Commit 33dd7699 authored by Christian Lamparter's avatar Christian Lamparter Committed by John W. Linville

carl9170: report A-MPDU status

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.
Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 69578029
...@@ -425,6 +425,7 @@ struct ar9170 { ...@@ -425,6 +425,7 @@ struct ar9170 {
bool rx_has_plcp; bool rx_has_plcp;
struct sk_buff *rx_failover; struct sk_buff *rx_failover;
int rx_failover_missing; int rx_failover_missing;
u32 ampdu_ref;
/* FIFO for collecting outstanding BlockAckRequest */ /* FIFO for collecting outstanding BlockAckRequest */
struct list_head bar_list[__AR9170_NUM_TXQ]; struct list_head bar_list[__AR9170_NUM_TXQ];
......
...@@ -624,7 +624,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len) ...@@ -624,7 +624,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len)
#undef TID_CHECK #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; __le16 fc;
...@@ -637,6 +638,9 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms) ...@@ -637,6 +638,9 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms)
return true; 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 * "802.11n - 7.4a.3 A-MPDU contents" describes in which contexts
* certain frame types can be part of an aMPDU. * certain frame types can be part of an aMPDU.
...@@ -685,12 +689,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) ...@@ -685,12 +689,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
if (unlikely(len < sizeof(*mac))) if (unlikely(len < sizeof(*mac)))
goto drop; goto drop;
memset(&status, 0, sizeof(status));
mpdu_len = len - sizeof(*mac); mpdu_len = len - sizeof(*mac);
mac = (void *)(buf + mpdu_len); mac = (void *)(buf + mpdu_len);
mac_status = mac->status; mac_status = mac->status;
switch (mac_status & AR9170_RX_STATUS_MPDU) { switch (mac_status & AR9170_RX_STATUS_MPDU) {
case AR9170_RX_STATUS_MPDU_FIRST: case AR9170_RX_STATUS_MPDU_FIRST:
ar->ampdu_ref++;
/* Aggregated MPDUs start with an PLCP header */ /* Aggregated MPDUs start with an PLCP header */
if (likely(mpdu_len >= sizeof(struct ar9170_rx_head))) { if (likely(mpdu_len >= sizeof(struct ar9170_rx_head))) {
head = (void *) buf; head = (void *) buf;
...@@ -721,12 +728,13 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) ...@@ -721,12 +728,13 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
break; break;
case AR9170_RX_STATUS_MPDU_LAST: case AR9170_RX_STATUS_MPDU_LAST:
status.flag |= RX_FLAG_AMPDU_IS_LAST;
/* /*
* The last frame of an A-MPDU has an extra tail * The last frame of an A-MPDU has an extra tail
* which does contain the phy status of the whole * which does contain the phy status of the whole
* aggregate. * aggregate.
*/ */
if (likely(mpdu_len >= sizeof(struct ar9170_rx_phystatus))) { if (likely(mpdu_len >= sizeof(struct ar9170_rx_phystatus))) {
mpdu_len -= sizeof(struct ar9170_rx_phystatus); mpdu_len -= sizeof(struct ar9170_rx_phystatus);
phy = (void *)(buf + mpdu_len); phy = (void *)(buf + mpdu_len);
...@@ -774,11 +782,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) ...@@ -774,11 +782,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN))) if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN)))
goto drop; goto drop;
memset(&status, 0, sizeof(status));
if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status)))
goto drop; goto drop;
if (!carl9170_ampdu_check(ar, buf, mac_status)) if (!carl9170_ampdu_check(ar, buf, mac_status, &status))
goto drop; goto drop;
if (phy) if (phy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment