[PATCH wireless-next] wifi: mac80211: find the station of a freed 802.3 frame for AQL
From: Julius Bairaktaris
Date: Sun Nov 22 2026 - 10:05:46 EST
ieee80211_report_used_skb() returns a frame's pending airtime to the
station found from the 802.11 header. An encap offloaded frame starts
with its 802.3 header instead, so the lookup finds no station, the
station keeps the charge, and once its leaked airtime exceeds its limit
ieee80211_txq_airtime_check() stops scheduling it until it reassociates.
Drivers with AQL and encap offload reach this through
ieee80211_free_txskb() wherever they drop a frame without knowing its
station, for example when firmware recovery returns the frames it held.
Look up an encap offloaded frame's station with
ieee80211_lookup_ra_sta(), as ieee80211_subif_start_xmit_8023() did on
transmit.
Fixes: 50ff477a8639 ("mac80211: add 802.11 encapsulation offloading support")
Signed-off-by: Julius Bairaktaris <julius@xxxxxxxxxxxxxx>
---
I used Claude (Anthropic) to help write these patches.
I have reviewed the commit message myself and edited it where needed.
net/mac80211/ieee80211_i.h | 3 +++
net/mac80211/status.c | 17 +++++++++++++++--
net/mac80211/tx.c | 6 +++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a74b1e711733..88f342742e14 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2313,6 +2313,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev);
netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
struct net_device *dev);
+int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, struct sta_info **sta_out,
+ bool bss);
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev,
u32 info_flags,
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 5d1807ab46ef..cde6f0cfa0ed 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -769,11 +769,24 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
acked = false;
if (tx_time_est) {
- struct sta_info *sta;
+ struct ieee80211_sub_if_data *sdata;
+ struct sta_info *sta = NULL;
rcu_read_lock();
- sta = sta_info_get_by_addrs(local, hdr->addr1, hdr->addr2);
+ /* An encap offloaded frame still starts with its 802.3
+ * header; find its station as the transmit path did.
+ */
+ if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) {
+ sta = sta_info_get_by_addrs(local, hdr->addr1,
+ hdr->addr2);
+ } else {
+ sdata = ieee80211_sdata_from_skb(local, skb);
+ if (!sdata ||
+ ieee80211_lookup_ra_sta(sdata, skb, &sta, false) ||
+ IS_ERR(sta))
+ sta = NULL;
+ }
ieee80211_sta_update_pending_airtime(local, sta,
skb_get_queue_mapping(skb),
tx_time_est,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index cb9ecac25a9c..7b1fcf3dea7d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2626,9 +2626,9 @@ static inline bool ieee80211_is_tdls_setup(struct sk_buff *skb)
* - NULL: frame will be unicast to a yet unknown station
* - ERR_PTR(-ENOENT): frame will be group addressed
*/
-static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb,
- struct sta_info **sta_out, bool bss)
+int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, struct sta_info **sta_out,
+ bool bss)
{
struct sta_info *sta;
base-commit: e1dd8486807c1acf9551250b7f81e116a21e6ad6
--
2.53.0