A-MPDU status reporting
Subsystems (4)
Johannes Berg
maintainercover A-MPDU status reporting
We just added A-MPDU status reporting in radiotap, this implements it in mac80211 and iwlwifi. The changes will be adopted formally next week so I'll merge the patches then (into the different trees.)
johannes
Johannes Berg
maintainerPATCH 1/3 wireless: add radiotap A-MPDU status field
From: Johannes Berg <[email protected]>
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.4
Re: [PATCH 1/3] wireless: add radiotap A-MPDU status field
Hi Johannes,
Quoted 17 lines · Johannes Berg
From: Johannes Berg <[email protected]>
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.
Signed-off-by Johannes Berg <[email protected]>---
include/net/ieee80211_radiotap.h| 11 +++++++++++net/wireless/radiotap.c| 2 ++2 files changed, 13 insertions(+)include/net/ieee80211_radiotap.h +0
-0
include/net/ieee80211_radiotap.h struct ieee80211_radiotap_header { · line 186
Quoted 4 lines
include/net/ieee80211_radiotap.h +1
-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
Just a minor nit, but there seems to be an 's' too many in unitlesss above.
---
Gertjan
Johannes Berg
maintainerRe: [PATCH 1/3] wireless: add radiotap A-MPDU status field
Quoted 3 lines · Gertjan van Wingerde
Quoted 1 line
+ *
IEEE80211_RADIOTAP_AMPDU_STATUSu32, u16, u8, u8 unitlesssJust a minor nit, but there seems to be an 's' too many in unitlesss above.
Good catch, thanks. I fixed it, but I'm not going to repost the patches for it :-)
johannes
Johannes Berg
maintainerPATCH 2/3 mac80211: support A-MPDU status reporting
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
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
@@ -676,21 +676,41 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)* @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT * to hw.radiotap_mcs_details to advertise that fact +* @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference +* number (@ampdu_reference) must be populated and be a distinct number for +* each A-MPDU +* @RX_FLAG_AMPDU_REPORT_ZEROLEN: driver reports 0-length subframes +* @RX_FLAG_AMPDU_IS_ZEROLEN: This is a zero-length subframe, for +* monitoring purposes only +* @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all +* subframes of a single A-MPDU +* @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU +* @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected +* on this subframe +* @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC +* is stored in the @ampdu_delimiter_crc field) */ enum mac80211_rx_flags { -RX_FLAG_MMIC_ERROR =1 <<0 , -RX_FLAG_DECRYPTED =1 <<1 , -RX_FLAG_MMIC_STRIPPED =1 <<3 , -RX_FLAG_IV_STRIPPED =1 <<4 , -RX_FLAG_FAILED_FCS_CRC =1 <<5 , -RX_FLAG_FAILED_PLCP_CRC =1 <<6 , -RX_FLAG_MACTIME_MPDU =1 <<7 , -RX_FLAG_SHORTPRE =1 <<8 , -RX_FLAG_HT =1 <<9 , -RX_FLAG_40MHZ =1 <<10 , -RX_FLAG_SHORT_GI =1 <<11 , -RX_FLAG_NO_SIGNAL_VAL =1 <<12 , -RX_FLAG_HT_GF =1 <<13 , +RX_FLAG_MMIC_ERROR =BIT (0 ), +RX_FLAG_DECRYPTED =BIT (1 ), +RX_FLAG_MMIC_STRIPPED =BIT (3 ), +RX_FLAG_IV_STRIPPED =BIT (4 ), +RX_FLAG_FAILED_FCS_CRC =BIT (5 ), +RX_FLAG_FAILED_PLCP_CRC =BIT (6 ), +RX_FLAG_MACTIME_MPDU =BIT (7 ), +RX_FLAG_SHORTPRE =BIT (8 ), +RX_FLAG_HT =BIT (9 ), +RX_FLAG_40MHZ =BIT (10 ), +RX_FLAG_SHORT_GI =BIT (11 ), +RX_FLAG_NO_SIGNAL_VAL =BIT (12 ), +RX_FLAG_HT_GF =BIT (13 ), +RX_FLAG_AMPDU_DETAILS =BIT (14 ), +RX_FLAG_AMPDU_REPORT_ZEROLEN =BIT (15 ), +RX_FLAG_AMPDU_IS_ZEROLEN =BIT (16 ), +RX_FLAG_AMPDU_LAST_KNOWN =BIT (17 ), +RX_FLAG_AMPDU_IS_LAST =BIT (18 ), +RX_FLAG_AMPDU_DELIM_CRC_ERROR =BIT (19 ), +RX_FLAG_AMPDU_DELIM_CRC_KNOWN =BIT (20 ), };/**
@@ -714,17 +734,22 @@ enum mac80211_rx_flags {* HT rates are use (RX_FLAG_HT) * @flag: %RX_FLAG_* * @rx_flags: internal RX flags for mac80211 +* @ampdu_reference: A-MPDU reference number, must be a different value for +* each A-MPDU but the same for each subframe within one A-MPDU +* @ampdu_delimiter_crc: A-MPDU delimiter CRC */ struct ieee80211_rx_status {u64 mactime;u32 device_timestamp; -u16 flag; +u32 ampdu_reference; +u32 flag;u16 freq;u8 rate_idx;u8 rx_flags;u8 band;u8 antenna;s8 signal; +u8 ampdu_delimiter_crc; };/**
net/mac80211/rx.c +41 -1
60 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerPATCH 3/3 iwlwifi: report A-MPDU status
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
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 | 11 +++++++++++ 3 files changed, 13 insertions(+)
drivers/net/wireless/iwlwifi/dvm/commands.h +1 -0
@@ -1055,6 +1055,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
@@ -771,6 +771,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 +11 -0
@@ -667,6 +667,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 ;
@@ -981,6 +982,16 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv,if (phy_res->phy_flags &RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK ) rx_status.flag |=RX_FLAG_SHORTPRE ; +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; + } +/* Set up the HT phy flags */ if (rate_n_flags &RATE_MCS_HT_MSK ) rx_status.flag |=RX_FLAG_HT ;
Signature · 1 line
1.7.10.4
Christian Lamparter
maintainerPATCH 1/1 carl9170: report A-MPDU status
In reply to Johannes BergBecause the hardware reports whenever an frame
was either at the start, in the middle or at
the end of a A-MPDU, we can easily report the
information for radiotap.
--- drivers/net/wireless/ath/carl9170/carl9170.h | 1 + drivers/net/wireless/ath/carl9170/rx.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/carl9170/carl9170.h +1 -0
@@ -425,6 +425,7 @@ struct ar9170 {bool rx_has_plcp;struct sk_buff *rx_failover;int rx_failover_missing; +u32 ampdu_ref;/* FIFO for collecting outstanding BlockAckRequest */ struct list_head bar_list[__AR9170_NUM_TXQ];
drivers/net/wireless/ath/carl9170/rx.c +11 -4
@@ -623,7 +623,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len)#undef TID_CHECK } -static bool carl9170_ampdu_check (struct ar9170 *ar,u8 *buf,u8 ms) +static bool carl9170_ampdu_check (struct ar9170 *ar,u8 *buf,u8 ms, +struct ieee80211_rx_status *rx_status) {__le16 fc;
@@ -636,6 +637,9 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms)return true; } + rx_status->flag |=RX_FLAG_AMPDU_DETAILS |RX_FLAG_AMPDU_LAST_KNOWN ; + rx_status->ampdu_reference = ar->ampdu_ref; +/* * "802.11n - 7.4a.3 A-MPDU contents" describes in which contexts * certain frame types can be part of an aMPDU.
@@ -684,12 +688,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)if (unlikely (len <sizeof (*mac))) goto drop; +memset (&status,0 ,sizeof (status)); + mpdu_len = len -sizeof (*mac); mac = (void *)(buf + mpdu_len); mac_status = mac->status;switch (mac_status &AR9170_RX_STATUS_MPDU ) {case AR9170_RX_STATUS_MPDU_FIRST : + ar->ampdu_ref++;/* Aggregated MPDUs start with an PLCP header */ if (likely (mpdu_len >=sizeof (struct ar9170_rx_head ))) { head = (void *) buf;
@@ -720,12 +727,13 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)break ;case AR9170_RX_STATUS_MPDU_LAST : + status.flag |=RX_FLAG_AMPDU_IS_LAST ; +/* * The last frame of an A-MPDU has an extra tail * which does contain the phy status of the whole * aggregate. */ -if (likely (mpdu_len >=sizeof (struct ar9170_rx_phystatus ))) { mpdu_len -=sizeof (struct ar9170_rx_phystatus ); phy = (void *)(buf + mpdu_len);
@@ -773,11 +781,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)if (unlikely (mpdu_len < (2 +2 +ETH_ALEN +FCS_LEN ))) goto drop; -memset (&status,0 ,sizeof (status));if (unlikely (carl9170_rx_mac_status (ar, head, mac, &status))) goto drop; -if (!carl9170_ampdu_check (ar, buf, mac_status)) +if (!carl9170_ampdu_check (ar, buf, mac_status, &status)) goto drop;if (phy)
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerRe: [PATCH] carl9170: report A-MPDU status
Quoted 4 lines · Christian Lamparter
Because the hardware reports whenever an frame
was either at the start, in the middle or at
the end of a A-MPDU, we can easily report the
information for radiotap.
John, you can pick this up after you pull from me, I've included the prerequisite patches now.
johannes
Johannes Berg
maintainerQuoted 4 lines · Johannes Berg
We just added A-MPDU status reporting in radiotap, this implements it in mac80211 and iwlwifi. The changes will be adopted formally next week so I'll merge the patches then (into the different trees.)
Applied the wrieless/mac80211 changes.
johannes