On 2/28/2025 6:06 PM, Johannes Berg wrote:
On Fri, 2025-01-17 at 22:34 +0530, Rameshkumar Sundaram wrote:
+static u32 ath12k_wmi_get_emlsr_pad_delay_us(u16 eml_cap)
+{
+ /* IEEE Std 802.11be-2024 Table 9-417i—Encoding of the EMLSR
+ * Padding Delay subfield.
+ */
+ u32 pad_delay = u16_get_bits(eml_cap, IEEE80211_EML_CAP_EMLSR_PADDING_DELAY);
+ static const u32 pad_delay_us[EMLSR_PAD_DELAY_MAX] = {0, 32, 64, 128, 256};
+
+ if (pad_delay >= EMLSR_PAD_DELAY_MAX)
+ return 0;
+
+ return pad_delay_us[pad_delay];
+}
+
+static u32 ath12k_wmi_get_emlsr_trans_delay_us(u16 eml_cap)
+{
+ /* IEEE Std 802.11be-2024 Table 9-417j—Encoding of the EMLSR
+ * Transition Delay subfield.
+ */
+ u32 trans_delay = u16_get_bits(eml_cap,
+ IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY);
+ static const u32 trans_delay_us[EMLSR_TRANS_DELAY_MAX] = {
+ 0, 16, 32, 64, 128, 256
+ };
+
+ if (trans_delay >= EMLSR_TRANS_DELAY_MAX)
+ return 0;
+
+ return trans_delay_us[trans_delay];
+}
+
+static u32 ath12k_wmi_get_emlsr_trans_timeout_us(u16 eml_cap)
+{
+ /* IEEE Std 802.11be-2024 Table 9-417m—Encoding of the
+ * Transition Timeout subfield.
+ */
+ u8 timeout = u16_get_bits(eml_cap, IEEE80211_EML_CAP_TRANSITION_TIMEOUT);
+ static const u32 trans_timeout_us[EML_TRANS_TIMEOUT_MAX] = {
+ 0, 128, 256, 512,
+ TU_TO_USEC(1),
+ TU_TO_USEC((1U << 1)),
+ TU_TO_USEC((1U << 2)),
+ TU_TO_USEC((1U << 3)),
+ TU_TO_USEC((1U << 4)),
+ TU_TO_USEC((1U << 5)),
+ TU_TO_USEC((1U << 6)),
+ };
+
+ if (timeout >= EML_TRANS_TIMEOUT_MAX)
+ return 0;
+
+ return trans_timeout_us[timeout];
+}
Some of these should probably be in ieee80211.h, and also - making a
Sure, will move all three get helpers to ieee80211.h and use it in driver.
table of shifted values? That seems ... awkward at best?
static inline u32 ieee80211_emlsr_delay_in_us(u16 eml_cap)
{
/* IEEE Std 802.11be-2024 Table 9-417j—Encoding of the EMLSR
* Transition Delay subfield.
*/
u32 trans_delay = u16_get_bits(eml_cap,
IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY);
/* invalid values also just use 0 */
if (!trans_delay ||
trans_delay > IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_256US)
return 0;
return 16 * (1 << (trans_delay - 1));
}
seems a lot more effective?
Thanks for the suggestion, will remove the lookup tables and do direct
computation.
johannes
--
--
Ramesh