add a workaround for a wds related crash
[openwrt.git] / package / madwifi / patches / 306-bstuck_calibrate.patch
1 Index: madwifi-ng-r2568-20070710/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-13 11:18:20.621471697 +0200
4 +++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-13 11:18:21.021494493 +0200
5 @@ -153,6 +153,7 @@
6 static void ath_turbo_switch_mode(unsigned long);
7 static int ath_check_beacon_done(struct ath_softc *);
8 #endif
9 +static void ath_do_calibrate(struct net_device *);
10 static void ath_beacon_send(struct ath_softc *, int *);
11 static void ath_beacon_start_adhoc(struct ath_softc *, struct ieee80211vap *);
12 static void ath_beacon_return(struct ath_softc *, struct ath_buf *);
13 @@ -4173,7 +4174,7 @@
14 DPRINTF(sc, ATH_DEBUG_BEACON_PROC,
15 "%s: missed %u consecutive beacons\n",
16 __func__, sc->sc_bmisscount);
17 - if (sc->sc_bmisscount > BSTUCK_THRESH)
18 + if (sc->sc_bmisscount > BSTUCK_CALIBR_THR)
19 ATH_SCHEDULE_TQUEUE(&sc->sc_bstucktq, needmark);
20 return;
21 }
22 @@ -4312,8 +4313,17 @@
23 * check will be true, in which case return
24 * without resetting the driver.
25 */
26 - if (sc->sc_bmisscount <= BSTUCK_THRESH)
27 + if (sc->sc_bmisscount <= BSTUCK_CALIBR_THR)
28 return;
29 +
30 + if (sc->sc_bmisscount <= BSTUCK_RESET_THR) {
31 + ATH_LOCK(sc);
32 + ath_do_calibrate(dev);
33 + mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
34 + ATH_UNLOCK(sc);
35 + return;
36 + }
37 +
38 printk("%s: stuck beacon; resetting (bmiss count %u)\n",
39 DEV_NAME(dev), sc->sc_bmisscount);
40 ath_reset(dev);
41 @@ -8027,17 +8037,13 @@
42 * Periodically recalibrate the PHY to account
43 * for temperature/environment changes.
44 */
45 -static void
46 -ath_calibrate(unsigned long arg)
47 +static void ath_do_calibrate(struct net_device *dev)
48 {
49 - struct net_device *dev = (struct net_device *) arg;
50 struct ath_softc *sc = dev->priv;
51 struct ath_hal *ah = sc->sc_ah;
52 - /* u_int32_t nchans; */
53 HAL_BOOL isIQdone = AH_FALSE;
54
55 sc->sc_stats.ast_per_cal++;
56 -
57 DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: channel %u/%x\n",
58 __func__, sc->sc_curchan.channel, sc->sc_curchan.channelFlags);
59
60 @@ -8055,15 +8061,26 @@
61 __func__, sc->sc_curchan.channel);
62 sc->sc_stats.ast_per_calfail++;
63 }
64 -
65 - ath_hal_process_noisefloor(ah);
66 if (isIQdone == AH_TRUE)
67 ath_calinterval = ATH_LONG_CALINTERVAL;
68 else
69 ath_calinterval = ATH_SHORT_CALINTERVAL;
70 +}
71 +
72 +static void
73 +ath_calibrate(unsigned long arg)
74 +{
75 + struct net_device *dev = (struct net_device *) arg;
76 + struct ath_softc *sc = dev->priv;
77 + struct ath_hal *ah = sc->sc_ah;
78 +
79 + ATH_LOCK(sc);
80 + ath_do_calibrate(dev);
81 + ath_hal_process_noisefloor(ah);
82
83 sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
84 add_timer(&sc->sc_cal_ch);
85 + ATH_UNLOCK(sc);
86 }
87
88 static void
89 Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
90 ===================================================================
91 --- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h 2007-07-13 11:18:20.353456423 +0200
92 +++ madwifi-ng-r2568-20070710/ath/if_athvar.h 2007-07-13 11:18:21.021494493 +0200
93 @@ -538,7 +538,8 @@
94 */
95 #define ATH_TXQ_MOVE_Q(_tqs,_tqd) ATH_TXQ_MOVE_MCASTQ(_tqs,_tqd)
96
97 -#define BSTUCK_THRESH 10 /* # of stuck beacons before resetting NB: this is a guess*/
98 +#define BSTUCK_CALIBR_THR 3 /* # of stuck beacons before restarting calibration */
99 +#define BSTUCK_RESET_THR 10 /* # of stuck beacons before resetting NB: this is a guess*/
100
101 struct ath_softc {
102 struct ieee80211com sc_ic; /* NB: must be first */
This page took 0.057863 seconds and 5 git commands to generate.