| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/26 05:47 | flow | patch-triage |
5mArgs:null Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_set_smd_ctx",
"nl80211_get_smd_ctx",
"nl80211_parse_smd_ctx",
"nl80211_put_smd_ctx",
"cfg80211_free_pending_smd_ctx_req",
"cfg80211_get_smd_ctx_done",
"sta_info_move_smd_state",
"sta_info_reset_smd_state",
"sta_info_move_drv_smd_state",
"drv_sta_smd_state"
],
"KMSANReasoning": "The patch series introduces support for IEEE 802.11bn / UHR Seamless Mobility Domain (SMD) and BSS Transition procedures into cfg80211, mac80211, and nl80211.\n\nA careful examination of KMSAN vs KASAN applicability reveals:\n1. Heap Allocations:\n - `struct ieee80211_smd_ctx` in `nl80211_parse_smd_ctx()` is allocated using `kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL)`.\n - `struct cfg80211_smd_get_ctx_pending` in `nl80211_get_smd_ctx()` is allocated using `kzalloc_obj(*pending)`.\n - `struct sta_info` instances are allocated via `kzalloc()` in mac80211.\n All heap-allocated structures are fully zeroed upon allocation.\n\n2. Stack Variables:\n - Stack-allocated `struct cfg80211_rx_info info` instances across all callsites (`cfg80211_rx_mgmt_khz()`, `cfg80211_rx_mgmt()`, and `ieee80211_rx_h_userspace_mgmt()`) use C99 designated initializers (e.g. `= { .st_info.ctx = NULL }`), which zero out all unmentioned members.\n - Stack-allocated `struct ieee80211_rx_data rx = {}` in `ieee80211_rx_list()` is zero-initialized.\n - Stack-allocated `struct station_parameters params` in `nl80211_set_station()` and `nl80211_new_station()` are cleared using `memset(\u0026params, 0, sizeof(params))`.\n - In virtual/hardware drivers (e.g. `mac80211_hwsim`), `struct ieee80211_rx_status` instances are initialized using `memset(\u0026rx_status, 0, sizeof(rx_status))`, ensuring `smd_ctx_valid` is 0.\n\n3. Kernel-to-Userspace Data Transfer:\n - In `nl80211_put_smd_ctx()`, attributes are serialized to netlink messages exclusively using individual scalar helpers (`nla_put_u8()`, `nla_put_u16()`) or sized binary attributes with known payload length (`nla_put(..., ctx-\u003epn_len, ...)`). No raw kernel structs with uninitialized padding or hole bytes are copied to user space.\n\n4. Other Potential Bugs:\n - Any risks in this patch series involve potential locking issues (protected by `smd_get_ctx_lock` and wiphy mutex, covered by LOCKDEP) or pointer/buffer handling (covered by KASAN).\n\nBecause no uninitialized memory reads or information leak risks are introduced or exposed, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false,
"Reasoning": "The patch series adds support for IEEE 802.11bn Ultra High Reliability (UHR) Seamless Mobility Domain (SMD) BSS Transition to cfg80211 and mac80211. It introduces new user-accessible netlink commands (NL80211_CMD_SET_SMD_CTX and NL80211_CMD_GET_SMD_CTX), complex nested netlink attribute parsing and serialization routines, SMD station state machine management with multiple WARN_ON checks, and asynchronous pending request tracking. These paths are reachable from userspace via nl80211 and emulated wireless devices like mac80211_hwsim, making them well-suited for fuzzing.",
"WorthFuzzing": true
} |
| 1/1 | 2026/09/26 05:47 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 5cfe055d5f8b97d7088e07d7da2a7f059bc02d0d\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sat Sep 26 05:47:17 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/ieee80211-uhr.h b/include/linux/ieee80211-uhr.h\nindex 19e9260d0db80..e74de842b281d 100644\n--- a/include/linux/ieee80211-uhr.h\n+++ b/include/linux/ieee80211-uhr.h\n@@ -589,6 +589,10 @@ ieee80211_uhr_dbe_cap(const struct ieee80211_uhr_cap *cap)\n #define IEEE80211_SMD_INFO_CAPA_TYPE\t\t\t0x10\n #define IEEE80211_SMD_INFO_CAPA_PTK_PER_AP_MLD\t\t0x20\n \n+/* IEEE P802.11bn/D2.0, Aug 2026, subclause 9.4.2.363 */\n+#define IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN\t\t2 /* in 64 TUs */\n+#define IEEE80211_SMD_INFO_NUM_PREP_AP_MAX\t\t7\n+\n struct ieee80211_smd_info {\n \tu8 id[ETH_ALEN];\n \tu8 capa;\n@@ -645,6 +649,92 @@ struct ieee80211_uhr_mode_change_tuple {\n \tu8 variable[];\n } __packed;\n \n+/*\n+ * Context information carried in SMD BSS Transition (refer IEEE P802.11bn/D2.0,\n+ * Aug 2026, subclause 37.16.9.\n+ */\n+#define IEEE80211_SMD_CTX_NUM_VALID_CTX 8\n+\n+#define IEEE80211_SMD_CTX_VALID_DL_SN 0\n+#define IEEE80211_SMD_CTX_VALID_UL_SN 1\n+#define IEEE80211_SMD_CTX_VALID_PN 2\n+#define IEEE80211_SMD_CTX_VALID_BA_PARAMS 3\n+/* Positions 4 to 7 are reserved */\n+\n+/*\n+ * Data TIDs transported in the context, IEEE P802.11bn/D2.0, Aug 2026,\n+ * subclause 9.4.2.364.\n+ */\n+#define IEEE80211_SMD_CTX_NUM_TIDS 8\n+\n+#define IEEE80211_SMD_CTX_MAX_PN_LEN 16\n+\n+/**\n+ * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL\n+ *\n+ * @amsdu_supported: Peer's capability to support A-MSDU within A-MPDU.\n+ * @ba_policy: BlockAck policy (0 = delayed BlockAck, 1 = immediate BlockAck)\n+ * @buffer_size: Reorder buffer size from ADDBA Request (10-bit, max 1023)\n+ * @timeout: BlockAck session timeout\n+ * @ext_no_frag: ADDBA Extension fragmentation support\n+ * @extfrag_level: ADDBA Extension HE fragmentation level\n+ * @ext_buffer_size: ADDBA Extension buffer size; combined with @buffer_size as\n+ *\t(@ext_buffer_size \u003c\u003c 10 | @buffer_size) to get the full reorder\n+ *\tbuffer size\n+ */\n+struct ieee80211_smd_ctx_ba {\n+\tbool amsdu_supported;\n+\tu8 ba_policy;\n+\tu16 buffer_size;\n+\tu16 timeout;\n+\tbool ext_no_frag;\n+\tu8 extfrag_level;\n+\tu16 ext_buffer_size;\n+};\n+\n+/**\n+ * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer\n+ *\tIEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)\n+ *\n+ * @valid_ctx_bmap: Bitmap indicating which context fields are valid;\n+ *\tbit positions defined by IEEE80211_SMD_CTX_VALID_* constants\n+ * @pn_len: Length of PN in bytes; varies by cipher type\n+ *\t(e.g. CCMP (6), GCMP-256 (16))\n+ * @dl: Down-link context data\n+ * @dl.valid_tid_bmap: valid DL TIDs for which context is present\n+ * @dl.sn: DL SN per-TID to be assigned next\n+ * @dl.pn: DL PN to be assigned next\n+ * @dl.ba: DL BlockAck parameters per-TID for the BlockAck session\n+ * @ul: Up-link context data\n+ * @ul.valid_tid_bmap: valid UL TIDs for which context is present\n+ * @ul.sn: UL SN per-TID to be checked next\n+ * @ul.pn: UL PN per-TID to be checked next\n+ * @ul.ba: UL BlockAck parameters per-TID for the BlockAck session\n+ * @drv_ctx_size: Number of valid bytes in @drv_ctx.\n+ * @drv_ctx: Variable-sized array of driver-specific context, counted by\n+ *\t@drv_ctx_size. Opaque to the wireless core; interpreted by drivers.\n+ */\n+struct ieee80211_smd_ctx {\n+\tDECLARE_BITMAP(valid_ctx_bmap, IEEE80211_SMD_CTX_NUM_VALID_CTX);\n+\tu8 pn_len;\n+\n+\tstruct {\n+\t\tDECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);\n+\t\tu16 sn[IEEE80211_SMD_CTX_NUM_TIDS];\n+\t\tu8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN];\n+\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\n+\t} dl;\n+\tstruct {\n+\t\tDECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);\n+\t\tu16 sn[IEEE80211_SMD_CTX_NUM_TIDS];\n+\t\tu8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN];\n+\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\n+\t} ul;\n+\n+\tsize_t drv_ctx_size;\n+\tu8 drv_ctx[] ____cacheline_aligned __counted_by(drv_ctx_size);\n+};\n+\n static inline int\n ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tuple *tuple)\n {\n@@ -653,6 +743,65 @@ ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tupl\n \t\t\t IEEE80211_UHR_MODE_CHANGE_CONTROL_MODE_LENGTH);\n }\n \n+/**\n+ * ieee80211_is_uhr_link_reconf_req - check if frame is UHR Link Reconf Request\n+ * @skb: the SKB to check\n+ * Return: whether or not the frame is a UHR Link Reconf Request frame\n+ */\n+static inline bool ieee80211_is_uhr_link_reconf_req(struct sk_buff *skb)\n+{\n+\tstruct ieee80211_mgmt *mgmt = (void *)skb-\u003edata;\n+\tu8 category, action;\n+\n+\tif (!ieee80211_is_action(mgmt-\u003eframe_control))\n+\t\treturn false;\n+\n+\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))\n+\t\treturn false;\n+\n+\tcategory = mgmt-\u003eu.action.category;\n+\taction = mgmt-\u003eu.action.action_code;\n+\n+\treturn category == WLAN_CATEGORY_PROTECTED_UHR \u0026\u0026\n+\t action == IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_REQUEST;\n+}\n+\n+/**\n+ * ieee80211_is_st_prep_req - check if frame is ST Preparation Request\n+ * @skb: the SKB to check\n+ * Return: whether or not the frame is an ST Prep request frame\n+ */\n+static inline bool ieee80211_is_st_prep_req(struct sk_buff *skb)\n+{\n+\tstruct ieee80211_mgmt *mgmt = (void *)skb-\u003edata;\n+\tu8 type;\n+\n+\tif (!ieee80211_is_uhr_link_reconf_req(skb))\n+\t\treturn false;\n+\n+\ttype = mgmt-\u003eu.action.uhr_link_reconf_req.type;\n+\n+\treturn type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_PREP;\n+}\n+\n+/**\n+ * ieee80211_is_st_exec_req - check if frame is ST Execution Request\n+ * @skb: the SKB to check\n+ * Return: whether or not the frame is an ST Exec request frame\n+ */\n+static inline bool ieee80211_is_st_exec_req(struct sk_buff *skb)\n+{\n+\tstruct ieee80211_mgmt *mgmt = (void *)skb-\u003edata;\n+\tu8 type;\n+\n+\tif (!ieee80211_is_uhr_link_reconf_req(skb))\n+\t\treturn false;\n+\n+\ttype = mgmt-\u003eu.action.uhr_link_reconf_req.type;\n+\n+\treturn type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC;\n+}\n+\n #define for_each_uhr_mode_change_tuple(data, len, tuple)\t\t\\\n \tfor (tuple = (const void *)(data);\t\t\t\t\\\n \t (len) - ((const u8 *)tuple - (data)) \u003e= sizeof(*tuple) \u0026\u0026\t\\\ndiff --git a/include/net/cfg80211.h b/include/net/cfg80211.h\nindex 9aa7d2d4a1841..71711dbbf7495 100644\n--- a/include/net/cfg80211.h\n+++ b/include/net/cfg80211.h\n@@ -1587,6 +1587,29 @@ struct cfg80211_s1g_short_beacon {\n \tsize_t short_tail_len;\n };\n \n+/**\n+ * struct cfg80211_smd_params - Seamless Mobility Domain parameters\n+ *\n+ * @smd_enabled: SMD is enabled on this device\n+ * @smd_identifier: SMD ID (ETH_ALEN bytes)\n+ * @smd_timeout: timeout in 64 TUs for ST Preparation\n+ * @dl_data_fwd: MSDU forwarding supported\n+ * @max_num_of_peer_apmlds: max prepared AP MLDs supported (0-7)\n+ * @smd_type: SMD type\n+ * @ptk_mode: PTK mode\n+ * @neighbor_probing: UHR Neighboring AP Probing supported\n+ */\n+struct cfg80211_smd_params {\n+\tbool smd_enabled;\n+\tu8 smd_identifier[ETH_ALEN];\n+\tu16 smd_timeout;\n+\tbool dl_data_fwd;\n+\tu8 max_num_of_peer_apmlds;\n+\tenum nl80211_smd_type smd_type;\n+\tenum nl80211_smd_ptk_mode ptk_mode;\n+\tbool neighbor_probing;\n+};\n+\n /**\n * struct cfg80211_ap_settings - AP configuration\n *\n@@ -1623,6 +1646,7 @@ struct cfg80211_s1g_short_beacon {\n * @mbssid_config: AP settings for multiple bssid\n * @s1g_long_beacon_period: S1G long beacon period\n * @s1g_short_beacon: S1G short beacon data\n+ * @smd_params: Seamless Mobility Domain (SMD) parameters\n */\n struct cfg80211_ap_settings {\n \tstruct cfg80211_chan_def chandef;\n@@ -1655,6 +1679,7 @@ struct cfg80211_ap_settings {\n \tstruct cfg80211_mbssid_config mbssid_config;\n \tu8 s1g_long_beacon_period;\n \tstruct cfg80211_s1g_short_beacon s1g_short_beacon;\n+\tstruct cfg80211_smd_params smd_params;\n };\n \n \n@@ -1872,6 +1897,21 @@ struct cfg80211_ttlm_params {\n \tu16 ulink[8];\n };\n \n+/**\n+ * struct cfg80211_sta_smd_params - SMD parameters for an added station\n+ *\n+ * @smd_sta: SMD-negotiated STA\n+ * @smd_identifier: SMD Identifier\n+ * @dl_data_fwd: MSDU forwarding supported\n+ * @roam_sta: station was created via SMD BSS Transition procedure\n+ */\n+struct cfg80211_sta_smd_params {\n+\tbool smd_sta;\n+\tu8 smd_identifier[ETH_ALEN];\n+\tbool dl_data_fwd;\n+\tbool roam_sta;\n+};\n+\n /**\n * struct station_parameters - station parameters\n *\n@@ -1912,6 +1952,7 @@ struct cfg80211_ttlm_params {\n * @link_sta_params: link related params.\n * @epp_peer: EPP peer indication\n * @nmi_mac: MAC address of the NMI station of the NAN peer\n+ * @smd_params: SMD params for this station\n */\n struct station_parameters {\n \tstruct net_device *vlan;\n@@ -1940,6 +1981,7 @@ struct station_parameters {\n \tstruct link_station_parameters link_sta_params;\n \tbool epp_peer;\n \tconst u8 *nmi_mac;\n+\tstruct cfg80211_sta_smd_params smd_params;\n };\n \n /**\n@@ -4847,6 +4889,27 @@ struct mgmt_frame_regs {\n \tu32 global_mcast_stypes, interface_mcast_stypes;\n };\n \n+/**\n+ * struct cfg80211_smd_transition_info - SMD BSS Transition info\n+ *\n+ * @ctx: Dynamic context to be transferred as part of ST\n+ * @type: Type of ST indication\n+ */\n+struct cfg80211_smd_transition_info {\n+\tstruct ieee80211_smd_ctx *ctx;\n+\tenum nl80211_smd_ctx_type type;\n+};\n+\n+/**\n+ * struct cfg80211_smd_get_ctx_pending - pending async GET_SMD_CTX request\n+ * @list: linkage on wireless_dev::smd_get_ctx_pending_list\n+ * @sta_addr: non-AP MLD address for which context was requested\n+ */\n+struct cfg80211_smd_get_ctx_pending {\n+\tstruct list_head list;\n+\tu8 sta_addr[ETH_ALEN];\n+};\n+\n /**\n * struct cfg80211_ops - backend description for wireless configuration\n *\n@@ -5278,6 +5341,12 @@ struct mgmt_frame_regs {\n *\n * @start_pd: Start the PD interface.\n * @stop_pd: Stop the PD interface.\n+ *\n+ * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info-\u003ectx is\n+ *\tfreed immediately after this call returns; drivers must copy\n+ *\t@st_info-\u003ectx if asynchronous processing is required.\n+ *\n+ * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD.\n */\n struct cfg80211_ops {\n \tint\t(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);\n@@ -5656,6 +5725,12 @@ struct cfg80211_ops {\n \t\t\t bool val);\n \tint\t(*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\n \tvoid\t(*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\n+\tint\t(*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\n+\t\t\t const u8 *addr,\n+\t\t\t struct cfg80211_smd_transition_info *st_info);\n+\tint\t(*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\n+\t\t\t const u8 *addr,\n+\t\t\t enum nl80211_smd_ctx_type type);\n };\n \n /*\n@@ -7228,6 +7303,8 @@ enum ieee80211_ap_reg_power {\n * @links.cac_time_ms: CAC time in ms\n * @valid_links: bitmap describing what elements of @links are valid\n * @radio_mask: Bitmask of radios that this interface is allowed to operate on.\n+ * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests.\n+ * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests.\n */\n struct wireless_dev {\n \tstruct wiphy *wiphy;\n@@ -7347,6 +7424,10 @@ struct wireless_dev {\n \t} links[IEEE80211_MLD_MAX_NUM_LINKS];\n \tu16 valid_links;\n \n+\t/* protects @smd_get_ctx_pending_list */\n+\tspinlock_t smd_get_ctx_lock;\n+\tstruct list_head smd_get_ctx_pending_list;\n+\n \tu32 radio_mask;\n };\n \n@@ -9504,6 +9585,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,\n * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds\n * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds\n * @no_sta: set if no station is known for the frame (relevant for MLD)\n+ * @st_info: SMD BSS Transition data\n */\n struct cfg80211_rx_info {\n \tint freq;\n@@ -9516,6 +9598,7 @@ struct cfg80211_rx_info {\n \tu64 rx_tstamp;\n \tu64 ack_tstamp;\n \tbool no_sta;\n+\tstruct cfg80211_smd_transition_info st_info;\n };\n \n /**\n@@ -11023,4 +11106,36 @@ void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,\n \t\t\t\t u32 signal_interference_bitmap,\n \t\t\t\t gfp_t gfp);\n \n+/**\n+ * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the\n+ *\tcfg80211_smd_get_ctx_pending list.\n+ * @wdev: wdev that maintains the list\n+ * @addr: if @addr is NULL, drain the entire list; otherwise, drain only the\n+ *\tmatching entries\n+ *\n+ * When the current AP MLD requests the station's context, those requests are\n+ * maintained in a pending list until drivers notify completion. In case the\n+ * device is brought down or the station is removed prematurely, free up the\n+ * remaining entries in the list.\n+ */\n+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\n+\t\t\t\t const u8 *addr);\n+\n+/**\n+ * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211\n+ * @wdev: wireless device that handled the request\n+ * @sta_addr: non-AP MLD address the context was collected for\n+ * @st_info: SMD BSS Transition Info (set @st_info-\u003ectx to NULL to indicate\n+ *\tfailure)\n+ *\n+ * Called via ieee80211_get_smd_ctx_done after async driver context collection\n+ * completes. Finds the matching pending request and sends a multicast\n+ * %NL80211_CMD_SMD_CTX_EVENT reply to userspace (MLME group).\n+ *\n+ * Return: None\n+ */\n+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\n+\t\t\t const u8 *sta_addr,\n+\t\t\t struct cfg80211_smd_transition_info *st_info);\n+\n #endif /* __NET_CFG80211_H */\ndiff --git a/include/net/mac80211.h b/include/net/mac80211.h\nindex 1172d7b83ed18..6a26823799d45 100644\n--- a/include/net/mac80211.h\n+++ b/include/net/mac80211.h\n@@ -797,6 +797,7 @@ struct ieee80211_bss_npca_params {\n * @s1g_long_beacon_period: number of beacon intervals between each long\n *\tbeacon transmission.\n * @npca: NPCA parameters\n+ * @smd_params: SMD parameters\n */\n struct ieee80211_bss_conf {\n \tstruct ieee80211_vif *vif;\n@@ -904,6 +905,7 @@ struct ieee80211_bss_conf {\n \tu8 s1g_long_beacon_period;\n \n \tstruct ieee80211_bss_npca_params npca;\n+\tstruct cfg80211_smd_params smd_params;\n };\n \n #define IEEE80211_NAN_MAX_CHANNELS 3\n@@ -1733,6 +1735,10 @@ enum mac80211_rx_encoding {\n * @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only\n *\tneeded for Timing measurement and Fine timing measurement action frames.\n *\tOnly reported by devices that have timestamping enabled.\n+ * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information.\n+ *\tOnly needed for ST Preparation Request and ST Execution Request action\n+ *\tframes. The pointer will be consumed by mac80211; must be kmalloc-ed.\n+ *\tIndicated by @smd_ctx_valid.\n * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use\n *\tit but can store it and pass it back to the driver for synchronisation\n * @band: the active band when this frame was received\n@@ -1773,12 +1779,15 @@ enum mac80211_rx_encoding {\n * @link_id: id of the link used to receive the packet. Set and used by\n *\tmac80211 internally, it uses @freq set by the driver to identify the\n *\tcorrect link per vif.\n+ * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag\n+ *\tis used only for ST Preparation or ST Execution Request frames.\n */\n struct ieee80211_rx_status {\n \tu64 mactime;\n \tunion {\n \t\tu64 boottime_ns;\n \t\tktime_t ack_tx_hwtstamp;\n+\t\tstruct ieee80211_smd_ctx *smd_ctx;\n \t};\n \tu32 device_timestamp;\n \tu32 ampdu_reference;\n@@ -1812,7 +1821,8 @@ struct ieee80211_rx_status {\n \tu8 chains;\n \ts8 chain_signal[IEEE80211_MAX_CHAINS];\n \tu8 zero_length_psdu_type;\n-\tu8 link_id:4;\n+\tu8 link_id:4,\n+\t smd_ctx_valid:1;\n };\n \n static_assert(sizeof(struct ieee80211_rx_status) \u003c= sizeof_field(struct sk_buff, cb));\n@@ -2724,6 +2734,7 @@ struct ieee80211_link_sta {\n * @nan_sched: NAN peer schedule for this station. Valid only for NMI stations.\n * @ext_mld_capa_ops: the MLD's extended MLD capabilities and operations\n *\tNOTE: currently only tracked for AP STAs\n+ * @smd_params: SMD parameters of the STA\n */\n struct ieee80211_sta {\n \tu8 addr[ETH_ALEN] __aligned(2);\n@@ -2758,6 +2769,8 @@ struct ieee80211_sta {\n \t/* should only be accessed with the wiphy mutex held */\n \tstruct ieee80211_nan_peer_sched *nan_sched;\n \n+\tstruct cfg80211_sta_smd_params smd_params;\n+\n \t/* must be last */\n \tu8 drv_priv[] __aligned(sizeof(void *));\n };\n@@ -3958,6 +3971,19 @@ enum ieee80211_ampdu_mlme_action {\n #define IEEE80211_AMPDU_TX_START_IMMEDIATE 1\n #define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2\n \n+/**\n+ * enum ieee80211_ba_policy - BlockAck Policy\n+ *\n+ * @IEEE80211_BLOCKACK_DELAYED: Block ACK sent to the BAR sender in next TXOP\n+ * @IEEE80211_BLOCKACK_IMMEDIATE: Block ACK sent to the BAR sender immediately\n+ *\n+ * This field is valid only for %IEEE80211_AMPDU_RX_START.\n+ */\n+enum ieee80211_ba_policy {\n+\tIEEE80211_BLOCKACK_DELAYED,\n+\tIEEE80211_BLOCKACK_IMMEDIATE,\n+};\n+\n /**\n * struct ieee80211_ampdu_params - AMPDU action parameters\n *\n@@ -3970,6 +3996,7 @@ enum ieee80211_ampdu_mlme_action {\n * @buf_size: reorder buffer size (number of subframes). Valid only when the\n *\taction is set to %IEEE80211_AMPDU_RX_START or\n *\t%IEEE80211_AMPDU_TX_OPERATIONAL\n+ * @policy: BlockAck policy of type \u0026enum ieee80211_ba_policy\n * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.\n *\tvalid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL\n * @timeout: BA session timeout. Valid only when the action is set to\n@@ -3981,6 +4008,7 @@ struct ieee80211_ampdu_params {\n \tu16 tid;\n \tu16 ssn;\n \tu16 buf_size;\n+\tenum ieee80211_ba_policy policy;\n \tbool amsdu;\n \tu16 timeout;\n };\n@@ -4071,6 +4099,24 @@ struct ieee80211_prep_tx_info {\n \tint link_id;\n };\n \n+/**\n+ * enum ieee80211_sta_smd_state - SMD BSS Transition sub-state\n+ *\n+ * Tracks the 802.11bn SMD BSS Transition sub-state (IEEE P802.11bn/D2.0,\n+ * Aug 2026, subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association.\n+ *\n+ * @IEEE80211_STA_SMD_NONE: Plain State 4. No sub-state active.\n+ * @IEEE80211_STA_SMD_PREP: State 4a. STA prepared at the target AP MLD\n+ * @IEEE80211_STA_SMD_EXEC: State 4b. ST execution active at the current AP MLD\n+ * @IEEE80211_STA_SMD_DRAIN: State 4c. DL draining period at the current AP MLD\n+ */\n+enum ieee80211_sta_smd_state {\n+\tIEEE80211_STA_SMD_NONE,\n+\tIEEE80211_STA_SMD_PREP,\n+\tIEEE80211_STA_SMD_EXEC,\n+\tIEEE80211_STA_SMD_DRAIN,\n+};\n+\n /**\n * struct ieee80211_ops - callbacks from mac80211 to the driver\n *\n@@ -4737,6 +4783,16 @@ struct ieee80211_prep_tx_info {\n * @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay\n *\tdriver according to the parameter received in the EML Operating mode\n *\tnotification frame.\n+ * @sta_smd_state: Notifies low level driver about IEEE 802.11bn SMD substate\n+ *\ttransition of a station. It must not fail while transitioning down.\n+ *\tThe callback can sleep.\n+ * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on\n+ *\tthe target AP MLD side to program dynamic context.\n+ * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in\n+ *\tthe current AP MLD side on behalf of the target AP MLD to collect\n+ *\tdynamic context, when the non-AP MLD sends ST Execute frame directly\n+ *\tto the target. Since the response is asynchronous, the drivers that\n+ *\timplement this should not store reference to @sta.\n */\n struct ieee80211_ops {\n \tvoid (*tx)(struct ieee80211_hw *hw,\n@@ -5138,6 +5194,17 @@ struct ieee80211_ops {\n \t\t\t struct ieee80211_vif *vif,\n \t\t\t struct ieee80211_sta *sta,\n \t\t\t struct ieee80211_eml_params *eml_params);\n+\tint (*sta_smd_state)(struct ieee80211_hw *hw,\n+\t\t\t struct ieee80211_vif *vif,\n+\t\t\t struct ieee80211_sta *sta,\n+\t\t\t enum ieee80211_sta_smd_state old_state,\n+\t\t\t enum ieee80211_sta_smd_state new_state);\n+\tint (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\n+\t\t\t struct ieee80211_sta *sta,\n+\t\t\t struct cfg80211_smd_transition_info *st_info);\n+\tint (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\n+\t\t\t struct ieee80211_sta *sta,\n+\t\t\t enum nl80211_smd_ctx_type type);\n };\n \n /**\n@@ -8207,4 +8274,15 @@ bool ieee80211_vif_nan_started(struct ieee80211_vif *vif);\n * Return: 0 if success and non-zero on error\n */\n int ieee80211_encrypt_tx_skb(struct sk_buff *skb);\n+\n+/**\n+ * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211\n+ * @vif: virtual interface\n+ * @sta_addr: non-AP MLD address the context was collected for\n+ * @st_info: SMD BSS Transition Info (set @st_info-\u003ectx to NULL to indicate\n+ *\tfailure)\n+ */\n+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\n+\t\t\t\tconst u8 *sta_addr,\n+\t\t\t\tstruct cfg80211_smd_transition_info *st_info);\n #endif /* MAC80211_H */\ndiff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h\nindex 9a2ccb8d66b86..8dd07751a3365 100644\n--- a/include/uapi/linux/nl80211.h\n+++ b/include/uapi/linux/nl80211.h\n@@ -1427,6 +1427,18 @@\n * @NL80211_CMD_STOP_PD: Stop the PD operation, identified by\n *\tits %NL80211_ATTR_WDEV interface.\n *\n+ * @NL80211_CMD_SET_SMD_CTX: Set the SMD BSS Transition dynamic context for a\n+ *\tnon-AP MLD sent from the current AP MLD on the target AP MLD managed by\n+ *\tan SMD-ME. This command carries %NL80211_ATTR_MLD_ADDR,\n+ *\t%NL80211_ATTR_SMD_CTX_TYPE and %NL80211_ATTR_SMD_CTX.\n+ * @NL80211_CMD_GET_SMD_CTX: Get the SMD BSS Transition dynamic context for a\n+ *\tnon-AP MLD associated to an AP MLD managed by an SMD-ME. This command\n+ *\tcarries %NL80211_ATTR_MLD_ADDR and %NL80211_ATTR_SMD_CTX_TYPE.\n+ * @NL80211_CMD_SMD_CTX_EVENT: Event reporting the collected SMD context\n+ *\t(requested via %NL80211_CMD_GET_SMD_CTX) to userspace. It carries\n+ *\t%NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_SMD_CTX_TYPE, and\n+ *\t%NL80211_ATTR_SMD_CTX.\n+ *\n * @NL80211_CMD_MAX: highest used command number\n * @__NL80211_CMD_AFTER_LAST: internal use\n */\n@@ -1705,6 +1717,10 @@ enum nl80211_commands {\n \tNL80211_CMD_START_PD,\n \tNL80211_CMD_STOP_PD,\n \n+\tNL80211_CMD_SET_SMD_CTX,\n+\tNL80211_CMD_GET_SMD_CTX,\n+\tNL80211_CMD_SMD_CTX_EVENT,\n+\n \t/* add new commands above here */\n \n \t/* used to define NL80211_CMD_MAX below */\n@@ -3190,6 +3206,35 @@ enum nl80211_commands {\n *\tknown station to transmit a frame. This is relevant to know whether\n *\tMLD address translation happened or to disable it when sending a frame.\n *\n+ * @NL80211_ATTR_SMD_PARAMS: Nested attribute to indicate support for Seamless\n+ *\tMobility Domain (SMD); it contains parameters to define capabilities of\n+ *\tan AP managed by an SMD-ME. Valid if the driver supports\n+ *\t%NL80211_EXT_FEATURE_SMD.\n+ *\tUsed with %NL80211_CMD_START_AP. See \u0026enum nl80211_smd_params_attrs.\n+ *\n+ * @NL80211_ATTR_PEER_SMD_ENABLED: Flag indicating a peer STA has SMD enabled.\n+ *\tUsed with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.\n+ *\n+ * @NL80211_ATTR_PEER_SMD_MAC_ADDR: Binary attribute with the 6-byte MAC\n+ *\taddress of the SMD-capable peer STA.\n+ *\tUsed with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.\n+ *\n+ * @NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING: Flag indicating the peer STA\n+ *\tsupports DL data forwarding within the SMD domain.\n+ *\tUsed with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.\n+ *\n+ * @NL80211_ATTR_SMD_ROAM_STA: Flag attribute indicating this station was\n+ *\tcreated via SMD BSS Transition Preparation at the Target AP MLD (refer\n+ *\tIEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.6).\n+ *\tThis flag is carried in %NL80211_CMD_NEW_STATION.\n+ *\n+ * @NL80211_ATTR_SMD_CTX: Nested attribute associated with UHR SMD BSS\n+ *\tTransition data. Used with %NL80211_CMD_SET_SMD_CTX and\n+ *\t%NL80211_CMD_SMD_CTX_EVENT. See \u0026enum nl80211_smd_ctx.\n+ * @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context.\n+ *\tUsed along with %NL80211_CMD_SET_SMD_CTX, %NL80211_CMD_GET_SMD_CTX,\n+ *\tand %NL80211_CMD_SMD_CTX_EVENT.\n+ *\n * @NUM_NL80211_ATTR: total number of nl80211_attrs available\n * @NL80211_ATTR_MAX: highest attribute number currently defined\n * @__NL80211_ATTR_AFTER_LAST: internal use\n@@ -3792,6 +3837,17 @@ enum nl80211_attrs {\n \n \tNL80211_ATTR_FRAME_NO_STA,\n \n+\tNL80211_ATTR_SMD_PARAMS,\n+\n+\tNL80211_ATTR_PEER_SMD_ENABLED,\n+\tNL80211_ATTR_PEER_SMD_MAC_ADDR,\n+\tNL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING,\n+\n+\tNL80211_ATTR_SMD_ROAM_STA,\n+\n+\tNL80211_ATTR_SMD_CTX,\n+\tNL80211_ATTR_SMD_CTX_TYPE,\n+\n \t/* add attributes here, update the policy in nl80211.c */\n \n \t__NL80211_ATTR_AFTER_LAST,\n@@ -3942,6 +3998,13 @@ enum nl80211_iftype {\n *\tthat support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a\n *\tpreviously added station into associated state\n * @NL80211_STA_FLAG_SPP_AMSDU: station supports SPP A-MSDUs\n+ * @NL80211_STA_FLAG_SMD: station has negotiated SMD.\n+ * @NL80211_STA_FLAG_SMD_PREP_TARGET: station is prepared at SMD target AP MLD\n+ *\t(State 4a).\n+ * @NL80211_STA_FLAG_SMD_EXEC_CURRENT: current AP MLD is executing SMD BSS\n+ *\tTransition (State 4b).\n+ * @NL80211_STA_FLAG_SMD_DL_DRAIN: current AP MLD is in DL draining period\n+ *\t(State 4c).\n * @NL80211_STA_FLAG_MAX: highest station flag number currently defined\n * @__NL80211_STA_FLAG_AFTER_LAST: internal use\n */\n@@ -3955,6 +4018,10 @@ enum nl80211_sta_flags {\n \tNL80211_STA_FLAG_TDLS_PEER,\n \tNL80211_STA_FLAG_ASSOCIATED,\n \tNL80211_STA_FLAG_SPP_AMSDU,\n+\tNL80211_STA_FLAG_SMD,\n+\tNL80211_STA_FLAG_SMD_PREP_TARGET,\n+\tNL80211_STA_FLAG_SMD_EXEC_CURRENT,\n+\tNL80211_STA_FLAG_SMD_DL_DRAIN,\n \n \t/* keep last */\n \t__NL80211_STA_FLAG_AFTER_LAST,\n@@ -7126,6 +7193,15 @@ enum nl80211_feature_flags {\n *\toffload in station mode, including Fast Transition or Opportunistic\n *\tKey Caching.\n *\n+ * @NL80211_EXT_FEATURE_SMD: Driver supports Seamless Mobility Domain (SMD)\n+ *\tand is managed by an SMD-ME to support SMD BSS Transition in AP mode\n+ *\tand supports association to an SMD-ME and SMD BSS transition in\n+ *\tnon-AP STA mode.\n+ *\n+ * @NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING: Driver supports forwarding of\n+ *\tbuffered downlink (DL) data packets in AP mode to the non-AP STA during\n+ *\tSMD BSS Transition.\n+ *\n * @NUM_NL80211_EXT_FEATURES: number of extended features.\n * @MAX_NL80211_EXT_FEATURES: highest extended feature index.\n */\n@@ -7209,6 +7285,8 @@ enum nl80211_ext_feature_index {\n \tNL80211_EXT_FEATURE_SET_KEY_LTF_SEED,\n \tNL80211_EXT_FEATURE_PROBE_AP,\n \tNL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,\n+\tNL80211_EXT_FEATURE_SMD,\n+\tNL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING,\n \n \t/* add new features before the definition below */\n \tNUM_NL80211_EXT_FEATURES,\n@@ -9120,4 +9198,228 @@ enum nl80211_nan_peer_map_attrs {\n \n #define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff\n \n+/**\n+ * enum nl80211_smd_type - Type of the SMD\n+ *\n+ * @NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP: Separate MAC SAP is used per AP MLD.\n+ * @NL80211_SMD_TYPE_PER_SMD_MAC_SAP: one MAC SAP is used in the SMD.\n+ * @NUM_NL80211_SMD_TYPES: internal.\n+ * @NL80211_SMD_TYPE_MAX: Max type of the SMD.\n+ *\n+ * This value represents the data path models between the non-AP MLD and DS.\n+ * DS mapping for the non-AP MLD is updated if\n+ * %NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP is used.\n+ *\n+ * All AP MLDs within an SMD shall indicate the same SMD type (refer\n+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.2).\n+ */\n+enum nl80211_smd_type {\n+\tNL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP,\n+\tNL80211_SMD_TYPE_PER_SMD_MAC_SAP,\n+\n+\tNUM_NL80211_SMD_TYPES,\n+\tNL80211_SMD_TYPE_MAX = NUM_NL80211_SMD_TYPES - 1,\n+};\n+\n+/**\n+ * enum nl80211_smd_ptk_mode - PTK Mode used in the SMD\n+ *\n+ * @NL80211_SMD_PTK_MODE_PER_SMD_PTK: one PTK is used by all AP MLDs in the SMD.\n+ * @NL80211_SMD_PTK_MODE_PER_AP_MLD_PTK: Separate PTK is used per AP MLD.\n+ * @NUM_NL80211_SMD_PTK_MODES: internal.\n+ * @NL80211_SMD_PTK_MODE_MAX: Max type of PTK mode.\n+ *\n+ * This value represents the security mode of the SMD that dictates the PTK used\n+ * in current and target AP MLDs to protect communications with the non-AP MLD\n+ * (refer IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.3.2)\n+ */\n+enum nl80211_smd_ptk_mode {\n+\tNL80211_SMD_PTK_MODE_PER_SMD_PTK,\n+\tNL80211_SMD_PTK_MODE_PER_AP_MLD_PTK,\n+\n+\tNUM_NL80211_SMD_PTK_MODES,\n+\tNL80211_SMD_PTK_MODE_MAX = NUM_NL80211_SMD_PTK_MODES - 1,\n+};\n+\n+/**\n+ * enum nl80211_smd_params_attrs - SMD Domain parameters\n+ *\n+ * @NL80211_SMD_PARAMS_ATTR_UNSPEC: Invalid attribute.\n+ * @NL80211_SMD_PARAMS_ATTR_IDENTIFIER: Required (binary) attribute of ETH_ALEN\n+ *\tbytes used to define the unique identifier for the SMD.\n+ * @NL80211_SMD_PARAMS_ATTR_TIMEOUT: Required (u16) attribute to define the SMD\n+ *\tPreparation timeout (in 64 TUs, values 0 and 1 are reserved) for\n+ *\tthe target AP MLD.\n+ * @NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING: Flag attribute to indicate that\n+ *\tthe device supports forwarding of buffered DL data packets.\n+ * @NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS: Required (u8) attribute to define\n+ *\tthe maximum number of AP MLDs a non-AP MLD can prepare with. Value is\n+ *\tthe maximum number of AP MLDs - 1. A value of 0 means that the non-AP\n+ *\tMLD can prepare with 1 AP MLD.\n+ * @NL80211_SMD_PARAMS_ATTR_TYPE: Required (u8) attribute to indicate the\n+ *\tSMD Type (\u0026enum nl80211_smd_type).\n+ * @NL80211_SMD_PARAMS_ATTR_PTK_MODE: Required (u8) attribute to indicate the\n+ *\tPTK mode used for protection (\u0026enum nl80211_smd_ptk_mode).\n+ * @NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING: Flag attribute to indicate that\n+ *\tthe device supports UHR Neighboring AP Probing.\n+ * @__NL80211_SMD_PARAMS_ATTR_LAST: Last attribute, used internally.\n+ * @NL80211_SMD_PARAMS_ATTR_MAX: Max attribute.\n+ *\n+ * Nested attributes carried in %NL80211_ATTR_SMD_PARAMS to define\n+ * device capabilities that is part of an SMD (refer IEEE P802.11bn/D2.0,\n+ * Aug 2026, subclause 9.4.2.363, Figure 9-aa43 and Figure 9-aa44).\n+ *\n+ */\n+enum nl80211_smd_params_attrs {\n+\tNL80211_SMD_PARAMS_ATTR_UNSPEC,\n+\tNL80211_SMD_PARAMS_ATTR_IDENTIFIER,\n+\tNL80211_SMD_PARAMS_ATTR_TIMEOUT,\n+\tNL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING,\n+\tNL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS,\n+\tNL80211_SMD_PARAMS_ATTR_TYPE,\n+\tNL80211_SMD_PARAMS_ATTR_PTK_MODE,\n+\tNL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING,\n+\n+\t/* keep last */\n+\t__NL80211_SMD_PARAMS_ATTR_LAST,\n+\tNL80211_SMD_PARAMS_ATTR_MAX = __NL80211_SMD_PARAMS_ATTR_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_smd_ctx_type - SMD Request Type values\n+ *\n+ * Used with %NL80211_ATTR_SMD_CTX_TYPE.\n+ *\n+ * @NL80211_SMD_CTX_TYPE_PREP: SMD BSS Transition (ST) Preparation.\n+ * @NL80211_SMD_CTX_TYPE_EXEC: ST Execution.\n+ * @NUM_SMD_CTX_TYPES: internal.\n+ * @NL80211_SMD_CTX_TYPE_MAX: Max type of ST context.\n+ */\n+enum nl80211_smd_ctx_type {\n+\tNL80211_SMD_CTX_TYPE_PREP,\n+\tNL80211_SMD_CTX_TYPE_EXEC,\n+\n+\tNUM_SMD_CTX_TYPES,\n+\tNL80211_SMD_CTX_TYPE_MAX = NUM_SMD_CTX_TYPES - 1,\n+};\n+\n+/**\n+ * enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes\n+ *\n+ * @__NL80211_SMD_CTX_BA_ATTR_INVALID: Invalid attribute.\n+ * @NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE: Required (u16) BA buffer size.\n+ * @NL80211_SMD_CTX_BA_ATTR_POLICY: Required (u8) BA policy.\n+ * @NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT: Flag attribute to indicate\n+ *\tAMSDU support.\n+ * @NL80211_SMD_CTX_BA_ATTR_TIMEOUT: Required (u16) Block Ack timeout.\n+ * @NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG: Flag attribute to indicate\n+ *\tfragmentation support.\n+ * @NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL: Required (u8) HE fragmentation\n+ *\tlevel.\n+ * @NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE: Required (u16) extended buffer size.\n+ * @__NL80211_SMD_CTX_BA_ATTR_LAST: Last attribute, used internally.\n+ * @NL80211_SMD_CTX_BA_ATTR_MAX: Max attribute.\n+ *\n+ * Used with %NL80211_SMD_CTX_DL_ATTR_BA_PARAMS and\n+ * %NL80211_SMD_CTX_UL_ATTR_BA_PARAMS.\n+ */\n+enum nl80211_smd_ctx_ba_param {\n+\t__NL80211_SMD_CTX_BA_ATTR_INVALID,\n+\tNL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,\n+\tNL80211_SMD_CTX_BA_ATTR_POLICY,\n+\tNL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT,\n+\tNL80211_SMD_CTX_BA_ATTR_TIMEOUT,\n+\tNL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG,\n+\tNL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,\n+\tNL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,\n+\n+\t__NL80211_SMD_CTX_BA_ATTR_LAST,\n+\tNL80211_SMD_CTX_BA_ATTR_MAX = __NL80211_SMD_CTX_BA_ATTR_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction\n+ *\n+ * @__NL80211_SMD_CTX_DL_ATTR_INVALID: Invalid attribute.\n+ * @NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.\n+ * @NL80211_SMD_CTX_DL_ATTR_SN: Optional (nested) next SN (u16) per TID to\n+ *\tbe assigned to DL individually addressed frames.\n+ * @NL80211_SMD_CTX_DL_ATTR_PN: Optional (binary) starting PN (max 16 bytes) for\n+ *\tDL individually addressed frames.\n+ * @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters,\n+ *\tnested array of TIDs (uses \u0026enum nl80211_smd_ctx_ba_param).\n+ * @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally.\n+ * @NL80211_SMD_CTX_DL_ATTR_MAX: Max attribute.\n+ *\n+ * Used with %NL80211_SMD_CTX_ATTR_DL.\n+ */\n+enum nl80211_smd_ctx_dl {\n+\t__NL80211_SMD_CTX_DL_ATTR_INVALID,\n+\tNL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,\n+\tNL80211_SMD_CTX_DL_ATTR_SN,\n+\tNL80211_SMD_CTX_DL_ATTR_PN,\n+\tNL80211_SMD_CTX_DL_ATTR_BA_PARAMS,\n+\n+\t__NL80211_SMD_CTX_DL_ATTR_LAST,\n+\tNL80211_SMD_CTX_DL_ATTR_MAX = __NL80211_SMD_CTX_DL_ATTR_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction\n+ *\n+ * @__NL80211_SMD_CTX_UL_ATTR_INVALID: Invalid attribute.\n+ * @NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.\n+ * @NL80211_SMD_CTX_UL_ATTR_SN: Optional (nested) last SN received per TID\n+ *\tfor UL individually addressed frames.\n+ * @NL80211_SMD_CTX_UL_ATTR_PN: Optional (nested) last PN received per TID\n+ *\tfor UL individually addressed frames.\n+ * @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters\n+ *\t(uses \u0026enum nl80211_smd_ctx_ba_param).\n+ * @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally.\n+ * @NL80211_SMD_CTX_UL_ATTR_MAX: Max attribute.\n+ *\n+ * Used with %NL80211_SMD_CTX_ATTR_UL.\n+ */\n+enum nl80211_smd_ctx_ul {\n+\t__NL80211_SMD_CTX_UL_ATTR_INVALID,\n+\tNL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,\n+\tNL80211_SMD_CTX_UL_ATTR_SN,\n+\tNL80211_SMD_CTX_UL_ATTR_PN,\n+\tNL80211_SMD_CTX_UL_ATTR_BA_PARAMS,\n+\n+\t__NL80211_SMD_CTX_UL_ATTR_LAST,\n+\tNL80211_SMD_CTX_UL_ATTR_MAX = __NL80211_SMD_CTX_UL_ATTR_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_smd_ctx - SMD Context information\n+ *\n+ * Top-level container for SMD BSS Transition dynamic context. Carried in\n+ * %NL80211_ATTR_SMD_CTX with %NL80211_CMD_SET_SMD_CTX (target AP MLD) or\n+ * with %NL80211_CMD_FRAME (current AP MLD reporting context to userspace)\n+ * and %NL80211_CMD_SMD_CTX_EVENT (current AP MLD reporting the requested\n+ * context on behalf of the target AP MLD).\n+ *\n+ * @__NL80211_SMD_CTX_ATTR_INVALID: Invalid attribute.\n+ * @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters.\n+ *\tSee \u0026enum nl80211_smd_ctx_dl.\n+ * @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters.\n+ *\tSee \u0026enum nl80211_smd_ctx_ul.\n+ * @NL80211_SMD_CTX_ATTR_DRV_DATA: Optional (binary) driver-specific blob.\n+ *\tPassed through nl80211 as a blob; parsed only at the driver layer of\n+ *\tthe current AP MLD and target AP MLD. First 3 bytes shall be driver OUI\n+ *\tfor the driver to parse as required.\n+ * @__NL80211_SMD_CTX_ATTR_LAST: Last attribute, used internally.\n+ * @NL80211_SMD_CTX_ATTR_MAX: Max attribute.\n+ */\n+enum nl80211_smd_ctx {\n+\t__NL80211_SMD_CTX_ATTR_INVALID,\n+\tNL80211_SMD_CTX_ATTR_DL,\n+\tNL80211_SMD_CTX_ATTR_UL,\n+\tNL80211_SMD_CTX_ATTR_DRV_DATA,\n+\n+\t__NL80211_SMD_CTX_ATTR_LAST,\n+\tNL80211_SMD_CTX_ATTR_MAX = __NL80211_SMD_CTX_ATTR_LAST - 1\n+};\n+\n #endif /* __LINUX_NL80211_H */\ndiff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c\nindex 9629e00069a1f..2d67fd8831465 100644\n--- a/net/mac80211/agg-rx.c\n+++ b/net/mac80211/agg-rx.c\n@@ -289,6 +289,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,\n \t\t.amsdu = false,\n \t\t.timeout = timeout,\n \t\t.ssn = start_seq_num,\n+\t\t.policy = ba_policy,\n \t};\n \tint i, ret = -EOPNOTSUPP;\n \tu16 status = WLAN_STATUS_REQUEST_DECLINED;\ndiff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c\nindex 23f4f9ec86d0a..95b699117147a 100644\n--- a/net/mac80211/cfg.c\n+++ b/net/mac80211/cfg.c\n@@ -1796,6 +1796,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,\n \t\t}\n \t}\n \n+\tif (params-\u003esmd_params.smd_enabled)\n+\t\tlink_conf-\u003esmd_params = params-\u003esmd_params;\n+\telse\n+\t\tlink_conf-\u003esmd_params.smd_enabled = false;\n+\n \tif (sdata-\u003evif.type == NL80211_IFTYPE_AP \u0026\u0026\n \t params-\u003embssid_config.tx_wdev) {\n \t\terr = ieee80211_set_ap_mbssid_options(sdata,\n@@ -2447,6 +2452,73 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,\n \treturn 0;\n }\n \n+static int sta_apply_smd_state_flags(struct sta_info *sta,\n+\t\t\t\t u32 mask, u32 set)\n+{\n+\tbool smd_prep_target, smd_exec_current, smd_dl_drain;\n+\tu32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |\n+\t\t\t BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |\n+\t\t\t BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);\n+\tenum ieee80211_sta_smd_state new_ss;\n+\tu32 smd_flags;\n+\tint err;\n+\n+\tif (!(mask \u0026 expected_mask))\n+\t\treturn 0;\n+\n+\tsmd_flags = mask \u0026 expected_mask \u0026 set;\n+\tif (WARN_ON(hweight32(smd_flags) \u003e 1))\n+\t\treturn -EINVAL;\n+\n+\tsmd_prep_target =\n+\t\t!!(smd_flags \u0026 BIT(NL80211_STA_FLAG_SMD_PREP_TARGET));\n+\tsmd_exec_current =\n+\t\t!!(smd_flags \u0026 BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT));\n+\tsmd_dl_drain =\n+\t\t!!(smd_flags \u0026 BIT(NL80211_STA_FLAG_SMD_DL_DRAIN));\n+\n+\tif (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) \u0026\u0026\n+\t (smd_exec_current || smd_dl_drain))\n+\t\treturn -EINVAL;\n+\n+\tif (smd_prep_target)\n+\t\tnew_ss = IEEE80211_STA_SMD_PREP;\n+\telse if (smd_exec_current)\n+\t\tnew_ss = IEEE80211_STA_SMD_EXEC;\n+\telse if (smd_dl_drain)\n+\t\tnew_ss = IEEE80211_STA_SMD_DRAIN;\n+\telse\n+\t\tnew_ss = IEEE80211_STA_SMD_NONE;\n+\n+\tif (new_ss == sta-\u003esmd_state)\n+\t\treturn 0;\n+\n+\terr = sta_info_move_smd_state(sta, new_ss, true);\n+\tif (err)\n+\t\treturn err;\n+\n+\tif (smd_prep_target) {\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);\n+\t\tset_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);\n+\t} else if (smd_exec_current) {\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);\n+\t\tset_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);\n+\t} else if (smd_dl_drain) {\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);\n+\t\tset_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);\n+\t} else {\n+\t\t/* all flags revert back to none being set */\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);\n+\t\tclear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int sta_apply_parameters(struct ieee80211_local *local,\n \t\t\t\tstruct sta_info *sta,\n \t\t\t\tstruct station_parameters *params)\n@@ -2523,6 +2595,18 @@ static int sta_apply_parameters(struct ieee80211_local *local,\n \tif (mask \u0026 BIT(NL80211_STA_FLAG_SPP_AMSDU))\n \t\tsta-\u003esta.spp_amsdu = set \u0026 BIT(NL80211_STA_FLAG_SPP_AMSDU);\n \n+\tif (mask \u0026 BIT(NL80211_STA_FLAG_SMD)) {\n+\t\tif (set \u0026 BIT(NL80211_STA_FLAG_SMD)) {\n+\t\t\tset_sta_flag(sta, WLAN_STA_SMD);\n+\t\t} else if (test_sta_flag(sta, WLAN_STA_SMD)) {\n+\t\t\tsta_info_reset_smd_state(sta, true);\n+\t\t\tclear_sta_flag(sta, WLAN_STA_SMD);\n+\t\t}\n+\t}\n+\n+\tif (params-\u003esmd_params.smd_sta)\n+\t\tsta-\u003esta.smd_params = params-\u003esmd_params;\n+\n \t/* mark TDLS channel switch support, if the AP allows it */\n \tif (test_sta_flag(sta, WLAN_STA_TDLS_PEER) \u0026\u0026\n \t !sdata-\u003edeflink.u.mgd.tdls_chan_switch_prohibited \u0026\u0026\n@@ -2624,6 +2708,17 @@ static int sta_apply_parameters(struct ieee80211_local *local,\n \t\t\treturn ret;\n \t}\n \n+\t/*\n+\t * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026,\n+\t * subclause 11.3.1).\n+\t * Only meaningful for SMD-capable stations (WLAN_STA_SMD set).\n+\t */\n+\tif (test_sta_flag(sta, WLAN_STA_SMD)) {\n+\t\tret = sta_apply_smd_state_flags(sta, mask, set);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \t/* Mark the STA as MLO if MLD MAC address is available */\n \tif (params-\u003elink_sta_params.mld_mac)\n \t\tsta-\u003esta.mlo = true;\n@@ -2708,6 +2803,19 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev,\n \t */\n \tif (!err \u0026\u0026 sdata-\u003evif.type == NL80211_IFTYPE_NAN_DATA)\n \t\tieee80211_nan_update_ndi_carrier(sta-\u003esdata);\n+\n+\t/*\n+\t * SMD sub-state was set in sta_apply_parameters() before the station\n+\t * was inserted so drv_sta_smd_state() was skipped (WLAN_STA_INSERTED\n+\t * was not yet set). Walk the driver step-by-step to the target state.\n+\t */\n+\tif (!err \u0026\u0026 test_sta_flag(sta, WLAN_STA_SMD) \u0026\u0026\n+\t sta-\u003esmd_state != IEEE80211_STA_SMD_NONE) {\n+\t\terr = sta_info_move_drv_smd_state(sta);\n+\t\tif (err)\n+\t\t\tWARN_ON(__sta_info_destroy(sta));\n+\t}\n+\n \treturn err;\n }\n \n@@ -5973,6 +6081,66 @@ ieee80211_set_peer_nan_sched(struct wiphy *wiphy,\n \treturn ieee80211_nan_set_peer_sched(sdata, sched);\n }\n \n+static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\n+\t\t\t\t const u8 *addr,\n+\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct ieee80211_local *local = wiphy_priv(wiphy);\n+\tstruct ieee80211_sub_if_data *sdata;\n+\tstruct sta_info *sta;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tsdata = IEEE80211_WDEV_TO_SUB_IF(wdev);\n+\n+\tif (sdata-\u003evif.type != NL80211_IFTYPE_AP \u0026\u0026\n+\t sdata-\u003evif.type != NL80211_IFTYPE_AP_VLAN)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tsta = sta_info_get_bss(sdata, addr);\n+\tif (!sta)\n+\t\treturn -ENOENT;\n+\tif (!sta-\u003esta.smd_params.smd_sta)\n+\t\treturn -EINVAL;\n+\n+\treturn drv_set_smd_ctx(local, sdata, \u0026sta-\u003esta, st_info);\n+}\n+\n+static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\n+\t\t\t\t const u8 *addr,\n+\t\t\t\t enum nl80211_smd_ctx_type type)\n+{\n+\tstruct ieee80211_local *local = wiphy_priv(wiphy);\n+\tstruct ieee80211_sub_if_data *sdata;\n+\tstruct sta_info *sta;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tsdata = IEEE80211_WDEV_TO_SUB_IF(wdev);\n+\n+\tif (sdata-\u003evif.type != NL80211_IFTYPE_AP \u0026\u0026\n+\t sdata-\u003evif.type != NL80211_IFTYPE_AP_VLAN)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tsta = sta_info_get_bss(sdata, addr);\n+\tif (!sta)\n+\t\treturn -ENOENT;\n+\tif (!sta-\u003esta.smd_params.smd_sta)\n+\t\treturn -EINVAL;\n+\n+\treturn drv_get_smd_ctx(local, sdata, \u0026sta-\u003esta, type);\n+}\n+\n+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\n+\t\t\t\tconst u8 *sta_addr,\n+\t\t\t\tstruct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);\n+\n+\tcfg80211_get_smd_ctx_done(\u0026sdata-\u003ewdev, sta_addr, st_info);\n+}\n+EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);\n+\n const struct cfg80211_ops mac80211_config_ops = {\n \t.add_virtual_intf = ieee80211_add_iface,\n \t.del_virtual_intf = ieee80211_del_iface,\n@@ -6091,4 +6259,6 @@ const struct cfg80211_ops mac80211_config_ops = {\n \t.set_epcs = ieee80211_set_epcs,\n \t.nan_set_local_sched = ieee80211_set_local_nan_sched,\n \t.nan_set_peer_sched = ieee80211_set_peer_nan_sched,\n+\t.set_smd_ctx = ieee80211_set_smd_ctx,\n+\t.get_smd_ctx = ieee80211_get_smd_ctx,\n };\ndiff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c\nindex ef75255d47d5a..24c985687bd27 100644\n--- a/net/mac80211/debugfs_sta.c\n+++ b/net/mac80211/debugfs_sta.c\n@@ -78,6 +78,10 @@ static const char * const sta_flag_names[] = {\n \tFLAG(PS_DELIVER),\n \tFLAG(USES_ENCRYPTION),\n \tFLAG(DECAP_OFFLOAD),\n+\tFLAG(SMD),\n+\tFLAG(SMD_PREP_TARGET),\n+\tFLAG(SMD_EXEC_CURRENT),\n+\tFLAG(SMD_DL_DRAIN),\n #undef FLAG\n };\n \ndiff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c\nindex 49753b73aba26..d77a5a80f06ec 100644\n--- a/net/mac80211/driver-ops.c\n+++ b/net/mac80211/driver-ops.c\n@@ -633,3 +633,27 @@ int drv_change_sta_links(struct ieee80211_local *local,\n \n \treturn 0;\n }\n+\n+int drv_sta_smd_state(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t enum ieee80211_sta_smd_state old_state,\n+\t\t enum ieee80211_sta_smd_state new_state)\n+{\n+\tint ret = 0;\n+\n+\tmight_sleep();\n+\tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n+\n+\tsdata = get_bss_sdata(sdata);\n+\tif (!check_sdata_in_driver(sdata))\n+\t\treturn -EIO;\n+\n+\ttrace_drv_sta_smd_state(local, sdata, sta, old_state, new_state);\n+\tif (local-\u003eops-\u003esta_smd_state)\n+\t\tret = local-\u003eops-\u003esta_smd_state(\u0026local-\u003ehw, \u0026sdata-\u003evif,\n+\t\t\t\t\t\tsta, old_state, new_state);\n+\ttrace_drv_return_int(local, ret);\n+\n+\treturn ret;\n+}\ndiff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h\nindex f1c0b87fddd5f..0339ff71cd4ab 100644\n--- a/net/mac80211/driver-ops.h\n+++ b/net/mac80211/driver-ops.h\n@@ -1814,4 +1814,58 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,\n \treturn ret;\n }\n \n+int drv_sta_smd_state(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t enum ieee80211_sta_smd_state old_state,\n+\t\t enum ieee80211_sta_smd_state new_state);\n+\n+static inline int drv_set_smd_ctx(struct ieee80211_local *local,\n+\t\t\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t\t\t struct ieee80211_sta *sta,\n+\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n+{\n+\tint ret;\n+\n+\tif (!local-\u003eops-\u003eset_smd_ctx)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tsdata = get_bss_sdata(sdata);\n+\n+\tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n+\n+\tif (!check_sdata_in_driver(sdata))\n+\t\treturn -EIO;\n+\n+\ttrace_drv_set_smd_ctx(local, sdata, sta, st_info);\n+\tret = local-\u003eops-\u003eset_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, st_info);\n+\ttrace_drv_return_int(local, ret);\n+\n+\treturn ret;\n+}\n+\n+static inline int drv_get_smd_ctx(struct ieee80211_local *local,\n+\t\t\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t\t\t struct ieee80211_sta *sta,\n+\t\t\t\t enum nl80211_smd_ctx_type type)\n+{\n+\tint ret;\n+\n+\tif (!sdata || !local-\u003eops-\u003eget_smd_ctx)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tsdata = get_bss_sdata(sdata);\n+\n+\tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n+\n+\tif (!check_sdata_in_driver(sdata))\n+\t\treturn -EIO;\n+\n+\ttrace_drv_get_smd_ctx(local, sdata, sta, type);\n+\tret = local-\u003eops-\u003eget_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, type);\n+\ttrace_drv_return_int(local, ret);\n+\n+\treturn ret;\n+}\n+\n #endif /* __MAC80211_DRIVER_OPS */\ndiff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h\nindex 9514f01778beb..cf1a5d54d2299 100644\n--- a/net/mac80211/ieee80211_i.h\n+++ b/net/mac80211/ieee80211_i.h\n@@ -268,6 +268,8 @@ struct ieee80211_rx_data {\n \t};\n \n \tu8 link_addrs[3 * ETH_ALEN];\n+\n+\tstruct ieee80211_smd_ctx *smd_ctx;\n };\n \n struct ieee80211_csa_settings {\ndiff --git a/net/mac80211/rx.c b/net/mac80211/rx.c\nindex b3990b7a72990..4ad7a71d298a9 100644\n--- a/net/mac80211/rx.c\n+++ b/net/mac80211/rx.c\n@@ -3970,6 +3970,22 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)\n \treturn RX_QUEUED;\n }\n \n+static void\n+ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,\n+\t\t\t\t\t struct ieee80211_rx_data *rx)\n+{\n+\tstruct ieee80211_mgmt *mgmt = (void *)info-\u003ebuf;\n+\tu8 type;\n+\n+\tif (!rx-\u003esmd_ctx)\n+\t\treturn;\n+\n+\ttype = mgmt-\u003eu.action.uhr_link_reconf_req.type;\n+\n+\tinfo-\u003est_info.type = type;\n+\tinfo-\u003est_info.ctx = rx-\u003esmd_ctx;\n+}\n+\n static ieee80211_rx_result debug_noinline\n ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)\n {\n@@ -3981,6 +3997,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)\n \t\t.link_id = rx-\u003elink_id,\n \t\t.have_link_id = rx-\u003elink_id \u003e= 0,\n \t\t.no_sta = !rx-\u003esta,\n+\t\t.st_info.ctx = NULL,\n \t};\n \n \t/* skip known-bad action frames and return them in the next handler */\n@@ -4002,6 +4019,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)\n \t ieee80211_is_ftm(rx-\u003eskb)) {\n \t\tinfo.rx_tstamp = ktime_to_ns(skb_hwtstamps(rx-\u003eskb)-\u003ehwtstamp);\n \t\tinfo.ack_tstamp = ktime_to_ns(status-\u003eack_tx_hwtstamp);\n+\t} else if (ieee80211_is_st_prep_req(rx-\u003eskb) ||\n+\t\t ieee80211_is_st_exec_req(rx-\u003eskb)) {\n+\t\tieee80211_rx_h_userspace_mgmt_st_req_frame(\u0026info, rx);\n \t}\n \n \tif (cfg80211_rx_mgmt_ext(\u0026rx-\u003esdata-\u003ewdev, \u0026info)) {\n@@ -5340,7 +5360,8 @@ static bool ieee80211_rx_valid_freq(int freq, struct ieee80211_link_data *link)\n static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\t\t\t\t struct ieee80211_link_sta *link_pubsta,\n \t\t\t\t\t struct sk_buff *skb,\n-\t\t\t\t\t struct list_head *list)\n+\t\t\t\t\t struct list_head *list,\n+\t\t\t\t\t struct ieee80211_rx_data *rx)\n {\n \tstruct ieee80211_local *local = hw_to_local(hw);\n \tstruct ieee80211_sub_if_data *sdata;\n@@ -5349,16 +5370,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \tstruct link_sta_info *link_sta;\n \tstruct sta_info *sta;\n \t__le16 fc;\n-\tstruct ieee80211_rx_data rx;\n \tstruct rhlist_head *tmp;\n \tbool rx_data_pending;\n \tint err = 0;\n \n \tfc = ((struct ieee80211_hdr *)skb-\u003edata)-\u003eframe_control;\n-\tmemset(\u0026rx, 0, sizeof(rx));\n-\trx.skb = skb;\n-\trx.local = local;\n-\trx.list = list;\n+\trx-\u003eskb = skb;\n+\trx-\u003elocal = local;\n+\trx-\u003elist = list;\n \n \tif (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))\n \t\tI802_DEBUG_INC(local-\u003edot11ReceivedFragmentCount);\n@@ -5390,8 +5409,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t}\n \n \thdr = (struct ieee80211_hdr *)skb-\u003edata;\n-\tieee80211_parse_qos(\u0026rx);\n-\tieee80211_verify_alignment(\u0026rx);\n+\tieee80211_parse_qos(rx);\n+\tieee80211_verify_alignment(rx);\n \n \tif (unlikely(ieee80211_is_probe_resp(hdr-\u003eframe_control) ||\n \t\t ieee80211_is_beacon(hdr-\u003eframe_control) ||\n@@ -5412,9 +5431,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\t\t\t\t sta);\n \t\t\tlink_sta = rcu_dereference(sta-\u003elink[link_pubsta-\u003elink_id]);\n \n-\t\t\trx.sdata = sta-\u003esdata;\n-\t\t\tif (ieee80211_rx_data_set_link_sta(\u0026rx, link_sta) \u0026\u0026\n-\t\t\t ieee80211_prepare_and_rx_handle(\u0026rx, skb, true))\n+\t\t\trx-\u003esdata = sta-\u003esdata;\n+\t\t\tif (ieee80211_rx_data_set_link_sta(rx, link_sta) \u0026\u0026\n+\t\t\t ieee80211_prepare_and_rx_handle(rx, skb, true))\n \t\t\t\treturn;\n \n \t\t\tgoto out;\n@@ -5434,13 +5453,13 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\t\t\tcontinue;\n \n \t\t\tif (rx_data_pending) {\n-\t\t\t\tieee80211_prepare_and_rx_handle(\u0026rx, skb,\n+\t\t\t\tieee80211_prepare_and_rx_handle(rx, skb,\n \t\t\t\t\t\t\t\tfalse);\n \t\t\t\trx_data_pending = false;\n \t\t\t}\n \n-\t\t\trx.sdata = sta-\u003esdata;\n-\t\t\tif (!ieee80211_rx_data_set_link_sta(\u0026rx, \u0026sta-\u003edeflink))\n+\t\t\trx-\u003esdata = sta-\u003esdata;\n+\t\t\tif (!ieee80211_rx_data_set_link_sta(rx, \u0026sta-\u003edeflink))\n \t\t\t\tcontinue;\n \n \t\t\trx_data_pending = true;\n@@ -5458,20 +5477,20 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\t\t\tcontinue;\n \n \t\t\tif (rx_data_pending) {\n-\t\t\t\tieee80211_prepare_and_rx_handle(\u0026rx, skb,\n+\t\t\t\tieee80211_prepare_and_rx_handle(rx, skb,\n \t\t\t\t\t\t\t\tfalse);\n \t\t\t\trx_data_pending = false;\n \t\t\t}\n \n-\t\t\trx.sdata = sta-\u003esdata;\n-\t\t\tif (!ieee80211_rx_data_set_link_sta(\u0026rx, link_sta))\n+\t\t\trx-\u003esdata = sta-\u003esdata;\n+\t\t\tif (!ieee80211_rx_data_set_link_sta(rx, link_sta))\n \t\t\t\tcontinue;\n \n \t\t\trx_data_pending = true;\n \t\t}\n \n \t\tif (rx_data_pending) {\n-\t\t\tif (ieee80211_prepare_and_rx_handle(\u0026rx, skb, true))\n+\t\t\tif (ieee80211_prepare_and_rx_handle(rx, skb, true))\n \t\t\t\treturn;\n \n \t\t\tgoto out;\n@@ -5526,14 +5545,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\tif (link_sta \u0026\u0026 link \u0026\u0026\n \t\t ieee80211_rx_valid_freq(status-\u003efreq, link)) {\n \t\t\tif (rx_data_pending) {\n-\t\t\t\tieee80211_prepare_and_rx_handle(\u0026rx, skb, false);\n+\t\t\t\tieee80211_prepare_and_rx_handle(rx, skb, false);\n \t\t\t\trx_data_pending = false;\n \t\t\t}\n \n \t\t\t/* No valid_links check as we need to RX beacons */\n \n-\t\t\trx.sdata = sdata;\n-\t\t\tif (ieee80211_rx_data_set_link_sta(\u0026rx, link_sta))\n+\t\t\trx-\u003esdata = sdata;\n+\t\t\tif (ieee80211_rx_data_set_link_sta(rx, link_sta))\n \t\t\t\trx_data_pending = true;\n \n \t\t\tcontinue;\n@@ -5562,22 +5581,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,\n \t\t}\n \n \t\tif (rx_data_pending) {\n-\t\t\tieee80211_prepare_and_rx_handle(\u0026rx, skb, false);\n+\t\t\tieee80211_prepare_and_rx_handle(rx, skb, false);\n \t\t\trx_data_pending = false;\n \t\t}\n \n-\t\trx.sdata = sdata;\n-\t\trx.local = sdata-\u003elocal;\n-\t\trx.link = link;\n-\t\trx.link_id = link-\u003elink_id;\n-\t\trx.sta = NULL;\n-\t\trx.link_sta = NULL;\n+\t\trx-\u003esdata = sdata;\n+\t\trx-\u003elocal = sdata-\u003elocal;\n+\t\trx-\u003elink = link;\n+\t\trx-\u003elink_id = link-\u003elink_id;\n+\t\trx-\u003esta = NULL;\n+\t\trx-\u003elink_sta = NULL;\n \n \t\trx_data_pending = true;\n \t}\n \n \tif (rx_data_pending \u0026\u0026\n-\t ieee80211_prepare_and_rx_handle(\u0026rx, skb, true))\n+\t ieee80211_prepare_and_rx_handle(rx, skb, true))\n \t\treturn;\n \n out:\n@@ -5597,6 +5616,15 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,\n \tstruct ieee80211_supported_band *sband;\n \tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\n \tstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-\u003edata;\n+\tstruct ieee80211_smd_ctx *smd_ctx = NULL;\n+\tstruct ieee80211_rx_data rx = {};\n+\n+\t/* cache the pointer to free it later */\n+\tif (status-\u003esmd_ctx_valid) {\n+\t\tsmd_ctx = status-\u003esmd_ctx;\n+\t\tstatus-\u003esmd_ctx = NULL;\n+\t\tstatus-\u003esmd_ctx_valid = false;\n+\t}\n \n \tWARN_ON_ONCE(softirq_count() == 0);\n \n@@ -5731,6 +5759,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,\n \n \tkcov_remote_start_common(skb_get_kcov_handle(skb));\n \n+\trx.smd_ctx = smd_ctx;\n+\n+\tif (WARN_ONCE((status-\u003eflag \u0026 RX_FLAG_8023) \u0026\u0026 rx.smd_ctx,\n+\t\t \"802.3 packet but with IEEE P802.11bn SMD context\"))\n+\t\tgoto drop;\n+\n \t/*\n \t * Frames with failed FCS/PLCP checksum are not returned,\n \t * all other frames are returned without radiotap header\n@@ -5748,12 +5782,14 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,\n \t\t\t__ieee80211_rx_handle_8023(hw, link_pubsta, skb, list);\n \t\telse\n \t\t\t__ieee80211_rx_handle_packet(hw, link_pubsta, skb,\n-\t\t\t\t\t\t list);\n+\t\t\t\t\t\t list, \u0026rx);\n \t}\n+\tkfree(smd_ctx);\n \n \tkcov_remote_stop();\n \treturn;\n drop:\n+\tkfree(smd_ctx);\n \tkfree_skb(skb);\n }\n EXPORT_SYMBOL(ieee80211_rx_list);\ndiff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c\nindex fdf00cbf49d8b..9ea0a87912892 100644\n--- a/net/mac80211/sta_info.c\n+++ b/net/mac80211/sta_info.c\n@@ -701,6 +701,7 @@ __sta_info_alloc(struct ieee80211_sub_if_data *sdata,\n \tieee80211_init_frag_cache(\u0026sta-\u003efrags);\n \n \tsta-\u003esta_state = IEEE80211_STA_NONE;\n+\tsta-\u003esmd_state = IEEE80211_STA_SMD_NONE;\n \n \tif (sdata-\u003evif.type == NL80211_IFTYPE_MESH_POINT)\n \t\tsta-\u003eamsdu_mesh_control = -1;\n@@ -1311,6 +1312,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)\n {\n \tstruct ieee80211_local *local;\n \tstruct ieee80211_sub_if_data *sdata;\n+\tstruct wireless_dev *wdev;\n \tint ret, i;\n \n \tmight_sleep();\n@@ -1320,6 +1322,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)\n \n \tlocal = sta-\u003elocal;\n \tsdata = sta-\u003esdata;\n+\twdev = \u0026sdata-\u003ewdev;\n \n \tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n \n@@ -1389,6 +1392,10 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)\n \t rcu_access_pointer(sdata-\u003eu.vlan.sta) == sta)\n \t\tRCU_INIT_POINTER(sdata-\u003eu.vlan.sta, NULL);\n \n+\tif (sdata-\u003evif.type == NL80211_IFTYPE_AP ||\n+\t sdata-\u003evif.type == NL80211_IFTYPE_AP_VLAN)\n+\t\tcfg80211_free_pending_smd_ctx_req(wdev, sta-\u003eaddr);\n+\n \treturn 0;\n }\n \n@@ -1527,6 +1534,20 @@ static int _sta_info_move_state(struct sta_info *sta,\n \t\tWARN_ONCE(err,\n \t\t\t \"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\\n\",\n \t\t\t err);\n+\n+\t\t/* revert SMD states if STA has transitioned down */\n+\t\tif (new_state == IEEE80211_STA_AUTH \u0026\u0026\n+\t\t sta-\u003esta_state == IEEE80211_STA_ASSOC) {\n+\t\t\tif (test_sta_flag(sta, WLAN_STA_SMD) \u0026\u0026\n+\t\t\t sta-\u003esmd_state == IEEE80211_STA_SMD_PREP)\n+\t\t\t\tsta_info_reset_smd_state(sta, true);\n+\t\t} else if (new_state == IEEE80211_STA_ASSOC \u0026\u0026\n+\t\t\t sta-\u003esta_state == IEEE80211_STA_AUTHORIZED) {\n+\t\t\tif (test_sta_flag(sta, WLAN_STA_SMD) \u0026\u0026\n+\t\t\t sta-\u003esmd_state != IEEE80211_STA_SMD_NONE \u0026\u0026\n+\t\t\t sta-\u003esmd_state != IEEE80211_STA_SMD_PREP)\n+\t\t\t\tsta_info_reset_smd_state(sta, true);\n+\t\t}\n \t}\n \n \tsta-\u003esta_state = new_state;\n@@ -3883,3 +3904,128 @@ bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,\n \n \treturn true;\n }\n+\n+int sta_info_move_smd_state(struct sta_info *sta,\n+\t\t\t enum ieee80211_sta_smd_state new_ss,\n+\t\t\t bool notify)\n+{\n+\tenum ieee80211_sta_smd_state old_ss = sta-\u003esmd_state;\n+\tstruct ieee80211_local *local = sta-\u003elocal;\n+\tbool notify_driver;\n+\tint err;\n+\n+\tmight_sleep();\n+\n+\tif (old_ss == new_ss)\n+\t\treturn 0;\n+\n+\tswitch (new_ss) {\n+\tcase IEEE80211_STA_SMD_NONE:\n+\t\tif (old_ss != IEEE80211_STA_SMD_PREP \u0026\u0026\n+\t\t old_ss != IEEE80211_STA_SMD_EXEC \u0026\u0026\n+\t\t old_ss != IEEE80211_STA_SMD_DRAIN)\n+\t\t\treturn -EINVAL;\n+\t\tbreak;\n+\tcase IEEE80211_STA_SMD_EXEC:\n+\t\tif (old_ss != IEEE80211_STA_SMD_NONE)\n+\t\t\treturn -EINVAL;\n+\t\tbreak;\n+\tcase IEEE80211_STA_SMD_DRAIN:\n+\t\tif (old_ss != IEEE80211_STA_SMD_EXEC)\n+\t\t\treturn -EINVAL;\n+\t\tbreak;\n+\tcase IEEE80211_STA_SMD_PREP:\n+\t\tif (old_ss != IEEE80211_STA_SMD_NONE)\n+\t\t\treturn -EINVAL;\n+\t\tbreak;\n+\tdefault:\n+\t\tsdata_err(sta-\u003esdata, \"invalid smd state %d\", new_ss);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tsta_dbg(sta-\u003esdata, \"moving STA %pM SMD state %u -\u003e %u\\n\",\n+\t\tsta-\u003esta.addr, old_ss, new_ss);\n+\n+\tnotify_driver = notify \u0026\u0026 test_sta_flag(sta, WLAN_STA_INSERTED);\n+\n+\tif (new_ss \u003e old_ss \u0026\u0026 notify_driver) {\n+\t\terr = drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta, old_ss,\n+\t\t\t\t\tnew_ss);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n+\n+\tif (new_ss \u003c old_ss \u0026\u0026 notify_driver) {\n+\t\terr = drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta, old_ss,\n+\t\t\t\t\tnew_ss);\n+\t\t/* driver should not fail moving down SMD states */\n+\t\tWARN_ONCE(err,\n+\t\t\t \"Driver should not fail moving down SMD states: %d\\n\",\n+\t\t\t err);\n+\t}\n+\n+\tsta-\u003esmd_state = new_ss;\n+\n+\treturn 0;\n+}\n+\n+void sta_info_reset_smd_state(struct sta_info *sta, bool notify)\n+{\n+\tif (sta-\u003esmd_state == IEEE80211_STA_SMD_NONE)\n+\t\treturn;\n+\n+\t/* DRAIN -\u003e NONE, EXEC -\u003e NONE or PREP -\u003e NONE */\n+\tWARN_ON_ONCE(sta_info_move_smd_state(sta, IEEE80211_STA_SMD_NONE,\n+\t\t\t\t\t notify));\n+\n+\tclear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);\n+\tclear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);\n+\tclear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);\n+}\n+\n+int sta_info_move_drv_smd_state(struct sta_info *sta)\n+{\n+\tenum ieee80211_sta_smd_state new_ss = sta-\u003esmd_state;\n+\tstruct ieee80211_local *local = sta-\u003elocal;\n+\tint err = 0;\n+\n+\tif (!test_sta_flag(sta, WLAN_STA_INSERTED))\n+\t\treturn 0;\n+\n+\tswitch (new_ss) {\n+\tcase IEEE80211_STA_SMD_PREP:\n+\t\terr = drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta,\n+\t\t\t\t\tIEEE80211_STA_SMD_NONE,\n+\t\t\t\t\tIEEE80211_STA_SMD_PREP);\n+\t\tif (err)\n+\t\t\tgoto rollback;\n+\t\tbreak;\n+\tcase IEEE80211_STA_SMD_EXEC:\n+\tcase IEEE80211_STA_SMD_DRAIN:\n+\t\terr = drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta,\n+\t\t\t\t\tIEEE80211_STA_SMD_NONE,\n+\t\t\t\t\tIEEE80211_STA_SMD_EXEC);\n+\t\tif (err)\n+\t\t\tgoto rollback;\n+\n+\t\tif (new_ss == IEEE80211_STA_SMD_DRAIN)\n+\t\t\terr = drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta,\n+\t\t\t\t\t\tIEEE80211_STA_SMD_EXEC,\n+\t\t\t\t\t\tIEEE80211_STA_SMD_DRAIN);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!err)\n+\t\treturn 0;\n+\n+\t/* if EXEC -\u003e DRAIN failed in the driver, notify EXEC -\u003e NONE */\n+\tWARN_ON_ONCE(drv_sta_smd_state(local, sta-\u003esdata, \u0026sta-\u003esta,\n+\t\t\t\t IEEE80211_STA_SMD_EXEC,\n+\t\t\t\t IEEE80211_STA_SMD_NONE));\n+\n+rollback:\n+\tsta_info_reset_smd_state(sta, false);\n+\treturn err;\n+}\ndiff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h\nindex ee0d32877c5b4..bdc021675727f 100644\n--- a/net/mac80211/sta_info.h\n+++ b/net/mac80211/sta_info.h\n@@ -72,6 +72,12 @@\n * @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption,\n *\tso drop all packets without a key later.\n * @WLAN_STA_DECAP_OFFLOAD: This station uses rx decap offload\n+ * @WLAN_STA_SMD: this station is associated to an SMD-ME.\n+ * @WLAN_STA_SMD_PREP_TARGET: this SMD station is prepared at the target AP MLD.\n+ * @WLAN_STA_SMD_EXEC_CURRENT: this SMD station has started execution at\n+ *\tthe current AP MLD.\n+ * @WLAN_STA_SMD_DL_DRAIN: this SMD station has started draining at\n+ *\tthe current AP MLD.\n *\n * @NUM_WLAN_STA_FLAGS: number of defined flags\n */\n@@ -104,6 +110,10 @@ enum ieee80211_sta_info_flags {\n \tWLAN_STA_PS_DELIVER,\n \tWLAN_STA_USES_ENCRYPTION,\n \tWLAN_STA_DECAP_OFFLOAD,\n+\tWLAN_STA_SMD,\n+\tWLAN_STA_SMD_PREP_TARGET,\n+\tWLAN_STA_SMD_EXEC_CURRENT,\n+\tWLAN_STA_SMD_DL_DRAIN,\n \n \tNUM_WLAN_STA_FLAGS,\n };\n@@ -711,6 +721,7 @@ struct ieee80211_sta_removed_link_stats {\n *\twould be assigned to link[link_id] where link_id is the id assigned\n *\tby the AP.\n * @rem_link_stats: accumulated removed link stats\n+ * @smd_state: Sub-state for STAs in SMD BSS Transition\n */\n struct sta_info {\n \t/* General information, mostly static */\n@@ -787,6 +798,8 @@ struct sta_info {\n \tstruct link_sta_info __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];\n \tstruct ieee80211_sta_removed_link_stats rem_link_stats;\n \n+\tenum ieee80211_sta_smd_state smd_state;\n+\n \t/* keep last! */\n \tstruct ieee80211_sta sta;\n };\n@@ -1159,4 +1172,10 @@ static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s)\n \treturn r;\n }\n \n+int sta_info_move_smd_state(struct sta_info *sta,\n+\t\t\t enum ieee80211_sta_smd_state new_ss,\n+\t\t\t bool notify);\n+void sta_info_reset_smd_state(struct sta_info *sta, bool notify);\n+int sta_info_move_drv_smd_state(struct sta_info *sta);\n+\n #endif /* STA_INFO_H */\ndiff --git a/net/mac80211/trace.h b/net/mac80211/trace.h\nindex 562a4964afa3a..38ad5076232de 100644\n--- a/net/mac80211/trace.h\n+++ b/net/mac80211/trace.h\n@@ -116,6 +116,7 @@\n \t\t\t\t__field(u16, ssn)\t\t\t\t\t\\\n \t\t\t\t__field(u16, buf_size)\t\t\t\t\t\\\n \t\t\t\t__field(bool, amsdu)\t\t\t\t\t\\\n+\t\t\t\t__field(u8, policy)\t\t\t\t\t\\\n \t\t\t\t__field(u16, timeout)\t\t\t\t\t\\\n \t\t\t\t__field(u16, action)\n #define AMPDU_ACTION_ASSIGN\tSTA_NAMED_ASSIGN(params-\u003esta);\t\t\t\t\\\n@@ -123,12 +124,13 @@\n \t\t\t\t__entry-\u003essn = params-\u003essn;\t\t\t\t\\\n \t\t\t\t__entry-\u003ebuf_size = params-\u003ebuf_size;\t\t\t\\\n \t\t\t\t__entry-\u003eamsdu = params-\u003eamsdu;\t\t\t\t\\\n+\t\t\t\t__entry-\u003epolicy = params-\u003epolicy;\t\t\t\\\n \t\t\t\t__entry-\u003etimeout = params-\u003etimeout;\t\t\t\\\n \t\t\t\t__entry-\u003eaction = params-\u003eaction;\n-#define AMPDU_ACTION_PR_FMT\tSTA_PR_FMT \" tid %d, ssn %d, buf_size %u, amsdu %d, timeout %d action %d\"\n+#define AMPDU_ACTION_PR_FMT\tSTA_PR_FMT \" tid %d, ssn %d, buf_size %u, amsdu %d, policy=%u, timeout %d action %d\"\n #define AMPDU_ACTION_PR_ARG\tSTA_PR_ARG, __entry-\u003etid, __entry-\u003essn,\t\t\t\\\n-\t\t\t\t__entry-\u003ebuf_size, __entry-\u003eamsdu, __entry-\u003etimeout,\t\\\n-\t\t\t\t__entry-\u003eaction\n+\t\t\t\t__entry-\u003ebuf_size, __entry-\u003eamsdu, __entry-\u003epolicy,\t\\\n+\t\t\t\t__entry-\u003etimeout, __entry-\u003eaction\n \n /*\n * Tracing for driver callbacks.\n@@ -3403,6 +3405,115 @@ TRACE_EVENT(drv_nan_peer_sched_changed,\n \t)\n );\n \n+TRACE_EVENT(drv_sta_smd_state,\n+\tTP_PROTO(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t enum ieee80211_sta_smd_state old_state,\n+\t\t enum ieee80211_sta_smd_state new_state),\n+\n+\tTP_ARGS(local, sdata, sta, old_state, new_state),\n+\n+\tTP_STRUCT__entry(\n+\t\tLOCAL_ENTRY\n+\t\tVIF_ENTRY\n+\t\tSTA_ENTRY\n+\t\t__field(u32, old_state)\n+\t\t__field(u32, new_state)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\tLOCAL_ASSIGN;\n+\t\tVIF_ASSIGN;\n+\t\tSTA_ASSIGN;\n+\t\t__entry-\u003eold_state = old_state;\n+\t\t__entry-\u003enew_state = new_state;\n+\t),\n+\n+\tTP_printk(\n+\t\tLOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT\n+\t\t\" smd_state: %d-\u003e%d\",\n+\t\tLOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,\n+\t\t__entry-\u003eold_state, __entry-\u003enew_state\n+\t)\n+);\n+\n+TRACE_EVENT(drv_set_smd_ctx,\n+\tTP_PROTO(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t struct cfg80211_smd_transition_info *st_info),\n+\n+\tTP_ARGS(local, sdata, sta, st_info),\n+\n+\tTP_STRUCT__entry(\n+\t\tLOCAL_ENTRY\n+\t\tVIF_ENTRY\n+\t\tSTA_ENTRY\n+\t\t__field(u8, st_type)\n+\t\t__field(unsigned int, num_tids)\n+\t\t__dynamic_array(unsigned long, dl_tid_bitmap,\n+\t\t\t\tBITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))\n+\t\t__dynamic_array(unsigned long, ul_tid_bitmap,\n+\t\t\t\tBITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))\n+\t),\n+\n+\tTP_fast_assign(\n+\t\tstruct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\n+\t\tunsigned long sz;\n+\n+\t\tLOCAL_ASSIGN;\n+\t\tVIF_ASSIGN;\n+\t\tSTA_ASSIGN;\n+\t\t__entry-\u003est_type = st_info-\u003etype;\n+\n+\t\t__entry-\u003enum_tids = IEEE80211_SMD_CTX_NUM_TIDS;\n+\t\tsz = BITS_TO_LONGS(__entry-\u003enum_tids) * sizeof(unsigned long);\n+\n+\t\tmemcpy(__get_dynamic_array(dl_tid_bitmap),\n+\t\t ctx-\u003edl.valid_tid_bmap, sz);\n+\t\tmemcpy(__get_dynamic_array(ul_tid_bitmap),\n+\t\t ctx-\u003eul.valid_tid_bmap, sz);\n+\t),\n+\n+\tTP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT\n+\t\t \", ST type=%u DL TIDs: %*pb, UL TIDs: %*pb\",\n+\t\t LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,\n+\t\t __entry-\u003est_type,\n+\t\t __entry-\u003enum_tids,\n+\t\t (unsigned long *)__get_dynamic_array(dl_tid_bitmap),\n+\t\t __entry-\u003enum_tids,\n+\t\t (unsigned long *)__get_dynamic_array(ul_tid_bitmap)\n+\t)\n+);\n+\n+TRACE_EVENT(drv_get_smd_ctx,\n+\tTP_PROTO(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t enum nl80211_smd_ctx_type type),\n+\n+\tTP_ARGS(local, sdata, sta, type),\n+\n+\tTP_STRUCT__entry(\n+\t\tLOCAL_ENTRY\n+\t\tVIF_ENTRY\n+\t\tSTA_ENTRY\n+\t\t__field(u8, st_type)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\tLOCAL_ASSIGN;\n+\t\tVIF_ASSIGN;\n+\t\tSTA_ASSIGN;\n+\t\t__entry-\u003est_type = type;\n+\t),\n+\n+\tTP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT \", ST type=%u\",\n+\t\t LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry-\u003est_type\n+\t)\n+);\n+\n #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */\n \n #undef TRACE_INCLUDE_PATH\ndiff --git a/net/wireless/core.c b/net/wireless/core.c\nindex d13310fef691a..129af6ba5fdae 100644\n--- a/net/wireless/core.c\n+++ b/net/wireless/core.c\n@@ -1405,6 +1405,25 @@ void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,\n }\n EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);\n \n+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\n+\t\t\t\t const u8 *addr)\n+{\n+\tstruct cfg80211_smd_get_ctx_pending *pending, *tmp;\n+\n+\tspin_lock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\tlist_for_each_entry_safe(pending, tmp,\n+\t\t\t\t \u0026wdev-\u003esmd_get_ctx_pending_list,\n+\t\t\t\t list) {\n+\t\tif (!addr || ether_addr_equal(pending-\u003esta_addr, addr)) {\n+\t\t\tlist_del(\u0026pending-\u003elist);\n+\t\t\tkfree(pending);\n+\t\t\tdev_put(wdev-\u003enetdev);\n+\t\t}\n+\t}\n+\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+}\n+EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req);\n+\n static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,\n \t\t\t\t bool unregister_netdev)\n {\n@@ -1477,6 +1496,10 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,\n \t\t}\n \t}\n \n+\tif (wdev-\u003eiftype == NL80211_IFTYPE_AP ||\n+\t wdev-\u003eiftype == NL80211_IFTYPE_AP_VLAN)\n+\t\tcfg80211_free_pending_smd_ctx_req(wdev, NULL);\n+\n \twdev-\u003econnected = false;\n }\n \n@@ -1619,6 +1642,8 @@ void cfg80211_init_wdev(struct wireless_dev *wdev)\n \tINIT_LIST_HEAD(\u0026wdev-\u003epmsr_list);\n \tspin_lock_init(\u0026wdev-\u003epmsr_lock);\n \twiphy_work_init(\u0026wdev-\u003epmsr_free_wk, cfg80211_pmsr_free_wk);\n+\tspin_lock_init(\u0026wdev-\u003esmd_get_ctx_lock);\n+\tINIT_LIST_HEAD(\u0026wdev-\u003esmd_get_ctx_pending_list);\n \n #ifdef CONFIG_CFG80211_WEXT\n \twdev-\u003ewext.default_key = -1;\ndiff --git a/net/wireless/mlme.c b/net/wireless/mlme.c\nindex a0d1cde26f0c9..15e14f429c164 100644\n--- a/net/wireless/mlme.c\n+++ b/net/wireless/mlme.c\n@@ -1475,3 +1475,33 @@ void cfg80211_mlo_reconf_add_done(struct net_device *dev,\n \tnl80211_mlo_reconf_add_done(dev, data);\n }\n EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done);\n+\n+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\n+\t\t\t const u8 *sta_addr,\n+\t\t\t struct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct cfg80211_smd_get_ctx_pending *pending = NULL, *iter;\n+\n+\tspin_lock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\tlist_for_each_entry(iter, \u0026wdev-\u003esmd_get_ctx_pending_list, list) {\n+\t\tif (ether_addr_equal(iter-\u003esta_addr, sta_addr)) {\n+\t\t\tpending = iter;\n+\t\t\tlist_del(\u0026pending-\u003elist);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\n+\tif (!pending) {\n+\t\twiphy_err(wdev-\u003ewiphy,\n+\t\t\t \"No pending SMD ctx req for %pM found in %s\\n\",\n+\t\t\t sta_addr, __func__);\n+\t\treturn;\n+\t}\n+\n+\tnl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info);\n+\n+\tdev_put(wdev-\u003enetdev);\n+\tkfree(pending);\n+}\n+EXPORT_SYMBOL(cfg80211_get_smd_ctx_done);\ndiff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c\nindex ab5a14f5fe283..0de9394954990 100644\n--- a/net/wireless/nl80211.c\n+++ b/net/wireless/nl80211.c\n@@ -689,6 +689,62 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {\n \t[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },\n };\n \n+static const struct nla_policy\n+nl80211_smd_params_policy[NL80211_SMD_PARAMS_ATTR_MAX + 1] = {\n+\t[NL80211_SMD_PARAMS_ATTR_IDENTIFIER] = NLA_POLICY_ETH_ADDR,\n+\t[NL80211_SMD_PARAMS_ATTR_TIMEOUT] =\n+\t\tNLA_POLICY_MIN(NLA_U16, IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN),\n+\t[NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING] = { .type = NLA_FLAG },\n+\t[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] =\n+\t\tNLA_POLICY_MAX(NLA_U8, IEEE80211_SMD_INFO_NUM_PREP_AP_MAX),\n+\t[NL80211_SMD_PARAMS_ATTR_TYPE] =\n+\t\tNLA_POLICY_MAX(NLA_U8, NL80211_SMD_TYPE_MAX),\n+\t[NL80211_SMD_PARAMS_ATTR_PTK_MODE] =\n+\t\tNLA_POLICY_MAX(NLA_U8, NL80211_SMD_PTK_MODE_MAX),\n+\t[NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING] = { .type = NLA_FLAG },\n+};\n+\n+static const struct nla_policy\n+nl80211_smd_ctx_ba_policy[NL80211_SMD_CTX_BA_ATTR_MAX + 1] = {\n+\t[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },\n+\t[NL80211_SMD_CTX_BA_ATTR_POLICY] = { .type = NLA_U8 },\n+\t[NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT] = { .type = NLA_FLAG },\n+\t[NL80211_SMD_CTX_BA_ATTR_TIMEOUT] = { .type = NLA_U16 },\n+\t[NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG] = { .type = NLA_FLAG },\n+\t[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL] = { .type = NLA_U8 },\n+\t[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE] = { .type = NLA_U16 },\n+};\n+\n+static const struct nla_policy\n+nl80211_smd_ctx_dl_policy[NL80211_SMD_CTX_DL_ATTR_MAX + 1] = {\n+\t[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n+\t[NL80211_SMD_CTX_DL_ATTR_SN] = { .type = NLA_NESTED },\n+\t[NL80211_SMD_CTX_DL_ATTR_PN] = { .type = NLA_BINARY,\n+\t\t\t\t\t .len = IEEE80211_SMD_CTX_MAX_PN_LEN },\n+\t[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS] =\n+\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\n+};\n+\n+static const struct nla_policy\n+nl80211_smd_ctx_ul_policy[NL80211_SMD_CTX_UL_ATTR_MAX + 1] = {\n+\t[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n+\t[NL80211_SMD_CTX_UL_ATTR_SN] = { .type = NLA_NESTED },\n+\t[NL80211_SMD_CTX_UL_ATTR_PN] = { .type = NLA_NESTED },\n+\t[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS] =\n+\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\n+};\n+\n+static const struct nla_policy\n+nl80211_smd_ctx_policy[NL80211_SMD_CTX_ATTR_MAX + 1] = {\n+\t[NL80211_SMD_CTX_ATTR_DL] =\n+\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_dl_policy),\n+\t[NL80211_SMD_CTX_ATTR_UL] =\n+\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_ul_policy),\n+\t[NL80211_SMD_CTX_ATTR_DRV_DATA] =\n+\t\tNLA_POLICY_RANGE(NLA_BINARY,\n+\t\t\t\t 3, IEEE80211_MAX_DATA_LEN),\n+};\n+\n static const struct netlink_range_validation nl80211_punct_bitmap_range = {\n \t.min = 0,\n \t.max = 0xffff,\n@@ -1098,6 +1154,15 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n \t\tNLA_POLICY_FULL_RANGE(NLA_U32, \u0026nl80211_punct_bitmap_range),\n \t[NL80211_ATTR_STA_DUMP_LINK_STATS] = { .type = NLA_FLAG },\n \t[NL80211_ATTR_FRAME_NO_STA] = { .type = NLA_FLAG },\n+\t[NL80211_ATTR_SMD_PARAMS] =\n+\t\tNLA_POLICY_NESTED(nl80211_smd_params_policy),\n+\t[NL80211_ATTR_PEER_SMD_ENABLED] = { .type = NLA_FLAG },\n+\t[NL80211_ATTR_PEER_SMD_MAC_ADDR] = NLA_POLICY_ETH_ADDR,\n+\t[NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING] = { .type = NLA_FLAG },\n+\t[NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },\n+\t[NL80211_ATTR_SMD_CTX] = NLA_POLICY_NESTED(nl80211_smd_ctx_policy),\n+\t[NL80211_ATTR_SMD_CTX_TYPE] =\n+\t\tNLA_POLICY_MAX(NLA_U8, NL80211_SMD_CTX_TYPE_MAX),\n };\n \n /* policy for the key attributes */\n@@ -7208,6 +7273,78 @@ static int nl80211_check_npca(struct cfg80211_registered_device *rdev,\n \treturn -EINVAL;\n }\n \n+static int nl80211_parse_smd_params(struct genl_info *info,\n+\t\t\t\t struct cfg80211_smd_params *smd_params)\n+{\n+\tstruct nlattr *smd_params_attr = info-\u003eattrs[NL80211_ATTR_SMD_PARAMS];\n+\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n+\tstruct net_device *dev = info-\u003euser_ptr[1];\n+\tstruct wireless_dev *wdev = dev-\u003eieee80211_ptr;\n+\tstruct nlattr *tb[NL80211_SMD_PARAMS_ATTR_MAX + 1];\n+\tint err;\n+\n+\tif (!wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\n+\t\t\t\t NL80211_EXT_FEATURE_SMD)) {\n+\t\tGENL_SET_ERR_MSG(info, \"SMD is not supported\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tif (!wdev-\u003evalid_links) {\n+\t\tGENL_SET_ERR_MSG(info, \"SMD is not allowed without MLO\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\terr = nla_parse_nested(tb, NL80211_SMD_PARAMS_ATTR_MAX,\n+\t\t\t smd_params_attr, nl80211_smd_params_policy,\n+\t\t\t NULL);\n+\tif (err) {\n+\t\tGENL_SET_ERR_MSG(info, \"failed to parse SMD parameters\");\n+\t\treturn err;\n+\t}\n+\n+\tif (!tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER] ||\n+\t !tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT] ||\n+\t !tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] ||\n+\t !tb[NL80211_SMD_PARAMS_ATTR_TYPE] ||\n+\t !tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]) {\n+\t\tGENL_SET_ERR_MSG(info, \"required SMD parameters are missing\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmemcpy(smd_params-\u003esmd_identifier,\n+\t nla_data(tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER]),\n+\t ETH_ALEN);\n+\n+\tsmd_params-\u003esmd_timeout =\n+\t\tnla_get_u16(tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT]);\n+\n+\tsmd_params-\u003edl_data_fwd =\n+\t\t!!tb[NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING];\n+\tif (smd_params-\u003edl_data_fwd \u0026\u0026\n+\t !wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\n+\t\t\t\t NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING)) {\n+\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t \"SMD DL packet forwarding is not supported\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\tsmd_params-\u003emax_num_of_peer_apmlds =\n+\t\tnla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS]);\n+\n+\tsmd_params-\u003esmd_type =\n+\t\tnla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_TYPE]);\n+\n+\tsmd_params-\u003eptk_mode =\n+\t\tnla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]);\n+\n+\tsmd_params-\u003eneighbor_probing =\n+\t\t!!tb[NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING];\n+\n+\tsmd_params-\u003esmd_enabled = true;\n+\n+\treturn 0;\n+}\n+\n static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)\n {\n \tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n@@ -7489,6 +7626,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)\n \n \t/* FIXME: validate MLO/link-id against driver capabilities */\n \n+\tif (info-\u003eattrs[NL80211_ATTR_SMD_PARAMS]) {\n+\t\terr = nl80211_parse_smd_params(info, \u0026params-\u003esmd_params);\n+\t\tif (err)\n+\t\t\tgoto out;\n+\t}\n+\n \terr = rdev_start_ap(rdev, dev, params);\n \tif (!err) {\n \t\twdev-\u003elinks[link_id].ap.beacon_interval = params-\u003ebeacon_interval;\n@@ -7608,6 +7751,10 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {\n \t[NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG },\n \t[NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG },\n \t[NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG },\n+\t[NL80211_STA_FLAG_SMD] = { .type = NLA_FLAG },\n+\t[NL80211_STA_FLAG_SMD_PREP_TARGET] = { .type = NLA_FLAG },\n+\t[NL80211_STA_FLAG_SMD_EXEC_CURRENT] = { .type = NLA_FLAG },\n+\t[NL80211_STA_FLAG_SMD_DL_DRAIN] = { .type = NLA_FLAG },\n };\n \n static int parse_station_flags(struct genl_info *info,\n@@ -7674,11 +7821,17 @@ static int parse_station_flags(struct genl_info *info,\n \tswitch (iftype) {\n \tcase NL80211_IFTYPE_AP:\n \tcase NL80211_IFTYPE_AP_VLAN:\n+\t\tparams-\u003esta_flags_mask =\n+\t\t\tBIT(NL80211_STA_FLAG_SMD) |\n+\t\t\tBIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |\n+\t\t\tBIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |\n+\t\t\tBIT(NL80211_STA_FLAG_SMD_DL_DRAIN);\n+\t\tfallthrough;\n \tcase NL80211_IFTYPE_P2P_GO:\n-\t\tparams-\u003esta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |\n-\t\t\t\t\t BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |\n-\t\t\t\t\t BIT(NL80211_STA_FLAG_WME) |\n-\t\t\t\t\t BIT(NL80211_STA_FLAG_MFP);\n+\t\tparams-\u003esta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) |\n+\t\t\t\t\t BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |\n+\t\t\t\t\t BIT(NL80211_STA_FLAG_WME) |\n+\t\t\t\t\t BIT(NL80211_STA_FLAG_MFP);\n \t\tbreak;\n \tcase NL80211_IFTYPE_P2P_CLIENT:\n \tcase NL80211_IFTYPE_STATION:\n@@ -8819,7 +8972,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,\n \t\treturn -EINVAL;\n \n \t/* When you run into this, adjust the code below for the new flag */\n-\tBUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);\n+\tBUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);\n \n \tswitch (statype) {\n \tcase CFG80211_STA_MESH_PEER_KERNEL:\n@@ -8913,7 +9066,11 @@ int cfg80211_check_station_change(struct wiphy *wiphy,\n \t\t\t\t BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |\n \t\t\t\t BIT(NL80211_STA_FLAG_WME) |\n \t\t\t\t BIT(NL80211_STA_FLAG_MFP) |\n-\t\t\t\t BIT(NL80211_STA_FLAG_SPP_AMSDU)))\n+\t\t\t\t BIT(NL80211_STA_FLAG_SPP_AMSDU) |\n+\t\t\t\t BIT(NL80211_STA_FLAG_SMD) |\n+\t\t\t\t BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |\n+\t\t\t\t BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |\n+\t\t\t\t BIT(NL80211_STA_FLAG_SMD_DL_DRAIN)))\n \t\t\treturn -EINVAL;\n \n \t\t/* but authenticated/associated only if driver handles it */\n@@ -9167,6 +9324,32 @@ static int nl80211_parse_sta_txpower_setting(struct genl_info *info,\n \treturn 0;\n }\n \n+static int nl80211_set_station_smd(struct genl_info *info,\n+\t\t\t\t struct station_parameters *params)\n+{\n+\tstruct nlattr *smd_mac;\n+\n+\tparams-\u003esmd_params.smd_sta =\n+\t\t!!info-\u003eattrs[NL80211_ATTR_PEER_SMD_ENABLED];\n+\n+\tif (!params-\u003esmd_params.smd_sta)\n+\t\treturn 0;\n+\n+\tsmd_mac = info-\u003eattrs[NL80211_ATTR_PEER_SMD_MAC_ADDR];\n+\n+\tif (!info-\u003eattrs[NL80211_ATTR_MLD_ADDR] || !smd_mac)\n+\t\treturn -EINVAL;\n+\n+\tnla_memcpy(params-\u003esmd_params.smd_identifier, smd_mac, ETH_ALEN);\n+\n+\tparams-\u003esmd_params.dl_data_fwd =\n+\t\t!!info-\u003eattrs[NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING];\n+\n+\tparams-\u003esmd_params.roam_sta = !!info-\u003eattrs[NL80211_ATTR_SMD_ROAM_STA];\n+\n+\treturn 0;\n+}\n+\n static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)\n {\n \tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n@@ -9305,6 +9488,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)\n \tif (err)\n \t\treturn err;\n \n+\terr = nl80211_set_station_smd(info, \u0026params);\n+\tif (err)\n+\t\treturn err;\n+\n \t/* Include parameters for TDLS peer (will check later) */\n \terr = nl80211_set_station_tdls(info, \u0026params);\n \tif (err)\n@@ -9533,6 +9720,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)\n \tif (parse_station_flags(info, wdev-\u003eiftype, \u0026params))\n \t\treturn -EINVAL;\n \n+\terr = nl80211_set_station_smd(info, \u0026params);\n+\tif (err)\n+\t\treturn err;\n+\n \t/* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT\n \t * as userspace might just pass through the capabilities from the IEs\n \t * directly, rather than enforcing this restriction and returning an\n@@ -9566,7 +9757,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)\n \t\treturn -EINVAL;\n \n \t/* When you run into this, adjust the code below for the new flag */\n-\tBUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);\n+\tBUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);\n \n \tswitch (wdev-\u003eiftype) {\n \tcase NL80211_IFTYPE_AP:\n@@ -19387,6 +19578,556 @@ nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)\n \treturn rdev_set_epcs(rdev, dev, val);\n }\n \n+static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids)\n+{\n+\tsize_t n = 0;\n+\n+\tn += nla_total_size(0); /* ba_params nest header */\n+\tn += n_tids * (nla_total_size(0) + /* tid nest header */\n+\t\t nla_total_size(sizeof(u16)) + /* buff_size */\n+\t\t nla_total_size(sizeof(u8)) + /* policy */\n+\t\t nla_total_size(0) + /* amsdu_support */\n+\t\t nla_total_size(sizeof(u16)) + /* timeout */\n+\t\t nla_total_size(0) + /* ext_no_frag */\n+\t\t nla_total_size(sizeof(u8)) + /* ext_frag_lvl */\n+\t\t nla_total_size(sizeof(u16))); /* ext_buff_size */\n+\n+\treturn n;\n+}\n+\n+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info)\n+{\n+\tconst struct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\n+\tint n_dl_tids = 0, n_ul_tids = 0;\n+\tu8 pn_len = ctx-\u003epn_len;\n+\tsize_t n = 0;\n+\n+\t/* count valid TIDs */\n+\tn_dl_tids = bitmap_weight(ctx-\u003edl.valid_tid_bmap,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n+\tn_ul_tids = bitmap_weight(ctx-\u003eul.valid_tid_bmap,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n+\n+\tn += nla_total_size(sizeof(u8)); /* ST type */\n+\n+\t/* outer NL80211_ATTR_SMD_CTX nest */\n+\tn += nla_total_size(0); /* nest header */\n+\n+\t/* DL nest */\n+\tn += nla_total_size(0); /* DL nest header */\n+\n+\tn += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tn += nla_total_size(0); /* DL SN nest header */\n+\t\tn += n_dl_tids * nla_total_size(sizeof(u16)); /* DL SN */\n+\t}\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap))\n+\t\tn += nla_total_size(pn_len); /* DL PN */\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\n+\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids); /* DL BA */\n+\n+\t/* UL nest */\n+\tn += nla_total_size(0); /* UL nest header */\n+\n+\tn += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tn += nla_total_size(0); /* UL SN nest header */\n+\t\tn += n_ul_tids * nla_total_size(sizeof(u16)); /* UL SN */\n+\t}\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tn += nla_total_size(0); /* UL PN nest header */\n+\t\tn += n_ul_tids * nla_total_size(pn_len); /* UL PN */\n+\t}\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\n+\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids); /* UL BA */\n+\n+\tif (ctx-\u003edrv_ctx_size)\n+\t\tn += nla_total_size(ctx-\u003edrv_ctx_size); /* Driver data */\n+\n+\treturn n;\n+}\n+\n+static int\n+nl80211_put_smd_ctx_ba_params(struct sk_buff *msg,\n+\t\t\t const unsigned long *tid_bmap,\n+\t\t\t const struct ieee80211_smd_ctx_ba *ba_tids,\n+\t\t\t bool dl)\n+{\n+\tu32 ba_params_attr = NL80211_SMD_CTX_DL_ATTR_BA_PARAMS;\n+\tstruct nlattr *dl_ul_ba = NULL, *tid_ba = NULL;\n+\tu8 tid;\n+\n+\tif (!dl)\n+\t\tba_params_attr = NL80211_SMD_CTX_UL_ATTR_BA_PARAMS;\n+\n+\tdl_ul_ba = nla_nest_start(msg, ba_params_attr);\n+\tif (!dl_ul_ba)\n+\t\treturn -ENOBUFS;\n+\n+\tfor_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\tconst struct ieee80211_smd_ctx_ba *ba = \u0026ba_tids[tid];\n+\n+\t\ttid_ba = nla_nest_start(msg, tid + 1);\n+\t\tif (!tid_ba)\n+\t\t\tgoto nla_fail;\n+\n+\t\tif (nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,\n+\t\t\t\tba-\u003ebuffer_size) ||\n+\t\t nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_POLICY,\n+\t\t\t ba-\u003eba_policy) ||\n+\t\t (ba-\u003eamsdu_supported \u0026\u0026\n+\t\t nla_put_flag(msg,\n+\t\t\t\t NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT)) ||\n+\t\t nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_TIMEOUT,\n+\t\t\t\tba-\u003etimeout) ||\n+\t\t (ba-\u003eext_no_frag \u0026\u0026\n+\t\t nla_put_flag(msg, NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG)) ||\n+\t\t nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,\n+\t\t\t ba-\u003eextfrag_level) ||\n+\t\t nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,\n+\t\t\t\tba-\u003eext_buffer_size)) {\n+\t\t\tnla_nest_cancel(msg, tid_ba);\n+\t\t\tgoto nla_fail;\n+\t\t}\n+\n+\t\tnla_nest_end(msg, tid_ba);\n+\t}\n+\n+\tnla_nest_end(msg, dl_ul_ba);\n+\treturn 0;\n+\n+nla_fail:\n+\tnla_nest_cancel(msg, dl_ul_ba);\n+\treturn -ENOBUFS;\n+}\n+\n+int nl80211_put_smd_ctx(struct sk_buff *msg,\n+\t\t\tstruct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;\n+\tstruct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;\n+\tconst struct ieee80211_smd_ctx *ctx;\n+\tu8 dl_tid_bmap = 0, ul_tid_bmap = 0;\n+\tbool pn_size_valid;\n+\tu8 tid;\n+\n+\t/* ST Type */\n+\tif (nla_put_u8(msg, NL80211_ATTR_SMD_CTX_TYPE, st_info-\u003etype))\n+\t\treturn -ENOBUFS;\n+\n+\tsmd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);\n+\tif (!smd_ctx)\n+\t\treturn -ENOBUFS;\n+\n+\tctx = st_info-\u003ectx;\n+\n+\t/* Build DL context */\n+\tdl_tid_bmap = bitmap_read(ctx-\u003edl.valid_tid_bmap, 0,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n+\n+\tdl = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_DL);\n+\tif (!dl)\n+\t\tgoto nla_fail;\n+\n+\tif (nla_put_u8(msg, NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,\n+\t\t dl_tid_bmap))\n+\t\tgoto nla_fail_dl;\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tdl_sn = nla_nest_start(msg, NL80211_SMD_CTX_DL_ATTR_SN);\n+\t\tif (!dl_sn)\n+\t\t\tgoto nla_fail_dl;\n+\n+\t\tfor_each_set_bit(tid, ctx-\u003edl.valid_tid_bmap,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\tif (nla_put_u16(msg, tid + 1, ctx-\u003edl.sn[tid])) {\n+\t\t\t\tnla_nest_cancel(msg, dl_sn);\n+\t\t\t\tgoto nla_fail_dl;\n+\t\t\t}\n+\t\t}\n+\t\tnla_nest_end(msg, dl_sn);\n+\t}\n+\n+\tpn_size_valid =\n+\t\tctx-\u003epn_len \u0026\u0026 ctx-\u003epn_len \u003c= IEEE80211_SMD_CTX_MAX_PN_LEN;\n+\n+\tif (pn_size_valid \u0026\u0026\n+\t test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n+\t nla_put(msg, NL80211_SMD_CTX_DL_ATTR_PN, ctx-\u003epn_len, ctx-\u003edl.pn))\n+\t\tgoto nla_fail_dl;\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n+\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003edl.valid_tid_bmap,\n+\t\t\t\t\t ctx-\u003edl.ba, true))\n+\t\tgoto nla_fail_dl;\n+\n+\tnla_nest_end(msg, dl);\n+\n+\t/* Build UL context */\n+\tul_tid_bmap = bitmap_read(ctx-\u003eul.valid_tid_bmap, 0,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n+\n+\tul = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_UL);\n+\tif (!ul)\n+\t\tgoto nla_fail;\n+\n+\tif (nla_put_u8(msg, NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,\n+\t\t ul_tid_bmap))\n+\t\tgoto nla_fail_ul;\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tul_sn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_SN);\n+\t\tif (!ul_sn)\n+\t\t\tgoto nla_fail_ul;\n+\n+\t\tfor_each_set_bit(tid, ctx-\u003eul.valid_tid_bmap,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\tif (nla_put_u16(msg, tid + 1, ctx-\u003eul.sn[tid])) {\n+\t\t\t\tnla_nest_cancel(msg, ul_sn);\n+\t\t\t\tgoto nla_fail_ul;\n+\t\t\t}\n+\t\t}\n+\t\tnla_nest_end(msg, ul_sn);\n+\t}\n+\n+\tif (pn_size_valid \u0026\u0026\n+\t test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap)) {\n+\t\tul_pn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_PN);\n+\t\tif (!ul_pn)\n+\t\t\tgoto nla_fail_ul;\n+\n+\t\tfor_each_set_bit(tid, ctx-\u003eul.valid_tid_bmap,\n+\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\tif (nla_put(msg, tid + 1, ctx-\u003epn_len,\n+\t\t\t\t ctx-\u003eul.pn[tid])) {\n+\t\t\t\tnla_nest_cancel(msg, ul_pn);\n+\t\t\t\tgoto nla_fail_ul;\n+\t\t\t}\n+\t\t}\n+\t\tnla_nest_end(msg, ul_pn);\n+\t}\n+\n+\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n+\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003eul.valid_tid_bmap,\n+\t\t\t\t\t ctx-\u003eul.ba, false))\n+\t\tgoto nla_fail_ul;\n+\n+\tnla_nest_end(msg, ul);\n+\n+\t/* Driver data blob */\n+\tif (ctx-\u003edrv_ctx_size \u0026\u0026\n+\t nla_put(msg, NL80211_SMD_CTX_ATTR_DRV_DATA, ctx-\u003edrv_ctx_size,\n+\t\t ctx-\u003edrv_ctx))\n+\t\tgoto nla_fail;\n+\n+\tnla_nest_end(msg, smd_ctx);\n+\n+\treturn 0;\n+\n+nla_fail_ul:\n+\tnla_nest_cancel(msg, ul);\n+\n+nla_fail_dl:\n+\tnla_nest_cancel(msg, dl);\n+\n+nla_fail:\n+\tnla_nest_cancel(msg, smd_ctx);\n+\treturn -EINVAL;\n+}\n+\n+static int\n+nl80211_parse_smd_ctx_ba_params(struct nlattr *tb,\n+\t\t\t\tstruct ieee80211_smd_ctx_ba *ba_tids,\n+\t\t\t\tunsigned long *valid_ctx_bmap)\n+{\n+\tstruct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1];\n+\tstruct ieee80211_smd_ctx_ba *ba;\n+\tstruct nlattr *ba_attr;\n+\tint n_tids = 0;\n+\tint rem, tid;\n+\n+\tif (!tb)\n+\t\treturn 0;\n+\n+\tnla_for_each_nested(ba_attr, tb, rem) {\n+\t\ttid = nla_type(ba_attr) - 1;\n+\t\tif (tid \u003c 0 || tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS)\n+\t\t\treturn -EINVAL;\n+\n+\t\tif (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX,\n+\t\t\t\t ba_attr, nl80211_smd_ctx_ba_policy,\n+\t\t\t\t NULL))\n+\t\t\treturn -EINVAL;\n+\n+\t\tba = \u0026ba_tids[tid];\n+\n+\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE])\n+\t\t\tba-\u003ebuffer_size =\n+\t\t\t\tnla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE]);\n+\n+\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY])\n+\t\t\tba-\u003eba_policy =\n+\t\t\t\tnla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY]);\n+\n+\t\tba-\u003eamsdu_supported =\n+\t\t\t!!ba_tb[NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT];\n+\n+\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT])\n+\t\t\tba-\u003etimeout =\n+\t\t\t\tnla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT]);\n+\n+\t\tba-\u003eext_no_frag = !!ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG];\n+\n+\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL])\n+\t\t\tba-\u003eextfrag_level =\n+\t\t\t\tnla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL]);\n+\n+\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE])\n+\t\t\tba-\u003eext_buffer_size =\n+\t\t\t\tnla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]);\n+\n+\t\tn_tids++;\n+\t}\n+\n+\tif (!n_tids)\n+\t\treturn -EINVAL;\n+\n+\tset_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, valid_ctx_bmap);\n+\n+\treturn 0;\n+}\n+\n+static int nl80211_parse_smd_ctx(struct genl_info *info,\n+\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct nlattr *dl_tb[NL80211_SMD_CTX_DL_ATTR_MAX + 1];\n+\tstruct nlattr *ul_tb[NL80211_SMD_CTX_UL_ATTR_MAX + 1];\n+\tstruct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];\n+\tstruct ieee80211_smd_ctx *ctx;\n+\tstruct nlattr *bmap_attr;\n+\tsize_t drv_ctx_size = 0;\n+\n+\tst_info-\u003etype = nla_get_u8(info-\u003eattrs[NL80211_ATTR_SMD_CTX_TYPE]);\n+\n+\tif (nla_parse_nested(tb, NL80211_SMD_CTX_ATTR_MAX,\n+\t\t\t info-\u003eattrs[NL80211_ATTR_SMD_CTX],\n+\t\t\t nl80211_smd_ctx_policy, NULL)) {\n+\t\tGENL_SET_ERR_MSG(info, \"failed to parse SMD context\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (tb[NL80211_SMD_CTX_ATTR_DRV_DATA])\n+\t\tdrv_ctx_size = nla_len(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]);\n+\n+\tctx = kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL);\n+\tif (!ctx)\n+\t\treturn -ENOMEM;\n+\n+\tst_info-\u003ectx = ctx;\n+\n+\t/* DL Context */\n+\tif (tb[NL80211_SMD_CTX_ATTR_DL]) {\n+\t\tstruct nlattr *ba_attr;\n+\n+\t\tif (nla_parse_nested(dl_tb, NL80211_SMD_CTX_DL_ATTR_MAX,\n+\t\t\t\t tb[NL80211_SMD_CTX_ATTR_DL],\n+\t\t\t\t nl80211_smd_ctx_dl_policy, NULL)) {\n+\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse DL context\");\n+\t\t\tgoto err_free_ctx;\n+\t\t}\n+\n+\t\tbmap_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP];\n+\t\tif (bmap_attr)\n+\t\t\tbitmap_write(ctx-\u003edl.valid_tid_bmap,\n+\t\t\t\t nla_get_u8(bmap_attr),\n+\t\t\t\t 0, IEEE80211_SMD_CTX_NUM_TIDS);\n+\n+\t\tif (dl_tb[NL80211_SMD_CTX_DL_ATTR_SN]) {\n+\t\t\tstruct nlattr *sn_attr;\n+\t\t\tint n_tids = 0;\n+\t\t\tint rem, tid;\n+\n+\t\t\tnla_for_each_nested(sn_attr,\n+\t\t\t\t\t dl_tb[NL80211_SMD_CTX_DL_ATTR_SN],\n+\t\t\t\t\t rem) {\n+\t\t\t\ttid = nla_type(sn_attr) - 1;\n+\t\t\t\tif (tid \u003c 0 ||\n+\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid DL SN tid\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\n+\t\t\t\tif (nla_len(sn_attr) != sizeof(u16)) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid DL SN len\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\n+\t\t\t\tctx-\u003edl.sn[tid] = nla_get_u16(sn_attr);\n+\t\t\t\tn_tids++;\n+\t\t\t}\n+\n+\t\t\tif (!n_tids) {\n+\t\t\t\tGENL_SET_ERR_MSG(info, \"empty DL SN nesting\");\n+\t\t\t\tgoto err_free_ctx;\n+\t\t\t}\n+\n+\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_DL_SN,\n+\t\t\t\tctx-\u003evalid_ctx_bmap);\n+\t\t}\n+\n+\t\tif (dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]) {\n+\t\t\tconst u8 *pn_data =\n+\t\t\t\tnla_data(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);\n+\n+\t\t\tctx-\u003epn_len =\n+\t\t\t\tnla_len(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);\n+\n+\t\t\tmemcpy(ctx-\u003edl.pn, pn_data, ctx-\u003epn_len);\n+\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_PN,\n+\t\t\t\tctx-\u003evalid_ctx_bmap);\n+\t\t}\n+\n+\t\tba_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS];\n+\t\tif (ba_attr \u0026\u0026\n+\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003edl.ba,\n+\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n+\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t \"failed to parse DL BlockAck params\");\n+\t\t\tgoto err_free_ctx;\n+\t\t}\n+\t}\n+\n+\t/* UL Context */\n+\tif (tb[NL80211_SMD_CTX_ATTR_UL]) {\n+\t\tstruct nlattr *ba_attr;\n+\n+\t\tif (nla_parse_nested(ul_tb, NL80211_SMD_CTX_UL_ATTR_MAX,\n+\t\t\t\t tb[NL80211_SMD_CTX_ATTR_UL],\n+\t\t\t\t nl80211_smd_ctx_ul_policy, NULL)) {\n+\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse UL context\");\n+\t\t\tgoto err_free_ctx;\n+\t\t}\n+\n+\t\tbmap_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP];\n+\t\tif (bmap_attr)\n+\t\t\tbitmap_write(ctx-\u003eul.valid_tid_bmap,\n+\t\t\t\t nla_get_u8(bmap_attr),\n+\t\t\t\t 0, IEEE80211_SMD_CTX_NUM_TIDS);\n+\n+\t\tif (ul_tb[NL80211_SMD_CTX_UL_ATTR_SN]) {\n+\t\t\tstruct nlattr *sn_attr;\n+\t\t\tint n_tids = 0;\n+\t\t\tint rem, tid;\n+\n+\t\t\tnla_for_each_nested(sn_attr,\n+\t\t\t\t\t ul_tb[NL80211_SMD_CTX_UL_ATTR_SN],\n+\t\t\t\t\t rem) {\n+\t\t\t\ttid = nla_type(sn_attr) - 1;\n+\t\t\t\tif (tid \u003c 0 ||\n+\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid UL SN tid\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\n+\t\t\t\tif (nla_len(sn_attr) != sizeof(u16)) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid UL SN len\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\n+\t\t\t\tctx-\u003eul.sn[tid] = nla_get_u16(sn_attr);\n+\t\t\t\tn_tids++;\n+\t\t\t}\n+\n+\t\t\tif (!n_tids) {\n+\t\t\t\tGENL_SET_ERR_MSG(info, \"empty UL SN nesting\");\n+\t\t\t\tgoto err_free_ctx;\n+\t\t\t}\n+\n+\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_UL_SN,\n+\t\t\t\tctx-\u003evalid_ctx_bmap);\n+\t\t}\n+\n+\t\tif (ul_tb[NL80211_SMD_CTX_UL_ATTR_PN]) {\n+\t\t\tstruct nlattr *pn_attr;\n+\t\t\tint n_tids = 0;\n+\t\t\tint rem, tid;\n+\n+\t\t\tnla_for_each_nested(pn_attr,\n+\t\t\t\t\t ul_tb[NL80211_SMD_CTX_UL_ATTR_PN],\n+\t\t\t\t\t rem) {\n+\t\t\t\tu8 pn_len;\n+\n+\t\t\t\ttid = nla_type(pn_attr) - 1;\n+\t\t\t\tif (tid \u003c 0 ||\n+\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid UL PN tid\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\n+\t\t\t\t/*\n+\t\t\t\t * PN length must be the same for all DL and\n+\t\t\t\t * UL TIDs.\n+\t\t\t\t */\n+\t\t\t\tpn_len = nla_len(pn_attr);\n+\t\t\t\tif (pn_len \u003e IEEE80211_SMD_CTX_MAX_PN_LEN ||\n+\t\t\t\t (ctx-\u003epn_len \u0026\u0026 pn_len != ctx-\u003epn_len)) {\n+\t\t\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t\t\t \"invalid PN length\");\n+\t\t\t\t\tgoto err_free_ctx;\n+\t\t\t\t}\n+\t\t\t\tctx-\u003epn_len = pn_len;\n+\n+\t\t\t\tmemcpy(ctx-\u003eul.pn[tid], nla_data(pn_attr),\n+\t\t\t\t ctx-\u003epn_len);\n+\t\t\t\tn_tids++;\n+\t\t\t}\n+\n+\t\t\tif (!n_tids) {\n+\t\t\t\tGENL_SET_ERR_MSG(info, \"empty UL PN nesting\");\n+\t\t\t\tgoto err_free_ctx;\n+\t\t\t}\n+\n+\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_PN,\n+\t\t\t\tctx-\u003evalid_ctx_bmap);\n+\t\t}\n+\n+\t\tba_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS];\n+\t\tif (ba_attr \u0026\u0026\n+\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003eul.ba,\n+\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n+\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t \"failed to parse UL BlockAck params\");\n+\t\t\tgoto err_free_ctx;\n+\t\t}\n+\t}\n+\n+\t/* Driver data */\n+\tif (tb[NL80211_SMD_CTX_ATTR_DRV_DATA]) {\n+\t\tctx-\u003edrv_ctx_size = drv_ctx_size;\n+\t\tmemcpy(ctx-\u003edrv_ctx,\n+\t\t nla_data(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]),\n+\t\t drv_ctx_size);\n+\t}\n+\n+\treturn 0;\n+\n+err_free_ctx:\n+\tkfree(ctx);\n+\tst_info-\u003ectx = NULL;\n+\treturn -EINVAL;\n+}\n+\n #define NL80211_FLAG_NEED_WIPHY\t\t0x01\n #define NL80211_FLAG_NEED_NETDEV\t0x02\n #define NL80211_FLAG_NEED_RTNL\t\t0x04\n@@ -19728,6 +20469,128 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)\n \treturn err;\n }\n \n+static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)\n+{\n+\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n+\tstruct cfg80211_smd_transition_info st_info = {};\n+\tstruct net_device *dev = info-\u003euser_ptr[1];\n+\tstruct wireless_dev *wdev = dev-\u003eieee80211_ptr;\n+\tconst u8 *addr;\n+\tint err;\n+\n+\tif (!rdev-\u003eops-\u003eset_smd_ctx)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tif (wdev-\u003eiftype != NL80211_IFTYPE_AP \u0026\u0026\n+\t wdev-\u003eiftype != NL80211_IFTYPE_AP_VLAN)\n+\t\treturn -EINVAL;\n+\n+\tif (!info-\u003eattrs[NL80211_ATTR_MLD_ADDR] ||\n+\t !info-\u003eattrs[NL80211_ATTR_SMD_CTX] ||\n+\t !info-\u003eattrs[NL80211_ATTR_SMD_CTX_TYPE]) {\n+\t\tGENL_SET_ERR_MSG(info, \"required attributes are missing\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\taddr = nla_data(info-\u003eattrs[NL80211_ATTR_MLD_ADDR]);\n+\n+\terr = nl80211_parse_smd_ctx(info, \u0026st_info);\n+\tif (err)\n+\t\treturn err;\n+\n+\t/* drivers must copy @ctx for any deferred processing */\n+\terr = rdev_set_smd_ctx(rdev, wdev, addr, \u0026st_info);\n+\n+\tkfree(st_info.ctx);\n+\treturn err;\n+}\n+\n+static struct cfg80211_smd_get_ctx_pending *\n+__cfg80211_get_smd_sta_pending_ctx(struct wireless_dev *wdev, const u8 *addr)\n+{\n+\tstruct cfg80211_smd_get_ctx_pending *pending = NULL, *tmp;\n+\n+\tlockdep_assert_held(\u0026wdev-\u003esmd_get_ctx_lock);\n+\n+\tlist_for_each_entry(tmp, \u0026wdev-\u003esmd_get_ctx_pending_list, list) {\n+\t\tif (ether_addr_equal(tmp-\u003esta_addr, addr)) {\n+\t\t\tpending = tmp;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\treturn pending;\n+}\n+\n+static int nl80211_get_smd_ctx(struct sk_buff *skb, struct genl_info *info)\n+{\n+\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n+\tstruct net_device *dev = info-\u003euser_ptr[1];\n+\tstruct wireless_dev *wdev = dev-\u003eieee80211_ptr;\n+\tstruct cfg80211_smd_get_ctx_pending *pending;\n+\tenum nl80211_smd_ctx_type type;\n+\tconst u8 *addr = NULL;\n+\tint err;\n+\n+\tif (!rdev-\u003eops-\u003eget_smd_ctx)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tif (wdev-\u003eiftype != NL80211_IFTYPE_AP \u0026\u0026\n+\t wdev-\u003eiftype != NL80211_IFTYPE_AP_VLAN)\n+\t\treturn -EINVAL;\n+\n+\tif (!info-\u003eattrs[NL80211_ATTR_MLD_ADDR] ||\n+\t !info-\u003eattrs[NL80211_ATTR_SMD_CTX_TYPE]) {\n+\t\tGENL_SET_ERR_MSG(info, \"required attributes are missing\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\taddr = nla_data(info-\u003eattrs[NL80211_ATTR_MLD_ADDR]);\n+\ttype = nla_get_u8(info-\u003eattrs[NL80211_ATTR_SMD_CTX_TYPE]);\n+\n+\tspin_lock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\tif (__cfg80211_get_smd_sta_pending_ctx(wdev, addr)) {\n+\t\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\t\treturn -EBUSY;\n+\t}\n+\t/* safe to unlock, concurrent commands are serialized by wiphy mutex */\n+\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\n+\tpending = kzalloc_obj(*pending);\n+\tif (!pending)\n+\t\treturn -ENOMEM;\n+\n+\tmemcpy(pending-\u003esta_addr, addr, ETH_ALEN);\n+\n+\t/*\n+\t * Take reference and add to the list before calling the driver to avoid\n+\t * race. Upon success, the reference is released while reporting back\n+\t * the context or in the list removal and drain path.\n+\t */\n+\tdev_hold(wdev-\u003enetdev);\n+\n+\tspin_lock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\tlist_add_tail(\u0026pending-\u003elist, \u0026wdev-\u003esmd_get_ctx_pending_list);\n+\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\n+\terr = rdev_get_smd_ctx(rdev, wdev, addr, type);\n+\tif (err) {\n+\t\t/* revert upon failure */\n+\t\tspin_lock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\t\tpending = __cfg80211_get_smd_sta_pending_ctx(wdev, addr);\n+\t\tif (pending) {\n+\t\t\tlist_del(\u0026pending-\u003elist);\n+\t\t\tkfree(pending);\n+\t\t\tdev_put(wdev-\u003enetdev);\n+\t\t}\n+\t\tspin_unlock_bh(\u0026wdev-\u003esmd_get_ctx_lock);\n+\t\treturn err;\n+\t}\n+\n+\t/* Reply will arrive via cfg80211_get_smd_ctx_done() */\n+\treturn 0;\n+}\n+\n #define SELECTOR(__sel, name, value) \\\n \t((__sel) == (value)) ? NL80211_IFL_SEL_##name :\n int __missing_selector(void);\n@@ -20629,6 +21492,19 @@ static const struct genl_small_ops nl80211_small_ops[] = {\n \t\t.flags = GENL_ADMIN_PERM,\n \t\t.internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV_UP),\n \t},\n+\t{\n+\t\t.cmd = NL80211_CMD_SET_SMD_CTX,\n+\t\t.doit = nl80211_set_smd_ctx,\n+\t\t.flags = GENL_UNS_ADMIN_PERM,\n+\t\t.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |\n+\t\t\t\t\t NL80211_FLAG_CLEAR_SKB),\n+\t},\n+\t{\n+\t\t.cmd = NL80211_CMD_GET_SMD_CTX,\n+\t\t.doit = nl80211_get_smd_ctx,\n+\t\t.flags = GENL_UNS_ADMIN_PERM,\n+\t\t.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),\n+\t},\n };\n \n static struct genl_family nl80211_fam __ro_after_init = {\n@@ -22012,10 +22888,14 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\n \t\t struct cfg80211_rx_info *info, gfp_t gfp)\n {\n \tstruct net_device *netdev = wdev-\u003enetdev;\n+\tint st_roaming_data_len = 0;\n \tstruct sk_buff *msg;\n \tvoid *hdr;\n \n-\tmsg = nlmsg_new(100 + info-\u003elen, gfp);\n+\tif (info-\u003est_info.ctx)\n+\t\tst_roaming_data_len = nl80211_smd_ctx_nl_size(\u0026info-\u003est_info);\n+\n+\tmsg = nlmsg_new(100 + info-\u003elen + st_roaming_data_len, gfp);\n \tif (!msg)\n \t\treturn -ENOMEM;\n \n@@ -22051,6 +22931,10 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\n \t nla_put_flag(msg, NL80211_ATTR_FRAME_NO_STA)))\n \t\tgoto nla_put_failure;\n \n+\tif (st_roaming_data_len \u0026\u0026\n+\t nl80211_put_smd_ctx(msg, \u0026info-\u003est_info))\n+\t\tgoto nla_put_failure;\n+\n \tgenlmsg_end(msg, hdr);\n \n \treturn genlmsg_unicast(wiphy_net(\u0026rdev-\u003ewiphy), msg, nlportid);\n@@ -23648,6 +24532,47 @@ void cfg80211_nan_channel_evac(struct wireless_dev *wdev,\n }\n EXPORT_SYMBOL(cfg80211_nan_channel_evac);\n \n+void\n+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,\n+\t\t\t\tconst u8 *sta_addr,\n+\t\t\t\tstruct cfg80211_smd_transition_info *st_info)\n+{\n+\tstruct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev-\u003ewiphy);\n+\tstruct net_device *dev = wdev-\u003enetdev;\n+\tsize_t msg_len = NLMSG_DEFAULT_SIZE;\n+\tstruct sk_buff *msg;\n+\tvoid *hdr;\n+\n+\tif (st_info-\u003ectx)\n+\t\tmsg_len = 100 + nl80211_smd_ctx_nl_size(st_info) +\n+\t\t\t nla_total_size(ETH_ALEN); /* MLD address */\n+\n+\tmsg = nlmsg_new(msg_len, GFP_ATOMIC);\n+\tif (!msg)\n+\t\treturn;\n+\n+\thdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SMD_CTX_EVENT);\n+\tif (!hdr)\n+\t\tgoto nla_put_failure;\n+\n+\tif (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev-\u003ewiphy_idx) ||\n+\t nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev-\u003eifindex) ||\n+\t nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, sta_addr))\n+\t\tgoto nla_put_failure;\n+\n+\tif (st_info-\u003ectx \u0026\u0026 nl80211_put_smd_ctx(msg, st_info))\n+\t\tgoto nla_put_failure;\n+\n+\tgenlmsg_end(msg, hdr);\n+\n+\tgenlmsg_multicast_netns(\u0026nl80211_fam, wiphy_net(\u0026rdev-\u003ewiphy), msg, 0,\n+\t\t\t\tNL80211_MCGRP_MLME, GFP_ATOMIC);\n+\treturn;\n+\n+nla_put_failure:\n+\tnlmsg_free(msg);\n+}\n+\n /* initialisation/exit functions */\n \n int __init nl80211_init(void)\ndiff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h\nindex bdb065d140549..2855d30ba3546 100644\n--- a/net/wireless/nl80211.h\n+++ b/net/wireless/nl80211.h\n@@ -129,4 +129,13 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);\n void nl80211_mlo_reconf_add_done(struct net_device *dev,\n \t\t\t\t struct cfg80211_mlo_reconf_done_data *data);\n \n+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info);\n+int nl80211_put_smd_ctx(struct sk_buff *msg,\n+\t\t\tstruct cfg80211_smd_transition_info *st_info);\n+\n+void\n+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,\n+\t\t\t\tconst u8 *sta_addr,\n+\t\t\t\tstruct cfg80211_smd_transition_info *st_info);\n+\n #endif /* __NET_WIRELESS_NL80211_H */\ndiff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h\nindex 46849fe8d0b39..ab520560f6043 100644\n--- a/net/wireless/rdev-ops.h\n+++ b/net/wireless/rdev-ops.h\n@@ -1636,4 +1636,32 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,\n \treturn ret;\n }\n \n+static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev,\n+\t\t\t\t struct wireless_dev *wdev, const u8 *addr,\n+\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n+{\n+\tint ret = -EOPNOTSUPP;\n+\n+\ttrace_rdev_set_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, st_info);\n+\tif (rdev-\u003eops-\u003eset_smd_ctx)\n+\t\tret = rdev-\u003eops-\u003eset_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, st_info);\n+\ttrace_rdev_return_int(\u0026rdev-\u003ewiphy, ret);\n+\n+\treturn ret;\n+}\n+\n+static inline int rdev_get_smd_ctx(struct cfg80211_registered_device *rdev,\n+\t\t\t\t struct wireless_dev *wdev, const u8 *addr,\n+\t\t\t\t enum nl80211_smd_ctx_type type)\n+{\n+\tint ret = -EOPNOTSUPP;\n+\n+\ttrace_rdev_get_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, type);\n+\tif (rdev-\u003eops-\u003eget_smd_ctx)\n+\t\tret = rdev-\u003eops-\u003eget_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, type);\n+\ttrace_rdev_return_int(\u0026rdev-\u003ewiphy, ret);\n+\n+\treturn ret;\n+}\n+\n #endif /* __CFG80211_RDEV_OPS */\ndiff --git a/net/wireless/trace.h b/net/wireless/trace.h\nindex 8c2a91b85c396..a2662919b8f08 100644\n--- a/net/wireless/trace.h\n+++ b/net/wireless/trace.h\n@@ -4405,6 +4405,79 @@ TRACE_EVENT(cfg80211_nan_channel_evac,\n \tTP_printk(WDEV_PR_FMT \", \" WIPHY_PR_FMT \", \" CHAN_DEF_PR_FMT,\n \t\t WDEV_PR_ARG, WIPHY_PR_ARG, CHAN_DEF_PR_ARG)\n );\n+\n+TRACE_EVENT(rdev_set_smd_ctx,\n+\tTP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,\n+\t\t struct cfg80211_smd_transition_info *st_info),\n+\n+\tTP_ARGS(wiphy, wdev, addr, st_info),\n+\n+\tTP_STRUCT__entry(\n+\t\tWIPHY_ENTRY\n+\t\tWDEV_ENTRY\n+\t\tMAC_ENTRY(sta_addr)\n+\t\t__field(u8, st_type)\n+\t\t__field(unsigned int, num_tids)\n+\t\t__dynamic_array(unsigned long, tx_tid_bitmap,\n+\t\t\t\tBITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))\n+\t\t__dynamic_array(unsigned long, rx_tid_bitmap,\n+\t\t\t\tBITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))\n+\t),\n+\n+\tTP_fast_assign(\n+\t\tstruct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\n+\t\tunsigned long sz;\n+\n+\t\tWIPHY_ASSIGN;\n+\t\tWDEV_ASSIGN;\n+\t\tMAC_ASSIGN(sta_addr, addr);\n+\t\t__entry-\u003est_type = st_info-\u003etype;\n+\n+\t\t__entry-\u003enum_tids = IEEE80211_SMD_CTX_NUM_TIDS;\n+\t\tsz = BITS_TO_LONGS(__entry-\u003enum_tids) * sizeof(unsigned long);\n+\n+\t\tmemcpy(__get_dynamic_array(tx_tid_bitmap),\n+\t\t ctx-\u003edl.valid_tid_bmap, sz);\n+\t\tmemcpy(__get_dynamic_array(rx_tid_bitmap),\n+\t\t ctx-\u003eul.valid_tid_bmap, sz);\n+\t),\n+\n+\tTP_printk(WIPHY_PR_FMT \", \" WDEV_PR_FMT\n+\t\t \", sta=%pM, ST type=%u DL TIDs: %*pb, UL TIDs: %*pb\",\n+\t\t WIPHY_PR_ARG, WDEV_PR_ARG, __entry-\u003esta_addr,\n+\t\t __entry-\u003est_type,\n+\t\t __entry-\u003enum_tids,\n+\t\t (unsigned long *)__get_dynamic_array(tx_tid_bitmap),\n+\t\t __entry-\u003enum_tids,\n+\t\t (unsigned long *)__get_dynamic_array(rx_tid_bitmap))\n+);\n+\n+TRACE_EVENT(rdev_get_smd_ctx,\n+\tTP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,\n+\t\t enum nl80211_smd_ctx_type type),\n+\n+\tTP_ARGS(wiphy, wdev, addr, type),\n+\n+\tTP_STRUCT__entry(\n+\t\tWIPHY_ENTRY\n+\t\tWDEV_ENTRY\n+\t\tMAC_ENTRY(sta_addr)\n+\t\t__field(u8, st_type)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\tWIPHY_ASSIGN;\n+\t\tWDEV_ASSIGN;\n+\t\tMAC_ASSIGN(sta_addr, addr);\n+\t\t__entry-\u003est_type = type;\n+\t),\n+\n+\tTP_printk(WIPHY_PR_FMT \", \" WDEV_PR_FMT\n+\t\t \", sta=%pM, ST type=%u\",\n+\t\t WIPHY_PR_ARG, WDEV_PR_ARG, __entry-\u003esta_addr,\n+\t\t __entry-\u003est_type)\n+);\n+\n #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */\n \n #undef TRACE_INCLUDE_PATH\n"
} |
| 2/1 | 2026/09/26 05:47 | agent | patch-evaluator |
1mModel:core Args: null Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_set_smd_ctx",
"nl80211_get_smd_ctx",
"nl80211_parse_smd_ctx",
"nl80211_put_smd_ctx",
"cfg80211_free_pending_smd_ctx_req",
"cfg80211_get_smd_ctx_done",
"sta_info_move_smd_state",
"sta_info_reset_smd_state",
"sta_info_move_drv_smd_state",
"drv_sta_smd_state"
],
"Reasoning": "The patch series adds support for IEEE 802.11bn Ultra High Reliability (UHR) Seamless Mobility Domain (SMD) BSS Transition to cfg80211 and mac80211. It introduces new user-accessible netlink commands (NL80211_CMD_SET_SMD_CTX and NL80211_CMD_GET_SMD_CTX), complex nested netlink attribute parsing and serialization routines, SMD station state machine management with multiple WARN_ON checks, and asynchronous pending request tracking. These paths are reachable from userspace via nl80211 and emulated wireless devices like mac80211_hwsim, making them well-suited for fuzzing.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 5cfe055d5f8b97d7088e07d7da2a7f059bc02d0d
Author: syz-cluster <triage@syzkaller.com>
Date: Sat Sep 26 05:47:17 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/ieee80211-uhr.h b/include/linux/ieee80211-uhr.h
index 19e9260d0db80..e74de842b281d 100644
--- a/include/linux/ieee80211-uhr.h
+++ b/include/linux/ieee80211-uhr.h
@@ -589,6 +589,10 @@ ieee80211_uhr_dbe_cap(const struct ieee80211_uhr_cap *cap)
#define IEEE80211_SMD_INFO_CAPA_TYPE 0x10
#define IEEE80211_SMD_INFO_CAPA_PTK_PER_AP_MLD 0x20
+/* IEEE P802.11bn/D2.0, Aug 2026, subclause 9.4.2.363 */
+#define IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN 2 /* in 64 TUs */
+#define IEEE80211_SMD_INFO_NUM_PREP_AP_MAX 7
+
struct ieee80211_smd_info {
u8 id[ETH_ALEN];
u8 capa;
@@ -645,6 +649,92 @@ struct ieee80211_uhr_mode_change_tuple {
u8 variable[];
} __packed;
+/*
+ * Context information carried in SMD BSS Transition (refer IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 37.16.9.
+ */
+#define IEEE80211_SMD_CTX_NUM_VALID_CTX 8
+
+#define IEEE80211_SMD_CTX_VALID_DL_SN 0
+#define IEEE80211_SMD_CTX_VALID_UL_SN 1
+#define IEEE80211_SMD_CTX_VALID_PN 2
+#define IEEE80211_SMD_CTX_VALID_BA_PARAMS 3
+/* Positions 4 to 7 are reserved */
+
+/*
+ * Data TIDs transported in the context, IEEE P802.11bn/D2.0, Aug 2026,
+ * subclause 9.4.2.364.
+ */
+#define IEEE80211_SMD_CTX_NUM_TIDS 8
+
+#define IEEE80211_SMD_CTX_MAX_PN_LEN 16
+
+/**
+ * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL
+ *
+ * @amsdu_supported: Peer's capability to support A-MSDU within A-MPDU.
+ * @ba_policy: BlockAck policy (0 = delayed BlockAck, 1 = immediate BlockAck)
+ * @buffer_size: Reorder buffer size from ADDBA Request (10-bit, max 1023)
+ * @timeout: BlockAck session timeout
+ * @ext_no_frag: ADDBA Extension fragmentation support
+ * @extfrag_level: ADDBA Extension HE fragmentation level
+ * @ext_buffer_size: ADDBA Extension buffer size; combined with @buffer_size as
+ * (@ext_buffer_size << 10 | @buffer_size) to get the full reorder
+ * buffer size
+ */
+struct ieee80211_smd_ctx_ba {
+ bool amsdu_supported;
+ u8 ba_policy;
+ u16 buffer_size;
+ u16 timeout;
+ bool ext_no_frag;
+ u8 extfrag_level;
+ u16 ext_buffer_size;
+};
+
+/**
+ * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)
+ *
+ * @valid_ctx_bmap: Bitmap indicating which context fields are valid;
+ * bit positions defined by IEEE80211_SMD_CTX_VALID_* constants
+ * @pn_len: Length of PN in bytes; varies by cipher type
+ * (e.g. CCMP (6), GCMP-256 (16))
+ * @dl: Down-link context data
+ * @dl.valid_tid_bmap: valid DL TIDs for which context is present
+ * @dl.sn: DL SN per-TID to be assigned next
+ * @dl.pn: DL PN to be assigned next
+ * @dl.ba: DL BlockAck parameters per-TID for the BlockAck session
+ * @ul: Up-link context data
+ * @ul.valid_tid_bmap: valid UL TIDs for which context is present
+ * @ul.sn: UL SN per-TID to be checked next
+ * @ul.pn: UL PN per-TID to be checked next
+ * @ul.ba: UL BlockAck parameters per-TID for the BlockAck session
+ * @drv_ctx_size: Number of valid bytes in @drv_ctx.
+ * @drv_ctx: Variable-sized array of driver-specific context, counted by
+ * @drv_ctx_size. Opaque to the wireless core; interpreted by drivers.
+ */
+struct ieee80211_smd_ctx {
+ DECLARE_BITMAP(valid_ctx_bmap, IEEE80211_SMD_CTX_NUM_VALID_CTX);
+ u8 pn_len;
+
+ struct {
+ DECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);
+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN];
+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];
+ } dl;
+ struct {
+ DECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);
+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN];
+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];
+ } ul;
+
+ size_t drv_ctx_size;
+ u8 drv_ctx[] ____cacheline_aligned __counted_by(drv_ctx_size);
+};
+
static inline int
ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tuple *tuple)
{
@@ -653,6 +743,65 @@ ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tupl
IEEE80211_UHR_MODE_CHANGE_CONTROL_MODE_LENGTH);
}
+/**
+ * ieee80211_is_uhr_link_reconf_req - check if frame is UHR Link Reconf Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is a UHR Link Reconf Request frame
+ */
+static inline bool ieee80211_is_uhr_link_reconf_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 category, action;
+
+ if (!ieee80211_is_action(mgmt->frame_control))
+ return false;
+
+ if (skb->len < IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))
+ return false;
+
+ category = mgmt->u.action.category;
+ action = mgmt->u.action.action_code;
+
+ return category == WLAN_CATEGORY_PROTECTED_UHR &&
+ action == IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_REQUEST;
+}
+
+/**
+ * ieee80211_is_st_prep_req - check if frame is ST Preparation Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Prep request frame
+ */
+static inline bool ieee80211_is_st_prep_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_PREP;
+}
+
+/**
+ * ieee80211_is_st_exec_req - check if frame is ST Execution Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Exec request frame
+ */
+static inline bool ieee80211_is_st_exec_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC;
+}
+
#define for_each_uhr_mode_change_tuple(data, len, tuple) \
for (tuple = (const void *)(data); \
(len) - ((const u8 *)tuple - (data)) >= sizeof(*tuple) && \
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9aa7d2d4a1841..71711dbbf7495 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1587,6 +1587,29 @@ struct cfg80211_s1g_short_beacon {
size_t short_tail_len;
};
+/**
+ * struct cfg80211_smd_params - Seamless Mobility Domain parameters
+ *
+ * @smd_enabled: SMD is enabled on this device
+ * @smd_identifier: SMD ID (ETH_ALEN bytes)
+ * @smd_timeout: timeout in 64 TUs for ST Preparation
+ * @dl_data_fwd: MSDU forwarding supported
+ * @max_num_of_peer_apmlds: max prepared AP MLDs supported (0-7)
+ * @smd_type: SMD type
+ * @ptk_mode: PTK mode
+ * @neighbor_probing: UHR Neighboring AP Probing supported
+ */
+struct cfg80211_smd_params {
+ bool smd_enabled;
+ u8 smd_identifier[ETH_ALEN];
+ u16 smd_timeout;
+ bool dl_data_fwd;
+ u8 max_num_of_peer_apmlds;
+ enum nl80211_smd_type smd_type;
+ enum nl80211_smd_ptk_mode ptk_mode;
+ bool neighbor_probing;
+};
+
/**
* struct cfg80211_ap_settings - AP configuration
*
@@ -1623,6 +1646,7 @@ struct cfg80211_s1g_short_beacon {
* @mbssid_config: AP settings for multiple bssid
* @s1g_long_beacon_period: S1G long beacon period
* @s1g_short_beacon: S1G short beacon data
+ * @smd_params: Seamless Mobility Domain (SMD) parameters
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
@@ -1655,6 +1679,7 @@ struct cfg80211_ap_settings {
struct cfg80211_mbssid_config mbssid_config;
u8 s1g_long_beacon_period;
struct cfg80211_s1g_short_beacon s1g_short_beacon;
+ struct cfg80211_smd_params smd_params;
};
@@ -1872,6 +1897,21 @@ struct cfg80211_ttlm_params {
u16 ulink[8];
};
+/**
+ * struct cfg80211_sta_smd_params - SMD parameters for an added station
+ *
+ * @smd_sta: SMD-negotiated STA
+ * @smd_identifier: SMD Identifier
+ * @dl_data_fwd: MSDU forwarding supported
+ * @roam_sta: station was created via SMD BSS Transition procedure
+ */
+struct cfg80211_sta_smd_params {
+ bool smd_sta;
+ u8 smd_identifier[ETH_ALEN];
+ bool dl_data_fwd;
+ bool roam_sta;
+};
+
/**
* struct station_parameters - station parameters
*
@@ -1912,6 +1952,7 @@ struct cfg80211_ttlm_params {
* @link_sta_params: link related params.
* @epp_peer: EPP peer indication
* @nmi_mac: MAC address of the NMI station of the NAN peer
+ * @smd_params: SMD params for this station
*/
struct station_parameters {
struct net_device *vlan;
@@ -1940,6 +1981,7 @@ struct station_parameters {
struct link_station_parameters link_sta_params;
bool epp_peer;
const u8 *nmi_mac;
+ struct cfg80211_sta_smd_params smd_params;
};
/**
@@ -4847,6 +4889,27 @@ struct mgmt_frame_regs {
u32 global_mcast_stypes, interface_mcast_stypes;
};
+/**
+ * struct cfg80211_smd_transition_info - SMD BSS Transition info
+ *
+ * @ctx: Dynamic context to be transferred as part of ST
+ * @type: Type of ST indication
+ */
+struct cfg80211_smd_transition_info {
+ struct ieee80211_smd_ctx *ctx;
+ enum nl80211_smd_ctx_type type;
+};
+
+/**
+ * struct cfg80211_smd_get_ctx_pending - pending async GET_SMD_CTX request
+ * @list: linkage on wireless_dev::smd_get_ctx_pending_list
+ * @sta_addr: non-AP MLD address for which context was requested
+ */
+struct cfg80211_smd_get_ctx_pending {
+ struct list_head list;
+ u8 sta_addr[ETH_ALEN];
+};
+
/**
* struct cfg80211_ops - backend description for wireless configuration
*
@@ -5278,6 +5341,12 @@ struct mgmt_frame_regs {
*
* @start_pd: Start the PD interface.
* @stop_pd: Stop the PD interface.
+ *
+ * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info->ctx is
+ * freed immediately after this call returns; drivers must copy
+ * @st_info->ctx if asynchronous processing is required.
+ *
+ * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5656,6 +5725,12 @@ struct cfg80211_ops {
bool val);
int (*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
void (*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
+ int (*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info);
+ int (*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ enum nl80211_smd_ctx_type type);
};
/*
@@ -7228,6 +7303,8 @@ enum ieee80211_ap_reg_power {
* @links.cac_time_ms: CAC time in ms
* @valid_links: bitmap describing what elements of @links are valid
* @radio_mask: Bitmask of radios that this interface is allowed to operate on.
+ * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests.
+ * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests.
*/
struct wireless_dev {
struct wiphy *wiphy;
@@ -7347,6 +7424,10 @@ struct wireless_dev {
} links[IEEE80211_MLD_MAX_NUM_LINKS];
u16 valid_links;
+ /* protects @smd_get_ctx_pending_list */
+ spinlock_t smd_get_ctx_lock;
+ struct list_head smd_get_ctx_pending_list;
+
u32 radio_mask;
};
@@ -9504,6 +9585,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
* @no_sta: set if no station is known for the frame (relevant for MLD)
+ * @st_info: SMD BSS Transition data
*/
struct cfg80211_rx_info {
int freq;
@@ -9516,6 +9598,7 @@ struct cfg80211_rx_info {
u64 rx_tstamp;
u64 ack_tstamp;
bool no_sta;
+ struct cfg80211_smd_transition_info st_info;
};
/**
@@ -11023,4 +11106,36 @@ void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,
u32 signal_interference_bitmap,
gfp_t gfp);
+/**
+ * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the
+ * cfg80211_smd_get_ctx_pending list.
+ * @wdev: wdev that maintains the list
+ * @addr: if @addr is NULL, drain the entire list; otherwise, drain only the
+ * matching entries
+ *
+ * When the current AP MLD requests the station's context, those requests are
+ * maintained in a pending list until drivers notify completion. In case the
+ * device is brought down or the station is removed prematurely, free up the
+ * remaining entries in the list.
+ */
+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,
+ const u8 *addr);
+
+/**
+ * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211
+ * @wdev: wireless device that handled the request
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ *
+ * Called via ieee80211_get_smd_ctx_done after async driver context collection
+ * completes. Finds the matching pending request and sends a multicast
+ * %NL80211_CMD_SMD_CTX_EVENT reply to userspace (MLME group).
+ *
+ * Return: None
+ */
+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_CFG80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1172d7b83ed18..6a26823799d45 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -797,6 +797,7 @@ struct ieee80211_bss_npca_params {
* @s1g_long_beacon_period: number of beacon intervals between each long
* beacon transmission.
* @npca: NPCA parameters
+ * @smd_params: SMD parameters
*/
struct ieee80211_bss_conf {
struct ieee80211_vif *vif;
@@ -904,6 +905,7 @@ struct ieee80211_bss_conf {
u8 s1g_long_beacon_period;
struct ieee80211_bss_npca_params npca;
+ struct cfg80211_smd_params smd_params;
};
#define IEEE80211_NAN_MAX_CHANNELS 3
@@ -1733,6 +1735,10 @@ enum mac80211_rx_encoding {
* @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only
* needed for Timing measurement and Fine timing measurement action frames.
* Only reported by devices that have timestamping enabled.
+ * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information.
+ * Only needed for ST Preparation Request and ST Execution Request action
+ * frames. The pointer will be consumed by mac80211; must be kmalloc-ed.
+ * Indicated by @smd_ctx_valid.
* @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
* it but can store it and pass it back to the driver for synchronisation
* @band: the active band when this frame was received
@@ -1773,12 +1779,15 @@ enum mac80211_rx_encoding {
* @link_id: id of the link used to receive the packet. Set and used by
* mac80211 internally, it uses @freq set by the driver to identify the
* correct link per vif.
+ * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag
+ * is used only for ST Preparation or ST Execution Request frames.
*/
struct ieee80211_rx_status {
u64 mactime;
union {
u64 boottime_ns;
ktime_t ack_tx_hwtstamp;
+ struct ieee80211_smd_ctx *smd_ctx;
};
u32 device_timestamp;
u32 ampdu_reference;
@@ -1812,7 +1821,8 @@ struct ieee80211_rx_status {
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
u8 zero_length_psdu_type;
- u8 link_id:4;
+ u8 link_id:4,
+ smd_ctx_valid:1;
};
static_assert(sizeof(struct ieee80211_rx_status) <= sizeof_field(struct sk_buff, cb));
@@ -2724,6 +2734,7 @@ struct ieee80211_link_sta {
* @nan_sched: NAN peer schedule for this station. Valid only for NMI stations.
* @ext_mld_capa_ops: the MLD's extended MLD capabilities and operations
* NOTE: currently only tracked for AP STAs
+ * @smd_params: SMD parameters of the STA
*/
struct ieee80211_sta {
u8 addr[ETH_ALEN] __aligned(2);
@@ -2758,6 +2769,8 @@ struct ieee80211_sta {
/* should only be accessed with the wiphy mutex held */
struct ieee80211_nan_peer_sched *nan_sched;
+ struct cfg80211_sta_smd_params smd_params;
+
/* must be last */
u8 drv_priv[] __aligned(sizeof(void *));
};
@@ -3958,6 +3971,19 @@ enum ieee80211_ampdu_mlme_action {
#define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
#define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
+/**
+ * enum ieee80211_ba_policy - BlockAck Policy
+ *
+ * @IEEE80211_BLOCKACK_DELAYED: Block ACK sent to the BAR sender in next TXOP
+ * @IEEE80211_BLOCKACK_IMMEDIATE: Block ACK sent to the BAR sender immediately
+ *
+ * This field is valid only for %IEEE80211_AMPDU_RX_START.
+ */
+enum ieee80211_ba_policy {
+ IEEE80211_BLOCKACK_DELAYED,
+ IEEE80211_BLOCKACK_IMMEDIATE,
+};
+
/**
* struct ieee80211_ampdu_params - AMPDU action parameters
*
@@ -3970,6 +3996,7 @@ enum ieee80211_ampdu_mlme_action {
* @buf_size: reorder buffer size (number of subframes). Valid only when the
* action is set to %IEEE80211_AMPDU_RX_START or
* %IEEE80211_AMPDU_TX_OPERATIONAL
+ * @policy: BlockAck policy of type &enum ieee80211_ba_policy
* @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
* valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
* @timeout: BA session timeout. Valid only when the action is set to
@@ -3981,6 +4008,7 @@ struct ieee80211_ampdu_params {
u16 tid;
u16 ssn;
u16 buf_size;
+ enum ieee80211_ba_policy policy;
bool amsdu;
u16 timeout;
};
@@ -4071,6 +4099,24 @@ struct ieee80211_prep_tx_info {
int link_id;
};
+/**
+ * enum ieee80211_sta_smd_state - SMD BSS Transition sub-state
+ *
+ * Tracks the 802.11bn SMD BSS Transition sub-state (IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association.
+ *
+ * @IEEE80211_STA_SMD_NONE: Plain State 4. No sub-state active.
+ * @IEEE80211_STA_SMD_PREP: State 4a. STA prepared at the target AP MLD
+ * @IEEE80211_STA_SMD_EXEC: State 4b. ST execution active at the current AP MLD
+ * @IEEE80211_STA_SMD_DRAIN: State 4c. DL draining period at the current AP MLD
+ */
+enum ieee80211_sta_smd_state {
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_PREP,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_DRAIN,
+};
+
/**
* struct ieee80211_ops - callbacks from mac80211 to the driver
*
@@ -4737,6 +4783,16 @@ struct ieee80211_prep_tx_info {
* @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
* driver according to the parameter received in the EML Operating mode
* notification frame.
+ * @sta_smd_state: Notifies low level driver about IEEE 802.11bn SMD substate
+ * transition of a station. It must not fail while transitioning down.
+ * The callback can sleep.
+ * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on
+ * the target AP MLD side to program dynamic context.
+ * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in
+ * the current AP MLD side on behalf of the target AP MLD to collect
+ * dynamic context, when the non-AP MLD sends ST Execute frame directly
+ * to the target. Since the response is asynchronous, the drivers that
+ * implement this should not store reference to @sta.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5138,6 +5194,17 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_eml_params *eml_params);
+ int (*sta_smd_state)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state);
+ int (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info);
+ int (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type);
};
/**
@@ -8207,4 +8274,15 @@ bool ieee80211_vif_nan_started(struct ieee80211_vif *vif);
* Return: 0 if success and non-zero on error
*/
int ieee80211_encrypt_tx_skb(struct sk_buff *skb);
+
+/**
+ * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211
+ * @vif: virtual interface
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ */
+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
#endif /* MAC80211_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9a2ccb8d66b86..8dd07751a3365 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1427,6 +1427,18 @@
* @NL80211_CMD_STOP_PD: Stop the PD operation, identified by
* its %NL80211_ATTR_WDEV interface.
*
+ * @NL80211_CMD_SET_SMD_CTX: Set the SMD BSS Transition dynamic context for a
+ * non-AP MLD sent from the current AP MLD on the target AP MLD managed by
+ * an SMD-ME. This command carries %NL80211_ATTR_MLD_ADDR,
+ * %NL80211_ATTR_SMD_CTX_TYPE and %NL80211_ATTR_SMD_CTX.
+ * @NL80211_CMD_GET_SMD_CTX: Get the SMD BSS Transition dynamic context for a
+ * non-AP MLD associated to an AP MLD managed by an SMD-ME. This command
+ * carries %NL80211_ATTR_MLD_ADDR and %NL80211_ATTR_SMD_CTX_TYPE.
+ * @NL80211_CMD_SMD_CTX_EVENT: Event reporting the collected SMD context
+ * (requested via %NL80211_CMD_GET_SMD_CTX) to userspace. It carries
+ * %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_SMD_CTX_TYPE, and
+ * %NL80211_ATTR_SMD_CTX.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1705,6 +1717,10 @@ enum nl80211_commands {
NL80211_CMD_START_PD,
NL80211_CMD_STOP_PD,
+ NL80211_CMD_SET_SMD_CTX,
+ NL80211_CMD_GET_SMD_CTX,
+ NL80211_CMD_SMD_CTX_EVENT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3190,6 +3206,35 @@ enum nl80211_commands {
* known station to transmit a frame. This is relevant to know whether
* MLD address translation happened or to disable it when sending a frame.
*
+ * @NL80211_ATTR_SMD_PARAMS: Nested attribute to indicate support for Seamless
+ * Mobility Domain (SMD); it contains parameters to define capabilities of
+ * an AP managed by an SMD-ME. Valid if the driver supports
+ * %NL80211_EXT_FEATURE_SMD.
+ * Used with %NL80211_CMD_START_AP. See &enum nl80211_smd_params_attrs.
+ *
+ * @NL80211_ATTR_PEER_SMD_ENABLED: Flag indicating a peer STA has SMD enabled.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_PEER_SMD_MAC_ADDR: Binary attribute with the 6-byte MAC
+ * address of the SMD-capable peer STA.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING: Flag indicating the peer STA
+ * supports DL data forwarding within the SMD domain.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_SMD_ROAM_STA: Flag attribute indicating this station was
+ * created via SMD BSS Transition Preparation at the Target AP MLD (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.6).
+ * This flag is carried in %NL80211_CMD_NEW_STATION.
+ *
+ * @NL80211_ATTR_SMD_CTX: Nested attribute associated with UHR SMD BSS
+ * Transition data. Used with %NL80211_CMD_SET_SMD_CTX and
+ * %NL80211_CMD_SMD_CTX_EVENT. See &enum nl80211_smd_ctx.
+ * @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context.
+ * Used along with %NL80211_CMD_SET_SMD_CTX, %NL80211_CMD_GET_SMD_CTX,
+ * and %NL80211_CMD_SMD_CTX_EVENT.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3792,6 +3837,17 @@ enum nl80211_attrs {
NL80211_ATTR_FRAME_NO_STA,
+ NL80211_ATTR_SMD_PARAMS,
+
+ NL80211_ATTR_PEER_SMD_ENABLED,
+ NL80211_ATTR_PEER_SMD_MAC_ADDR,
+ NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING,
+
+ NL80211_ATTR_SMD_ROAM_STA,
+
+ NL80211_ATTR_SMD_CTX,
+ NL80211_ATTR_SMD_CTX_TYPE,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -3942,6 +3998,13 @@ enum nl80211_iftype {
* that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a
* previously added station into associated state
* @NL80211_STA_FLAG_SPP_AMSDU: station supports SPP A-MSDUs
+ * @NL80211_STA_FLAG_SMD: station has negotiated SMD.
+ * @NL80211_STA_FLAG_SMD_PREP_TARGET: station is prepared at SMD target AP MLD
+ * (State 4a).
+ * @NL80211_STA_FLAG_SMD_EXEC_CURRENT: current AP MLD is executing SMD BSS
+ * Transition (State 4b).
+ * @NL80211_STA_FLAG_SMD_DL_DRAIN: current AP MLD is in DL draining period
+ * (State 4c).
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -3955,6 +4018,10 @@ enum nl80211_sta_flags {
NL80211_STA_FLAG_TDLS_PEER,
NL80211_STA_FLAG_ASSOCIATED,
NL80211_STA_FLAG_SPP_AMSDU,
+ NL80211_STA_FLAG_SMD,
+ NL80211_STA_FLAG_SMD_PREP_TARGET,
+ NL80211_STA_FLAG_SMD_EXEC_CURRENT,
+ NL80211_STA_FLAG_SMD_DL_DRAIN,
/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
@@ -7126,6 +7193,15 @@ enum nl80211_feature_flags {
* offload in station mode, including Fast Transition or Opportunistic
* Key Caching.
*
+ * @NL80211_EXT_FEATURE_SMD: Driver supports Seamless Mobility Domain (SMD)
+ * and is managed by an SMD-ME to support SMD BSS Transition in AP mode
+ * and supports association to an SMD-ME and SMD BSS transition in
+ * non-AP STA mode.
+ *
+ * @NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING: Driver supports forwarding of
+ * buffered downlink (DL) data packets in AP mode to the non-AP STA during
+ * SMD BSS Transition.
+ *
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
@@ -7209,6 +7285,8 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
NL80211_EXT_FEATURE_PROBE_AP,
NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,
+ NL80211_EXT_FEATURE_SMD,
+ NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
@@ -9120,4 +9198,228 @@ enum nl80211_nan_peer_map_attrs {
#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff
+/**
+ * enum nl80211_smd_type - Type of the SMD
+ *
+ * @NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP: Separate MAC SAP is used per AP MLD.
+ * @NL80211_SMD_TYPE_PER_SMD_MAC_SAP: one MAC SAP is used in the SMD.
+ * @NUM_NL80211_SMD_TYPES: internal.
+ * @NL80211_SMD_TYPE_MAX: Max type of the SMD.
+ *
+ * This value represents the data path models between the non-AP MLD and DS.
+ * DS mapping for the non-AP MLD is updated if
+ * %NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP is used.
+ *
+ * All AP MLDs within an SMD shall indicate the same SMD type (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.2).
+ */
+enum nl80211_smd_type {
+ NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP,
+ NL80211_SMD_TYPE_PER_SMD_MAC_SAP,
+
+ NUM_NL80211_SMD_TYPES,
+ NL80211_SMD_TYPE_MAX = NUM_NL80211_SMD_TYPES - 1,
+};
+
+/**
+ * enum nl80211_smd_ptk_mode - PTK Mode used in the SMD
+ *
+ * @NL80211_SMD_PTK_MODE_PER_SMD_PTK: one PTK is used by all AP MLDs in the SMD.
+ * @NL80211_SMD_PTK_MODE_PER_AP_MLD_PTK: Separate PTK is used per AP MLD.
+ * @NUM_NL80211_SMD_PTK_MODES: internal.
+ * @NL80211_SMD_PTK_MODE_MAX: Max type of PTK mode.
+ *
+ * This value represents the security mode of the SMD that dictates the PTK used
+ * in current and target AP MLDs to protect communications with the non-AP MLD
+ * (refer IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.3.2)
+ */
+enum nl80211_smd_ptk_mode {
+ NL80211_SMD_PTK_MODE_PER_SMD_PTK,
+ NL80211_SMD_PTK_MODE_PER_AP_MLD_PTK,
+
+ NUM_NL80211_SMD_PTK_MODES,
+ NL80211_SMD_PTK_MODE_MAX = NUM_NL80211_SMD_PTK_MODES - 1,
+};
+
+/**
+ * enum nl80211_smd_params_attrs - SMD Domain parameters
+ *
+ * @NL80211_SMD_PARAMS_ATTR_UNSPEC: Invalid attribute.
+ * @NL80211_SMD_PARAMS_ATTR_IDENTIFIER: Required (binary) attribute of ETH_ALEN
+ * bytes used to define the unique identifier for the SMD.
+ * @NL80211_SMD_PARAMS_ATTR_TIMEOUT: Required (u16) attribute to define the SMD
+ * Preparation timeout (in 64 TUs, values 0 and 1 are reserved) for
+ * the target AP MLD.
+ * @NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING: Flag attribute to indicate that
+ * the device supports forwarding of buffered DL data packets.
+ * @NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS: Required (u8) attribute to define
+ * the maximum number of AP MLDs a non-AP MLD can prepare with. Value is
+ * the maximum number of AP MLDs - 1. A value of 0 means that the non-AP
+ * MLD can prepare with 1 AP MLD.
+ * @NL80211_SMD_PARAMS_ATTR_TYPE: Required (u8) attribute to indicate the
+ * SMD Type (&enum nl80211_smd_type).
+ * @NL80211_SMD_PARAMS_ATTR_PTK_MODE: Required (u8) attribute to indicate the
+ * PTK mode used for protection (&enum nl80211_smd_ptk_mode).
+ * @NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING: Flag attribute to indicate that
+ * the device supports UHR Neighboring AP Probing.
+ * @__NL80211_SMD_PARAMS_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_PARAMS_ATTR_MAX: Max attribute.
+ *
+ * Nested attributes carried in %NL80211_ATTR_SMD_PARAMS to define
+ * device capabilities that is part of an SMD (refer IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 9.4.2.363, Figure 9-aa43 and Figure 9-aa44).
+ *
+ */
+enum nl80211_smd_params_attrs {
+ NL80211_SMD_PARAMS_ATTR_UNSPEC,
+ NL80211_SMD_PARAMS_ATTR_IDENTIFIER,
+ NL80211_SMD_PARAMS_ATTR_TIMEOUT,
+ NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING,
+ NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS,
+ NL80211_SMD_PARAMS_ATTR_TYPE,
+ NL80211_SMD_PARAMS_ATTR_PTK_MODE,
+ NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING,
+
+ /* keep last */
+ __NL80211_SMD_PARAMS_ATTR_LAST,
+ NL80211_SMD_PARAMS_ATTR_MAX = __NL80211_SMD_PARAMS_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_type - SMD Request Type values
+ *
+ * Used with %NL80211_ATTR_SMD_CTX_TYPE.
+ *
+ * @NL80211_SMD_CTX_TYPE_PREP: SMD BSS Transition (ST) Preparation.
+ * @NL80211_SMD_CTX_TYPE_EXEC: ST Execution.
+ * @NUM_SMD_CTX_TYPES: internal.
+ * @NL80211_SMD_CTX_TYPE_MAX: Max type of ST context.
+ */
+enum nl80211_smd_ctx_type {
+ NL80211_SMD_CTX_TYPE_PREP,
+ NL80211_SMD_CTX_TYPE_EXEC,
+
+ NUM_SMD_CTX_TYPES,
+ NL80211_SMD_CTX_TYPE_MAX = NUM_SMD_CTX_TYPES - 1,
+};
+
+/**
+ * enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes
+ *
+ * @__NL80211_SMD_CTX_BA_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE: Required (u16) BA buffer size.
+ * @NL80211_SMD_CTX_BA_ATTR_POLICY: Required (u8) BA policy.
+ * @NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT: Flag attribute to indicate
+ * AMSDU support.
+ * @NL80211_SMD_CTX_BA_ATTR_TIMEOUT: Required (u16) Block Ack timeout.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG: Flag attribute to indicate
+ * fragmentation support.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL: Required (u8) HE fragmentation
+ * level.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE: Required (u16) extended buffer size.
+ * @__NL80211_SMD_CTX_BA_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_BA_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_DL_ATTR_BA_PARAMS and
+ * %NL80211_SMD_CTX_UL_ATTR_BA_PARAMS.
+ */
+enum nl80211_smd_ctx_ba_param {
+ __NL80211_SMD_CTX_BA_ATTR_INVALID,
+ NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,
+ NL80211_SMD_CTX_BA_ATTR_POLICY,
+ NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT,
+ NL80211_SMD_CTX_BA_ATTR_TIMEOUT,
+ NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG,
+ NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,
+
+ __NL80211_SMD_CTX_BA_ATTR_LAST,
+ NL80211_SMD_CTX_BA_ATTR_MAX = __NL80211_SMD_CTX_BA_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction
+ *
+ * @__NL80211_SMD_CTX_DL_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.
+ * @NL80211_SMD_CTX_DL_ATTR_SN: Optional (nested) next SN (u16) per TID to
+ * be assigned to DL individually addressed frames.
+ * @NL80211_SMD_CTX_DL_ATTR_PN: Optional (binary) starting PN (max 16 bytes) for
+ * DL individually addressed frames.
+ * @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters,
+ * nested array of TIDs (uses &enum nl80211_smd_ctx_ba_param).
+ * @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_DL_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_ATTR_DL.
+ */
+enum nl80211_smd_ctx_dl {
+ __NL80211_SMD_CTX_DL_ATTR_INVALID,
+ NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,
+ NL80211_SMD_CTX_DL_ATTR_SN,
+ NL80211_SMD_CTX_DL_ATTR_PN,
+ NL80211_SMD_CTX_DL_ATTR_BA_PARAMS,
+
+ __NL80211_SMD_CTX_DL_ATTR_LAST,
+ NL80211_SMD_CTX_DL_ATTR_MAX = __NL80211_SMD_CTX_DL_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction
+ *
+ * @__NL80211_SMD_CTX_UL_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.
+ * @NL80211_SMD_CTX_UL_ATTR_SN: Optional (nested) last SN received per TID
+ * for UL individually addressed frames.
+ * @NL80211_SMD_CTX_UL_ATTR_PN: Optional (nested) last PN received per TID
+ * for UL individually addressed frames.
+ * @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters
+ * (uses &enum nl80211_smd_ctx_ba_param).
+ * @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_UL_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_ATTR_UL.
+ */
+enum nl80211_smd_ctx_ul {
+ __NL80211_SMD_CTX_UL_ATTR_INVALID,
+ NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,
+ NL80211_SMD_CTX_UL_ATTR_SN,
+ NL80211_SMD_CTX_UL_ATTR_PN,
+ NL80211_SMD_CTX_UL_ATTR_BA_PARAMS,
+
+ __NL80211_SMD_CTX_UL_ATTR_LAST,
+ NL80211_SMD_CTX_UL_ATTR_MAX = __NL80211_SMD_CTX_UL_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx - SMD Context information
+ *
+ * Top-level container for SMD BSS Transition dynamic context. Carried in
+ * %NL80211_ATTR_SMD_CTX with %NL80211_CMD_SET_SMD_CTX (target AP MLD) or
+ * with %NL80211_CMD_FRAME (current AP MLD reporting context to userspace)
+ * and %NL80211_CMD_SMD_CTX_EVENT (current AP MLD reporting the requested
+ * context on behalf of the target AP MLD).
+ *
+ * @__NL80211_SMD_CTX_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters.
+ * See &enum nl80211_smd_ctx_dl.
+ * @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters.
+ * See &enum nl80211_smd_ctx_ul.
+ * @NL80211_SMD_CTX_ATTR_DRV_DATA: Optional (binary) driver-specific blob.
+ * Passed through nl80211 as a blob; parsed only at the driver layer of
+ * the current AP MLD and target AP MLD. First 3 bytes shall be driver OUI
+ * for the driver to parse as required.
+ * @__NL80211_SMD_CTX_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_ATTR_MAX: Max attribute.
+ */
+enum nl80211_smd_ctx {
+ __NL80211_SMD_CTX_ATTR_INVALID,
+ NL80211_SMD_CTX_ATTR_DL,
+ NL80211_SMD_CTX_ATTR_UL,
+ NL80211_SMD_CTX_ATTR_DRV_DATA,
+
+ __NL80211_SMD_CTX_ATTR_LAST,
+ NL80211_SMD_CTX_ATTR_MAX = __NL80211_SMD_CTX_ATTR_LAST - 1
+};
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 9629e00069a1f..2d67fd8831465 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -289,6 +289,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
.amsdu = false,
.timeout = timeout,
.ssn = start_seq_num,
+ .policy = ba_policy,
};
int i, ret = -EOPNOTSUPP;
u16 status = WLAN_STATUS_REQUEST_DECLINED;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 23f4f9ec86d0a..95b699117147a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1796,6 +1796,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
}
}
+ if (params->smd_params.smd_enabled)
+ link_conf->smd_params = params->smd_params;
+ else
+ link_conf->smd_params.smd_enabled = false;
+
if (sdata->vif.type == NL80211_IFTYPE_AP &&
params->mbssid_config.tx_wdev) {
err = ieee80211_set_ap_mbssid_options(sdata,
@@ -2447,6 +2452,73 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
return 0;
}
+static int sta_apply_smd_state_flags(struct sta_info *sta,
+ u32 mask, u32 set)
+{
+ bool smd_prep_target, smd_exec_current, smd_dl_drain;
+ u32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);
+ enum ieee80211_sta_smd_state new_ss;
+ u32 smd_flags;
+ int err;
+
+ if (!(mask & expected_mask))
+ return 0;
+
+ smd_flags = mask & expected_mask & set;
+ if (WARN_ON(hweight32(smd_flags) > 1))
+ return -EINVAL;
+
+ smd_prep_target =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_PREP_TARGET));
+ smd_exec_current =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT));
+ smd_dl_drain =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_DL_DRAIN));
+
+ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
+ (smd_exec_current || smd_dl_drain))
+ return -EINVAL;
+
+ if (smd_prep_target)
+ new_ss = IEEE80211_STA_SMD_PREP;
+ else if (smd_exec_current)
+ new_ss = IEEE80211_STA_SMD_EXEC;
+ else if (smd_dl_drain)
+ new_ss = IEEE80211_STA_SMD_DRAIN;
+ else
+ new_ss = IEEE80211_STA_SMD_NONE;
+
+ if (new_ss == sta->smd_state)
+ return 0;
+
+ err = sta_info_move_smd_state(sta, new_ss, true);
+ if (err)
+ return err;
+
+ if (smd_prep_target) {
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ set_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ } else if (smd_exec_current) {
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ set_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ } else if (smd_dl_drain) {
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ set_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ } else {
+ /* all flags revert back to none being set */
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ }
+
+ return 0;
+}
+
static int sta_apply_parameters(struct ieee80211_local *local,
struct sta_info *sta,
struct station_parameters *params)
@@ -2523,6 +2595,18 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (mask & BIT(NL80211_STA_FLAG_SPP_AMSDU))
sta->sta.spp_amsdu = set & BIT(NL80211_STA_FLAG_SPP_AMSDU);
+ if (mask & BIT(NL80211_STA_FLAG_SMD)) {
+ if (set & BIT(NL80211_STA_FLAG_SMD)) {
+ set_sta_flag(sta, WLAN_STA_SMD);
+ } else if (test_sta_flag(sta, WLAN_STA_SMD)) {
+ sta_info_reset_smd_state(sta, true);
+ clear_sta_flag(sta, WLAN_STA_SMD);
+ }
+ }
+
+ if (params->smd_params.smd_sta)
+ sta->sta.smd_params = params->smd_params;
+
/* mark TDLS channel switch support, if the AP allows it */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
!sdata->deflink.u.mgd.tdls_chan_switch_prohibited &&
@@ -2624,6 +2708,17 @@ static int sta_apply_parameters(struct ieee80211_local *local,
return ret;
}
+ /*
+ * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026,
+ * subclause 11.3.1).
+ * Only meaningful for SMD-capable stations (WLAN_STA_SMD set).
+ */
+ if (test_sta_flag(sta, WLAN_STA_SMD)) {
+ ret = sta_apply_smd_state_flags(sta, mask, set);
+ if (ret)
+ return ret;
+ }
+
/* Mark the STA as MLO if MLD MAC address is available */
if (params->link_sta_params.mld_mac)
sta->sta.mlo = true;
@@ -2708,6 +2803,19 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev,
*/
if (!err && sdata->vif.type == NL80211_IFTYPE_NAN_DATA)
ieee80211_nan_update_ndi_carrier(sta->sdata);
+
+ /*
+ * SMD sub-state was set in sta_apply_parameters() before the station
+ * was inserted so drv_sta_smd_state() was skipped (WLAN_STA_INSERTED
+ * was not yet set). Walk the driver step-by-step to the target state.
+ */
+ if (!err && test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state != IEEE80211_STA_SMD_NONE) {
+ err = sta_info_move_drv_smd_state(sta);
+ if (err)
+ WARN_ON(__sta_info_destroy(sta));
+ }
+
return err;
}
@@ -5973,6 +6081,66 @@ ieee80211_set_peer_nan_sched(struct wiphy *wiphy,
return ieee80211_nan_set_peer_sched(sdata, sched);
}
+static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ struct sta_info *sta;
+
+ lockdep_assert_wiphy(wiphy);
+
+ sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP &&
+ sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, addr);
+ if (!sta)
+ return -ENOENT;
+ if (!sta->sta.smd_params.smd_sta)
+ return -EINVAL;
+
+ return drv_set_smd_ctx(local, sdata, &sta->sta, st_info);
+}
+
+static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ enum nl80211_smd_ctx_type type)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ struct sta_info *sta;
+
+ lockdep_assert_wiphy(wiphy);
+
+ sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP &&
+ sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, addr);
+ if (!sta)
+ return -ENOENT;
+ if (!sta->sta.smd_params.smd_sta)
+ return -EINVAL;
+
+ return drv_get_smd_ctx(local, sdata, &sta->sta, type);
+}
+
+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+ cfg80211_get_smd_ctx_done(&sdata->wdev, sta_addr, st_info);
+}
+EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);
+
const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -6091,4 +6259,6 @@ const struct cfg80211_ops mac80211_config_ops = {
.set_epcs = ieee80211_set_epcs,
.nan_set_local_sched = ieee80211_set_local_nan_sched,
.nan_set_peer_sched = ieee80211_set_peer_nan_sched,
+ .set_smd_ctx = ieee80211_set_smd_ctx,
+ .get_smd_ctx = ieee80211_get_smd_ctx,
};
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index ef75255d47d5a..24c985687bd27 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -78,6 +78,10 @@ static const char * const sta_flag_names[] = {
FLAG(PS_DELIVER),
FLAG(USES_ENCRYPTION),
FLAG(DECAP_OFFLOAD),
+ FLAG(SMD),
+ FLAG(SMD_PREP_TARGET),
+ FLAG(SMD_EXEC_CURRENT),
+ FLAG(SMD_DL_DRAIN),
#undef FLAG
};
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 49753b73aba26..d77a5a80f06ec 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -633,3 +633,27 @@ int drv_change_sta_links(struct ieee80211_local *local,
return 0;
}
+
+int drv_sta_smd_state(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state)
+{
+ int ret = 0;
+
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ sdata = get_bss_sdata(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_sta_smd_state(local, sdata, sta, old_state, new_state);
+ if (local->ops->sta_smd_state)
+ ret = local->ops->sta_smd_state(&local->hw, &sdata->vif,
+ sta, old_state, new_state);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index f1c0b87fddd5f..0339ff71cd4ab 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1814,4 +1814,58 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,
return ret;
}
+int drv_sta_smd_state(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state);
+
+static inline int drv_set_smd_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret;
+
+ if (!local->ops->set_smd_ctx)
+ return -EOPNOTSUPP;
+
+ sdata = get_bss_sdata(sdata);
+
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_set_smd_ctx(local, sdata, sta, st_info);
+ ret = local->ops->set_smd_ctx(&local->hw, &sdata->vif, sta, st_info);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
+static inline int drv_get_smd_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type)
+{
+ int ret;
+
+ if (!sdata || !local->ops->get_smd_ctx)
+ return -EOPNOTSUPP;
+
+ sdata = get_bss_sdata(sdata);
+
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_get_smd_ctx(local, sdata, sta, type);
+ ret = local->ops->get_smd_ctx(&local->hw, &sdata->vif, sta, type);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9514f01778beb..cf1a5d54d2299 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -268,6 +268,8 @@ struct ieee80211_rx_data {
};
u8 link_addrs[3 * ETH_ALEN];
+
+ struct ieee80211_smd_ctx *smd_ctx;
};
struct ieee80211_csa_settings {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b3990b7a72990..4ad7a71d298a9 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3970,6 +3970,22 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
return RX_QUEUED;
}
+static void
+ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,
+ struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_mgmt *mgmt = (void *)info->buf;
+ u8 type;
+
+ if (!rx->smd_ctx)
+ return;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ info->st_info.type = type;
+ info->st_info.ctx = rx->smd_ctx;
+}
+
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
{
@@ -3981,6 +3997,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
.link_id = rx->link_id,
.have_link_id = rx->link_id >= 0,
.no_sta = !rx->sta,
+ .st_info.ctx = NULL,
};
/* skip known-bad action frames and return them in the next handler */
@@ -4002,6 +4019,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
ieee80211_is_ftm(rx->skb)) {
info.rx_tstamp = ktime_to_ns(skb_hwtstamps(rx->skb)->hwtstamp);
info.ack_tstamp = ktime_to_ns(status->ack_tx_hwtstamp);
+ } else if (ieee80211_is_st_prep_req(rx->skb) ||
+ ieee80211_is_st_exec_req(rx->skb)) {
+ ieee80211_rx_h_userspace_mgmt_st_req_frame(&info, rx);
}
if (cfg80211_rx_mgmt_ext(&rx->sdata->wdev, &info)) {
@@ -5340,7 +5360,8 @@ static bool ieee80211_rx_valid_freq(int freq, struct ieee80211_link_data *link)
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct ieee80211_link_sta *link_pubsta,
struct sk_buff *skb,
- struct list_head *list)
+ struct list_head *list,
+ struct ieee80211_rx_data *rx)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -5349,16 +5370,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct link_sta_info *link_sta;
struct sta_info *sta;
__le16 fc;
- struct ieee80211_rx_data rx;
struct rhlist_head *tmp;
bool rx_data_pending;
int err = 0;
fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
- memset(&rx, 0, sizeof(rx));
- rx.skb = skb;
- rx.local = local;
- rx.list = list;
+ rx->skb = skb;
+ rx->local = local;
+ rx->list = list;
if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
I802_DEBUG_INC(local->dot11ReceivedFragmentCount);
@@ -5390,8 +5409,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
}
hdr = (struct ieee80211_hdr *)skb->data;
- ieee80211_parse_qos(&rx);
- ieee80211_verify_alignment(&rx);
+ ieee80211_parse_qos(rx);
+ ieee80211_verify_alignment(rx);
if (unlikely(ieee80211_is_probe_resp(hdr->frame_control) ||
ieee80211_is_beacon(hdr->frame_control) ||
@@ -5412,9 +5431,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
sta);
link_sta = rcu_dereference(sta->link[link_pubsta->link_id]);
- rx.sdata = sta->sdata;
- if (ieee80211_rx_data_set_link_sta(&rx, link_sta) &&
- ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ rx->sdata = sta->sdata;
+ if (ieee80211_rx_data_set_link_sta(rx, link_sta) &&
+ ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
goto out;
@@ -5434,13 +5453,13 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
continue;
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb,
+ ieee80211_prepare_and_rx_handle(rx, skb,
false);
rx_data_pending = false;
}
- rx.sdata = sta->sdata;
- if (!ieee80211_rx_data_set_link_sta(&rx, &sta->deflink))
+ rx->sdata = sta->sdata;
+ if (!ieee80211_rx_data_set_link_sta(rx, &sta->deflink))
continue;
rx_data_pending = true;
@@ -5458,20 +5477,20 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
continue;
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb,
+ ieee80211_prepare_and_rx_handle(rx, skb,
false);
rx_data_pending = false;
}
- rx.sdata = sta->sdata;
- if (!ieee80211_rx_data_set_link_sta(&rx, link_sta))
+ rx->sdata = sta->sdata;
+ if (!ieee80211_rx_data_set_link_sta(rx, link_sta))
continue;
rx_data_pending = true;
}
if (rx_data_pending) {
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ if (ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
goto out;
@@ -5526,14 +5545,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
if (link_sta && link &&
ieee80211_rx_valid_freq(status->freq, link)) {
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(rx, skb, false);
rx_data_pending = false;
}
/* No valid_links check as we need to RX beacons */
- rx.sdata = sdata;
- if (ieee80211_rx_data_set_link_sta(&rx, link_sta))
+ rx->sdata = sdata;
+ if (ieee80211_rx_data_set_link_sta(rx, link_sta))
rx_data_pending = true;
continue;
@@ -5562,22 +5581,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
}
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(rx, skb, false);
rx_data_pending = false;
}
- rx.sdata = sdata;
- rx.local = sdata->local;
- rx.link = link;
- rx.link_id = link->link_id;
- rx.sta = NULL;
- rx.link_sta = NULL;
+ rx->sdata = sdata;
+ rx->local = sdata->local;
+ rx->link = link;
+ rx->link_id = link->link_id;
+ rx->sta = NULL;
+ rx->link_sta = NULL;
rx_data_pending = true;
}
if (rx_data_pending &&
- ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
out:
@@ -5597,6 +5616,15 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
struct ieee80211_supported_band *sband;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct ieee80211_smd_ctx *smd_ctx = NULL;
+ struct ieee80211_rx_data rx = {};
+
+ /* cache the pointer to free it later */
+ if (status->smd_ctx_valid) {
+ smd_ctx = status->smd_ctx;
+ status->smd_ctx = NULL;
+ status->smd_ctx_valid = false;
+ }
WARN_ON_ONCE(softirq_count() == 0);
@@ -5731,6 +5759,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
kcov_remote_start_common(skb_get_kcov_handle(skb));
+ rx.smd_ctx = smd_ctx;
+
+ if (WARN_ONCE((status->flag & RX_FLAG_8023) && rx.smd_ctx,
+ "802.3 packet but with IEEE P802.11bn SMD context"))
+ goto drop;
+
/*
* Frames with failed FCS/PLCP checksum are not returned,
* all other frames are returned without radiotap header
@@ -5748,12 +5782,14 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
__ieee80211_rx_handle_8023(hw, link_pubsta, skb, list);
else
__ieee80211_rx_handle_packet(hw, link_pubsta, skb,
- list);
+ list, &rx);
}
+ kfree(smd_ctx);
kcov_remote_stop();
return;
drop:
+ kfree(smd_ctx);
kfree_skb(skb);
}
EXPORT_SYMBOL(ieee80211_rx_list);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index fdf00cbf49d8b..9ea0a87912892 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -701,6 +701,7 @@ __sta_info_alloc(struct ieee80211_sub_if_data *sdata,
ieee80211_init_frag_cache(&sta->frags);
sta->sta_state = IEEE80211_STA_NONE;
+ sta->smd_state = IEEE80211_STA_SMD_NONE;
if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
sta->amsdu_mesh_control = -1;
@@ -1311,6 +1312,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
{
struct ieee80211_local *local;
struct ieee80211_sub_if_data *sdata;
+ struct wireless_dev *wdev;
int ret, i;
might_sleep();
@@ -1320,6 +1322,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
local = sta->local;
sdata = sta->sdata;
+ wdev = &sdata->wdev;
lockdep_assert_wiphy(local->hw.wiphy);
@@ -1389,6 +1392,10 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
rcu_access_pointer(sdata->u.vlan.sta) == sta)
RCU_INIT_POINTER(sdata->u.vlan.sta, NULL);
+ if (sdata->vif.type == NL80211_IFTYPE_AP ||
+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+ cfg80211_free_pending_smd_ctx_req(wdev, sta->addr);
+
return 0;
}
@@ -1527,6 +1534,20 @@ static int _sta_info_move_state(struct sta_info *sta,
WARN_ONCE(err,
"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n",
err);
+
+ /* revert SMD states if STA has transitioned down */
+ if (new_state == IEEE80211_STA_AUTH &&
+ sta->sta_state == IEEE80211_STA_ASSOC) {
+ if (test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state == IEEE80211_STA_SMD_PREP)
+ sta_info_reset_smd_state(sta, true);
+ } else if (new_state == IEEE80211_STA_ASSOC &&
+ sta->sta_state == IEEE80211_STA_AUTHORIZED) {
+ if (test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state != IEEE80211_STA_SMD_NONE &&
+ sta->smd_state != IEEE80211_STA_SMD_PREP)
+ sta_info_reset_smd_state(sta, true);
+ }
}
sta->sta_state = new_state;
@@ -3883,3 +3904,128 @@ bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,
return true;
}
+
+int sta_info_move_smd_state(struct sta_info *sta,
+ enum ieee80211_sta_smd_state new_ss,
+ bool notify)
+{
+ enum ieee80211_sta_smd_state old_ss = sta->smd_state;
+ struct ieee80211_local *local = sta->local;
+ bool notify_driver;
+ int err;
+
+ might_sleep();
+
+ if (old_ss == new_ss)
+ return 0;
+
+ switch (new_ss) {
+ case IEEE80211_STA_SMD_NONE:
+ if (old_ss != IEEE80211_STA_SMD_PREP &&
+ old_ss != IEEE80211_STA_SMD_EXEC &&
+ old_ss != IEEE80211_STA_SMD_DRAIN)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_EXEC:
+ if (old_ss != IEEE80211_STA_SMD_NONE)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_DRAIN:
+ if (old_ss != IEEE80211_STA_SMD_EXEC)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_PREP:
+ if (old_ss != IEEE80211_STA_SMD_NONE)
+ return -EINVAL;
+ break;
+ default:
+ sdata_err(sta->sdata, "invalid smd state %d", new_ss);
+ return -EINVAL;
+ }
+
+ sta_dbg(sta->sdata, "moving STA %pM SMD state %u -> %u\n",
+ sta->sta.addr, old_ss, new_ss);
+
+ notify_driver = notify && test_sta_flag(sta, WLAN_STA_INSERTED);
+
+ if (new_ss > old_ss && notify_driver) {
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss,
+ new_ss);
+ if (err)
+ return err;
+ }
+
+ if (new_ss < old_ss && notify_driver) {
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss,
+ new_ss);
+ /* driver should not fail moving down SMD states */
+ WARN_ONCE(err,
+ "Driver should not fail moving down SMD states: %d\n",
+ err);
+ }
+
+ sta->smd_state = new_ss;
+
+ return 0;
+}
+
+void sta_info_reset_smd_state(struct sta_info *sta, bool notify)
+{
+ if (sta->smd_state == IEEE80211_STA_SMD_NONE)
+ return;
+
+ /* DRAIN -> NONE, EXEC -> NONE or PREP -> NONE */
+ WARN_ON_ONCE(sta_info_move_smd_state(sta, IEEE80211_STA_SMD_NONE,
+ notify));
+
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+}
+
+int sta_info_move_drv_smd_state(struct sta_info *sta)
+{
+ enum ieee80211_sta_smd_state new_ss = sta->smd_state;
+ struct ieee80211_local *local = sta->local;
+ int err = 0;
+
+ if (!test_sta_flag(sta, WLAN_STA_INSERTED))
+ return 0;
+
+ switch (new_ss) {
+ case IEEE80211_STA_SMD_PREP:
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_PREP);
+ if (err)
+ goto rollback;
+ break;
+ case IEEE80211_STA_SMD_EXEC:
+ case IEEE80211_STA_SMD_DRAIN:
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_EXEC);
+ if (err)
+ goto rollback;
+
+ if (new_ss == IEEE80211_STA_SMD_DRAIN)
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_DRAIN);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (!err)
+ return 0;
+
+ /* if EXEC -> DRAIN failed in the driver, notify EXEC -> NONE */
+ WARN_ON_ONCE(drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_NONE));
+
+rollback:
+ sta_info_reset_smd_state(sta, false);
+ return err;
+}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index ee0d32877c5b4..bdc021675727f 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -72,6 +72,12 @@
* @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption,
* so drop all packets without a key later.
* @WLAN_STA_DECAP_OFFLOAD: This station uses rx decap offload
+ * @WLAN_STA_SMD: this station is associated to an SMD-ME.
+ * @WLAN_STA_SMD_PREP_TARGET: this SMD station is prepared at the target AP MLD.
+ * @WLAN_STA_SMD_EXEC_CURRENT: this SMD station has started execution at
+ * the current AP MLD.
+ * @WLAN_STA_SMD_DL_DRAIN: this SMD station has started draining at
+ * the current AP MLD.
*
* @NUM_WLAN_STA_FLAGS: number of defined flags
*/
@@ -104,6 +110,10 @@ enum ieee80211_sta_info_flags {
WLAN_STA_PS_DELIVER,
WLAN_STA_USES_ENCRYPTION,
WLAN_STA_DECAP_OFFLOAD,
+ WLAN_STA_SMD,
+ WLAN_STA_SMD_PREP_TARGET,
+ WLAN_STA_SMD_EXEC_CURRENT,
+ WLAN_STA_SMD_DL_DRAIN,
NUM_WLAN_STA_FLAGS,
};
@@ -711,6 +721,7 @@ struct ieee80211_sta_removed_link_stats {
* would be assigned to link[link_id] where link_id is the id assigned
* by the AP.
* @rem_link_stats: accumulated removed link stats
+ * @smd_state: Sub-state for STAs in SMD BSS Transition
*/
struct sta_info {
/* General information, mostly static */
@@ -787,6 +798,8 @@ struct sta_info {
struct link_sta_info __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
struct ieee80211_sta_removed_link_stats rem_link_stats;
+ enum ieee80211_sta_smd_state smd_state;
+
/* keep last! */
struct ieee80211_sta sta;
};
@@ -1159,4 +1172,10 @@ static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s)
return r;
}
+int sta_info_move_smd_state(struct sta_info *sta,
+ enum ieee80211_sta_smd_state new_ss,
+ bool notify);
+void sta_info_reset_smd_state(struct sta_info *sta, bool notify);
+int sta_info_move_drv_smd_state(struct sta_info *sta);
+
#endif /* STA_INFO_H */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 562a4964afa3a..38ad5076232de 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -116,6 +116,7 @@
__field(u16, ssn) \
__field(u16, buf_size) \
__field(bool, amsdu) \
+ __field(u8, policy) \
__field(u16, timeout) \
__field(u16, action)
#define AMPDU_ACTION_ASSIGN STA_NAMED_ASSIGN(params->sta); \
@@ -123,12 +124,13 @@
__entry->ssn = params->ssn; \
__entry->buf_size = params->buf_size; \
__entry->amsdu = params->amsdu; \
+ __entry->policy = params->policy; \
__entry->timeout = params->timeout; \
__entry->action = params->action;
-#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, timeout %d action %d"
+#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, policy=%u, timeout %d action %d"
#define AMPDU_ACTION_PR_ARG STA_PR_ARG, __entry->tid, __entry->ssn, \
- __entry->buf_size, __entry->amsdu, __entry->timeout, \
- __entry->action
+ __entry->buf_size, __entry->amsdu, __entry->policy, \
+ __entry->timeout, __entry->action
/*
* Tracing for driver callbacks.
@@ -3403,6 +3405,115 @@ TRACE_EVENT(drv_nan_peer_sched_changed,
)
);
+TRACE_EVENT(drv_sta_smd_state,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state),
+
+ TP_ARGS(local, sdata, sta, old_state, new_state),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u32, old_state)
+ __field(u32, new_state)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->old_state = old_state;
+ __entry->new_state = new_state;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ " smd_state: %d->%d",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->old_state, __entry->new_state
+ )
+);
+
+TRACE_EVENT(drv_set_smd_ctx,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info),
+
+ TP_ARGS(local, sdata, sta, st_info),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, st_type)
+ __field(unsigned int, num_tids)
+ __dynamic_array(unsigned long, dl_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ __dynamic_array(unsigned long, ul_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ ),
+
+ TP_fast_assign(
+ struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ unsigned long sz;
+
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->st_type = st_info->type;
+
+ __entry->num_tids = IEEE80211_SMD_CTX_NUM_TIDS;
+ sz = BITS_TO_LONGS(__entry->num_tids) * sizeof(unsigned long);
+
+ memcpy(__get_dynamic_array(dl_tid_bitmap),
+ ctx->dl.valid_tid_bmap, sz);
+ memcpy(__get_dynamic_array(ul_tid_bitmap),
+ ctx->ul.valid_tid_bmap, sz);
+ ),
+
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ ", ST type=%u DL TIDs: %*pb, UL TIDs: %*pb",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->st_type,
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(dl_tid_bitmap),
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(ul_tid_bitmap)
+ )
+);
+
+TRACE_EVENT(drv_get_smd_ctx,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type),
+
+ TP_ARGS(local, sdata, sta, type),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, st_type)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->st_type = type;
+ ),
+
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT ", ST type=%u",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->st_type
+ )
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
diff --git a/net/wireless/core.c b/net/wireless/core.c
index d13310fef691a..129af6ba5fdae 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1405,6 +1405,25 @@ void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
}
EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);
+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,
+ const u8 *addr)
+{
+ struct cfg80211_smd_get_ctx_pending *pending, *tmp;
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_for_each_entry_safe(pending, tmp,
+ &wdev->smd_get_ctx_pending_list,
+ list) {
+ if (!addr || ether_addr_equal(pending->sta_addr, addr)) {
+ list_del(&pending->list);
+ kfree(pending);
+ dev_put(wdev->netdev);
+ }
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+}
+EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req);
+
static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
bool unregister_netdev)
{
@@ -1477,6 +1496,10 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
}
}
+ if (wdev->iftype == NL80211_IFTYPE_AP ||
+ wdev->iftype == NL80211_IFTYPE_AP_VLAN)
+ cfg80211_free_pending_smd_ctx_req(wdev, NULL);
+
wdev->connected = false;
}
@@ -1619,6 +1642,8 @@ void cfg80211_init_wdev(struct wireless_dev *wdev)
INIT_LIST_HEAD(&wdev->pmsr_list);
spin_lock_init(&wdev->pmsr_lock);
wiphy_work_init(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
+ spin_lock_init(&wdev->smd_get_ctx_lock);
+ INIT_LIST_HEAD(&wdev->smd_get_ctx_pending_list);
#ifdef CONFIG_CFG80211_WEXT
wdev->wext.default_key = -1;
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index a0d1cde26f0c9..15e14f429c164 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1475,3 +1475,33 @@ void cfg80211_mlo_reconf_add_done(struct net_device *dev,
nl80211_mlo_reconf_add_done(dev, data);
}
EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done);
+
+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *iter;
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_for_each_entry(iter, &wdev->smd_get_ctx_pending_list, list) {
+ if (ether_addr_equal(iter->sta_addr, sta_addr)) {
+ pending = iter;
+ list_del(&pending->list);
+ break;
+ }
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ if (!pending) {
+ wiphy_err(wdev->wiphy,
+ "No pending SMD ctx req for %pM found in %s\n",
+ sta_addr, __func__);
+ return;
+ }
+
+ nl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info);
+
+ dev_put(wdev->netdev);
+ kfree(pending);
+}
+EXPORT_SYMBOL(cfg80211_get_smd_ctx_done);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ab5a14f5fe283..0de9394954990 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -689,6 +689,62 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },
};
+static const struct nla_policy
+nl80211_smd_params_policy[NL80211_SMD_PARAMS_ATTR_MAX + 1] = {
+ [NL80211_SMD_PARAMS_ATTR_IDENTIFIER] = NLA_POLICY_ETH_ADDR,
+ [NL80211_SMD_PARAMS_ATTR_TIMEOUT] =
+ NLA_POLICY_MIN(NLA_U16, IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN),
+ [NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING] = { .type = NLA_FLAG },
+ [NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_SMD_INFO_NUM_PREP_AP_MAX),
+ [NL80211_SMD_PARAMS_ATTR_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_TYPE_MAX),
+ [NL80211_SMD_PARAMS_ATTR_PTK_MODE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_PTK_MODE_MAX),
+ [NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING] = { .type = NLA_FLAG },
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_ba_policy[NL80211_SMD_CTX_BA_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },
+ [NL80211_SMD_CTX_BA_ATTR_POLICY] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT] = { .type = NLA_FLAG },
+ [NL80211_SMD_CTX_BA_ATTR_TIMEOUT] = { .type = NLA_U16 },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG] = { .type = NLA_FLAG },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE] = { .type = NLA_U16 },
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_dl_policy[NL80211_SMD_CTX_DL_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_DL_ATTR_SN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_DL_ATTR_PN] = { .type = NLA_BINARY,
+ .len = IEEE80211_SMD_CTX_MAX_PN_LEN },
+ [NL80211_SMD_CTX_DL_ATTR_BA_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_ul_policy[NL80211_SMD_CTX_UL_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_UL_ATTR_SN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_UL_ATTR_PN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_UL_ATTR_BA_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_policy[NL80211_SMD_CTX_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_ATTR_DL] =
+ NLA_POLICY_NESTED(nl80211_smd_ctx_dl_policy),
+ [NL80211_SMD_CTX_ATTR_UL] =
+ NLA_POLICY_NESTED(nl80211_smd_ctx_ul_policy),
+ [NL80211_SMD_CTX_ATTR_DRV_DATA] =
+ NLA_POLICY_RANGE(NLA_BINARY,
+ 3, IEEE80211_MAX_DATA_LEN),
+};
+
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
.min = 0,
.max = 0xffff,
@@ -1098,6 +1154,15 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),
[NL80211_ATTR_STA_DUMP_LINK_STATS] = { .type = NLA_FLAG },
[NL80211_ATTR_FRAME_NO_STA] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_smd_params_policy),
+ [NL80211_ATTR_PEER_SMD_ENABLED] = { .type = NLA_FLAG },
+ [NL80211_ATTR_PEER_SMD_MAC_ADDR] = NLA_POLICY_ETH_ADDR,
+ [NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_CTX] = NLA_POLICY_NESTED(nl80211_smd_ctx_policy),
+ [NL80211_ATTR_SMD_CTX_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_CTX_TYPE_MAX),
};
/* policy for the key attributes */
@@ -7208,6 +7273,78 @@ static int nl80211_check_npca(struct cfg80211_registered_device *rdev,
return -EINVAL;
}
+static int nl80211_parse_smd_params(struct genl_info *info,
+ struct cfg80211_smd_params *smd_params)
+{
+ struct nlattr *smd_params_attr = info->attrs[NL80211_ATTR_SMD_PARAMS];
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct nlattr *tb[NL80211_SMD_PARAMS_ATTR_MAX + 1];
+ int err;
+
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_SMD)) {
+ GENL_SET_ERR_MSG(info, "SMD is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (!wdev->valid_links) {
+ GENL_SET_ERR_MSG(info, "SMD is not allowed without MLO");
+ return -EINVAL;
+ }
+
+ err = nla_parse_nested(tb, NL80211_SMD_PARAMS_ATTR_MAX,
+ smd_params_attr, nl80211_smd_params_policy,
+ NULL);
+ if (err) {
+ GENL_SET_ERR_MSG(info, "failed to parse SMD parameters");
+ return err;
+ }
+
+ if (!tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_TYPE] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]) {
+ GENL_SET_ERR_MSG(info, "required SMD parameters are missing");
+ return -EINVAL;
+ }
+
+ memcpy(smd_params->smd_identifier,
+ nla_data(tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER]),
+ ETH_ALEN);
+
+ smd_params->smd_timeout =
+ nla_get_u16(tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT]);
+
+ smd_params->dl_data_fwd =
+ !!tb[NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING];
+ if (smd_params->dl_data_fwd &&
+ !wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING)) {
+ GENL_SET_ERR_MSG(info,
+ "SMD DL packet forwarding is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ smd_params->max_num_of_peer_apmlds =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS]);
+
+ smd_params->smd_type =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_TYPE]);
+
+ smd_params->ptk_mode =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]);
+
+ smd_params->neighbor_probing =
+ !!tb[NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING];
+
+ smd_params->smd_enabled = true;
+
+ return 0;
+}
+
static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -7489,6 +7626,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
/* FIXME: validate MLO/link-id against driver capabilities */
+ if (info->attrs[NL80211_ATTR_SMD_PARAMS]) {
+ err = nl80211_parse_smd_params(info, ¶ms->smd_params);
+ if (err)
+ goto out;
+ }
+
err = rdev_start_ap(rdev, dev, params);
if (!err) {
wdev->links[link_id].ap.beacon_interval = params->beacon_interval;
@@ -7608,6 +7751,10 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {
[NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_PREP_TARGET] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_EXEC_CURRENT] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_DL_DRAIN] = { .type = NLA_FLAG },
};
static int parse_station_flags(struct genl_info *info,
@@ -7674,11 +7821,17 @@ static int parse_station_flags(struct genl_info *info,
switch (iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ params->sta_flags_mask =
+ BIT(NL80211_STA_FLAG_SMD) |
+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);
+ fallthrough;
case NL80211_IFTYPE_P2P_GO:
- params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
- BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
- BIT(NL80211_STA_FLAG_WME) |
- BIT(NL80211_STA_FLAG_MFP);
+ params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) |
+ BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
+ BIT(NL80211_STA_FLAG_WME) |
+ BIT(NL80211_STA_FLAG_MFP);
break;
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
@@ -8819,7 +8972,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
/* When you run into this, adjust the code below for the new flag */
- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (statype) {
case CFG80211_STA_MESH_PEER_KERNEL:
@@ -8913,7 +9066,11 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
BIT(NL80211_STA_FLAG_WME) |
BIT(NL80211_STA_FLAG_MFP) |
- BIT(NL80211_STA_FLAG_SPP_AMSDU)))
+ BIT(NL80211_STA_FLAG_SPP_AMSDU) |
+ BIT(NL80211_STA_FLAG_SMD) |
+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN)))
return -EINVAL;
/* but authenticated/associated only if driver handles it */
@@ -9167,6 +9324,32 @@ static int nl80211_parse_sta_txpower_setting(struct genl_info *info,
return 0;
}
+static int nl80211_set_station_smd(struct genl_info *info,
+ struct station_parameters *params)
+{
+ struct nlattr *smd_mac;
+
+ params->smd_params.smd_sta =
+ !!info->attrs[NL80211_ATTR_PEER_SMD_ENABLED];
+
+ if (!params->smd_params.smd_sta)
+ return 0;
+
+ smd_mac = info->attrs[NL80211_ATTR_PEER_SMD_MAC_ADDR];
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] || !smd_mac)
+ return -EINVAL;
+
+ nla_memcpy(params->smd_params.smd_identifier, smd_mac, ETH_ALEN);
+
+ params->smd_params.dl_data_fwd =
+ !!info->attrs[NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING];
+
+ params->smd_params.roam_sta = !!info->attrs[NL80211_ATTR_SMD_ROAM_STA];
+
+ return 0;
+}
+
static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -9305,6 +9488,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
if (err)
return err;
+ err = nl80211_set_station_smd(info, ¶ms);
+ if (err)
+ return err;
+
/* Include parameters for TDLS peer (will check later) */
err = nl80211_set_station_tdls(info, ¶ms);
if (err)
@@ -9533,6 +9720,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
if (parse_station_flags(info, wdev->iftype, ¶ms))
return -EINVAL;
+ err = nl80211_set_station_smd(info, ¶ms);
+ if (err)
+ return err;
+
/* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT
* as userspace might just pass through the capabilities from the IEs
* directly, rather than enforcing this restriction and returning an
@@ -9566,7 +9757,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
/* When you run into this, adjust the code below for the new flag */
- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
@@ -19387,6 +19578,556 @@ nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)
return rdev_set_epcs(rdev, dev, val);
}
+static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids)
+{
+ size_t n = 0;
+
+ n += nla_total_size(0); /* ba_params nest header */
+ n += n_tids * (nla_total_size(0) + /* tid nest header */
+ nla_total_size(sizeof(u16)) + /* buff_size */
+ nla_total_size(sizeof(u8)) + /* policy */
+ nla_total_size(0) + /* amsdu_support */
+ nla_total_size(sizeof(u16)) + /* timeout */
+ nla_total_size(0) + /* ext_no_frag */
+ nla_total_size(sizeof(u8)) + /* ext_frag_lvl */
+ nla_total_size(sizeof(u16))); /* ext_buff_size */
+
+ return n;
+}
+
+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info)
+{
+ const struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ int n_dl_tids = 0, n_ul_tids = 0;
+ u8 pn_len = ctx->pn_len;
+ size_t n = 0;
+
+ /* count valid TIDs */
+ n_dl_tids = bitmap_weight(ctx->dl.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+ n_ul_tids = bitmap_weight(ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ n += nla_total_size(sizeof(u8)); /* ST type */
+
+ /* outer NL80211_ATTR_SMD_CTX nest */
+ n += nla_total_size(0); /* nest header */
+
+ /* DL nest */
+ n += nla_total_size(0); /* DL nest header */
+
+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* DL SN nest header */
+ n += n_dl_tids * nla_total_size(sizeof(u16)); /* DL SN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap))
+ n += nla_total_size(pn_len); /* DL PN */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap))
+ n += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids); /* DL BA */
+
+ /* UL nest */
+ n += nla_total_size(0); /* UL nest header */
+
+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* UL SN nest header */
+ n += n_ul_tids * nla_total_size(sizeof(u16)); /* UL SN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* UL PN nest header */
+ n += n_ul_tids * nla_total_size(pn_len); /* UL PN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap))
+ n += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids); /* UL BA */
+
+ if (ctx->drv_ctx_size)
+ n += nla_total_size(ctx->drv_ctx_size); /* Driver data */
+
+ return n;
+}
+
+static int
+nl80211_put_smd_ctx_ba_params(struct sk_buff *msg,
+ const unsigned long *tid_bmap,
+ const struct ieee80211_smd_ctx_ba *ba_tids,
+ bool dl)
+{
+ u32 ba_params_attr = NL80211_SMD_CTX_DL_ATTR_BA_PARAMS;
+ struct nlattr *dl_ul_ba = NULL, *tid_ba = NULL;
+ u8 tid;
+
+ if (!dl)
+ ba_params_attr = NL80211_SMD_CTX_UL_ATTR_BA_PARAMS;
+
+ dl_ul_ba = nla_nest_start(msg, ba_params_attr);
+ if (!dl_ul_ba)
+ return -ENOBUFS;
+
+ for_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) {
+ const struct ieee80211_smd_ctx_ba *ba = &ba_tids[tid];
+
+ tid_ba = nla_nest_start(msg, tid + 1);
+ if (!tid_ba)
+ goto nla_fail;
+
+ if (nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,
+ ba->buffer_size) ||
+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_POLICY,
+ ba->ba_policy) ||
+ (ba->amsdu_supported &&
+ nla_put_flag(msg,
+ NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT)) ||
+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_TIMEOUT,
+ ba->timeout) ||
+ (ba->ext_no_frag &&
+ nla_put_flag(msg, NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG)) ||
+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ ba->extfrag_level) ||
+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,
+ ba->ext_buffer_size)) {
+ nla_nest_cancel(msg, tid_ba);
+ goto nla_fail;
+ }
+
+ nla_nest_end(msg, tid_ba);
+ }
+
+ nla_nest_end(msg, dl_ul_ba);
+ return 0;
+
+nla_fail:
+ nla_nest_cancel(msg, dl_ul_ba);
+ return -ENOBUFS;
+}
+
+int nl80211_put_smd_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;
+ struct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;
+ const struct ieee80211_smd_ctx *ctx;
+ u8 dl_tid_bmap = 0, ul_tid_bmap = 0;
+ bool pn_size_valid;
+ u8 tid;
+
+ /* ST Type */
+ if (nla_put_u8(msg, NL80211_ATTR_SMD_CTX_TYPE, st_info->type))
+ return -ENOBUFS;
+
+ smd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);
+ if (!smd_ctx)
+ return -ENOBUFS;
+
+ ctx = st_info->ctx;
+
+ /* Build DL context */
+ dl_tid_bmap = bitmap_read(ctx->dl.valid_tid_bmap, 0,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ dl = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_DL);
+ if (!dl)
+ goto nla_fail;
+
+ if (nla_put_u8(msg, NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,
+ dl_tid_bmap))
+ goto nla_fail_dl;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx->valid_ctx_bmap)) {
+ dl_sn = nla_nest_start(msg, NL80211_SMD_CTX_DL_ATTR_SN);
+ if (!dl_sn)
+ goto nla_fail_dl;
+
+ for_each_set_bit(tid, ctx->dl.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put_u16(msg, tid + 1, ctx->dl.sn[tid])) {
+ nla_nest_cancel(msg, dl_sn);
+ goto nla_fail_dl;
+ }
+ }
+ nla_nest_end(msg, dl_sn);
+ }
+
+ pn_size_valid =
+ ctx->pn_len && ctx->pn_len <= IEEE80211_SMD_CTX_MAX_PN_LEN;
+
+ if (pn_size_valid &&
+ test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap) &&
+ nla_put(msg, NL80211_SMD_CTX_DL_ATTR_PN, ctx->pn_len, ctx->dl.pn))
+ goto nla_fail_dl;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap) &&
+ nl80211_put_smd_ctx_ba_params(msg, ctx->dl.valid_tid_bmap,
+ ctx->dl.ba, true))
+ goto nla_fail_dl;
+
+ nla_nest_end(msg, dl);
+
+ /* Build UL context */
+ ul_tid_bmap = bitmap_read(ctx->ul.valid_tid_bmap, 0,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ ul = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_UL);
+ if (!ul)
+ goto nla_fail;
+
+ if (nla_put_u8(msg, NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,
+ ul_tid_bmap))
+ goto nla_fail_ul;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx->valid_ctx_bmap)) {
+ ul_sn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_SN);
+ if (!ul_sn)
+ goto nla_fail_ul;
+
+ for_each_set_bit(tid, ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put_u16(msg, tid + 1, ctx->ul.sn[tid])) {
+ nla_nest_cancel(msg, ul_sn);
+ goto nla_fail_ul;
+ }
+ }
+ nla_nest_end(msg, ul_sn);
+ }
+
+ if (pn_size_valid &&
+ test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap)) {
+ ul_pn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_PN);
+ if (!ul_pn)
+ goto nla_fail_ul;
+
+ for_each_set_bit(tid, ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put(msg, tid + 1, ctx->pn_len,
+ ctx->ul.pn[tid])) {
+ nla_nest_cancel(msg, ul_pn);
+ goto nla_fail_ul;
+ }
+ }
+ nla_nest_end(msg, ul_pn);
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap) &&
+ nl80211_put_smd_ctx_ba_params(msg, ctx->ul.valid_tid_bmap,
+ ctx->ul.ba, false))
+ goto nla_fail_ul;
+
+ nla_nest_end(msg, ul);
+
+ /* Driver data blob */
+ if (ctx->drv_ctx_size &&
+ nla_put(msg, NL80211_SMD_CTX_ATTR_DRV_DATA, ctx->drv_ctx_size,
+ ctx->drv_ctx))
+ goto nla_fail;
+
+ nla_nest_end(msg, smd_ctx);
+
+ return 0;
+
+nla_fail_ul:
+ nla_nest_cancel(msg, ul);
+
+nla_fail_dl:
+ nla_nest_cancel(msg, dl);
+
+nla_fail:
+ nla_nest_cancel(msg, smd_ctx);
+ return -EINVAL;
+}
+
+static int
+nl80211_parse_smd_ctx_ba_params(struct nlattr *tb,
+ struct ieee80211_smd_ctx_ba *ba_tids,
+ unsigned long *valid_ctx_bmap)
+{
+ struct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1];
+ struct ieee80211_smd_ctx_ba *ba;
+ struct nlattr *ba_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ if (!tb)
+ return 0;
+
+ nla_for_each_nested(ba_attr, tb, rem) {
+ tid = nla_type(ba_attr) - 1;
+ if (tid < 0 || tid >= IEEE80211_SMD_CTX_NUM_TIDS)
+ return -EINVAL;
+
+ if (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX,
+ ba_attr, nl80211_smd_ctx_ba_policy,
+ NULL))
+ return -EINVAL;
+
+ ba = &ba_tids[tid];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE])
+ ba->buffer_size =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE]);
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY])
+ ba->ba_policy =
+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY]);
+
+ ba->amsdu_supported =
+ !!ba_tb[NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT])
+ ba->timeout =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT]);
+
+ ba->ext_no_frag = !!ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL])
+ ba->extfrag_level =
+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL]);
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE])
+ ba->ext_buffer_size =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]);
+
+ n_tids++;
+ }
+
+ if (!n_tids)
+ return -EINVAL;
+
+ set_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, valid_ctx_bmap);
+
+ return 0;
+}
+
+static int nl80211_parse_smd_ctx(struct genl_info *info,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct nlattr *dl_tb[NL80211_SMD_CTX_DL_ATTR_MAX + 1];
+ struct nlattr *ul_tb[NL80211_SMD_CTX_UL_ATTR_MAX + 1];
+ struct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];
+ struct ieee80211_smd_ctx *ctx;
+ struct nlattr *bmap_attr;
+ size_t drv_ctx_size = 0;
+
+ st_info->type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]);
+
+ if (nla_parse_nested(tb, NL80211_SMD_CTX_ATTR_MAX,
+ info->attrs[NL80211_ATTR_SMD_CTX],
+ nl80211_smd_ctx_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse SMD context");
+ return -EINVAL;
+ }
+
+ if (tb[NL80211_SMD_CTX_ATTR_DRV_DATA])
+ drv_ctx_size = nla_len(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]);
+
+ ctx = kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ st_info->ctx = ctx;
+
+ /* DL Context */
+ if (tb[NL80211_SMD_CTX_ATTR_DL]) {
+ struct nlattr *ba_attr;
+
+ if (nla_parse_nested(dl_tb, NL80211_SMD_CTX_DL_ATTR_MAX,
+ tb[NL80211_SMD_CTX_ATTR_DL],
+ nl80211_smd_ctx_dl_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse DL context");
+ goto err_free_ctx;
+ }
+
+ bmap_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP];
+ if (bmap_attr)
+ bitmap_write(ctx->dl.valid_tid_bmap,
+ nla_get_u8(bmap_attr),
+ 0, IEEE80211_SMD_CTX_NUM_TIDS);
+
+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ dl_tb[NL80211_SMD_CTX_DL_ATTR_SN],
+ rem) {
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid DL SN tid");
+ goto err_free_ctx;
+ }
+
+ if (nla_len(sn_attr) != sizeof(u16)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid DL SN len");
+ goto err_free_ctx;
+ }
+
+ ctx->dl.sn[tid] = nla_get_u16(sn_attr);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty DL SN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_DL_SN,
+ ctx->valid_ctx_bmap);
+ }
+
+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]) {
+ const u8 *pn_data =
+ nla_data(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);
+
+ ctx->pn_len =
+ nla_len(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);
+
+ memcpy(ctx->dl.pn, pn_data, ctx->pn_len);
+ set_bit(IEEE80211_SMD_CTX_VALID_PN,
+ ctx->valid_ctx_bmap);
+ }
+
+ ba_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS];
+ if (ba_attr &&
+ nl80211_parse_smd_ctx_ba_params(ba_attr, ctx->dl.ba,
+ ctx->valid_ctx_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse DL BlockAck params");
+ goto err_free_ctx;
+ }
+ }
+
+ /* UL Context */
+ if (tb[NL80211_SMD_CTX_ATTR_UL]) {
+ struct nlattr *ba_attr;
+
+ if (nla_parse_nested(ul_tb, NL80211_SMD_CTX_UL_ATTR_MAX,
+ tb[NL80211_SMD_CTX_ATTR_UL],
+ nl80211_smd_ctx_ul_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse UL context");
+ goto err_free_ctx;
+ }
+
+ bmap_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP];
+ if (bmap_attr)
+ bitmap_write(ctx->ul.valid_tid_bmap,
+ nla_get_u8(bmap_attr),
+ 0, IEEE80211_SMD_CTX_NUM_TIDS);
+
+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ ul_tb[NL80211_SMD_CTX_UL_ATTR_SN],
+ rem) {
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL SN tid");
+ goto err_free_ctx;
+ }
+
+ if (nla_len(sn_attr) != sizeof(u16)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL SN len");
+ goto err_free_ctx;
+ }
+
+ ctx->ul.sn[tid] = nla_get_u16(sn_attr);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL SN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_UL_SN,
+ ctx->valid_ctx_bmap);
+ }
+
+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_PN]) {
+ struct nlattr *pn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(pn_attr,
+ ul_tb[NL80211_SMD_CTX_UL_ATTR_PN],
+ rem) {
+ u8 pn_len;
+
+ tid = nla_type(pn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL PN tid");
+ goto err_free_ctx;
+ }
+
+ /*
+ * PN length must be the same for all DL and
+ * UL TIDs.
+ */
+ pn_len = nla_len(pn_attr);
+ if (pn_len > IEEE80211_SMD_CTX_MAX_PN_LEN ||
+ (ctx->pn_len && pn_len != ctx->pn_len)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid PN length");
+ goto err_free_ctx;
+ }
+ ctx->pn_len = pn_len;
+
+ memcpy(ctx->ul.pn[tid], nla_data(pn_attr),
+ ctx->pn_len);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL PN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_PN,
+ ctx->valid_ctx_bmap);
+ }
+
+ ba_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS];
+ if (ba_attr &&
+ nl80211_parse_smd_ctx_ba_params(ba_attr, ctx->ul.ba,
+ ctx->valid_ctx_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse UL BlockAck params");
+ goto err_free_ctx;
+ }
+ }
+
+ /* Driver data */
+ if (tb[NL80211_SMD_CTX_ATTR_DRV_DATA]) {
+ ctx->drv_ctx_size = drv_ctx_size;
+ memcpy(ctx->drv_ctx,
+ nla_data(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]),
+ drv_ctx_size);
+ }
+
+ return 0;
+
+err_free_ctx:
+ kfree(ctx);
+ st_info->ctx = NULL;
+ return -EINVAL;
+}
+
#define NL80211_FLAG_NEED_WIPHY 0x01
#define NL80211_FLAG_NEED_NETDEV 0x02
#define NL80211_FLAG_NEED_RTNL 0x04
@@ -19728,6 +20469,128 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)
return err;
}
+static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct cfg80211_smd_transition_info st_info = {};
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ const u8 *addr;
+ int err;
+
+ if (!rdev->ops->set_smd_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+
+ err = nl80211_parse_smd_ctx(info, &st_info);
+ if (err)
+ return err;
+
+ /* drivers must copy @ctx for any deferred processing */
+ err = rdev_set_smd_ctx(rdev, wdev, addr, &st_info);
+
+ kfree(st_info.ctx);
+ return err;
+}
+
+static struct cfg80211_smd_get_ctx_pending *
+__cfg80211_get_smd_sta_pending_ctx(struct wireless_dev *wdev, const u8 *addr)
+{
+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *tmp;
+
+ lockdep_assert_held(&wdev->smd_get_ctx_lock);
+
+ list_for_each_entry(tmp, &wdev->smd_get_ctx_pending_list, list) {
+ if (ether_addr_equal(tmp->sta_addr, addr)) {
+ pending = tmp;
+ break;
+ }
+ }
+
+ return pending;
+}
+
+static int nl80211_get_smd_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_smd_get_ctx_pending *pending;
+ enum nl80211_smd_ctx_type type;
+ const u8 *addr = NULL;
+ int err;
+
+ if (!rdev->ops->get_smd_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+ type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]);
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ if (__cfg80211_get_smd_sta_pending_ctx(wdev, addr)) {
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+ return -EBUSY;
+ }
+ /* safe to unlock, concurrent commands are serialized by wiphy mutex */
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ pending = kzalloc_obj(*pending);
+ if (!pending)
+ return -ENOMEM;
+
+ memcpy(pending->sta_addr, addr, ETH_ALEN);
+
+ /*
+ * Take reference and add to the list before calling the driver to avoid
+ * race. Upon success, the reference is released while reporting back
+ * the context or in the list removal and drain path.
+ */
+ dev_hold(wdev->netdev);
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_add_tail(&pending->list, &wdev->smd_get_ctx_pending_list);
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ err = rdev_get_smd_ctx(rdev, wdev, addr, type);
+ if (err) {
+ /* revert upon failure */
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ pending = __cfg80211_get_smd_sta_pending_ctx(wdev, addr);
+ if (pending) {
+ list_del(&pending->list);
+ kfree(pending);
+ dev_put(wdev->netdev);
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+ return err;
+ }
+
+ /* Reply will arrive via cfg80211_get_smd_ctx_done() */
+ return 0;
+}
+
#define SELECTOR(__sel, name, value) \
((__sel) == (value)) ? NL80211_IFL_SEL_##name :
int __missing_selector(void);
@@ -20629,6 +21492,19 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV_UP),
},
+ {
+ .cmd = NL80211_CMD_SET_SMD_CTX,
+ .doit = nl80211_set_smd_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_CLEAR_SKB),
+ },
+ {
+ .cmd = NL80211_CMD_GET_SMD_CTX,
+ .doit = nl80211_get_smd_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
@@ -22012,10 +22888,14 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
struct cfg80211_rx_info *info, gfp_t gfp)
{
struct net_device *netdev = wdev->netdev;
+ int st_roaming_data_len = 0;
struct sk_buff *msg;
void *hdr;
- msg = nlmsg_new(100 + info->len, gfp);
+ if (info->st_info.ctx)
+ st_roaming_data_len = nl80211_smd_ctx_nl_size(&info->st_info);
+
+ msg = nlmsg_new(100 + info->len + st_roaming_data_len, gfp);
if (!msg)
return -ENOMEM;
@@ -22051,6 +22931,10 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
nla_put_flag(msg, NL80211_ATTR_FRAME_NO_STA)))
goto nla_put_failure;
+ if (st_roaming_data_len &&
+ nl80211_put_smd_ctx(msg, &info->st_info))
+ goto nla_put_failure;
+
genlmsg_end(msg, hdr);
return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
@@ -23648,6 +24532,47 @@ void cfg80211_nan_channel_evac(struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_nan_channel_evac);
+void
+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+ struct net_device *dev = wdev->netdev;
+ size_t msg_len = NLMSG_DEFAULT_SIZE;
+ struct sk_buff *msg;
+ void *hdr;
+
+ if (st_info->ctx)
+ msg_len = 100 + nl80211_smd_ctx_nl_size(st_info) +
+ nla_total_size(ETH_ALEN); /* MLD address */
+
+ msg = nlmsg_new(msg_len, GFP_ATOMIC);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SMD_CTX_EVENT);
+ if (!hdr)
+ goto nla_put_failure;
+
+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+ nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
+ nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, sta_addr))
+ goto nla_put_failure;
+
+ if (st_info->ctx && nl80211_put_smd_ctx(msg, st_info))
+ goto nla_put_failure;
+
+ genlmsg_end(msg, hdr);
+
+ genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+ NL80211_MCGRP_MLME, GFP_ATOMIC);
+ return;
+
+nla_put_failure:
+ nlmsg_free(msg);
+}
+
/* initialisation/exit functions */
int __init nl80211_init(void)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index bdb065d140549..2855d30ba3546 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -129,4 +129,13 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
void nl80211_mlo_reconf_add_done(struct net_device *dev,
struct cfg80211_mlo_reconf_done_data *data);
+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info);
+int nl80211_put_smd_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info);
+
+void
+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_WIRELESS_NL80211_H */
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 46849fe8d0b39..ab520560f6043 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1636,4 +1636,32 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_smd_ctx(&rdev->wiphy, wdev, addr, st_info);
+ if (rdev->ops->set_smd_ctx)
+ ret = rdev->ops->set_smd_ctx(&rdev->wiphy, wdev, addr, st_info);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
+static inline int rdev_get_smd_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_smd_ctx_type type)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_get_smd_ctx(&rdev->wiphy, wdev, addr, type);
+ if (rdev->ops->get_smd_ctx)
+ ret = rdev->ops->get_smd_ctx(&rdev->wiphy, wdev, addr, type);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 8c2a91b85c396..a2662919b8f08 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -4405,6 +4405,79 @@ TRACE_EVENT(cfg80211_nan_channel_evac,
TP_printk(WDEV_PR_FMT ", " WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
WDEV_PR_ARG, WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
);
+
+TRACE_EVENT(rdev_set_smd_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info),
+
+ TP_ARGS(wiphy, wdev, addr, st_info),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ WDEV_ENTRY
+ MAC_ENTRY(sta_addr)
+ __field(u8, st_type)
+ __field(unsigned int, num_tids)
+ __dynamic_array(unsigned long, tx_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ __dynamic_array(unsigned long, rx_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ ),
+
+ TP_fast_assign(
+ struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ unsigned long sz;
+
+ WIPHY_ASSIGN;
+ WDEV_ASSIGN;
+ MAC_ASSIGN(sta_addr, addr);
+ __entry->st_type = st_info->type;
+
+ __entry->num_tids = IEEE80211_SMD_CTX_NUM_TIDS;
+ sz = BITS_TO_LONGS(__entry->num_tids) * sizeof(unsigned long);
+
+ memcpy(__get_dynamic_array(tx_tid_bitmap),
+ ctx->dl.valid_tid_bmap, sz);
+ memcpy(__get_dynamic_array(rx_tid_bitmap),
+ ctx->ul.valid_tid_bmap, sz);
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT
+ ", sta=%pM, ST type=%u DL TIDs: %*pb, UL TIDs: %*pb",
+ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->sta_addr,
+ __entry->st_type,
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(tx_tid_bitmap),
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(rx_tid_bitmap))
+);
+
+TRACE_EVENT(rdev_get_smd_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_smd_ctx_type type),
+
+ TP_ARGS(wiphy, wdev, addr, type),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ WDEV_ENTRY
+ MAC_ENTRY(sta_addr)
+ __field(u8, st_type)
+ ),
+
+ TP_fast_assign(
+ WIPHY_ASSIGN;
+ WDEV_ASSIGN;
+ MAC_ASSIGN(sta_addr, addr);
+ __entry->st_type = type;
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT
+ ", sta=%pM, ST type=%u",
+ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->sta_addr,
+ __entry->st_type)
+);
+
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
|
| 3/2 | 2026/09/26 05:47 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 52065 output: 27 thoughts: 770 Thoughts: **Fuzzing Evaluation: IEEE 802.11bn / UHR SMD Support** Okay, so I'm looking at this commit and trying to figure out if it's worth throwing at syzkaller. First, let's break down what's being touched here. Looks like a hefty modification of the wireless stack – `include/linux/ieee80211-uhr.h`, `net/mac80211`, `net/wireless` and the uAPI headers. This is adding support for IEEE 802.11bn Ultra High Reliability Seamless Mobility Domain (UHR SMD) BSS Transition. That includes new nl80211 commands: `NL80211_CMD_SET_SMD_CTX`, `NL80211_CMD_GET_SMD_CTX`, and modifications in `nl80211_start_ap`, `nl80211_new_station`, and `nl80211_set_station`. There's also rx handling for ST prep/exec requests in mac80211, state transitions in `sta_info.c`, and some complex netlink parsing with functions like `nl80211_parse_smd_ctx`. Now, the important question: can we even fuzz this effectively with standard syzkaller setups, QEMU and all that? Luckily, the answer is probably yes! I know that `mac80211_hwsim`, virtual WiFi, and nl80211 netlink sockets are already extensively fuzzed by syzkaller. And this patch is modifying core cfg80211/mac80211 and the nl80211 parsing/state machine. This definitely looks promising. The next step is to make sure this UHR SMD code is reachable in the syzkaller setup. I'll need to check if a driver supports this, or if the nl80211 commands can reach this code. I need to dig into `nl80211_set_smd_ctx`, `nl80211_get_smd_ctx`, and the surrounding code, see what Kconfig options and drivers are involved. Let's fire up `grepper` or scan the repo and see what we can find. If it's reachable, then it's fuzzing time. |
| 4/2 | 2026/09/26 05:47 | tool | grepper |
0mArgs:{
"Expression": "NL80211_EXT_FEATURE_SMD"
}Results: {
"Output": "include/uapi/linux/nl80211.h=1445=enum nl80211_commands {\n--\ninclude/uapi/linux/nl80211.h-3211- *\tan AP managed by an SMD-ME. Valid if the driver supports\ninclude/uapi/linux/nl80211.h:3212: *\t%NL80211_EXT_FEATURE_SMD.\ninclude/uapi/linux/nl80211.h-3213- *\tUsed with %NL80211_CMD_START_AP. See \u0026enum nl80211_smd_params_attrs.\n--\ninclude/uapi/linux/nl80211.h=6911=enum nl80211_feature_flags {\n--\ninclude/uapi/linux/nl80211.h-7195- *\ninclude/uapi/linux/nl80211.h:7196: * @NL80211_EXT_FEATURE_SMD: Driver supports Seamless Mobility Domain (SMD)\ninclude/uapi/linux/nl80211.h-7197- *\tand is managed by an SMD-ME to support SMD BSS Transition in AP mode\n--\ninclude/uapi/linux/nl80211.h-7200- *\ninclude/uapi/linux/nl80211.h:7201: * @NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING: Driver supports forwarding of\ninclude/uapi/linux/nl80211.h-7202- *\tbuffered downlink (DL) data packets in AP mode to the non-AP STA during\n--\ninclude/uapi/linux/nl80211.h=7208=enum nl80211_ext_feature_index {\n--\ninclude/uapi/linux/nl80211.h-7287-\tNL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,\ninclude/uapi/linux/nl80211.h:7288:\tNL80211_EXT_FEATURE_SMD,\ninclude/uapi/linux/nl80211.h:7289:\tNL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING,\ninclude/uapi/linux/nl80211.h-7290-\n--\nnet/wireless/nl80211.c=7276=static int nl80211_parse_smd_params(struct genl_info *info,\n--\nnet/wireless/nl80211.c-7286-\tif (!wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\nnet/wireless/nl80211.c:7287:\t\t\t\t NL80211_EXT_FEATURE_SMD)) {\nnet/wireless/nl80211.c-7288-\t\tGENL_SET_ERR_MSG(info, \"SMD is not supported\");\n--\nnet/wireless/nl80211.c-7324-\t !wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\nnet/wireless/nl80211.c:7325:\t\t\t\t NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING)) {\nnet/wireless/nl80211.c-7326-\t\tGENL_SET_ERR_MSG(info,\n"
} |
| 5/2 | 2026/09/26 05:47 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54288 output: 20 thoughts: 43 Thoughts: Here's my summary, as though I'm thinking through this process: **Investigating SMD Context in NL80211 Drivers** Okay, so I need to quickly ascertain the current state of support and usage for the `NL80211_EXT_FEATURE_SMD` extended feature. My first instinct is to scan the driver landscape. I need to know if any existing drivers are actively *advertising* this feature, because that's the clearest indicator of intent and capability. After that, I also need to see how they interact with this specific context. Are they using the `set_smd_ctx` and `get_smd_ctx` functions? If these functions are used, it suggests those drivers are using the Surface Management Data context. If I'm lucky, I should be able to get a quick overview of who's using it and how just from looking for those function calls. This will provide a baseline understanding before I dive deeper into specific implementations. Let's see what this reveals! |
| 6/2 | 2026/09/26 05:47 | tool | grepper |
0mArgs:{
"Expression": "set_smd_ctx"
}Results: {
"Output": "include/net/cfg80211.h=4908=struct cfg80211_smd_get_ctx_pending {\n--\ninclude/net/cfg80211.h-5344- *\ninclude/net/cfg80211.h:5345: * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info-\u003ectx is\ninclude/net/cfg80211.h-5346- *\tfreed immediately after this call returns; drivers must copy\n--\ninclude/net/cfg80211.h=5351=struct cfg80211_ops {\n--\ninclude/net/cfg80211.h-5727-\tvoid\t(*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\ninclude/net/cfg80211.h:5728:\tint\t(*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\ninclude/net/cfg80211.h-5729-\t\t\t const u8 *addr,\n--\ninclude/net/mac80211.h=4113=enum ieee80211_sta_smd_state {\n--\ninclude/net/mac80211.h-4788- *\tThe callback can sleep.\ninclude/net/mac80211.h:4789: * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on\ninclude/net/mac80211.h-4790- *\tthe target AP MLD side to program dynamic context.\n--\ninclude/net/mac80211.h=4797=struct ieee80211_ops {\n--\ninclude/net/mac80211.h-5201-\t\t\t enum ieee80211_sta_smd_state new_state);\ninclude/net/mac80211.h:5202:\tint (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\ninclude/net/mac80211.h-5203-\t\t\t struct ieee80211_sta *sta,\n--\nnet/mac80211/cfg.c=6073=ieee80211_set_peer_nan_sched(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-6083-\nnet/mac80211/cfg.c:6084:static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\nnet/mac80211/cfg.c-6085-\t\t\t\t const u8 *addr,\n--\nnet/mac80211/cfg.c-6105-\nnet/mac80211/cfg.c:6106:\treturn drv_set_smd_ctx(local, sdata, \u0026sta-\u003esta, st_info);\nnet/mac80211/cfg.c-6107-}\n--\nnet/mac80211/cfg.c=6144=const struct cfg80211_ops mac80211_config_ops = {\n--\nnet/mac80211/cfg.c-6261-\t.nan_set_peer_sched = ieee80211_set_peer_nan_sched,\nnet/mac80211/cfg.c:6262:\t.set_smd_ctx = ieee80211_set_smd_ctx,\nnet/mac80211/cfg.c-6263-\t.get_smd_ctx = ieee80211_get_smd_ctx,\n--\nnet/mac80211/driver-ops.h=1817=int drv_sta_smd_state(struct ieee80211_local *local,\n--\nnet/mac80211/driver-ops.h-1822-\nnet/mac80211/driver-ops.h:1823:static inline int drv_set_smd_ctx(struct ieee80211_local *local,\nnet/mac80211/driver-ops.h-1824-\t\t\t\t struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/driver-ops.h-1829-\nnet/mac80211/driver-ops.h:1830:\tif (!local-\u003eops-\u003eset_smd_ctx)\nnet/mac80211/driver-ops.h-1831-\t\treturn -EOPNOTSUPP;\n--\nnet/mac80211/driver-ops.h-1839-\nnet/mac80211/driver-ops.h:1840:\ttrace_drv_set_smd_ctx(local, sdata, sta, st_info);\nnet/mac80211/driver-ops.h:1841:\tret = local-\u003eops-\u003eset_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, st_info);\nnet/mac80211/driver-ops.h-1842-\ttrace_drv_return_int(local, ret);\n--\nnet/mac80211/trace.h=3408=TRACE_EVENT(drv_sta_smd_state,\n--\nnet/mac80211/trace.h-3440-\nnet/mac80211/trace.h:3441:TRACE_EVENT(drv_set_smd_ctx,\nnet/mac80211/trace.h-3442-\tTP_PROTO(struct ieee80211_local *local,\n--\nnet/wireless/nl80211.c=20401=static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-20471-\nnet/wireless/nl80211.c:20472:static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)\nnet/wireless/nl80211.c-20473-{\n--\nnet/wireless/nl80211.c-20480-\nnet/wireless/nl80211.c:20481:\tif (!rdev-\u003eops-\u003eset_smd_ctx)\nnet/wireless/nl80211.c-20482-\t\treturn -EOPNOTSUPP;\n--\nnet/wireless/nl80211.c-20501-\t/* drivers must copy @ctx for any deferred processing */\nnet/wireless/nl80211.c:20502:\terr = rdev_set_smd_ctx(rdev, wdev, addr, \u0026st_info);\nnet/wireless/nl80211.c-20503-\n--\nnet/wireless/nl80211.c=20619=static const struct genl_small_ops nl80211_small_ops[] = {\n--\nnet/wireless/nl80211.c-21496-\t\t.cmd = NL80211_CMD_SET_SMD_CTX,\nnet/wireless/nl80211.c:21497:\t\t.doit = nl80211_set_smd_ctx,\nnet/wireless/nl80211.c-21498-\t\t.flags = GENL_UNS_ADMIN_PERM,\n--\nnet/wireless/rdev-ops.h=1625=rdev_set_epcs(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/rdev-ops.h-1638-\nnet/wireless/rdev-ops.h:1639:static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev,\nnet/wireless/rdev-ops.h-1640-\t\t\t\t struct wireless_dev *wdev, const u8 *addr,\n--\nnet/wireless/rdev-ops.h-1644-\nnet/wireless/rdev-ops.h:1645:\ttrace_rdev_set_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, st_info);\nnet/wireless/rdev-ops.h:1646:\tif (rdev-\u003eops-\u003eset_smd_ctx)\nnet/wireless/rdev-ops.h:1647:\t\tret = rdev-\u003eops-\u003eset_smd_ctx(\u0026rdev-\u003ewiphy, wdev, addr, st_info);\nnet/wireless/rdev-ops.h-1648-\ttrace_rdev_return_int(\u0026rdev-\u003ewiphy, ret);\n--\nnet/wireless/trace.h=4391=TRACE_EVENT(cfg80211_nan_channel_evac,\n--\nnet/wireless/trace.h-4408-\nnet/wireless/trace.h:4409:TRACE_EVENT(rdev_set_smd_ctx,\nnet/wireless/trace.h-4410-\tTP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,\n"
} |
| 7/2 | 2026/09/26 05:47 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57028 output: 38 thoughts: 2571 Thoughts: **SMD Context Management in mac80211: A Deep Dive** Alright, let's break this down. My initial observation is that `mac80211` hinges on `mac80211_config_ops`, specifically the implementations of `.set_smd_ctx` and `.get_smd_ctx`, which are essential for managing SMD contexts. This is key for any `mac80211`-based device, including `mac80211_hwsim`. It's clear that `cfg80211` routes `NL80211_CMD_SET_SMD_CTX` and `NL80211_CMD_GET_SMD_CTX` commands directly to `rdev->ops->set_smd_ctx` and `rdev->ops->get_smd_ctx` respectively. The vital link here is that mac80211 registers these operations within the wiphy through `mac80211_config_ops`, as defined in `net/mac80211/cfg.c`. This means that when a wiphy is allocated and registered by mac80211 drivers like mac80211_hwsim, the `cfg80211_ops` are set to `mac80211_config_ops`. Delving into the specifics, `ieee80211_set_smd_ctx` within `net/mac80211/cfg.c` is the core handler for setting the SMD context. It checks the interface type, ensuring it's an AP or AP_VLAN, and looks up the station. Critically, it then calls `drv_set_smd_ctx`, but it's important to realize that `nl80211_set_smd_ctx` in `cfg80211` itself calls `rdev_set_smd_ctx` and before calling `rdev_set_smd_ctx`, it performs an important parsing step via `nl80211_parse_smd_ctx`. This parsing step must manage complex nested netlink attributes! This is important to note for any custom SMD implementations. On the retrieval side, `nl80211_get_smd_ctx` handles the retrieval process. It manages a pending list (`wdev->smd_get_ctx_pending_list`) with a spinlock and uses `dev_hold` and `kzalloc_obj`, and references. The function then calls `rdev_get_smd_ctx` and performs rollback in case of failure. The pending context requests are freed via `cfg80211_free_pending_smd_ctx_req`. This function is called within `_cfg80211_unregister_wdev` and `__sta_info_destroy_part1`, ensuring a clean shutdown and context cleanup during station destruction. Furthermore, `nl80211_new_station` and `nl80211_set_station` both call `nl80211_set_station_smd`. The core logic for SMD state changes resides in `sta_apply_parameters` and is driven by flags. `sta_apply_smd_state_flags` calls `sta_info_move_smd_state` with `WARN_ON`s. `ieee80211_add_station` also interacts with `sta_info_move_smd_state`, as does `sta_info_reset_smd_state`. `sta_info_move_drv_smd_state` is also critical here. The WARN_ONs associated with these functions signal potential driver bugs or improper state transitions. Also, in `rx.c`, a `WARN_ONCE` warns about 802.3 packets that include an IEEE P802.11bn SMD context, and `nl80211_send_mgmt` uses `nl80211_put_smd_ctx` for serialization. Given this understanding, `mac80211_hwsim`'s ability to support multi-interface setups, AP mode, MLO, and mesh is quite relevant. Therefore, `NL80211_EXT_FEATURE_SMD` is what needs to be enabled in our drivers. This will allow the use of SMD in those systems. |
| 8/2 | 2026/09/26 05:48 | tool | grepper |
0mError:no matches Args: {
"Expression": "NL80211_EXT_FEATURE_SMD",
"PathPrefix": "drivers/net/wireless"
}Results: {
"error": "no matches"
} |
| 9/2 | 2026/09/26 05:48 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 60627 output: 18 thoughts: 3945 Thoughts: **Analyzing SMD Functionality and Reachability** Okay, here's the breakdown of my thought process. Initially, I noticed that the `NL80211_EXT_FEATURE_SMD` flag isn't set by any driver yet, at least within the kernel tree, according to the `grepper` output. This immediately raised a flag: does this prevent any of the modified code from being reached? I started digging into where the check for this flag lives. I found the check in `nl80211_parse_smd_params` within `nl80211.c`, which prevents the parsing if the flag isn't set. Critically, this function is only called from `nl80211_start_ap`. This means, at least, that functionality related to setting SMD parameters at AP start is gated on the driver explicitly setting the feature flag, which none do. But, I needed to check what happened elsewhere. I looked for calls to `nl80211_set_smd_ctx` and realized the core of the functionality is *not* gated on `NL80211_EXT_FEATURE_SMD`. Instead, `nl80211_set_smd_ctx` does *not* have that check. This function, in turn, calls `rdev_set_smd_ctx`, which, for mac80211, is `ieee80211_set_smd_ctx`. Inside `ieee80211_set_smd_ctx`, it calls `drv_set_smd_ctx`, but first it checks if the AP interface is present, and then checks `sta->sta.smd_params.smd_sta`. This means it's essential to understand where the station's `smd_sta` parameter is set. This is done through `nl80211_set_station_smd` when creating a new station, and this does *not* check for the feature flag. It's predicated on attributes set on new station creation. The `smd_sta` value is controlled by the `NL80211_ATTR_PEER_SMD_ENABLED` flag in the netlink message. The code then uses several station flags that control execution. After the station's parameters are set, it makes its way into `sta_apply_parameters`. The flags related to SMD are then applied. The `sta_apply_smd_state_flags` function calls other functions that ultimately are drivers that may need to be implemented. Finally, there's a station destruction flow where SMD contexts might get cleaned up. `nl80211_get_smd_ctx` also goes through the driver call path and the netlink layer. There's a lot of error handling to review, involving list management, and the `dev_hold`/`dev_put` pair. The most important error path is when drivers don't implement the `get_smd_ctx` operations. Crucially, `nl80211_set_smd_ctx` also handles quite a complex netlink structure involving parsing of multiple context parameters. I need to confirm that my suspicions are correct and that the checks are covered by some kind of fuzzing. Thankfully, syzkaller does test all of this by using nl80211 commands with mac80211_hwsim, covering different scenarios. The RX path will also likely have some interesting logic if mgmt frames are coming in for SMD functionality. Specifically, the processing for SMD is triggered based on the management frame type. |
| 10/2 | 2026/09/26 05:48 | tool | grepper |
0mArgs:{
"Expression": "smd_ctx"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 609 lines.\nUse more precise expression if possible.\n\ninclude/linux/ieee80211-uhr.h=647=struct ieee80211_uhr_mode_change_tuple {\n--\ninclude/linux/ieee80211-uhr.h-672-/**\ninclude/linux/ieee80211-uhr.h:673: * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL\ninclude/linux/ieee80211-uhr.h-674- *\n--\ninclude/linux/ieee80211-uhr.h-684- */\ninclude/linux/ieee80211-uhr.h:685:struct ieee80211_smd_ctx_ba {\ninclude/linux/ieee80211-uhr.h-686-\tbool amsdu_supported;\n--\ninclude/linux/ieee80211-uhr.h-695-/**\ninclude/linux/ieee80211-uhr.h:696: * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer\ninclude/linux/ieee80211-uhr.h-697- *\tIEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)\n--\ninclude/linux/ieee80211-uhr.h-716- */\ninclude/linux/ieee80211-uhr.h:717:struct ieee80211_smd_ctx {\ninclude/linux/ieee80211-uhr.h-718-\tDECLARE_BITMAP(valid_ctx_bmap, IEEE80211_SMD_CTX_NUM_VALID_CTX);\n--\ninclude/linux/ieee80211-uhr.h-724-\t\tu8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN];\ninclude/linux/ieee80211-uhr.h:725:\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\ninclude/linux/ieee80211-uhr.h-726-\t} dl;\n--\ninclude/linux/ieee80211-uhr.h-730-\t\tu8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN];\ninclude/linux/ieee80211-uhr.h:731:\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\ninclude/linux/ieee80211-uhr.h-732-\t} ul;\n--\ninclude/net/cfg80211.h=4898=struct cfg80211_smd_transition_info {\ninclude/net/cfg80211.h:4899:\tstruct ieee80211_smd_ctx *ctx;\ninclude/net/cfg80211.h:4900:\tenum nl80211_smd_ctx_type type;\ninclude/net/cfg80211.h-4901-};\n--\ninclude/net/cfg80211.h=4908=struct cfg80211_smd_get_ctx_pending {\n--\ninclude/net/cfg80211.h-5344- *\ninclude/net/cfg80211.h:5345: * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info-\u003ectx is\ninclude/net/cfg80211.h-5346- *\tfreed immediately after this call returns; drivers must copy\n--\ninclude/net/cfg80211.h-5348- *\ninclude/net/cfg80211.h:5349: * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD.\ninclude/net/cfg80211.h-5350- */\ninclude/net/cfg80211.h=5351=struct cfg80211_ops {\n--\ninclude/net/cfg80211.h-5727-\tvoid\t(*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\ninclude/net/cfg80211.h:5728:\tint\t(*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\ninclude/net/cfg80211.h-5729-\t\t\t const u8 *addr,\ninclude/net/cfg80211.h-5730-\t\t\t struct cfg80211_smd_transition_info *st_info);\ninclude/net/cfg80211.h:5731:\tint\t(*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\ninclude/net/cfg80211.h-5732-\t\t\t const u8 *addr,\ninclude/net/cfg80211.h:5733:\t\t\t enum nl80211_smd_ctx_type type);\ninclude/net/cfg80211.h-5734-};\n--\ninclude/net/cfg80211.h=7219=enum ieee80211_ap_reg_power {\n--\ninclude/net/cfg80211.h-7305- * @radio_mask: Bitmask of radios that this interface is allowed to operate on.\ninclude/net/cfg80211.h:7306: * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests.\ninclude/net/cfg80211.h:7307: * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests.\ninclude/net/cfg80211.h-7308- */\n--\ninclude/net/cfg80211.h=11104=void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,\n--\ninclude/net/cfg80211.h-11109-/**\ninclude/net/cfg80211.h:11110: * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the\ninclude/net/cfg80211.h-11111- *\tcfg80211_smd_get_ctx_pending list.\n--\ninclude/net/cfg80211.h-11120- */\ninclude/net/cfg80211.h:11121:void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\ninclude/net/cfg80211.h-11122-\t\t\t\t const u8 *addr);\n--\ninclude/net/cfg80211.h-11124-/**\ninclude/net/cfg80211.h:11125: * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211\ninclude/net/cfg80211.h-11126- * @wdev: wireless device that handled the request\n--\ninclude/net/cfg80211.h-11130- *\ninclude/net/cfg80211.h:11131: * Called via ieee80211_get_smd_ctx_done after async driver context collection\ninclude/net/cfg80211.h-11132- * completes. Finds the matching pending request and sends a multicast\n--\ninclude/net/cfg80211.h-11136- */\ninclude/net/cfg80211.h:11137:void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\ninclude/net/cfg80211.h-11138-\t\t\t const u8 *sta_addr,\n--\ninclude/net/mac80211.h=1714=enum mac80211_rx_encoding {\n--\ninclude/net/mac80211.h-1737- *\tOnly reported by devices that have timestamping enabled.\ninclude/net/mac80211.h:1738: * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information.\ninclude/net/mac80211.h-1739- *\tOnly needed for ST Preparation Request and ST Execution Request action\ninclude/net/mac80211.h-1740- *\tframes. The pointer will be consumed by mac80211; must be kmalloc-ed.\ninclude/net/mac80211.h:1741: *\tIndicated by @smd_ctx_valid.\ninclude/net/mac80211.h-1742- * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use\n--\ninclude/net/mac80211.h-1781- *\tcorrect link per vif.\ninclude/net/mac80211.h:1782: * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag\ninclude/net/mac80211.h-1783- *\tis used only for ST Preparation or ST Execution Request frames.\n--\ninclude/net/mac80211.h=1785=struct ieee80211_rx_status {\n--\ninclude/net/mac80211.h-1789-\t\tktime_t ack_tx_hwtstamp;\ninclude/net/mac80211.h:1790:\t\tstruct ieee80211_smd_ctx *smd_ctx;\ninclude/net/mac80211.h-1791-\t};\n--\ninclude/net/mac80211.h-1824-\tu8 link_id:4,\ninclude/net/mac80211.h:1825:\t smd_ctx_valid:1;\ninclude/net/mac80211.h-1826-};\n--\ninclude/net/mac80211.h=4113=enum ieee80211_sta_smd_state {\n--\ninclude/net/mac80211.h-4788- *\tThe callback can sleep.\ninclude/net/mac80211.h:4789: * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on\ninclude/net/mac80211.h-4790- *\tthe target AP MLD side to program dynamic context.\ninclude/net/mac80211.h:4791: * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in\ninclude/net/mac80211.h-4792- *\tthe current AP MLD side on behalf of the target AP MLD to collect\n--\ninclude/net/mac80211.h=4797=struct ieee80211_ops {\n--\ninclude/net/mac80211.h-5201-\t\t\t enum ieee80211_sta_smd_state new_state);\ninclude/net/mac80211.h:5202:\tint (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\ninclude/net/mac80211.h-5203-\t\t\t struct ieee80211_sta *sta,\ninclude/net/mac80211.h-5204-\t\t\t struct cfg80211_smd_transition_info *st_info);\ninclude/net/mac80211.h:5205:\tint (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\ninclude/net/mac80211.h-5206-\t\t\t struct ieee80211_sta *sta,\ninclude/net/mac80211.h:5207:\t\t\t enum nl80211_smd_ctx_type type);\ninclude/net/mac80211.h-5208-};\n--\ninclude/net/mac80211.h=8276=int ieee80211_encrypt_tx_skb(struct sk_buff *skb);\n--\ninclude/net/mac80211.h-8278-/**\ninclude/net/mac80211.h:8279: * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211\ninclude/net/mac80211.h-8280- * @vif: virtual interface\n--\ninclude/net/mac80211.h-8284- */\ninclude/net/mac80211.h:8285:void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\ninclude/net/mac80211.h-8286-\t\t\t\tconst u8 *sta_addr,\n--\ninclude/uapi/linux/nl80211.h=1445=enum nl80211_commands {\n--\ninclude/uapi/linux/nl80211.h-3232- *\tTransition data. Used with %NL80211_CMD_SET_SMD_CTX and\ninclude/uapi/linux/nl80211.h:3233: *\t%NL80211_CMD_SMD_CTX_EVENT. See \u0026enum nl80211_smd_ctx.\ninclude/uapi/linux/nl80211.h-3234- * @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context.\n--\ninclude/uapi/linux/nl80211.h=9273=enum nl80211_smd_params_attrs {\n--\ninclude/uapi/linux/nl80211.h-9288-/**\ninclude/uapi/linux/nl80211.h:9289: * enum nl80211_smd_ctx_type - SMD Request Type values\ninclude/uapi/linux/nl80211.h-9290- *\n--\ninclude/uapi/linux/nl80211.h-9297- */\ninclude/uapi/linux/nl80211.h:9298:enum nl80211_smd_ctx_type {\ninclude/uapi/linux/nl80211.h-9299-\tNL80211_SMD_CTX_TYPE_PREP,\n--\ninclude/uapi/linux/nl80211.h-9306-/**\ninclude/uapi/linux/nl80211.h:9307: * enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes\ninclude/uapi/linux/nl80211.h-9308- *\n--\ninclude/uapi/linux/nl80211.h-9325- */\ninclude/uapi/linux/nl80211.h:9326:enum nl80211_smd_ctx_ba_param {\ninclude/uapi/linux/nl80211.h-9327-\t__NL80211_SMD_CTX_BA_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9340-/**\ninclude/uapi/linux/nl80211.h:9341: * enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction\ninclude/uapi/linux/nl80211.h-9342- *\n--\ninclude/uapi/linux/nl80211.h-9349- * @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters,\ninclude/uapi/linux/nl80211.h:9350: *\tnested array of TIDs (uses \u0026enum nl80211_smd_ctx_ba_param).\ninclude/uapi/linux/nl80211.h-9351- * @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally.\n--\ninclude/uapi/linux/nl80211.h-9355- */\ninclude/uapi/linux/nl80211.h:9356:enum nl80211_smd_ctx_dl {\ninclude/uapi/linux/nl80211.h-9357-\t__NL80211_SMD_CTX_DL_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9367-/**\ninclude/uapi/linux/nl80211.h:9368: * enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction\ninclude/uapi/linux/nl80211.h-9369- *\n--\ninclude/uapi/linux/nl80211.h-9376- * @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters\ninclude/uapi/linux/nl80211.h:9377: *\t(uses \u0026enum nl80211_smd_ctx_ba_param).\ninclude/uapi/linux/nl80211.h-9378- * @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally.\n--\ninclude/uapi/linux/nl80211.h-9382- */\ninclude/uapi/linux/nl80211.h:9383:enum nl80211_smd_ctx_ul {\ninclude/uapi/linux/nl80211.h-9384-\t__NL80211_SMD_CTX_UL_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9394-/**\ninclude/uapi/linux/nl80211.h:9395: * enum nl80211_smd_ctx - SMD Context information\ninclude/uapi/linux/nl80211.h-9396- *\n--\ninclude/uapi/linux/nl80211.h-9404- * @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters.\ninclude/uapi/linux/nl80211.h:9405: *\tSee \u0026enum nl80211_smd_ctx_dl.\ninclude/uapi/linux/nl80211.h-9406- * @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters.\ninclude/uapi/linux/nl80211.h:9407: *\tSee \u0026enum nl80211_smd_ctx_ul.\ninclude/uapi/linux/nl80211.h-9408- * @NL80211_SMD_CTX_ATTR_DRV_DATA: Optional (binary) driver-specific blob.\n--\ninclude/uapi/linux/nl80211.h-9414- */\ninclude/uapi/linux/nl80211.h:9415:enum nl80211_smd_ctx {\ninclude/uapi/linux/nl80211.h-9416-\t__NL80211_SMD_CTX_ATTR_INVALID,\n--\nnet/mac80211/cfg.c=6073=ieee80211_set_peer_nan_sched(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-6083-\nnet/mac80211/cfg.c:6084:static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\nnet/mac80211/cfg.c-6085-\t\t\t\t const u8 *addr,\n--\nnet/mac80211/cfg.c-6105-\nnet/mac80211/cfg.c:6106:\treturn drv_set_smd_ctx(local, sdata, \u0026sta-\u003esta, st_info);\nnet/mac80211/cfg.c-6107-}\nnet/mac80211/cfg.c-6108-\nnet/mac80211/cfg.c:6109:static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\nnet/mac80211/cfg.c-6110-\t\t\t\t const u8 *addr,\nnet/mac80211/cfg.c:6111:\t\t\t\t enum nl80211_smd_ctx_type type)\nnet/mac80211/cfg.c-6112-{\n--\nnet/mac80211/cfg.c-6130-\nnet/mac80211/cfg.c:6131:\treturn drv_get_smd_ctx(local, sdata, \u0026sta-\u003esta, type);\nnet/mac80211/cfg.c-6132-}\nnet/mac80211/cfg.c-6133-\nnet/mac80211/cfg.c:6134:void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\nnet/mac80211/cfg.c-6135-\t\t\t\tconst u8 *sta_addr,\n--\nnet/mac80211/cfg.c-6139-\nnet/mac80211/cfg.c:6140:\tcfg80211_get_smd_ctx_done(\u0026sdata-\u003ewdev, sta_addr, st_info);\nnet/mac80211/cfg.c-6141-}\nnet/mac80211/cfg.c:6142:EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);\nnet/mac80211/cfg.c-6143-\nnet/mac80211/cfg.c=6144=const struct cfg80211_ops mac80211_config_ops = {\n--\nnet/mac80211/cfg.c-6261-\t.nan_set_peer_sched = ieee80211_set_peer_nan_sched,\nnet/mac80211/cfg.c:6262:\t.set_smd_ctx = ieee80211_set_smd_ctx,\nnet/mac80211/cfg.c:6263:\t.get_smd_ctx = ieee80211_get_smd_ctx,\nnet/mac80211/cfg.c-6264-};\n--\nnet/mac80211/driver-ops.h=1817=int drv_sta_smd_state(struct ieee80211_local *local,\n--\nnet/mac80211/driver-ops.h-1822-\nnet/mac80211/driver-ops.h:1823:static inline int drv_set_smd_ctx(struct ieee80211_local *local,\nnet/mac80211/driver-ops.h-1824-\t\t\t\t struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/driver-ops.h-1829-\nnet/mac80211/driver-ops.h:1830:\tif (!local-\u003eops-\u003eset_smd_ctx)\nnet/mac80211/driver-ops.h-1831-\t\treturn -EOPNOTSUPP;\n--\nnet/mac80211/driver-ops.h-1839-\nnet/mac80211/driver-ops.h:1840:\ttrace_drv_set_smd_ctx(local, sdata, sta, st_info);\nnet/mac80211/driver-ops.h:1841:\tret = local-\u003eops-\u003eset_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, st_info);\nnet/mac80211/driver-ops.h-1842-\ttrace_drv_return_int(local, ret);\n--\nnet/mac80211/driver-ops.h-1846-\nnet/mac80211/driver-ops.h:1847:static inline int drv_get_smd_ctx(struct ieee80211_local *local,\nnet/mac80211/driver-ops.h-1848-\t\t\t\t struct ieee80211_sub_if_data *sdata,\nnet/mac80211/driver-ops.h-1849-\t\t\t\t struct ieee80211_sta *sta,\nnet/mac80211/driver-ops.h:1850:\t\t\t\t enum nl80211_smd_ctx_type type)\nnet/mac80211/driver-ops.h-1851-{\n--\nnet/mac80211/driver-ops.h-1853-\nnet/mac80211/driver-ops.h:1854:\tif (!sdata || !local-\u003eops-\u003eget_smd_ctx)\nnet/mac80211/driver-ops.h-1855-\t\treturn -EOPNOTSUPP;\n--\nnet/mac80211/driver-ops.h-1863-\nnet/mac80211/driver-ops.h:1864:\ttrace_drv_get_smd_ctx(local, sdata, sta, type);\nnet/mac80211/driver-ops.h:1865:\tret = local-\u003eops-\u003eget_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, type);\nnet/mac80211/driver-ops.h-1866-\ttrace_drv_return_int(local, ret);\n--\nnet/mac80211/ieee80211_i.h=231=struct ieee80211_rx_data {\n--\nnet/mac80211/ieee80211_i.h-271-\nnet/mac80211/ieee80211_i.h:272:\tstruct ieee80211_smd_ctx *smd_ctx;\nnet/mac80211/ieee80211_i.h-273-};\n--\nnet/mac80211/rx.c=3974=ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,\n--\nnet/mac80211/rx.c-3979-\nnet/mac80211/rx.c:3980:\tif (!rx-\u003esmd_ctx)\nnet/mac80211/rx.c-3981-\t\treturn;\n--\nnet/mac80211/rx.c-3985-\tinfo-\u003est_info.type = type;\nnet/mac80211/rx.c:3986:\tinfo-\u003est_info.ctx = rx-\u003esmd_ctx;\nnet/mac80211/rx.c-3987-}\n--\nnet/mac80211/rx.c=5610=void ieee80211_rx_list(struct ieee80211_hw *hw,\n--\nnet/mac80211/rx.c-5618-\tstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-\u003edata;\nnet/mac80211/rx.c:5619:\tstruct ieee80211_smd_ctx *smd_ctx = NULL;\nnet/mac80211/rx.c-5620-\tstruct ieee80211_rx_data rx = {};\n--\nnet/mac80211/rx.c-5622-\t/* cache the pointer to free it later */\nnet/mac80211/rx.c:5623:\tif (status-\u003esmd_ctx_valid) {\nnet/mac80211/rx.c:5624:\t\tsmd_ctx = status-\u003esmd_ctx;\nnet/mac80211/rx.c:5625:\t\tstatus-\u003esmd_ctx = NULL;\nnet/mac80211/rx.c:5626:\t\tstatus-\u003esmd_ctx_valid = false;\nnet/mac80211/rx.c-5627-\t}\n--\nnet/mac80211/rx.c-5761-\nnet/mac80211/rx.c:5762:\trx.smd_ctx = smd_ctx;\nnet/mac80211/rx.c-5763-\nnet/mac80211/rx.c:5764:\tif (WARN_ONCE((status-\u003eflag \u0026 RX_FLAG_8023) \u0026\u0026 rx.smd_ctx,\nnet/mac80211/rx.c-5765-\t\t \"802.3 packet but with IEEE P802.11bn SMD context\"))\n--\nnet/mac80211/rx.c-5786-\t}\nnet/mac80211/rx.c:5787:\tkfree(smd_ctx);\nnet/mac80211/rx.c-5788-\n--\nnet/mac80211/rx.c-5791- drop:\nnet/mac80211/rx.c:5792:\tkfree(smd_ctx);\nnet/mac80211/rx.c-5793-\tkfree_skb(skb);\n--\nnet/mac80211/sta_info.c=1311=static int __must_check __sta_info_destroy_part1(struct sta_info *sta)\n--\nnet/mac80211/sta_info.c-1396-\t sdata-\u003evif.type == NL80211_IFTYPE_AP_VLAN)\nnet/mac80211/sta_info.c:1397:\t\tcfg80211_free_pending_smd_ctx_req(wdev, sta-\u003eaddr);\nnet/mac80211/sta_info.c-1398-\n--\nnet/mac80211/trace.h=3408=TRACE_EVENT(drv_sta_smd_state,\n--\nnet/mac80211/trace.h-3440-\nnet/mac80211/trace.h:3441:TRACE_EVENT(drv_set_smd_ctx,\nnet/mac80211/trace.h-3442-\tTP_PROTO(struct ieee80211_local *local,\n--\nnet/mac80211/trace.h-3461-\tTP_fast_assign(\nnet/mac80211/trace.h:3462:\t\tstruct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\nnet/mac80211/trace.h-3463-\t\tunsigned long sz;\n--\nnet/mac80211/trace.h-3489-\nnet/mac80211/trace.h:3490:TRACE_EVENT(drv_get_smd_ctx,\nnet/mac80211/trace.h-3491-\tTP_PROTO(struct ieee80211_local *local,\n--\nnet/mac80211/trace.h-3493-\t\t struct ieee80211_sta *sta,\nnet/mac80211/trace.h:3494:\t\t enum nl80211_smd_ctx_type type),\nnet/mac80211/trace.h-3495-\n--\nnet/wireless/core.c=1406=EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);\nnet/wireless/core.c-1407-\nnet/wireless/core.c:1408:void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\nnet/wireless/core.c-1409-\t\t\t\t const u8 *addr)\n--\nnet/wireless/core.c-1424-}\nnet/wireless/core.c:1425:EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req);\nnet/wireless/core.c-1426-\nnet/wireless/core.c=1427=static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,\n--\nnet/wireless/core.c-1500-\t wdev-\u003eiftype == NL80211_IFTYPE_AP_VLAN)\nnet/wireless/core.c:1501:\t\tcfg80211_free_pending_smd_ctx_req(wdev, NULL);\nnet/wireless/core.c-1502-\n--\nnet/wireless/mlme.c=1477=EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done);\nnet/wireless/mlme.c-1478-\nnet/wireless/mlme.c:1479:void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\nnet/wireless/mlme.c-1480-\t\t\t const u8 *sta_addr,\n--\nnet/wireless/mlme.c-1501-\nnet/wireless/mlme.c:1502:\tnl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info);\nnet/wireless/mlme.c-1503-\n--\nnet/wireless/mlme.c-1506-}\nnet/wireless/mlme.c:1507:EXPORT_SYMBOL(cfg80211_get_smd_ctx_done);\n--\nnet/wireless/nl80211.c=707=static const struct nla_policy\nnet/wireless/nl80211.c:708:nl80211_smd_ctx_ba_policy[NL80211_SMD_CTX_BA_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-709-\t[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },\n--\nnet/wireless/nl80211.c=718=static const struct nla_policy\nnet/wireless/nl80211.c:719:nl80211_smd_ctx_dl_policy[NL80211_SMD_CTX_DL_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-720-\t[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n--\nnet/wireless/nl80211.c-724-\t[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS] =\nnet/wireless/nl80211.c:725:\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\nnet/wireless/nl80211.c-726-};\n--\nnet/wireless/nl80211.c=728=static const struct nla_policy\nnet/wireless/nl80211.c:729:nl80211_smd_ctx_ul_policy[NL80211_SMD_CTX_UL_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-730-\t[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n--\nnet/wireless/nl80211.c-733-\t[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS] =\nnet/wireless/nl80211.c:734:\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\nnet/wireless/nl80211.c-735-};\n--\nnet/wireless/nl80211.c=737=static const struct nla_policy\nnet/wireless/nl80211.c:738:nl80211_smd_ctx_policy[NL80211_SMD_CTX_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-739-\t[NL80211_SMD_CTX_ATTR_DL] =\nnet/wireless/nl80211.c:740:\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_dl_policy),\nnet/wireless/nl80211.c-741-\t[NL80211_SMD_CTX_ATTR_UL] =\nnet/wireless/nl80211.c:742:\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_ul_policy),\nnet/wireless/nl80211.c-743-\t[NL80211_SMD_CTX_ATTR_DRV_DATA] =\n--\nnet/wireless/nl80211.c=757=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n--\nnet/wireless/nl80211.c-1162-\t[NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },\nnet/wireless/nl80211.c:1163:\t[NL80211_ATTR_SMD_CTX] = NLA_POLICY_NESTED(nl80211_smd_ctx_policy),\nnet/wireless/nl80211.c-1164-\t[NL80211_ATTR_SMD_CTX_TYPE] =\n--\nnet/wireless/nl80211.c=19562=nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-19580-\nnet/wireless/nl80211.c:19581:static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids)\nnet/wireless/nl80211.c-19582-{\n--\nnet/wireless/nl80211.c-19597-\nnet/wireless/nl80211.c:19598:size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info)\nnet/wireless/nl80211.c-19599-{\nnet/wireless/nl80211.c:19600:\tconst struct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\nnet/wireless/nl80211.c-19601-\tint n_dl_tids = 0, n_ul_tids = 0;\n--\nnet/wireless/nl80211.c-19629-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\nnet/wireless/nl80211.c:19630:\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids); /* DL BA */\nnet/wireless/nl80211.c-19631-\n--\nnet/wireless/nl80211.c-19647-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\nnet/wireless/nl80211.c:19648:\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids); /* UL BA */\nnet/wireless/nl80211.c-19649-\n--\nnet/wireless/nl80211.c=19656=static int\nnet/wireless/nl80211.c:19657:nl80211_put_smd_ctx_ba_params(struct sk_buff *msg,\nnet/wireless/nl80211.c-19658-\t\t\t const unsigned long *tid_bmap,\nnet/wireless/nl80211.c:19659:\t\t\t const struct ieee80211_smd_ctx_ba *ba_tids,\nnet/wireless/nl80211.c-19660-\t\t\t bool dl)\n--\nnet/wireless/nl80211.c-19673-\tfor_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) {\nnet/wireless/nl80211.c:19674:\t\tconst struct ieee80211_smd_ctx_ba *ba = \u0026ba_tids[tid];\nnet/wireless/nl80211.c-19675-\n--\nnet/wireless/nl80211.c-19709-\nnet/wireless/nl80211.c:19710:int nl80211_put_smd_ctx(struct sk_buff *msg,\nnet/wireless/nl80211.c-19711-\t\t\tstruct cfg80211_smd_transition_info *st_info)\n--\nnet/wireless/nl80211.c-19713-\tstruct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;\nnet/wireless/nl80211.c:19714:\tstruct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;\nnet/wireless/nl80211.c:19715:\tconst struct ieee80211_smd_ctx *ctx;\nnet/wireless/nl80211.c-19716-\tu8 dl_tid_bmap = 0, ul_tid_bmap = 0;\n--\nnet/wireless/nl80211.c-19723-\nnet/wireless/nl80211.c:19724:\tsmd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);\nnet/wireless/nl80211.c:19725:\tif (!smd_ctx)\nnet/wireless/nl80211.c-19726-\t\treturn -ENOBUFS;\n--\nnet/wireless/nl80211.c-19765-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\nnet/wireless/nl80211.c:19766:\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003edl.valid_tid_bmap,\nnet/wireless/nl80211.c-19767-\t\t\t\t\t ctx-\u003edl.ba, true))\n--\nnet/wireless/nl80211.c-19816-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\nnet/wireless/nl80211.c:19817:\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003eul.valid_tid_bmap,\nnet/wireless/nl80211.c-19818-\t\t\t\t\t ctx-\u003eul.ba, false))\n--\nnet/wireless/nl80211.c-19828-\nnet/wireless/nl80211.c:19829:\tnla_nest_end(msg, smd_ctx);\nnet/wireless/nl80211.c-19830-\n--\nnet/wireless/nl80211.c-19839-nla_fail:\nnet/wireless/nl80211.c:19840:\tnla_nest_cancel(msg, smd_ctx);\nnet/wireless/nl80211.c-19841-\treturn -EINVAL;\n--\nnet/wireless/nl80211.c=19844=static int\nnet/wireless/nl80211.c:19845:nl80211_parse_smd_ctx_ba_params(struct nlattr *tb,\nnet/wireless/nl80211.c:19846:\t\t\t\tstruct ieee80211_smd_ctx_ba *ba_tids,\nnet/wireless/nl80211.c-19847-\t\t\t\tunsigned long *valid_ctx_bmap)\n--\nnet/wireless/nl80211.c-19849-\tstruct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1];\nnet/wireless/nl80211.c:19850:\tstruct ieee80211_smd_ctx_ba *ba;\nnet/wireless/nl80211.c-19851-\tstruct nlattr *ba_attr;\n--\nnet/wireless/nl80211.c-19863-\t\tif (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX,\nnet/wireless/nl80211.c:19864:\t\t\t\t ba_attr, nl80211_smd_ctx_ba_policy,\nnet/wireless/nl80211.c-19865-\t\t\t\t NULL))\n--\nnet/wireless/nl80211.c-19905-\nnet/wireless/nl80211.c:19906:static int nl80211_parse_smd_ctx(struct genl_info *info,\nnet/wireless/nl80211.c-19907-\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n--\nnet/wireless/nl80211.c-19911-\tstruct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];\nnet/wireless/nl80211.c:19912:\tstruct ieee80211_smd_ctx *ctx;\nnet/wireless/nl80211.c-19913-\tstruct nlattr *bmap_attr;\n--\nnet/wireless/nl80211.c-19919-\t\t\t info-\u003eattrs[NL80211_ATTR_SMD_CTX],\nnet/wireless/nl80211.c:19920:\t\t\t nl80211_smd_ctx_policy, NULL)) {\nnet/wireless/nl80211.c-19921-\t\tGENL_SET_ERR_MSG(info, \"failed to parse SMD context\");\n--\nnet/wireless/nl80211.c-19939-\t\t\t\t tb[NL80211_SMD_CTX_ATTR_DL],\nnet/wireless/nl80211.c:19940:\t\t\t\t nl80211_smd_ctx_dl_policy, NULL)) {\nnet/wireless/nl80211.c-19941-\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse DL context\");\n--\nnet/wireless/nl80211.c-19999-\t\tif (ba_attr \u0026\u0026\nnet/wireless/nl80211.c:20000:\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003edl.ba,\nnet/wireless/nl80211.c-20001-\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n--\nnet/wireless/nl80211.c-20013-\t\t\t\t tb[NL80211_SMD_CTX_ATTR_UL],\nnet/wireless/nl80211.c:20014:\t\t\t\t nl80211_smd_ctx_ul_policy, NULL)) {\nnet/wireless/nl80211.c-20015-\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse UL context\");\n--\nnet/wireless/nl80211.c-20106-\t\tif (ba_attr \u0026\u0026\nnet/wireless/nl80211.c:20107:\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003eul.ba,\nnet/wireless/nl80211.c-20108-\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n--\nnet/wireless/nl80211.c=20401=static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-20471-\nnet/wireless/nl80211.c:20472:static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)\nnet/wireless/nl80211.c-20473-{\n--\nnet/wireless/nl80211.c-20480-\nnet/wireless/nl80211.c:20481:\tif (!rdev-\u003eops-\u003eset_smd_ctx)\nnet/wireless/nl80211.c-20482-\t\treturn -EOPNOTSUPP;\n--\nnet/wireless/nl80211.c-20496-\nnet/wireless/nl80211.c:20497:\terr = nl80211_parse_smd_ctx(info, \u0026st_info);\nnet/wireless/nl80211.c-20498-\tif (err)\n\n"
} |
| 11/2 | 2026/09/26 05:48 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 78924 output: 31 thoughts: 685 Thoughts: **Fuzzing Target Assessment: nl80211 and mac80211** Okay, let's break this down. My initial thought is to determine if this area is both reachable and worthwhile to fuzz. The criteria dictates that `WorthFuzzing` is true if the patch touches reachable, executable code, particularly core subsystems or those with clear fuzzer support. My initial reaction is positive. `net/wireless/nl80211.c` and `net/mac80211` are definitely reachable via generic netlink (`nl80211`), and Syzkaller has excellent support for nl80211, which gives a strong indication that this is fuzzer-friendly. We're talking virtual interfaces, netlink messages, station management (creating, setting, starting APs), and new commands. Now, looking deeper, the code itself screams potential. I see complex netlink parsing with dynamic memory allocation in functions like `nl80211_parse_smd_ctx` and related functions. This kind of complexity is always a fuzzer's friend. I also spot a state machine with WARN_ON assertions in functions like `sta_apply_smd_state_flags` and a variety of other `sta_info_*` related functions; these are ripe for fuzzing to uncover potential issues with state transitions, especially around the WARN_ON assertions. There is even a `WARN_ON(__sta_info_destroy(sta))` which looks juicy. Furthermore, there is asynchronous request tracking with linked lists and spinlocks and station destruction cleanup. This adds even more complexity, and more surfaces for potential race conditions or other concurrency issues that fuzzing can uncover. Based on this analysis of code, my immediate conclusion is that `WorthFuzzing = true`. The next step is to carefully check the configurations and associated symbols. I'll need to dig into the Kconfig files around `net/wireless` and `net/mac80211` to make sure we have the correct build options. |
| 12/2 | 2026/09/26 05:48 | tool | grepper |
0mArgs:{
"Expression": "config CFG80211",
"PathPrefix": "net/wireless"
}Results: {
"Output": "net/wireless/Kconfig=14=config WEXT_PRIV\n--\nnet/wireless/Kconfig-16-\nnet/wireless/Kconfig:17:config CFG80211\nnet/wireless/Kconfig-18-\ttristate \"cfg80211 - wireless configuration API\"\n--\nnet/wireless/Kconfig=38=config NL80211_TESTMODE\n--\nnet/wireless/Kconfig-51-\nnet/wireless/Kconfig:52:config CFG80211_DEVELOPER_WARNINGS\nnet/wireless/Kconfig-53-\tbool \"enable developer warnings\"\n--\nnet/wireless/Kconfig-67-\nnet/wireless/Kconfig:68:config CFG80211_CERTIFICATION_ONUS\nnet/wireless/Kconfig-69-\tbool \"cfg80211 certification onus\"\n--\nnet/wireless/Kconfig-88-\nnet/wireless/Kconfig:89:config CFG80211_REQUIRE_SIGNED_REGDB\nnet/wireless/Kconfig-90-\tbool \"require regdb signature\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-98-\nnet/wireless/Kconfig:99:config CFG80211_USE_KERNEL_REGDB_KEYS\nnet/wireless/Kconfig-100-\tbool \"allow regdb keys shipped with the kernel\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-110-\nnet/wireless/Kconfig:111:config CFG80211_EXTRA_REGDB_KEYDIR\nnet/wireless/Kconfig-112-\tstring \"additional regdb key directory\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-121-\nnet/wireless/Kconfig:122:config CFG80211_REG_CELLULAR_HINTS\nnet/wireless/Kconfig-123-\tbool \"cfg80211 regulatory support for cellular base station hints\"\n--\nnet/wireless/Kconfig-134-\nnet/wireless/Kconfig:135:config CFG80211_REG_RELAX_NO_IR\nnet/wireless/Kconfig-136-\tbool \"cfg80211 support for NO_IR relaxation\"\n--\nnet/wireless/Kconfig-158-\nnet/wireless/Kconfig:159:config CFG80211_DEFAULT_PS\nnet/wireless/Kconfig-160-\tbool \"enable powersave by default\"\n--\nnet/wireless/Kconfig-168-\nnet/wireless/Kconfig:169:config CFG80211_DEBUGFS\nnet/wireless/Kconfig-170-\tbool \"cfg80211 DebugFS entries\"\n--\nnet/wireless/Kconfig-176-\nnet/wireless/Kconfig:177:config CFG80211_CRDA_SUPPORT\nnet/wireless/Kconfig-178-\tbool \"support CRDA\" if EXPERT\n--\nnet/wireless/Kconfig-186-\nnet/wireless/Kconfig:187:config CFG80211_WEXT\nnet/wireless/Kconfig-188-\tbool \"cfg80211 wireless extensions compatibility\"\n--\nnet/wireless/Kconfig-193-\nnet/wireless/Kconfig:194:config CFG80211_KUNIT_TEST\nnet/wireless/Kconfig-195-\ttristate \"KUnit tests for cfg80211\" if !KUNIT_ALL_TESTS\n"
} |
| 13/2 | 2026/09/26 05:48 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 80997 output: 35 thoughts: 17 Thoughts: Here's a summary of my thought process, as requested: **Diving into `net/mac80211/Kconfig`** Okay, time to get started. My first instinct is to dive into the `net/mac80211/Kconfig` file. Given my expertise, I know this is where the core configuration options related to the mac80211 subsystem are defined. I expect to find the settings that govern driver inclusion, feature enable/disable switches, and potentially some default values for parameters related to wireless networking. My hope is to quickly identify the relevant configuration option(s) that are causing me issues. From experience, this is usually the best first step in understanding and potentially troubleshooting the current setup. I'll need to remember to pay close attention to any dependencies and default values declared there. This gives me a high level starting point from which to work. |
| 14/2 | 2026/09/26 05:48 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211",
"PathPrefix": "net/mac80211"
}Results: {
"Output": "net/mac80211/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nnet/mac80211/Kconfig:2:config MAC80211\nnet/mac80211/Kconfig-3-\ttristate \"Generic IEEE 802.11 Networking Stack (mac80211)\"\n--\nnet/mac80211/Kconfig=19=if MAC80211 != n\nnet/mac80211/Kconfig-20-\nnet/mac80211/Kconfig:21:config MAC80211_HAS_RC\nnet/mac80211/Kconfig-22-\tbool\nnet/mac80211/Kconfig-23-\nnet/mac80211/Kconfig:24:config MAC80211_RC_MINSTREL\nnet/mac80211/Kconfig-25-\tbool \"Minstrel\" if EXPERT\n--\nnet/mac80211/Kconfig=31=choice\n--\nnet/mac80211/Kconfig-40-\nnet/mac80211/Kconfig:41:config MAC80211_RC_DEFAULT_MINSTREL\nnet/mac80211/Kconfig-42-\tbool \"Minstrel\"\n--\nnet/mac80211/Kconfig=48=endchoice\nnet/mac80211/Kconfig-49-\nnet/mac80211/Kconfig:50:config MAC80211_RC_DEFAULT\nnet/mac80211/Kconfig-51-\tstring\n--\nnet/mac80211/Kconfig=57=comment \"Some wireless drivers require a rate control algorithm\"\n--\nnet/mac80211/Kconfig-59-\nnet/mac80211/Kconfig:60:config MAC80211_KUNIT_TEST\nnet/mac80211/Kconfig-61-\ttristate \"KUnit tests for mac80211\" if !KUNIT_ALL_TESTS\n--\nnet/mac80211/Kconfig-69-\nnet/mac80211/Kconfig:70:config MAC80211_MESH\nnet/mac80211/Kconfig-71-\tbool \"Enable mac80211 mesh networking support\"\n--\nnet/mac80211/Kconfig-78-\nnet/mac80211/Kconfig:79:config MAC80211_LEDS\nnet/mac80211/Kconfig-80-\tbool \"Enable LED triggers\"\n--\nnet/mac80211/Kconfig-87-\nnet/mac80211/Kconfig:88:config MAC80211_DEBUGFS\nnet/mac80211/Kconfig-89-\tbool \"Export mac80211 internals in DebugFS\"\n--\nnet/mac80211/Kconfig-96-\nnet/mac80211/Kconfig:97:config MAC80211_MESSAGE_TRACING\nnet/mac80211/Kconfig-98-\tbool \"Trace all mac80211 debug messages\"\n--\nnet/mac80211/Kconfig-109-\nnet/mac80211/Kconfig:110:menuconfig MAC80211_DEBUG_MENU\nnet/mac80211/Kconfig-111-\tbool \"Select mac80211 debugging features\"\n--\nnet/mac80211/Kconfig-115-\nnet/mac80211/Kconfig:116:config MAC80211_NOINLINE\nnet/mac80211/Kconfig-117-\tbool \"Do not inline TX/RX handlers\"\n--\nnet/mac80211/Kconfig-131-\nnet/mac80211/Kconfig:132:config MAC80211_VERBOSE_DEBUG\nnet/mac80211/Kconfig-133-\tbool \"Verbose debugging output\"\n--\nnet/mac80211/Kconfig-142-\nnet/mac80211/Kconfig:143:config MAC80211_MLME_DEBUG\nnet/mac80211/Kconfig-144-\tbool \"Verbose managed MLME output\"\n--\nnet/mac80211/Kconfig-153-\nnet/mac80211/Kconfig:154:config MAC80211_STA_DEBUG\nnet/mac80211/Kconfig-155-\tbool \"Verbose station debugging\"\n--\nnet/mac80211/Kconfig-162-\nnet/mac80211/Kconfig:163:config MAC80211_HT_DEBUG\nnet/mac80211/Kconfig-164-\tbool \"Verbose HT debugging\"\n--\nnet/mac80211/Kconfig-174-\nnet/mac80211/Kconfig:175:config MAC80211_OCB_DEBUG\nnet/mac80211/Kconfig-176-\tbool \"Verbose OCB debugging\"\n--\nnet/mac80211/Kconfig-185-\nnet/mac80211/Kconfig:186:config MAC80211_IBSS_DEBUG\nnet/mac80211/Kconfig-187-\tbool \"Verbose IBSS debugging\"\n--\nnet/mac80211/Kconfig-196-\nnet/mac80211/Kconfig:197:config MAC80211_PS_DEBUG\nnet/mac80211/Kconfig-198-\tbool \"Verbose powersave mode debugging\"\n--\nnet/mac80211/Kconfig-208-\nnet/mac80211/Kconfig:209:config MAC80211_MPL_DEBUG\nnet/mac80211/Kconfig-210-\tbool \"Verbose mesh peer link debugging\"\n--\nnet/mac80211/Kconfig-221-\nnet/mac80211/Kconfig:222:config MAC80211_MPATH_DEBUG\nnet/mac80211/Kconfig-223-\tbool \"Verbose mesh path debugging\"\n--\nnet/mac80211/Kconfig-234-\nnet/mac80211/Kconfig:235:config MAC80211_MHWMP_DEBUG\nnet/mac80211/Kconfig-236-\tbool \"Verbose mesh HWMP routing debugging\"\n--\nnet/mac80211/Kconfig-247-\nnet/mac80211/Kconfig:248:config MAC80211_MESH_SYNC_DEBUG\nnet/mac80211/Kconfig-249-\tbool \"Verbose mesh synchronization debugging\"\n--\nnet/mac80211/Kconfig-258-\nnet/mac80211/Kconfig:259:config MAC80211_MESH_CSA_DEBUG\nnet/mac80211/Kconfig-260-\tbool \"Verbose mesh channel switch debugging\"\n--\nnet/mac80211/Kconfig-269-\nnet/mac80211/Kconfig:270:config MAC80211_MESH_PS_DEBUG\nnet/mac80211/Kconfig-271-\tbool \"Verbose mesh powersave debugging\"\n--\nnet/mac80211/Kconfig-280-\nnet/mac80211/Kconfig:281:config MAC80211_TDLS_DEBUG\nnet/mac80211/Kconfig-282-\tbool \"Verbose TDLS debugging\"\n--\nnet/mac80211/Kconfig-292-\nnet/mac80211/Kconfig:293:config MAC80211_DEBUG_COUNTERS\nnet/mac80211/Kconfig-294-\tbool \"Extra statistics for TX/RX debugging\"\n--\nnet/mac80211/Kconfig-307-\nnet/mac80211/Kconfig:308:config MAC80211_STA_HASH_MAX_SIZE\nnet/mac80211/Kconfig-309-\tint \"Station hash table maximum size\" if MAC80211_DEBUG_MENU\n"
} |
| 15/2 | 2026/09/26 05:48 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 83419 output: 25 thoughts: 24 Thoughts: Here's my take on the thought process, tailored for an expert audience and written in the first person: **Investigating MAC80211_HWSIM Configuration** Okay, so I'm thinking about `MAC80211_HWSIM`. I need to figure out the specifics of this – how and where it's configured in the kernel. I can't just assume it's set up in a particular place, I need to trace its origin and dependencies to truly understand its role. Time to dig into the relevant configuration files and code to see where this module is being defined, any dependencies it might have, and what implications that has for build configurations. Let's see what the Kconfig files reveal. |
| 16/2 | 2026/09/26 05:48 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211_HWSIM"
}Results: {
"Output": "drivers/net/wireless/virtual/Kconfig:1:config MAC80211_HWSIM\ndrivers/net/wireless/virtual/Kconfig-2-\ttristate \"Simulated radio testing tool for mac80211\"\n"
} |
| 17/2 | 2026/09/26 05:48 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 83693 output: 372 thoughts: 2915 Thoughts: **Analysis of SMD Feature Implementation for Fuzzing** Alright, let's break this down. First, I need to confirm the relevant kernel configs. `CFG80211`, `MAC80211`, and `MAC80211_HWSIM` seem like the obvious candidates, and `NL80211_TESTMODE` might be useful, but is optional. I'll also keep `NETDEVICES` and `WLAN` in mind as base requirements. `CFG80211` and `MAC80211` are fundamental, as expected, and `MAC80211_HWSIM` is essential for testing. Now, let's dig into the dependencies of `CFG80211`. The Kconfig entry shows that it's reliant on `RFKILL || !RFKILL`, that's standard and not a concern. Next, I need to pinpoint the kernel symbols that are modified or added as part of this patch that introduces the SMD feature. This will involve a review of the code changes, specifically functions, to determine which are specific to the new logic. I'll examine the functions in `net/wireless/nl80211.c`: I see several static helper functions for parsing and putting SMD context, which would normally be excluded, but some of the functions such as `nl80211_set_smd_ctx` and `nl80211_get_smd_ctx` have a distinct role and are not inlined due to the use of function pointers. Also, there are the modified functions: `nl80211_send_mgmt`, `nl80211_start_ap`, `nl80211_set_station`, `nl80211_new_station`. Then, functions were modified in `net/wireless/core.c`: `cfg80211_init_wdev`, and `_cfg80211_unregister_wdev`, and the added function `cfg80211_free_pending_smd_ctx_req`. The modified function in `net/wireless/mlme.c` is: `cfg80211_get_smd_ctx_done`. In `net/mac80211/cfg.c`, modified functions are: `ieee80211_start_ap`, `sta_apply_parameters`, `ieee80211_add_station`, and added functions: `ieee80211_set_smd_ctx`, `ieee80211_get_smd_ctx`, and `ieee80211_get_smd_ctx_done`, and function `sta_apply_smd_state_flags`. Also in `net/mac80211` several new functions are added and modified as part of state transitions: `sta_info_move_smd_state`, `sta_info_reset_smd_state`, `sta_info_move_drv_smd_state`, `drv_sta_smd_state`, and modified functions: `__sta_info_destroy_part1` and `_sta_info_move_state`, and `__ieee80211_start_rx_ba_session`. Now, the trick is to identify the non-static functions, along with any static functions that are not inlined and are critical to the SMD logic. I need to make sure I don't select ubiquitous helper functions. Looking at the non-static symbols, plus static functions with function addresses in the symbol table, it looks like: * `nl80211_set_smd_ctx` * `nl80211_get_smd_ctx` * `nl80211_parse_smd_ctx` * `nl80211_put_smd_ctx` * `cfg80211_free_pending_smd_ctx_req` * `cfg80211_get_smd_ctx_done` * `sta_info_move_smd_state` * `sta_info_reset_smd_state` * `sta_info_move_drv_smd_state` * `drv_sta_smd_state` Checking, especially for `nl80211_set_smd_ctx`, I confirm that function pointers in `nl80211_small_ops` |
| 18/2 | 2026/09/26 05:48 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_set_smd_ctx",
"nl80211_get_smd_ctx",
"nl80211_parse_smd_ctx",
"nl80211_put_smd_ctx",
"cfg80211_free_pending_smd_ctx_req",
"cfg80211_get_smd_ctx_done",
"sta_info_move_smd_state",
"sta_info_reset_smd_state",
"sta_info_move_drv_smd_state",
"drv_sta_smd_state"
],
"Reasoning": "The patch series adds support for IEEE 802.11bn Ultra High Reliability (UHR) Seamless Mobility Domain (SMD) BSS Transition to cfg80211 and mac80211. It introduces new user-accessible netlink commands (NL80211_CMD_SET_SMD_CTX and NL80211_CMD_GET_SMD_CTX), complex nested netlink attribute parsing and serialization routines, SMD station state machine management with multiple WARN_ON checks, and asynchronous pending request tracking. These paths are reachable from userspace via nl80211 and emulated wireless devices like mac80211_hwsim, making them well-suited for fuzzing.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_set_smd_ctx",
"nl80211_get_smd_ctx",
"nl80211_parse_smd_ctx",
"nl80211_put_smd_ctx",
"cfg80211_free_pending_smd_ctx_req",
"cfg80211_get_smd_ctx_done",
"sta_info_move_smd_state",
"sta_info_reset_smd_state",
"sta_info_move_drv_smd_state",
"drv_sta_smd_state"
],
"Reasoning": "The patch series adds support for IEEE 802.11bn Ultra High Reliability (UHR) Seamless Mobility Domain (SMD) BSS Transition to cfg80211 and mac80211. It introduces new user-accessible netlink commands (NL80211_CMD_SET_SMD_CTX and NL80211_CMD_GET_SMD_CTX), complex nested netlink attribute parsing and serialization routines, SMD station state machine management with multiple WARN_ON checks, and asynchronous pending request tracking. These paths are reachable from userspace via nl80211 and emulated wireless devices like mac80211_hwsim, making them well-suited for fuzzing.",
"WorthFuzzing": true
} |
| 19/1 | 2026/09/26 05:48 | action | If |
3mArgs:{
"WorthFuzzing": true
}Results: null |
| 20/2 | 2026/09/26 05:48 | agent | kmsan-evaluator |
3mModel:core Args: null Results: {
"KMSANReasoning": "The patch series introduces support for IEEE 802.11bn / UHR Seamless Mobility Domain (SMD) and BSS Transition procedures into cfg80211, mac80211, and nl80211.\n\nA careful examination of KMSAN vs KASAN applicability reveals:\n1. Heap Allocations:\n - `struct ieee80211_smd_ctx` in `nl80211_parse_smd_ctx()` is allocated using `kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL)`.\n - `struct cfg80211_smd_get_ctx_pending` in `nl80211_get_smd_ctx()` is allocated using `kzalloc_obj(*pending)`.\n - `struct sta_info` instances are allocated via `kzalloc()` in mac80211.\n All heap-allocated structures are fully zeroed upon allocation.\n\n2. Stack Variables:\n - Stack-allocated `struct cfg80211_rx_info info` instances across all callsites (`cfg80211_rx_mgmt_khz()`, `cfg80211_rx_mgmt()`, and `ieee80211_rx_h_userspace_mgmt()`) use C99 designated initializers (e.g. `= { .st_info.ctx = NULL }`), which zero out all unmentioned members.\n - Stack-allocated `struct ieee80211_rx_data rx = {}` in `ieee80211_rx_list()` is zero-initialized.\n - Stack-allocated `struct station_parameters params` in `nl80211_set_station()` and `nl80211_new_station()` are cleared using `memset(\u0026params, 0, sizeof(params))`.\n - In virtual/hardware drivers (e.g. `mac80211_hwsim`), `struct ieee80211_rx_status` instances are initialized using `memset(\u0026rx_status, 0, sizeof(rx_status))`, ensuring `smd_ctx_valid` is 0.\n\n3. Kernel-to-Userspace Data Transfer:\n - In `nl80211_put_smd_ctx()`, attributes are serialized to netlink messages exclusively using individual scalar helpers (`nla_put_u8()`, `nla_put_u16()`) or sized binary attributes with known payload length (`nla_put(..., ctx-\u003epn_len, ...)`). No raw kernel structs with uninitialized padding or hole bytes are copied to user space.\n\n4. Other Potential Bugs:\n - Any risks in this patch series involve potential locking issues (protected by `smd_get_ctx_lock` and wiphy mutex, covered by LOCKDEP) or pointer/buffer handling (covered by KASAN).\n\nBecause no uninitialized memory reads or information leak risks are introduced or exposed, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 5cfe055d5f8b97d7088e07d7da2a7f059bc02d0d
Author: syz-cluster <triage@syzkaller.com>
Date: Sat Sep 26 05:47:17 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/ieee80211-uhr.h b/include/linux/ieee80211-uhr.h
index 19e9260d0db80..e74de842b281d 100644
--- a/include/linux/ieee80211-uhr.h
+++ b/include/linux/ieee80211-uhr.h
@@ -589,6 +589,10 @@ ieee80211_uhr_dbe_cap(const struct ieee80211_uhr_cap *cap)
#define IEEE80211_SMD_INFO_CAPA_TYPE 0x10
#define IEEE80211_SMD_INFO_CAPA_PTK_PER_AP_MLD 0x20
+/* IEEE P802.11bn/D2.0, Aug 2026, subclause 9.4.2.363 */
+#define IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN 2 /* in 64 TUs */
+#define IEEE80211_SMD_INFO_NUM_PREP_AP_MAX 7
+
struct ieee80211_smd_info {
u8 id[ETH_ALEN];
u8 capa;
@@ -645,6 +649,92 @@ struct ieee80211_uhr_mode_change_tuple {
u8 variable[];
} __packed;
+/*
+ * Context information carried in SMD BSS Transition (refer IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 37.16.9.
+ */
+#define IEEE80211_SMD_CTX_NUM_VALID_CTX 8
+
+#define IEEE80211_SMD_CTX_VALID_DL_SN 0
+#define IEEE80211_SMD_CTX_VALID_UL_SN 1
+#define IEEE80211_SMD_CTX_VALID_PN 2
+#define IEEE80211_SMD_CTX_VALID_BA_PARAMS 3
+/* Positions 4 to 7 are reserved */
+
+/*
+ * Data TIDs transported in the context, IEEE P802.11bn/D2.0, Aug 2026,
+ * subclause 9.4.2.364.
+ */
+#define IEEE80211_SMD_CTX_NUM_TIDS 8
+
+#define IEEE80211_SMD_CTX_MAX_PN_LEN 16
+
+/**
+ * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL
+ *
+ * @amsdu_supported: Peer's capability to support A-MSDU within A-MPDU.
+ * @ba_policy: BlockAck policy (0 = delayed BlockAck, 1 = immediate BlockAck)
+ * @buffer_size: Reorder buffer size from ADDBA Request (10-bit, max 1023)
+ * @timeout: BlockAck session timeout
+ * @ext_no_frag: ADDBA Extension fragmentation support
+ * @extfrag_level: ADDBA Extension HE fragmentation level
+ * @ext_buffer_size: ADDBA Extension buffer size; combined with @buffer_size as
+ * (@ext_buffer_size << 10 | @buffer_size) to get the full reorder
+ * buffer size
+ */
+struct ieee80211_smd_ctx_ba {
+ bool amsdu_supported;
+ u8 ba_policy;
+ u16 buffer_size;
+ u16 timeout;
+ bool ext_no_frag;
+ u8 extfrag_level;
+ u16 ext_buffer_size;
+};
+
+/**
+ * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)
+ *
+ * @valid_ctx_bmap: Bitmap indicating which context fields are valid;
+ * bit positions defined by IEEE80211_SMD_CTX_VALID_* constants
+ * @pn_len: Length of PN in bytes; varies by cipher type
+ * (e.g. CCMP (6), GCMP-256 (16))
+ * @dl: Down-link context data
+ * @dl.valid_tid_bmap: valid DL TIDs for which context is present
+ * @dl.sn: DL SN per-TID to be assigned next
+ * @dl.pn: DL PN to be assigned next
+ * @dl.ba: DL BlockAck parameters per-TID for the BlockAck session
+ * @ul: Up-link context data
+ * @ul.valid_tid_bmap: valid UL TIDs for which context is present
+ * @ul.sn: UL SN per-TID to be checked next
+ * @ul.pn: UL PN per-TID to be checked next
+ * @ul.ba: UL BlockAck parameters per-TID for the BlockAck session
+ * @drv_ctx_size: Number of valid bytes in @drv_ctx.
+ * @drv_ctx: Variable-sized array of driver-specific context, counted by
+ * @drv_ctx_size. Opaque to the wireless core; interpreted by drivers.
+ */
+struct ieee80211_smd_ctx {
+ DECLARE_BITMAP(valid_ctx_bmap, IEEE80211_SMD_CTX_NUM_VALID_CTX);
+ u8 pn_len;
+
+ struct {
+ DECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);
+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN];
+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];
+ } dl;
+ struct {
+ DECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);
+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN];
+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];
+ } ul;
+
+ size_t drv_ctx_size;
+ u8 drv_ctx[] ____cacheline_aligned __counted_by(drv_ctx_size);
+};
+
static inline int
ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tuple *tuple)
{
@@ -653,6 +743,65 @@ ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tupl
IEEE80211_UHR_MODE_CHANGE_CONTROL_MODE_LENGTH);
}
+/**
+ * ieee80211_is_uhr_link_reconf_req - check if frame is UHR Link Reconf Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is a UHR Link Reconf Request frame
+ */
+static inline bool ieee80211_is_uhr_link_reconf_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 category, action;
+
+ if (!ieee80211_is_action(mgmt->frame_control))
+ return false;
+
+ if (skb->len < IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))
+ return false;
+
+ category = mgmt->u.action.category;
+ action = mgmt->u.action.action_code;
+
+ return category == WLAN_CATEGORY_PROTECTED_UHR &&
+ action == IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_REQUEST;
+}
+
+/**
+ * ieee80211_is_st_prep_req - check if frame is ST Preparation Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Prep request frame
+ */
+static inline bool ieee80211_is_st_prep_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_PREP;
+}
+
+/**
+ * ieee80211_is_st_exec_req - check if frame is ST Execution Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Exec request frame
+ */
+static inline bool ieee80211_is_st_exec_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC;
+}
+
#define for_each_uhr_mode_change_tuple(data, len, tuple) \
for (tuple = (const void *)(data); \
(len) - ((const u8 *)tuple - (data)) >= sizeof(*tuple) && \
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9aa7d2d4a1841..71711dbbf7495 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1587,6 +1587,29 @@ struct cfg80211_s1g_short_beacon {
size_t short_tail_len;
};
+/**
+ * struct cfg80211_smd_params - Seamless Mobility Domain parameters
+ *
+ * @smd_enabled: SMD is enabled on this device
+ * @smd_identifier: SMD ID (ETH_ALEN bytes)
+ * @smd_timeout: timeout in 64 TUs for ST Preparation
+ * @dl_data_fwd: MSDU forwarding supported
+ * @max_num_of_peer_apmlds: max prepared AP MLDs supported (0-7)
+ * @smd_type: SMD type
+ * @ptk_mode: PTK mode
+ * @neighbor_probing: UHR Neighboring AP Probing supported
+ */
+struct cfg80211_smd_params {
+ bool smd_enabled;
+ u8 smd_identifier[ETH_ALEN];
+ u16 smd_timeout;
+ bool dl_data_fwd;
+ u8 max_num_of_peer_apmlds;
+ enum nl80211_smd_type smd_type;
+ enum nl80211_smd_ptk_mode ptk_mode;
+ bool neighbor_probing;
+};
+
/**
* struct cfg80211_ap_settings - AP configuration
*
@@ -1623,6 +1646,7 @@ struct cfg80211_s1g_short_beacon {
* @mbssid_config: AP settings for multiple bssid
* @s1g_long_beacon_period: S1G long beacon period
* @s1g_short_beacon: S1G short beacon data
+ * @smd_params: Seamless Mobility Domain (SMD) parameters
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
@@ -1655,6 +1679,7 @@ struct cfg80211_ap_settings {
struct cfg80211_mbssid_config mbssid_config;
u8 s1g_long_beacon_period;
struct cfg80211_s1g_short_beacon s1g_short_beacon;
+ struct cfg80211_smd_params smd_params;
};
@@ -1872,6 +1897,21 @@ struct cfg80211_ttlm_params {
u16 ulink[8];
};
+/**
+ * struct cfg80211_sta_smd_params - SMD parameters for an added station
+ *
+ * @smd_sta: SMD-negotiated STA
+ * @smd_identifier: SMD Identifier
+ * @dl_data_fwd: MSDU forwarding supported
+ * @roam_sta: station was created via SMD BSS Transition procedure
+ */
+struct cfg80211_sta_smd_params {
+ bool smd_sta;
+ u8 smd_identifier[ETH_ALEN];
+ bool dl_data_fwd;
+ bool roam_sta;
+};
+
/**
* struct station_parameters - station parameters
*
@@ -1912,6 +1952,7 @@ struct cfg80211_ttlm_params {
* @link_sta_params: link related params.
* @epp_peer: EPP peer indication
* @nmi_mac: MAC address of the NMI station of the NAN peer
+ * @smd_params: SMD params for this station
*/
struct station_parameters {
struct net_device *vlan;
@@ -1940,6 +1981,7 @@ struct station_parameters {
struct link_station_parameters link_sta_params;
bool epp_peer;
const u8 *nmi_mac;
+ struct cfg80211_sta_smd_params smd_params;
};
/**
@@ -4847,6 +4889,27 @@ struct mgmt_frame_regs {
u32 global_mcast_stypes, interface_mcast_stypes;
};
+/**
+ * struct cfg80211_smd_transition_info - SMD BSS Transition info
+ *
+ * @ctx: Dynamic context to be transferred as part of ST
+ * @type: Type of ST indication
+ */
+struct cfg80211_smd_transition_info {
+ struct ieee80211_smd_ctx *ctx;
+ enum nl80211_smd_ctx_type type;
+};
+
+/**
+ * struct cfg80211_smd_get_ctx_pending - pending async GET_SMD_CTX request
+ * @list: linkage on wireless_dev::smd_get_ctx_pending_list
+ * @sta_addr: non-AP MLD address for which context was requested
+ */
+struct cfg80211_smd_get_ctx_pending {
+ struct list_head list;
+ u8 sta_addr[ETH_ALEN];
+};
+
/**
* struct cfg80211_ops - backend description for wireless configuration
*
@@ -5278,6 +5341,12 @@ struct mgmt_frame_regs {
*
* @start_pd: Start the PD interface.
* @stop_pd: Stop the PD interface.
+ *
+ * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info->ctx is
+ * freed immediately after this call returns; drivers must copy
+ * @st_info->ctx if asynchronous processing is required.
+ *
+ * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5656,6 +5725,12 @@ struct cfg80211_ops {
bool val);
int (*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
void (*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
+ int (*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info);
+ int (*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ enum nl80211_smd_ctx_type type);
};
/*
@@ -7228,6 +7303,8 @@ enum ieee80211_ap_reg_power {
* @links.cac_time_ms: CAC time in ms
* @valid_links: bitmap describing what elements of @links are valid
* @radio_mask: Bitmask of radios that this interface is allowed to operate on.
+ * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests.
+ * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests.
*/
struct wireless_dev {
struct wiphy *wiphy;
@@ -7347,6 +7424,10 @@ struct wireless_dev {
} links[IEEE80211_MLD_MAX_NUM_LINKS];
u16 valid_links;
+ /* protects @smd_get_ctx_pending_list */
+ spinlock_t smd_get_ctx_lock;
+ struct list_head smd_get_ctx_pending_list;
+
u32 radio_mask;
};
@@ -9504,6 +9585,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
* @no_sta: set if no station is known for the frame (relevant for MLD)
+ * @st_info: SMD BSS Transition data
*/
struct cfg80211_rx_info {
int freq;
@@ -9516,6 +9598,7 @@ struct cfg80211_rx_info {
u64 rx_tstamp;
u64 ack_tstamp;
bool no_sta;
+ struct cfg80211_smd_transition_info st_info;
};
/**
@@ -11023,4 +11106,36 @@ void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,
u32 signal_interference_bitmap,
gfp_t gfp);
+/**
+ * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the
+ * cfg80211_smd_get_ctx_pending list.
+ * @wdev: wdev that maintains the list
+ * @addr: if @addr is NULL, drain the entire list; otherwise, drain only the
+ * matching entries
+ *
+ * When the current AP MLD requests the station's context, those requests are
+ * maintained in a pending list until drivers notify completion. In case the
+ * device is brought down or the station is removed prematurely, free up the
+ * remaining entries in the list.
+ */
+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,
+ const u8 *addr);
+
+/**
+ * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211
+ * @wdev: wireless device that handled the request
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ *
+ * Called via ieee80211_get_smd_ctx_done after async driver context collection
+ * completes. Finds the matching pending request and sends a multicast
+ * %NL80211_CMD_SMD_CTX_EVENT reply to userspace (MLME group).
+ *
+ * Return: None
+ */
+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_CFG80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1172d7b83ed18..6a26823799d45 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -797,6 +797,7 @@ struct ieee80211_bss_npca_params {
* @s1g_long_beacon_period: number of beacon intervals between each long
* beacon transmission.
* @npca: NPCA parameters
+ * @smd_params: SMD parameters
*/
struct ieee80211_bss_conf {
struct ieee80211_vif *vif;
@@ -904,6 +905,7 @@ struct ieee80211_bss_conf {
u8 s1g_long_beacon_period;
struct ieee80211_bss_npca_params npca;
+ struct cfg80211_smd_params smd_params;
};
#define IEEE80211_NAN_MAX_CHANNELS 3
@@ -1733,6 +1735,10 @@ enum mac80211_rx_encoding {
* @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only
* needed for Timing measurement and Fine timing measurement action frames.
* Only reported by devices that have timestamping enabled.
+ * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information.
+ * Only needed for ST Preparation Request and ST Execution Request action
+ * frames. The pointer will be consumed by mac80211; must be kmalloc-ed.
+ * Indicated by @smd_ctx_valid.
* @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
* it but can store it and pass it back to the driver for synchronisation
* @band: the active band when this frame was received
@@ -1773,12 +1779,15 @@ enum mac80211_rx_encoding {
* @link_id: id of the link used to receive the packet. Set and used by
* mac80211 internally, it uses @freq set by the driver to identify the
* correct link per vif.
+ * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag
+ * is used only for ST Preparation or ST Execution Request frames.
*/
struct ieee80211_rx_status {
u64 mactime;
union {
u64 boottime_ns;
ktime_t ack_tx_hwtstamp;
+ struct ieee80211_smd_ctx *smd_ctx;
};
u32 device_timestamp;
u32 ampdu_reference;
@@ -1812,7 +1821,8 @@ struct ieee80211_rx_status {
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
u8 zero_length_psdu_type;
- u8 link_id:4;
+ u8 link_id:4,
+ smd_ctx_valid:1;
};
static_assert(sizeof(struct ieee80211_rx_status) <= sizeof_field(struct sk_buff, cb));
@@ -2724,6 +2734,7 @@ struct ieee80211_link_sta {
* @nan_sched: NAN peer schedule for this station. Valid only for NMI stations.
* @ext_mld_capa_ops: the MLD's extended MLD capabilities and operations
* NOTE: currently only tracked for AP STAs
+ * @smd_params: SMD parameters of the STA
*/
struct ieee80211_sta {
u8 addr[ETH_ALEN] __aligned(2);
@@ -2758,6 +2769,8 @@ struct ieee80211_sta {
/* should only be accessed with the wiphy mutex held */
struct ieee80211_nan_peer_sched *nan_sched;
+ struct cfg80211_sta_smd_params smd_params;
+
/* must be last */
u8 drv_priv[] __aligned(sizeof(void *));
};
@@ -3958,6 +3971,19 @@ enum ieee80211_ampdu_mlme_action {
#define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
#define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
+/**
+ * enum ieee80211_ba_policy - BlockAck Policy
+ *
+ * @IEEE80211_BLOCKACK_DELAYED: Block ACK sent to the BAR sender in next TXOP
+ * @IEEE80211_BLOCKACK_IMMEDIATE: Block ACK sent to the BAR sender immediately
+ *
+ * This field is valid only for %IEEE80211_AMPDU_RX_START.
+ */
+enum ieee80211_ba_policy {
+ IEEE80211_BLOCKACK_DELAYED,
+ IEEE80211_BLOCKACK_IMMEDIATE,
+};
+
/**
* struct ieee80211_ampdu_params - AMPDU action parameters
*
@@ -3970,6 +3996,7 @@ enum ieee80211_ampdu_mlme_action {
* @buf_size: reorder buffer size (number of subframes). Valid only when the
* action is set to %IEEE80211_AMPDU_RX_START or
* %IEEE80211_AMPDU_TX_OPERATIONAL
+ * @policy: BlockAck policy of type &enum ieee80211_ba_policy
* @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
* valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
* @timeout: BA session timeout. Valid only when the action is set to
@@ -3981,6 +4008,7 @@ struct ieee80211_ampdu_params {
u16 tid;
u16 ssn;
u16 buf_size;
+ enum ieee80211_ba_policy policy;
bool amsdu;
u16 timeout;
};
@@ -4071,6 +4099,24 @@ struct ieee80211_prep_tx_info {
int link_id;
};
+/**
+ * enum ieee80211_sta_smd_state - SMD BSS Transition sub-state
+ *
+ * Tracks the 802.11bn SMD BSS Transition sub-state (IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association.
+ *
+ * @IEEE80211_STA_SMD_NONE: Plain State 4. No sub-state active.
+ * @IEEE80211_STA_SMD_PREP: State 4a. STA prepared at the target AP MLD
+ * @IEEE80211_STA_SMD_EXEC: State 4b. ST execution active at the current AP MLD
+ * @IEEE80211_STA_SMD_DRAIN: State 4c. DL draining period at the current AP MLD
+ */
+enum ieee80211_sta_smd_state {
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_PREP,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_DRAIN,
+};
+
/**
* struct ieee80211_ops - callbacks from mac80211 to the driver
*
@@ -4737,6 +4783,16 @@ struct ieee80211_prep_tx_info {
* @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
* driver according to the parameter received in the EML Operating mode
* notification frame.
+ * @sta_smd_state: Notifies low level driver about IEEE 802.11bn SMD substate
+ * transition of a station. It must not fail while transitioning down.
+ * The callback can sleep.
+ * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on
+ * the target AP MLD side to program dynamic context.
+ * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in
+ * the current AP MLD side on behalf of the target AP MLD to collect
+ * dynamic context, when the non-AP MLD sends ST Execute frame directly
+ * to the target. Since the response is asynchronous, the drivers that
+ * implement this should not store reference to @sta.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5138,6 +5194,17 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_eml_params *eml_params);
+ int (*sta_smd_state)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state);
+ int (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info);
+ int (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type);
};
/**
@@ -8207,4 +8274,15 @@ bool ieee80211_vif_nan_started(struct ieee80211_vif *vif);
* Return: 0 if success and non-zero on error
*/
int ieee80211_encrypt_tx_skb(struct sk_buff *skb);
+
+/**
+ * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211
+ * @vif: virtual interface
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ */
+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
#endif /* MAC80211_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9a2ccb8d66b86..8dd07751a3365 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1427,6 +1427,18 @@
* @NL80211_CMD_STOP_PD: Stop the PD operation, identified by
* its %NL80211_ATTR_WDEV interface.
*
+ * @NL80211_CMD_SET_SMD_CTX: Set the SMD BSS Transition dynamic context for a
+ * non-AP MLD sent from the current AP MLD on the target AP MLD managed by
+ * an SMD-ME. This command carries %NL80211_ATTR_MLD_ADDR,
+ * %NL80211_ATTR_SMD_CTX_TYPE and %NL80211_ATTR_SMD_CTX.
+ * @NL80211_CMD_GET_SMD_CTX: Get the SMD BSS Transition dynamic context for a
+ * non-AP MLD associated to an AP MLD managed by an SMD-ME. This command
+ * carries %NL80211_ATTR_MLD_ADDR and %NL80211_ATTR_SMD_CTX_TYPE.
+ * @NL80211_CMD_SMD_CTX_EVENT: Event reporting the collected SMD context
+ * (requested via %NL80211_CMD_GET_SMD_CTX) to userspace. It carries
+ * %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_SMD_CTX_TYPE, and
+ * %NL80211_ATTR_SMD_CTX.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1705,6 +1717,10 @@ enum nl80211_commands {
NL80211_CMD_START_PD,
NL80211_CMD_STOP_PD,
+ NL80211_CMD_SET_SMD_CTX,
+ NL80211_CMD_GET_SMD_CTX,
+ NL80211_CMD_SMD_CTX_EVENT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3190,6 +3206,35 @@ enum nl80211_commands {
* known station to transmit a frame. This is relevant to know whether
* MLD address translation happened or to disable it when sending a frame.
*
+ * @NL80211_ATTR_SMD_PARAMS: Nested attribute to indicate support for Seamless
+ * Mobility Domain (SMD); it contains parameters to define capabilities of
+ * an AP managed by an SMD-ME. Valid if the driver supports
+ * %NL80211_EXT_FEATURE_SMD.
+ * Used with %NL80211_CMD_START_AP. See &enum nl80211_smd_params_attrs.
+ *
+ * @NL80211_ATTR_PEER_SMD_ENABLED: Flag indicating a peer STA has SMD enabled.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_PEER_SMD_MAC_ADDR: Binary attribute with the 6-byte MAC
+ * address of the SMD-capable peer STA.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING: Flag indicating the peer STA
+ * supports DL data forwarding within the SMD domain.
+ * Used with %NL80211_CMD_NEW_STATION and %NL80211_CMD_SET_STATION.
+ *
+ * @NL80211_ATTR_SMD_ROAM_STA: Flag attribute indicating this station was
+ * created via SMD BSS Transition Preparation at the Target AP MLD (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.6).
+ * This flag is carried in %NL80211_CMD_NEW_STATION.
+ *
+ * @NL80211_ATTR_SMD_CTX: Nested attribute associated with UHR SMD BSS
+ * Transition data. Used with %NL80211_CMD_SET_SMD_CTX and
+ * %NL80211_CMD_SMD_CTX_EVENT. See &enum nl80211_smd_ctx.
+ * @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context.
+ * Used along with %NL80211_CMD_SET_SMD_CTX, %NL80211_CMD_GET_SMD_CTX,
+ * and %NL80211_CMD_SMD_CTX_EVENT.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3792,6 +3837,17 @@ enum nl80211_attrs {
NL80211_ATTR_FRAME_NO_STA,
+ NL80211_ATTR_SMD_PARAMS,
+
+ NL80211_ATTR_PEER_SMD_ENABLED,
+ NL80211_ATTR_PEER_SMD_MAC_ADDR,
+ NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING,
+
+ NL80211_ATTR_SMD_ROAM_STA,
+
+ NL80211_ATTR_SMD_CTX,
+ NL80211_ATTR_SMD_CTX_TYPE,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -3942,6 +3998,13 @@ enum nl80211_iftype {
* that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a
* previously added station into associated state
* @NL80211_STA_FLAG_SPP_AMSDU: station supports SPP A-MSDUs
+ * @NL80211_STA_FLAG_SMD: station has negotiated SMD.
+ * @NL80211_STA_FLAG_SMD_PREP_TARGET: station is prepared at SMD target AP MLD
+ * (State 4a).
+ * @NL80211_STA_FLAG_SMD_EXEC_CURRENT: current AP MLD is executing SMD BSS
+ * Transition (State 4b).
+ * @NL80211_STA_FLAG_SMD_DL_DRAIN: current AP MLD is in DL draining period
+ * (State 4c).
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -3955,6 +4018,10 @@ enum nl80211_sta_flags {
NL80211_STA_FLAG_TDLS_PEER,
NL80211_STA_FLAG_ASSOCIATED,
NL80211_STA_FLAG_SPP_AMSDU,
+ NL80211_STA_FLAG_SMD,
+ NL80211_STA_FLAG_SMD_PREP_TARGET,
+ NL80211_STA_FLAG_SMD_EXEC_CURRENT,
+ NL80211_STA_FLAG_SMD_DL_DRAIN,
/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
@@ -7126,6 +7193,15 @@ enum nl80211_feature_flags {
* offload in station mode, including Fast Transition or Opportunistic
* Key Caching.
*
+ * @NL80211_EXT_FEATURE_SMD: Driver supports Seamless Mobility Domain (SMD)
+ * and is managed by an SMD-ME to support SMD BSS Transition in AP mode
+ * and supports association to an SMD-ME and SMD BSS transition in
+ * non-AP STA mode.
+ *
+ * @NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING: Driver supports forwarding of
+ * buffered downlink (DL) data packets in AP mode to the non-AP STA during
+ * SMD BSS Transition.
+ *
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
@@ -7209,6 +7285,8 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
NL80211_EXT_FEATURE_PROBE_AP,
NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,
+ NL80211_EXT_FEATURE_SMD,
+ NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
@@ -9120,4 +9198,228 @@ enum nl80211_nan_peer_map_attrs {
#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff
+/**
+ * enum nl80211_smd_type - Type of the SMD
+ *
+ * @NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP: Separate MAC SAP is used per AP MLD.
+ * @NL80211_SMD_TYPE_PER_SMD_MAC_SAP: one MAC SAP is used in the SMD.
+ * @NUM_NL80211_SMD_TYPES: internal.
+ * @NL80211_SMD_TYPE_MAX: Max type of the SMD.
+ *
+ * This value represents the data path models between the non-AP MLD and DS.
+ * DS mapping for the non-AP MLD is updated if
+ * %NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP is used.
+ *
+ * All AP MLDs within an SMD shall indicate the same SMD type (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.2).
+ */
+enum nl80211_smd_type {
+ NL80211_SMD_TYPE_PER_AP_MLD_MAC_SAP,
+ NL80211_SMD_TYPE_PER_SMD_MAC_SAP,
+
+ NUM_NL80211_SMD_TYPES,
+ NL80211_SMD_TYPE_MAX = NUM_NL80211_SMD_TYPES - 1,
+};
+
+/**
+ * enum nl80211_smd_ptk_mode - PTK Mode used in the SMD
+ *
+ * @NL80211_SMD_PTK_MODE_PER_SMD_PTK: one PTK is used by all AP MLDs in the SMD.
+ * @NL80211_SMD_PTK_MODE_PER_AP_MLD_PTK: Separate PTK is used per AP MLD.
+ * @NUM_NL80211_SMD_PTK_MODES: internal.
+ * @NL80211_SMD_PTK_MODE_MAX: Max type of PTK mode.
+ *
+ * This value represents the security mode of the SMD that dictates the PTK used
+ * in current and target AP MLDs to protect communications with the non-AP MLD
+ * (refer IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.1.3.2)
+ */
+enum nl80211_smd_ptk_mode {
+ NL80211_SMD_PTK_MODE_PER_SMD_PTK,
+ NL80211_SMD_PTK_MODE_PER_AP_MLD_PTK,
+
+ NUM_NL80211_SMD_PTK_MODES,
+ NL80211_SMD_PTK_MODE_MAX = NUM_NL80211_SMD_PTK_MODES - 1,
+};
+
+/**
+ * enum nl80211_smd_params_attrs - SMD Domain parameters
+ *
+ * @NL80211_SMD_PARAMS_ATTR_UNSPEC: Invalid attribute.
+ * @NL80211_SMD_PARAMS_ATTR_IDENTIFIER: Required (binary) attribute of ETH_ALEN
+ * bytes used to define the unique identifier for the SMD.
+ * @NL80211_SMD_PARAMS_ATTR_TIMEOUT: Required (u16) attribute to define the SMD
+ * Preparation timeout (in 64 TUs, values 0 and 1 are reserved) for
+ * the target AP MLD.
+ * @NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING: Flag attribute to indicate that
+ * the device supports forwarding of buffered DL data packets.
+ * @NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS: Required (u8) attribute to define
+ * the maximum number of AP MLDs a non-AP MLD can prepare with. Value is
+ * the maximum number of AP MLDs - 1. A value of 0 means that the non-AP
+ * MLD can prepare with 1 AP MLD.
+ * @NL80211_SMD_PARAMS_ATTR_TYPE: Required (u8) attribute to indicate the
+ * SMD Type (&enum nl80211_smd_type).
+ * @NL80211_SMD_PARAMS_ATTR_PTK_MODE: Required (u8) attribute to indicate the
+ * PTK mode used for protection (&enum nl80211_smd_ptk_mode).
+ * @NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING: Flag attribute to indicate that
+ * the device supports UHR Neighboring AP Probing.
+ * @__NL80211_SMD_PARAMS_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_PARAMS_ATTR_MAX: Max attribute.
+ *
+ * Nested attributes carried in %NL80211_ATTR_SMD_PARAMS to define
+ * device capabilities that is part of an SMD (refer IEEE P802.11bn/D2.0,
+ * Aug 2026, subclause 9.4.2.363, Figure 9-aa43 and Figure 9-aa44).
+ *
+ */
+enum nl80211_smd_params_attrs {
+ NL80211_SMD_PARAMS_ATTR_UNSPEC,
+ NL80211_SMD_PARAMS_ATTR_IDENTIFIER,
+ NL80211_SMD_PARAMS_ATTR_TIMEOUT,
+ NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING,
+ NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS,
+ NL80211_SMD_PARAMS_ATTR_TYPE,
+ NL80211_SMD_PARAMS_ATTR_PTK_MODE,
+ NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING,
+
+ /* keep last */
+ __NL80211_SMD_PARAMS_ATTR_LAST,
+ NL80211_SMD_PARAMS_ATTR_MAX = __NL80211_SMD_PARAMS_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_type - SMD Request Type values
+ *
+ * Used with %NL80211_ATTR_SMD_CTX_TYPE.
+ *
+ * @NL80211_SMD_CTX_TYPE_PREP: SMD BSS Transition (ST) Preparation.
+ * @NL80211_SMD_CTX_TYPE_EXEC: ST Execution.
+ * @NUM_SMD_CTX_TYPES: internal.
+ * @NL80211_SMD_CTX_TYPE_MAX: Max type of ST context.
+ */
+enum nl80211_smd_ctx_type {
+ NL80211_SMD_CTX_TYPE_PREP,
+ NL80211_SMD_CTX_TYPE_EXEC,
+
+ NUM_SMD_CTX_TYPES,
+ NL80211_SMD_CTX_TYPE_MAX = NUM_SMD_CTX_TYPES - 1,
+};
+
+/**
+ * enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes
+ *
+ * @__NL80211_SMD_CTX_BA_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE: Required (u16) BA buffer size.
+ * @NL80211_SMD_CTX_BA_ATTR_POLICY: Required (u8) BA policy.
+ * @NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT: Flag attribute to indicate
+ * AMSDU support.
+ * @NL80211_SMD_CTX_BA_ATTR_TIMEOUT: Required (u16) Block Ack timeout.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG: Flag attribute to indicate
+ * fragmentation support.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL: Required (u8) HE fragmentation
+ * level.
+ * @NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE: Required (u16) extended buffer size.
+ * @__NL80211_SMD_CTX_BA_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_BA_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_DL_ATTR_BA_PARAMS and
+ * %NL80211_SMD_CTX_UL_ATTR_BA_PARAMS.
+ */
+enum nl80211_smd_ctx_ba_param {
+ __NL80211_SMD_CTX_BA_ATTR_INVALID,
+ NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,
+ NL80211_SMD_CTX_BA_ATTR_POLICY,
+ NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT,
+ NL80211_SMD_CTX_BA_ATTR_TIMEOUT,
+ NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG,
+ NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,
+
+ __NL80211_SMD_CTX_BA_ATTR_LAST,
+ NL80211_SMD_CTX_BA_ATTR_MAX = __NL80211_SMD_CTX_BA_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction
+ *
+ * @__NL80211_SMD_CTX_DL_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.
+ * @NL80211_SMD_CTX_DL_ATTR_SN: Optional (nested) next SN (u16) per TID to
+ * be assigned to DL individually addressed frames.
+ * @NL80211_SMD_CTX_DL_ATTR_PN: Optional (binary) starting PN (max 16 bytes) for
+ * DL individually addressed frames.
+ * @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters,
+ * nested array of TIDs (uses &enum nl80211_smd_ctx_ba_param).
+ * @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_DL_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_ATTR_DL.
+ */
+enum nl80211_smd_ctx_dl {
+ __NL80211_SMD_CTX_DL_ATTR_INVALID,
+ NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,
+ NL80211_SMD_CTX_DL_ATTR_SN,
+ NL80211_SMD_CTX_DL_ATTR_PN,
+ NL80211_SMD_CTX_DL_ATTR_BA_PARAMS,
+
+ __NL80211_SMD_CTX_DL_ATTR_LAST,
+ NL80211_SMD_CTX_DL_ATTR_MAX = __NL80211_SMD_CTX_DL_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction
+ *
+ * @__NL80211_SMD_CTX_UL_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included.
+ * @NL80211_SMD_CTX_UL_ATTR_SN: Optional (nested) last SN received per TID
+ * for UL individually addressed frames.
+ * @NL80211_SMD_CTX_UL_ATTR_PN: Optional (nested) last PN received per TID
+ * for UL individually addressed frames.
+ * @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters
+ * (uses &enum nl80211_smd_ctx_ba_param).
+ * @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_UL_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_SMD_CTX_ATTR_UL.
+ */
+enum nl80211_smd_ctx_ul {
+ __NL80211_SMD_CTX_UL_ATTR_INVALID,
+ NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,
+ NL80211_SMD_CTX_UL_ATTR_SN,
+ NL80211_SMD_CTX_UL_ATTR_PN,
+ NL80211_SMD_CTX_UL_ATTR_BA_PARAMS,
+
+ __NL80211_SMD_CTX_UL_ATTR_LAST,
+ NL80211_SMD_CTX_UL_ATTR_MAX = __NL80211_SMD_CTX_UL_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_smd_ctx - SMD Context information
+ *
+ * Top-level container for SMD BSS Transition dynamic context. Carried in
+ * %NL80211_ATTR_SMD_CTX with %NL80211_CMD_SET_SMD_CTX (target AP MLD) or
+ * with %NL80211_CMD_FRAME (current AP MLD reporting context to userspace)
+ * and %NL80211_CMD_SMD_CTX_EVENT (current AP MLD reporting the requested
+ * context on behalf of the target AP MLD).
+ *
+ * @__NL80211_SMD_CTX_ATTR_INVALID: Invalid attribute.
+ * @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters.
+ * See &enum nl80211_smd_ctx_dl.
+ * @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters.
+ * See &enum nl80211_smd_ctx_ul.
+ * @NL80211_SMD_CTX_ATTR_DRV_DATA: Optional (binary) driver-specific blob.
+ * Passed through nl80211 as a blob; parsed only at the driver layer of
+ * the current AP MLD and target AP MLD. First 3 bytes shall be driver OUI
+ * for the driver to parse as required.
+ * @__NL80211_SMD_CTX_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_SMD_CTX_ATTR_MAX: Max attribute.
+ */
+enum nl80211_smd_ctx {
+ __NL80211_SMD_CTX_ATTR_INVALID,
+ NL80211_SMD_CTX_ATTR_DL,
+ NL80211_SMD_CTX_ATTR_UL,
+ NL80211_SMD_CTX_ATTR_DRV_DATA,
+
+ __NL80211_SMD_CTX_ATTR_LAST,
+ NL80211_SMD_CTX_ATTR_MAX = __NL80211_SMD_CTX_ATTR_LAST - 1
+};
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 9629e00069a1f..2d67fd8831465 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -289,6 +289,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
.amsdu = false,
.timeout = timeout,
.ssn = start_seq_num,
+ .policy = ba_policy,
};
int i, ret = -EOPNOTSUPP;
u16 status = WLAN_STATUS_REQUEST_DECLINED;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 23f4f9ec86d0a..95b699117147a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1796,6 +1796,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
}
}
+ if (params->smd_params.smd_enabled)
+ link_conf->smd_params = params->smd_params;
+ else
+ link_conf->smd_params.smd_enabled = false;
+
if (sdata->vif.type == NL80211_IFTYPE_AP &&
params->mbssid_config.tx_wdev) {
err = ieee80211_set_ap_mbssid_options(sdata,
@@ -2447,6 +2452,73 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
return 0;
}
+static int sta_apply_smd_state_flags(struct sta_info *sta,
+ u32 mask, u32 set)
+{
+ bool smd_prep_target, smd_exec_current, smd_dl_drain;
+ u32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);
+ enum ieee80211_sta_smd_state new_ss;
+ u32 smd_flags;
+ int err;
+
+ if (!(mask & expected_mask))
+ return 0;
+
+ smd_flags = mask & expected_mask & set;
+ if (WARN_ON(hweight32(smd_flags) > 1))
+ return -EINVAL;
+
+ smd_prep_target =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_PREP_TARGET));
+ smd_exec_current =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT));
+ smd_dl_drain =
+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_DL_DRAIN));
+
+ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
+ (smd_exec_current || smd_dl_drain))
+ return -EINVAL;
+
+ if (smd_prep_target)
+ new_ss = IEEE80211_STA_SMD_PREP;
+ else if (smd_exec_current)
+ new_ss = IEEE80211_STA_SMD_EXEC;
+ else if (smd_dl_drain)
+ new_ss = IEEE80211_STA_SMD_DRAIN;
+ else
+ new_ss = IEEE80211_STA_SMD_NONE;
+
+ if (new_ss == sta->smd_state)
+ return 0;
+
+ err = sta_info_move_smd_state(sta, new_ss, true);
+ if (err)
+ return err;
+
+ if (smd_prep_target) {
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ set_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ } else if (smd_exec_current) {
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ set_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ } else if (smd_dl_drain) {
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ set_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ } else {
+ /* all flags revert back to none being set */
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+ }
+
+ return 0;
+}
+
static int sta_apply_parameters(struct ieee80211_local *local,
struct sta_info *sta,
struct station_parameters *params)
@@ -2523,6 +2595,18 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (mask & BIT(NL80211_STA_FLAG_SPP_AMSDU))
sta->sta.spp_amsdu = set & BIT(NL80211_STA_FLAG_SPP_AMSDU);
+ if (mask & BIT(NL80211_STA_FLAG_SMD)) {
+ if (set & BIT(NL80211_STA_FLAG_SMD)) {
+ set_sta_flag(sta, WLAN_STA_SMD);
+ } else if (test_sta_flag(sta, WLAN_STA_SMD)) {
+ sta_info_reset_smd_state(sta, true);
+ clear_sta_flag(sta, WLAN_STA_SMD);
+ }
+ }
+
+ if (params->smd_params.smd_sta)
+ sta->sta.smd_params = params->smd_params;
+
/* mark TDLS channel switch support, if the AP allows it */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
!sdata->deflink.u.mgd.tdls_chan_switch_prohibited &&
@@ -2624,6 +2708,17 @@ static int sta_apply_parameters(struct ieee80211_local *local,
return ret;
}
+ /*
+ * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026,
+ * subclause 11.3.1).
+ * Only meaningful for SMD-capable stations (WLAN_STA_SMD set).
+ */
+ if (test_sta_flag(sta, WLAN_STA_SMD)) {
+ ret = sta_apply_smd_state_flags(sta, mask, set);
+ if (ret)
+ return ret;
+ }
+
/* Mark the STA as MLO if MLD MAC address is available */
if (params->link_sta_params.mld_mac)
sta->sta.mlo = true;
@@ -2708,6 +2803,19 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev,
*/
if (!err && sdata->vif.type == NL80211_IFTYPE_NAN_DATA)
ieee80211_nan_update_ndi_carrier(sta->sdata);
+
+ /*
+ * SMD sub-state was set in sta_apply_parameters() before the station
+ * was inserted so drv_sta_smd_state() was skipped (WLAN_STA_INSERTED
+ * was not yet set). Walk the driver step-by-step to the target state.
+ */
+ if (!err && test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state != IEEE80211_STA_SMD_NONE) {
+ err = sta_info_move_drv_smd_state(sta);
+ if (err)
+ WARN_ON(__sta_info_destroy(sta));
+ }
+
return err;
}
@@ -5973,6 +6081,66 @@ ieee80211_set_peer_nan_sched(struct wiphy *wiphy,
return ieee80211_nan_set_peer_sched(sdata, sched);
}
+static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ struct sta_info *sta;
+
+ lockdep_assert_wiphy(wiphy);
+
+ sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP &&
+ sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, addr);
+ if (!sta)
+ return -ENOENT;
+ if (!sta->sta.smd_params.smd_sta)
+ return -EINVAL;
+
+ return drv_set_smd_ctx(local, sdata, &sta->sta, st_info);
+}
+
+static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ enum nl80211_smd_ctx_type type)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ struct sta_info *sta;
+
+ lockdep_assert_wiphy(wiphy);
+
+ sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP &&
+ sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, addr);
+ if (!sta)
+ return -ENOENT;
+ if (!sta->sta.smd_params.smd_sta)
+ return -EINVAL;
+
+ return drv_get_smd_ctx(local, sdata, &sta->sta, type);
+}
+
+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+ cfg80211_get_smd_ctx_done(&sdata->wdev, sta_addr, st_info);
+}
+EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);
+
const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -6091,4 +6259,6 @@ const struct cfg80211_ops mac80211_config_ops = {
.set_epcs = ieee80211_set_epcs,
.nan_set_local_sched = ieee80211_set_local_nan_sched,
.nan_set_peer_sched = ieee80211_set_peer_nan_sched,
+ .set_smd_ctx = ieee80211_set_smd_ctx,
+ .get_smd_ctx = ieee80211_get_smd_ctx,
};
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index ef75255d47d5a..24c985687bd27 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -78,6 +78,10 @@ static const char * const sta_flag_names[] = {
FLAG(PS_DELIVER),
FLAG(USES_ENCRYPTION),
FLAG(DECAP_OFFLOAD),
+ FLAG(SMD),
+ FLAG(SMD_PREP_TARGET),
+ FLAG(SMD_EXEC_CURRENT),
+ FLAG(SMD_DL_DRAIN),
#undef FLAG
};
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 49753b73aba26..d77a5a80f06ec 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -633,3 +633,27 @@ int drv_change_sta_links(struct ieee80211_local *local,
return 0;
}
+
+int drv_sta_smd_state(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state)
+{
+ int ret = 0;
+
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ sdata = get_bss_sdata(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_sta_smd_state(local, sdata, sta, old_state, new_state);
+ if (local->ops->sta_smd_state)
+ ret = local->ops->sta_smd_state(&local->hw, &sdata->vif,
+ sta, old_state, new_state);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index f1c0b87fddd5f..0339ff71cd4ab 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1814,4 +1814,58 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,
return ret;
}
+int drv_sta_smd_state(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state);
+
+static inline int drv_set_smd_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret;
+
+ if (!local->ops->set_smd_ctx)
+ return -EOPNOTSUPP;
+
+ sdata = get_bss_sdata(sdata);
+
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_set_smd_ctx(local, sdata, sta, st_info);
+ ret = local->ops->set_smd_ctx(&local->hw, &sdata->vif, sta, st_info);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
+static inline int drv_get_smd_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type)
+{
+ int ret;
+
+ if (!sdata || !local->ops->get_smd_ctx)
+ return -EOPNOTSUPP;
+
+ sdata = get_bss_sdata(sdata);
+
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ trace_drv_get_smd_ctx(local, sdata, sta, type);
+ ret = local->ops->get_smd_ctx(&local->hw, &sdata->vif, sta, type);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9514f01778beb..cf1a5d54d2299 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -268,6 +268,8 @@ struct ieee80211_rx_data {
};
u8 link_addrs[3 * ETH_ALEN];
+
+ struct ieee80211_smd_ctx *smd_ctx;
};
struct ieee80211_csa_settings {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b3990b7a72990..4ad7a71d298a9 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3970,6 +3970,22 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
return RX_QUEUED;
}
+static void
+ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,
+ struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_mgmt *mgmt = (void *)info->buf;
+ u8 type;
+
+ if (!rx->smd_ctx)
+ return;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ info->st_info.type = type;
+ info->st_info.ctx = rx->smd_ctx;
+}
+
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
{
@@ -3981,6 +3997,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
.link_id = rx->link_id,
.have_link_id = rx->link_id >= 0,
.no_sta = !rx->sta,
+ .st_info.ctx = NULL,
};
/* skip known-bad action frames and return them in the next handler */
@@ -4002,6 +4019,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
ieee80211_is_ftm(rx->skb)) {
info.rx_tstamp = ktime_to_ns(skb_hwtstamps(rx->skb)->hwtstamp);
info.ack_tstamp = ktime_to_ns(status->ack_tx_hwtstamp);
+ } else if (ieee80211_is_st_prep_req(rx->skb) ||
+ ieee80211_is_st_exec_req(rx->skb)) {
+ ieee80211_rx_h_userspace_mgmt_st_req_frame(&info, rx);
}
if (cfg80211_rx_mgmt_ext(&rx->sdata->wdev, &info)) {
@@ -5340,7 +5360,8 @@ static bool ieee80211_rx_valid_freq(int freq, struct ieee80211_link_data *link)
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct ieee80211_link_sta *link_pubsta,
struct sk_buff *skb,
- struct list_head *list)
+ struct list_head *list,
+ struct ieee80211_rx_data *rx)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -5349,16 +5370,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct link_sta_info *link_sta;
struct sta_info *sta;
__le16 fc;
- struct ieee80211_rx_data rx;
struct rhlist_head *tmp;
bool rx_data_pending;
int err = 0;
fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
- memset(&rx, 0, sizeof(rx));
- rx.skb = skb;
- rx.local = local;
- rx.list = list;
+ rx->skb = skb;
+ rx->local = local;
+ rx->list = list;
if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
I802_DEBUG_INC(local->dot11ReceivedFragmentCount);
@@ -5390,8 +5409,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
}
hdr = (struct ieee80211_hdr *)skb->data;
- ieee80211_parse_qos(&rx);
- ieee80211_verify_alignment(&rx);
+ ieee80211_parse_qos(rx);
+ ieee80211_verify_alignment(rx);
if (unlikely(ieee80211_is_probe_resp(hdr->frame_control) ||
ieee80211_is_beacon(hdr->frame_control) ||
@@ -5412,9 +5431,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
sta);
link_sta = rcu_dereference(sta->link[link_pubsta->link_id]);
- rx.sdata = sta->sdata;
- if (ieee80211_rx_data_set_link_sta(&rx, link_sta) &&
- ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ rx->sdata = sta->sdata;
+ if (ieee80211_rx_data_set_link_sta(rx, link_sta) &&
+ ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
goto out;
@@ -5434,13 +5453,13 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
continue;
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb,
+ ieee80211_prepare_and_rx_handle(rx, skb,
false);
rx_data_pending = false;
}
- rx.sdata = sta->sdata;
- if (!ieee80211_rx_data_set_link_sta(&rx, &sta->deflink))
+ rx->sdata = sta->sdata;
+ if (!ieee80211_rx_data_set_link_sta(rx, &sta->deflink))
continue;
rx_data_pending = true;
@@ -5458,20 +5477,20 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
continue;
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb,
+ ieee80211_prepare_and_rx_handle(rx, skb,
false);
rx_data_pending = false;
}
- rx.sdata = sta->sdata;
- if (!ieee80211_rx_data_set_link_sta(&rx, link_sta))
+ rx->sdata = sta->sdata;
+ if (!ieee80211_rx_data_set_link_sta(rx, link_sta))
continue;
rx_data_pending = true;
}
if (rx_data_pending) {
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ if (ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
goto out;
@@ -5526,14 +5545,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
if (link_sta && link &&
ieee80211_rx_valid_freq(status->freq, link)) {
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(rx, skb, false);
rx_data_pending = false;
}
/* No valid_links check as we need to RX beacons */
- rx.sdata = sdata;
- if (ieee80211_rx_data_set_link_sta(&rx, link_sta))
+ rx->sdata = sdata;
+ if (ieee80211_rx_data_set_link_sta(rx, link_sta))
rx_data_pending = true;
continue;
@@ -5562,22 +5581,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
}
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(rx, skb, false);
rx_data_pending = false;
}
- rx.sdata = sdata;
- rx.local = sdata->local;
- rx.link = link;
- rx.link_id = link->link_id;
- rx.sta = NULL;
- rx.link_sta = NULL;
+ rx->sdata = sdata;
+ rx->local = sdata->local;
+ rx->link = link;
+ rx->link_id = link->link_id;
+ rx->sta = NULL;
+ rx->link_sta = NULL;
rx_data_pending = true;
}
if (rx_data_pending &&
- ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ ieee80211_prepare_and_rx_handle(rx, skb, true))
return;
out:
@@ -5597,6 +5616,15 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
struct ieee80211_supported_band *sband;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct ieee80211_smd_ctx *smd_ctx = NULL;
+ struct ieee80211_rx_data rx = {};
+
+ /* cache the pointer to free it later */
+ if (status->smd_ctx_valid) {
+ smd_ctx = status->smd_ctx;
+ status->smd_ctx = NULL;
+ status->smd_ctx_valid = false;
+ }
WARN_ON_ONCE(softirq_count() == 0);
@@ -5731,6 +5759,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
kcov_remote_start_common(skb_get_kcov_handle(skb));
+ rx.smd_ctx = smd_ctx;
+
+ if (WARN_ONCE((status->flag & RX_FLAG_8023) && rx.smd_ctx,
+ "802.3 packet but with IEEE P802.11bn SMD context"))
+ goto drop;
+
/*
* Frames with failed FCS/PLCP checksum are not returned,
* all other frames are returned without radiotap header
@@ -5748,12 +5782,14 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
__ieee80211_rx_handle_8023(hw, link_pubsta, skb, list);
else
__ieee80211_rx_handle_packet(hw, link_pubsta, skb,
- list);
+ list, &rx);
}
+ kfree(smd_ctx);
kcov_remote_stop();
return;
drop:
+ kfree(smd_ctx);
kfree_skb(skb);
}
EXPORT_SYMBOL(ieee80211_rx_list);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index fdf00cbf49d8b..9ea0a87912892 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -701,6 +701,7 @@ __sta_info_alloc(struct ieee80211_sub_if_data *sdata,
ieee80211_init_frag_cache(&sta->frags);
sta->sta_state = IEEE80211_STA_NONE;
+ sta->smd_state = IEEE80211_STA_SMD_NONE;
if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
sta->amsdu_mesh_control = -1;
@@ -1311,6 +1312,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
{
struct ieee80211_local *local;
struct ieee80211_sub_if_data *sdata;
+ struct wireless_dev *wdev;
int ret, i;
might_sleep();
@@ -1320,6 +1322,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
local = sta->local;
sdata = sta->sdata;
+ wdev = &sdata->wdev;
lockdep_assert_wiphy(local->hw.wiphy);
@@ -1389,6 +1392,10 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta)
rcu_access_pointer(sdata->u.vlan.sta) == sta)
RCU_INIT_POINTER(sdata->u.vlan.sta, NULL);
+ if (sdata->vif.type == NL80211_IFTYPE_AP ||
+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+ cfg80211_free_pending_smd_ctx_req(wdev, sta->addr);
+
return 0;
}
@@ -1527,6 +1534,20 @@ static int _sta_info_move_state(struct sta_info *sta,
WARN_ONCE(err,
"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n",
err);
+
+ /* revert SMD states if STA has transitioned down */
+ if (new_state == IEEE80211_STA_AUTH &&
+ sta->sta_state == IEEE80211_STA_ASSOC) {
+ if (test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state == IEEE80211_STA_SMD_PREP)
+ sta_info_reset_smd_state(sta, true);
+ } else if (new_state == IEEE80211_STA_ASSOC &&
+ sta->sta_state == IEEE80211_STA_AUTHORIZED) {
+ if (test_sta_flag(sta, WLAN_STA_SMD) &&
+ sta->smd_state != IEEE80211_STA_SMD_NONE &&
+ sta->smd_state != IEEE80211_STA_SMD_PREP)
+ sta_info_reset_smd_state(sta, true);
+ }
}
sta->sta_state = new_state;
@@ -3883,3 +3904,128 @@ bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,
return true;
}
+
+int sta_info_move_smd_state(struct sta_info *sta,
+ enum ieee80211_sta_smd_state new_ss,
+ bool notify)
+{
+ enum ieee80211_sta_smd_state old_ss = sta->smd_state;
+ struct ieee80211_local *local = sta->local;
+ bool notify_driver;
+ int err;
+
+ might_sleep();
+
+ if (old_ss == new_ss)
+ return 0;
+
+ switch (new_ss) {
+ case IEEE80211_STA_SMD_NONE:
+ if (old_ss != IEEE80211_STA_SMD_PREP &&
+ old_ss != IEEE80211_STA_SMD_EXEC &&
+ old_ss != IEEE80211_STA_SMD_DRAIN)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_EXEC:
+ if (old_ss != IEEE80211_STA_SMD_NONE)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_DRAIN:
+ if (old_ss != IEEE80211_STA_SMD_EXEC)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_SMD_PREP:
+ if (old_ss != IEEE80211_STA_SMD_NONE)
+ return -EINVAL;
+ break;
+ default:
+ sdata_err(sta->sdata, "invalid smd state %d", new_ss);
+ return -EINVAL;
+ }
+
+ sta_dbg(sta->sdata, "moving STA %pM SMD state %u -> %u\n",
+ sta->sta.addr, old_ss, new_ss);
+
+ notify_driver = notify && test_sta_flag(sta, WLAN_STA_INSERTED);
+
+ if (new_ss > old_ss && notify_driver) {
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss,
+ new_ss);
+ if (err)
+ return err;
+ }
+
+ if (new_ss < old_ss && notify_driver) {
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss,
+ new_ss);
+ /* driver should not fail moving down SMD states */
+ WARN_ONCE(err,
+ "Driver should not fail moving down SMD states: %d\n",
+ err);
+ }
+
+ sta->smd_state = new_ss;
+
+ return 0;
+}
+
+void sta_info_reset_smd_state(struct sta_info *sta, bool notify)
+{
+ if (sta->smd_state == IEEE80211_STA_SMD_NONE)
+ return;
+
+ /* DRAIN -> NONE, EXEC -> NONE or PREP -> NONE */
+ WARN_ON_ONCE(sta_info_move_smd_state(sta, IEEE80211_STA_SMD_NONE,
+ notify));
+
+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);
+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
+}
+
+int sta_info_move_drv_smd_state(struct sta_info *sta)
+{
+ enum ieee80211_sta_smd_state new_ss = sta->smd_state;
+ struct ieee80211_local *local = sta->local;
+ int err = 0;
+
+ if (!test_sta_flag(sta, WLAN_STA_INSERTED))
+ return 0;
+
+ switch (new_ss) {
+ case IEEE80211_STA_SMD_PREP:
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_PREP);
+ if (err)
+ goto rollback;
+ break;
+ case IEEE80211_STA_SMD_EXEC:
+ case IEEE80211_STA_SMD_DRAIN:
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_NONE,
+ IEEE80211_STA_SMD_EXEC);
+ if (err)
+ goto rollback;
+
+ if (new_ss == IEEE80211_STA_SMD_DRAIN)
+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_DRAIN);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (!err)
+ return 0;
+
+ /* if EXEC -> DRAIN failed in the driver, notify EXEC -> NONE */
+ WARN_ON_ONCE(drv_sta_smd_state(local, sta->sdata, &sta->sta,
+ IEEE80211_STA_SMD_EXEC,
+ IEEE80211_STA_SMD_NONE));
+
+rollback:
+ sta_info_reset_smd_state(sta, false);
+ return err;
+}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index ee0d32877c5b4..bdc021675727f 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -72,6 +72,12 @@
* @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption,
* so drop all packets without a key later.
* @WLAN_STA_DECAP_OFFLOAD: This station uses rx decap offload
+ * @WLAN_STA_SMD: this station is associated to an SMD-ME.
+ * @WLAN_STA_SMD_PREP_TARGET: this SMD station is prepared at the target AP MLD.
+ * @WLAN_STA_SMD_EXEC_CURRENT: this SMD station has started execution at
+ * the current AP MLD.
+ * @WLAN_STA_SMD_DL_DRAIN: this SMD station has started draining at
+ * the current AP MLD.
*
* @NUM_WLAN_STA_FLAGS: number of defined flags
*/
@@ -104,6 +110,10 @@ enum ieee80211_sta_info_flags {
WLAN_STA_PS_DELIVER,
WLAN_STA_USES_ENCRYPTION,
WLAN_STA_DECAP_OFFLOAD,
+ WLAN_STA_SMD,
+ WLAN_STA_SMD_PREP_TARGET,
+ WLAN_STA_SMD_EXEC_CURRENT,
+ WLAN_STA_SMD_DL_DRAIN,
NUM_WLAN_STA_FLAGS,
};
@@ -711,6 +721,7 @@ struct ieee80211_sta_removed_link_stats {
* would be assigned to link[link_id] where link_id is the id assigned
* by the AP.
* @rem_link_stats: accumulated removed link stats
+ * @smd_state: Sub-state for STAs in SMD BSS Transition
*/
struct sta_info {
/* General information, mostly static */
@@ -787,6 +798,8 @@ struct sta_info {
struct link_sta_info __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
struct ieee80211_sta_removed_link_stats rem_link_stats;
+ enum ieee80211_sta_smd_state smd_state;
+
/* keep last! */
struct ieee80211_sta sta;
};
@@ -1159,4 +1172,10 @@ static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s)
return r;
}
+int sta_info_move_smd_state(struct sta_info *sta,
+ enum ieee80211_sta_smd_state new_ss,
+ bool notify);
+void sta_info_reset_smd_state(struct sta_info *sta, bool notify);
+int sta_info_move_drv_smd_state(struct sta_info *sta);
+
#endif /* STA_INFO_H */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 562a4964afa3a..38ad5076232de 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -116,6 +116,7 @@
__field(u16, ssn) \
__field(u16, buf_size) \
__field(bool, amsdu) \
+ __field(u8, policy) \
__field(u16, timeout) \
__field(u16, action)
#define AMPDU_ACTION_ASSIGN STA_NAMED_ASSIGN(params->sta); \
@@ -123,12 +124,13 @@
__entry->ssn = params->ssn; \
__entry->buf_size = params->buf_size; \
__entry->amsdu = params->amsdu; \
+ __entry->policy = params->policy; \
__entry->timeout = params->timeout; \
__entry->action = params->action;
-#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, timeout %d action %d"
+#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, policy=%u, timeout %d action %d"
#define AMPDU_ACTION_PR_ARG STA_PR_ARG, __entry->tid, __entry->ssn, \
- __entry->buf_size, __entry->amsdu, __entry->timeout, \
- __entry->action
+ __entry->buf_size, __entry->amsdu, __entry->policy, \
+ __entry->timeout, __entry->action
/*
* Tracing for driver callbacks.
@@ -3403,6 +3405,115 @@ TRACE_EVENT(drv_nan_peer_sched_changed,
)
);
+TRACE_EVENT(drv_sta_smd_state,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_smd_state old_state,
+ enum ieee80211_sta_smd_state new_state),
+
+ TP_ARGS(local, sdata, sta, old_state, new_state),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u32, old_state)
+ __field(u32, new_state)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->old_state = old_state;
+ __entry->new_state = new_state;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ " smd_state: %d->%d",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->old_state, __entry->new_state
+ )
+);
+
+TRACE_EVENT(drv_set_smd_ctx,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info),
+
+ TP_ARGS(local, sdata, sta, st_info),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, st_type)
+ __field(unsigned int, num_tids)
+ __dynamic_array(unsigned long, dl_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ __dynamic_array(unsigned long, ul_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ ),
+
+ TP_fast_assign(
+ struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ unsigned long sz;
+
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->st_type = st_info->type;
+
+ __entry->num_tids = IEEE80211_SMD_CTX_NUM_TIDS;
+ sz = BITS_TO_LONGS(__entry->num_tids) * sizeof(unsigned long);
+
+ memcpy(__get_dynamic_array(dl_tid_bitmap),
+ ctx->dl.valid_tid_bmap, sz);
+ memcpy(__get_dynamic_array(ul_tid_bitmap),
+ ctx->ul.valid_tid_bmap, sz);
+ ),
+
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ ", ST type=%u DL TIDs: %*pb, UL TIDs: %*pb",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->st_type,
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(dl_tid_bitmap),
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(ul_tid_bitmap)
+ )
+);
+
+TRACE_EVENT(drv_get_smd_ctx,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_smd_ctx_type type),
+
+ TP_ARGS(local, sdata, sta, type),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, st_type)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->st_type = type;
+ ),
+
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT ", ST type=%u",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->st_type
+ )
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
diff --git a/net/wireless/core.c b/net/wireless/core.c
index d13310fef691a..129af6ba5fdae 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1405,6 +1405,25 @@ void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
}
EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);
+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,
+ const u8 *addr)
+{
+ struct cfg80211_smd_get_ctx_pending *pending, *tmp;
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_for_each_entry_safe(pending, tmp,
+ &wdev->smd_get_ctx_pending_list,
+ list) {
+ if (!addr || ether_addr_equal(pending->sta_addr, addr)) {
+ list_del(&pending->list);
+ kfree(pending);
+ dev_put(wdev->netdev);
+ }
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+}
+EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req);
+
static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
bool unregister_netdev)
{
@@ -1477,6 +1496,10 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
}
}
+ if (wdev->iftype == NL80211_IFTYPE_AP ||
+ wdev->iftype == NL80211_IFTYPE_AP_VLAN)
+ cfg80211_free_pending_smd_ctx_req(wdev, NULL);
+
wdev->connected = false;
}
@@ -1619,6 +1642,8 @@ void cfg80211_init_wdev(struct wireless_dev *wdev)
INIT_LIST_HEAD(&wdev->pmsr_list);
spin_lock_init(&wdev->pmsr_lock);
wiphy_work_init(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
+ spin_lock_init(&wdev->smd_get_ctx_lock);
+ INIT_LIST_HEAD(&wdev->smd_get_ctx_pending_list);
#ifdef CONFIG_CFG80211_WEXT
wdev->wext.default_key = -1;
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index a0d1cde26f0c9..15e14f429c164 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1475,3 +1475,33 @@ void cfg80211_mlo_reconf_add_done(struct net_device *dev,
nl80211_mlo_reconf_add_done(dev, data);
}
EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done);
+
+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *iter;
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_for_each_entry(iter, &wdev->smd_get_ctx_pending_list, list) {
+ if (ether_addr_equal(iter->sta_addr, sta_addr)) {
+ pending = iter;
+ list_del(&pending->list);
+ break;
+ }
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ if (!pending) {
+ wiphy_err(wdev->wiphy,
+ "No pending SMD ctx req for %pM found in %s\n",
+ sta_addr, __func__);
+ return;
+ }
+
+ nl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info);
+
+ dev_put(wdev->netdev);
+ kfree(pending);
+}
+EXPORT_SYMBOL(cfg80211_get_smd_ctx_done);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ab5a14f5fe283..0de9394954990 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -689,6 +689,62 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },
};
+static const struct nla_policy
+nl80211_smd_params_policy[NL80211_SMD_PARAMS_ATTR_MAX + 1] = {
+ [NL80211_SMD_PARAMS_ATTR_IDENTIFIER] = NLA_POLICY_ETH_ADDR,
+ [NL80211_SMD_PARAMS_ATTR_TIMEOUT] =
+ NLA_POLICY_MIN(NLA_U16, IEEE80211_SMD_INFO_PREP_TIMEOUT_MIN),
+ [NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING] = { .type = NLA_FLAG },
+ [NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_SMD_INFO_NUM_PREP_AP_MAX),
+ [NL80211_SMD_PARAMS_ATTR_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_TYPE_MAX),
+ [NL80211_SMD_PARAMS_ATTR_PTK_MODE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_PTK_MODE_MAX),
+ [NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING] = { .type = NLA_FLAG },
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_ba_policy[NL80211_SMD_CTX_BA_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },
+ [NL80211_SMD_CTX_BA_ATTR_POLICY] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT] = { .type = NLA_FLAG },
+ [NL80211_SMD_CTX_BA_ATTR_TIMEOUT] = { .type = NLA_U16 },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG] = { .type = NLA_FLAG },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE] = { .type = NLA_U16 },
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_dl_policy[NL80211_SMD_CTX_DL_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_DL_ATTR_SN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_DL_ATTR_PN] = { .type = NLA_BINARY,
+ .len = IEEE80211_SMD_CTX_MAX_PN_LEN },
+ [NL80211_SMD_CTX_DL_ATTR_BA_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_ul_policy[NL80211_SMD_CTX_UL_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },
+ [NL80211_SMD_CTX_UL_ATTR_SN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_UL_ATTR_PN] = { .type = NLA_NESTED },
+ [NL80211_SMD_CTX_UL_ATTR_BA_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),
+};
+
+static const struct nla_policy
+nl80211_smd_ctx_policy[NL80211_SMD_CTX_ATTR_MAX + 1] = {
+ [NL80211_SMD_CTX_ATTR_DL] =
+ NLA_POLICY_NESTED(nl80211_smd_ctx_dl_policy),
+ [NL80211_SMD_CTX_ATTR_UL] =
+ NLA_POLICY_NESTED(nl80211_smd_ctx_ul_policy),
+ [NL80211_SMD_CTX_ATTR_DRV_DATA] =
+ NLA_POLICY_RANGE(NLA_BINARY,
+ 3, IEEE80211_MAX_DATA_LEN),
+};
+
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
.min = 0,
.max = 0xffff,
@@ -1098,6 +1154,15 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),
[NL80211_ATTR_STA_DUMP_LINK_STATS] = { .type = NLA_FLAG },
[NL80211_ATTR_FRAME_NO_STA] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_smd_params_policy),
+ [NL80211_ATTR_PEER_SMD_ENABLED] = { .type = NLA_FLAG },
+ [NL80211_ATTR_PEER_SMD_MAC_ADDR] = NLA_POLICY_ETH_ADDR,
+ [NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_CTX] = NLA_POLICY_NESTED(nl80211_smd_ctx_policy),
+ [NL80211_ATTR_SMD_CTX_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_SMD_CTX_TYPE_MAX),
};
/* policy for the key attributes */
@@ -7208,6 +7273,78 @@ static int nl80211_check_npca(struct cfg80211_registered_device *rdev,
return -EINVAL;
}
+static int nl80211_parse_smd_params(struct genl_info *info,
+ struct cfg80211_smd_params *smd_params)
+{
+ struct nlattr *smd_params_attr = info->attrs[NL80211_ATTR_SMD_PARAMS];
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct nlattr *tb[NL80211_SMD_PARAMS_ATTR_MAX + 1];
+ int err;
+
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_SMD)) {
+ GENL_SET_ERR_MSG(info, "SMD is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (!wdev->valid_links) {
+ GENL_SET_ERR_MSG(info, "SMD is not allowed without MLO");
+ return -EINVAL;
+ }
+
+ err = nla_parse_nested(tb, NL80211_SMD_PARAMS_ATTR_MAX,
+ smd_params_attr, nl80211_smd_params_policy,
+ NULL);
+ if (err) {
+ GENL_SET_ERR_MSG(info, "failed to parse SMD parameters");
+ return err;
+ }
+
+ if (!tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_TYPE] ||
+ !tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]) {
+ GENL_SET_ERR_MSG(info, "required SMD parameters are missing");
+ return -EINVAL;
+ }
+
+ memcpy(smd_params->smd_identifier,
+ nla_data(tb[NL80211_SMD_PARAMS_ATTR_IDENTIFIER]),
+ ETH_ALEN);
+
+ smd_params->smd_timeout =
+ nla_get_u16(tb[NL80211_SMD_PARAMS_ATTR_TIMEOUT]);
+
+ smd_params->dl_data_fwd =
+ !!tb[NL80211_SMD_PARAMS_ATTR_DL_DATA_FORWARDING];
+ if (smd_params->dl_data_fwd &&
+ !wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING)) {
+ GENL_SET_ERR_MSG(info,
+ "SMD DL packet forwarding is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ smd_params->max_num_of_peer_apmlds =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_MAX_PEER_APMLDS]);
+
+ smd_params->smd_type =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_TYPE]);
+
+ smd_params->ptk_mode =
+ nla_get_u8(tb[NL80211_SMD_PARAMS_ATTR_PTK_MODE]);
+
+ smd_params->neighbor_probing =
+ !!tb[NL80211_SMD_PARAMS_ATTR_NEIGHBOR_PROBING];
+
+ smd_params->smd_enabled = true;
+
+ return 0;
+}
+
static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -7489,6 +7626,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
/* FIXME: validate MLO/link-id against driver capabilities */
+ if (info->attrs[NL80211_ATTR_SMD_PARAMS]) {
+ err = nl80211_parse_smd_params(info, ¶ms->smd_params);
+ if (err)
+ goto out;
+ }
+
err = rdev_start_ap(rdev, dev, params);
if (!err) {
wdev->links[link_id].ap.beacon_interval = params->beacon_interval;
@@ -7608,6 +7751,10 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {
[NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_PREP_TARGET] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_EXEC_CURRENT] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_SMD_DL_DRAIN] = { .type = NLA_FLAG },
};
static int parse_station_flags(struct genl_info *info,
@@ -7674,11 +7821,17 @@ static int parse_station_flags(struct genl_info *info,
switch (iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ params->sta_flags_mask =
+ BIT(NL80211_STA_FLAG_SMD) |
+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);
+ fallthrough;
case NL80211_IFTYPE_P2P_GO:
- params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
- BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
- BIT(NL80211_STA_FLAG_WME) |
- BIT(NL80211_STA_FLAG_MFP);
+ params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) |
+ BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
+ BIT(NL80211_STA_FLAG_WME) |
+ BIT(NL80211_STA_FLAG_MFP);
break;
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
@@ -8819,7 +8972,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
/* When you run into this, adjust the code below for the new flag */
- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (statype) {
case CFG80211_STA_MESH_PEER_KERNEL:
@@ -8913,7 +9066,11 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
BIT(NL80211_STA_FLAG_WME) |
BIT(NL80211_STA_FLAG_MFP) |
- BIT(NL80211_STA_FLAG_SPP_AMSDU)))
+ BIT(NL80211_STA_FLAG_SPP_AMSDU) |
+ BIT(NL80211_STA_FLAG_SMD) |
+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN)))
return -EINVAL;
/* but authenticated/associated only if driver handles it */
@@ -9167,6 +9324,32 @@ static int nl80211_parse_sta_txpower_setting(struct genl_info *info,
return 0;
}
+static int nl80211_set_station_smd(struct genl_info *info,
+ struct station_parameters *params)
+{
+ struct nlattr *smd_mac;
+
+ params->smd_params.smd_sta =
+ !!info->attrs[NL80211_ATTR_PEER_SMD_ENABLED];
+
+ if (!params->smd_params.smd_sta)
+ return 0;
+
+ smd_mac = info->attrs[NL80211_ATTR_PEER_SMD_MAC_ADDR];
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] || !smd_mac)
+ return -EINVAL;
+
+ nla_memcpy(params->smd_params.smd_identifier, smd_mac, ETH_ALEN);
+
+ params->smd_params.dl_data_fwd =
+ !!info->attrs[NL80211_ATTR_PEER_SMD_DL_DATA_FORWARDING];
+
+ params->smd_params.roam_sta = !!info->attrs[NL80211_ATTR_SMD_ROAM_STA];
+
+ return 0;
+}
+
static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -9305,6 +9488,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
if (err)
return err;
+ err = nl80211_set_station_smd(info, ¶ms);
+ if (err)
+ return err;
+
/* Include parameters for TDLS peer (will check later) */
err = nl80211_set_station_tdls(info, ¶ms);
if (err)
@@ -9533,6 +9720,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
if (parse_station_flags(info, wdev->iftype, ¶ms))
return -EINVAL;
+ err = nl80211_set_station_smd(info, ¶ms);
+ if (err)
+ return err;
+
/* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT
* as userspace might just pass through the capabilities from the IEs
* directly, rather than enforcing this restriction and returning an
@@ -9566,7 +9757,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
/* When you run into this, adjust the code below for the new flag */
- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 8);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
@@ -19387,6 +19578,556 @@ nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)
return rdev_set_epcs(rdev, dev, val);
}
+static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids)
+{
+ size_t n = 0;
+
+ n += nla_total_size(0); /* ba_params nest header */
+ n += n_tids * (nla_total_size(0) + /* tid nest header */
+ nla_total_size(sizeof(u16)) + /* buff_size */
+ nla_total_size(sizeof(u8)) + /* policy */
+ nla_total_size(0) + /* amsdu_support */
+ nla_total_size(sizeof(u16)) + /* timeout */
+ nla_total_size(0) + /* ext_no_frag */
+ nla_total_size(sizeof(u8)) + /* ext_frag_lvl */
+ nla_total_size(sizeof(u16))); /* ext_buff_size */
+
+ return n;
+}
+
+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info)
+{
+ const struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ int n_dl_tids = 0, n_ul_tids = 0;
+ u8 pn_len = ctx->pn_len;
+ size_t n = 0;
+
+ /* count valid TIDs */
+ n_dl_tids = bitmap_weight(ctx->dl.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+ n_ul_tids = bitmap_weight(ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ n += nla_total_size(sizeof(u8)); /* ST type */
+
+ /* outer NL80211_ATTR_SMD_CTX nest */
+ n += nla_total_size(0); /* nest header */
+
+ /* DL nest */
+ n += nla_total_size(0); /* DL nest header */
+
+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* DL SN nest header */
+ n += n_dl_tids * nla_total_size(sizeof(u16)); /* DL SN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap))
+ n += nla_total_size(pn_len); /* DL PN */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap))
+ n += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids); /* DL BA */
+
+ /* UL nest */
+ n += nla_total_size(0); /* UL nest header */
+
+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* UL SN nest header */
+ n += n_ul_tids * nla_total_size(sizeof(u16)); /* UL SN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap)) {
+ n += nla_total_size(0); /* UL PN nest header */
+ n += n_ul_tids * nla_total_size(pn_len); /* UL PN */
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap))
+ n += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids); /* UL BA */
+
+ if (ctx->drv_ctx_size)
+ n += nla_total_size(ctx->drv_ctx_size); /* Driver data */
+
+ return n;
+}
+
+static int
+nl80211_put_smd_ctx_ba_params(struct sk_buff *msg,
+ const unsigned long *tid_bmap,
+ const struct ieee80211_smd_ctx_ba *ba_tids,
+ bool dl)
+{
+ u32 ba_params_attr = NL80211_SMD_CTX_DL_ATTR_BA_PARAMS;
+ struct nlattr *dl_ul_ba = NULL, *tid_ba = NULL;
+ u8 tid;
+
+ if (!dl)
+ ba_params_attr = NL80211_SMD_CTX_UL_ATTR_BA_PARAMS;
+
+ dl_ul_ba = nla_nest_start(msg, ba_params_attr);
+ if (!dl_ul_ba)
+ return -ENOBUFS;
+
+ for_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) {
+ const struct ieee80211_smd_ctx_ba *ba = &ba_tids[tid];
+
+ tid_ba = nla_nest_start(msg, tid + 1);
+ if (!tid_ba)
+ goto nla_fail;
+
+ if (nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE,
+ ba->buffer_size) ||
+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_POLICY,
+ ba->ba_policy) ||
+ (ba->amsdu_supported &&
+ nla_put_flag(msg,
+ NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT)) ||
+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_TIMEOUT,
+ ba->timeout) ||
+ (ba->ext_no_frag &&
+ nla_put_flag(msg, NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG)) ||
+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ ba->extfrag_level) ||
+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE,
+ ba->ext_buffer_size)) {
+ nla_nest_cancel(msg, tid_ba);
+ goto nla_fail;
+ }
+
+ nla_nest_end(msg, tid_ba);
+ }
+
+ nla_nest_end(msg, dl_ul_ba);
+ return 0;
+
+nla_fail:
+ nla_nest_cancel(msg, dl_ul_ba);
+ return -ENOBUFS;
+}
+
+int nl80211_put_smd_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;
+ struct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;
+ const struct ieee80211_smd_ctx *ctx;
+ u8 dl_tid_bmap = 0, ul_tid_bmap = 0;
+ bool pn_size_valid;
+ u8 tid;
+
+ /* ST Type */
+ if (nla_put_u8(msg, NL80211_ATTR_SMD_CTX_TYPE, st_info->type))
+ return -ENOBUFS;
+
+ smd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);
+ if (!smd_ctx)
+ return -ENOBUFS;
+
+ ctx = st_info->ctx;
+
+ /* Build DL context */
+ dl_tid_bmap = bitmap_read(ctx->dl.valid_tid_bmap, 0,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ dl = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_DL);
+ if (!dl)
+ goto nla_fail;
+
+ if (nla_put_u8(msg, NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,
+ dl_tid_bmap))
+ goto nla_fail_dl;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx->valid_ctx_bmap)) {
+ dl_sn = nla_nest_start(msg, NL80211_SMD_CTX_DL_ATTR_SN);
+ if (!dl_sn)
+ goto nla_fail_dl;
+
+ for_each_set_bit(tid, ctx->dl.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put_u16(msg, tid + 1, ctx->dl.sn[tid])) {
+ nla_nest_cancel(msg, dl_sn);
+ goto nla_fail_dl;
+ }
+ }
+ nla_nest_end(msg, dl_sn);
+ }
+
+ pn_size_valid =
+ ctx->pn_len && ctx->pn_len <= IEEE80211_SMD_CTX_MAX_PN_LEN;
+
+ if (pn_size_valid &&
+ test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap) &&
+ nla_put(msg, NL80211_SMD_CTX_DL_ATTR_PN, ctx->pn_len, ctx->dl.pn))
+ goto nla_fail_dl;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap) &&
+ nl80211_put_smd_ctx_ba_params(msg, ctx->dl.valid_tid_bmap,
+ ctx->dl.ba, true))
+ goto nla_fail_dl;
+
+ nla_nest_end(msg, dl);
+
+ /* Build UL context */
+ ul_tid_bmap = bitmap_read(ctx->ul.valid_tid_bmap, 0,
+ IEEE80211_SMD_CTX_NUM_TIDS);
+
+ ul = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_UL);
+ if (!ul)
+ goto nla_fail;
+
+ if (nla_put_u8(msg, NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,
+ ul_tid_bmap))
+ goto nla_fail_ul;
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx->valid_ctx_bmap)) {
+ ul_sn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_SN);
+ if (!ul_sn)
+ goto nla_fail_ul;
+
+ for_each_set_bit(tid, ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put_u16(msg, tid + 1, ctx->ul.sn[tid])) {
+ nla_nest_cancel(msg, ul_sn);
+ goto nla_fail_ul;
+ }
+ }
+ nla_nest_end(msg, ul_sn);
+ }
+
+ if (pn_size_valid &&
+ test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap)) {
+ ul_pn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_PN);
+ if (!ul_pn)
+ goto nla_fail_ul;
+
+ for_each_set_bit(tid, ctx->ul.valid_tid_bmap,
+ IEEE80211_SMD_CTX_NUM_TIDS) {
+ if (nla_put(msg, tid + 1, ctx->pn_len,
+ ctx->ul.pn[tid])) {
+ nla_nest_cancel(msg, ul_pn);
+ goto nla_fail_ul;
+ }
+ }
+ nla_nest_end(msg, ul_pn);
+ }
+
+ if (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx->valid_ctx_bmap) &&
+ nl80211_put_smd_ctx_ba_params(msg, ctx->ul.valid_tid_bmap,
+ ctx->ul.ba, false))
+ goto nla_fail_ul;
+
+ nla_nest_end(msg, ul);
+
+ /* Driver data blob */
+ if (ctx->drv_ctx_size &&
+ nla_put(msg, NL80211_SMD_CTX_ATTR_DRV_DATA, ctx->drv_ctx_size,
+ ctx->drv_ctx))
+ goto nla_fail;
+
+ nla_nest_end(msg, smd_ctx);
+
+ return 0;
+
+nla_fail_ul:
+ nla_nest_cancel(msg, ul);
+
+nla_fail_dl:
+ nla_nest_cancel(msg, dl);
+
+nla_fail:
+ nla_nest_cancel(msg, smd_ctx);
+ return -EINVAL;
+}
+
+static int
+nl80211_parse_smd_ctx_ba_params(struct nlattr *tb,
+ struct ieee80211_smd_ctx_ba *ba_tids,
+ unsigned long *valid_ctx_bmap)
+{
+ struct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1];
+ struct ieee80211_smd_ctx_ba *ba;
+ struct nlattr *ba_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ if (!tb)
+ return 0;
+
+ nla_for_each_nested(ba_attr, tb, rem) {
+ tid = nla_type(ba_attr) - 1;
+ if (tid < 0 || tid >= IEEE80211_SMD_CTX_NUM_TIDS)
+ return -EINVAL;
+
+ if (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX,
+ ba_attr, nl80211_smd_ctx_ba_policy,
+ NULL))
+ return -EINVAL;
+
+ ba = &ba_tids[tid];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE])
+ ba->buffer_size =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE]);
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY])
+ ba->ba_policy =
+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY]);
+
+ ba->amsdu_supported =
+ !!ba_tb[NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT])
+ ba->timeout =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT]);
+
+ ba->ext_no_frag = !!ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG];
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL])
+ ba->extfrag_level =
+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL]);
+
+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE])
+ ba->ext_buffer_size =
+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]);
+
+ n_tids++;
+ }
+
+ if (!n_tids)
+ return -EINVAL;
+
+ set_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, valid_ctx_bmap);
+
+ return 0;
+}
+
+static int nl80211_parse_smd_ctx(struct genl_info *info,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct nlattr *dl_tb[NL80211_SMD_CTX_DL_ATTR_MAX + 1];
+ struct nlattr *ul_tb[NL80211_SMD_CTX_UL_ATTR_MAX + 1];
+ struct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];
+ struct ieee80211_smd_ctx *ctx;
+ struct nlattr *bmap_attr;
+ size_t drv_ctx_size = 0;
+
+ st_info->type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]);
+
+ if (nla_parse_nested(tb, NL80211_SMD_CTX_ATTR_MAX,
+ info->attrs[NL80211_ATTR_SMD_CTX],
+ nl80211_smd_ctx_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse SMD context");
+ return -EINVAL;
+ }
+
+ if (tb[NL80211_SMD_CTX_ATTR_DRV_DATA])
+ drv_ctx_size = nla_len(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]);
+
+ ctx = kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ st_info->ctx = ctx;
+
+ /* DL Context */
+ if (tb[NL80211_SMD_CTX_ATTR_DL]) {
+ struct nlattr *ba_attr;
+
+ if (nla_parse_nested(dl_tb, NL80211_SMD_CTX_DL_ATTR_MAX,
+ tb[NL80211_SMD_CTX_ATTR_DL],
+ nl80211_smd_ctx_dl_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse DL context");
+ goto err_free_ctx;
+ }
+
+ bmap_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP];
+ if (bmap_attr)
+ bitmap_write(ctx->dl.valid_tid_bmap,
+ nla_get_u8(bmap_attr),
+ 0, IEEE80211_SMD_CTX_NUM_TIDS);
+
+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ dl_tb[NL80211_SMD_CTX_DL_ATTR_SN],
+ rem) {
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid DL SN tid");
+ goto err_free_ctx;
+ }
+
+ if (nla_len(sn_attr) != sizeof(u16)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid DL SN len");
+ goto err_free_ctx;
+ }
+
+ ctx->dl.sn[tid] = nla_get_u16(sn_attr);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty DL SN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_DL_SN,
+ ctx->valid_ctx_bmap);
+ }
+
+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]) {
+ const u8 *pn_data =
+ nla_data(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);
+
+ ctx->pn_len =
+ nla_len(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);
+
+ memcpy(ctx->dl.pn, pn_data, ctx->pn_len);
+ set_bit(IEEE80211_SMD_CTX_VALID_PN,
+ ctx->valid_ctx_bmap);
+ }
+
+ ba_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS];
+ if (ba_attr &&
+ nl80211_parse_smd_ctx_ba_params(ba_attr, ctx->dl.ba,
+ ctx->valid_ctx_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse DL BlockAck params");
+ goto err_free_ctx;
+ }
+ }
+
+ /* UL Context */
+ if (tb[NL80211_SMD_CTX_ATTR_UL]) {
+ struct nlattr *ba_attr;
+
+ if (nla_parse_nested(ul_tb, NL80211_SMD_CTX_UL_ATTR_MAX,
+ tb[NL80211_SMD_CTX_ATTR_UL],
+ nl80211_smd_ctx_ul_policy, NULL)) {
+ GENL_SET_ERR_MSG(info, "failed to parse UL context");
+ goto err_free_ctx;
+ }
+
+ bmap_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP];
+ if (bmap_attr)
+ bitmap_write(ctx->ul.valid_tid_bmap,
+ nla_get_u8(bmap_attr),
+ 0, IEEE80211_SMD_CTX_NUM_TIDS);
+
+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ ul_tb[NL80211_SMD_CTX_UL_ATTR_SN],
+ rem) {
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL SN tid");
+ goto err_free_ctx;
+ }
+
+ if (nla_len(sn_attr) != sizeof(u16)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL SN len");
+ goto err_free_ctx;
+ }
+
+ ctx->ul.sn[tid] = nla_get_u16(sn_attr);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL SN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_UL_SN,
+ ctx->valid_ctx_bmap);
+ }
+
+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_PN]) {
+ struct nlattr *pn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(pn_attr,
+ ul_tb[NL80211_SMD_CTX_UL_ATTR_PN],
+ rem) {
+ u8 pn_len;
+
+ tid = nla_type(pn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL PN tid");
+ goto err_free_ctx;
+ }
+
+ /*
+ * PN length must be the same for all DL and
+ * UL TIDs.
+ */
+ pn_len = nla_len(pn_attr);
+ if (pn_len > IEEE80211_SMD_CTX_MAX_PN_LEN ||
+ (ctx->pn_len && pn_len != ctx->pn_len)) {
+ GENL_SET_ERR_MSG(info,
+ "invalid PN length");
+ goto err_free_ctx;
+ }
+ ctx->pn_len = pn_len;
+
+ memcpy(ctx->ul.pn[tid], nla_data(pn_attr),
+ ctx->pn_len);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL PN nesting");
+ goto err_free_ctx;
+ }
+
+ set_bit(IEEE80211_SMD_CTX_VALID_PN,
+ ctx->valid_ctx_bmap);
+ }
+
+ ba_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS];
+ if (ba_attr &&
+ nl80211_parse_smd_ctx_ba_params(ba_attr, ctx->ul.ba,
+ ctx->valid_ctx_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse UL BlockAck params");
+ goto err_free_ctx;
+ }
+ }
+
+ /* Driver data */
+ if (tb[NL80211_SMD_CTX_ATTR_DRV_DATA]) {
+ ctx->drv_ctx_size = drv_ctx_size;
+ memcpy(ctx->drv_ctx,
+ nla_data(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]),
+ drv_ctx_size);
+ }
+
+ return 0;
+
+err_free_ctx:
+ kfree(ctx);
+ st_info->ctx = NULL;
+ return -EINVAL;
+}
+
#define NL80211_FLAG_NEED_WIPHY 0x01
#define NL80211_FLAG_NEED_NETDEV 0x02
#define NL80211_FLAG_NEED_RTNL 0x04
@@ -19728,6 +20469,128 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)
return err;
}
+static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct cfg80211_smd_transition_info st_info = {};
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ const u8 *addr;
+ int err;
+
+ if (!rdev->ops->set_smd_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+
+ err = nl80211_parse_smd_ctx(info, &st_info);
+ if (err)
+ return err;
+
+ /* drivers must copy @ctx for any deferred processing */
+ err = rdev_set_smd_ctx(rdev, wdev, addr, &st_info);
+
+ kfree(st_info.ctx);
+ return err;
+}
+
+static struct cfg80211_smd_get_ctx_pending *
+__cfg80211_get_smd_sta_pending_ctx(struct wireless_dev *wdev, const u8 *addr)
+{
+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *tmp;
+
+ lockdep_assert_held(&wdev->smd_get_ctx_lock);
+
+ list_for_each_entry(tmp, &wdev->smd_get_ctx_pending_list, list) {
+ if (ether_addr_equal(tmp->sta_addr, addr)) {
+ pending = tmp;
+ break;
+ }
+ }
+
+ return pending;
+}
+
+static int nl80211_get_smd_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_smd_get_ctx_pending *pending;
+ enum nl80211_smd_ctx_type type;
+ const u8 *addr = NULL;
+ int err;
+
+ if (!rdev->ops->get_smd_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+ type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]);
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ if (__cfg80211_get_smd_sta_pending_ctx(wdev, addr)) {
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+ return -EBUSY;
+ }
+ /* safe to unlock, concurrent commands are serialized by wiphy mutex */
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ pending = kzalloc_obj(*pending);
+ if (!pending)
+ return -ENOMEM;
+
+ memcpy(pending->sta_addr, addr, ETH_ALEN);
+
+ /*
+ * Take reference and add to the list before calling the driver to avoid
+ * race. Upon success, the reference is released while reporting back
+ * the context or in the list removal and drain path.
+ */
+ dev_hold(wdev->netdev);
+
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ list_add_tail(&pending->list, &wdev->smd_get_ctx_pending_list);
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+
+ err = rdev_get_smd_ctx(rdev, wdev, addr, type);
+ if (err) {
+ /* revert upon failure */
+ spin_lock_bh(&wdev->smd_get_ctx_lock);
+ pending = __cfg80211_get_smd_sta_pending_ctx(wdev, addr);
+ if (pending) {
+ list_del(&pending->list);
+ kfree(pending);
+ dev_put(wdev->netdev);
+ }
+ spin_unlock_bh(&wdev->smd_get_ctx_lock);
+ return err;
+ }
+
+ /* Reply will arrive via cfg80211_get_smd_ctx_done() */
+ return 0;
+}
+
#define SELECTOR(__sel, name, value) \
((__sel) == (value)) ? NL80211_IFL_SEL_##name :
int __missing_selector(void);
@@ -20629,6 +21492,19 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV_UP),
},
+ {
+ .cmd = NL80211_CMD_SET_SMD_CTX,
+ .doit = nl80211_set_smd_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_CLEAR_SKB),
+ },
+ {
+ .cmd = NL80211_CMD_GET_SMD_CTX,
+ .doit = nl80211_get_smd_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
@@ -22012,10 +22888,14 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
struct cfg80211_rx_info *info, gfp_t gfp)
{
struct net_device *netdev = wdev->netdev;
+ int st_roaming_data_len = 0;
struct sk_buff *msg;
void *hdr;
- msg = nlmsg_new(100 + info->len, gfp);
+ if (info->st_info.ctx)
+ st_roaming_data_len = nl80211_smd_ctx_nl_size(&info->st_info);
+
+ msg = nlmsg_new(100 + info->len + st_roaming_data_len, gfp);
if (!msg)
return -ENOMEM;
@@ -22051,6 +22931,10 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
nla_put_flag(msg, NL80211_ATTR_FRAME_NO_STA)))
goto nla_put_failure;
+ if (st_roaming_data_len &&
+ nl80211_put_smd_ctx(msg, &info->st_info))
+ goto nla_put_failure;
+
genlmsg_end(msg, hdr);
return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
@@ -23648,6 +24532,47 @@ void cfg80211_nan_channel_evac(struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_nan_channel_evac);
+void
+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+ struct net_device *dev = wdev->netdev;
+ size_t msg_len = NLMSG_DEFAULT_SIZE;
+ struct sk_buff *msg;
+ void *hdr;
+
+ if (st_info->ctx)
+ msg_len = 100 + nl80211_smd_ctx_nl_size(st_info) +
+ nla_total_size(ETH_ALEN); /* MLD address */
+
+ msg = nlmsg_new(msg_len, GFP_ATOMIC);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SMD_CTX_EVENT);
+ if (!hdr)
+ goto nla_put_failure;
+
+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+ nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
+ nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, sta_addr))
+ goto nla_put_failure;
+
+ if (st_info->ctx && nl80211_put_smd_ctx(msg, st_info))
+ goto nla_put_failure;
+
+ genlmsg_end(msg, hdr);
+
+ genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+ NL80211_MCGRP_MLME, GFP_ATOMIC);
+ return;
+
+nla_put_failure:
+ nlmsg_free(msg);
+}
+
/* initialisation/exit functions */
int __init nl80211_init(void)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index bdb065d140549..2855d30ba3546 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -129,4 +129,13 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
void nl80211_mlo_reconf_add_done(struct net_device *dev,
struct cfg80211_mlo_reconf_done_data *data);
+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info);
+int nl80211_put_smd_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info);
+
+void
+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_WIRELESS_NL80211_H */
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 46849fe8d0b39..ab520560f6043 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1636,4 +1636,32 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_smd_ctx(&rdev->wiphy, wdev, addr, st_info);
+ if (rdev->ops->set_smd_ctx)
+ ret = rdev->ops->set_smd_ctx(&rdev->wiphy, wdev, addr, st_info);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
+static inline int rdev_get_smd_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_smd_ctx_type type)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_get_smd_ctx(&rdev->wiphy, wdev, addr, type);
+ if (rdev->ops->get_smd_ctx)
+ ret = rdev->ops->get_smd_ctx(&rdev->wiphy, wdev, addr, type);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 8c2a91b85c396..a2662919b8f08 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -4405,6 +4405,79 @@ TRACE_EVENT(cfg80211_nan_channel_evac,
TP_printk(WDEV_PR_FMT ", " WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
WDEV_PR_ARG, WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
);
+
+TRACE_EVENT(rdev_set_smd_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info),
+
+ TP_ARGS(wiphy, wdev, addr, st_info),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ WDEV_ENTRY
+ MAC_ENTRY(sta_addr)
+ __field(u8, st_type)
+ __field(unsigned int, num_tids)
+ __dynamic_array(unsigned long, tx_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ __dynamic_array(unsigned long, rx_tid_bitmap,
+ BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS))
+ ),
+
+ TP_fast_assign(
+ struct ieee80211_smd_ctx *ctx = st_info->ctx;
+ unsigned long sz;
+
+ WIPHY_ASSIGN;
+ WDEV_ASSIGN;
+ MAC_ASSIGN(sta_addr, addr);
+ __entry->st_type = st_info->type;
+
+ __entry->num_tids = IEEE80211_SMD_CTX_NUM_TIDS;
+ sz = BITS_TO_LONGS(__entry->num_tids) * sizeof(unsigned long);
+
+ memcpy(__get_dynamic_array(tx_tid_bitmap),
+ ctx->dl.valid_tid_bmap, sz);
+ memcpy(__get_dynamic_array(rx_tid_bitmap),
+ ctx->ul.valid_tid_bmap, sz);
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT
+ ", sta=%pM, ST type=%u DL TIDs: %*pb, UL TIDs: %*pb",
+ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->sta_addr,
+ __entry->st_type,
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(tx_tid_bitmap),
+ __entry->num_tids,
+ (unsigned long *)__get_dynamic_array(rx_tid_bitmap))
+);
+
+TRACE_EVENT(rdev_get_smd_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_smd_ctx_type type),
+
+ TP_ARGS(wiphy, wdev, addr, type),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ WDEV_ENTRY
+ MAC_ENTRY(sta_addr)
+ __field(u8, st_type)
+ ),
+
+ TP_fast_assign(
+ WIPHY_ASSIGN;
+ WDEV_ASSIGN;
+ MAC_ASSIGN(sta_addr, addr);
+ __entry->st_type = type;
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT
+ ", sta=%pM, ST type=%u",
+ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->sta_addr,
+ __entry->st_type)
+);
+
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
|
| 21/3 | 2026/09/26 05:48 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 51277 output: 18 thoughts: 4059 Thoughts: **KMSAN Analysis of nl80211 Patch** Okay, let's break this down systematically. My primary concern here is identifying potential uninitialized memory reads that KMSAN would be good at catching, beyond the capabilities of KASAN or other standard tools. Following the guidelines, I need to focus on where the patch introduces kernel structures sent to userspace, conditional logic dependent on uninitialized variables, complex data structure initialization, and any logic that might lead to reading beyond the bounds of buffers. The core of this patch seems to revolve around the `cfg80211_smd_transition_info` structure and its associated `ieee80211_smd_ctx`. The critical functions are `nl80211_put_smd_ctx` (which sends information to userspace via netlink) and `nl80211_parse_smd_ctx` (which parses information received from userspace). The key is the `st_info->ctx`, which points to a `struct ieee80211_smd_ctx`. It appears that in some cases, the driver *allocates* and *initializes* this `smd_ctx`, but in other cases, `kzalloc` is used. Here's my thought process: 1. **Data Flow:** The data flows from the driver (or, in this case, a response from user space) through `cfg80211_get_smd_ctx_done` or `cfg80211_parse_smd_ctx`, then to `nl80211_put_smd_ctx`, which then prepares a netlink message. This message includes data from the `ieee80211_smd_ctx` struct. 2. **Allocation:** The `ieee80211_smd_ctx` is allocated in the driver in some cases, and `kzalloc` is used, so data fields initialized to zero in the `nl80211_parse_smd_ctx` path, at least initially. 3. **Kernel to User Space:** The critical part for KMSAN is where this `ieee80211_smd_ctx` is *sent* to user space, specifically via `nl80211_put_smd_ctx`. This function iterates through various fields within `st_info->ctx` (which *is* a pointer to the driver allocated data). The code specifically copies `ctx->dl.valid_tid_bmap` and other data to user space. 4. **Potential Vulnerabilities:** The primary concern is if the driver *fails to fully initialize* the `ieee80211_smd_ctx` before passing it to `nl80211_put_smd_ctx`. However, since `kzalloc` is used, the code is initialized to 0. The patch does read all potentially uninitialized data. The key is determining *when* the driver allocates the `ieee80211_smd_ctx`. Is there a case where the driver doesn't properly initialize *all* the fields before passing it to the mac80211 stack? 5. **Tracepoints:** The tracepoints show us that the `valid_tid_bmap` is being copied. Therefore, since the data is initialized through `kzalloc`, and all potentially uninitialized data is read, I do not believe this patch requires KMSAN, as there are no obvious uninitialized memory reads. |
| 22/3 | 2026/09/26 05:49 | tool | grepper |
0mArgs:{
"Expression": "smd_ctx"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 609 lines.\nUse more precise expression if possible.\n\ninclude/linux/ieee80211-uhr.h=647=struct ieee80211_uhr_mode_change_tuple {\n--\ninclude/linux/ieee80211-uhr.h-672-/**\ninclude/linux/ieee80211-uhr.h:673: * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL\ninclude/linux/ieee80211-uhr.h-674- *\n--\ninclude/linux/ieee80211-uhr.h-684- */\ninclude/linux/ieee80211-uhr.h:685:struct ieee80211_smd_ctx_ba {\ninclude/linux/ieee80211-uhr.h-686-\tbool amsdu_supported;\n--\ninclude/linux/ieee80211-uhr.h-695-/**\ninclude/linux/ieee80211-uhr.h:696: * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer\ninclude/linux/ieee80211-uhr.h-697- *\tIEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)\n--\ninclude/linux/ieee80211-uhr.h-716- */\ninclude/linux/ieee80211-uhr.h:717:struct ieee80211_smd_ctx {\ninclude/linux/ieee80211-uhr.h-718-\tDECLARE_BITMAP(valid_ctx_bmap, IEEE80211_SMD_CTX_NUM_VALID_CTX);\n--\ninclude/linux/ieee80211-uhr.h-724-\t\tu8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN];\ninclude/linux/ieee80211-uhr.h:725:\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\ninclude/linux/ieee80211-uhr.h-726-\t} dl;\n--\ninclude/linux/ieee80211-uhr.h-730-\t\tu8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN];\ninclude/linux/ieee80211-uhr.h:731:\t\tstruct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS];\ninclude/linux/ieee80211-uhr.h-732-\t} ul;\n--\ninclude/net/cfg80211.h=4898=struct cfg80211_smd_transition_info {\ninclude/net/cfg80211.h:4899:\tstruct ieee80211_smd_ctx *ctx;\ninclude/net/cfg80211.h:4900:\tenum nl80211_smd_ctx_type type;\ninclude/net/cfg80211.h-4901-};\n--\ninclude/net/cfg80211.h=4908=struct cfg80211_smd_get_ctx_pending {\n--\ninclude/net/cfg80211.h-5344- *\ninclude/net/cfg80211.h:5345: * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info-\u003ectx is\ninclude/net/cfg80211.h-5346- *\tfreed immediately after this call returns; drivers must copy\n--\ninclude/net/cfg80211.h-5348- *\ninclude/net/cfg80211.h:5349: * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD.\ninclude/net/cfg80211.h-5350- */\ninclude/net/cfg80211.h=5351=struct cfg80211_ops {\n--\ninclude/net/cfg80211.h-5727-\tvoid\t(*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\ninclude/net/cfg80211.h:5728:\tint\t(*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\ninclude/net/cfg80211.h-5729-\t\t\t const u8 *addr,\ninclude/net/cfg80211.h-5730-\t\t\t struct cfg80211_smd_transition_info *st_info);\ninclude/net/cfg80211.h:5731:\tint\t(*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,\ninclude/net/cfg80211.h-5732-\t\t\t const u8 *addr,\ninclude/net/cfg80211.h:5733:\t\t\t enum nl80211_smd_ctx_type type);\ninclude/net/cfg80211.h-5734-};\n--\ninclude/net/cfg80211.h=7219=enum ieee80211_ap_reg_power {\n--\ninclude/net/cfg80211.h-7305- * @radio_mask: Bitmask of radios that this interface is allowed to operate on.\ninclude/net/cfg80211.h:7306: * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests.\ninclude/net/cfg80211.h:7307: * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests.\ninclude/net/cfg80211.h-7308- */\n--\ninclude/net/cfg80211.h=11104=void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,\n--\ninclude/net/cfg80211.h-11109-/**\ninclude/net/cfg80211.h:11110: * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the\ninclude/net/cfg80211.h-11111- *\tcfg80211_smd_get_ctx_pending list.\n--\ninclude/net/cfg80211.h-11120- */\ninclude/net/cfg80211.h:11121:void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\ninclude/net/cfg80211.h-11122-\t\t\t\t const u8 *addr);\n--\ninclude/net/cfg80211.h-11124-/**\ninclude/net/cfg80211.h:11125: * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211\ninclude/net/cfg80211.h-11126- * @wdev: wireless device that handled the request\n--\ninclude/net/cfg80211.h-11130- *\ninclude/net/cfg80211.h:11131: * Called via ieee80211_get_smd_ctx_done after async driver context collection\ninclude/net/cfg80211.h-11132- * completes. Finds the matching pending request and sends a multicast\n--\ninclude/net/cfg80211.h-11136- */\ninclude/net/cfg80211.h:11137:void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\ninclude/net/cfg80211.h-11138-\t\t\t const u8 *sta_addr,\n--\ninclude/net/mac80211.h=1714=enum mac80211_rx_encoding {\n--\ninclude/net/mac80211.h-1737- *\tOnly reported by devices that have timestamping enabled.\ninclude/net/mac80211.h:1738: * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information.\ninclude/net/mac80211.h-1739- *\tOnly needed for ST Preparation Request and ST Execution Request action\ninclude/net/mac80211.h-1740- *\tframes. The pointer will be consumed by mac80211; must be kmalloc-ed.\ninclude/net/mac80211.h:1741: *\tIndicated by @smd_ctx_valid.\ninclude/net/mac80211.h-1742- * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use\n--\ninclude/net/mac80211.h-1781- *\tcorrect link per vif.\ninclude/net/mac80211.h:1782: * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag\ninclude/net/mac80211.h-1783- *\tis used only for ST Preparation or ST Execution Request frames.\n--\ninclude/net/mac80211.h=1785=struct ieee80211_rx_status {\n--\ninclude/net/mac80211.h-1789-\t\tktime_t ack_tx_hwtstamp;\ninclude/net/mac80211.h:1790:\t\tstruct ieee80211_smd_ctx *smd_ctx;\ninclude/net/mac80211.h-1791-\t};\n--\ninclude/net/mac80211.h-1824-\tu8 link_id:4,\ninclude/net/mac80211.h:1825:\t smd_ctx_valid:1;\ninclude/net/mac80211.h-1826-};\n--\ninclude/net/mac80211.h=4113=enum ieee80211_sta_smd_state {\n--\ninclude/net/mac80211.h-4788- *\tThe callback can sleep.\ninclude/net/mac80211.h:4789: * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on\ninclude/net/mac80211.h-4790- *\tthe target AP MLD side to program dynamic context.\ninclude/net/mac80211.h:4791: * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in\ninclude/net/mac80211.h-4792- *\tthe current AP MLD side on behalf of the target AP MLD to collect\n--\ninclude/net/mac80211.h=4797=struct ieee80211_ops {\n--\ninclude/net/mac80211.h-5201-\t\t\t enum ieee80211_sta_smd_state new_state);\ninclude/net/mac80211.h:5202:\tint (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\ninclude/net/mac80211.h-5203-\t\t\t struct ieee80211_sta *sta,\ninclude/net/mac80211.h-5204-\t\t\t struct cfg80211_smd_transition_info *st_info);\ninclude/net/mac80211.h:5205:\tint (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\ninclude/net/mac80211.h-5206-\t\t\t struct ieee80211_sta *sta,\ninclude/net/mac80211.h:5207:\t\t\t enum nl80211_smd_ctx_type type);\ninclude/net/mac80211.h-5208-};\n--\ninclude/net/mac80211.h=8276=int ieee80211_encrypt_tx_skb(struct sk_buff *skb);\n--\ninclude/net/mac80211.h-8278-/**\ninclude/net/mac80211.h:8279: * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211\ninclude/net/mac80211.h-8280- * @vif: virtual interface\n--\ninclude/net/mac80211.h-8284- */\ninclude/net/mac80211.h:8285:void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\ninclude/net/mac80211.h-8286-\t\t\t\tconst u8 *sta_addr,\n--\ninclude/uapi/linux/nl80211.h=1445=enum nl80211_commands {\n--\ninclude/uapi/linux/nl80211.h-3232- *\tTransition data. Used with %NL80211_CMD_SET_SMD_CTX and\ninclude/uapi/linux/nl80211.h:3233: *\t%NL80211_CMD_SMD_CTX_EVENT. See \u0026enum nl80211_smd_ctx.\ninclude/uapi/linux/nl80211.h-3234- * @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context.\n--\ninclude/uapi/linux/nl80211.h=9273=enum nl80211_smd_params_attrs {\n--\ninclude/uapi/linux/nl80211.h-9288-/**\ninclude/uapi/linux/nl80211.h:9289: * enum nl80211_smd_ctx_type - SMD Request Type values\ninclude/uapi/linux/nl80211.h-9290- *\n--\ninclude/uapi/linux/nl80211.h-9297- */\ninclude/uapi/linux/nl80211.h:9298:enum nl80211_smd_ctx_type {\ninclude/uapi/linux/nl80211.h-9299-\tNL80211_SMD_CTX_TYPE_PREP,\n--\ninclude/uapi/linux/nl80211.h-9306-/**\ninclude/uapi/linux/nl80211.h:9307: * enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes\ninclude/uapi/linux/nl80211.h-9308- *\n--\ninclude/uapi/linux/nl80211.h-9325- */\ninclude/uapi/linux/nl80211.h:9326:enum nl80211_smd_ctx_ba_param {\ninclude/uapi/linux/nl80211.h-9327-\t__NL80211_SMD_CTX_BA_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9340-/**\ninclude/uapi/linux/nl80211.h:9341: * enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction\ninclude/uapi/linux/nl80211.h-9342- *\n--\ninclude/uapi/linux/nl80211.h-9349- * @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters,\ninclude/uapi/linux/nl80211.h:9350: *\tnested array of TIDs (uses \u0026enum nl80211_smd_ctx_ba_param).\ninclude/uapi/linux/nl80211.h-9351- * @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally.\n--\ninclude/uapi/linux/nl80211.h-9355- */\ninclude/uapi/linux/nl80211.h:9356:enum nl80211_smd_ctx_dl {\ninclude/uapi/linux/nl80211.h-9357-\t__NL80211_SMD_CTX_DL_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9367-/**\ninclude/uapi/linux/nl80211.h:9368: * enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction\ninclude/uapi/linux/nl80211.h-9369- *\n--\ninclude/uapi/linux/nl80211.h-9376- * @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters\ninclude/uapi/linux/nl80211.h:9377: *\t(uses \u0026enum nl80211_smd_ctx_ba_param).\ninclude/uapi/linux/nl80211.h-9378- * @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally.\n--\ninclude/uapi/linux/nl80211.h-9382- */\ninclude/uapi/linux/nl80211.h:9383:enum nl80211_smd_ctx_ul {\ninclude/uapi/linux/nl80211.h-9384-\t__NL80211_SMD_CTX_UL_ATTR_INVALID,\n--\ninclude/uapi/linux/nl80211.h-9394-/**\ninclude/uapi/linux/nl80211.h:9395: * enum nl80211_smd_ctx - SMD Context information\ninclude/uapi/linux/nl80211.h-9396- *\n--\ninclude/uapi/linux/nl80211.h-9404- * @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters.\ninclude/uapi/linux/nl80211.h:9405: *\tSee \u0026enum nl80211_smd_ctx_dl.\ninclude/uapi/linux/nl80211.h-9406- * @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters.\ninclude/uapi/linux/nl80211.h:9407: *\tSee \u0026enum nl80211_smd_ctx_ul.\ninclude/uapi/linux/nl80211.h-9408- * @NL80211_SMD_CTX_ATTR_DRV_DATA: Optional (binary) driver-specific blob.\n--\ninclude/uapi/linux/nl80211.h-9414- */\ninclude/uapi/linux/nl80211.h:9415:enum nl80211_smd_ctx {\ninclude/uapi/linux/nl80211.h-9416-\t__NL80211_SMD_CTX_ATTR_INVALID,\n--\nnet/mac80211/cfg.c=6073=ieee80211_set_peer_nan_sched(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-6083-\nnet/mac80211/cfg.c:6084:static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\nnet/mac80211/cfg.c-6085-\t\t\t\t const u8 *addr,\n--\nnet/mac80211/cfg.c-6105-\nnet/mac80211/cfg.c:6106:\treturn drv_set_smd_ctx(local, sdata, \u0026sta-\u003esta, st_info);\nnet/mac80211/cfg.c-6107-}\nnet/mac80211/cfg.c-6108-\nnet/mac80211/cfg.c:6109:static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,\nnet/mac80211/cfg.c-6110-\t\t\t\t const u8 *addr,\nnet/mac80211/cfg.c:6111:\t\t\t\t enum nl80211_smd_ctx_type type)\nnet/mac80211/cfg.c-6112-{\n--\nnet/mac80211/cfg.c-6130-\nnet/mac80211/cfg.c:6131:\treturn drv_get_smd_ctx(local, sdata, \u0026sta-\u003esta, type);\nnet/mac80211/cfg.c-6132-}\nnet/mac80211/cfg.c-6133-\nnet/mac80211/cfg.c:6134:void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif,\nnet/mac80211/cfg.c-6135-\t\t\t\tconst u8 *sta_addr,\n--\nnet/mac80211/cfg.c-6139-\nnet/mac80211/cfg.c:6140:\tcfg80211_get_smd_ctx_done(\u0026sdata-\u003ewdev, sta_addr, st_info);\nnet/mac80211/cfg.c-6141-}\nnet/mac80211/cfg.c:6142:EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);\nnet/mac80211/cfg.c-6143-\nnet/mac80211/cfg.c=6144=const struct cfg80211_ops mac80211_config_ops = {\n--\nnet/mac80211/cfg.c-6261-\t.nan_set_peer_sched = ieee80211_set_peer_nan_sched,\nnet/mac80211/cfg.c:6262:\t.set_smd_ctx = ieee80211_set_smd_ctx,\nnet/mac80211/cfg.c:6263:\t.get_smd_ctx = ieee80211_get_smd_ctx,\nnet/mac80211/cfg.c-6264-};\n--\nnet/mac80211/driver-ops.h=1817=int drv_sta_smd_state(struct ieee80211_local *local,\n--\nnet/mac80211/driver-ops.h-1822-\nnet/mac80211/driver-ops.h:1823:static inline int drv_set_smd_ctx(struct ieee80211_local *local,\nnet/mac80211/driver-ops.h-1824-\t\t\t\t struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/driver-ops.h-1829-\nnet/mac80211/driver-ops.h:1830:\tif (!local-\u003eops-\u003eset_smd_ctx)\nnet/mac80211/driver-ops.h-1831-\t\treturn -EOPNOTSUPP;\n--\nnet/mac80211/driver-ops.h-1839-\nnet/mac80211/driver-ops.h:1840:\ttrace_drv_set_smd_ctx(local, sdata, sta, st_info);\nnet/mac80211/driver-ops.h:1841:\tret = local-\u003eops-\u003eset_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, st_info);\nnet/mac80211/driver-ops.h-1842-\ttrace_drv_return_int(local, ret);\n--\nnet/mac80211/driver-ops.h-1846-\nnet/mac80211/driver-ops.h:1847:static inline int drv_get_smd_ctx(struct ieee80211_local *local,\nnet/mac80211/driver-ops.h-1848-\t\t\t\t struct ieee80211_sub_if_data *sdata,\nnet/mac80211/driver-ops.h-1849-\t\t\t\t struct ieee80211_sta *sta,\nnet/mac80211/driver-ops.h:1850:\t\t\t\t enum nl80211_smd_ctx_type type)\nnet/mac80211/driver-ops.h-1851-{\n--\nnet/mac80211/driver-ops.h-1853-\nnet/mac80211/driver-ops.h:1854:\tif (!sdata || !local-\u003eops-\u003eget_smd_ctx)\nnet/mac80211/driver-ops.h-1855-\t\treturn -EOPNOTSUPP;\n--\nnet/mac80211/driver-ops.h-1863-\nnet/mac80211/driver-ops.h:1864:\ttrace_drv_get_smd_ctx(local, sdata, sta, type);\nnet/mac80211/driver-ops.h:1865:\tret = local-\u003eops-\u003eget_smd_ctx(\u0026local-\u003ehw, \u0026sdata-\u003evif, sta, type);\nnet/mac80211/driver-ops.h-1866-\ttrace_drv_return_int(local, ret);\n--\nnet/mac80211/ieee80211_i.h=231=struct ieee80211_rx_data {\n--\nnet/mac80211/ieee80211_i.h-271-\nnet/mac80211/ieee80211_i.h:272:\tstruct ieee80211_smd_ctx *smd_ctx;\nnet/mac80211/ieee80211_i.h-273-};\n--\nnet/mac80211/rx.c=3974=ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,\n--\nnet/mac80211/rx.c-3979-\nnet/mac80211/rx.c:3980:\tif (!rx-\u003esmd_ctx)\nnet/mac80211/rx.c-3981-\t\treturn;\n--\nnet/mac80211/rx.c-3985-\tinfo-\u003est_info.type = type;\nnet/mac80211/rx.c:3986:\tinfo-\u003est_info.ctx = rx-\u003esmd_ctx;\nnet/mac80211/rx.c-3987-}\n--\nnet/mac80211/rx.c=5610=void ieee80211_rx_list(struct ieee80211_hw *hw,\n--\nnet/mac80211/rx.c-5618-\tstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-\u003edata;\nnet/mac80211/rx.c:5619:\tstruct ieee80211_smd_ctx *smd_ctx = NULL;\nnet/mac80211/rx.c-5620-\tstruct ieee80211_rx_data rx = {};\n--\nnet/mac80211/rx.c-5622-\t/* cache the pointer to free it later */\nnet/mac80211/rx.c:5623:\tif (status-\u003esmd_ctx_valid) {\nnet/mac80211/rx.c:5624:\t\tsmd_ctx = status-\u003esmd_ctx;\nnet/mac80211/rx.c:5625:\t\tstatus-\u003esmd_ctx = NULL;\nnet/mac80211/rx.c:5626:\t\tstatus-\u003esmd_ctx_valid = false;\nnet/mac80211/rx.c-5627-\t}\n--\nnet/mac80211/rx.c-5761-\nnet/mac80211/rx.c:5762:\trx.smd_ctx = smd_ctx;\nnet/mac80211/rx.c-5763-\nnet/mac80211/rx.c:5764:\tif (WARN_ONCE((status-\u003eflag \u0026 RX_FLAG_8023) \u0026\u0026 rx.smd_ctx,\nnet/mac80211/rx.c-5765-\t\t \"802.3 packet but with IEEE P802.11bn SMD context\"))\n--\nnet/mac80211/rx.c-5786-\t}\nnet/mac80211/rx.c:5787:\tkfree(smd_ctx);\nnet/mac80211/rx.c-5788-\n--\nnet/mac80211/rx.c-5791- drop:\nnet/mac80211/rx.c:5792:\tkfree(smd_ctx);\nnet/mac80211/rx.c-5793-\tkfree_skb(skb);\n--\nnet/mac80211/sta_info.c=1311=static int __must_check __sta_info_destroy_part1(struct sta_info *sta)\n--\nnet/mac80211/sta_info.c-1396-\t sdata-\u003evif.type == NL80211_IFTYPE_AP_VLAN)\nnet/mac80211/sta_info.c:1397:\t\tcfg80211_free_pending_smd_ctx_req(wdev, sta-\u003eaddr);\nnet/mac80211/sta_info.c-1398-\n--\nnet/mac80211/trace.h=3408=TRACE_EVENT(drv_sta_smd_state,\n--\nnet/mac80211/trace.h-3440-\nnet/mac80211/trace.h:3441:TRACE_EVENT(drv_set_smd_ctx,\nnet/mac80211/trace.h-3442-\tTP_PROTO(struct ieee80211_local *local,\n--\nnet/mac80211/trace.h-3461-\tTP_fast_assign(\nnet/mac80211/trace.h:3462:\t\tstruct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\nnet/mac80211/trace.h-3463-\t\tunsigned long sz;\n--\nnet/mac80211/trace.h-3489-\nnet/mac80211/trace.h:3490:TRACE_EVENT(drv_get_smd_ctx,\nnet/mac80211/trace.h-3491-\tTP_PROTO(struct ieee80211_local *local,\n--\nnet/mac80211/trace.h-3493-\t\t struct ieee80211_sta *sta,\nnet/mac80211/trace.h:3494:\t\t enum nl80211_smd_ctx_type type),\nnet/mac80211/trace.h-3495-\n--\nnet/wireless/core.c=1406=EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);\nnet/wireless/core.c-1407-\nnet/wireless/core.c:1408:void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev,\nnet/wireless/core.c-1409-\t\t\t\t const u8 *addr)\n--\nnet/wireless/core.c-1424-}\nnet/wireless/core.c:1425:EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req);\nnet/wireless/core.c-1426-\nnet/wireless/core.c=1427=static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,\n--\nnet/wireless/core.c-1500-\t wdev-\u003eiftype == NL80211_IFTYPE_AP_VLAN)\nnet/wireless/core.c:1501:\t\tcfg80211_free_pending_smd_ctx_req(wdev, NULL);\nnet/wireless/core.c-1502-\n--\nnet/wireless/mlme.c=1477=EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done);\nnet/wireless/mlme.c-1478-\nnet/wireless/mlme.c:1479:void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev,\nnet/wireless/mlme.c-1480-\t\t\t const u8 *sta_addr,\n--\nnet/wireless/mlme.c-1501-\nnet/wireless/mlme.c:1502:\tnl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info);\nnet/wireless/mlme.c-1503-\n--\nnet/wireless/mlme.c-1506-}\nnet/wireless/mlme.c:1507:EXPORT_SYMBOL(cfg80211_get_smd_ctx_done);\n--\nnet/wireless/nl80211.c=707=static const struct nla_policy\nnet/wireless/nl80211.c:708:nl80211_smd_ctx_ba_policy[NL80211_SMD_CTX_BA_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-709-\t[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },\n--\nnet/wireless/nl80211.c=718=static const struct nla_policy\nnet/wireless/nl80211.c:719:nl80211_smd_ctx_dl_policy[NL80211_SMD_CTX_DL_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-720-\t[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n--\nnet/wireless/nl80211.c-724-\t[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS] =\nnet/wireless/nl80211.c:725:\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\nnet/wireless/nl80211.c-726-};\n--\nnet/wireless/nl80211.c=728=static const struct nla_policy\nnet/wireless/nl80211.c:729:nl80211_smd_ctx_ul_policy[NL80211_SMD_CTX_UL_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-730-\t[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP] = { .type = NLA_U8 },\n--\nnet/wireless/nl80211.c-733-\t[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS] =\nnet/wireless/nl80211.c:734:\t\tNLA_POLICY_NESTED_ARRAY(nl80211_smd_ctx_ba_policy),\nnet/wireless/nl80211.c-735-};\n--\nnet/wireless/nl80211.c=737=static const struct nla_policy\nnet/wireless/nl80211.c:738:nl80211_smd_ctx_policy[NL80211_SMD_CTX_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-739-\t[NL80211_SMD_CTX_ATTR_DL] =\nnet/wireless/nl80211.c:740:\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_dl_policy),\nnet/wireless/nl80211.c-741-\t[NL80211_SMD_CTX_ATTR_UL] =\nnet/wireless/nl80211.c:742:\t\tNLA_POLICY_NESTED(nl80211_smd_ctx_ul_policy),\nnet/wireless/nl80211.c-743-\t[NL80211_SMD_CTX_ATTR_DRV_DATA] =\n--\nnet/wireless/nl80211.c=757=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n--\nnet/wireless/nl80211.c-1162-\t[NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },\nnet/wireless/nl80211.c:1163:\t[NL80211_ATTR_SMD_CTX] = NLA_POLICY_NESTED(nl80211_smd_ctx_policy),\nnet/wireless/nl80211.c-1164-\t[NL80211_ATTR_SMD_CTX_TYPE] =\n--\nnet/wireless/nl80211.c=19562=nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-19580-\nnet/wireless/nl80211.c:19581:static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids)\nnet/wireless/nl80211.c-19582-{\n--\nnet/wireless/nl80211.c-19597-\nnet/wireless/nl80211.c:19598:size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info)\nnet/wireless/nl80211.c-19599-{\nnet/wireless/nl80211.c:19600:\tconst struct ieee80211_smd_ctx *ctx = st_info-\u003ectx;\nnet/wireless/nl80211.c-19601-\tint n_dl_tids = 0, n_ul_tids = 0;\n--\nnet/wireless/nl80211.c-19629-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\nnet/wireless/nl80211.c:19630:\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids); /* DL BA */\nnet/wireless/nl80211.c-19631-\n--\nnet/wireless/nl80211.c-19647-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap))\nnet/wireless/nl80211.c:19648:\t\tn += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids); /* UL BA */\nnet/wireless/nl80211.c-19649-\n--\nnet/wireless/nl80211.c=19656=static int\nnet/wireless/nl80211.c:19657:nl80211_put_smd_ctx_ba_params(struct sk_buff *msg,\nnet/wireless/nl80211.c-19658-\t\t\t const unsigned long *tid_bmap,\nnet/wireless/nl80211.c:19659:\t\t\t const struct ieee80211_smd_ctx_ba *ba_tids,\nnet/wireless/nl80211.c-19660-\t\t\t bool dl)\n--\nnet/wireless/nl80211.c-19673-\tfor_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) {\nnet/wireless/nl80211.c:19674:\t\tconst struct ieee80211_smd_ctx_ba *ba = \u0026ba_tids[tid];\nnet/wireless/nl80211.c-19675-\n--\nnet/wireless/nl80211.c-19709-\nnet/wireless/nl80211.c:19710:int nl80211_put_smd_ctx(struct sk_buff *msg,\nnet/wireless/nl80211.c-19711-\t\t\tstruct cfg80211_smd_transition_info *st_info)\n--\nnet/wireless/nl80211.c-19713-\tstruct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;\nnet/wireless/nl80211.c:19714:\tstruct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;\nnet/wireless/nl80211.c:19715:\tconst struct ieee80211_smd_ctx *ctx;\nnet/wireless/nl80211.c-19716-\tu8 dl_tid_bmap = 0, ul_tid_bmap = 0;\n--\nnet/wireless/nl80211.c-19723-\nnet/wireless/nl80211.c:19724:\tsmd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);\nnet/wireless/nl80211.c:19725:\tif (!smd_ctx)\nnet/wireless/nl80211.c-19726-\t\treturn -ENOBUFS;\n--\nnet/wireless/nl80211.c-19765-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\nnet/wireless/nl80211.c:19766:\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003edl.valid_tid_bmap,\nnet/wireless/nl80211.c-19767-\t\t\t\t\t ctx-\u003edl.ba, true))\n--\nnet/wireless/nl80211.c-19816-\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\nnet/wireless/nl80211.c:19817:\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003eul.valid_tid_bmap,\nnet/wireless/nl80211.c-19818-\t\t\t\t\t ctx-\u003eul.ba, false))\n--\nnet/wireless/nl80211.c-19828-\nnet/wireless/nl80211.c:19829:\tnla_nest_end(msg, smd_ctx);\nnet/wireless/nl80211.c-19830-\n--\nnet/wireless/nl80211.c-19839-nla_fail:\nnet/wireless/nl80211.c:19840:\tnla_nest_cancel(msg, smd_ctx);\nnet/wireless/nl80211.c-19841-\treturn -EINVAL;\n--\nnet/wireless/nl80211.c=19844=static int\nnet/wireless/nl80211.c:19845:nl80211_parse_smd_ctx_ba_params(struct nlattr *tb,\nnet/wireless/nl80211.c:19846:\t\t\t\tstruct ieee80211_smd_ctx_ba *ba_tids,\nnet/wireless/nl80211.c-19847-\t\t\t\tunsigned long *valid_ctx_bmap)\n--\nnet/wireless/nl80211.c-19849-\tstruct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1];\nnet/wireless/nl80211.c:19850:\tstruct ieee80211_smd_ctx_ba *ba;\nnet/wireless/nl80211.c-19851-\tstruct nlattr *ba_attr;\n--\nnet/wireless/nl80211.c-19863-\t\tif (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX,\nnet/wireless/nl80211.c:19864:\t\t\t\t ba_attr, nl80211_smd_ctx_ba_policy,\nnet/wireless/nl80211.c-19865-\t\t\t\t NULL))\n--\nnet/wireless/nl80211.c-19905-\nnet/wireless/nl80211.c:19906:static int nl80211_parse_smd_ctx(struct genl_info *info,\nnet/wireless/nl80211.c-19907-\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n--\nnet/wireless/nl80211.c-19911-\tstruct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];\nnet/wireless/nl80211.c:19912:\tstruct ieee80211_smd_ctx *ctx;\nnet/wireless/nl80211.c-19913-\tstruct nlattr *bmap_attr;\n--\nnet/wireless/nl80211.c-19919-\t\t\t info-\u003eattrs[NL80211_ATTR_SMD_CTX],\nnet/wireless/nl80211.c:19920:\t\t\t nl80211_smd_ctx_policy, NULL)) {\nnet/wireless/nl80211.c-19921-\t\tGENL_SET_ERR_MSG(info, \"failed to parse SMD context\");\n--\nnet/wireless/nl80211.c-19939-\t\t\t\t tb[NL80211_SMD_CTX_ATTR_DL],\nnet/wireless/nl80211.c:19940:\t\t\t\t nl80211_smd_ctx_dl_policy, NULL)) {\nnet/wireless/nl80211.c-19941-\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse DL context\");\n--\nnet/wireless/nl80211.c-19999-\t\tif (ba_attr \u0026\u0026\nnet/wireless/nl80211.c:20000:\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003edl.ba,\nnet/wireless/nl80211.c-20001-\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n--\nnet/wireless/nl80211.c-20013-\t\t\t\t tb[NL80211_SMD_CTX_ATTR_UL],\nnet/wireless/nl80211.c:20014:\t\t\t\t nl80211_smd_ctx_ul_policy, NULL)) {\nnet/wireless/nl80211.c-20015-\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse UL context\");\n--\nnet/wireless/nl80211.c-20106-\t\tif (ba_attr \u0026\u0026\nnet/wireless/nl80211.c:20107:\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003eul.ba,\nnet/wireless/nl80211.c-20108-\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n--\nnet/wireless/nl80211.c=20401=static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-20471-\nnet/wireless/nl80211.c:20472:static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info)\nnet/wireless/nl80211.c-20473-{\n--\nnet/wireless/nl80211.c-20480-\nnet/wireless/nl80211.c:20481:\tif (!rdev-\u003eops-\u003eset_smd_ctx)\nnet/wireless/nl80211.c-20482-\t\treturn -EOPNOTSUPP;\n--\nnet/wireless/nl80211.c-20496-\nnet/wireless/nl80211.c:20497:\terr = nl80211_parse_smd_ctx(info, \u0026st_info);\nnet/wireless/nl80211.c-20498-\tif (err)\n\n"
} |
| 23/3 | 2026/09/26 05:49 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 69674 output: 31 thoughts: 2021 Thoughts: **Analyzing SMD Context Transmission in nl80211** Okay, here's the breakdown of my thought process after reviewing the `nl80211.c` code. My initial focus went directly to `nl80211_put_smd_ctx`. This is where the core logic of encoding the Station Management Data (SMD) context for transmission over the nl80211 netlink interface resides. My immediate thought was to understand the structure: It takes a netlink message (`struct sk_buff *msg`) and a `cfg80211_smd_transition_info` structure as input. The function carefully constructs nested Netlink attributes to represent the SMD context. It breaks it down into Downlink (DL) and Uplink (UL) components, serial numbers, PN values, BA parameters, and driver-specific context. The use of bit maps (`valid_tid_bmap`) and nested attributes suggests a detailed and flexible representation to handle various scenarios and specific parameters. The code carefully checks for buffer overflow errors (`-ENOBUFS`) throughout the process. Now, my mind jumps to the bigger picture. I need to understand how this is used within the driver stack. I'm thinking about the reception of ST Preparation Request and ST Execution Request management frames. I quickly remember that `rx->smd_ctx` might be set by the driver within `status->smd_ctx` when an incoming frame is received. *But how does the driver get this context data in the first place?* I then go back to the comment associated with `smd_ctx` in mac80211. This explains that the driver *should* `kmalloc` the context. I'm now curious about the typical data path for this context. *Is any driver actually implementing this?* I need to find the driver that handles this! I'll perform a search within the drivers/net/wireless directory to see if any drivers are using the `smd_ctx` or the related `set_smd_ctx` or `get_smd_ctx` API's. |
| 24/3 | 2026/09/26 05:49 | tool | grepper |
0mError:no matches Args: {
"Expression": "set_smd_ctx",
"PathPrefix": "drivers/net/wireless"
}Results: {
"error": "no matches"
} |
| 25/3 | 2026/09/26 05:49 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 72188 output: 27 thoughts: 53 Thoughts: **Investigating the Missing `set_smd_ctx` Implementation** Okay, so I'm looking at this code and it's striking me that I don't see any drivers actively implementing `set_smd_ctx`. That's unusual. It makes me immediately question what's going on here. Surely, there *must* be some use case, otherwise the function wouldn't have been designed as it is. Wait a second, could this be something that's only utilized in a very specific scenario? Thinking about it a bit more, could it be something that is implemented in a virtual device, or even within a testing or simulation environment? Hmm, perhaps something related to `mac80211`'s hardware simulation, or even a similar virtual WiFi driver? Right, let's go check the relevant files for the `mac80211_hwsim` or, maybe even the `virt_wifi` modules, and see if the function is being utilized there, and if so, how. That should shed some light on the matter. |
| 26/3 | 2026/09/26 05:49 | tool | grepper |
0mArgs:{
"Expression": "NL80211_EXT_FEATURE_SMD"
}Results: {
"Output": "include/uapi/linux/nl80211.h=1445=enum nl80211_commands {\n--\ninclude/uapi/linux/nl80211.h-3211- *\tan AP managed by an SMD-ME. Valid if the driver supports\ninclude/uapi/linux/nl80211.h:3212: *\t%NL80211_EXT_FEATURE_SMD.\ninclude/uapi/linux/nl80211.h-3213- *\tUsed with %NL80211_CMD_START_AP. See \u0026enum nl80211_smd_params_attrs.\n--\ninclude/uapi/linux/nl80211.h=6911=enum nl80211_feature_flags {\n--\ninclude/uapi/linux/nl80211.h-7195- *\ninclude/uapi/linux/nl80211.h:7196: * @NL80211_EXT_FEATURE_SMD: Driver supports Seamless Mobility Domain (SMD)\ninclude/uapi/linux/nl80211.h-7197- *\tand is managed by an SMD-ME to support SMD BSS Transition in AP mode\n--\ninclude/uapi/linux/nl80211.h-7200- *\ninclude/uapi/linux/nl80211.h:7201: * @NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING: Driver supports forwarding of\ninclude/uapi/linux/nl80211.h-7202- *\tbuffered downlink (DL) data packets in AP mode to the non-AP STA during\n--\ninclude/uapi/linux/nl80211.h=7208=enum nl80211_ext_feature_index {\n--\ninclude/uapi/linux/nl80211.h-7287-\tNL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,\ninclude/uapi/linux/nl80211.h:7288:\tNL80211_EXT_FEATURE_SMD,\ninclude/uapi/linux/nl80211.h:7289:\tNL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING,\ninclude/uapi/linux/nl80211.h-7290-\n--\nnet/wireless/nl80211.c=7276=static int nl80211_parse_smd_params(struct genl_info *info,\n--\nnet/wireless/nl80211.c-7286-\tif (!wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\nnet/wireless/nl80211.c:7287:\t\t\t\t NL80211_EXT_FEATURE_SMD)) {\nnet/wireless/nl80211.c-7288-\t\tGENL_SET_ERR_MSG(info, \"SMD is not supported\");\n--\nnet/wireless/nl80211.c-7324-\t !wiphy_ext_feature_isset(\u0026rdev-\u003ewiphy,\nnet/wireless/nl80211.c:7325:\t\t\t\t NL80211_EXT_FEATURE_SMD_DL_PKT_FORWARDING)) {\nnet/wireless/nl80211.c-7326-\t\tGENL_SET_ERR_MSG(info,\n"
} |
| 27/3 | 2026/09/26 05:49 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 73397 output: 24 thoughts: 2399 Thoughts: **Analyzing SMD Context Data Flow** Okay, let's break down this SMD context data flow within the userspace interaction. I'm focusing on how the data structures are allocated, populated, and passed around. It starts with the `NL80211_CMD_SET_SMD_CTX` command, initiated by userspace, and handled by `nl80211_set_smd_ctx`. The key is the `cfg80211_smd_transition_info` (`st_info`) structure. The `nl80211_parse_smd_ctx` function is called to parse information to populate `st_info`. Crucially, it allocates a context `ctx` using `kzalloc`. This `ctx` is part of `st_info` and contains, among other things, the `valid_tid_bmap` bitmaps for Tx and Rx. The important thing here is that `kzalloc` zeroes out the memory, so those bitmaps are initialized to zero. The driver is expected to copy `@ctx` for any deferred processing via `rdev_set_smd_ctx`. Now, the `rdev_set_smd_ctx` is passed to the driver's implementation. `mac80211` uses `ieee80211_set_smd_ctx`, which internally calls `drv_set_smd_ctx`. The call stack goes `nl80211_set_smd_ctx` -> `rdev_set_smd_ctx` -> `ieee80211_set_smd_ctx` -> `drv_set_smd_ctx`. Inside of `ieee80211_set_smd_ctx` a call to `sta_info_get_bss` is done, using the STA address to find the corresponding STA info. The crucial part here is `drv_set_smd_ctx`, as it's the point where the driver gets to actually do something with the data. Next up, the `NL80211_CMD_GET_SMD_CTX` command calls `nl80211_get_smd_ctx`. Here, a `pending` structure is allocated using `kzalloc_obj`, and the station address is copied into it. The `rdev_get_smd_ctx` function then kicks off the process of fetching the SMD context. A later call, `cfg80211_get_smd_ctx_done`, is triggered to complete the context retrieval. It retrieves the data from the driver and will notify the userspace via `nl80211_notify_get_smd_ctx_done`. Inside `nl80211_notify_get_smd_ctx_done`, if the SMD context (`st_info->ctx`) is present, it's included in the notification message. I see that `cfg80211_get_smd_ctx_done` is only called by drivers. However, I noticed that no driver currently implements it yet. Aha! `nl80211_send_mgmt` is where the `st_info` structure's `ctx` data could be populated. It's used to send management frames, and it can include SMD context data, indicated by the check `if (info->st_info.ctx)`. I need to understand what triggers calls to `nl80211_send_mgmt`. That should provide the context for when and why `st_info`'s `ctx` member is populated. That would be the critical link. |
| 28/3 | 2026/09/26 05:49 | tool | grepper |
0mArgs:{
"Expression": "nl80211_send_mgmt"
}Results: {
"Output": "include/uapi/linux/nl80211.h=1445=enum nl80211_commands {\n--\ninclude/uapi/linux/nl80211.h-2422- *\ninclude/uapi/linux/nl80211.h:2423: * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.\ninclude/uapi/linux/nl80211.h-2424- *\tAs specified in the \u0026enum nl80211_rxmgmt_flags.\n--\nnet/wireless/mlme.c=1010=bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,\n--\nnet/wireless/mlme.c-1051-\t\t/* Indicate the received Action frame to user space */\nnet/wireless/mlme.c:1052:\t\tif (nl80211_send_mgmt(rdev, wdev, reg-\u003enlportid, info,\nnet/wireless/mlme.c-1053-\t\t\t\t GFP_ATOMIC))\n--\nnet/wireless/nl80211.c=2399=static int\nnet/wireless/nl80211.c:2400:nl80211_send_mgmt_stypes(struct sk_buff *msg,\nnet/wireless/nl80211.c-2401-\t\t\t const struct ieee80211_txrx_stypes *mgmt_stypes)\n--\nnet/wireless/nl80211.c=3124=static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/nl80211.c-3466-\tcase 9:\nnet/wireless/nl80211.c:3467:\t\tif (nl80211_send_mgmt_stypes(msg, mgmt_stypes))\nnet/wireless/nl80211.c-3468-\t\t\tgoto nla_put_failure;\n--\nnet/wireless/nl80211.c=22884=EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame);\nnet/wireless/nl80211.c-22885-\nnet/wireless/nl80211.c:22886:int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\nnet/wireless/nl80211.c-22887-\t\t struct wireless_dev *wdev, u32 nlportid,\n--\nnet/wireless/nl80211.h=108=void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/nl80211.h-111-\nnet/wireless/nl80211.h:112:int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\nnet/wireless/nl80211.h-113-\t\t struct wireless_dev *wdev, u32 nlpid,\n"
} |
| 29/3 | 2026/09/26 05:49 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 77464 output: 20 thoughts: 882 Thoughts: **Diving into the Management Frame Handling** Okay, let's break this down. I'm looking at how userspace management frames are handled, specifically the scenario involving Structured Management Data (SMD) context. I'm focusing on the `ieee80211_rx_h_userspace_mgmt` function within `net/mac80211/rx.c`. I can see it's calling `ieee80211_rx_h_userspace_mgmt_st_req_frame` in a particular case. This function clearly accesses the `rx->smd_ctx`. My primary concern right now is tracking down where this `rx->smd_ctx` value is actually set. It's a key piece of information for any Structured Management Data requests. The code in `ieee80211_rx_h_userspace_mgmt_st_req_frame` uses `rx->smd_ctx` and populates the `info->st_info.ctx` field. That is set into the `cfg80211_rx_info` struct, which is then used in the `cfg80211_rx_mgmt_ext` function. Now, I'm digging into `ieee80211_rx_list` to see how that `rx->smd_ctx` gets populated. It looks like `smd_ctx` is set in the `ieee80211_rx_list` using information from the `status` struct. It appears that it gets populated using a cached pointer, with `smd_ctx = status->smd_ctx;`. But that also means, I need to know the origin of the `status` structure! Specifically, where is `status->smd_ctx` initially populated, and when is `smd_ctx_valid` set? Since `status` is obtained via `IEEE80211_SKB_RXCB(skb)`, I need to find the initialization of this `status` within the packet receive path. I'll need to trace the initialization of `status`. So, the next step is to examine how drivers call `ieee80211_rx_list` or `ieee80211_rx_skb`, to trace the flow of execution and initialization of the rx path. |
| 30/3 | 2026/09/26 05:50 | tool | grepper |
0mArgs:{
"Expression": "smd_ctx_valid"
}Results: {
"Output": "include/net/mac80211.h=1714=enum mac80211_rx_encoding {\n--\ninclude/net/mac80211.h-1740- *\tframes. The pointer will be consumed by mac80211; must be kmalloc-ed.\ninclude/net/mac80211.h:1741: *\tIndicated by @smd_ctx_valid.\ninclude/net/mac80211.h-1742- * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use\n--\ninclude/net/mac80211.h-1781- *\tcorrect link per vif.\ninclude/net/mac80211.h:1782: * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag\ninclude/net/mac80211.h-1783- *\tis used only for ST Preparation or ST Execution Request frames.\n--\ninclude/net/mac80211.h=1785=struct ieee80211_rx_status {\n--\ninclude/net/mac80211.h-1824-\tu8 link_id:4,\ninclude/net/mac80211.h:1825:\t smd_ctx_valid:1;\ninclude/net/mac80211.h-1826-};\n--\nnet/mac80211/rx.c=5610=void ieee80211_rx_list(struct ieee80211_hw *hw,\n--\nnet/mac80211/rx.c-5622-\t/* cache the pointer to free it later */\nnet/mac80211/rx.c:5623:\tif (status-\u003esmd_ctx_valid) {\nnet/mac80211/rx.c-5624-\t\tsmd_ctx = status-\u003esmd_ctx;\nnet/mac80211/rx.c-5625-\t\tstatus-\u003esmd_ctx = NULL;\nnet/mac80211/rx.c:5626:\t\tstatus-\u003esmd_ctx_valid = false;\nnet/mac80211/rx.c-5627-\t}\n"
} |
| 31/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 79487 output: 37 thoughts: 336 Thoughts: **Analyzing the Initialization of `struct ieee80211_rx_status`**
Okay, hold on a second. I need to take a closer look at `struct ieee80211_rx_status`. Specifically, the definition:
```c
struct ieee80211_rx_status {
u64 mactime;
union {
u64 boottime_ns;
ktime_t ack_tx_hwtstamp;
struct ieee80211_smd_ctx *smd_ctx;
};
...
u8 link_id:4,
smd_ctx_valid:1;
};
```
Now, where does this structure actually *live*? Ah, right, it's accessed via `IEEE80211_SKB_RXCB(skb)`, which means it's tucked away inside `skb->cb`. I need to understand how drivers populate this `status` field when receiving packets.
My initial thought is that drivers generally do something like this:
```c
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
memset(status, 0, sizeof(*status));
```
But, wait a minute... what if a driver *doesn't* do a full `memset`? Or, here's a thought, what if the `smd_ctx_valid` bitfield isn't initialized? That's a potential vulnerability.
I need to investigate the initialization practices of `IEEE80211_SKB_RXCB(skb)` within the driver code. Let's start by doing a `grep` through the relevant areas: `drivers/net/wireless` and `net/mac80211`. That should give me a good overview of how various drivers are handling this critical structure and the potential for any inconsistencies or omissions.
|
| 32/3 | 2026/09/26 05:50 | tool | grepper |
0mArgs:{
"Expression": "IEEE80211_SKB_RXCB",
"PathPrefix": "drivers/net/wireless"
}Results: {
"Output": "drivers/net/wireless/admtek/adm8211.c=350=static void adm8211_interrupt_rci(struct ieee80211_hw *dev)\n--\ndrivers/net/wireless/admtek/adm8211.c-445-\ndrivers/net/wireless/admtek/adm8211.c:446:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/admtek/adm8211.c-447-\t\t\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/ath/ar5523/ar5523.c=534=static void ar5523_data_rx_cb(struct urb *urb)\n--\ndrivers/net/wireless/ath/ar5523/ar5523.c-603-\ndrivers/net/wireless/ath/ar5523/ar5523.c:604:\trx_status = IEEE80211_SKB_RXCB(data-\u003eskb);\ndrivers/net/wireless/ath/ar5523/ar5523.c-605-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=1352=static void ath10k_htt_rx_h_queue_msdu(struct ath10k *ar,\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1357-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:1358:\tstatus = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1359-\t*status = *rx_status;\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=1364=static void ath10k_process_rx(struct ath10k *ar, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1369-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:1370:\tstatus = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1371-\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=2454=static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-2553-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:2554:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-2555-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/ath/ath10k/wmi.c=2527=int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath10k/wmi.c-2529-\tstruct wmi_mgmt_rx_ev_arg arg = {};\ndrivers/net/wireless/ath/ath10k/wmi.c:2530:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/wmi.c-2531-\tstruct ieee80211_hdr *hdr;\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c=2432=static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *napi,\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c-2493-\ndrivers/net/wireless/ath/ath11k/dp_rx.c:2494:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath11k/dp_rx.c-2495-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c=3250=static int ath11k_dp_rx_h_verify_tkip_mic(struct ath11k *ar, struct ath11k_peer *peer,\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c-3253-\tstruct hal_rx_desc *rx_desc = (struct hal_rx_desc *)msdu-\u003edata;\ndrivers/net/wireless/ath/ath11k/dp_rx.c:3254:\tstruct ieee80211_rx_status *rxs = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath11k/dp_rx.c-3255-\tstruct ieee80211_key_conf *key_conf;\n--\ndrivers/net/wireless/ath/ath11k/wmi.c=7621=static void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath11k/wmi.c-7624-\tstruct ath11k *ar;\ndrivers/net/wireless/ath/ath11k/wmi.c:7625:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath11k/wmi.c-7626-\tstruct ieee80211_hdr *hdr;\n--\ndrivers/net/wireless/ath/ath12k/dp_mon.c=493=void ath12k_dp_mon_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev,\n--\ndrivers/net/wireless/ath/ath12k/dp_mon.c-512-\ndrivers/net/wireless/ath/ath12k/dp_mon.c:513:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/dp_mon.c-514-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath12k/dp_rx.c=1371=void ath12k_dp_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, struct napi_struct *napi,\n--\ndrivers/net/wireless/ath/ath12k/dp_rx.c-1430-\ndrivers/net/wireless/ath/ath12k/dp_rx.c:1431:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/dp_rx.c-1432-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c=991=static int ath12k_wifi7_dp_rx_h_verify_tkip_mic(struct ath12k_pdev_dp *dp_pdev,\n--\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c-999-\tstruct hal_rx_desc *rx_desc = (struct hal_rx_desc *)msdu-\u003edata;\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c:1000:\tstruct ieee80211_rx_status *rxs = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c-1001-\tstruct ieee80211_key_conf *key_conf;\n--\ndrivers/net/wireless/ath/ath12k/wmi.c=7276=static void ath12k_mgmt_rx_event(struct ath12k_base *ab, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath12k/wmi.c-7279-\tstruct ath12k *ar;\ndrivers/net/wireless/ath/ath12k/wmi.c:7280:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath12k/wmi.c-7281-\tstruct ath12k_dp_link_peer *peer;\n--\ndrivers/net/wireless/ath/ath5k/base.c=1416=ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,\n--\ndrivers/net/wireless/ath/ath5k/base.c-1423-\ndrivers/net/wireless/ath/ath5k/base.c:1424:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath5k/base.c-1425-\n--\ndrivers/net/wireless/ath/ath9k/debug_sta.c=91=void ath_debug_rate_stats(struct ath_softc *sc,\n--\ndrivers/net/wireless/ath/ath9k/debug_sta.c-112-\trstats = \u0026an-\u003erx_rate_stats;\ndrivers/net/wireless/ath/ath9k/debug_sta.c:113:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath9k/debug_sta.c-114-\n--\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c=1081=void ath9k_rx_tasklet(struct tasklet_struct *t)\n--\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c-1111-\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c:1112:\t\tmemcpy(IEEE80211_SKB_RXCB(rxbuf-\u003eskb), \u0026rx_status,\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c-1113-\t\t sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/ath/ath9k/recv.c=1008=static void ath_rx_count_airtime(struct ath_softc *sc,\n--\ndrivers/net/wireless/ath/ath9k/recv.c-1033-\ndrivers/net/wireless/ath/ath9k/recv.c:1034:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath9k/recv.c-1035-\n--\ndrivers/net/wireless/ath/ath9k/recv.c=1058=int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)\n--\ndrivers/net/wireless/ath/ath9k/recv.c-1110-\ndrivers/net/wireless/ath/ath9k/recv.c:1111:\t\trxs = IEEE80211_SKB_RXCB(hdr_skb);\ndrivers/net/wireless/ath/ath9k/recv.c-1112-\t\tmemset(rxs, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/ath/carl9170/rx.c=662=static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len,\n--\ndrivers/net/wireless/ath/carl9170/rx.c-685-\ndrivers/net/wireless/ath/carl9170/rx.c:686:\tmemcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status));\ndrivers/net/wireless/ath/carl9170/rx.c-687-\tieee80211_rx(ar-\u003ehw, skb);\n--\ndrivers/net/wireless/ath/wcn36xx/txrx.c=306=int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/wcn36xx/txrx.c-410-\ndrivers/net/wireless/ath/wcn36xx/txrx.c:411:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/ath/wcn36xx/txrx.c-412-\n--\ndrivers/net/wireless/atmel/at76c50x-usb.c=1544=static void at76_rx_tasklet(struct tasklet_struct *t)\n--\ndrivers/net/wireless/atmel/at76c50x-usb.c-1588-\t\t priv-\u003erx_skb-\u003elen, priv-\u003erx_skb-\u003edata_len);\ndrivers/net/wireless/atmel/at76c50x-usb.c:1589:\tmemcpy(IEEE80211_SKB_RXCB(priv-\u003erx_skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/atmel/at76c50x-usb.c-1590-\tieee80211_rx_irqsafe(priv-\u003ehw, priv-\u003erx_skb);\n--\ndrivers/net/wireless/broadcom/b43/xmit.c=632=void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)\n--\ndrivers/net/wireless/broadcom/b43/xmit.c-806-\ndrivers/net/wireless/broadcom/b43/xmit.c:807:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/broadcom/b43/xmit.c-808-\tieee80211_rx_ni(dev-\u003ewl-\u003ehw, skb);\n--\ndrivers/net/wireless/broadcom/b43legacy/xmit.c=418=void b43legacy_rx(struct b43legacy_wldev *dev,\n--\ndrivers/net/wireless/broadcom/b43legacy/xmit.c-564-\ndrivers/net/wireless/broadcom/b43legacy/xmit.c:565:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/broadcom/b43legacy/xmit.c-566-\tieee80211_rx_irqsafe(dev-\u003ewl-\u003ehw, skb);\n--\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c=7076=brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,\n--\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7097-\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c:7098:\tmemcpy(IEEE80211_SKB_RXCB(p), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7099-\tieee80211_rx_irqsafe(wlc-\u003epub-\u003eieee_hw, p);\n--\ndrivers/net/wireless/intel/iwlegacy/3945.c=465=il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb,\n--\ndrivers/net/wireless/intel/iwlegacy/3945.c-516-\til_update_stats(il, false, fc, len);\ndrivers/net/wireless/intel/iwlegacy/3945.c:517:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlegacy/3945.c-518-\n--\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c=565=il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,\n--\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c-603-\til_update_stats(il, false, fc, len);\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c:604:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c-605-\n--\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c=604=static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,\n--\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c-668-\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c:669:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c-670-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=49=static inline int iwl_mld_check_pn(struct iwl_mld *mld, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-53-\tstruct ieee80211_hdr *hdr = (void *)skb_mac_header(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:54:\tstruct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-55-\tstruct iwl_mld_sta *mld_sta;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=323=static void iwl_mld_rx_vht(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-325-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:326:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-327-\tstruct ieee80211_radiotap_vht *vht;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=635=static void iwl_mld_rx_he(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-637-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:638:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-639-\tstruct ieee80211_radiotap_he *he = NULL;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=750=static void iwl_mld_decode_lsig(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-752-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:753:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-754-\tu32 format = phy_data-\u003erate_n_flags \u0026 RATE_MCS_MOD_TYPE_MSK;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=791=iwl_mld_radiotap_put_tlv(struct sk_buff *skb, u16 type, u16 len)\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-793-\tstruct ieee80211_radiotap_tlv *tlv;\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:794:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-795-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1230=static void iwl_mld_rx_eht(struct iwl_mld *mld, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1232-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1233:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1234-\tstruct ieee80211_radiotap_eht *eht;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1494=static void iwl_mld_rx_fill_status(struct iwl_mld *mld, int link_id,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1498-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1499:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1500-\tu32 rate_n_flags = phy_data-\u003erate_n_flags;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1733=iwl_mld_rx_with_sta(struct iwl_mld *mld, struct ieee80211_hdr *hdr,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1765-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1766:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1767-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=2014=void iwl_mld_rx_mpdu(struct iwl_mld *mld, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2071-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2072:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2073-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=2283=static void iwl_mld_no_data_rx(struct iwl_mld *mld,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2303-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2304:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2305-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2336-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2337:\tiwl_mld_fill_rx_status_band_freq(IEEE80211_SKB_RXCB(skb),\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2338-\t\t\t\t\t ntfy-\u003eband, ntfy-\u003echannel);\n--\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c=170=void iwl_mld_handle_time_msmt_notif(struct iwl_mld *mld,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c-193-\tadj_time = iwl_mld_ptp_get_adj_time(mld, ts_10ns * 10);\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c:194:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c-195-\trx_status-\u003eack_tx_hwtstamp = ktime_set(0, adj_time);\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c=1687=void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c-1741-\tskb_put_data(skb, data, size);\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1742:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c-1743-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c=288=void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c-329-\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c:330:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c-331-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=14=static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-18-\tstruct ieee80211_hdr *hdr = (void *)skb_mac_header(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:19:\tstruct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-20-\tstruct iwl_mvm_key_pn *ptk_pn;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=207=static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-209-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:210:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-211-\tstruct ieee80211_radiotap_vendor_content *radiotap;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1649=static void iwl_mvm_rx_eht(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1652-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1653:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1654-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1792=static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1795-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1796:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1797-\tstruct ieee80211_radiotap_he *he = NULL;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1919=static void iwl_mvm_decode_lsig(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1921-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1922:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1923-\tstruct ieee80211_radiotap_lsig *lsig;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1972=static void iwl_mvm_rx_fill_status(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1978-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1979:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1980-\tu32 rate_n_flags = phy_data-\u003erate_n_flags;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=2095=void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2186-\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:2187:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2188-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=2409=void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2466-\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:2467:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2468-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c=58=void iwl_mvm_time_sync_msmt_event(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c-82-\tadj_time = iwl_mvm_ptp_get_adj_time(mvm, ts_10ns * 10);\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c:83:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c-84-\trx_status-\u003eack_tx_hwtstamp = ktime_set(0, adj_time);\n--\ndrivers/net/wireless/intersil/p54/txrx.c=327=static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/intersil/p54/txrx.c-329-\tstruct p54_rx_data *hdr = (struct p54_rx_data *) skb-\u003edata;\ndrivers/net/wireless/intersil/p54/txrx.c:330:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intersil/p54/txrx.c-331-\tu16 freq = le16_to_cpu(hdr-\u003efreq);\n--\ndrivers/net/wireless/marvell/libertas_tf/main.c=493=int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/marvell/libertas_tf/main.c-534-\ndrivers/net/wireless/marvell/libertas_tf/main.c:535:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/marvell/libertas_tf/main.c-536-\n--\ndrivers/net/wireless/marvell/mwl8k.c=1328=static int rxq_process(struct ieee80211_hw *hw, int index, int limit)\n--\ndrivers/net/wireless/marvell/mwl8k.c-1417-\t\tmwl8k_remove_dma_header(skb, qos);\ndrivers/net/wireless/marvell/mwl8k.c:1418:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/marvell/mwl8k.c-1419-\t\tieee80211_rx_irqsafe(hw, skb);\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c=1256=mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c-1259-{\ndrivers/net/wireless/mediatek/mt76/mac80211.c:1260:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/mediatek/mt76/mac80211.c-1261-\tstruct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);\n--\ndrivers/net/wireless/mediatek/mt7601u/mac.c=460=u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt7601u/mac.c-462-{\ndrivers/net/wireless/mediatek/mt7601u/mac.c:463:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/mediatek/mt7601u/mac.c-464-\tstruct mt7601u_rxwi *rxwi = rxi;\n--\ndrivers/net/wireless/morsemicro/mm81x/mac.c=1930=void mm81x_mac_rx_skb(struct mm81x *mors, struct sk_buff *skb,\n--\ndrivers/net/wireless/morsemicro/mm81x/mac.c-1955-rx:\ndrivers/net/wireless/morsemicro/mm81x/mac.c:1956:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/morsemicro/mm81x/mac.c-1957-\tieee80211_rx_ni(hw, skb);\n--\ndrivers/net/wireless/purelifi/plfxlc/mac.c=393=int plfxlc_mac_rx(struct ieee80211_hw *hw, const u8 *buffer,\n--\ndrivers/net/wireless/purelifi/plfxlc/mac.c-490-\tskb_put_data(skb, buffer, payload_length);\ndrivers/net/wireless/purelifi/plfxlc/mac.c:491:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/purelifi/plfxlc/mac.c-492-\tieee80211_rx_irqsafe(hw, skb);\n--\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c=737=void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)\n--\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c-838-\t */\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c:839:\trx_status = IEEE80211_SKB_RXCB(entry-\u003eskb);\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c-840-\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c=211=static void rtl8180_handle_rx(struct ieee80211_hw *dev)\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-321-\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:322:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-323-\t\t\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c=325=static void rtl8187_rx_cb(struct urb *urb)\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-395-\t\trx_status.flag |= RX_FLAG_FAILED_FCS_CRC;\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:396:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-397-\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c=6320=int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6369-\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:6370:\t\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6371-\t\tmemset(rx_status, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c=6439=int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6479-\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:6480:\t\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6481-\t\tmemset(rx_status, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c=1342=static void process_agg_start(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-1356-\t\trx_status.signal = 50 + 10;\ndrivers/net/wireless/realtek/rtlwifi/base.c:1357:\t\tmemcpy(IEEE80211_SKB_RXCB(skb_delba),\ndrivers/net/wireless/realtek/rtlwifi/base.c-1358-\t\t \u0026rx_status, sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c=631=static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c-641-\t\tif (likely(uskb)) {\ndrivers/net/wireless/realtek/rtlwifi/pci.c:642:\t\t\tmemcpy(IEEE80211_SKB_RXCB(uskb), \u0026rx_status,\ndrivers/net/wireless/realtek/rtlwifi/pci.c-643-\t\t\t sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c=664=static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c-769-\t\tif (!stats.crc \u0026\u0026 !stats.hwerror \u0026\u0026 (skb-\u003elen \u003e FCS_LEN)) {\ndrivers/net/wireless/realtek/rtlwifi/pci.c:770:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status,\ndrivers/net/wireless/realtek/rtlwifi/pci.c-771-\t\t\t sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c=344=static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c-346-\tstruct ieee80211_rx_status *rx_status =\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c:347:\t\t (struct ieee80211_rx_status *)IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c-348-\tu32 skb_len, pkt_len, drvinfo_len;\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c=369=static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c-388-\tif (!stats.crc) {\ndrivers/net/wireless/realtek/rtlwifi/usb.c:389:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtlwifi/usb.c-390-\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c=411=static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c-430-\tif (!stats.crc) {\ndrivers/net/wireless/realtek/rtlwifi/usb.c:431:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtlwifi/usb.c-432-\n--\ndrivers/net/wireless/realtek/rtw88/sdio.c=950=static void rtw_sdio_rx_skb(struct rtw_dev *rtwdev, struct sk_buff *skb,\n--\ndrivers/net/wireless/realtek/rtw88/sdio.c-953-{\ndrivers/net/wireless/realtek/rtw88/sdio.c:954:\t*IEEE80211_SKB_RXCB(skb) = *rx_status;\ndrivers/net/wireless/realtek/rtw88/sdio.c-955-\n--\ndrivers/net/wireless/realtek/rtw89/core.c=2567=static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-2569-{\ndrivers/net/wireless/realtek/rtw89/core.c:2570:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-2571-\tstruct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb-\u003edata;\n--\ndrivers/net/wireless/realtek/rtw89/core.c=3026=static void rtw89_vif_rx_bcn_stat(struct rtw89_dev *rtwdev, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-3031-\tstruct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb-\u003edata;\ndrivers/net/wireless/realtek/rtw89/core.c:3032:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-3033-\tstruct rtw89_beacon_stat *bcn_stat = \u0026rtwdev-\u003ephystat.bcn_stat;\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4029=static void rtw89_core_rx_pending_skb(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4043-\t\tskb_unlink(skb_ppdu, \u0026rtwdev-\u003eppdu_sts.rx_queue[band]);\ndrivers/net/wireless/realtek/rtw89/core.c:4044:\t\trx_status = IEEE80211_SKB_RXCB(skb_ppdu);\ndrivers/net/wireless/realtek/rtw89/core.c-4045-\t\tif (rtw89_core_rx_ppdu_match(rtwdev, desc_info, rx_status))\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4470=static void rtw89_core_flush_ppdu_rx_queue(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4479-\t\tskb_unlink(skb_ppdu, \u0026ppdu_sts-\u003erx_queue[band]);\ndrivers/net/wireless/realtek/rtw89/core.c:4480:\t\trx_status = IEEE80211_SKB_RXCB(skb_ppdu);\ndrivers/net/wireless/realtek/rtw89/core.c-4481-\t\trtw89_core_rx_to_mac80211(rtwdev, NULL, desc_info, skb_ppdu, rx_status);\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4520=void rtw89_core_rx(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4538-\ndrivers/net/wireless/realtek/rtw89/core.c:4539:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-4540-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c=1395=void rsi_indicate_pkt_to_os(struct rsi_common *common,\n--\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c-1399-\tstruct ieee80211_hw *hw = adapter-\u003ehw;\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c:1400:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c-1401-\n--\ndrivers/net/wireless/silabs/wfx/data_rx.c=38=void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb)\ndrivers/net/wireless/silabs/wfx/data_rx.c-39-{\ndrivers/net/wireless/silabs/wfx/data_rx.c:40:\tstruct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/silabs/wfx/data_rx.c-41-\tstruct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb-\u003edata;\n--\ndrivers/net/wireless/st/cw1200/txrx.c=1000=void cw1200_rx_cb(struct cw1200_common *priv,\n--\ndrivers/net/wireless/st/cw1200/txrx.c-1005-\tstruct sk_buff *skb = *skb_p;\ndrivers/net/wireless/st/cw1200/txrx.c:1006:\tstruct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/st/cw1200/txrx.c-1007-\tstruct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb-\u003edata;\n--\ndrivers/net/wireless/ti/wl1251/rx.c=133=static void wl1251_rx_body(struct wl1251 *wl,\n--\ndrivers/net/wireless/ti/wl1251/rx.c-180-\ndrivers/net/wireless/ti/wl1251/rx.c:181:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/ti/wl1251/rx.c-182-\tieee80211_rx_ni(wl-\u003ehw, skb);\n--\ndrivers/net/wireless/ti/wlcore/rx.c=103=static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,\n--\ndrivers/net/wireless/ti/wlcore/rx.c-182-\ndrivers/net/wireless/ti/wlcore/rx.c:183:\twl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon,\ndrivers/net/wireless/ti/wlcore/rx.c-184-\t\t\t ieee80211_is_probe_resp(hdr-\u003eframe_control));\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1815=static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1858-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1859:\tIEEE80211_SKB_RXCB(skb)-\u003eflag |= RX_FLAG_RADIOTAP_TLV_AT_END;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1860-#endif\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1863=static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1889-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1890:\tmemcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1891-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=216=void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-240-\t/* Copy the RX status to add a MAC timestamp if needed */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:241:\tmemcpy(\u0026rx_status, IEEE80211_SKB_RXCB(skb),\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-242-\t sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-567-\t\t/* Timestamp is likely inaccurate (and late) in this case */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:568:\t\tif (!(IEEE80211_SKB_RXCB(skb)-\u003eflag \u0026 RX_FLAG_MACTIME))\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-569-\t\t\tthreshold = 128;\n--\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c=1018=int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)\n--\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c-1095-\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c:1096:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c-1097-\tieee80211_rx_irqsafe(hw, skb);\n"
} |
| 33/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 95321 output: 50 thoughts: 111 Thoughts: Okay, let's break this down. **Diving into the mac80211_hwsim Implementation** My initial focus is on `mac80211_hwsim_main.c`. I'm specifically drawn to a `memcpy` call within that file: `memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));`. My immediate thought is, "Ah, copying the receive status. Good, but I need to understand *how* that `rx_status` is populated." To that end, I'll need to jump over and understand the data flow, how that struct is initialized. I'll need to figure out where `rx_status` gets initialized. I'll look around line 1863 in that same file to see how that's done. That's likely where the magic happens. |
| 34/3 | 2026/09/26 05:50 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 1860,
"LineCount": 40
}Results: {
"Contents": "1860:\t#endif\n1861:\t}\n1862:\t\n1863:\tstatic void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,\n1864:\t\t\t\t struct ieee80211_rx_status *rx_status,\n1865:\t\t\t\t struct sk_buff *skb)\n1866:\t{\n1867:\t\tstruct ieee80211_hdr *hdr = (void *)skb-\u003edata;\n1868:\t\n1869:\t\tif (!ieee80211_has_morefrags(hdr-\u003eframe_control) \u0026\u0026\n1870:\t\t !is_multicast_ether_addr(hdr-\u003eaddr1) \u0026\u0026\n1871:\t\t (ieee80211_is_mgmt(hdr-\u003eframe_control) ||\n1872:\t\t ieee80211_is_data(hdr-\u003eframe_control))) {\n1873:\t\t\tstruct ieee80211_sta *sta;\n1874:\t\t\tunsigned int link_id;\n1875:\t\n1876:\t\t\trcu_read_lock();\n1877:\t\t\tsta = ieee80211_find_sta_by_link_addrs(data-\u003ehw, hdr-\u003eaddr2,\n1878:\t\t\t\t\t\t\t hdr-\u003eaddr1, \u0026link_id);\n1879:\t\t\tif (sta) {\n1880:\t\t\t\tstruct hwsim_sta_priv *sp = (void *)sta-\u003edrv_priv;\n1881:\t\n1882:\t\t\t\tif (ieee80211_has_pm(hdr-\u003eframe_control))\n1883:\t\t\t\t\tsp-\u003eactive_links_rx \u0026= ~BIT(link_id);\n1884:\t\t\t\telse\n1885:\t\t\t\t\tsp-\u003eactive_links_rx |= BIT(link_id);\n1886:\t\t\t}\n1887:\t\t\trcu_read_unlock();\n1888:\t\t}\n1889:\t\n1890:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));\n1891:\t\n1892:\t\tmac80211_hwsim_add_vendor_rtap(skb);\n1893:\t\n1894:\t\tif (data-\u003enan.device_vif)\n1895:\t\t\tmac80211_hwsim_nan_rx(data-\u003ehw, skb);\n1896:\t\n1897:\t\tdata-\u003erx_pkts++;\n1898:\t\tdata-\u003erx_bytes += skb-\u003elen;\n1899:\t\tieee80211_rx_irqsafe(data-\u003ehw, skb);\n"
} |
| 35/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 96402 output: 40 thoughts: 44 Thoughts: Okay, here's my interpretation of this thought process, framed in the first person, and assuming I'm already pretty familiar with the mac80211 framework: **Investigating the Origin of `rx_status` in `mac80211_hwsim_rx`** Alright, so I'm looking at `mac80211_hwsim_rx` and something's bugging me. Specifically, I need to figure out where the `rx_status` variable, the one that gets passed into it, is coming from. It's crucial for understanding how the simulated hardware interacts with the receiving process. It defines all the different parameters associated with the frame, which is critical! So, my immediate thought is, "Okay, let's take a look at the code". The only logical way forward is to trace the callers of the function. I know the framework, so I'll quickly look up where this is defined and then I will search for usages of the function, to see how and where it is being called. From there, I can walk back the call stack and hopefully nail down exactly how that `rx_status` is being populated. Then I can debug it, if needed. |
| 36/3 | 2026/09/26 05:50 | tool | grepper |
0mArgs:{
"Expression": "mac80211_hwsim_rx\\(",
"PathPrefix": "drivers/net/wireless/virtual/"
}Results: {
"Output": "drivers/net/wireless/virtual/mac80211_hwsim_main.c=1815=static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1862-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1863:static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1864-\t\t\t struct ieee80211_rx_status *rx_status,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1902=static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2027-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:2028:\t\tmac80211_hwsim_rx(data2, \u0026rx_status, nskb);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2029-\t}\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=6489=static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-6641-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:6642:\tmac80211_hwsim_rx(data2, \u0026rx_status, skb);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-6643-\n"
} |
| 37/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 97286 output: 50 thoughts: 46 Thoughts: Okay, let's dive into this. I need to understand how `rx_status` is being set up within `mac80211_hwsim_main.c`. My immediate thought is to pinpoint *exactly* where it’s initialized, so I'm going to track down the relevant code segments. Let me check lines around 2027 and 6641. That should give me a solid view on where to start. Once I understand the *initial* state, I'll be in a better position to analyze its subsequent usage. |
| 38/3 | 2026/09/26 05:50 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 1980,
"LineCount": 55
}Results: {
"Contents": "1980:\t\t\tif (!(data-\u003egroup \u0026 data2-\u003egroup))\n1981:\t\t\t\tcontinue;\n1982:\t\n1983:\t\t\tif (data-\u003enetgroup != data2-\u003enetgroup)\n1984:\t\t\t\tcontinue;\n1985:\t\n1986:\t\t\t/*\n1987:\t\t\t * Set mactime early since NAN RX filtering relies on it\n1988:\t\t\t * for slot calculation\n1989:\t\t\t */\n1990:\t\t\trx_status.mactime = sim_tsf + data2-\u003etsf_offset;\n1991:\t\n1992:\t\t\tif (!hwsim_chans_compat(chan, data2-\u003etmp_chan) \u0026\u0026\n1993:\t\t\t !hwsim_chans_compat(chan, data2-\u003echannel)) {\n1994:\t\t\t\tieee80211_iterate_active_interfaces_atomic(\n1995:\t\t\t\t\tdata2-\u003ehw, IEEE80211_IFACE_ITER_NORMAL,\n1996:\t\t\t\t\tmac80211_hwsim_tx_iter, \u0026tx_iter_data);\n1997:\t\t\t\tif (!tx_iter_data.receive)\n1998:\t\t\t\t\tcontinue;\n1999:\t\t\t}\n2000:\t\n2001:\t\t\t/*\n2002:\t\t\t * reserve some space for our vendor and the normal\n2003:\t\t\t * radiotap header, since we're copying anyway\n2004:\t\t\t */\n2005:\t\t\tif (skb-\u003elen \u003c PAGE_SIZE \u0026\u0026 paged_rx) {\n2006:\t\t\t\tstruct page *page = alloc_page(GFP_ATOMIC);\n2007:\t\n2008:\t\t\t\tif (!page)\n2009:\t\t\t\t\tcontinue;\n2010:\t\n2011:\t\t\t\tnskb = dev_alloc_skb(128);\n2012:\t\t\t\tif (!nskb) {\n2013:\t\t\t\t\t__free_page(page);\n2014:\t\t\t\t\tcontinue;\n2015:\t\t\t\t}\n2016:\t\n2017:\t\t\t\tmemcpy(page_address(page), skb-\u003edata, skb-\u003elen);\n2018:\t\t\t\tskb_add_rx_frag(nskb, 0, page, 0, skb-\u003elen, skb-\u003elen);\n2019:\t\t\t} else {\n2020:\t\t\t\tnskb = skb_copy(skb, GFP_ATOMIC);\n2021:\t\t\t\tif (!nskb)\n2022:\t\t\t\t\tcontinue;\n2023:\t\t\t}\n2024:\t\n2025:\t\t\tif (mac80211_hwsim_addr_match(data2, hdr-\u003eaddr1))\n2026:\t\t\t\tack = true;\n2027:\t\n2028:\t\t\tmac80211_hwsim_rx(data2, \u0026rx_status, nskb);\n2029:\t\t}\n2030:\t\tspin_unlock(\u0026hwsim_radio_lock);\n2031:\t\n2032:\t\treturn ack;\n2033:\t}\n2034:\t\n"
} |
| 39/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 98309 output: 50 thoughts: 35 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Investigating `rx_status` Initialization in `mac80211_hwsim_tx_frame_no_nl`** Alright, I'm digging into this `rx_status` issue again. My immediate thought is, "Where exactly did we set this thing up in the first place?" I need to refresh my memory and understand how it was declared and initialized, especially in the context of `mac80211_hwsim_tx_frame_no_nl`. Let me go back and trace the flow. I need to refresh my memory from earlier, and see what the code does with the `rx_status`. It's likely related to a downstream problem I am trying to resolve, so understanding the initial setup is critical to debuging this. Let me go back there and refresh my memory. |
| 40/3 | 2026/09/26 05:50 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 1902,
"LineCount": 40
}Results: {
"Contents": "1902:\tstatic bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,\n1903:\t\t\t\t\t\t struct sk_buff *skb,\n1904:\t\t\t\t\t\t struct ieee80211_channel *chan)\n1905:\t{\n1906:\t\tstruct mac80211_hwsim_data *data = hw-\u003epriv, *data2;\n1907:\t\tbool ack = false;\n1908:\t\tstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb-\u003edata;\n1909:\t\tstruct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);\n1910:\t\tstruct ieee80211_rx_status rx_status;\n1911:\t\tu64 sim_tsf = mac80211_hwsim_get_sim_tsf();\n1912:\t\n1913:\t\tmac80211_hwsim_write_tsf(data, skb, sim_tsf);\n1914:\t\n1915:\t\tmac80211_hwsim_monitor_rx(hw, skb, chan-\u003ecenter_freq);\n1916:\t\n1917:\t\tmemset(\u0026rx_status, 0, sizeof(rx_status));\n1918:\t\trx_status.flag |= RX_FLAG_MACTIME_START;\n1919:\t\trx_status.freq = chan-\u003ecenter_freq;\n1920:\t\trx_status.freq_offset = chan-\u003efreq_offset ? 1 : 0;\n1921:\t\trx_status.band = chan-\u003eband;\n1922:\t\tif (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_VHT_MCS) {\n1923:\t\t\trx_status.rate_idx =\n1924:\t\t\t\tieee80211_rate_get_vht_mcs(\u0026info-\u003econtrol.rates[0]);\n1925:\t\t\trx_status.nss =\n1926:\t\t\t\tieee80211_rate_get_vht_nss(\u0026info-\u003econtrol.rates[0]);\n1927:\t\t\trx_status.encoding = RX_ENC_VHT;\n1928:\t\t} else {\n1929:\t\t\trx_status.rate_idx = info-\u003econtrol.rates[0].idx;\n1930:\t\t\tif (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_MCS)\n1931:\t\t\t\trx_status.encoding = RX_ENC_HT;\n1932:\t\t}\n1933:\t\tif (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_40_MHZ_WIDTH)\n1934:\t\t\trx_status.bw = RATE_INFO_BW_40;\n1935:\t\telse if (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_80_MHZ_WIDTH)\n1936:\t\t\trx_status.bw = RATE_INFO_BW_80;\n1937:\t\telse if (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_160_MHZ_WIDTH)\n1938:\t\t\trx_status.bw = RATE_INFO_BW_160;\n1939:\t\telse\n1940:\t\t\trx_status.bw = RATE_INFO_BW_20;\n1941:\t\tif (info-\u003econtrol.rates[0].flags \u0026 IEEE80211_TX_RC_SHORT_GI)\n"
} |
| 41/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 99540 output: 50 thoughts: 49 Thoughts: Here's my summary, as though I'm thinking through this code: **Checking Receiver Status Reset** Okay, so I'm seeing `memset(&rx_status, 0, sizeof(rx_status));` being used here. This is a common pattern, and I want to confirm exactly where in the flow this reset of the `rx_status` structure is happening, to ensure it's correct. I recall that `rx_status` likely holds all the receive-related state information. To contextualize this, I should probably check the `mac80211_hwsim_main.c` file. I'll need to jump into the code and focus my attention around line 6641. I'll review what's happening just before and after this `memset` call to understand the logic. This will give me a better understanding of the timing and the potential implications of this reset. I need to make sure this reset is happening at the appropriate point in the reception process; perhaps after an interrupt has been serviced and before new data is handled. |
| 42/3 | 2026/09/26 05:50 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 6620,
"LineCount": 35
}Results: {
"Contents": "6620:\t\t\t\t\tgoto out;\n6621:\t\t\t\t}\n6622:\t\t\t}\n6623:\t\t\tmutex_unlock(\u0026data2-\u003emutex);\n6624:\t\t} else if (!channel) {\n6625:\t\t\tgoto out;\n6626:\t\t} else {\n6627:\t\t\trx_status.freq = channel-\u003ecenter_freq;\n6628:\t\t\trx_status.band = channel-\u003eband;\n6629:\t\t}\n6630:\t\n6631:\t\trx_status.rate_idx = nla_get_u32(info-\u003eattrs[HWSIM_ATTR_RX_RATE]);\n6632:\t\tif (rx_status.rate_idx \u003e= data2-\u003ehw-\u003ewiphy-\u003ebands[rx_status.band]-\u003en_bitrates)\n6633:\t\t\tgoto out;\n6634:\t\trx_status.signal = nla_get_u32(info-\u003eattrs[HWSIM_ATTR_SIGNAL]);\n6635:\t\n6636:\t\thdr = (void *)skb-\u003edata;\n6637:\t\n6638:\t\tif (ieee80211_is_beacon(hdr-\u003eframe_control) ||\n6639:\t\t ieee80211_is_probe_resp(hdr-\u003eframe_control))\n6640:\t\t\trx_status.boottime_ns = ktime_get_boottime_ns();\n6641:\t\n6642:\t\tmac80211_hwsim_rx(data2, \u0026rx_status, skb);\n6643:\t\n6644:\t\treturn 0;\n6645:\terr:\n6646:\t\tpr_debug(\"mac80211_hwsim: error occurred in %s\\n\", __func__);\n6647:\tout:\n6648:\t\tdev_kfree_skb(skb);\n6649:\t\treturn -EINVAL;\n6650:\t}\n6651:\t\n6652:\tstatic int hwsim_register_received_nl(struct sk_buff *skb_2,\n6653:\t\t\t\t\t struct genl_info *info)\n6654:\t{\n"
} |
| 43/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 100444 output: 50 thoughts: 55 Thoughts: Here's my summary, as if I were thinking it: **Digging into the `hwsim_cloned_frame_received_nl` Initialization** Okay, so I need to understand how the `rx_status` field is being initialized within the `hwsim_cloned_frame_received_nl` function. Given the nature of this code, I'm betting that's where the initial handling of the frame reception begins. Let's jump directly to the source. Let me check lines 6580 through 6620 of `mac80211_hwsim_main.c`. That should give me the core logic surrounding the initialization and any setup of the frame before the rest of the processing. I expect to see the key assignments to the `rx_status` struct in there. Hopefully, that will immediately reveal what I'm looking for regarding the handling of `rx_status`. |
| 44/3 | 2026/09/26 05:50 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 6575,
"LineCount": 45
}Results: {
"Contents": "6575:\t\t\t}\n6576:\t\n6577:\t\t\tif (frame_data_len \u003e found-\u003elen \u0026\u0026\n6578:\t\t\t pskb_expand_head(found, 0, frame_data_len - found-\u003elen,\n6579:\t\t\t\t\t GFP_ATOMIC)) {\n6580:\t\t\t\tspin_unlock_irqrestore(\u0026txdata-\u003epending.lock, flags);\n6581:\t\t\t\tgoto out;\n6582:\t\t\t}\n6583:\t\t\tskb_trim(found, 0);\n6584:\t\t\tskb_put_data(found, frame_data, frame_data_len);\n6585:\t\t\tspin_unlock_irqrestore(\u0026txdata-\u003epending.lock, flags);\n6586:\t\t}\n6587:\t\n6588:\t\t/* check if radio is configured properly */\n6589:\t\n6590:\t\tif ((data2-\u003eidle \u0026\u0026 !data2-\u003etmp_chan) || !data2-\u003estarted)\n6591:\t\t\tgoto out;\n6592:\t\n6593:\t\t/* A frame is received from user space */\n6594:\t\tmemset(\u0026rx_status, 0, sizeof(rx_status));\n6595:\t\tif (info-\u003eattrs[HWSIM_ATTR_FREQ]) {\n6596:\t\t\tstruct tx_iter_data iter_data = {\n6597:\t\t\t\t.hw = data2-\u003ehw,\n6598:\t\t\t\t.rx_status = \u0026rx_status,\n6599:\t\t\t};\n6600:\t\n6601:\t\t\t/* throw away off-channel packets, but allow both the temporary\n6602:\t\t\t * (\"hw\" scan/remain-on-channel), regular channels and links,\n6603:\t\t\t * since the internal datapath also allows this\n6604:\t\t\t */\n6605:\t\t\trx_status.freq = nla_get_u32(info-\u003eattrs[HWSIM_ATTR_FREQ]);\n6606:\t\n6607:\t\t\titer_data.channel = ieee80211_get_channel(data2-\u003ehw-\u003ewiphy,\n6608:\t\t\t\t\t\t\t\t rx_status.freq);\n6609:\t\t\tif (!iter_data.channel)\n6610:\t\t\t\tgoto out;\n6611:\t\t\trx_status.band = iter_data.channel-\u003eband;\n6612:\t\n6613:\t\t\tmutex_lock(\u0026data2-\u003emutex);\n6614:\t\t\tif (!hwsim_chans_compat(iter_data.channel, channel)) {\n6615:\t\t\t\tieee80211_iterate_active_interfaces_atomic(\n6616:\t\t\t\t\tdata2-\u003ehw, IEEE80211_IFACE_ITER_NORMAL,\n6617:\t\t\t\t\tmac80211_hwsim_tx_iter, \u0026iter_data);\n6618:\t\t\t\tif (!iter_data.receive) {\n6619:\t\t\t\t\tmutex_unlock(\u0026data2-\u003emutex);\n"
} |
| 45/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 101512 output: 26 thoughts: 1476 Thoughts: **Deep Dive into the Patch: Potential Memory Issues and Contextual Understanding** Okay, so first things first, `memset(&rx_status, 0, sizeof(rx_status));` is done, which is good housekeeping for a structure. Now, let's confirm the definition of the `struct ieee80211_rx_status`. Yep, there it is in `include/net/mac80211.h`. Aha, `smd_ctx` is tucked away in a union with `boottime_ns` and `ack_tx_hwtstamp`. That's a key detail. We also see that `rx_status.boottime_ns = ktime_get_boottime_ns();` is called in `mac80211_hwsim_main.c`. This means that if `smd_ctx_valid` remains zero (because of `memset`), the `status->smd_ctx_valid` will be zero as well. Looking at `ieee80211_rx_list`, it becomes clear that it checks `smd_ctx_valid` before using `smd_ctx`. So it's safe if it remains 0. And, the `static_assert` ensures the size of `rx_status` fits in the `sk_buff`'s control block (`cb`). Okay, that passes. Now, let's dissect this patch. I'll need to go line by line through the diff to be sure. First up, `include/linux/ieee80211-uhr.h`. We're adding some constants here. Let's make sure that these numbers are sensible and won't cause any unexpected behavior later on. Constants look like they are all reasonable, related to UHR configuration and context. We see the introduction of `ieee80211_smd_ctx_ba`, `ieee80211_smd_ctx` structs, and their elements. And new helper functions: `ieee80211_is_uhr_link_reconf_req`, `ieee80211_is_st_prep_req`, and `ieee80211_is_st_exec_req`. Alright, let's examine the `ieee80211_is_uhr_link_reconf_req` function. It looks like it checks for a specific action frame. Let's make sure the size checks are done correctly. I need to make sure the size check isn't vulnerable to any overflows, particularly in this function: `ieee80211_is_uhr_link_reconf_req` where `IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req)` is used. Time to get the grepper out and find that definition! |
| 46/3 | 2026/09/26 05:50 | tool | grepper |
0mArgs:{
"Expression": "IEEE80211_MIN_ACTION_SIZE"
}Results: {
"Output": "drivers/net/wireless/ath/ath11k/mac.c=6264=static int ath11k_mac_mgmt_action_frame_fill_elem_data(struct ath11k_vif *arvif,\n--\ndrivers/net/wireless/ath/ath11k/mac.c-6279-\t/* make sure category field is present */\ndrivers/net/wireless/ath/ath11k/mac.c:6280:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\ndrivers/net/wireless/ath/ath11k/mac.c-6281-\t\treturn -EINVAL;\ndrivers/net/wireless/ath/ath11k/mac.c-6282-\ndrivers/net/wireless/ath/ath11k/mac.c:6283:\tremaining_len = skb-\u003elen - IEEE80211_MIN_ACTION_SIZE(category);\ndrivers/net/wireless/ath/ath11k/mac.c-6284-\thas_protected = ieee80211_has_protected(hdr-\u003eframe_control);\n--\ndrivers/net/wireless/ath/ath11k/mac.c-6326-\tcategory = *buf++;\ndrivers/net/wireless/ath/ath11k/mac.c:6327:\t/* category code is already taken care in %IEEE80211_MIN_ACTION_SIZE hence\ndrivers/net/wireless/ath/ath11k/mac.c-6328-\t * no need to adjust remaining_len\n--\ndrivers/net/wireless/ath/ath12k/mac.c=9290=static int ath12k_mac_mgmt_action_frame_fill_elem_data(struct ath12k_link_vif *arvif,\n--\ndrivers/net/wireless/ath/ath12k/mac.c-9308-\t/* make sure category field is present */\ndrivers/net/wireless/ath/ath12k/mac.c:9309:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\ndrivers/net/wireless/ath/ath12k/mac.c-9310-\t\treturn -EINVAL;\ndrivers/net/wireless/ath/ath12k/mac.c-9311-\ndrivers/net/wireless/ath/ath12k/mac.c:9312:\tremaining_len = skb-\u003elen - IEEE80211_MIN_ACTION_SIZE(category);\ndrivers/net/wireless/ath/ath12k/mac.c-9313-\thas_protected = ieee80211_has_protected(hdr-\u003eframe_control);\n--\ndrivers/net/wireless/ath/ath12k/mac.c-9355-\tcategory = *buf++;\ndrivers/net/wireless/ath/ath12k/mac.c:9356:\t/* category code is already taken care in %IEEE80211_MIN_ACTION_SIZE hence\ndrivers/net/wireless/ath/ath12k/mac.c-9357-\t * no need to adjust remaining_len\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c=1435=void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c-1442-\tsize_t ies_len, lci_len = 0, civic_len = 0;\ndrivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1443:\tsize_t baselen = IEEE80211_MIN_ACTION_SIZE(ftm);\ndrivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c-1444-\tstatic const u8 rprt_type_lci = IEEE80211_SPCT_MSR_RPRT_TYPE_LCI;\n--\ndrivers/net/wireless/marvell/mwifiex/tdls.c=729=mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv,\n--\ndrivers/net/wireless/marvell/mwifiex/tdls.c-757-\t\t/* See the layout of 'struct ieee80211_mgmt'. */\ndrivers/net/wireless/marvell/mwifiex/tdls.c:758:\t\textra = IEEE80211_MIN_ACTION_SIZE(tdls_discover_resp) - 24;\ndrivers/net/wireless/marvell/mwifiex/tdls.c-759-\t\tskb_put(skb, extra);\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c=410=mt76_connac2_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-424-\tif (ieee80211_is_action(fc) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:425:\t skb-\u003elen \u003e= IEEE80211_MIN_ACTION_SIZE(addba_req.capab) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-426-\t mgmt-\u003eu.action.category == WLAN_CATEGORY_BACK \u0026\u0026\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c=676=mt7925_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c-689-\tif (ieee80211_is_action(fc) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c:690:\t skb-\u003elen \u003e= IEEE80211_MIN_ACTION_SIZE(action_code) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c-691-\t mgmt-\u003eu.action.category == WLAN_CATEGORY_BACK \u0026\u0026\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c=759=mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c-776-\tif (ieee80211_is_action(fc) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c:777:\t skb-\u003elen \u003e= IEEE80211_MIN_ACTION_SIZE(action_code) \u0026\u0026\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c-778-\t mgmt-\u003eu.action.category == WLAN_CATEGORY_BACK \u0026\u0026\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c=5176=static void rtl8xxxu_dump_action(struct device *dev,\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5184-\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:5185:\tif (skb_len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5186-\t\treturn;\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5189-\tcase WLAN_ACTION_ADDBA_RESP:\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:5190:\t\tif (skb_len \u003c IEEE80211_MIN_ACTION_SIZE(addba_resp))\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5191-\t\t\tbreak;\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5204-\tcase WLAN_ACTION_ADDBA_REQ:\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:5205:\t\tif (skb_len \u003c IEEE80211_MIN_ACTION_SIZE(addba_req))\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-5206-\t\t\tbreak;\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c=1367=bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-1378-\tmgmt = (void *)skb-\u003edata;\ndrivers/net/wireless/realtek/rtlwifi/base.c:1379:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\ndrivers/net/wireless/realtek/rtlwifi/base.c-1380-\t\treturn true;\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-1399-\ndrivers/net/wireless/realtek/rtlwifi/base.c:1400:\t\t\t\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(addba_req))\ndrivers/net/wireless/realtek/rtlwifi/base.c-1401-\t\t\t\t\treturn true;\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c=2390=static struct sk_buff *rtl_make_smps_action(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-2397-\ndrivers/net/wireless/realtek/rtlwifi/base.c:2398:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(ht_smps) +\ndrivers/net/wireless/realtek/rtlwifi/base.c-2399-\t\t\t hw-\u003eextra_tx_headroom);\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-2403-\tskb_reserve(skb, hw-\u003eextra_tx_headroom);\ndrivers/net/wireless/realtek/rtlwifi/base.c:2404:\taction_frame = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(ht_smps));\ndrivers/net/wireless/realtek/rtlwifi/base.c-2405-\tmemcpy(action_frame-\u003eda, da, ETH_ALEN);\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c=2517=struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-2524-\ndrivers/net/wireless/realtek/rtlwifi/base.c:2525:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(delba) +\ndrivers/net/wireless/realtek/rtlwifi/base.c-2526-\t\t\t hw-\u003eextra_tx_headroom);\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-2530-\tskb_reserve(skb, hw-\u003eextra_tx_headroom);\ndrivers/net/wireless/realtek/rtlwifi/base.c:2531:\taction_frame = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(delba));\ndrivers/net/wireless/realtek/rtlwifi/base.c-2532-\tmemcpy(action_frame-\u003esa, sa, ETH_ALEN);\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c=467=static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c-526-\ndrivers/net/wireless/realtek/rtlwifi/pci.c:527:\t\t\tif (skb-\u003elen \u003e= IEEE80211_MIN_ACTION_SIZE(action_code) \u0026\u0026\ndrivers/net/wireless/realtek/rtlwifi/pci.c-528-\t\t\t action_frame-\u003eu.action.action_code ==\n--\ndrivers/net/wireless/silabs/wfx/data_rx.c=38=void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb)\n--\ndrivers/net/wireless/silabs/wfx/data_rx.c-82-\t mgmt-\u003eu.action.category == WLAN_CATEGORY_BACK \u0026\u0026\ndrivers/net/wireless/silabs/wfx/data_rx.c:83:\t skb-\u003elen \u003e IEEE80211_MIN_ACTION_SIZE(action_code)) {\ndrivers/net/wireless/silabs/wfx/data_rx.c-84-\t\twfx_rx_handle_ba(wvif, mgmt);\n--\ninclude/linux/ieee80211-uhr.h=751=static inline bool ieee80211_is_uhr_link_reconf_req(struct sk_buff *skb)\n--\ninclude/linux/ieee80211-uhr.h-758-\ninclude/linux/ieee80211-uhr.h:759:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))\ninclude/linux/ieee80211-uhr.h-760-\t\treturn false;\n--\ninclude/linux/ieee80211.h=992=struct ieee80211_mgmt {\n--\ninclude/linux/ieee80211.h-1221-\ninclude/linux/ieee80211.h:1222:#define IEEE80211_MIN_ACTION_SIZE(type)\toffsetofend(struct ieee80211_mgmt, u.action.type)\ninclude/linux/ieee80211.h-1223-\n--\ninclude/linux/ieee80211.h=2401=static inline bool ieee80211_is_bufferable_mmpdu(struct sk_buff *skb)\n--\ninclude/linux/ieee80211.h-2418-\ninclude/linux/ieee80211.h:2419:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\ninclude/linux/ieee80211.h-2420-\t\treturn true;\n--\ninclude/linux/ieee80211.h=2476=static inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)\ninclude/linux/ieee80211.h-2477-{\ninclude/linux/ieee80211.h:2478:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\ninclude/linux/ieee80211.h-2479-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2489=static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,\n--\ninclude/linux/ieee80211.h-2493-\ninclude/linux/ieee80211.h:2494:\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(category))\ninclude/linux/ieee80211.h-2495-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2510=ieee80211_is_protected_dual_of_public_action(struct sk_buff *skb)\n--\ninclude/linux/ieee80211.h-2515-\tif (!ieee80211_is_public_action((void *)skb-\u003edata, skb-\u003elen) ||\ninclude/linux/ieee80211.h:2516:\t skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\ninclude/linux/ieee80211.h-2517-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2556=static inline bool ieee80211_is_group_privacy_action(struct sk_buff *skb)\ninclude/linux/ieee80211.h-2557-{\ninclude/linux/ieee80211.h:2558:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\ninclude/linux/ieee80211.h-2559-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2648=static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)\n--\ninclude/linux/ieee80211.h-2654-\ninclude/linux/ieee80211.h:2655:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(tpc_report))\ninclude/linux/ieee80211.h-2656-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2690=static inline bool ieee80211_is_timing_measurement(struct sk_buff *skb)\n--\ninclude/linux/ieee80211.h-2693-\ninclude/linux/ieee80211.h:2694:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(wnm_timing_msr))\ninclude/linux/ieee80211.h-2695-\t\treturn false;\n--\ninclude/linux/ieee80211.h=2713=static inline bool ieee80211_is_ftm(struct sk_buff *skb)\n--\ninclude/linux/ieee80211.h-2716-\ninclude/linux/ieee80211.h:2717:\tif (skb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(ftm))\ninclude/linux/ieee80211.h-2718-\t\treturn false;\n--\nnet/mac80211/agg-tx.c=61=static void ieee80211_send_addba_request(struct sta_info *sta, u16 tid,\n--\nnet/mac80211/agg-tx.c-70-\nnet/mac80211/agg-tx.c:71:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(addba_req) +\nnet/mac80211/agg-tx.c-72-\t\t\t 2 + sizeof(struct ieee80211_addba_ext_ie) +\n--\nnet/mac80211/ap.c=14=ieee80211_send_eml_op_mode_notif(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ap.c-16-{\nnet/mac80211/ap.c:17:\tint len = IEEE80211_MIN_ACTION_SIZE(eml_omn);\nnet/mac80211/ap.c-18-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/ap.c=51=ieee80211_rx_eml_op_mode_notif(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ap.c-53-{\nnet/mac80211/ap.c:54:\tint len = IEEE80211_MIN_ACTION_SIZE(eml_omn);\nnet/mac80211/ap.c-55-\tenum nl80211_iftype type = ieee80211_vif_type_p2p(\u0026sdata-\u003evif);\n--\nnet/mac80211/ap.c=188=ieee80211_rx_uhr_link_reconfig_req(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ap.c-205-\t\tieee802_11_parse_elems(mgmt-\u003eu.action.uhr_link_reconf_req.variable,\nnet/mac80211/ap.c:206:\t\t\t\t skb-\u003elen - IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req),\nnet/mac80211/ap.c-207-\t\t\t\t IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION,\n--\nnet/mac80211/ht.c=427=void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ht.c-436-\nnet/mac80211/ht.c:437:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(delba) +\nnet/mac80211/ht.c-438-\t\t\t local-\u003ehw.extra_tx_headroom);\n--\nnet/mac80211/ht.c=497=int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ht.c-506-\nnet/mac80211/ht.c:507:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(ht_smps) +\nnet/mac80211/ht.c-508-\t\t\t local-\u003ehw.extra_tx_headroom);\n--\nnet/mac80211/ht.c-512-\tskb_reserve(skb, local-\u003ehw.extra_tx_headroom);\nnet/mac80211/ht.c:513:\taction_frame = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(ht_smps));\nnet/mac80211/ht.c-514-\tmemcpy(action_frame-\u003eda, da, ETH_ALEN);\n--\nnet/mac80211/ibss.c=863=ieee80211_rx_mgmt_spectrum_mgmt(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ibss.c-867-{\nnet/mac80211/ibss.c:868:\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(chan_switch))\nnet/mac80211/ibss.c-869-\t\treturn;\n--\nnet/mac80211/mesh_hwmp.c=55=static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,\n--\nnet/mac80211/mesh_hwmp.c-62-{\nnet/mac80211/mesh_hwmp.c:63:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(mesh_action);\nnet/mac80211/mesh_hwmp.c-64-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/mesh_hwmp.c=189=int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mesh_hwmp.c-192-{\nnet/mac80211/mesh_hwmp.c:193:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(mesh_action);\nnet/mac80211/mesh_hwmp.c-194-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/mesh_hwmp.c=904=void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mesh_hwmp.c-912-\t/* need action_code */\nnet/mac80211/mesh_hwmp.c:913:\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(mesh_action))\nnet/mac80211/mesh_hwmp.c-914-\t\treturn;\n--\nnet/mac80211/mesh_plink.c=211=static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mesh_plink.c-215-{\nnet/mac80211/mesh_plink.c:216:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(self_prot);\nnet/mac80211/mesh_plink.c-217-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/mesh_plink.c=1221=void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mesh_plink.c-1229-\t/* need aux */\nnet/mac80211/mesh_plink.c:1230:\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(self_prot) + 1)\nnet/mac80211/mesh_plink.c-1231-\t\treturn;\n--\nnet/mac80211/mlme.c=1453=static void ieee80211_send_uhr_omp_req_dbe(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-1492-\tsize = local-\u003ehw.extra_tx_headroom +\nnet/mac80211/mlme.c:1493:\t IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req) +\nnet/mac80211/mlme.c-1494-\t 3 + sizeof(*mle) + sizeof(*common) +\n--\nnet/mac80211/mlme.c-1504-\nnet/mac80211/mlme.c:1505:\tmgmt = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req));\nnet/mac80211/mlme.c-1506-\tmgmt-\u003eframe_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |\n--\nnet/mac80211/mlme.c=8564=ieee80211_send_neg_ttlm_req(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-8570-\tstruct sk_buff *skb;\nnet/mac80211/mlme.c:8571:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(ttlm_req);\nnet/mac80211/mlme.c-8572-\tint ttlm_max_len = 2 + 1 + sizeof(struct ieee80211_ttlm_elem) + 1 +\n--\nnet/mac80211/mlme.c=8631=ieee80211_send_neg_ttlm_res(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-8638-\tstruct sk_buff *skb;\nnet/mac80211/mlme.c:8639:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(ttlm_res);\nnet/mac80211/mlme.c-8640-\tint ttlm_max_len = 2 + 1 + sizeof(struct ieee80211_ttlm_elem) + 1 +\n--\nnet/mac80211/mlme.c=8762=static void ieee80211_process_neg_ttlm_req(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-8777-\tdialog_token = mgmt-\u003eu.action.ttlm_req.dialog_token;\nnet/mac80211/mlme.c:8778:\ties_len = len - IEEE80211_MIN_ACTION_SIZE(ttlm_req);\nnet/mac80211/mlme.c-8779-\telems = ieee802_11_parse_elems(mgmt-\u003eu.action.ttlm_req.variable,\n--\nnet/mac80211/mlme.c=8876=void ieee80211_send_teardown_neg_ttlm(struct ieee80211_vif *vif)\nnet/mac80211/mlme.c-8877-{\nnet/mac80211/mlme.c:8878:\tint frame_len = IEEE80211_MIN_ACTION_SIZE(ttlm_tear_down);\nnet/mac80211/mlme.c-8879-\tstruct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);\n--\nnet/mac80211/mlme.c=10920=ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-10937-\tif (!ieee80211_vif_is_mld(\u0026sdata-\u003evif) ||\nnet/mac80211/mlme.c:10938:\t len \u003c IEEE80211_MIN_ACTION_SIZE(ml_reconf_resp) ||\nnet/mac80211/mlme.c-10939-\t mgmt-\u003eu.action.ml_reconf_resp.dialog_token !=\n--\nnet/mac80211/mlme.c=11153=ieee80211_build_ml_reconf_req(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-11243-\tskb_reserve(skb, local-\u003ehw.extra_tx_headroom);\nnet/mac80211/mlme.c:11244:\tmgmt = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(ml_reconf_req));\nnet/mac80211/mlme.c-11245-\n--\nnet/mac80211/mlme.c=11627=int ieee80211_mgd_set_epcs(struct ieee80211_sub_if_data *sdata, bool enable)\nnet/mac80211/mlme.c-11628-{\nnet/mac80211/mlme.c:11629:\tint frame_len = IEEE80211_MIN_ACTION_SIZE(epcs) + (enable ? 1 : 0);\nnet/mac80211/mlme.c-11630-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/mlme.c=11749=static void ieee80211_process_epcs_ena_resp(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-11783-\tpos += IEEE80211_EPCS_ENA_RESP_BODY_LEN;\nnet/mac80211/mlme.c:11784:\ties_len = len - IEEE80211_MIN_ACTION_SIZE(epcs) -\nnet/mac80211/mlme.c-11785-\t\tIEEE80211_EPCS_ENA_RESP_BODY_LEN;\n--\nnet/mac80211/rx.c=242=static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/rx.c-254-\nnet/mac80211/rx.c:255:\tBUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE(action_code));\nnet/mac80211/rx.c-256-\n--\nnet/mac80211/rx.c=1111=static ieee80211_rx_result ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-1144-\t\t\t/* make sure category field is present */\nnet/mac80211/rx.c:1145:\t\t\tif (rx-\u003eskb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\nnet/mac80211/rx.c-1146-\t\t\t\treturn RX_DROP_U_RUNT_ACTION;\n--\nnet/mac80211/rx.c=3409=static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/rx.c-3427-\nnet/mac80211/rx.c:3428:\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(sa_query)) {\nnet/mac80211/rx.c-3429-\t\t/* Too short SA Query request frame */\n--\nnet/mac80211/rx.c-3437-\tskb_reserve(skb, local-\u003ehw.extra_tx_headroom);\nnet/mac80211/rx.c:3438:\tresp = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(sa_query));\nnet/mac80211/rx.c-3439-\tmemcpy(resp-\u003eda, sdata-\u003evif.cfg.ap_addr, ETH_ALEN);\n--\nnet/mac80211/rx.c=3500=ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-3520-\tif (ieee80211_is_action(mgmt-\u003eframe_control) \u0026\u0026\nnet/mac80211/rx.c:3521:\t rx-\u003eskb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(category))\nnet/mac80211/rx.c-3522-\t\treturn RX_DROP_U_RUNT_ACTION;\n--\nnet/mac80211/rx.c=3552=ieee80211_process_rx_twt_action(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-3573-\nnet/mac80211/rx.c:3574:\t\tif (rx-\u003eskb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code) +\nnet/mac80211/rx.c-3575-\t\t\t\t sizeof(struct ieee80211_twt_setup) +\n--\nnet/mac80211/rx.c-3582-\nnet/mac80211/rx.c:3583:\t\tif (rx-\u003eskb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code) +\nnet/mac80211/rx.c-3584-\t\t\t\t 3 + /* token + tlv */\n--\nnet/mac80211/rx.c-3590-\tcase WLAN_S1G_TWT_TEARDOWN:\nnet/mac80211/rx.c:3591:\t\tif (rx-\u003eskb-\u003elen \u003c IEEE80211_MIN_ACTION_SIZE(action_code) + 1)\nnet/mac80211/rx.c-3592-\t\t\tbreak;\n--\nnet/mac80211/rx.c=3603=ieee80211_rx_h_action(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-3635-\t\t/* verify action \u0026 smps_control/chanwidth are present */\nnet/mac80211/rx.c:3636:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ht_smps))\nnet/mac80211/rx.c-3637-\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3702-\tcase WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION:\nnet/mac80211/rx.c:3703:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3704-\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3713-\t\t\tbreak;\nnet/mac80211/rx.c:3714:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ext_chan_switch))\nnet/mac80211/rx.c-3715-\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3725-\t\t/* verify action code is present */\nnet/mac80211/rx.c:3726:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3727-\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3731-\t\t\t/* verify opmode is present */\nnet/mac80211/rx.c:3732:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(vht_opmode_notif))\nnet/mac80211/rx.c-3733-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3736-\t\tcase WLAN_VHT_ACTION_GROUPID_MGMT: {\nnet/mac80211/rx.c:3737:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(vht_group_notif))\nnet/mac80211/rx.c-3738-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3754-\t\t/* verify action_code is present */\nnet/mac80211/rx.c:3755:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3756-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3760-\t\tcase WLAN_ACTION_NDP_ADDBA_REQ:\nnet/mac80211/rx.c:3761:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(addba_req))\nnet/mac80211/rx.c-3762-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3765-\t\tcase WLAN_ACTION_NDP_ADDBA_RESP:\nnet/mac80211/rx.c:3766:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(addba_resp))\nnet/mac80211/rx.c-3767-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3770-\t\tcase WLAN_ACTION_NDP_DELBA:\nnet/mac80211/rx.c:3771:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(delba))\nnet/mac80211/rx.c-3772-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3780-\t\t/* verify action_code is present */\nnet/mac80211/rx.c:3781:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3782-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3788-\nnet/mac80211/rx.c:3789:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(measurement))\nnet/mac80211/rx.c-3790-\t\t\t\tbreak;\n--\nnet/mac80211/rx.c-3798-\t\t\tu8 *bssid;\nnet/mac80211/rx.c:3799:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(chan_switch))\nnet/mac80211/rx.c-3800-\t\t\t\tbreak;\n--\nnet/mac80211/rx.c-3823-\tcase WLAN_CATEGORY_SELF_PROTECTED:\nnet/mac80211/rx.c:3824:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(self_prot))\nnet/mac80211/rx.c-3825-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3844-\tcase WLAN_CATEGORY_MESH_ACTION:\nnet/mac80211/rx.c:3845:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3846-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3854-\tcase WLAN_CATEGORY_S1G:\nnet/mac80211/rx.c:3855:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3856-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3868-\tcase WLAN_CATEGORY_PROTECTED_EHT:\nnet/mac80211/rx.c:3869:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3870-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3876-\nnet/mac80211/rx.c:3877:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ttlm_req))\nnet/mac80211/rx.c-3878-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3883-\nnet/mac80211/rx.c:3884:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ttlm_res))\nnet/mac80211/rx.c-3885-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3890-\nnet/mac80211/rx.c:3891:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ttlm_tear_down))\nnet/mac80211/rx.c-3892-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3900-\t\t\t */\nnet/mac80211/rx.c:3901:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(ml_reconf_resp) + 3)\nnet/mac80211/rx.c-3902-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3907-\nnet/mac80211/rx.c:3908:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(epcs) +\nnet/mac80211/rx.c-3909-\t\t\t\t IEEE80211_EPCS_ENA_RESP_BODY_LEN)\n--\nnet/mac80211/rx.c-3915-\nnet/mac80211/rx.c:3916:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(epcs))\nnet/mac80211/rx.c-3917-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3922-\nnet/mac80211/rx.c:3923:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(eml_omn))\nnet/mac80211/rx.c-3924-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3930-\tcase WLAN_CATEGORY_PROTECTED_UHR:\nnet/mac80211/rx.c:3931:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(action_code))\nnet/mac80211/rx.c-3932-\t\t\tbreak;\n--\nnet/mac80211/rx.c-3937-\t\t\t\tbreak;\nnet/mac80211/rx.c:3938:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))\nnet/mac80211/rx.c-3939-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c-3947-\nnet/mac80211/rx.c:3948:\t\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_notif))\nnet/mac80211/rx.c-3949-\t\t\t\tgoto invalid;\n--\nnet/mac80211/rx.c=4038=ieee80211_rx_h_action_post_userspace(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-4048-\tcase WLAN_CATEGORY_SA_QUERY:\nnet/mac80211/rx.c:4049:\t\tif (len \u003c IEEE80211_MIN_ACTION_SIZE(sa_query))\nnet/mac80211/rx.c-4050-\t\t\tbreak;\n--\nnet/mac80211/s1g.c=26=ieee80211_s1g_send_twt_setup(struct ieee80211_sub_if_data *sdata, const u8 *da,\n--\nnet/mac80211/s1g.c-28-{\nnet/mac80211/s1g.c:29:\tint len = IEEE80211_MIN_ACTION_SIZE(s1g) + 3 + twt-\u003elength;\nnet/mac80211/s1g.c-30-\tstruct ieee80211_local *local = sdata-\u003elocal;\n--\nnet/mac80211/s1g.c=57=ieee80211_s1g_send_twt_teardown(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/s1g.c-65-\tskb = dev_alloc_skb(local-\u003ehw.extra_tx_headroom +\nnet/mac80211/s1g.c:66:\t\t\t IEEE80211_MIN_ACTION_SIZE(s1g) + 1);\nnet/mac80211/s1g.c-67-\tif (!skb)\n--\nnet/mac80211/s1g.c-70-\tskb_reserve(skb, local-\u003ehw.extra_tx_headroom);\nnet/mac80211/s1g.c:71:\tmgmt = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(s1g) + 1);\nnet/mac80211/s1g.c-72-\tmgmt-\u003eframe_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |\n--\nnet/mac80211/spectmgmt.c=394=static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/spectmgmt.c-402-\nnet/mac80211/spectmgmt.c:403:\tskb = dev_alloc_skb(IEEE80211_MIN_ACTION_SIZE(measurement) +\nnet/mac80211/spectmgmt.c-404-\t\t\t local-\u003ehw.extra_tx_headroom);\n--\nnet/mac80211/spectmgmt.c-408-\tskb_reserve(skb, local-\u003ehw.extra_tx_headroom);\nnet/mac80211/spectmgmt.c:409:\tmsr_report = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(measurement));\nnet/mac80211/spectmgmt.c-410-\tmemcpy(msr_report-\u003eda, da, ETH_ALEN);\n--\nnet/mac80211/tdls.c=878=ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,\n--\nnet/mac80211/tdls.c-888-\nnet/mac80211/tdls.c:889:\tmgmt = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE(tdls_discover_resp));\nnet/mac80211/tdls.c-890-\tmemcpy(mgmt-\u003eda, peer, ETH_ALEN);\n--\nnet/mac80211/util.c=3882=int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/util.c-3884-{\nnet/mac80211/util.c:3885:\tint hdr_len = IEEE80211_MIN_ACTION_SIZE(chan_switch);\nnet/mac80211/util.c-3886-\tstruct sk_buff *skb;\n"
} |
| 47/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 117252 output: 42 thoughts: 73 Thoughts: Here's my summary, as I understand the situation: **Analyzing the IEEE 802.11 Management Frame Structure** Alright, let's break this down. My initial concern is the validity of this `uhr_link_reconf_req` message within the 802.11 management frame context. Specifically, I need to ensure that the critical header fields are present, before any further processing of the request. The code's using `IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req)` which is designed to validate the existence of the expected header components. It needs to contain at least the `category`, `action_code`, and the `uhr_link_reconf_req` fields which encapsulate the actual dialog token and type information. I need to make sure this meets the base structural needs of a valid 802.11 management frame. Before I delve deeper into the payload, I need to confirm the frame structure adheres to the 802.11 standard. This means I'm going to double-check my understanding of `struct ieee80211_mgmt`. This will confirm I'm not missing anything and I have the correct base data structure in mind. This is all about ensuring the management frame is well-formed before interpreting the data within. |
| 48/3 | 2026/09/26 05:50 | tool | grepper |
0mArgs:{
"Expression": "uhr_link_reconf_req",
"PathPrefix": "include/linux/ieee80211.h"
}Results: {
"Output": "include/linux/ieee80211.h=992=struct ieee80211_mgmt {\n--\ninclude/linux/ieee80211.h-1191-\t\t\t\t\tu8 variable[];\ninclude/linux/ieee80211.h:1192:\t\t\t\t} __packed uhr_link_reconf_req;\ninclude/linux/ieee80211.h-1193-\t\t\t\tstruct {\n"
} |
| 49/3 | 2026/09/26 05:50 | llm | kmsan-evaluator-compressor |
0mModel:gemini-3.8-flash Args: null Results: null Reply: ### Investigation Overview and Goal
The agent is assessing whether the patch series introducing IEEE 802.11bn / UHR Seamless Mobility Domain (SMD) and BSS Transition support into `include/linux/ieee80211-uhr.h`, `include/net/cfg80211.h`, `include/net/mac80211.h`, `include/uapi/linux/nl80211.h`, `net/mac80211/`, and `net/wireless/` requires a dedicated KMSAN (KernelMemorySanitizer) fuzzing session (`NeedsKMSAN=true` vs `NeedsKMSAN=false`).
Key criterion: Dedicated KMSAN is justified **only** if uninitialized memory risks (uninitialized field reads in control flow, info-leaks across user/kernel boundary via netlink skbs, missing zero-initialization before copy, padding leaks) exist that cannot be caught by standard KASAN/LOCKDEP/etc.
---
### Approaches Tried and Results
1. **Grepping for `smd_ctx` across the codebase**:
- Located definitions of `struct ieee80211_smd_ctx`, `struct ieee80211_smd_ctx_ba`, `struct cfg80211_smd_transition_info`, and driver/nl80211 ops.
- Identified serialization into Netlink messages: `nl80211_put_smd_ctx()` in `net/wireless/nl80211.c`.
- Identified parsing from Netlink messages: `nl80211_parse_smd_ctx()` in `net/wireless/nl80211.c`.
- Identified RX path handling: `ieee80211_rx_list()` and `ieee80211_rx_h_userspace_mgmt_st_req_frame()` in `net/mac80211/rx.c`.
2. **Inspecting driver implementations of `set_smd_ctx` and `get_smd_ctx`**:
- Grepped `drivers/net/wireless` for `set_smd_ctx`.
- Result: No wireless hardware drivers currently implement `set_smd_ctx` or `get_smd_ctx` in tree yet.
- Grepped for `NL80211_EXT_FEATURE_SMD`: Only present in `nl80211.h` and validation checks in `net/wireless/nl80211.c`.
3. **Tracing where Netlink notifications send `smd_ctx`**:
- Looked at `nl80211_send_mgmt()`:
```c
if (info->st_info.ctx)
st_roaming_data_len = nl80211_smd_ctx_nl_size(&info->st_info);
...
if (st_roaming_data_len &&
nl80211_put_smd_ctx(msg, &info->st_info))
```
- Looked at `nl80211_notify_get_smd_ctx_done()`:
```c
if (st_info->ctx && nl80211_put_smd_ctx(msg, st_info))
```
- Looked at where `info->st_info.ctx` comes from on RX:
In `net/mac80211/rx.c`:
```c
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
if (status->smd_ctx_valid) {
smd_ctx = status->smd_ctx;
status->smd_ctx = NULL;
status->smd_ctx_valid = false;
}
...
rx.smd_ctx = smd_ctx;
...
ieee80211_rx_h_userspace_mgmt_st_req_frame(&info, rx);
```
4. **Examining `ieee80211_rx_status` definition and driver RX callbacks**:
- `struct ieee80211_rx_status` added `smd_ctx` inside a union and a bitfield:
```c
union {
u64 boottime_ns;
ktime_t ack_tx_hwtstamp;
struct ieee80211_smd_ctx *smd_ctx;
};
...
u8 link_id:4,
smd_ctx_valid:1;
```
- Checked driver uses of `IEEE80211_SKB_RXCB`:
Most drivers either `memset(rx_status, 0, sizeof(*rx_status))` or `memcpy(..., &rx_status, sizeof(...))` where `rx_status` is stack-allocated and initialized.
- Checked `mac80211_hwsim_main.c`: Checked where `rx_status` is initialized in `mac80211_hwsim_tx_frame_no_nl()`.
---
### Current Hypotheses and Lines of Investigation
1. **`rx_status` in `mac80211_hwsim_tx_frame_no_nl()`**:
- In `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, around line 1902: how is `rx_status` initialized before line 1990 (`rx_status.mactime = ...`) and line 2028 (`mac80211_hwsim_rx(data2, &rx_status, nskb)`)?
- If `rx_status` on the stack in `mac80211_hwsim` (or any other driver) is NOT zero-initialized, could `smd_ctx_valid` be uninitialized stack garbage?
- If `status->smd_ctx_valid` is uninitialized or 1, `status->smd_ctx` (which aliases `boottime_ns` or uninitialized stack bytes) would be treated as a pointer, dereferenced in `nl80211_put_smd_ctx()`, and passed to `kfree(smd_ctx)`! Note: invalid pointer deref/wild pointer free is typically caught by KASAN / general protection fault, but if it reads uninitialized fields, KMSAN detects uninit branch/read.
- Need to check lines 1900-1980 of `drivers/net/wireless/virtual/mac80211_hwsim_main.c`.
2. **Netlink serialization in `nl80211_put_smd_ctx()`**:
- Reads:
- `ctx->dl.valid_tid_bmap`
- `ctx->valid_ctx_bmap`
- `ctx->dl.sn[tid]`
- `ctx->dl.pn`
- `ctx->dl.ba[tid]`
- `ctx->ul.*`
- `ctx->drv_ctx`
- In `nl80211_parse_smd_ctx()` (userspace to kernel path):
`ctx = kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL);`
Zero-initialized.
- In `drv_set_smd_ctx()` tracepoint:
Reads `ctx->dl.valid_tid_bmap` and `ctx->ul.valid_tid_bmap` using `BITS_TO_LONGS(IEEE80211_SMD_CTX_NUM_TIDS)`.
- In `nl80211_put_smd_ctx_ba_params()`:
Checks `ba->amsdu_supported` and puts individual fields.
3. **Tracepoints in `net/mac80211/trace.h` and `net/wireless/trace.h`**:
- Tracepoints `drv_set_smd_ctx` and `rdev_set_smd_ctx`:
```c
sz = BITS_TO_LONGS(__entry->num_tids) * sizeof(unsigned long);
memcpy(__get_dynamic_array(dl_tid_bitmap), ctx->dl.valid_tid_bmap, sz);
```
`IEEE80211_SMD_CTX_NUM_TIDS` is 8. `BITS_TO_LONGS(8)` is 1 (8 bytes on 64-bit).
In `struct ieee80211_smd_ctx`:
`DECLARE_BITMAP(valid_tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS);` -> `unsigned long valid_tid_bmap[1]`.
Size matches.
4. **Structure padding or Info Leaks to Userspace**:
- Netlink attributes use `nla_put_u8`, `nla_put_u16`, `nla_put` with explicit lengths. They do not put raw structs directly (e.g. `nla_put(..., sizeof(struct), &struct)` is NOT used for `struct ieee80211_smd_ctx_ba` or `struct ieee80211_smd_ctx`). Individual scalar attributes (`NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE`, etc.) are serialized. No struct padding info-leak via Netlink.
---
### Critical File Paths and Functions
- `drivers/net/wireless/virtual/mac80211_hwsim_main.c`:
- `mac80211_hwsim_tx_frame_no_nl()` (lines 1902-2033)
- `hwsim_cloned_frame_received_nl()` (around line 6641)
- Need to verify how `struct ieee80211_rx_status rx_status` is declared/initialized in both functions.
- `net/wireless/nl80211.c`:
- `nl80211_parse_smd_ctx()` (line 19906): Uses `kzalloc`.
- `nl80211_put_smd_ctx()` (line 19710): Serializes `st_info->ctx` to Netlink msg.
- `nl80211_notify_get_smd_ctx_done()` (line 24532): Sends `NL80211_CMD_SMD_CTX_EVENT`.
- `nl80211_send_mgmt()` (line 22886): Sends action frames with SMD context if attached.
- `net/mac80211/rx.c`:
- `ieee80211_rx_list()` (lines 5610-5793): Inspects `status->smd_ctx_valid`, extracts `status->smd_ctx`, sets `rx.smd_ctx`.
- `ieee80211_rx_h_userspace_mgmt_st_req_frame()` (line 3974): Populates `info->st_info.ctx = rx->smd_ctx`.
- `include/net/mac80211.h`:
- `struct ieee80211_rx_status`: lines 1785-1826.
---
### Potential Reasoning Loops / Pitfalls to Watch Out For
- Do not get distracted by driver absence: mac80211 and cfg80211 are the primary code paths touched. However, check whether `mac80211_hwsim` (the virtual driver used heavily in syzkaller fuzzing!) initializes `rx_status` completely or leaves `smd_ctx_valid` uninitialized.
- Keep in mind the strict rule: KASAN bugs (OOB, UAF, NULL deref, unaligned access) or kernel crashes do NOT justify KMSAN. Only uninitialized memory reads (which KMSAN uniquely tracks) qualify.
- Specifically inspect `mac80211_hwsim_main.c` around line 1902 and line 6489 for how `struct ieee80211_rx_status rx_status` is declared. Next step should inspect lines 1902-1950 and 6489-6550 of `drivers/net/wireless/virtual/mac80211_hwsim_main.c`.Tokens: input: 89781 output: 2954 thoughts: 0 |
| 50/3 | 2026/09/26 05:50 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 72028 output: 42 thoughts: 0 |
| 51/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "include/linux/ieee80211.h",
"FirstLine": 1185,
"LineCount": 20
}Results: {
"Contents": "1185:\t\t\t\t\t\tu8 control;\n1186:\t\t\t\t\t\tu8 variable[];\n1187:\t\t\t\t\t} __packed eml_omn;\n1188:\t\t\t\t\tstruct {\n1189:\t\t\t\t\t\tu8 dialog_token;\n1190:\t\t\t\t\t\tu8 type;\n1191:\t\t\t\t\t\tu8 variable[];\n1192:\t\t\t\t\t} __packed uhr_link_reconf_req;\n1193:\t\t\t\t\tstruct {\n1194:\t\t\t\t\t\tu8 dialog_token;\n1195:\t\t\t\t\t\tu8 type;\n1196:\t\t\t\t\t\tu8 count;\n1197:\t\t\t\t\t\tu8 variable[];\n1198:\t\t\t\t\t} __packed uhr_link_reconf_resp;\n1199:\t\t\t\t\tstruct {\n1200:\t\t\t\t\t\tu8 dialog_token;\n1201:\t\t\t\t\t\tu8 type;\n1202:\t\t\t\t\t\tu8 variable[];\n1203:\t\t\t\t\t} __packed uhr_link_reconf_notif;\n1204:\t\t\t\t};\n"
} |
| 52/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 72328 output: 41 thoughts: 0 |
| 53/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/mac80211/rx.c",
"FirstLine": 3965,
"LineCount": 55
}Results: {
"Contents": "3965:\t\tdev_kfree_skb(rx-\u003eskb);\n3966:\t\treturn RX_QUEUED;\n3967:\t\n3968:\t queue:\n3969:\t\tieee80211_queue_skb_to_iface(sdata, rx-\u003elink_sta, rx-\u003eskb);\n3970:\t\treturn RX_QUEUED;\n3971:\t}\n3972:\t\n3973:\tstatic void\n3974:\tieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,\n3975:\t\t\t\t\t\t struct ieee80211_rx_data *rx)\n3976:\t{\n3977:\t\tstruct ieee80211_mgmt *mgmt = (void *)info-\u003ebuf;\n3978:\t\tu8 type;\n3979:\t\n3980:\t\tif (!rx-\u003esmd_ctx)\n3981:\t\t\treturn;\n3982:\t\n3983:\t\ttype = mgmt-\u003eu.action.uhr_link_reconf_req.type;\n3984:\t\n3985:\t\tinfo-\u003est_info.type = type;\n3986:\t\tinfo-\u003est_info.ctx = rx-\u003esmd_ctx;\n3987:\t}\n3988:\t\n3989:\tstatic ieee80211_rx_result debug_noinline\n3990:\tieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)\n3991:\t{\n3992:\t\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx-\u003eskb);\n3993:\t\tstruct cfg80211_rx_info info = {\n3994:\t\t\t.freq = ieee80211_rx_status_to_khz(status),\n3995:\t\t\t.buf = rx-\u003eskb-\u003edata,\n3996:\t\t\t.len = rx-\u003eskb-\u003elen,\n3997:\t\t\t.link_id = rx-\u003elink_id,\n3998:\t\t\t.have_link_id = rx-\u003elink_id \u003e= 0,\n3999:\t\t\t.no_sta = !rx-\u003esta,\n4000:\t\t\t.st_info.ctx = NULL,\n4001:\t\t};\n4002:\t\n4003:\t\t/* skip known-bad action frames and return them in the next handler */\n4004:\t\tif (status-\u003erx_flags \u0026 IEEE80211_RX_MALFORMED_ACTION_FRM)\n4005:\t\t\treturn RX_CONTINUE;\n4006:\t\n4007:\t\t/*\n4008:\t\t * Getting here means the kernel doesn't know how to handle\n4009:\t\t * it, but maybe userspace does ... include returned frames\n4010:\t\t * so userspace can register for those to know whether ones\n4011:\t\t * it transmitted were processed or returned.\n4012:\t\t */\n4013:\t\n4014:\t\tif (ieee80211_hw_check(\u0026rx-\u003elocal-\u003ehw, SIGNAL_DBM) \u0026\u0026\n4015:\t\t !(status-\u003eflag \u0026 RX_FLAG_NO_SIGNAL_VAL))\n4016:\t\t\tinfo.sig_dbm = status-\u003esignal;\n4017:\t\n4018:\t\tif (ieee80211_is_timing_measurement(rx-\u003eskb) ||\n4019:\t\t ieee80211_is_ftm(rx-\u003eskb)) {\n"
} |
| 54/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 73339 output: 41 thoughts: 1288 Thoughts: **Analyzing the 802.11 Management Frame Handling** Okay, let's break this down systematically. I'm focusing on the path taken for specific management frames, specifically those related to ST (Station) roaming preparation requests, and how the context, specifically `smd_ctx`, is handled. First, I see in `ieee80211_rx_h_userspace_mgmt` that there's a specific branch triggered if the received frame is an ST preparation or execution request. That’s good, the code explicitly handles these requests. It calls `ieee80211_rx_h_userspace_mgmt_st_req_frame`. Now, digging into the `ieee80211_is_st_prep_req()` function, it confirms that this path is taken for frames that are both a UHR (Ultra High Reliability) link reconfiguration request *and* have the correct type for an ST preparation. That is good, it allows to select what type of packet we are analysing. It involves several checks, like validating the category and action code in the management frame. Looking further into `ieee80211_rx_h_userspace_mgmt_st_req_frame`, it retrieves the 'type' field from the management frame. And, importantly, *if* `rx->smd_ctx` is not NULL, the context is attached to the `info->st_info.ctx`. This `rx->smd_ctx` is clearly being passed along, and it seems vital to the process. The next critical step is `cfg80211_rx_mgmt_ext()`, which, in turn, calls `nl80211_send_mgmt()`. That's where the data is actually sent to userspace. Within `nl80211_send_mgmt()`, it *checks* `info->st_info.ctx` and, if it exists, calculates `st_roaming_data_len`. It dynamically allocates a Netlink message (`nlmsg_new`) that includes space for this context data. It then uses `nl80211_put_smd_ctx` to add the context information into the Netlink message. This explains how the context information is transmitted to userspace, assuming `st_roaming_data_len` is non-zero. This is all looking good; it's exactly what I'd expect. The important question is: where does `rx->smd_ctx` come from? I need to understand that. I now need to know what happens in `ieee80211_rx_list()` which, it seems, is the entry point for packet processing. I see that `smd_ctx` is set from `status->smd_ctx` coming from `IEEE80211_SKB_RXCB(skb)` . The code checks if `status->smd_ctx_valid` is true and then caches the pointer to the `smd_ctx` pointer. This is important: it retrieves the `smd_ctx` from the receive status and sets it to NULL afterwards, and the value is then cached. It also sets `status->smd_ctx_valid` to `false` and caches the pointer. It then populates the `rx` struct and *then* the pointer is freed. Now I need to address the elephant in the room. What happens if multiple packets are handled within `ieee80211_rx_list()`? The code seems to assume a single packet context, as it stores the pointer to the `smd_ctx` on the `ieee80211_rx_status` structure. If multiple frames use the same structure, there's a serious potential for race conditions or data corruption. I need to verify how `ieee80211_rx_list()` iterates over incoming packets and confirm that the `smd_ctx` is handled safely in the loop. I need to check how it iterates, to verify the context is set correctly for each packet. |
| 55/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/mac80211/rx.c",
"FirstLine": 5605,
"LineCount": 50
}Results: {
"Contents": "5605:\t\n5606:\t/*\n5607:\t * This is the receive path handler. It is called by a low level driver when an\n5608:\t * 802.11 MPDU is received from the hardware.\n5609:\t */\n5610:\tvoid ieee80211_rx_list(struct ieee80211_hw *hw,\n5611:\t\t\t struct ieee80211_link_sta *link_pubsta,\n5612:\t\t\t struct sk_buff *skb, struct list_head *list)\n5613:\t{\n5614:\t\tstruct ieee80211_local *local = hw_to_local(hw);\n5615:\t\tstruct ieee80211_rate *rate = NULL;\n5616:\t\tstruct ieee80211_supported_band *sband;\n5617:\t\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\n5618:\t\tstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-\u003edata;\n5619:\t\tstruct ieee80211_smd_ctx *smd_ctx = NULL;\n5620:\t\tstruct ieee80211_rx_data rx = {};\n5621:\t\n5622:\t\t/* cache the pointer to free it later */\n5623:\t\tif (status-\u003esmd_ctx_valid) {\n5624:\t\t\tsmd_ctx = status-\u003esmd_ctx;\n5625:\t\t\tstatus-\u003esmd_ctx = NULL;\n5626:\t\t\tstatus-\u003esmd_ctx_valid = false;\n5627:\t\t}\n5628:\t\n5629:\t\tWARN_ON_ONCE(softirq_count() == 0);\n5630:\t\n5631:\t\tif (WARN_ON(status-\u003eband \u003e= NUM_NL80211_BANDS))\n5632:\t\t\tgoto drop;\n5633:\t\n5634:\t\tsband = local-\u003ehw.wiphy-\u003ebands[status-\u003eband];\n5635:\t\tif (WARN_ON(!sband))\n5636:\t\t\tgoto drop;\n5637:\t\n5638:\t\t/*\n5639:\t\t * If we're suspending, it is possible although not too likely\n5640:\t\t * that we'd be receiving frames after having already partially\n5641:\t\t * quiesced the stack. We can't process such frames then since\n5642:\t\t * that might, for example, cause stations to be added or other\n5643:\t\t * driver callbacks be invoked.\n5644:\t\t */\n5645:\t\tif (unlikely(local-\u003equiescing || local-\u003esuspended))\n5646:\t\t\tgoto drop;\n5647:\t\n5648:\t\t/* We might be during a HW reconfig, prevent Rx for the same reason */\n5649:\t\tif (unlikely(local-\u003ein_reconfig))\n5650:\t\t\tgoto drop;\n5651:\t\n5652:\t\t/*\n5653:\t\t * The same happens when we're not even started,\n5654:\t\t * but that's worth a warning.\n"
} |
| 56/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 76424 output: 26 thoughts: 351 Thoughts: **My Analysis of the mac80211 RX Path** Okay, so I'm digging into `ieee80211_rx_list`. Despite the name, it seems to handle *one* `skb`, but it uses a list to queue up the results, so that makes sense. That fourth argument, `struct list_head *list`, confirms it. I need to keep that in mind when I'm looking at other functions that call this. Hold on, let me quickly glance at the `struct ieee80211_rx_status` definition in `include/net/mac80211.h`. Right, `mactime`, the boot time and timestamp fields, `device_timestamp`, `ampdu_reference`, and the chain information are all packed in there, and that makes perfect sense. I was curious to confirm that these fields were all present. Okay, now I can move on. Now, I need to look at what drivers are actually *using* this function or its close relatives: `ieee80211_rx_skb()` and `mac80211_hwsim_rx()`. I'm going to quickly search for how they allocate and populate the `struct ieee80211_rx_status`. Time to fire up grep. I'll search for either `IEEE80211_SKB_RXCB` or `rx_status` to see how these structures are being handled, to understand how the lower layers are populating the information that's consumed by the mac80211 core. |
| 57/3 | 2026/09/26 05:51 | tool | grepper |
0mArgs:{
"Expression": "IEEE80211_SKB_RXCB"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 773 lines.\nUse more precise expression if possible.\n\ndrivers/net/wireless/admtek/adm8211.c=350=static void adm8211_interrupt_rci(struct ieee80211_hw *dev)\n--\ndrivers/net/wireless/admtek/adm8211.c-445-\ndrivers/net/wireless/admtek/adm8211.c:446:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/admtek/adm8211.c-447-\t\t\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/ath/ar5523/ar5523.c=534=static void ar5523_data_rx_cb(struct urb *urb)\n--\ndrivers/net/wireless/ath/ar5523/ar5523.c-603-\ndrivers/net/wireless/ath/ar5523/ar5523.c:604:\trx_status = IEEE80211_SKB_RXCB(data-\u003eskb);\ndrivers/net/wireless/ath/ar5523/ar5523.c-605-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=1352=static void ath10k_htt_rx_h_queue_msdu(struct ath10k *ar,\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1357-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:1358:\tstatus = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1359-\t*status = *rx_status;\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=1364=static void ath10k_process_rx(struct ath10k *ar, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1369-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:1370:\tstatus = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-1371-\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c=2454=static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,\n--\ndrivers/net/wireless/ath/ath10k/htt_rx.c-2553-\ndrivers/net/wireless/ath/ath10k/htt_rx.c:2554:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/htt_rx.c-2555-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/ath/ath10k/wmi.c=2527=int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath10k/wmi.c-2529-\tstruct wmi_mgmt_rx_ev_arg arg = {};\ndrivers/net/wireless/ath/ath10k/wmi.c:2530:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath10k/wmi.c-2531-\tstruct ieee80211_hdr *hdr;\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c=2432=static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *napi,\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c-2493-\ndrivers/net/wireless/ath/ath11k/dp_rx.c:2494:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath11k/dp_rx.c-2495-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c=3250=static int ath11k_dp_rx_h_verify_tkip_mic(struct ath11k *ar, struct ath11k_peer *peer,\n--\ndrivers/net/wireless/ath/ath11k/dp_rx.c-3253-\tstruct hal_rx_desc *rx_desc = (struct hal_rx_desc *)msdu-\u003edata;\ndrivers/net/wireless/ath/ath11k/dp_rx.c:3254:\tstruct ieee80211_rx_status *rxs = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath11k/dp_rx.c-3255-\tstruct ieee80211_key_conf *key_conf;\n--\ndrivers/net/wireless/ath/ath11k/wmi.c=7621=static void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath11k/wmi.c-7624-\tstruct ath11k *ar;\ndrivers/net/wireless/ath/ath11k/wmi.c:7625:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath11k/wmi.c-7626-\tstruct ieee80211_hdr *hdr;\n--\ndrivers/net/wireless/ath/ath12k/dp_mon.c=493=void ath12k_dp_mon_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev,\n--\ndrivers/net/wireless/ath/ath12k/dp_mon.c-512-\ndrivers/net/wireless/ath/ath12k/dp_mon.c:513:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/dp_mon.c-514-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath12k/dp_rx.c=1371=void ath12k_dp_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, struct napi_struct *napi,\n--\ndrivers/net/wireless/ath/ath12k/dp_rx.c-1430-\ndrivers/net/wireless/ath/ath12k/dp_rx.c:1431:\trx_status = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/dp_rx.c-1432-\t*rx_status = *status;\n--\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c=991=static int ath12k_wifi7_dp_rx_h_verify_tkip_mic(struct ath12k_pdev_dp *dp_pdev,\n--\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c-999-\tstruct hal_rx_desc *rx_desc = (struct hal_rx_desc *)msdu-\u003edata;\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c:1000:\tstruct ieee80211_rx_status *rxs = IEEE80211_SKB_RXCB(msdu);\ndrivers/net/wireless/ath/ath12k/wifi7/dp_rx.c-1001-\tstruct ieee80211_key_conf *key_conf;\n--\ndrivers/net/wireless/ath/ath12k/wmi.c=7276=static void ath12k_mgmt_rx_event(struct ath12k_base *ab, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/ath12k/wmi.c-7279-\tstruct ath12k *ar;\ndrivers/net/wireless/ath/ath12k/wmi.c:7280:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath12k/wmi.c-7281-\tstruct ath12k_dp_link_peer *peer;\n--\ndrivers/net/wireless/ath/ath5k/base.c=1416=ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,\n--\ndrivers/net/wireless/ath/ath5k/base.c-1423-\ndrivers/net/wireless/ath/ath5k/base.c:1424:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath5k/base.c-1425-\n--\ndrivers/net/wireless/ath/ath9k/debug_sta.c=91=void ath_debug_rate_stats(struct ath_softc *sc,\n--\ndrivers/net/wireless/ath/ath9k/debug_sta.c-112-\trstats = \u0026an-\u003erx_rate_stats;\ndrivers/net/wireless/ath/ath9k/debug_sta.c:113:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath9k/debug_sta.c-114-\n--\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c=1081=void ath9k_rx_tasklet(struct tasklet_struct *t)\n--\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c-1111-\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c:1112:\t\tmemcpy(IEEE80211_SKB_RXCB(rxbuf-\u003eskb), \u0026rx_status,\ndrivers/net/wireless/ath/ath9k/htc_drv_txrx.c-1113-\t\t sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/ath/ath9k/recv.c=1008=static void ath_rx_count_airtime(struct ath_softc *sc,\n--\ndrivers/net/wireless/ath/ath9k/recv.c-1033-\ndrivers/net/wireless/ath/ath9k/recv.c:1034:\trxs = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/ath/ath9k/recv.c-1035-\n--\ndrivers/net/wireless/ath/ath9k/recv.c=1058=int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)\n--\ndrivers/net/wireless/ath/ath9k/recv.c-1110-\ndrivers/net/wireless/ath/ath9k/recv.c:1111:\t\trxs = IEEE80211_SKB_RXCB(hdr_skb);\ndrivers/net/wireless/ath/ath9k/recv.c-1112-\t\tmemset(rxs, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/ath/carl9170/rx.c=662=static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len,\n--\ndrivers/net/wireless/ath/carl9170/rx.c-685-\ndrivers/net/wireless/ath/carl9170/rx.c:686:\tmemcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status));\ndrivers/net/wireless/ath/carl9170/rx.c-687-\tieee80211_rx(ar-\u003ehw, skb);\n--\ndrivers/net/wireless/ath/wcn36xx/txrx.c=306=int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)\n--\ndrivers/net/wireless/ath/wcn36xx/txrx.c-410-\ndrivers/net/wireless/ath/wcn36xx/txrx.c:411:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/ath/wcn36xx/txrx.c-412-\n--\ndrivers/net/wireless/atmel/at76c50x-usb.c=1544=static void at76_rx_tasklet(struct tasklet_struct *t)\n--\ndrivers/net/wireless/atmel/at76c50x-usb.c-1588-\t\t priv-\u003erx_skb-\u003elen, priv-\u003erx_skb-\u003edata_len);\ndrivers/net/wireless/atmel/at76c50x-usb.c:1589:\tmemcpy(IEEE80211_SKB_RXCB(priv-\u003erx_skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/atmel/at76c50x-usb.c-1590-\tieee80211_rx_irqsafe(priv-\u003ehw, priv-\u003erx_skb);\n--\ndrivers/net/wireless/broadcom/b43/xmit.c=632=void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)\n--\ndrivers/net/wireless/broadcom/b43/xmit.c-806-\ndrivers/net/wireless/broadcom/b43/xmit.c:807:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/broadcom/b43/xmit.c-808-\tieee80211_rx_ni(dev-\u003ewl-\u003ehw, skb);\n--\ndrivers/net/wireless/broadcom/b43legacy/xmit.c=418=void b43legacy_rx(struct b43legacy_wldev *dev,\n--\ndrivers/net/wireless/broadcom/b43legacy/xmit.c-564-\ndrivers/net/wireless/broadcom/b43legacy/xmit.c:565:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/broadcom/b43legacy/xmit.c-566-\tieee80211_rx_irqsafe(dev-\u003ewl-\u003ehw, skb);\n--\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c=7076=brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,\n--\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7097-\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c:7098:\tmemcpy(IEEE80211_SKB_RXCB(p), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7099-\tieee80211_rx_irqsafe(wlc-\u003epub-\u003eieee_hw, p);\n--\ndrivers/net/wireless/intel/iwlegacy/3945.c=465=il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb,\n--\ndrivers/net/wireless/intel/iwlegacy/3945.c-516-\til_update_stats(il, false, fc, len);\ndrivers/net/wireless/intel/iwlegacy/3945.c:517:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlegacy/3945.c-518-\n--\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c=565=il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,\n--\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c-603-\til_update_stats(il, false, fc, len);\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c:604:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlegacy/4965-mac.c-605-\n--\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c=604=static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,\n--\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c-668-\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c:669:\tmemcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));\ndrivers/net/wireless/intel/iwlwifi/dvm/rx.c-670-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=49=static inline int iwl_mld_check_pn(struct iwl_mld *mld, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-53-\tstruct ieee80211_hdr *hdr = (void *)skb_mac_header(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:54:\tstruct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-55-\tstruct iwl_mld_sta *mld_sta;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=323=static void iwl_mld_rx_vht(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-325-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:326:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-327-\tstruct ieee80211_radiotap_vht *vht;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=635=static void iwl_mld_rx_he(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-637-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:638:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-639-\tstruct ieee80211_radiotap_he *he = NULL;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=750=static void iwl_mld_decode_lsig(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-752-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:753:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-754-\tu32 format = phy_data-\u003erate_n_flags \u0026 RATE_MCS_MOD_TYPE_MSK;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=791=iwl_mld_radiotap_put_tlv(struct sk_buff *skb, u16 type, u16 len)\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-793-\tstruct ieee80211_radiotap_tlv *tlv;\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:794:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-795-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1230=static void iwl_mld_rx_eht(struct iwl_mld *mld, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1232-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1233:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1234-\tstruct ieee80211_radiotap_eht *eht;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1494=static void iwl_mld_rx_fill_status(struct iwl_mld *mld, int link_id,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1498-{\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1499:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1500-\tu32 rate_n_flags = phy_data-\u003erate_n_flags;\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=1733=iwl_mld_rx_with_sta(struct iwl_mld *mld, struct ieee80211_hdr *hdr,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1765-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:1766:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-1767-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=2014=void iwl_mld_rx_mpdu(struct iwl_mld *mld, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2071-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2072:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2073-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c=2283=static void iwl_mld_no_data_rx(struct iwl_mld *mld,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2303-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2304:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2305-\n--\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2336-\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c:2337:\tiwl_mld_fill_rx_status_band_freq(IEEE80211_SKB_RXCB(skb),\ndrivers/net/wireless/intel/iwlwifi/mld/rx.c-2338-\t\t\t\t\t ntfy-\u003eband, ntfy-\u003echannel);\n--\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c=170=void iwl_mld_handle_time_msmt_notif(struct iwl_mld *mld,\n--\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c-193-\tadj_time = iwl_mld_ptp_get_adj_time(mld, ts_10ns * 10);\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c:194:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mld/time_sync.c-195-\trx_status-\u003eack_tx_hwtstamp = ktime_set(0, adj_time);\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c=1687=void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c-1741-\tskb_put_data(skb, data, size);\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1742:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c-1743-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c=288=void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c-329-\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c:330:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rx.c-331-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=14=static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-18-\tstruct ieee80211_hdr *hdr = (void *)skb_mac_header(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:19:\tstruct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-20-\tstruct iwl_mvm_key_pn *ptk_pn;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=207=static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-209-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:210:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-211-\tstruct ieee80211_radiotap_vendor_content *radiotap;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1649=static void iwl_mvm_rx_eht(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1652-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1653:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1654-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1792=static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1795-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1796:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1797-\tstruct ieee80211_radiotap_he *he = NULL;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1919=static void iwl_mvm_decode_lsig(struct sk_buff *skb,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1921-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1922:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1923-\tstruct ieee80211_radiotap_lsig *lsig;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=1972=static void iwl_mvm_rx_fill_status(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1978-{\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1979:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-1980-\tu32 rate_n_flags = phy_data-\u003erate_n_flags;\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=2095=void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2186-\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:2187:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2188-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c=2409=void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2466-\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:2467:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/rxmq.c-2468-\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c=58=void iwl_mvm_time_sync_msmt_event(struct iwl_mvm *mvm,\n--\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c-82-\tadj_time = iwl_mvm_ptp_get_adj_time(mvm, ts_10ns * 10);\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c:83:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intel/iwlwifi/mvm/time-sync.c-84-\trx_status-\u003eack_tx_hwtstamp = ktime_set(0, adj_time);\n--\ndrivers/net/wireless/intersil/p54/txrx.c=327=static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/intersil/p54/txrx.c-329-\tstruct p54_rx_data *hdr = (struct p54_rx_data *) skb-\u003edata;\ndrivers/net/wireless/intersil/p54/txrx.c:330:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/intersil/p54/txrx.c-331-\tu16 freq = le16_to_cpu(hdr-\u003efreq);\n--\ndrivers/net/wireless/marvell/libertas_tf/main.c=493=int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/marvell/libertas_tf/main.c-534-\ndrivers/net/wireless/marvell/libertas_tf/main.c:535:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/marvell/libertas_tf/main.c-536-\n--\ndrivers/net/wireless/marvell/mwl8k.c=1328=static int rxq_process(struct ieee80211_hw *hw, int index, int limit)\n--\ndrivers/net/wireless/marvell/mwl8k.c-1417-\t\tmwl8k_remove_dma_header(skb, qos);\ndrivers/net/wireless/marvell/mwl8k.c:1418:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/marvell/mwl8k.c-1419-\t\tieee80211_rx_irqsafe(hw, skb);\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c=1256=mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mac80211.c-1259-{\ndrivers/net/wireless/mediatek/mt76/mac80211.c:1260:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/mediatek/mt76/mac80211.c-1261-\tstruct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);\n--\ndrivers/net/wireless/mediatek/mt7601u/mac.c=460=u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt7601u/mac.c-462-{\ndrivers/net/wireless/mediatek/mt7601u/mac.c:463:\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/mediatek/mt7601u/mac.c-464-\tstruct mt7601u_rxwi *rxwi = rxi;\n--\ndrivers/net/wireless/morsemicro/mm81x/mac.c=1930=void mm81x_mac_rx_skb(struct mm81x *mors, struct sk_buff *skb,\n--\ndrivers/net/wireless/morsemicro/mm81x/mac.c-1955-rx:\ndrivers/net/wireless/morsemicro/mm81x/mac.c:1956:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/morsemicro/mm81x/mac.c-1957-\tieee80211_rx_ni(hw, skb);\n--\ndrivers/net/wireless/purelifi/plfxlc/mac.c=393=int plfxlc_mac_rx(struct ieee80211_hw *hw, const u8 *buffer,\n--\ndrivers/net/wireless/purelifi/plfxlc/mac.c-490-\tskb_put_data(skb, buffer, payload_length);\ndrivers/net/wireless/purelifi/plfxlc/mac.c:491:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/purelifi/plfxlc/mac.c-492-\tieee80211_rx_irqsafe(hw, skb);\n--\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c=737=void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)\n--\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c-838-\t */\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c:839:\trx_status = IEEE80211_SKB_RXCB(entry-\u003eskb);\ndrivers/net/wireless/ralink/rt2x00/rt2x00dev.c-840-\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c=211=static void rtl8180_handle_rx(struct ieee80211_hw *dev)\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-321-\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:322:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-323-\t\t\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c=325=static void rtl8187_rx_cb(struct urb *urb)\n--\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-395-\t\trx_status.flag |= RX_FLAG_FAILED_FCS_CRC;\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:396:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-397-\tieee80211_rx_irqsafe(dev, skb);\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c=6320=int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6369-\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:6370:\t\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6371-\t\tmemset(rx_status, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c=6439=int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6479-\ndrivers/net/wireless/realtek/rtl8xxxu/core.c:6480:\t\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtl8xxxu/core.c-6481-\t\tmemset(rx_status, 0, sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c=1342=static void process_agg_start(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/base.c-1356-\t\trx_status.signal = 50 + 10;\ndrivers/net/wireless/realtek/rtlwifi/base.c:1357:\t\tmemcpy(IEEE80211_SKB_RXCB(skb_delba),\ndrivers/net/wireless/realtek/rtlwifi/base.c-1358-\t\t \u0026rx_status, sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c=631=static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c-641-\t\tif (likely(uskb)) {\ndrivers/net/wireless/realtek/rtlwifi/pci.c:642:\t\t\tmemcpy(IEEE80211_SKB_RXCB(uskb), \u0026rx_status,\ndrivers/net/wireless/realtek/rtlwifi/pci.c-643-\t\t\t sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c=664=static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)\n--\ndrivers/net/wireless/realtek/rtlwifi/pci.c-769-\t\tif (!stats.crc \u0026\u0026 !stats.hwerror \u0026\u0026 (skb-\u003elen \u003e FCS_LEN)) {\ndrivers/net/wireless/realtek/rtlwifi/pci.c:770:\t\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status,\ndrivers/net/wireless/realtek/rtlwifi/pci.c-771-\t\t\t sizeof(rx_status));\n--\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c=344=static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c-346-\tstruct ieee80211_rx_status *rx_status =\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c:347:\t\t (struct ieee80211_rx_status *)IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c-348-\tu32 skb_len, pkt_len, drvinfo_len;\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c=369=static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c-388-\tif (!stats.crc) {\ndrivers/net/wireless/realtek/rtlwifi/usb.c:389:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtlwifi/usb.c-390-\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c=411=static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/realtek/rtlwifi/usb.c-430-\tif (!stats.crc) {\ndrivers/net/wireless/realtek/rtlwifi/usb.c:431:\t\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026rx_status, sizeof(rx_status));\ndrivers/net/wireless/realtek/rtlwifi/usb.c-432-\n--\ndrivers/net/wireless/realtek/rtw88/sdio.c=950=static void rtw_sdio_rx_skb(struct rtw_dev *rtwdev, struct sk_buff *skb,\n--\ndrivers/net/wireless/realtek/rtw88/sdio.c-953-{\ndrivers/net/wireless/realtek/rtw88/sdio.c:954:\t*IEEE80211_SKB_RXCB(skb) = *rx_status;\ndrivers/net/wireless/realtek/rtw88/sdio.c-955-\n--\ndrivers/net/wireless/realtek/rtw89/core.c=2567=static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-2569-{\ndrivers/net/wireless/realtek/rtw89/core.c:2570:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-2571-\tstruct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb-\u003edata;\n--\ndrivers/net/wireless/realtek/rtw89/core.c=3026=static void rtw89_vif_rx_bcn_stat(struct rtw89_dev *rtwdev, struct sk_buff *skb)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-3031-\tstruct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb-\u003edata;\ndrivers/net/wireless/realtek/rtw89/core.c:3032:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-3033-\tstruct rtw89_beacon_stat *bcn_stat = \u0026rtwdev-\u003ephystat.bcn_stat;\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4029=static void rtw89_core_rx_pending_skb(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4043-\t\tskb_unlink(skb_ppdu, \u0026rtwdev-\u003eppdu_sts.rx_queue[band]);\ndrivers/net/wireless/realtek/rtw89/core.c:4044:\t\trx_status = IEEE80211_SKB_RXCB(skb_ppdu);\ndrivers/net/wireless/realtek/rtw89/core.c-4045-\t\tif (rtw89_core_rx_ppdu_match(rtwdev, desc_info, rx_status))\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4470=static void rtw89_core_flush_ppdu_rx_queue(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4479-\t\tskb_unlink(skb_ppdu, \u0026ppdu_sts-\u003erx_queue[band]);\ndrivers/net/wireless/realtek/rtw89/core.c:4480:\t\trx_status = IEEE80211_SKB_RXCB(skb_ppdu);\ndrivers/net/wireless/realtek/rtw89/core.c-4481-\t\trtw89_core_rx_to_mac80211(rtwdev, NULL, desc_info, skb_ppdu, rx_status);\n--\ndrivers/net/wireless/realtek/rtw89/core.c=4520=void rtw89_core_rx(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-4538-\ndrivers/net/wireless/realtek/rtw89/core.c:4539:\trx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/realtek/rtw89/core.c-4540-\tmemset(rx_status, 0, sizeof(*rx_status));\n--\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c=1395=void rsi_indicate_pkt_to_os(struct rsi_common *common,\n--\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c-1399-\tstruct ieee80211_hw *hw = adapter-\u003ehw;\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c:1400:\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/rsi/rsi_91x_mac80211.c-1401-\n--\ndrivers/net/wireless/silabs/wfx/data_rx.c=38=void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb)\ndrivers/net/wireless/silabs/wfx/data_rx.c-39-{\ndrivers/net/wireless/silabs/wfx/data_rx.c:40:\tstruct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/silabs/wfx/data_rx.c-41-\tstruct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb-\u003edata;\n--\ndrivers/net/wireless/st/cw1200/txrx.c=1000=void cw1200_rx_cb(struct cw1200_common *priv,\n--\ndrivers/net/wireless/st/cw1200/txrx.c-1005-\tstruct sk_buff *skb = *skb_p;\ndrivers/net/wireless/st/cw1200/txrx.c:1006:\tstruct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);\ndrivers/net/wireless/st/cw1200/txrx.c-1007-\tstruct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb-\u003edata;\n--\ndrivers/net/wireless/ti/wl1251/rx.c=133=static void wl1251_rx_body(struct wl1251 *wl,\n--\ndrivers/net/wireless/ti/wl1251/rx.c-180-\ndrivers/net/wireless/ti/wl1251/rx.c:181:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026status, sizeof(status));\ndrivers/net/wireless/ti/wl1251/rx.c-182-\tieee80211_rx_ni(wl-\u003ehw, skb);\n--\ndrivers/net/wireless/ti/wlcore/rx.c=103=static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,\n--\ndrivers/net/wireless/ti/wlcore/rx.c-182-\ndrivers/net/wireless/ti/wlcore/rx.c:183:\twl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon,\ndrivers/net/wireless/ti/wlcore/rx.c-184-\t\t\t ieee80211_is_probe_resp(hdr-\u003eframe_control));\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1815=static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1858-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1859:\tIEEE80211_SKB_RXCB(skb)-\u003eflag |= RX_FLAG_RADIOTAP_TLV_AT_END;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1860-#endif\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1863=static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1889-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1890:\tmemcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1891-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=216=void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-240-\t/* Copy the RX status to add a MAC timestamp if needed */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:241:\tmemcpy(\u0026rx_status, IEEE80211_SKB_RXCB(skb),\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-242-\t sizeof(struct ieee80211_rx_status));\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-567-\t\t/* Timestamp is likely inaccurate (and late) in this case */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:568:\t\tif (!(IEEE80211_SKB_RXCB(skb)-\u003eflag \u0026 RX_FLAG_MACTIME))\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-569-\t\t\tthreshold = 128;\n--\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c=1018=int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)\n--\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c-1095-\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c:1096:\tmemcpy(IEEE80211_SKB_RXCB(skb), \u0026stats, sizeof(stats));\ndrivers/net/wireless/zydas/zd1211rw/zd_mac.c-1097-\tieee80211_rx_irqsafe(hw, skb);\n--\ninclude/net/mac80211.h=1507=static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)\n\n"
} |
| 58/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 92258 output: 42 thoughts: 4489 Thoughts: **SMD Context Analysis: Potential Issues and Vulnerabilities** Alright, let's break down this SMD (Station Mobility Domain) context code. My initial impression is that the architecture is in place, and the framework for handling SMD transitions and context data is well-defined. My primary concern here, as always, is whether uninitialized memory or information leakage could exist, or any invalid input that could cause a denial-of-service. I see that `memset` is used consistently to zero-initialize the `rx_status` structure. This is good practice. The introduction of new data structures like `struct ieee80211_smd_ctx_ba`, `struct ieee80211_smd_ctx`, and associated parameters in `cfg80211` and `ieee80211` headers is standard, but the key is how they are initialized and used. The code defines `struct cfg80211_smd_transition_info` containing `ctx` pointer. This `ctx` is allocated using `kzalloc()` in `nl80211_parse_smd_ctx()`, which is important because it means we have zero-initialization. `nl80211_set_smd_ctx()` and `nl80211_get_smd_ctx()` are the core functions for setting and retrieving this context. I've reviewed both, and I need to make sure those data from `cfg80211_smd_transition_info` are properly handled. The `nl80211_set_smd_ctx()` function passes a pointer to `struct cfg80211_smd_transition_info` called `st_info` to `rdev_set_smd_ctx()`. `st_info`'s `ctx` is allocated using `kzalloc()`, which is zero-initialized. `nl80211_get_smd_ctx()` function calls `kzalloc_obj` to allocate `pending` and zero-initializes it, copies the STA address into `pending->sta_addr` . The `nl80211_put_smd_ctx()` function looks important, particularly where it's called. It's called from `nl80211_send_mgmt()` and `nl80211_notify_get_smd_ctx_done()`. In the case of `nl80211_send_mgmt()`, the `st_info` comes from the `cfg80211_rx_info` during an ST preparation or execution request. However, `info.st_info.ctx` is initialized to NULL. Now, that brings up the critical point: the `smd_ctx` pointer within the `ieee80211_rx_status` structure. The documentation says it's only *needed* for ST requests and *must* be `kmalloc`-ed by the driver. Critically, it says if the driver sets `smd_ctx_valid = 1`. Currently, as far as I can tell, no in-tree driver actually sets `smd_ctx_valid = 1`. This means `smd_ctx` remains `NULL`. If `smd_ctx_valid` is false (as it will be), then the code properly handles that: `smd_ctx` is assigned to `NULL`, which is the correct safe behavior. In conclusion, as far as I can see, based on the current implementation, there's no immediate risk of uninitialized memory reads or information leakage because everything is zero-initialized and accounted for. This is good, however I will note that if a driver were to be introduced that makes use of the `smd_ctx` field, it's very important to check that those functions do not cause potential uninitialized memory issues. We need to be especially cautious about how that `smd_ctx` is managed in `ieee80211_rx_list()` and in all of the places that will be consuming that `smd_ctx` data. |
| 59/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 19890,
"LineCount": 90
}Results: {
"Contents": "19890:\t\n19891:\t\t\tif (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE])\n19892:\t\t\t\tba-\u003eext_buffer_size =\n19893:\t\t\t\t\tnla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]);\n19894:\t\n19895:\t\t\tn_tids++;\n19896:\t\t}\n19897:\t\n19898:\t\tif (!n_tids)\n19899:\t\t\treturn -EINVAL;\n19900:\t\n19901:\t\tset_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, valid_ctx_bmap);\n19902:\t\n19903:\t\treturn 0;\n19904:\t}\n19905:\t\n19906:\tstatic int nl80211_parse_smd_ctx(struct genl_info *info,\n19907:\t\t\t\t\t struct cfg80211_smd_transition_info *st_info)\n19908:\t{\n19909:\t\tstruct nlattr *dl_tb[NL80211_SMD_CTX_DL_ATTR_MAX + 1];\n19910:\t\tstruct nlattr *ul_tb[NL80211_SMD_CTX_UL_ATTR_MAX + 1];\n19911:\t\tstruct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1];\n19912:\t\tstruct ieee80211_smd_ctx *ctx;\n19913:\t\tstruct nlattr *bmap_attr;\n19914:\t\tsize_t drv_ctx_size = 0;\n19915:\t\n19916:\t\tst_info-\u003etype = nla_get_u8(info-\u003eattrs[NL80211_ATTR_SMD_CTX_TYPE]);\n19917:\t\n19918:\t\tif (nla_parse_nested(tb, NL80211_SMD_CTX_ATTR_MAX,\n19919:\t\t\t\t info-\u003eattrs[NL80211_ATTR_SMD_CTX],\n19920:\t\t\t\t nl80211_smd_ctx_policy, NULL)) {\n19921:\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse SMD context\");\n19922:\t\t\treturn -EINVAL;\n19923:\t\t}\n19924:\t\n19925:\t\tif (tb[NL80211_SMD_CTX_ATTR_DRV_DATA])\n19926:\t\t\tdrv_ctx_size = nla_len(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]);\n19927:\t\n19928:\t\tctx = kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL);\n19929:\t\tif (!ctx)\n19930:\t\t\treturn -ENOMEM;\n19931:\t\n19932:\t\tst_info-\u003ectx = ctx;\n19933:\t\n19934:\t\t/* DL Context */\n19935:\t\tif (tb[NL80211_SMD_CTX_ATTR_DL]) {\n19936:\t\t\tstruct nlattr *ba_attr;\n19937:\t\n19938:\t\t\tif (nla_parse_nested(dl_tb, NL80211_SMD_CTX_DL_ATTR_MAX,\n19939:\t\t\t\t\t tb[NL80211_SMD_CTX_ATTR_DL],\n19940:\t\t\t\t\t nl80211_smd_ctx_dl_policy, NULL)) {\n19941:\t\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse DL context\");\n19942:\t\t\t\tgoto err_free_ctx;\n19943:\t\t\t}\n19944:\t\n19945:\t\t\tbmap_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP];\n19946:\t\t\tif (bmap_attr)\n19947:\t\t\t\tbitmap_write(ctx-\u003edl.valid_tid_bmap,\n19948:\t\t\t\t\t nla_get_u8(bmap_attr),\n19949:\t\t\t\t\t 0, IEEE80211_SMD_CTX_NUM_TIDS);\n19950:\t\n19951:\t\t\tif (dl_tb[NL80211_SMD_CTX_DL_ATTR_SN]) {\n19952:\t\t\t\tstruct nlattr *sn_attr;\n19953:\t\t\t\tint n_tids = 0;\n19954:\t\t\t\tint rem, tid;\n19955:\t\n19956:\t\t\t\tnla_for_each_nested(sn_attr,\n19957:\t\t\t\t\t\t dl_tb[NL80211_SMD_CTX_DL_ATTR_SN],\n19958:\t\t\t\t\t\t rem) {\n19959:\t\t\t\t\ttid = nla_type(sn_attr) - 1;\n19960:\t\t\t\t\tif (tid \u003c 0 ||\n19961:\t\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n19962:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n19963:\t\t\t\t\t\t\t\t \"invalid DL SN tid\");\n19964:\t\t\t\t\t\tgoto err_free_ctx;\n19965:\t\t\t\t\t}\n19966:\t\n19967:\t\t\t\t\tif (nla_len(sn_attr) != sizeof(u16)) {\n19968:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n19969:\t\t\t\t\t\t\t\t \"invalid DL SN len\");\n19970:\t\t\t\t\t\tgoto err_free_ctx;\n19971:\t\t\t\t\t}\n19972:\t\n19973:\t\t\t\t\tctx-\u003edl.sn[tid] = nla_get_u16(sn_attr);\n19974:\t\t\t\t\tn_tids++;\n19975:\t\t\t\t}\n19976:\t\n19977:\t\t\t\tif (!n_tids) {\n19978:\t\t\t\t\tGENL_SET_ERR_MSG(info, \"empty DL SN nesting\");\n19979:\t\t\t\t\tgoto err_free_ctx;\n"
} |
| 60/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 99401 output: 42 thoughts: 20 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving Back into `nl80211_parse_smd_ctx`** Alright, let's pick up where we left off, delving deeper into the `nl80211_parse_smd_ctx` function. I need to refresh my memory on the intricacies of this context, and re-familiarize myself with the data structures involved, the parsing logic, and the error handling within this function. I need to ensure I have a robust understanding of it, given its key role. I’ll make sure I'm crystal clear on how it handles the interaction with the SMDP protocol, particularly with the new changes that have been added recently. |
| 61/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 19980,
"LineCount": 90
}Results: {
"Contents": "19980:\t\t\t\t}\n19981:\t\n19982:\t\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_DL_SN,\n19983:\t\t\t\t\tctx-\u003evalid_ctx_bmap);\n19984:\t\t\t}\n19985:\t\n19986:\t\t\tif (dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]) {\n19987:\t\t\t\tconst u8 *pn_data =\n19988:\t\t\t\t\tnla_data(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);\n19989:\t\n19990:\t\t\t\tctx-\u003epn_len =\n19991:\t\t\t\t\tnla_len(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]);\n19992:\t\n19993:\t\t\t\tmemcpy(ctx-\u003edl.pn, pn_data, ctx-\u003epn_len);\n19994:\t\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_PN,\n19995:\t\t\t\t\tctx-\u003evalid_ctx_bmap);\n19996:\t\t\t}\n19997:\t\n19998:\t\t\tba_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS];\n19999:\t\t\tif (ba_attr \u0026\u0026\n20000:\t\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003edl.ba,\n20001:\t\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n20002:\t\t\t\tGENL_SET_ERR_MSG(info,\n20003:\t\t\t\t\t\t \"failed to parse DL BlockAck params\");\n20004:\t\t\t\tgoto err_free_ctx;\n20005:\t\t\t}\n20006:\t\t}\n20007:\t\n20008:\t\t/* UL Context */\n20009:\t\tif (tb[NL80211_SMD_CTX_ATTR_UL]) {\n20010:\t\t\tstruct nlattr *ba_attr;\n20011:\t\n20012:\t\t\tif (nla_parse_nested(ul_tb, NL80211_SMD_CTX_UL_ATTR_MAX,\n20013:\t\t\t\t\t tb[NL80211_SMD_CTX_ATTR_UL],\n20014:\t\t\t\t\t nl80211_smd_ctx_ul_policy, NULL)) {\n20015:\t\t\t\tGENL_SET_ERR_MSG(info, \"failed to parse UL context\");\n20016:\t\t\t\tgoto err_free_ctx;\n20017:\t\t\t}\n20018:\t\n20019:\t\t\tbmap_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP];\n20020:\t\t\tif (bmap_attr)\n20021:\t\t\t\tbitmap_write(ctx-\u003eul.valid_tid_bmap,\n20022:\t\t\t\t\t nla_get_u8(bmap_attr),\n20023:\t\t\t\t\t 0, IEEE80211_SMD_CTX_NUM_TIDS);\n20024:\t\n20025:\t\t\tif (ul_tb[NL80211_SMD_CTX_UL_ATTR_SN]) {\n20026:\t\t\t\tstruct nlattr *sn_attr;\n20027:\t\t\t\tint n_tids = 0;\n20028:\t\t\t\tint rem, tid;\n20029:\t\n20030:\t\t\t\tnla_for_each_nested(sn_attr,\n20031:\t\t\t\t\t\t ul_tb[NL80211_SMD_CTX_UL_ATTR_SN],\n20032:\t\t\t\t\t\t rem) {\n20033:\t\t\t\t\ttid = nla_type(sn_attr) - 1;\n20034:\t\t\t\t\tif (tid \u003c 0 ||\n20035:\t\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n20036:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n20037:\t\t\t\t\t\t\t\t \"invalid UL SN tid\");\n20038:\t\t\t\t\t\tgoto err_free_ctx;\n20039:\t\t\t\t\t}\n20040:\t\n20041:\t\t\t\t\tif (nla_len(sn_attr) != sizeof(u16)) {\n20042:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n20043:\t\t\t\t\t\t\t\t \"invalid UL SN len\");\n20044:\t\t\t\t\t\tgoto err_free_ctx;\n20045:\t\t\t\t\t}\n20046:\t\n20047:\t\t\t\t\tctx-\u003eul.sn[tid] = nla_get_u16(sn_attr);\n20048:\t\t\t\t\tn_tids++;\n20049:\t\t\t\t}\n20050:\t\n20051:\t\t\t\tif (!n_tids) {\n20052:\t\t\t\t\tGENL_SET_ERR_MSG(info, \"empty UL SN nesting\");\n20053:\t\t\t\t\tgoto err_free_ctx;\n20054:\t\t\t\t}\n20055:\t\n20056:\t\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_UL_SN,\n20057:\t\t\t\t\tctx-\u003evalid_ctx_bmap);\n20058:\t\t\t}\n20059:\t\n20060:\t\t\tif (ul_tb[NL80211_SMD_CTX_UL_ATTR_PN]) {\n20061:\t\t\t\tstruct nlattr *pn_attr;\n20062:\t\t\t\tint n_tids = 0;\n20063:\t\t\t\tint rem, tid;\n20064:\t\n20065:\t\t\t\tnla_for_each_nested(pn_attr,\n20066:\t\t\t\t\t\t ul_tb[NL80211_SMD_CTX_UL_ATTR_PN],\n20067:\t\t\t\t\t\t rem) {\n20068:\t\t\t\t\tu8 pn_len;\n20069:\t\n"
} |
| 62/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 101245 output: 42 thoughts: 20 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving Back into `nl80211_parse_smd_ctx`** Alright, let's pick up where we left off, delving deeper into the `nl80211_parse_smd_ctx` function. I need to refresh my memory on the intricacies of this context, and re-familiarize myself with the data structures involved, the parsing logic, and the error handling within this function. I need to ensure I have a robust understanding of it, given its key role. I’ll make sure I'm crystal clear on how it handles the interaction with the SMDP protocol, particularly with the new changes that have been added recently. |
| 63/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 20070,
"LineCount": 50
}Results: {
"Contents": "20070:\t\t\t\t\ttid = nla_type(pn_attr) - 1;\n20071:\t\t\t\t\tif (tid \u003c 0 ||\n20072:\t\t\t\t\t tid \u003e= IEEE80211_SMD_CTX_NUM_TIDS) {\n20073:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n20074:\t\t\t\t\t\t\t\t \"invalid UL PN tid\");\n20075:\t\t\t\t\t\tgoto err_free_ctx;\n20076:\t\t\t\t\t}\n20077:\t\n20078:\t\t\t\t\t/*\n20079:\t\t\t\t\t * PN length must be the same for all DL and\n20080:\t\t\t\t\t * UL TIDs.\n20081:\t\t\t\t\t */\n20082:\t\t\t\t\tpn_len = nla_len(pn_attr);\n20083:\t\t\t\t\tif (pn_len \u003e IEEE80211_SMD_CTX_MAX_PN_LEN ||\n20084:\t\t\t\t\t (ctx-\u003epn_len \u0026\u0026 pn_len != ctx-\u003epn_len)) {\n20085:\t\t\t\t\t\tGENL_SET_ERR_MSG(info,\n20086:\t\t\t\t\t\t\t\t \"invalid PN length\");\n20087:\t\t\t\t\t\tgoto err_free_ctx;\n20088:\t\t\t\t\t}\n20089:\t\t\t\t\tctx-\u003epn_len = pn_len;\n20090:\t\n20091:\t\t\t\t\tmemcpy(ctx-\u003eul.pn[tid], nla_data(pn_attr),\n20092:\t\t\t\t\t ctx-\u003epn_len);\n20093:\t\t\t\t\tn_tids++;\n20094:\t\t\t\t}\n20095:\t\n20096:\t\t\t\tif (!n_tids) {\n20097:\t\t\t\t\tGENL_SET_ERR_MSG(info, \"empty UL PN nesting\");\n20098:\t\t\t\t\tgoto err_free_ctx;\n20099:\t\t\t\t}\n20100:\t\n20101:\t\t\t\tset_bit(IEEE80211_SMD_CTX_VALID_PN,\n20102:\t\t\t\t\tctx-\u003evalid_ctx_bmap);\n20103:\t\t\t}\n20104:\t\n20105:\t\t\tba_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS];\n20106:\t\t\tif (ba_attr \u0026\u0026\n20107:\t\t\t nl80211_parse_smd_ctx_ba_params(ba_attr, ctx-\u003eul.ba,\n20108:\t\t\t\t\t\t\t ctx-\u003evalid_ctx_bmap)) {\n20109:\t\t\t\tGENL_SET_ERR_MSG(info,\n20110:\t\t\t\t\t\t \"failed to parse UL BlockAck params\");\n20111:\t\t\t\tgoto err_free_ctx;\n20112:\t\t\t}\n20113:\t\t}\n20114:\t\n20115:\t\t/* Driver data */\n20116:\t\tif (tb[NL80211_SMD_CTX_ATTR_DRV_DATA]) {\n20117:\t\t\tctx-\u003edrv_ctx_size = drv_ctx_size;\n20118:\t\t\tmemcpy(ctx-\u003edrv_ctx,\n20119:\t\t\t nla_data(tb[NL80211_SMD_CTX_ATTR_DRV_DATA]),\n"
} |
| 64/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 102342 output: 42 thoughts: 98 Thoughts: Here's my analysis of the provided code snippet, summarized as a thought process: **Diving into the SMD Context Management** Okay, let's break down this `nl80211_parse_smd_ctx` function. The first thing that jumps out is the allocation of `ctx`. It's done with `kzalloc`, which is great because it ensures that everything allocated in `ctx` is zero-initialized. This is a crucial detail. Knowing that every field not explicitly assigned a value will start at zero significantly simplifies debugging and reduces potential uninitialized-memory-related bugs. It provides a solid baseline. The size is cleverly calculated using `sizeof(*ctx) + drv_ctx_size`, which indicates some kind of dynamic extension based on driver-specific context information. Now, let's shift gears to `nl80211_put_smd_ctx`. It is a good practice to go through that one line by line. I have a feeling this will involve some form of clean-up of the `ctx` struct. |
| 65/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 19710,
"LineCount": 80
}Results: {
"Contents": "19710:\tint nl80211_put_smd_ctx(struct sk_buff *msg,\n19711:\t\t\t\tstruct cfg80211_smd_transition_info *st_info)\n19712:\t{\n19713:\t\tstruct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL;\n19714:\t\tstruct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL;\n19715:\t\tconst struct ieee80211_smd_ctx *ctx;\n19716:\t\tu8 dl_tid_bmap = 0, ul_tid_bmap = 0;\n19717:\t\tbool pn_size_valid;\n19718:\t\tu8 tid;\n19719:\t\n19720:\t\t/* ST Type */\n19721:\t\tif (nla_put_u8(msg, NL80211_ATTR_SMD_CTX_TYPE, st_info-\u003etype))\n19722:\t\t\treturn -ENOBUFS;\n19723:\t\n19724:\t\tsmd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX);\n19725:\t\tif (!smd_ctx)\n19726:\t\t\treturn -ENOBUFS;\n19727:\t\n19728:\t\tctx = st_info-\u003ectx;\n19729:\t\n19730:\t\t/* Build DL context */\n19731:\t\tdl_tid_bmap = bitmap_read(ctx-\u003edl.valid_tid_bmap, 0,\n19732:\t\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n19733:\t\n19734:\t\tdl = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_DL);\n19735:\t\tif (!dl)\n19736:\t\t\tgoto nla_fail;\n19737:\t\n19738:\t\tif (nla_put_u8(msg, NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP,\n19739:\t\t\t dl_tid_bmap))\n19740:\t\t\tgoto nla_fail_dl;\n19741:\t\n19742:\t\tif (test_bit(IEEE80211_SMD_CTX_VALID_DL_SN, ctx-\u003evalid_ctx_bmap)) {\n19743:\t\t\tdl_sn = nla_nest_start(msg, NL80211_SMD_CTX_DL_ATTR_SN);\n19744:\t\t\tif (!dl_sn)\n19745:\t\t\t\tgoto nla_fail_dl;\n19746:\t\n19747:\t\t\tfor_each_set_bit(tid, ctx-\u003edl.valid_tid_bmap,\n19748:\t\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n19749:\t\t\t\tif (nla_put_u16(msg, tid + 1, ctx-\u003edl.sn[tid])) {\n19750:\t\t\t\t\tnla_nest_cancel(msg, dl_sn);\n19751:\t\t\t\t\tgoto nla_fail_dl;\n19752:\t\t\t\t}\n19753:\t\t\t}\n19754:\t\t\tnla_nest_end(msg, dl_sn);\n19755:\t\t}\n19756:\t\n19757:\t\tpn_size_valid =\n19758:\t\t\tctx-\u003epn_len \u0026\u0026 ctx-\u003epn_len \u003c= IEEE80211_SMD_CTX_MAX_PN_LEN;\n19759:\t\n19760:\t\tif (pn_size_valid \u0026\u0026\n19761:\t\t test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n19762:\t\t nla_put(msg, NL80211_SMD_CTX_DL_ATTR_PN, ctx-\u003epn_len, ctx-\u003edl.pn))\n19763:\t\t\tgoto nla_fail_dl;\n19764:\t\n19765:\t\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n19766:\t\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003edl.valid_tid_bmap,\n19767:\t\t\t\t\t\t ctx-\u003edl.ba, true))\n19768:\t\t\tgoto nla_fail_dl;\n19769:\t\n19770:\t\tnla_nest_end(msg, dl);\n19771:\t\n19772:\t\t/* Build UL context */\n19773:\t\tul_tid_bmap = bitmap_read(ctx-\u003eul.valid_tid_bmap, 0,\n19774:\t\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS);\n19775:\t\n19776:\t\tul = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_UL);\n19777:\t\tif (!ul)\n19778:\t\t\tgoto nla_fail;\n19779:\t\n19780:\t\tif (nla_put_u8(msg, NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP,\n19781:\t\t\t ul_tid_bmap))\n19782:\t\t\tgoto nla_fail_ul;\n19783:\t\n19784:\t\tif (test_bit(IEEE80211_SMD_CTX_VALID_UL_SN, ctx-\u003evalid_ctx_bmap)) {\n19785:\t\t\tul_sn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_SN);\n19786:\t\t\tif (!ul_sn)\n19787:\t\t\t\tgoto nla_fail_ul;\n19788:\t\n19789:\t\t\tfor_each_set_bit(tid, ctx-\u003eul.valid_tid_bmap,\n"
} |
| 66/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 104359 output: 42 thoughts: 20 Thoughts: Okay, here's my attempt at summarizing the thought process, as if it were my own, assuming the user is an expert. **Diving Back into `nl80211_put_smd_ctx`** Alright, I'm back. Let's dig back into that `nl80211_put_smd_ctx` function. It's a key piece, and I want to refresh my memory on the specifics of how it operates. I need to fully understand its interactions within the broader nl80211 framework. I am interested to see if there is something new or whether my understanding of this function is as it should be. |
| 67/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 19790,
"LineCount": 50
}Results: {
"Contents": "19790:\t\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n19791:\t\t\t\tif (nla_put_u16(msg, tid + 1, ctx-\u003eul.sn[tid])) {\n19792:\t\t\t\t\tnla_nest_cancel(msg, ul_sn);\n19793:\t\t\t\t\tgoto nla_fail_ul;\n19794:\t\t\t\t}\n19795:\t\t\t}\n19796:\t\t\tnla_nest_end(msg, ul_sn);\n19797:\t\t}\n19798:\t\n19799:\t\tif (pn_size_valid \u0026\u0026\n19800:\t\t test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx-\u003evalid_ctx_bmap)) {\n19801:\t\t\tul_pn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_PN);\n19802:\t\t\tif (!ul_pn)\n19803:\t\t\t\tgoto nla_fail_ul;\n19804:\t\n19805:\t\t\tfor_each_set_bit(tid, ctx-\u003eul.valid_tid_bmap,\n19806:\t\t\t\t\t IEEE80211_SMD_CTX_NUM_TIDS) {\n19807:\t\t\t\tif (nla_put(msg, tid + 1, ctx-\u003epn_len,\n19808:\t\t\t\t\t ctx-\u003eul.pn[tid])) {\n19809:\t\t\t\t\tnla_nest_cancel(msg, ul_pn);\n19810:\t\t\t\t\tgoto nla_fail_ul;\n19811:\t\t\t\t}\n19812:\t\t\t}\n19813:\t\t\tnla_nest_end(msg, ul_pn);\n19814:\t\t}\n19815:\t\n19816:\t\tif (test_bit(IEEE80211_SMD_CTX_VALID_BA_PARAMS, ctx-\u003evalid_ctx_bmap) \u0026\u0026\n19817:\t\t nl80211_put_smd_ctx_ba_params(msg, ctx-\u003eul.valid_tid_bmap,\n19818:\t\t\t\t\t\t ctx-\u003eul.ba, false))\n19819:\t\t\tgoto nla_fail_ul;\n19820:\t\n19821:\t\tnla_nest_end(msg, ul);\n19822:\t\n19823:\t\t/* Driver data blob */\n19824:\t\tif (ctx-\u003edrv_ctx_size \u0026\u0026\n19825:\t\t nla_put(msg, NL80211_SMD_CTX_ATTR_DRV_DATA, ctx-\u003edrv_ctx_size,\n19826:\t\t\t ctx-\u003edrv_ctx))\n19827:\t\t\tgoto nla_fail;\n19828:\t\n19829:\t\tnla_nest_end(msg, smd_ctx);\n19830:\t\n19831:\t\treturn 0;\n19832:\t\n19833:\tnla_fail_ul:\n19834:\t\tnla_nest_cancel(msg, ul);\n19835:\t\n19836:\tnla_fail_dl:\n19837:\t\tnla_nest_cancel(msg, dl);\n19838:\t\n19839:\tnla_fail:\n"
} |
| 68/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 105467 output: 37 thoughts: 1374 Thoughts: **Analyzing SMD Parameter Handling in nl80211** Okay, let's break down how this SMD parameter handling works within the nl80211 framework. First, I'm noting that in `nl80211_put_smd_ctx`, the serialization to netlink messages is quite safe. It only includes attributes based on `ctx->valid_ctx_bmap` and `tid_bmap`, and each scalar is explicitly placed using functions like `nla_put_u8` and `nla_put`. This ensures no raw structs are blindly copied, which is good. Now, looking at `nl80211_start_ap`, the code checks for `NL80211_ATTR_SMD_PARAMS`. If present, it calls `nl80211_parse_smd_params`. In this parsing function, it seems very thorough. The code strictly enforces the presence of several required attributes: `IDENTIFIER`, `TIMEOUT`, `MAX_PEER_APMLDS`, `TYPE`, and `PTK_MODE`. If any are missing, it returns an error. The SMD identifier is copied directly using `memcpy`, while the other values are retrieved with `nla_get_u8`, `nla_get_u16` and typecast with `!!` as a boolean. There's also a check for `DL_DATA_FORWARDING` support based on `wiphy_ext_feature_isset` which is great, preventing unsupported configurations. All fields within the `cfg80211_smd_params` struct are initialized. The `params` structure, of type `cfg80211_ap_settings`, used here is dynamically allocated via `kzalloc`. If `NL80211_ATTR_SMD_PARAMS` isn't provided, `smd_params` defaults to all zeros because of the `kzalloc` call, and the `smd_enabled` flag defaults to false. Next, I'm checking `nl80211_set_station_smd`. Here, the code seems to handle the station-specific SMD settings. If the `PEER_SMD_ENABLED` attribute is set, it proceeds; otherwise, it exits. There's a check for `MLD_ADDR` and `PEER_SMD_MAC_ADDR`, indicating that these are required when enabling the station-side SMD features. The identifier is again copied using `nla_memcpy`, and boolean values for `DL_DATA_FORWARDING` and `ROAM_STA` are extracted using the `!!` operator to ensure we get boolean values. In both `nl80211_set_station` and `nl80211_new_station` functions, the `params` struct (of type `station_parameters`) is either initialized to zero or zeroed out, which will ensure any uninitialized parts are zero. |
| 69/3 | 2026/09/26 05:51 | tool | grepper |
0mArgs:{
"Expression": "struct station_parameters params",
"PathPrefix": "net/wireless/nl80211.c"
}Results: {
"Output": "net/wireless/nl80211.c=9353=static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-9357-\tstruct net_device *dev = wdev-\u003enetdev;\nnet/wireless/nl80211.c:9358:\tstruct station_parameters params;\nnet/wireless/nl80211.c-9359-\tu8 *mac_addr;\n--\nnet/wireless/nl80211.c=9529=static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-9534-\tstruct net_device *dev = wdev-\u003enetdev;\nnet/wireless/nl80211.c:9535:\tstruct station_parameters params;\nnet/wireless/nl80211.c-9536-\tu8 *mac_addr = NULL;\n"
} |
| 70/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 107803 output: 41 thoughts: 36 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing Parameter Initialization in nl80211 Station Setup** Alright, let's dive into the core of how station parameters are handled in the `nl80211` context. My initial thought is to trace the initialization of `params` across two key functions: `nl80211_set_station` and `nl80211_new_station`. I need to understand the lifecycle of this structure, specifically how it's populated and what potential issues might arise from its usage. I suspect subtle differences in how parameters are handled between a station being *created* versus being *modified* and I want to identify any gotchas. I need to be on the lookout for any missing parameter initializations or improper data copying. I need to make sure the structure is sound and consistent with the expected operation of the driver. Let's see how they do it. |
| 71/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 9355,
"LineCount": 25
}Results: {
"Contents": "9355:\t\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n9356:\t\tstruct wireless_dev *wdev = info-\u003euser_ptr[1];\n9357:\t\tstruct net_device *dev = wdev-\u003enetdev;\n9358:\t\tstruct station_parameters params;\n9359:\t\tu8 *mac_addr;\n9360:\t\tint err;\n9361:\t\n9362:\t\tmemset(\u0026params, 0, sizeof(params));\n9363:\t\n9364:\t\tif (!dev \u0026\u0026 wdev-\u003eiftype != NL80211_IFTYPE_NAN \u0026\u0026\n9365:\t\t wdev-\u003eiftype != NL80211_IFTYPE_NAN_DATA)\n9366:\t\t\treturn -EINVAL;\n9367:\t\n9368:\t\tif (!rdev-\u003eops-\u003echange_station)\n9369:\t\t\treturn -EOPNOTSUPP;\n9370:\t\n9371:\t\t/*\n9372:\t\t * AID and listen_interval properties can be set only for unassociated\n9373:\t\t * station. Include these parameters here and will check them in\n9374:\t\t * cfg80211_check_station_change().\n9375:\t\t */\n9376:\t\tif (info-\u003eattrs[NL80211_ATTR_STA_AID])\n9377:\t\t\tparams.aid = nla_get_u16(info-\u003eattrs[NL80211_ATTR_STA_AID]);\n9378:\t\n9379:\t\tif (info-\u003eattrs[NL80211_ATTR_VLAN_ID])\n"
} |
| 72/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 108530 output: 41 thoughts: 43 Thoughts: Here's my summary, as though I'm thinking through this code: **Analyzing the nl80211 Station Setup** Okay, so I'm looking at the `nl80211_set_station` function. The first thing that jumps out is that `memset(¶ms, 0, sizeof(params))` call. I need to be absolutely sure this is handled correctly here. Seems reasonable enough to start with a clean slate for the parameters, but I want to double-check that this doesn't inadvertently zero out anything crucial before setting up the station. It's good practice to clear a structure before filling it, but it also creates the possibility of accidentally resetting things that shouldn't be, so let's keep an eye on that. To understand the context better, I should dig into the `nl80211_new_station` function. This will give me a better understanding of how the station is initially created and what data is expected to be present, and it is here where the structure is likely initialized. By investigating `nl80211_new_station`, I can figure out what is meant to be new and what information is expected to be present. I should look there for the first instance of the `params` struct. |
| 73/3 | 2026/09/26 05:51 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 9532,
"LineCount": 25
}Results: {
"Contents": "9532:\t\tint err;\n9533:\t\tstruct wireless_dev *wdev = info-\u003euser_ptr[1];\n9534:\t\tstruct net_device *dev = wdev-\u003enetdev;\n9535:\t\tstruct station_parameters params;\n9536:\t\tu8 *mac_addr = NULL;\n9537:\t\tu32 auth_assoc = BIT(NL80211_STA_FLAG_AUTHENTICATED) |\n9538:\t\t\t\t BIT(NL80211_STA_FLAG_ASSOCIATED);\n9539:\t\n9540:\t\tmemset(\u0026params, 0, sizeof(params));\n9541:\t\n9542:\t\tif (!dev \u0026\u0026 wdev-\u003eiftype != NL80211_IFTYPE_NAN)\n9543:\t\t\treturn -EINVAL;\n9544:\t\n9545:\t\tif (!rdev-\u003eops-\u003eadd_station)\n9546:\t\t\treturn -EOPNOTSUPP;\n9547:\t\n9548:\t\tif (!info-\u003eattrs[NL80211_ATTR_MAC])\n9549:\t\t\treturn -EINVAL;\n9550:\t\n9551:\t\tif (wdev-\u003eiftype == NL80211_IFTYPE_NAN ||\n9552:\t\t wdev-\u003eiftype == NL80211_IFTYPE_NAN_DATA) {\n9553:\t\t\tif (info-\u003eattrs[NL80211_ATTR_STA_SUPPORTED_RATES])\n9554:\t\t\t\treturn -EINVAL;\n9555:\t\t\tif (wdev-\u003eiftype == NL80211_IFTYPE_NAN_DATA) {\n9556:\t\t\t\tif (!info-\u003eattrs[NL80211_ATTR_NAN_NMI_MAC])\n"
} |
| 74/3 | 2026/09/26 05:51 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 109355 output: 25 thoughts: 4667 Thoughts: **Analysis of Potential Uninitialized Memory Reads in mac80211 SMD Context Handling**
Okay, so I've been diving deep into the mac80211 code, specifically looking at the Secure Management Data (SMD) context handling, and I've got a couple of concerns. My main worry is around uninitialized memory reads, especially with the use of the SMD context.
First, I've confirmed that in places like `nl80211_set_station`, `nl80211_new_station`, `__ieee80211_start_rx_ba_session`, `__sta_info_alloc`, and `ieee80211_rx_list`, data structures like `params`, `rx`, and `sta` are initialized using `memset`, designated initializers or `kzalloc`, which should zero out any uninitialized parts. The allocation and initialization of these structures seem safe.
However, things get interesting with the `ieee80211_rx_list` and the `__ieee80211_rx_handle_packet()` functions. The code now passes a pointer to the `rx` structure. Critically, `rx` is initialized with `= {}` in `ieee80211_rx_list`. This ensures that `rx` is initialized every time the function is called, preventing the reuse of potentially stale data from previous calls.
Now, for `nl80211_put_smd_ctx`: It looks like the most likely place for a bug, due to the combination of `ctx->pn_len` and `test_bit(IEEE80211_SMD_CTX_VALID_PN, ctx->valid_ctx_bmap)`. My immediate thought is, what happens if we've set `ctx->pn_len` to a value greater than zero, but the `IEEE80211_SMD_CTX_VALID_PN` bit isn't set? In that case, we would be passing a valid `pn_len` but potentially reading uninitialized memory from `ctx->dl.pn`.
I followed the flow through `nl80211_parse_smd_ctx`, and found the following:
* If `NL80211_SMD_CTX_DL_ATTR_PN` is provided, `ctx->pn_len` is set correctly and the PN data is copied to `ctx->dl.pn`.
* The check focuses on the case where the DL PN data (`NL80211_SMD_CTX_DL_ATTR_PN`) is *not* present but the UL PN data (`NL80211_SMD_CTX_UL_ATTR_PN`) *is* present. In this scenario, `ctx->dl.pn` would be uninitialized.
However, since `ctx` is allocated with `kzalloc()`, `ctx->dl.pn` is actually *zeroed*, not uninitialized, if the driver doesn't populate `NL80211_SMD_CTX_DL_ATTR_PN`. This prevents an immediate crash.
Additionally, I checked `sta_apply_smd_state_flags()`, `sta_info_move_drv_smd_state()`, and `nl80211_notify_get_smd_ctx_done()`, and found no issues where variables might be uninitialized. The code does not have any potential problems. Similarly, the use of `nl80211_send_mgmt()` where `nl80211_put_smd_ctx` is called appears safe.
I did a quick check, and noticed that no driver in the tree actually allocates or implements the `ieee80211_smd_ctx` context using `get_smd_ctx` or `set_smd_ctx`. So it's unlikely that uninitialized memory is actually being used by any driver in the kernel.
So, in summary, I think the `kzalloc()` initialization and the structured initialization of variables avoids most of my concerns. The case of the UL/DL PN context could lead to some weird behavior, but it appears safe.
|
| 75/3 | 2026/09/26 05:52 | tool | grepper |
0mArgs:{
"Expression": "struct cfg80211_rx_info"
}Results: {
"Output": "include/net/cfg80211.h=9570=void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,\n--\ninclude/net/cfg80211.h-9574-/**\ninclude/net/cfg80211.h:9575: * struct cfg80211_rx_info - received management frame info\ninclude/net/cfg80211.h-9576- *\n--\ninclude/net/cfg80211.h-9589- */\ninclude/net/cfg80211.h:9590:struct cfg80211_rx_info {\ninclude/net/cfg80211.h-9591-\tint freq;\n--\ninclude/net/cfg80211.h-9606- * @wdev: wireless device receiving the frame\ninclude/net/cfg80211.h:9607: * @info: RX info as defined in struct cfg80211_rx_info\ninclude/net/cfg80211.h-9608- *\n--\ninclude/net/cfg80211.h=9617=bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,\ninclude/net/cfg80211.h:9618:\t\t\t struct cfg80211_rx_info *info);\ninclude/net/cfg80211.h-9619-\n--\ninclude/net/cfg80211.h=9637=static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,\n--\ninclude/net/cfg80211.h-9640-{\ninclude/net/cfg80211.h:9641:\tstruct cfg80211_rx_info info = {\ninclude/net/cfg80211.h-9642-\t\t.freq = freq,\n--\ninclude/net/cfg80211.h=9669=static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,\n--\ninclude/net/cfg80211.h-9672-{\ninclude/net/cfg80211.h:9673:\tstruct cfg80211_rx_info info = {\ninclude/net/cfg80211.h-9674-\t\t.freq = MHZ_TO_KHZ(freq),\n--\nnet/mac80211/rx.c=3973=static void\nnet/mac80211/rx.c:3974:ieee80211_rx_h_userspace_mgmt_st_req_frame(struct cfg80211_rx_info *info,\nnet/mac80211/rx.c-3975-\t\t\t\t\t struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c=3990=ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-3992-\tstruct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx-\u003eskb);\nnet/mac80211/rx.c:3993:\tstruct cfg80211_rx_info info = {\nnet/mac80211/rx.c-3994-\t\t.freq = ieee80211_rx_status_to_khz(status),\n--\nnet/wireless/mlme.c=1010=bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,\nnet/wireless/mlme.c:1011:\t\t\t struct cfg80211_rx_info *info)\nnet/wireless/mlme.c-1012-{\n--\nnet/wireless/nl80211.c=22886=int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\nnet/wireless/nl80211.c-22887-\t\t struct wireless_dev *wdev, u32 nlportid,\nnet/wireless/nl80211.c:22888:\t\t struct cfg80211_rx_info *info, gfp_t gfp)\nnet/wireless/nl80211.c-22889-{\n--\nnet/wireless/nl80211.h=112=int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,\nnet/wireless/nl80211.h-113-\t\t struct wireless_dev *wdev, u32 nlpid,\nnet/wireless/nl80211.h:114:\t\t struct cfg80211_rx_info *info, gfp_t gfp);\nnet/wireless/nl80211.h-115-\n--\nnet/wireless/trace.h=3472=TRACE_EVENT(cfg80211_rx_mgmt,\nnet/wireless/trace.h:3473:\tTP_PROTO(struct wireless_dev *wdev, struct cfg80211_rx_info *info),\nnet/wireless/trace.h-3474-\tTP_ARGS(wdev, info),\n"
} |
| 76/3 | 2026/09/26 05:52 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 116399 output: 715 thoughts: 3164 Thoughts: **Analysis of SM (SMD) Context and `cfg80211` Structures for Uninitialized Memory Usage**
Okay, let's break this down systematically. I've been examining the code related to the SM (SMD) Context feature and its integration within `cfg80211` to identify any potential risks of uninitialized memory usage, particularly focusing on whether this warrants `NeedsKMSAN=true`.
First, I've checked every instance of `struct cfg80211_rx_info`. Each one is initialized with designated initializers, effectively zeroing all unused fields including `.st_info`. This pattern is consistent across several functions such as `cfg80211_rx_mgmt_khz`, `cfg80211_rx_mgmt`, and `ieee80211_rx_h_userspace_mgmt`. Importantly, `.st_info.ctx` is explicitly set to `NULL` where relevant, eliminating any concern about uninitialized pointer usage.
Next, I reviewed the handling of `cfg80211_smd_params` in `struct cfg80211_ap_settings` and `struct ieee80211_bss_conf`. The key point here is that if SMD is not enabled, the code explicitly sets `link_conf->smd_params.smd_enabled = false;`. The rest of `link_conf->smd_params` is zeroed by design when the structure is allocated/initialized. I then analyzed `cfg80211_sta_smd_params` in `struct station_parameters` and `struct ieee80211_sta`. If `smd_sta` is `false`, the relevant fields are already zeroed since `sta` is allocated using `kzalloc`.
The core `drv_set_smd_ctx`, `drv_get_smd_ctx`, and associated rdev functions use checks for the presence of the driver function pointers before attempting to call them. This guards against any potential null pointer dereferences or uninitialized reads.
Crucially, the size calculations within `nl80211_smd_ctx_nl_size()` only consider valid fields. The calculations are based on data derived from the `st_info->ctx`, and are not influenced by uninitialized values.
I then honed in on the tracepoint `drv_set_smd_ctx`. Specifically, I carefully examined the bitmap copy within the tracepoint code. The code copies TIDs from `ctx->dl.valid_tid_bmap` and `ctx->ul.valid_tid_bmap` by using the dynamic array. Here, the number of valid TIDs is capped by `IEEE80211_SMD_CTX_NUM_TIDS` which is 8. The bitmapped uses `DECLARE_BITMAP` to store these bit fields and their number of long integers. The `memcpy` copies a fixed and known number of bytes, ensuring no out-of-bounds access or uninitialized reads. The same code path is checked for `nl80211_smd_ctx_nl_size()`.
I also inspected `cfg80211_free_pending_smd_ctx_req()`. The code here is standard list traversal, which is protected with locks. The structures are freed after list deletion, and the net device reference is dropped using `dev_put()`.
I checked all netlink policies. I found all policies have been carefully validated.
Finally, I reviewed the four criteria for `NeedsKMSAN=true` and `NeedsKMSAN=false` guidelines.
1. **Kernel structures sent to user space:** There are no raw kernel structures or structs with potential padding copied to user space. Netlink attributes use `nla_put_*` with explicit sizes, ensuring only initialized fields are transmitted. All netlink buffers are filled through `nla_put_*` helpers.
2. **Conditional logic or branching on uninitialized variables:** All stack and heap structures are either explicitly zeroed, initialized with designated initializers or initialized with `kzalloc`, `memset`, or `= {}` before use. No conditional branches rely on uninitialized values.
3. **Allocation/Initialization of complex data structures:** The complex data structures involved (`ieee80211_smd_ctx`, `cfg80211_smd_params`, etc.) are always initialized with `kzalloc` or `memset` or initialized with designated initializer like `= {}`.
4. **Bounds checks, lengths, etc. allowing access to uninitialized bytes:** No modifications of buffers in a way that allows reading or writing to uninitialized parts of the buffers.
|
| 77/3 | 2026/09/26 05:52 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series introduces support for IEEE 802.11bn / UHR Seamless Mobility Domain (SMD) and BSS Transition procedures into cfg80211, mac80211, and nl80211.\n\nA careful examination of KMSAN vs KASAN applicability reveals:\n1. Heap Allocations:\n - `struct ieee80211_smd_ctx` in `nl80211_parse_smd_ctx()` is allocated using `kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL)`.\n - `struct cfg80211_smd_get_ctx_pending` in `nl80211_get_smd_ctx()` is allocated using `kzalloc_obj(*pending)`.\n - `struct sta_info` instances are allocated via `kzalloc()` in mac80211.\n All heap-allocated structures are fully zeroed upon allocation.\n\n2. Stack Variables:\n - Stack-allocated `struct cfg80211_rx_info info` instances across all callsites (`cfg80211_rx_mgmt_khz()`, `cfg80211_rx_mgmt()`, and `ieee80211_rx_h_userspace_mgmt()`) use C99 designated initializers (e.g. `= { .st_info.ctx = NULL }`), which zero out all unmentioned members.\n - Stack-allocated `struct ieee80211_rx_data rx = {}` in `ieee80211_rx_list()` is zero-initialized.\n - Stack-allocated `struct station_parameters params` in `nl80211_set_station()` and `nl80211_new_station()` are cleared using `memset(\u0026params, 0, sizeof(params))`.\n - In virtual/hardware drivers (e.g. `mac80211_hwsim`), `struct ieee80211_rx_status` instances are initialized using `memset(\u0026rx_status, 0, sizeof(rx_status))`, ensuring `smd_ctx_valid` is 0.\n\n3. Kernel-to-Userspace Data Transfer:\n - In `nl80211_put_smd_ctx()`, attributes are serialized to netlink messages exclusively using individual scalar helpers (`nla_put_u8()`, `nla_put_u16()`) or sized binary attributes with known payload length (`nla_put(..., ctx-\u003epn_len, ...)`). No raw kernel structs with uninitialized padding or hole bytes are copied to user space.\n\n4. Other Potential Bugs:\n - Any risks in this patch series involve potential locking issues (protected by `smd_get_ctx_lock` and wiphy mutex, covered by LOCKDEP) or pointer/buffer handling (covered by KASAN).\n\nBecause no uninitialized memory reads or information leak risks are introduced or exposed, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series introduces support for IEEE 802.11bn / UHR Seamless Mobility Domain (SMD) and BSS Transition procedures into cfg80211, mac80211, and nl80211.\n\nA careful examination of KMSAN vs KASAN applicability reveals:\n1. Heap Allocations:\n - `struct ieee80211_smd_ctx` in `nl80211_parse_smd_ctx()` is allocated using `kzalloc(sizeof(*ctx) + drv_ctx_size, GFP_KERNEL)`.\n - `struct cfg80211_smd_get_ctx_pending` in `nl80211_get_smd_ctx()` is allocated using `kzalloc_obj(*pending)`.\n - `struct sta_info` instances are allocated via `kzalloc()` in mac80211.\n All heap-allocated structures are fully zeroed upon allocation.\n\n2. Stack Variables:\n - Stack-allocated `struct cfg80211_rx_info info` instances across all callsites (`cfg80211_rx_mgmt_khz()`, `cfg80211_rx_mgmt()`, and `ieee80211_rx_h_userspace_mgmt()`) use C99 designated initializers (e.g. `= { .st_info.ctx = NULL }`), which zero out all unmentioned members.\n - Stack-allocated `struct ieee80211_rx_data rx = {}` in `ieee80211_rx_list()` is zero-initialized.\n - Stack-allocated `struct station_parameters params` in `nl80211_set_station()` and `nl80211_new_station()` are cleared using `memset(\u0026params, 0, sizeof(params))`.\n - In virtual/hardware drivers (e.g. `mac80211_hwsim`), `struct ieee80211_rx_status` instances are initialized using `memset(\u0026rx_status, 0, sizeof(rx_status))`, ensuring `smd_ctx_valid` is 0.\n\n3. Kernel-to-Userspace Data Transfer:\n - In `nl80211_put_smd_ctx()`, attributes are serialized to netlink messages exclusively using individual scalar helpers (`nla_put_u8()`, `nla_put_u16()`) or sized binary attributes with known payload length (`nla_put(..., ctx-\u003epn_len, ...)`). No raw kernel structs with uninitialized padding or hole bytes are copied to user space.\n\n4. Other Potential Bugs:\n - Any risks in this patch series involve potential locking issues (protected by `smd_get_ctx_lock` and wiphy mutex, covered by LOCKDEP) or pointer/buffer handling (covered by KASAN).\n\nBecause no uninitialized memory reads or information leak risks are introduced or exposed, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|