From: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
pooventhiran.g@oss.qualcomm.com
Subject: [PATCH wireless-next v5 14/19] wifi: mac80211: filter uplink and downlink frames based on ST states
Date: Wed, 02 Dec 2026 15:58:09 +0530 [thread overview]
Message-ID: <20261202-smd-v5-14-1b020be65c7c@oss.qualcomm.com> (raw)
In-Reply-To: <20261202-smd-v5-0-1b020be65c7c@oss.qualcomm.com>
During ST, based on the state that the non-AP MLD is currently in, there
are frame filtering conditions imposed in both uplink and downlink
directions, as per IEEE P802.11bn/D2.0, Aug 2026, subclause 11.3.1.
State 4a:
- UL/DL: All Class 3 frames except ST Execution Request and Response
frames are disallowed.
State 4b:
- UL: Class 3 data frames are disallowed.
- DL: All Class 3 data, control, management frames are disallowed.
State 4c:
- UL: All Class 3 frames except QoS Null, Control, and UHR
Reconfiguration Notify frames are disallowed.
- DL: All Class 3 frames except Data, Control, and UHR
Reconfiguration Notify frames are disallowed.
Add the filters in both tx and rx handlers to implement the conditions
to avoid exchanging those frames while the station is transitioning
'seamlessly' (state-4) to the target AP MLD. The unexpected frames will
cause out-of-state operations and leaks in the context transferred.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
net/mac80211/drop.h | 1 +
net/mac80211/rx.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
net/mac80211/tx.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+)
diff --git a/net/mac80211/drop.h b/net/mac80211/drop.h
index f433ee17cce5..fe037c94b2ca 100644
--- a/net/mac80211/drop.h
+++ b/net/mac80211/drop.h
@@ -109,6 +109,7 @@ typedef unsigned int __bitwise ieee80211_rx_result;
R(RX_DROP_U_UNHANDLED_MGMT_STYPE) \
R(RX_DROP_U_NO_LINK) \
R(RX_DROP_U_DEFRAG_OVERFLOW) \
+ R(RX_DROP_U_SMD_FILTERED) \
/* this line for the trailing \ - add before this */
/* having two enums allows for checking ieee80211_rx_result use with sparse */
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a2356cd17691..a152471151a9 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1628,6 +1628,50 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
return RX_CONTINUE;
}
+static ieee80211_rx_result debug_noinline
+ieee80211_rx_h_st_state(struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
+ __le16 fc = hdr->frame_control;
+
+ if (!rx->sta ||
+ (rx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ rx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ !rx->sta->sta.smd_sta ||
+ !test_sta_flag(rx->sta, WLAN_STA_ASSOC) ||
+ is_multicast_ether_addr(hdr->addr1))
+ return RX_CONTINUE;
+
+ switch (rx->sta->st_state) {
+ case IEEE80211_STA_ST_NONE:
+ break;
+ case IEEE80211_STA_ST_PREPARED:
+ /* 4a: Class 3 disallowed except ST Execution Request */
+ if (ieee80211_is_st_exec_req(rx->skb))
+ break;
+ if (ieee80211_is_class3(rx->skb))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ case IEEE80211_STA_ST_EXECUTING:
+ /* 4b: Class 3 Data frames disallowed */
+ if (ieee80211_is_data(fc))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ case IEEE80211_STA_ST_DL_DRAIN:
+ /*
+ * 4c: Class 3 frames disallowed except QoS Null, Control, and
+ * UHR Reconfiguration Notify frames.
+ */
+ if (ieee80211_is_qos_nullfunc(fc) || ieee80211_is_ctl(fc) ||
+ ieee80211_is_uhr_link_reconf_notify(rx->skb))
+ break;
+ if (ieee80211_is_class3(rx->skb))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ }
+
+ return RX_CONTINUE;
+}
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx)
@@ -4305,6 +4349,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
CALL_RXH(ieee80211_rx_h_check_dup);
CALL_RXH(ieee80211_rx_h_check);
+ CALL_RXH(ieee80211_rx_h_st_state);
ieee80211_rx_reorder_ampdu(rx, &reorder_release);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index cb9ecac25a9c..aab0f8f6bd9c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -308,6 +308,48 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
return TX_CONTINUE;
}
+static ieee80211_tx_result debug_noinline
+ieee80211_tx_h_st_state(struct ieee80211_tx_data *tx)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+ __le16 fc = hdr->frame_control;
+
+ if (!tx->sta ||
+ (tx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ tx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ !tx->sta->sta.smd_sta ||
+ !test_sta_flag(tx->sta, WLAN_STA_ASSOC) ||
+ !(tx->flags & IEEE80211_TX_UNICAST))
+ return TX_CONTINUE;
+
+ switch (tx->sta->st_state) {
+ case IEEE80211_STA_ST_NONE:
+ break;
+ case IEEE80211_STA_ST_PREPARED:
+ /* 4a: Class 3 disallowed except ST Execution Response */
+ if (ieee80211_is_st_exec_resp(tx->skb))
+ break;
+ if (ieee80211_is_class3(tx->skb))
+ return TX_DROP;
+ break;
+ case IEEE80211_STA_ST_EXECUTING:
+ /* 4b: no restriction */
+ break;
+ case IEEE80211_STA_ST_DL_DRAIN:
+ /* 4c: Class 3 disallowed except Data, Control,
+ * UHR Reconfiguration Notify
+ */
+ if (ieee80211_is_ctl(fc) || ieee80211_is_data(fc) ||
+ ieee80211_is_uhr_link_reconf_notify(tx->skb))
+ break;
+ if (ieee80211_is_class3(tx->skb))
+ return TX_DROP;
+ break;
+ }
+
+ return TX_CONTINUE;
+}
+
/* This function is called whenever the AP is about to exceed the maximum limit
* of buffered frames for power saving STAs. This situation should not really
* happen often during normal operation, so dropping the oldest buffered packet
@@ -1883,6 +1925,7 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
CALL_TXH(ieee80211_tx_h_dynamic_ps);
CALL_TXH(ieee80211_tx_h_check_assoc);
+ CALL_TXH(ieee80211_tx_h_st_state);
CALL_TXH(ieee80211_tx_h_ps_buf);
CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
CALL_TXH(ieee80211_tx_h_select_key);
--
2.34.1
next prev parent reply other threads:[~2026-12-02 10:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 02/19] wifi: nl80211/cfg80211: define interfaces for SMD STA indications Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 03/19] wifi: nl80211: add ST sub-state STA flags for non-AP MLD Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 04/19] wifi: cfg80211: define layouts for ST context transfer Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 05/19] wifi: nl80211: define interfaces " Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 06/19] wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 07/19] wifi: ieee80211: define API to check if frame is class 3 Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 08/19] wifi: nl80211/cfg80211: pack ST dynamic context along with frame Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 09/19] wifi: nl80211/cfg80211: add support for ST context programming Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 10/19] wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 11/19] wifi: nl80211/cfg80211: define API to notify ST Drain completion Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes Pooventhiran G
2026-12-02 10:28 ` Pooventhiran G [this message]
2026-12-02 10:28 ` [PATCH wireless-next v5 15/19] wifi: mac80211: pass rx_data directly from ieee80211_rx_list() Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 16/19] wifi: mac80211: handle UHR Link Reconfiguration frame Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 17/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 19/19] wifi: mac80211: define API to invoke ST Drain Completion event Pooventhiran G
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202-smd-v5-14-1b020be65c7c@oss.qualcomm.com \
--to=pooventhiran.g@oss.qualcomm.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®