iwlwifi: fix TX status for aggregated packets
authorJohannes Berg <johannes.berg@intel.com>
Tue, 25 Feb 2014 09:37:15 +0000 (10:37 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 1 Apr 2014 23:58:56 +0000 (00:58 +0100)
commit 143582c6847cb285b361804c613127c25de60ca4 upstream.

Only the first packet is currently handled correctly, but then
all others are assumed to have failed which is problematic. Fix
this, marking them all successful instead (since if they're not
then the firmware will have transmitted them as single frames.)

This fixes the lost packet reporting.

Also do a tiny variable scoping cleanup.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[Add the dvm part]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
[bwh: Backported to 3.2:
 - Drop the mvm part
 - Adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/iwlwifi/iwl-agn-tx.c

index df1540c..5fe4602 100644 (file)
@@ -854,8 +854,6 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
        struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
        struct iwl_ht_agg *agg;
        struct sk_buff_head reclaimed_skbs;
        struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
        struct iwl_ht_agg *agg;
        struct sk_buff_head reclaimed_skbs;
-       struct ieee80211_tx_info *info;
-       struct ieee80211_hdr *hdr;
        struct sk_buff *skb;
        unsigned long flags;
        int sta_id;
        struct sk_buff *skb;
        unsigned long flags;
        int sta_id;
@@ -941,24 +939,32 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
                          0, &reclaimed_skbs);
        freed = 0;
        while (!skb_queue_empty(&reclaimed_skbs)) {
                          0, &reclaimed_skbs);
        freed = 0;
        while (!skb_queue_empty(&reclaimed_skbs)) {
+               struct ieee80211_hdr *hdr;
+               struct ieee80211_tx_info *info;
 
                skb = __skb_dequeue(&reclaimed_skbs);
 
                skb = __skb_dequeue(&reclaimed_skbs);
-               hdr = (struct ieee80211_hdr *)skb->data;
+               hdr = (void *)skb->data;
+               info = IEEE80211_SKB_CB(skb);
 
                if (ieee80211_is_data_qos(hdr->frame_control))
                        freed++;
                else
                        WARN_ON_ONCE(1);
 
 
                if (ieee80211_is_data_qos(hdr->frame_control))
                        freed++;
                else
                        WARN_ON_ONCE(1);
 
-               info = IEEE80211_SKB_CB(skb);
                kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
 
                kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
 
+               memset(&info->status, 0, sizeof(info->status));
+               /* Packet was transmitted successfully, failures come as single
+                * frames because before failing a frame the firmware transmits
+                * it without aggregation at least once.
+                */
+               info->flags |= IEEE80211_TX_STAT_ACK;
+
                if (freed == 1) {
                        /* this is the first skb we deliver in this batch */
                        /* put the rate scaling data there */
                        info = IEEE80211_SKB_CB(skb);
                        memset(&info->status, 0, sizeof(info->status));
                if (freed == 1) {
                        /* this is the first skb we deliver in this batch */
                        /* put the rate scaling data there */
                        info = IEEE80211_SKB_CB(skb);
                        memset(&info->status, 0, sizeof(info->status));
-                       info->flags |= IEEE80211_TX_STAT_ACK;
                        info->flags |= IEEE80211_TX_STAT_AMPDU;
                        info->status.ampdu_ack_len = ba_resp->txed_2_done;
                        info->status.ampdu_len = ba_resp->txed;
                        info->flags |= IEEE80211_TX_STAT_AMPDU;
                        info->status.ampdu_ack_len = ba_resp->txed_2_done;
                        info->status.ampdu_len = ba_resp->txed;