[PATCH wireless-next v3 17/21] wifi: mac80211: pass rx_data directly from ieee80211_rx_list()

From: Pooventhiran G

Date: Thu Nov 05 2026 - 15:02:10 EST


rx_data is currently defined inside __ieee80211_rx_handle_packet() and
is passed to the rx handlers called inside. Define it early in
ieee80211_rx_list() so that new transient data that live just between
the driver and mac80211 interface layer can be passed to the rx handlers
as well.

Signed-off-by: Pooventhiran G <pooventhiran.g@xxxxxxxxxxxxxxxx>
---
net/mac80211/rx.c | 60 +++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 12ba9fbcc983..78967ac95343 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5374,7 +5374,8 @@ static bool ieee80211_rx_valid_freq(struct ieee80211_rx_status *status,
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;
@@ -5383,16 +5384,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);
@@ -5424,8 +5423,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) ||
@@ -5446,9 +5445,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;
@@ -5468,13 +5467,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;
@@ -5492,20 +5491,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;
@@ -5560,14 +5559,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
if (link_sta && link &&
ieee80211_rx_valid_freq(status, 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;
@@ -5596,22 +5595,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 != &sdata->deflink ? link->link_id : -1;
- rx.sta = NULL;
- rx.link_sta = NULL;
+ rx->sdata = sdata;
+ rx->local = sdata->local;
+ rx->link = link;
+ rx->link_id = link != &sdata->deflink ? link->link_id : -1;
+ 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:
@@ -5631,6 +5630,7 @@ 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_rx_data rx = {};

WARN_ON_ONCE(softirq_count() == 0);

@@ -5782,7 +5782,7 @@ 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);
}

kcov_remote_stop();

--
2.34.1