ath9k: backport stability fixes from r35063
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
index 1fc9cd919b87294e00b21bca1bc025bacf4052bb..31a60375133792f1462bad0295e9a8f27b212afc 100644 (file)
  static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
 --- a/drivers/net/wireless/ath/ath9k/recv.c
 +++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -424,8 +424,8 @@ u32 ath_calcrxfilter(struct ath_softc *s
+@@ -286,7 +286,6 @@ int ath_rx_init(struct ath_softc *sc, in
+       spin_lock_init(&sc->sc_pcu_lock);
+       spin_lock_init(&sc->rx.rxbuflock);
+-      clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
+       common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 +
+                            sc->sc_ah->caps.rx_status_len;
+@@ -424,8 +423,8 @@ u32 ath_calcrxfilter(struct ath_softc *s
                rfilt |= ATH9K_RX_FILTER_COMP_BAR;
  
        if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) {
                        rfilt |= ATH9K_RX_FILTER_PROM;
                rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
        }
+@@ -473,6 +472,13 @@ start_recv:
+       return 0;
+ }
++static void ath_flushrecv(struct ath_softc *sc)
++{
++      if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
++              ath_rx_tasklet(sc, 1, true);
++      ath_rx_tasklet(sc, 1, false);
++}
++
+ bool ath_stoprecv(struct ath_softc *sc)
+ {
+       struct ath_hw *ah = sc->sc_ah;
+@@ -483,6 +489,8 @@ bool ath_stoprecv(struct ath_softc *sc)
+       ath9k_hw_setrxfilter(ah, 0);
+       stopped = ath9k_hw_stopdmarecv(ah, &reset);
++      ath_flushrecv(sc);
++
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+               ath_edma_stop_recv(sc);
+       else
+@@ -499,15 +507,6 @@ bool ath_stoprecv(struct ath_softc *sc)
+       return stopped && !reset;
+ }
+-void ath_flushrecv(struct ath_softc *sc)
+-{
+-      set_bit(SC_OP_RXFLUSH, &sc->sc_flags);
+-      if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+-              ath_rx_tasklet(sc, 1, true);
+-      ath_rx_tasklet(sc, 1, false);
+-      clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
+-}
+-
+ static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb)
+ {
+       /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */
+@@ -744,6 +743,7 @@ static struct ath_buf *ath_get_next_rx_b
+                       return NULL;
+       }
++      list_del(&bf->list);
+       if (!bf->bf_mpdu)
+               return bf;
+@@ -1066,9 +1066,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
+       do {
+               bool decrypt_error = false;
+-              /* If handling rx interrupt and flush is in progress => exit */
+-              if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0))
+-                      break;
+               memset(&rs, 0, sizeof(rs));
+               if (edma)
+@@ -1108,15 +1105,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
+               sc->rx.num_pkts++;
+               ath_debug_stat_rx(sc, &rs);
+-              /*
+-               * If we're asked to flush receive queue, directly
+-               * chain it back at the queue without processing it.
+-               */
+-              if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags)) {
+-                      RX_STAT_INC(rx_drop_rxflush);
+-                      goto requeue_drop_frag;
+-              }
+-
+               memset(rxs, 0, sizeof(struct ieee80211_rx_status));
+               rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
+@@ -1251,14 +1239,15 @@ requeue_drop_frag:
+                       sc->rx.frag = NULL;
+               }
+ requeue:
++              list_add_tail(&bf->list, &sc->rx.rxbuf);
++              if (!flush)
++                      continue;
++
+               if (edma) {
+-                      list_add_tail(&bf->list, &sc->rx.rxbuf);
+                       ath_rx_edma_buf_link(sc, qtype);
+               } else {
+-                      list_move_tail(&bf->list, &sc->rx.rxbuf);
+                       ath_rx_buf_link(sc, bf);
+-                      if (!flush)
+-                              ath9k_hw_rxena(ah);
++                      ath9k_hw_rxena(ah);
+               }
+       } while (1);
 --- a/net/mac80211/mlme.c
 +++ b/net/mac80211/mlme.c
 @@ -818,23 +818,71 @@ void ieee80211_sta_process_chanswitch(st
                        ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
        }
  
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -324,7 +324,6 @@ struct ath_rx {
+ int ath_startrecv(struct ath_softc *sc);
+ bool ath_stoprecv(struct ath_softc *sc);
+-void ath_flushrecv(struct ath_softc *sc);
+ u32 ath_calcrxfilter(struct ath_softc *sc);
+ int ath_rx_init(struct ath_softc *sc, int nbufs);
+ void ath_rx_cleanup(struct ath_softc *sc);
+@@ -627,7 +626,6 @@ void ath_ant_comb_update(struct ath_soft
+ enum sc_op_flags {
+       SC_OP_INVALID,
+       SC_OP_BEACONS,
+-      SC_OP_RXFLUSH,
+       SC_OP_ANI_RUN,
+       SC_OP_PRIM_STA_VIF,
+       SC_OP_HW_RESET,
+--- a/drivers/net/wireless/ath/ath9k/beacon.c
++++ b/drivers/net/wireless/ath/ath9k/beacon.c
+@@ -147,6 +147,7 @@ static struct ath_buf *ath9k_beacon_gene
+                                skb->len, DMA_TO_DEVICE);
+               dev_kfree_skb_any(skb);
+               bf->bf_buf_addr = 0;
++              bf->bf_mpdu = NULL;
+       }
+       skb = ieee80211_beacon_get(hw, vif);
+@@ -359,7 +360,6 @@ void ath9k_beacon_tasklet(unsigned long 
+               return;
+       bf = ath9k_beacon_generate(sc->hw, vif);
+-      WARN_ON(!bf);
+       if (sc->beacon.bmisscnt != 0) {
+               ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n",
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -919,7 +919,6 @@ static ssize_t read_file_recv(struct fil
+       RXS_ERR("RX-LENGTH-ERR", rx_len_err);
+       RXS_ERR("RX-OOM-ERR", rx_oom_err);
+       RXS_ERR("RX-RATE-ERR", rx_rate_err);
+-      RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush);
+       RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err);
+       PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN);
+--- a/drivers/net/wireless/ath/ath9k/debug.h
++++ b/drivers/net/wireless/ath/ath9k/debug.h
+@@ -198,7 +198,6 @@ struct ath_tx_stats {
+  * @rx_oom_err:  No. of frames dropped due to OOM issues.
+  * @rx_rate_err:  No. of frames dropped due to rate errors.
+  * @rx_too_many_frags_err:  Frames dropped due to too-many-frags received.
+- * @rx_drop_rxflush: No. of frames dropped due to RX-FLUSH.
+  * @rx_beacons:  No. of beacons received.
+  * @rx_frags:  No. of rx-fragements received.
+  */
+@@ -217,7 +216,6 @@ struct ath_rx_stats {
+       u32 rx_oom_err;
+       u32 rx_rate_err;
+       u32 rx_too_many_frags_err;
+-      u32 rx_drop_rxflush;
+       u32 rx_beacons;
+       u32 rx_frags;
+ };
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -181,7 +181,7 @@ static void ath_restart_work(struct ath_
+       ath_start_ani(sc);
+ }
+-static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
++static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx)
+ {
+       struct ath_hw *ah = sc->sc_ah;
+       bool ret = true;
+@@ -195,19 +195,15 @@ static bool ath_prepare_reset(struct ath
+       ath9k_debug_samp_bb_mac(sc);
+       ath9k_hw_disable_interrupts(ah);
++      tasklet_disable(&sc->intr_tq);
++
+       if (!ath_stoprecv(sc))
+               ret = false;
+       if (!ath_drain_all_txq(sc, retry_tx))
+               ret = false;
+-      if (!flush) {
+-              if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+-                      ath_rx_tasklet(sc, 1, true);
+-              ath_rx_tasklet(sc, 1, false);
+-      } else {
+-              ath_flushrecv(sc);
+-      }
++      tasklet_enable(&sc->intr_tq);
+       return ret;
+ }
+@@ -261,7 +257,6 @@ static int ath_reset_internal(struct ath
+       struct ath_common *common = ath9k_hw_common(ah);
+       struct ath9k_hw_cal_data *caldata = NULL;
+       bool fastcc = true;
+-      bool flush = false;
+       int r;
+       __ath_cancel_work(sc);
+@@ -275,11 +270,10 @@ static int ath_reset_internal(struct ath
+       if (!hchan) {
+               fastcc = false;
+-              flush = true;
+               hchan = ah->curchan;
+       }
+-      if (!ath_prepare_reset(sc, retry_tx, flush))
++      if (!ath_prepare_reset(sc, retry_tx))
+               fastcc = false;
+       ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n",
+@@ -821,7 +815,7 @@ static void ath9k_stop(struct ieee80211_
+               ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
+       }
+-      ath_prepare_reset(sc, false, true);
++      ath_prepare_reset(sc, false);
+       if (sc->rx.frag) {
+               dev_kfree_skb_any(sc->rx.frag);