wifi: ieee80211: Add helpers to fetch EMLSR delay and timeout values
Add helpers to get EMLSR transition delay, padding delay and transition timeout values from EML capabilities field of Multi-link Element. Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com> Link: https://patch.msgid.link/20250327051320.3253783-4-quic_ramess@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
14e0f59a88
commit
91ea0489dc
@ -5618,6 +5618,80 @@ static inline bool ieee80211_tid_to_link_map_size_ok(const u8 *data, size_t len)
|
||||
return len >= fixed + elem_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_emlsr_pad_delay_in_us - Fetch the EMLSR Padding delay
|
||||
* in microseconds
|
||||
* @eml_cap: EML capabilities field value from common info field of
|
||||
* the Multi-link element
|
||||
* Return: the EMLSR Padding delay (in microseconds) encoded in the
|
||||
* EML Capabilities field
|
||||
*/
|
||||
|
||||
static inline u32 ieee80211_emlsr_pad_delay_in_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);
|
||||
|
||||
if (!pad_delay ||
|
||||
pad_delay > IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_256US)
|
||||
return 0;
|
||||
|
||||
return 32 * (1 << (pad_delay - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_emlsr_trans_delay_in_us - Fetch the EMLSR Transition
|
||||
* delay in microseconds
|
||||
* @eml_cap: EML capabilities field value from common info field of
|
||||
* the Multi-link element
|
||||
* Return: the EMLSR Transition delay (in microseconds) encoded in the
|
||||
* EML Capabilities field
|
||||
*/
|
||||
|
||||
static inline u32 ieee80211_emlsr_trans_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));
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_eml_trans_timeout_in_us - Fetch the EMLSR Transition
|
||||
* timeout value in microseconds
|
||||
* @eml_cap: EML capabilities field value from common info field of
|
||||
* the Multi-link element
|
||||
* Return: the EMLSR Transition timeout (in microseconds) encoded in
|
||||
* the EML Capabilities field
|
||||
*/
|
||||
|
||||
static inline u32 ieee80211_eml_trans_timeout_in_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);
|
||||
|
||||
/* invalid values also just use 0 */
|
||||
if (!timeout || timeout > IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU)
|
||||
return 0;
|
||||
|
||||
return 128 * (1 << (timeout - 1));
|
||||
}
|
||||
|
||||
#define for_each_mle_subelement(_elem, _data, _len) \
|
||||
if (ieee80211_mle_size_ok(_data, _len)) \
|
||||
for_each_element(_elem, \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user