ath5k: fix tx status reporting
[openwrt.git] / package / mac80211 / patches / 521-ath9k_fix_ap_ps_buffering.patch
index 87cc2654b522e628386f8f29f792a0623407b09f..cc956ed27939e45d54954798f509fb18ee9de4d3 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -202,6 +202,7 @@ struct ath_atx_ac {
+@@ -200,6 +200,7 @@ struct ath_atx_ac {
        int sched;
        struct list_head list;
        struct list_head tid_q;
@@ -8,7 +8,7 @@
  };
  
  struct ath_frame_info {
-@@ -259,6 +260,8 @@ struct ath_node {
+@@ -257,6 +258,8 @@ struct ath_node {
        struct ath_atx_ac ac[WME_NUM_AC];
        u16 maxampdu;
        u8 mpdudensity;
@@ -17,7 +17,7 @@
  };
  
  #define AGGR_CLEANUP         BIT(1)
-@@ -340,6 +343,9 @@ int ath_tx_aggr_start(struct ath_softc *
+@@ -338,6 +341,9 @@ int ath_tx_aggr_start(struct ath_softc *
  void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  
@@ -29,7 +29,7 @@
  /********/
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1791,6 +1791,27 @@ static int ath9k_sta_remove(struct ieee8
+@@ -1800,6 +1800,27 @@ static int ath9k_sta_remove(struct ieee8
        return 0;
  }
  
@@ -57,7 +57,7 @@
  static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue,
                         const struct ieee80211_tx_queue_params *params)
  {
-@@ -2177,6 +2198,7 @@ struct ieee80211_ops ath9k_ops = {
+@@ -2206,6 +2227,7 @@ struct ieee80211_ops ath9k_ops = {
        .configure_filter   = ath9k_configure_filter,
        .sta_add            = ath9k_sta_add,
        .sta_remove         = ath9k_sta_remove,
  
        skb = bf->bf_mpdu;
        hdr = (struct ieee80211_hdr *)skb->data;
-@@ -442,7 +443,11 @@ static void ath_tx_complete_aggr(struct 
+@@ -441,22 +442,24 @@ static void ath_tx_complete_aggr(struct 
+                       /* transmit completion */
                        acked_cnt++;
                } else {
-                       if (!(tid->state & AGGR_CLEANUP) && retry) {
+-                      if (!(tid->state & AGGR_CLEANUP) && retry) {
 -                              if (fi->retries < ATH_MAX_SW_RETRIES) {
-+                              if (ts->ts_status & ATH9K_TXERR_FILT) {
-+                                      if (!an->sleeping)
-+                                              clear_filter = true;
-+                                      txpending = 1;
-+                              } else if (fi->retries < ATH_MAX_SW_RETRIES) {
-                                       ath_tx_set_retry(sc, txq, bf->bf_mpdu);
-                                       txpending = 1;
-                               } else {
-@@ -496,6 +501,7 @@ static void ath_tx_complete_aggr(struct 
+-                                      ath_tx_set_retry(sc, txq, bf->bf_mpdu);
+-                                      txpending = 1;
+-                              } else {
+-                                      bf->bf_state.bf_type |= BUF_XRETRY;
+-                                      txfail = 1;
+-                                      sendbar = 1;
+-                                      txfail_cnt++;
+-                              }
+-                      } else {
++                      if ((tid->state & AGGR_CLEANUP) || !retry) {
+                               /*
+                                * cleanup in progress, just fail
+                                * the un-acked sub-frames
+                                */
+                               txfail = 1;
++                      } else if (fi->retries < ATH_MAX_SW_RETRIES) {
++                              if (!(ts->ts_status & ATH9K_TXERR_FILT) ||
++                                  !an->sleeping)
++                                      ath_tx_set_retry(sc, txq, bf->bf_mpdu);
++
++                              clear_filter = true;
++                              txpending = 1;
++                      } else {
++                              bf->bf_state.bf_type |= BUF_XRETRY;
++                              txfail = 1;
++                              sendbar = 1;
++                              txfail_cnt++;
+                       }
+               }
+@@ -496,6 +499,7 @@ static void ath_tx_complete_aggr(struct 
                                !txfail, sendbar);
                } else {
                        /* retry the un-acked ones */
                        if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
                                if (bf->bf_next == NULL && bf_last->bf_stale) {
                                        struct ath_buf *tbf;
-@@ -546,7 +552,12 @@ static void ath_tx_complete_aggr(struct 
+@@ -546,7 +550,12 @@ static void ath_tx_complete_aggr(struct 
  
        /* prepend un-acked frames to the beginning of the pending frame queue */
        if (!list_empty(&bf_pending)) {
                list_splice(&bf_pending, &tid->buf_q);
                ath_tx_queue_tid(txq, tid);
                spin_unlock_bh(&txq->axq_lock);
-@@ -816,6 +827,11 @@ static void ath_tx_sched_aggr(struct ath
+@@ -816,6 +825,11 @@ static void ath_tx_sched_aggr(struct ath
                bf = list_first_entry(&bf_q, struct ath_buf, list);
                bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list);
  
                /* if only one frame, send as non-aggregate */
                if (bf == bf->bf_lastbf) {
                        fi = get_frame_info(bf->bf_mpdu);
-@@ -896,6 +912,67 @@ void ath_tx_aggr_stop(struct ath_softc *
+@@ -896,6 +910,67 @@ void ath_tx_aggr_stop(struct ath_softc *
        ath_tx_flush_tid(sc, txtid);
  }
  
  void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
  {
        struct ath_atx_tid *txtid;
-@@ -1491,7 +1568,6 @@ static int setup_tx_flags(struct sk_buff
+@@ -1491,7 +1566,6 @@ static int setup_tx_flags(struct sk_buff
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        int flags = 0;
  
        flags |= ATH9K_TXDESC_INTREQ;
  
        if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
-@@ -1754,6 +1830,9 @@ static void ath_tx_start_dma(struct ath_
+@@ -1754,6 +1828,9 @@ static void ath_tx_start_dma(struct ath_
                if (txctl->paprd)
                        bf->bf_state.bfs_paprd_timestamp = jiffies;
  
  
 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h
 +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -128,6 +128,11 @@ static inline void ath9k_hw_set11n_virtu
-       ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf);
+@@ -122,6 +122,11 @@ static inline void ath9k_hw_set11n_burst
+       ath9k_hw_ops(ah)->set11n_burstduration(ah, ds, burstDuration);
  }
  
 +static inline void ath9k_hw_set_clrdmask(struct ath_hw *ah, void *ds, bool val)
  /* PHY ops */
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -642,6 +642,7 @@ struct ath_hw_ops {
+@@ -626,6 +626,7 @@ struct ath_hw_ops {
+       void (*clr11n_aggr)(struct ath_hw *ah, void *ds);
+       void (*set11n_burstduration)(struct ath_hw *ah, void *ds,
                                     u32 burstDuration);
-       void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds,
-                                      u32 vmf);
 +      void (*set_clrdmask)(struct ath_hw *ah, void *ds, bool val);
  };
  
  static void ar9002_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
                                          void *lastds,
                                          u32 durUpdateEn, u32 rtsctsRate,
-@@ -460,4 +469,5 @@ void ar9002_hw_attach_mac_ops(struct ath
+@@ -448,4 +457,5 @@ void ar9002_hw_attach_mac_ops(struct ath
+       ops->set11n_aggr_last = ar9002_hw_set11n_aggr_last;
        ops->clr11n_aggr = ar9002_hw_clr11n_aggr;
        ops->set11n_burstduration = ar9002_hw_set11n_burstduration;
-       ops->set11n_virtualmorefrag = ar9002_hw_set11n_virtualmorefrag;
 +      ops->set_clrdmask = ar9002_hw_set_clrdmask;
  }
 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
  static void ar9003_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
                                          void *lastds,
                                          u32 durUpdateEn, u32 rtsctsRate,
-@@ -522,6 +531,7 @@ void ar9003_hw_attach_mac_ops(struct ath
+@@ -510,6 +519,7 @@ void ar9003_hw_attach_mac_ops(struct ath
+       ops->set11n_aggr_last = ar9003_hw_set11n_aggr_last;
        ops->clr11n_aggr = ar9003_hw_clr11n_aggr;
        ops->set11n_burstduration = ar9003_hw_set11n_burstduration;
-       ops->set11n_virtualmorefrag = ar9003_hw_set11n_virtualmorefrag;
 +      ops->set_clrdmask = ar9003_hw_set_clrdmask;
  }