Add helpers to get EMLSR transition delay, padding delay and transition timeout values from EML capabilities field of Multi-link Element.
Unified · Split
| @@ -5618,6 +5618,80 @@ static inline bool ieee80211_tid_to_link_map_size_ok(const u8 *data, size_t len) · 5617 unmodified lines | ||
| 5618 | 5618 | return len >= fixed + elem_len; |
| 5619 | 5619 | } |
| 5620 | 5620 | |
| 5621 | +/** | |
| 5622 | + * ieee80211_emlsr_pad_delay_in_us - Fetch the EMLSR Padding delay | |
| 5623 | + * in microseconds | |
| 5624 | + * @eml_cap: EML capabilities field value from common info field of | |
| 5625 | + * the Multi-link element | |
| 5626 | + * Return: the EMLSR Padding delay (in microseconds) encoded in the | |
| 5627 | + * EML Capabilities field | |
| 5628 | + */ | |
| 5629 | + | |
| 5630 | +static inline u32 ieee80211_emlsr_pad_delay_in_us(u16 eml_cap) | |
| 5631 | +{ | |
| 5632 | + /* IEEE Std 802.11be-2024 Table 9-417i—Encoding of the EMLSR | |
| 5633 | + * Padding Delay subfield. | |
| 5634 | + */ | |
| 5635 | + u32 pad_delay = u16_get_bits(eml_cap, | |
| 5636 | + IEEE80211_EML_CAP_EMLSR_PADDING_DELAY); | |
| 5637 | + | |
| 5638 | + if (!pad_delay || | |
| 5639 | + pad_delay > IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_256US) | |
| 5640 | + return 0; | |
| 5641 | + | |
| 5642 | + return 32 * (1 << (pad_delay - 1)); | |
| 5643 | +} | |
| 5644 | + | |
| 5645 | +/** | |
| 5646 | + * ieee80211_emlsr_trans_delay_in_us - Fetch the EMLSR Transition | |
| 5647 | + * delay in microseconds | |
| 5648 | + * @eml_cap: EML capabilities field value from common info field of | |
| 5649 | + * the Multi-link element | |
| 5650 | + * Return: the EMLSR Transition delay (in microseconds) encoded in the | |
| 5651 | + * EML Capabilities field | |
| 5652 | + */ | |
| 5653 | + | |
| 5654 | +static inline u32 ieee80211_emlsr_trans_delay_in_us(u16 eml_cap) | |
| 5655 | +{ | |
| 5656 | + /* IEEE Std 802.11be-2024 Table 9-417j—Encoding of the EMLSR | |
| 5657 | + * Transition Delay subfield. | |
| 5658 | + */ | |
| 5659 | + u32 trans_delay = | |
| 5660 | + u16_get_bits(eml_cap, | |
| 5661 | + IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY); | |
| 5662 | + | |
| 5663 | + /* invalid values also just use 0 */ | |
| 5664 | + if (!trans_delay || | |
| 5665 | + trans_delay > IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_256US) | |
| 5666 | + return 0; | |
| 5667 | + | |
| 5668 | + return 16 * (1 << (trans_delay - 1)); | |
| 5669 | +} | |
| 5670 | + | |
| 5671 | +/** | |
| 5672 | + * ieee80211_eml_trans_timeout_in_us - Fetch the EMLSR Transition | |
| 5673 | + * timeout value in microseconds | |
| 5674 | + * @eml_cap: EML capabilities field value from common info field of | |
| 5675 | + * the Multi-link element | |
| 5676 | + * Return: the EMLSR Transition timeout (in microseconds) encoded in | |
| 5677 | + * the EML Capabilities field | |
| 5678 | + */ | |
| 5679 | + | |
| 5680 | +static inline u32 ieee80211_eml_trans_timeout_in_us(u16 eml_cap) | |
| 5681 | +{ | |
| 5682 | + /* IEEE Std 802.11be-2024 Table 9-417m—Encoding of the | |
| 5683 | + * Transition Timeout subfield. | |
| 5684 | + */ | |
| 5685 | + u8 timeout = u16_get_bits(eml_cap, | |
| 5686 | + IEEE80211_EML_CAP_TRANSITION_TIMEOUT); | |
| 5687 | + | |
| 5688 | + /* invalid values also just use 0 */ | |
| 5689 | + if (!timeout || timeout > IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU) | |
| 5690 | + return 0; | |
| 5691 | + | |
| 5692 | + return 128 * (1 << (timeout - 1)); | |
| 5693 | +} | |
| 5694 | + | |
| 5621 | 5695 | #define for_each_mle_subelement(_elem, _data, _len) \ |
| 5622 | 5696 | if (ieee80211_mle_size_ok(_data, _len)) \ |
| 5623 | 5697 | for_each_element(_elem, \ |