ath9k: Remove RX Poll
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Tue, 24 Dec 2013 05:14:25 +0000 (10:44 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 3 Jan 2014 20:36:58 +0000 (15:36 -0500)
This patch removes the convoluted and hacky method of
monitoring for connectivity. We rely on mac80211's connection
loss logic and doing it in the driver is not necessary.

The HW check for MAC/BB hangs is also simplified, there
is no need to have a separate work instance for it.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/link.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/wow.c

index f2202e78fa7b3de875f1c06fca9438dc01a59f5e..f622a986c8cc8f0df8a98b12ea4f05580faa27ec 100644 (file)
@@ -455,10 +455,8 @@ bool ath9k_csa_is_finished(struct ath_softc *sc);
 
 void ath_tx_complete_poll_work(struct work_struct *work);
 void ath_reset_work(struct work_struct *work);
-void ath_hw_check(struct work_struct *work);
+bool ath_hw_check(struct ath_softc *sc);
 void ath_hw_pll_work(struct work_struct *work);
-void ath_rx_poll(unsigned long data);
-void ath_start_rx_poll(struct ath_softc *sc, u8 nbeacon);
 void ath_paprd_calibrate(struct work_struct *work);
 void ath_ani_calibrate(unsigned long data);
 void ath_start_ani(struct ath_softc *sc);
@@ -722,12 +720,10 @@ struct ath_softc {
        spinlock_t sc_pcu_lock;
        struct mutex mutex;
        struct work_struct paprd_work;
-       struct work_struct hw_check_work;
        struct work_struct hw_reset_work;
        struct completion paprd_complete;
        wait_queue_head_t tx_wait;
 
-       unsigned int hw_busy_count;
        unsigned long sc_flags;
        unsigned long driver_data;
 
@@ -761,7 +757,6 @@ struct ath_softc {
        struct ath_beacon_config cur_beacon_conf;
        struct delayed_work tx_complete_work;
        struct delayed_work hw_pll_work;
-       struct timer_list rx_poll_timer;
        struct timer_list sleep_timer;
 
 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
index 112aff720e1377791ab939616b6c0b2ed9598e3e..2e8bba0eb361b5846af5666a87854e002f24b20f 100644 (file)
@@ -337,8 +337,14 @@ void ath9k_beacon_tasklet(unsigned long data)
 
                ath9k_hw_check_nav(ah);
 
-               if (!ath9k_hw_check_alive(ah))
-                       ieee80211_queue_work(sc->hw, &sc->hw_check_work);
+               /*
+                * If the previous beacon has not been transmitted
+                * and a MAC/BB hang has been identified, return
+                * here because a chip reset would have been
+                * initiated.
+                */
+               if (!ath_hw_check(sc))
+                       return;
 
                if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) {
                        ath_dbg(common, BSTUCK,
index e63465b7eab9ccc7b0214382881b37d159f31546..f2a17fcf1ae412834bd7c0c0b16471429b007e59 100644 (file)
@@ -763,10 +763,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 
        setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc);
        INIT_WORK(&sc->hw_reset_work, ath_reset_work);
-       INIT_WORK(&sc->hw_check_work, ath_hw_check);
        INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
        INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
-       setup_timer(&sc->rx_poll_timer, ath_rx_poll, (unsigned long)sc);
 
        /*
         * Cache line size is used to size and align various
index aed7e29dc50f152b954278020b8b2999f3e795e7..c92ca81350decb7df8af5ab9163bcfe5a3fcc717 100644 (file)
@@ -65,50 +65,26 @@ void ath_tx_complete_poll_work(struct work_struct *work)
 /*
  * Checks if the BB/MAC is hung.
  */
-void ath_hw_check(struct work_struct *work)
+bool ath_hw_check(struct ath_softc *sc)
 {
-       struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work);
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-       unsigned long flags;
-       int busy;
-       u8 is_alive, nbeacon = 1;
        enum ath_reset_type type;
+       bool is_alive;
 
        ath9k_ps_wakeup(sc);
+
        is_alive = ath9k_hw_check_alive(sc->sc_ah);
 
-       if ((is_alive && !AR_SREV_9300(sc->sc_ah)) || sc->tx99_state)
-               goto out;
-       else if (!is_alive && AR_SREV_9300(sc->sc_ah)) {
+       if (!is_alive) {
                ath_dbg(common, RESET,
-                       "DCU stuck is detected. Schedule chip reset\n");
+                       "HW hang detected, schedule chip reset\n");
                type = RESET_TYPE_MAC_HANG;
-               goto sched_reset;
-       }
-
-       spin_lock_irqsave(&common->cc_lock, flags);
-       busy = ath_update_survey_stats(sc);
-       spin_unlock_irqrestore(&common->cc_lock, flags);
-
-       ath_dbg(common, RESET, "Possible baseband hang, busy=%d (try %d)\n",
-               busy, sc->hw_busy_count + 1);
-       if (busy >= 99) {
-               if (++sc->hw_busy_count >= 3) {
-                       type = RESET_TYPE_BB_HANG;
-                       goto sched_reset;
-               }
-       } else if (busy >= 0) {
-               sc->hw_busy_count = 0;
-               nbeacon = 3;
+               ath9k_queue_reset(sc, type);
        }
 
-       ath_start_rx_poll(sc, nbeacon);
-       goto out;
-
-sched_reset:
-       ath9k_queue_reset(sc, type);
-out:
        ath9k_ps_restore(sc);
+
+       return is_alive;
 }
 
 /*
@@ -161,29 +137,6 @@ void ath_hw_pll_work(struct work_struct *work)
                                     msecs_to_jiffies(ATH_PLL_WORK_INTERVAL));
 }
 
-/*
- * RX Polling - monitors baseband hangs.
- */
-void ath_start_rx_poll(struct ath_softc *sc, u8 nbeacon)
-{
-       if (!AR_SREV_9300(sc->sc_ah))
-               return;
-
-       if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags))
-               return;
-
-       mod_timer(&sc->rx_poll_timer, jiffies + msecs_to_jiffies
-                 (nbeacon * sc->cur_beacon_conf.beacon_interval));
-}
-
-void ath_rx_poll(unsigned long data)
-{
-       struct ath_softc *sc = (struct ath_softc *)data;
-
-       if (!test_bit(SC_OP_INVALID, &sc->sc_flags))
-               ieee80211_queue_work(sc->hw, &sc->hw_check_work);
-}
-
 /*
  * PA Pre-distortion.
  */
index c19182b8dd038eaadb7a529aee242b7e5d4fcad2..39d3af4108345ce5b4fb7d45209c94d15173afce 100644 (file)
@@ -170,7 +170,6 @@ void ath9k_ps_restore(struct ath_softc *sc)
 static void __ath_cancel_work(struct ath_softc *sc)
 {
        cancel_work_sync(&sc->paprd_work);
-       cancel_work_sync(&sc->hw_check_work);
        cancel_delayed_work_sync(&sc->tx_complete_work);
        cancel_delayed_work_sync(&sc->hw_pll_work);
 
@@ -194,7 +193,6 @@ void ath_restart_work(struct ath_softc *sc)
                ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work,
                                     msecs_to_jiffies(ATH_PLL_WORK_INTERVAL));
 
-       ath_start_rx_poll(sc, 3);
        ath_start_ani(sc);
 }
 
@@ -204,11 +202,7 @@ static bool ath_prepare_reset(struct ath_softc *sc)
        bool ret = true;
 
        ieee80211_stop_queues(sc->hw);
-
-       sc->hw_busy_count = 0;
        ath_stop_ani(sc);
-       del_timer_sync(&sc->rx_poll_timer);
-
        ath9k_hw_disable_interrupts(ah);
 
        if (!ath_drain_all_txq(sc))
@@ -867,7 +861,6 @@ static void ath9k_stop(struct ieee80211_hw *hw)
        mutex_lock(&sc->mutex);
 
        ath_cancel_work(sc);
-       del_timer_sync(&sc->rx_poll_timer);
 
        if (test_bit(SC_OP_INVALID, &sc->sc_flags)) {
                ath_dbg(common, ANY, "Device not present\n");
index 3692b2a501a2e50d522d130e8a85883fe7d36d02..470e1c0e7c57aac31e971f184dbab55bf4c2fcd8 100644 (file)
@@ -1077,10 +1077,6 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
        }
 
        rx_stats->is_mybeacon = ath9k_is_mybeacon(sc, hdr);
-       if (rx_stats->is_mybeacon) {
-               sc->hw_busy_count = 0;
-               ath_start_rx_poll(sc, 3);
-       }
 
        if (ath9k_process_rate(common, hw, rx_stats, rx_status)) {
                ret =-EINVAL;
index f1cde81bb7a2573f1905c2725c29c176da7013f0..1b3230fa36510916c740bbc62a2a1b6ec202f5a0 100644 (file)
@@ -197,7 +197,6 @@ int ath9k_suspend(struct ieee80211_hw *hw,
 
        ath_cancel_work(sc);
        ath_stop_ani(sc);
-       del_timer_sync(&sc->rx_poll_timer);
 
        if (test_bit(SC_OP_INVALID, &sc->sc_flags)) {
                ath_dbg(common, ANY, "Device not present\n");