mac80211: Don't buffer non-bufferable MMPDUs
PATCH 1/1 mac80211: Don't buffer non-bufferable MMPDUs
Non-bufferable MMPDUs are sent out to STAs even while in PS mode (for example probe responses). Applying filtered frame handling for these doesn't seem to make much sense and will only create more air utilization when the STA wakes up. Hence, apply filtered frame handling only for bufferable MMPDUs.
--- net/mac80211/status.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/status.c +6 -0
@@ -51,6 +51,12 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,struct ieee80211_hdr *hdr = (void *)skb->data;int ac; +if (ieee80211_is_mgmt (hdr->frame_control) && + !ieee80211_is_bufferable_mmpdu (hdr->frame_control)) { +ieee80211_free_txskb (&local->hw, skb); +return ; + } +/* * This skb 'survived' a round-trip through the driver, and * hopefully the driver didn't mangle it too badly. However,
Signature · 1 line
1.8.4.5
Johannes Berg
maintainerQuoted 21 lines · Helmut Schaa
Non-bufferable MMPDUs are sent out to STAs even while in PS mode (for example probe responses). Applying filtered frame handling for these doesn't seem to make much sense and will only create more air utilization when the STA wakes up. Hence, apply filtered frame handling only for bufferable MMPDUs.
Signed-off-by Helmut Schaa <[email protected]>---
net/mac80211/status.c | 6 ++++++1 file changed, 6 insertions(+)net/mac80211/status.c +0
-0@@ -51,6 +51,12 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, struct ieee80211_hdr *hdr = (void *)skb->data; int ac;
net/mac80211/status.c static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, · line 58
Quoted 5 lines
net/mac80211/status.c +5
-0+if (ieee80211_is_mgmt (hdr->frame_control) && + !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) { +ieee80211_free_txskb (&local->hw, skb); +return ; + }
I don't really see a problem per se with this patch, but it seems that we could just check the flags instead? Perhaps we simply shouldn't apply buffering filtered frames here to frames that were already marked with IEEE80211_TX_CTL_NO_PS_BUFFER, since those frames shouldn't be filtered by the driver to start with.
That said, it obviously also points to a driver bug not treating these frames correctly, so you might want to investigate why you got here to start with!
johannes
Quoted 21 lines · Johannes Berg
Quoted 20 lines · Helmut Schaa
Non-bufferable MMPDUs are sent out to STAs even while in PS mode (for example probe responses). Applying filtered frame handling for these doesn't seem to make much sense and will only create more air utilization when the STA wakes up. Hence, apply filtered frame handling only for bufferable MMPDUs.
Signed-off-by Helmut Schaa <[email protected]>--- net/mac80211/status.c | 6 ++++++ 1 file changed, 6 insertions(+)net/mac80211/status.c +0
-0@@ -51,6 +51,12 @@ static void ieee80211_handle_filtered_frame(structieee80211_local *local, struct ieee80211_hdr *hdr = (void *)skb->data;int ac;
Quoted 11 lines
net/mac80211/status.c static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
Quoted 6 lines
net/mac80211/status.c +5
-0+if (ieee80211_is_mgmt (hdr->frame_control) && + !ieee80211_is_bufferable_mmpdu (hdr->frame_control)) { +ieee80211_free_txskb (&local->hw, skb); +return ; + }I don't really see a problem per se with this patch, but it seems that we could just check the flags instead? Perhaps we simply shouldn't apply buffering filtered frames here to frames that were already marked with
IEEE80211_TX_CTL_NO_PS_BUFFER, since those frames shouldn't be filtered by the driver to start with.
Good point, that should make the check a bit nicer. I'll change that.
Quoted 3 lines
That said, it obviously also points to a driver bug not treating these frames correctly, so you might want to investigate why you got here to start with!
It was not the driver marking the frame as filtered but mac80211 itself in status.c:
acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
/*
* The STA is in power save mode, so assume
* that this TX packet failed because of that.
*/
ieee80211_handle_filtered_frame(local, sta, skb);
rcu_read_unlock();
return;
}However, I've put the code into ieee80211_handle_filtered_frame to not grow ieee80211_tx_status even more :)
If you prefer to add it here directly I'm fine to change it.
Helmut
Johannes Berg
maintainerQuoted 7 lines · Helmut Schaa
Quoted 3 lines
That said, it obviously also points to a driver bug not treating these frames correctly, so you might want to investigate why you got here to start with!
It was not the driver marking the frame as filtered but mac80211 itself in
status.c:
Quoted 12 lines
acked = !!(info->flags &
IEEE80211_TX_STAT_ACK); if (!acked &&test_sta_flag(sta, WLAN_STA_PS_STA)) { /*
* The STA is in power save mode, so assume
* that this TX packet failed because of that.
*/ieee80211_handle_filtered_frame(local, sta, skb);
rcu_read_unlock();
return;
}
Ah, yes, ok. So the frame simply didn't go through, for whatever reason. Hopefully the driver actually transmitted it :)
Quoted 5 lines
However, I've put the code into
ieee80211_handle_filtered_frameto not growieee80211_tx_statuseven more :)If you prefer to add it here directly I'm fine to change it.
No, looks fine as is. I just misunderstood how we got here.
johannes
Quoted 22 lines · Johannes Berg
Quoted 7 lines · Helmut Schaa
Quoted 3 lines
That said, it obviously also points to a driver bug not treating these frames correctly, so you might want to investigate why you got here to start with!
It was not the driver marking the frame as filtered but mac80211 itself in
status.c:Quoted 12 lines
acked = !!(info->flags & IEEE80211_TX_STAT_ACK); if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) { /* * The STA is in power save mode, so assume * that this TX packet failed because of that. */ ieee80211_handle_filtered_frame(local, sta, skb); rcu_read_unlock(); return; }
Quoted 2 lines
Ah, yes, ok. So the frame simply didn't go through, for whatever reason. Hopefully the driver actually transmitted it :)
Yep, saw it on the air.
It was a STA sending probe requests while in PS mode and jumping to a new channel before receiving/acking all probe responses. Hence, a probe response ended up in the filtered queue. And it was easy to reproduce with this specific STA (some old voip phone).
Quoted 7 lines
Quoted 5 lines
However, I've put the code into
ieee80211_handle_filtered_frameto not growieee80211_tx_statuseven more :)If you prefer to add it here directly I'm fine to change it.
No, looks fine as is. I just misunderstood how we got here.
Ok, I'd still like to change to checking IEEE80211_TX_CTL_NO_PS_BUFFER instead -> v2 follows.
Helmut
PATCH v2 1/1 mac80211: Don't buffer non-bufferable MMPDUs
In reply to Helmut SchaaNon-bufferable MMPDUs are sent out to STAs even while in PS mode (for example probe responses). Applying filtered frame handling for these doesn't seem to make much sense and will only create more air utilization when the STA wakes up. Hence, apply filtered frame handling only for bufferable MMPDUs.
Discovered while testing an old VOIP phone that started probing for APs while in PS mode. The mac80211/ath9k AP where the STA is associated would reply with a probe response but the phone sometimes moved to a new channel already and couldn't ack the probe response anymore. In that case mac80211 applied filtered frame handling for the un-acked probe response.
---
Changes in v2: Check IEEE80211_TX_CTL_NO_PS_BUFFER instead of frame_control field
net/mac80211/status.c | 5 +++++ 1 file changed, 5 insertions(+)
net/mac80211/status.c +5 -0
@@ -51,6 +51,11 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,struct ieee80211_hdr *hdr = (void *)skb->data;int ac; +if (info->flags &IEEE80211_TX_CTL_NO_PS_BUFFER ) { +ieee80211_free_txskb (&local->hw, skb); +return ; + } +/* * This skb 'survived' a round-trip through the driver, and * hopefully the driver didn't mangle it too badly. However,
Signature · 1 line
1.8.4.5