A-MPDU extension
This is a request for adoption of the long-discussed A-MPDU status extension. I finally got around to implementing it for testing.
This proposal adds the following field, as also documented on
http://www.radiotap.org/suggested-fields/A-MPDU%20status
Bit Number: 20
Structure: u32 reference number,
u16 flags,
u8 delimiter CRC value,
u8 reserved
Required Alignment: 4 bytes
The presence of this field indicates that the frame was received as part of an a-MPDU.
The reference number is generated by the capture device and is the same across each subframe of an A-MPDU. Since the capture device might be capable of capturing multiple channels or data from multiple (concurrent) captures could be merged, the reference number is not guaranteed to be unique across different channels. As a result, applications should use the channel information together with the reference number to identify the subframes belonging to the same A-MPDU.
The following flags are defined:
0x0001: driver reports 0-length subframes0x0002: frame is 0-length subframe (valid only if 0x0001 is set) 0x0004: last subframe is known (should be set for all subframes in an
A-MPDU)
0x0008: this frame is the last subframe0x0010: delimiter CRC error0x0020: delimiter CRC value known: the delimiter CRC value field is
valid0xffc0: reserved
Within an A-MPDU, the subframe index can be determined by the application so it is not included, but depending on the driver reporting this may miss 0-length subframes.
--- end of description ---
I've attached patches against wireshark to parse and the Linux kernel (the stack and the iwlwifi driver) to report this field.
Barring any objections, I will repost at the end of the month for and make the wiki updates to adopt this proposal. At that time, I'll also file a bug against wireshark to update, with this patch.
johannes
Quoted 1 line
From
15827701e153a2ff57a1857b54c86a4d3da1e61dMon Sep 17 00:00:00 2001
From: Johannes Berg <[email protected]>
Date: Thu, 5 Jul 2012 11:32:16 +0200
Subject: [PATCH 1/4] wireless: add radiotap A-MPDU status field
Define the A-MPDU status field in radiotap, also update the radiotap parser for it and the MCS field that was apparently missed last time.
--- include/net/ieee80211_radiotap.h | 11 +++++++++++ net/wireless/radiotap.c | 2 ++ 2 files changed, 13 insertions(+)
include/net/ieee80211_radiotap.h +11 -0
@@ -183,6 +183,9 @@ struct ieee80211_radiotap_header {* Contains a bitmap of known fields/flags, the flags, and * the MCS index. * +* IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitlesss +* +* Contains the AMPDU information for the subframe. */ enum ieee80211_radiotap_type {IEEE80211_RADIOTAP_TSFT =0 ,
@@ -205,6 +208,7 @@ enum ieee80211_radiotap_type {IEEE80211_RADIOTAP_DATA_RETRIES =17 ,IEEE80211_RADIOTAP_MCS =19 , +IEEE80211_RADIOTAP_AMPDU_STATUS =20 ,/* valid in every it_present bitmap, even vendor namespaces */ IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -270,6 +274,13 @@ enum ieee80211_radiotap_type {#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 +/* For IEEE80211_RADIOTAP_AMPDU_STATUS */ +#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 +#define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002 +#define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008 +#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 +#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020/* helpers */ static inline int ieee80211_get_radiotap_len (unsigned char *data)
net/wireless/radiotap.c +2 -0
@@ -41,6 +41,8 @@ static const struct radiotap_align_size rtap_namespace_sizes[] = { [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, }, [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, }, [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, }, + [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, }, + [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },/* * add more here as they are defined in radiotap.h */
Signature · 1 line
1.7.10
Quoted 1 line
From
94aabbebe7ea4bb2b297576d2219f28dda914036Mon Sep 17 00:00:00 2001
From: Johannes Berg <[email protected]>
Date: Thu, 5 Jul 2012 13:14:18 +0200
Subject: [PATCH 2/4] mac80211: optimize ieee80211_rx_status struct layout
We waste a lot of space in this struct because it uses int values where smaller ones would be sufficient. The upcoming A-MPDU information needs some space, optimize the struct now.
--- include/net/mac80211.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
include/net/mac80211.h +7 -7
@@ -709,13 +709,13 @@ enum mac80211_rx_flags {*/ struct ieee80211_rx_status {u64 mactime; -enum ieee80211_band band; -int freq; -int signal; -int antenna; -int rate_idx; -int flag; -unsigned int rx_flags; +u16 flag; +u16 freq; +u8 rate_idx; +u8 rx_flags; +u8 band; +u8 antenna; +s8 signal; };/**
Signature · 1 line
1.7.10
Quoted 1 line
From
1a0f020c98d5d67085272d83f28890fdddd26494Mon Sep 17 00:00:00 2001
From: Johannes Berg <[email protected]>
Date: Thu, 5 Jul 2012 11:34:31 +0200
Subject: [PATCH 3/4] mac80211: support A-MPDU status reporting
Support getting A-MPDU status information from the drivers and reporting it to userspace via radiotap in the standard fields.
--- include/net/mac80211.h | 53 +++++++++++++++++++++++++++++++++++------------- net/mac80211/rx.c | 42 +++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 15 deletions(-)
include/net/mac80211.h +39 -14
76 lines not on this page · raw message
net/mac80211/rx.c +41 -1
60 lines not on this page · raw message
Signature · 1 line
1.7.10
Quoted 1 line
From
cf0ca5d45dd2008602ecc37495206ae44b748e71Mon Sep 17 00:00:00 2001
From: Johannes Berg <[email protected]>
Date: Thu, 5 Jul 2012 13:05:08 +0200
Subject: [PATCH 4/4] iwlwifi: report A-MPDU status
Since the firmware will give us an A-MPDU bit and
only a single PHY information packet for all the
subframes in an A-MPDU, we can easily report the
minimal A-MPDU information for radiotap.
--- drivers/net/wireless/iwlwifi/dvm/commands.h | 1 + drivers/net/wireless/iwlwifi/dvm/dev.h | 1 + drivers/net/wireless/iwlwifi/dvm/rx.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/dvm/commands.h +1 -0
@@ -1019,6 +1019,7 @@ struct iwl_wep_cmd {#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) +#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7)#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
drivers/net/wireless/iwlwifi/dvm/dev.h +1 -0
@@ -787,6 +787,7 @@ struct iwl_priv {u8 agg_tids_count;struct iwl_rx_phy_res last_phy_res; +u32 ampdu_ref;bool last_phy_res_valid;/*
drivers/net/wireless/iwlwifi/dvm/rx.c +13 -1
@@ -668,6 +668,7 @@ static int iwlagn_rx_reply_rx_phy(struct iwl_priv *priv,struct iwl_rx_packet *pkt =rxb_addr (rxb); priv->last_phy_res_valid = true; + priv->ampdu_ref++;memcpy (&priv->last_phy_res, pkt->data,sizeof (struct iwl_rx_phy_res ));return 0 ;
@@ -911,6 +912,8 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv,u32 ampdu_status;u32 rate_n_flags; + rx_status.flag =0 ; +/** * REPLY_RX and REPLY_RX_MPDU_CMD are handled differently. * REPLY_RX: physical layer info is in this buffer
@@ -941,6 +944,16 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv, rx_pkt_status = *(__le32 *)(pkt->data +sizeof (*amsdu) + len); ampdu_status =iwlagn_translate_rx_status (priv,le32_to_cpu (rx_pkt_status)); + +if (phy_res->phy_flags &RX_RES_PHY_FLAGS_AGG_MSK ) { +/* +* We know which subframes of an A-MPDU belong +* together since we get a single PHY response +* from the firmware for all of them +*/ + rx_status.flag |=RX_FLAG_AMPDU_DETAILS ; + rx_status.ampdu_reference = priv->ampdu_ref; + } }if ((unlikely (phy_res->cfg_phy_cnt >20 ))) {
@@ -968,7 +981,6 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv, rx_status.band); rx_status.rate_idx =iwlagn_hwrate_to_mac80211_idx (rate_n_flags, rx_status.band); - rx_status.flag =0 ;/* TSF isn't reliable. In order to allow smooth user experience, * this W/A doesn't propagate it to the mac80211 */
Signature · 1 line
1.7.10
dissectors/packet-ieee80211-radiotap-defs.h +13 -0
@@ -182,6 +182,9 @@* Contains a bitmap of known fields/flags, the flags, and * the MCS index. * +* IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitlesss +* +* Contains the AMPDU information for the subframe. */ enum ieee80211_radiotap_type {IEEE80211_RADIOTAP_TSFT =0 ,
@@ -204,6 +207,7 @@IEEE80211_RADIOTAP_DATA_RETRIES =17 ,IEEE80211_RADIOTAP_XCHANNEL =18 ,/* Unofficial, used by FreeBSD */ IEEE80211_RADIOTAP_MCS =19 , +IEEE80211_RADIOTAP_AMPDU_STATUS =20 ,/* valid in every it_present bitmap, even vendor namespaces */ IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -270,4 +274,13 @@#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10#define IEEE80211_RADIOTAP_MCS_STBC 0x20 + +/* For IEEE80211_RADIOTAP_AMPDU_STATUS */ +#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 +#define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002 +#define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008 +#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 +#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 +#endif /* IEEE80211_RADIOTAP_H */
dissectors/packet-ieee80211-radiotap.c +87 -1
123 lines not on this page · raw message
dissectors/packet-ieee80211-radiotap-iter.c +2 -1
@@ -50,7 +50,8 @@ /* [IEEE80211_RADIOTAP_RTS_RETRIES] = 16 */ { 1, 1 }, /* [IEEE80211_RADIOTAP_DATA_RETRIES] = 17 */ { 1, 1 }, /* [IEEE80211_RADIOTAP_XCHANNEL] = 18 */ { 0, 0 }, /* Unofficial, used by FreeBSD */ - /* [IEEE80211_RADIOTAP_MCS] = 19 */ { 1, 3 } + /* [IEEE80211_RADIOTAP_MCS] = 19 */ { 1, 3 }, + /* [IEEE80211_RADIOTAP_AMPDU_STATUS] = 20 */ { 4, 8 }/* * add more here as they are defined in * include/net/ieee80211_radiotap.h