mac80211: Add support for Tx-AMSDU viz debugfs.
Subsystems (2)
RFC 1/1 mac80211: Add support for Tx-AMSDU viz debugfs.
Add support for sending AMSDU packet with the user defined config through debugfs. This helps in testing the Rx-AMSDU path without needing a special driver/stack.
Note: Its purely for debug purposes.
---
Tests and Observations
==============
1) Verified the Rx-AMSDU logic with mac80211 based chip it works fine all msdu's are delivered.
2) Wireshark parses this frame fine.
3)sample cmd: echo "0,7,5,100,00:10:18:a9:50:6c"
Quoted 1 line
/sys/kernel/debug/ieee80211/phy0/netdev:wlan0/send_amsdu
Issues: Comments are welcome
===
1) Netgear/Broadcom AP's are dropping some AMSDU's in the AMSDU deaggregation when seen on wired side.
2) with 8K seeing a DMA timeout and warning in ath9k driver. (will send a separate mail)
3) dev_alloc_skb allocates as below(local PAGE_SIZE=4096)
AMSDU Size: SKB tailroom
2304+26 2368 3839+26 7936 7935+26 16128
---
include/linux/ieee80211.h | 22 ++++ include/net/mac80211.h | 8 +- net/mac80211/debugfs_netdev.c | 257 +++++++++++++++++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 1 - net/mac80211/mlme.c | 2 +- net/mac80211/tx.c | 4 +- net/mac80211/wme.c | 5 + 7 files changed, 293 insertions(+), 6 deletions(-)
include/linux/ieee80211.h +22 -0
@@ -172,6 +172,28 @@#define IEEE80211_HT_CTL_LEN 4 +/*AMSDU Params*/ +#define LLC_SNAP_LEN 8 +#define AMSDU_SIZE_2K 2304 +#define AMSDU_SIZE_4K 3839 +#define AMSDU_SIZE_8K 7935 +#define AMSDU_SHDR_LEN 14 +#define AMSDU_RESERVE 0 + +struct ieee80211_amsdu_sub_header { +u8 daddr[6 ]; +u8 saddr[6 ]; +__le16 len; +} __packed; + +struct ieee80211_amsdu_llc_hdr { +u8 llc_dsap; +u8 llc_ssap; +u8 llc_ctrl; +u8 snap_oui[3 ]; +u16 snap_type; +} __packed; +struct ieee80211_hdr {__le16 frame_control;__le16 duration_id;
include/net/mac80211.h +7 -1
@@ -470,6 +470,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_STATUS_EOSP =BIT (28 ),IEEE80211_TX_CTL_USE_MINRATE =BIT (29 ),IEEE80211_TX_CTL_DONTFRAG =BIT (30 ), + IEEE80211_TX_CTL_AMSDU = BIT(31), };#define IEEE80211_TX_CTL_STBC_SHIFT 23
@@ -485,7 +486,8 @@ enum mac80211_tx_control_flags {IEEE80211_TX_STAT_AMPDU |IEEE80211_TX_STAT_AMPDU_NO_BACK | \IEEE80211_TX_CTL_RATE_CTRL_PROBE |IEEE80211_TX_CTL_NO_PS_BUFFER |IEEE80211_TX_CTL_MORE_FRAMES |IEEE80211_TX_CTL_LDPC | \ - IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) +IEEE80211_TX_CTL_STBC |IEEE80211_TX_STATUS_EOSP | \ + IEEE80211_TX_CTL_AMSDU)/** * enum mac80211_rate_control_flags - per-rate flags set by the
@@ -1402,6 +1404,10 @@ enum ieee80211_hw_flags {IEEE80211_HW_SCAN_WHILE_IDLE =1 <<24 ,IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF =1 <<25 ,IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL =1 <<26 , +/* Some Drivers may not support 4K frame transmission +* in that case we need 2 bits, else 1 bit is enough*/ +IEEE80211_HW_TX_4K_AMSDU =1 <<27 , + IEEE80211_HW_TX_8K_AMSDU = 1<<28 };/**
net/mac80211/debugfs_netdev.c +257 -0
275 lines not on this page · raw message
net/mac80211/ieee80211_i.h +0 -1
@@ -402,7 +402,6 @@ struct ieee80211_mgd_assoc_data {bool have_beacon;bool sent_assoc;bool synced; -u8 ap_ht_param;struct ieee80211_vht_cap ap_vht_cap;
net/mac80211/mlme.c +1 -1
@@ -2183,7 +2183,6 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, sdata->u.mgd.flags =0 ;ieee80211_vif_release_channel (sdata); } -kfree (assoc_data); sdata->u.mgd.assoc_data =NULL ; }
@@ -3905,6 +3904,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, assoc_data->supp_rates_len = bss->supp_rates_len;rcu_read_lock (); + ht_ie =ieee80211_bss_get_ie (req->bss,WLAN_EID_HT_OPERATION );if (ht_ie && ht_ie[1 ] >=sizeof (struct ieee80211_ht_operation )) assoc_data->ap_ht_param =
net/mac80211/tx.c +1 -3
@@ -1144,7 +1144,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING ; hdr = (struct ieee80211_hdr *) skb->data; -if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) { tx->sta =rcu_dereference (sdata->u.vlan.sta);if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
@@ -1327,7 +1326,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)#define CALL_TXH (txh) \ do { \ res = txh(tx); \ - if (res != TX_CONTINUE) \ + if (res != TX_CONTINUE) \ goto txh_done; \ } while (0)
@@ -1367,7 +1366,6 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)I802_DEBUG_INC (tx->local->tx_handlers_queued);return -1 ; } -return 0 ; }
net/mac80211/wme.c +5 -0
@@ -188,6 +188,11 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, ack_policy |=IEEE80211_QOS_CTL_ACK_POLICY_NOACK ; info->flags |=IEEE80211_TX_CTL_NO_ACK ; } +/* Check for AMSDU Injection Tx*/ +if (info->flags &IEEE80211_TX_CTL_AMSDU ) { + ack_policy |=IEEE80211_QOS_CTL_A_MSDU_PRESENT ; + info->flags |=IEEE80211_TX_CTL_DONTFRAG ; + }/* qos header is 2 bytes */ *p++ = ack_policy | tid;
Johannes Berg
maintainerinclude/net/mac80211.h enum mac80211_tx_control_flags { · line 473
Quoted 5 lines · On Thu, 2013-02-07 at 00:01 -0800, [email protected] wrote:
include/net/mac80211.h +1
-0@@ -470,6 +470,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_STATUS_EOSP =BIT (28 ),IEEE80211_TX_CTL_USE_MINRATE =BIT (29 ),IEEE80211_TX_CTL_DONTFRAG =BIT (30 ), + IEEE80211_TX_CTL_AMSDU = BIT(31),
Hmm. I'm not exactly happy with using (one of) the last control flag for a pure debug facility.
net/mac80211/ieee80211_i.h struct ieee80211_mgd_assoc_data { · line 405
Quoted 6 lines
net/mac80211/ieee80211_i.h +1
-1+++ b/net/mac80211/ieee80211_i.h@@ -402,7 +402,6 @@ struct ieee80211_mgd_assoc_data {bool have_beacon;bool sent_assoc;bool synced; -
All those spurious whitespace changes just make the patch appear longer ... :)
johannes
Quoted 6 lines · Johannes Berg
On Thu, 2013-02-07 at 00:01 -0800, [email protected] wrote:
Hmm. I'm not exactly happy with using (one of) the last control flag for a pure debug facility.
Hmm...initially i tried to add qos header in the debugfs itself but to avoid code redundancy went with the TX_CTL. But in either case we need some kind of flag to skip adding the qos header by mac80211 (or) to set the AMSDU bit in the qos control header.
Quoted 3 lines
All those spurious whitespace changes just make the patch appear longer ... :)
Right, will take care of those along with some line wrapping issues while submitting the patch.
Johannes Berg
maintainerQuoted 11 lines · Krishna Chaitanya
Quoted 6 lines · Johannes Berg
On Thu, 2013-02-07 at 00:01 -0800, [email protected] wrote:
Hmm. I'm not exactly happy with using (one of) the last control flag for a pure debug facility.
Hmm...initially i tried to add qos header in the debugfs itself but to avoid code redundancy went with the
TX_CTL. But in either case we need some kind of flag to skip adding the qos header by mac80211 (or) to set the AMSDU bit in the qos control header.
I guess the question is whether we really need this code in the tree at all? It seems like a (relatively) obscure debug feature for which I'm not sure we should touch the TX fastpath?
johannes
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Krishna Chaitanya
Quoted 6 lines · Johannes Berg
On Thu, 2013-02-07 at 00:01 -0800, [email protected] wrote:
Hmm. I'm not exactly happy with using (one of) the last control flag for a pure debug facility.
Quoted 8 lines
Quoted 4 lines
Hmm...initially i tried to add qos header in the debugfs itself but to avoid code redundancy went with the
TX_CTL. But in either case we need some kind of flag to skip adding the qos header by mac80211 (or) to set the AMSDU bit in the qos control header.I guess the question is whether we really need this code in the tree at all? It seems like a (relatively) obscure debug feature for which I'm not sure we should touch the TX fastpath?
AMSDU in itself is rarely used feature in 802.11. So your concern i s understandable.
But the problem is every time we have to test the Rx-AMSDU which is mandatory for WFA 802.11n cert, we need to procure a adapter which supports it, which is difficult. Thats the scenario we have faced which lead us to work on this.With this feature in place we can use any opensource adapter and driver for that purpose.
Again, Its a trade off between stability and usability :-)
Quoted 21 lines · Krishna Chaitanya
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Krishna Chaitanya
Quoted 6 lines · Johannes Berg
On Thu, 2013-02-07 at 00:01 -0800, [email protected] wrote:
Hmm. I'm not exactly happy with using (one of) the last control flag for a pure debug facility.
Quoted 8 lines
Quoted 4 lines
Hmm...initially i tried to add qos header in the debugfs itself but to avoid code redundancy went with the
TX_CTL. But in either case we need some kind of flag to skip adding the qos header by mac80211 (or) to set the AMSDU bit in the qos control header.I guess the question is whether we really need this code in the tree at all? It seems like a (relatively) obscure debug feature for which I'm not sure we should touch the TX fastpath?
AMSDU in itself is rarely used feature in 802.11. So your concern i s understandable.
Quoted 7 lines
But the problem is every time we have to test the Rx-AMSDU which is mandatory for WFA 802.11n cert, we need to procure a adapter which supports it, which is difficult. Thats the scenario we have faced which lead us to work on this.With this feature in place we can use any opensource adapter and driver for that purpose.
Again, Its a trade off between stability and usability :-)
How about injecting A-MSDU packets via cooked monitor mode or nl80211 frame tx and thus shifting the debug-only code into userspace?
- Felix
Johannes Berg
maintainerQuoted 9 lines · Felix Fietkau
Quoted 7 lines
But the problem is every time we have to test the Rx-AMSDU which is mandatory for WFA 802.11n cert, we need to procure a adapter which supports it, which is difficult. Thats the scenario we have faced which lead us to work on this.With this feature in place we can use any opensource adapter and driver for that purpose.
Again, Its a trade off between stability and usability :-)
How about injecting A-MSDU packets via cooked monitor mode or nl80211 frame tx and thus shifting the debug-only code into userspace?
nl80211 won't work -- no support for data frames (and I'd rather not add it), but monitor mode (why cooked?) seems fine.
johannes
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Felix Fietkau
Quoted 6 lines
But the problem is every time we have to test the Rx-AMSDU which is mandatory for WFA 802.11n cert, we need to procure a adapter which supports it, which is difficult. Thats the scenario we have faced which lead us to work on this.With this feature in place we can use any opensource adapter and driver for that purpose.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Again, Its a trade off between stability and usability :-)
How about injecting A-MSDU packets via cooked monitor mode or nl80211 frame tx and thus shifting the debug-only code into userspace?
nl80211 won't work -- no support for data frames (and I'd rather not add it), but monitor mode (why cooked?) seems fine.
But whats the use of sending an AMSDU if we are not connected? First check in the code is to check for a connection.
Quoted 10 lines · Krishna Chaitanya
Quoted 9 lines · Johannes Berg
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
But the problem is every time we have to test the Rx-AMSDU which is mandatory for WFA 802.11n cert, we need to procure a adapter which supports it, which is difficult. Thats the scenario we have faced which lead us to work on this.With this feature in place we can use any opensource adapter and driver for that purpose.
Again, Its a trade off between stability and usability :-)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
How about injecting A-MSDU packets via cooked monitor mode or nl80211 frame tx and thus shifting the debug-only code into userspace?
nl80211 won't work -- no support for data frames (and I'd rather not add it), but monitor mode (why cooked?) seems fine.
But whats the use of sending an AMSDU if we are not connected? First check in the code is to check for a connection.
I mentioned cooked monitor because putting the hw in monitor mode may not always be desirable, and cooked monitor bypasses that.
You can send the AMSDU while you're connected. mac80211 treats injected frames that match the address of a local interface similar to regular tx on that interface, except for bypassing the normal 802.11 header encapsulation, so it should work for your tests.
- Felix
Johannes Berg
maintainerQuoted 4 lines · Felix Fietkau
Quoted 2 lines
But whats the use of sending an AMSDU if we are not connected? First check in the code is to check for a connection.
I mentioned cooked monitor because putting the hw in monitor mode may not always be desirable, and cooked monitor bypasses that.
You can pass "flags none" on the iw command line and it shouldn't change much then, but yeah, still might do a few other things. Anyway cooked should work fine.
johannes
Quoted 10 lines · Johannes Berg
Quoted 4 lines · Felix Fietkau
Quoted 2 lines
But whats the use of sending an AMSDU if we are not connected? First check in the code is to check for a connection.
I mentioned cooked monitor because putting the hw in monitor mode may not always be desirable, and cooked monitor bypasses that.
You can pass "flags none" on the iw command line and it shouldn't change much then, but yeah, still might do a few other things. Anyway cooked should work fine.
Even in the cooked monitor case, the setting of qos_header is done in the ieee80211_xmit(), so we still need to have some flag to know if its an AMSDU/Not based, even if we set the bit in the user space this will overwrite that.
Johannes Berg
maintainerQuoted 8 lines · Krishna Chaitanya
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Felix Fietkau
Quoted 2 lines
But whats the use of sending an AMSDU if we are not connected? First check in the code is to check for a connection.
I mentioned cooked monitor because putting the hw in monitor mode may not always be desirable, and cooked monitor bypasses that.
Quoted 8 lines
Quoted 3 lines
You can pass "flags none" on the iw command line and it shouldn't change much then, but yeah, still might do a few other things. Anyway cooked should work fine.
Even in the cooked monitor case, the setting of
qos_headeris done in theieee80211_xmit(), so we still need to have some flag to know if its an AMSDU/Not based, even if we set the bit in the user space this will overwrite that.
You should be able to patch this very easily to preserve the A-MSDU bit, which won't matter in the normal case where it's always cleared.
johannes
Quoted 6 lines · Johannes Berg
Quoted 2 lines · Krishna Chaitanya
Quoted 1 line · Johannes Berg
On Thu, 2013-02-07 at 16:18 +0100, Felix Fietkau wrote:
You should be able to patch this very easily to preserve the A-MSDU bit, which won't matter in the normal case where it's always cleared.
Will give it a try locally and share the patch. Thanks.