1 Index: madwifi-ng-r2568-20070710/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-23 01:48:45.690583928 +0200
4 +++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-23 01:48:46.026603077 +0200
6 static void ath_turbo_switch_mode(unsigned long);
7 static int ath_check_beacon_done(struct ath_softc *);
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 *);
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);
22 @@ -4314,8 +4315,17 @@
23 * check will be true, in which case return
24 * without resetting the driver.
26 - if (sc->sc_bmisscount <= BSTUCK_THRESH)
27 + if (sc->sc_bmisscount <= BSTUCK_CALIBR_THR)
30 + if (sc->sc_bmisscount <= BSTUCK_RESET_THR) {
32 + ath_do_calibrate(dev);
33 + mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
38 printk("%s: stuck beacon; resetting (bmiss count %u)\n",
39 DEV_NAME(dev), sc->sc_bmisscount);
41 @@ -8029,17 +8039,13 @@
42 * Periodically recalibrate the PHY to account
43 * for temperature/environment changes.
46 -ath_calibrate(unsigned long arg)
47 +static void ath_do_calibrate(struct net_device *dev)
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;
55 sc->sc_stats.ast_per_cal++;
57 DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: channel %u/%x\n",
58 __func__, sc->sc_curchan.channel, sc->sc_curchan.channelFlags);
60 @@ -8057,15 +8063,26 @@
61 __func__, sc->sc_curchan.channel);
62 sc->sc_stats.ast_per_calfail++;
65 - ath_hal_process_noisefloor(ah);
66 if (isIQdone == AH_TRUE)
67 ath_calinterval = ATH_LONG_CALINTERVAL;
69 ath_calinterval = ATH_SHORT_CALINTERVAL;
73 +ath_calibrate(unsigned long arg)
75 + struct net_device *dev = (struct net_device *) arg;
76 + struct ath_softc *sc = dev->priv;
77 + struct ath_hal *ah = sc->sc_ah;
80 + ath_do_calibrate(dev);
81 + ath_hal_process_noisefloor(ah);
83 sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
84 add_timer(&sc->sc_cal_ch);
89 Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
90 ===================================================================
91 --- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h 2007-07-23 01:48:45.406567742 +0200
92 +++ madwifi-ng-r2568-20070710/ath/if_athvar.h 2007-07-23 01:48:46.026603077 +0200
95 #define ATH_TXQ_MOVE_Q(_tqs,_tqd) ATH_TXQ_MOVE_MCASTQ(_tqs,_tqd)
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*/
102 struct ieee80211com sc_ic; /* NB: must be first */