aboutsummaryrefslogtreecommitdiffstats
path: root/package/madwifi/patches/306-bstuck_calibrate.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-07-13 09:17:34 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-07-13 09:17:34 +0000
commit5a85e7c4519bf1e59ae601d79a853f6f2a4a5574 (patch)
tree61aca46999509f11b4a3d7612c07c4554801d8d7 /package/madwifi/patches/306-bstuck_calibrate.patch
parent5675353c3ab1c203710b72ddf969dcbdef774f2c (diff)
downloadupstream-5a85e7c4519bf1e59ae601d79a853f6f2a4a5574.tar.gz
upstream-5a85e7c4519bf1e59ae601d79a853f6f2a4a5574.tar.bz2
upstream-5a85e7c4519bf1e59ae601d79a853f6f2a4a5574.zip
madwifi: patch for 'fixing' stuck beacons through card recalibration
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7960 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/madwifi/patches/306-bstuck_calibrate.patch')
-rw-r--r--package/madwifi/patches/306-bstuck_calibrate.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/package/madwifi/patches/306-bstuck_calibrate.patch b/package/madwifi/patches/306-bstuck_calibrate.patch
new file mode 100644
index 0000000000..b498aa0e8e
--- /dev/null
+++ b/package/madwifi/patches/306-bstuck_calibrate.patch
@@ -0,0 +1,102 @@
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
+===================================================================
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-13 11:14:06.322980052 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-13 11:15:00.834086460 +0200
+@@ -153,6 +153,7 @@
+ static void ath_turbo_switch_mode(unsigned long);
+ static int ath_check_beacon_done(struct ath_softc *);
+ #endif
++static void ath_do_calibrate(struct net_device *);
+ static void ath_beacon_send(struct ath_softc *, int *);
+ static void ath_beacon_start_adhoc(struct ath_softc *, struct ieee80211vap *);
+ static void ath_beacon_return(struct ath_softc *, struct ath_buf *);
+@@ -4173,7 +4174,7 @@
+ DPRINTF(sc, ATH_DEBUG_BEACON_PROC,
+ "%s: missed %u consecutive beacons\n",
+ __func__, sc->sc_bmisscount);
+- if (sc->sc_bmisscount > BSTUCK_THRESH)
++ if (sc->sc_bmisscount > BSTUCK_CALIBR_THR)
+ ATH_SCHEDULE_TQUEUE(&sc->sc_bstucktq, needmark);
+ return;
+ }
+@@ -4312,8 +4313,17 @@
+ * check will be true, in which case return
+ * without resetting the driver.
+ */
+- if (sc->sc_bmisscount <= BSTUCK_THRESH)
++ if (sc->sc_bmisscount <= BSTUCK_CALIBR_THR)
+ return;
++
++ if (sc->sc_bmisscount <= BSTUCK_RESET_THR) {
++ ATH_LOCK(sc);
++ ath_do_calibrate(dev);
++ mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
++ ATH_UNLOCK(sc);
++ return;
++ }
++
+ printk("%s: stuck beacon; resetting (bmiss count %u)\n",
+ DEV_NAME(dev), sc->sc_bmisscount);
+ ath_reset(dev);
+@@ -8027,17 +8037,13 @@
+ * Periodically recalibrate the PHY to account
+ * for temperature/environment changes.
+ */
+-static void
+-ath_calibrate(unsigned long arg)
++static void ath_do_calibrate(struct net_device *dev)
+ {
+- struct net_device *dev = (struct net_device *) arg;
+ struct ath_softc *sc = dev->priv;
+ struct ath_hal *ah = sc->sc_ah;
+- /* u_int32_t nchans; */
+ HAL_BOOL isIQdone = AH_FALSE;
+
+ sc->sc_stats.ast_per_cal++;
+-
+ DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: channel %u/%x\n",
+ __func__, sc->sc_curchan.channel, sc->sc_curchan.channelFlags);
+
+@@ -8055,15 +8061,26 @@
+ __func__, sc->sc_curchan.channel);
+ sc->sc_stats.ast_per_calfail++;
+ }
+-
+- ath_hal_process_noisefloor(ah);
+ if (isIQdone == AH_TRUE)
+ ath_calinterval = ATH_LONG_CALINTERVAL;
+ else
+ ath_calinterval = ATH_SHORT_CALINTERVAL;
++}
++
++static void
++ath_calibrate(unsigned long arg)
++{
++ struct net_device *dev = (struct net_device *) arg;
++ struct ath_softc *sc = dev->priv;
++ struct ath_hal *ah = sc->sc_ah;
++
++ ATH_LOCK(sc);
++ ath_do_calibrate(dev);
++ ath_hal_process_noisefloor(ah);
+
+ sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
+ add_timer(&sc->sc_cal_ch);
++ ATH_UNLOCK(sc);
+ }
+
+ static void
+Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
+===================================================================
+--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h 2007-07-13 11:14:06.274977315 +0200
++++ madwifi-ng-r2568-20070710/ath/if_athvar.h 2007-07-13 11:14:06.522991448 +0200
+@@ -538,7 +538,8 @@
+ */
+ #define ATH_TXQ_MOVE_Q(_tqs,_tqd) ATH_TXQ_MOVE_MCASTQ(_tqs,_tqd)
+
+-#define BSTUCK_THRESH 10 /* # of stuck beacons before resetting NB: this is a guess*/
++#define BSTUCK_CALIBR_THR 3 /* # of stuck beacons before restarting calibration */
++#define BSTUCK_RESET_THR 10 /* # of stuck beacons before resetting NB: this is a guess*/
+
+ struct ath_softc {
+ struct ieee80211com sc_ic; /* NB: must be first */