casaroli commented on code in PR #21319:
URL: https://github.com/apache/nuttx/pull/21319#discussion_r4456152621
##########
include/nuttx/wireless/ieee80211/ieee80211.h:
##########
@@ -4058,4 +4880,180 @@ enum ieee80211_range_params_max_total_ltf
IEEE80211_RANGE_PARAMS_MAX_TOTAL_LTF_UNSPECIFIED,
};
+/* Multi-link device */
+
+#define IEEE80211_MLD_MAX_NUM_LINKS 15
+
+begin_packed_struct struct ieee80211_rnr_mld_params
+{
+ uint8_t mld_id;
+ uint16_t params;
+}
+end_packed_struct;
+
+#define IEEE80211_RNR_MLD_PARAMS_LINK_ID 0x000F
+#define IEEE80211_RNR_MLD_PARAMS_BSS_CHANGE_COUNT 0x0FF0
+#define IEEE80211_RNR_MLD_PARAMS_UPDATES_INCLUDED 0x1000
+#define IEEE80211_RNR_MLD_PARAMS_DISABLED_LINK 0x2000
+
+begin_packed_struct struct ieee80211_tbtt_info_7_8_9
+{
+ uint8_t tbtt_offset;
+ uint8_t bssid[ETH_ALEN];
+ uint8_t bss_params;
+ int8_t psd_20;
+}
+end_packed_struct;
+
+begin_packed_struct struct ieee80211_tbtt_info_ge_11
+{
+ uint8_t tbtt_offset;
+ uint8_t bssid[ETH_ALEN];
+ uint32_t short_ssid;
+ uint8_t bss_params;
+ int8_t psd_20;
+ struct ieee80211_rnr_mld_params mld_params;
+ struct ieee80211_enh_crit_upd enh_crit_upd;
+}
+end_packed_struct;
+
+/* ieee80211_s1g_check_tim - Check whether an AID bit is set in an S1G TIM.
+ * tim: The S1G TIM information element.
+ * tim_len: Length of the TIM information element.
+ * aid: The AID to check.
+ */
+
+static inline bool
+ieee80211_s1g_check_tim(FAR const struct ieee80211_tim_ie *tim,
+ uint8_t tim_len, uint16_t aid)
+{
+ FAR const uint8_t *ptr;
+ FAR const uint8_t *end;
+ uint8_t target_block;
+ uint8_t target_subblock;
+ uint8_t target_bit;
+
+ if (!tim || tim_len < 3)
+ {
+ return false;
+ }
+
+ target_block = (aid >> 6) & 0x1f;
+ target_subblock = (aid >> 3) & 0x7;
+ target_bit = aid & 0x7;
+ ptr = tim->virtual_map;
+ end = (FAR const uint8_t *)tim + tim_len + 2;
Review Comment:
`end` is 2 bytes after the TIM element. `tim_len` is the length of the
element body (`__ieee80211_check_tim()` above uses it so, and Linux sets `end =
(const u8 *)tim + tim_len`). With a 3-byte TIM body and the next element's
bytes `01 05` after it, `ieee80211_s1g_check_tim(tim, 3, 5)` returns true: it
reads the next element as an encoded block for AID 5.
Fix: `end = (FAR const uint8_t *)tim + tim_len;`
##########
include/nuttx/wireless/ieee80211/ieee80211.h:
##########
@@ -2459,15 +2843,15 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap
*cap,
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_RESERVED 0xc0
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_MASK 0xc0
Review Comment:
Linux calls these macros `IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_*`; here
they are `NOMIMAL`, so code ported from Linux that uses them does not compile.
Fix: use the `NOMINAL` names, and keep the `NOMIMAL` names as aliases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]