ath9k: fix stuck beacon detection
authorFelix Fietkau <nbd@openwrt.org>
Tue, 22 Mar 2011 20:54:19 +0000 (21:54 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 30 Mar 2011 18:15:18 +0000 (14:15 -0400)
Stuck beacon detection is supposed to trigger when 9 consecutive beacons
could not be sent by the hardware. When the driver runs only one active
AP mode interface, it still configures the hardware beacon timer for
4 (ATH_BCBUF) beacon slots slots, which causes stuck beacon detection
to be reset if ath9k_hw_stoptxdma clears the stuck frames between
SWBA intervals.
Fix this by not resetting the missed beacon count for empty slots and
multiplying the threshold not by the maximum number of beacon slots
but by the configured number of beacon interfaces.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c

index 07dfb31..7c91ba4 100644 (file)
@@ -362,7 +362,7 @@ struct ath_vif {
  * number of BSSIDs) if a given beacon does not go out even after waiting this
  * number of beacon intervals, the game's up.
  */
-#define BSTUCK_THRESH                  (9 * ATH_BCBUF)
+#define BSTUCK_THRESH                  9
 #define        ATH_BCBUF                       4
 #define ATH_DEFAULT_BINTVAL            100 /* TU */
 #define ATH_DEFAULT_BMISS_LIMIT        10
index 6ebeafe..74f33bc 100644 (file)
@@ -363,7 +363,7 @@ void ath_beacon_tasklet(unsigned long data)
        if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0) {
                sc->beacon.bmisscnt++;
 
-               if (sc->beacon.bmisscnt < BSTUCK_THRESH) {
+               if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) {
                        ath_dbg(common, ATH_DBG_BSTUCK,
                                "missed %u consecutive beacons\n",
                                sc->beacon.bmisscnt);
@@ -380,13 +380,6 @@ void ath_beacon_tasklet(unsigned long data)
                return;
        }
 
-       if (sc->beacon.bmisscnt != 0) {
-               ath_dbg(common, ATH_DBG_BSTUCK,
-                       "resume beacon xmit after %u misses\n",
-                       sc->beacon.bmisscnt);
-               sc->beacon.bmisscnt = 0;
-       }
-
        /*
         * Generate beacon frames. we are sending frames
         * staggered so calculate the slot for this frame based
@@ -420,6 +413,13 @@ void ath_beacon_tasklet(unsigned long data)
                        bfaddr = bf->bf_daddr;
                        bc = 1;
                }
+
+               if (sc->beacon.bmisscnt != 0) {
+                       ath_dbg(common, ATH_DBG_BSTUCK,
+                               "resume beacon xmit after %u misses\n",
+                               sc->beacon.bmisscnt);
+                       sc->beacon.bmisscnt = 0;
+               }
        }
 
        /*