1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 21:47:42 +02:00

madwifi: remove stuck beacon workaround (does not work properly). add a workaround for MIB interrupt flooding

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8310 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2007-08-01 18:37:20 +00:00
parent a5e3f9b197
commit 915a4b76b8
2 changed files with 83 additions and 102 deletions

View File

@ -1,102 +0,0 @@
Index: madwifi-ng-r2568-20070710/ath/if_ath.c
===================================================================
--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-23 01:48:45.690583928 +0200
+++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-23 01:48:46.026603077 +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 *);
@@ -4175,7 +4176,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;
}
@@ -4314,8 +4315,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);
@@ -8029,17 +8039,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);
@@ -8057,15 +8063,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-23 01:48:45.406567742 +0200
+++ madwifi-ng-r2568-20070710/ath/if_athvar.h 2007-07-23 01:48:46.026603077 +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 */

View File

@ -0,0 +1,83 @@
Index: madwifi-ng-r2568-20070710/ath/if_ath.c
===================================================================
--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-08-01 11:07:47.882943145 +0200
+++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-08-01 11:41:11.781138794 +0200
@@ -203,6 +203,7 @@
static void ath_flushrecv(struct ath_softc *);
static void ath_chan_change(struct ath_softc *, struct ieee80211_channel *);
static void ath_calibrate(unsigned long);
+static void ath_mib_enable(unsigned long);
static int ath_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static void ath_scan_start(struct ieee80211com *);
@@ -660,6 +661,10 @@
sc->sc_cal_ch.function = ath_calibrate;
sc->sc_cal_ch.data = (unsigned long) dev;
+ init_timer(&sc->sc_mib_enable);
+ sc->sc_mib_enable.function = ath_mib_enable;
+ sc->sc_mib_enable.data = (unsigned long) sc;
+
#ifdef ATH_SUPERG_DYNTURBO
init_timer(&sc->sc_dturbo_switch_mode);
sc->sc_dturbo_switch_mode.function = ath_turbo_switch_mode;
@@ -1751,16 +1756,19 @@
if (status & HAL_INT_MIB) {
sc->sc_stats.ast_mib++;
/*
- * Disable interrupts until we service the MIB
- * interrupt; otherwise it will continue to fire.
- */
- ath_hal_intrset(ah, 0);
- /*
- * Let the HAL handle the event. We assume it will
- * clear whatever condition caused the interrupt.
+ * When the card receives lots of PHY errors, the MIB
+ * interrupt will fire at a very rapid rate. We will use
+ * a timer to enforce at least 1 jiffy delay between
+ * MIB interrupts. This should be unproblematic, since
+ * the hardware will continue to update the counters in the
+ * mean time.
*/
- ath_hal_mibevent(ah, &sc->sc_halstats);
+ sc->sc_imask &= ~HAL_INT_MIB;
ath_hal_intrset(ah, sc->sc_imask);
+ mod_timer(&sc->sc_mib_enable, jiffies + 1);
+
+ /* Let the HAL handle the event. */
+ ath_hal_mibevent(ah, &sc->sc_halstats);
}
}
if (needmark)
@@ -8029,6 +8037,19 @@
}
/*
+ * Enable MIB interrupts again, after the ISR disabled them
+ * to slow down the rate of PHY error reporting.
+ */
+static void
+ath_mib_enable(unsigned long arg)
+{
+ struct ath_softc *sc = (struct ath_softc *) arg;
+
+ sc->sc_imask |= HAL_INT_MIB;
+ ath_hal_intrset(sc->sc_ah, sc->sc_imask);
+}
+
+/*
* Periodically recalibrate the PHY to account
* for temperature/environment changes.
*/
Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
===================================================================
--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h 2007-08-01 11:33:50.800008711 +0200
+++ madwifi-ng-r2568-20070710/ath/if_athvar.h 2007-08-01 11:34:33.202425088 +0200
@@ -687,6 +687,7 @@
struct ctl_table *sc_sysctls;
u_int16_t sc_reapcount; /* # of tx buffers reaped after net dev stopped */
+ struct timer_list sc_mib_enable;
#ifdef ATH_REVERSE_ENGINEERING
u_int8_t register_snapshot[MAX_REGISTER_ADDRESS];