1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-02-06 20:27:16.005587752 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-06 22:06:51.778996341 +0100
6 static int maxvaps = -1;
7 static int outdoor = -1;
8 static int xchanmode = -1;
9 +static int beacon_cal = 1;
11 static const char *hal_status_desc[] = {
16 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
17 +MODULE_PARM(beacon_cal, "i");
18 MODULE_PARM(countrycode, "i");
19 MODULE_PARM(maxvaps, "i");
20 MODULE_PARM(outdoor, "i");
22 MODULE_PARM(ratectl, "s");
24 #include <linux/moduleparam.h>
25 +module_param(beacon_cal, int, 0600);
26 module_param(countrycode, int, 0600);
27 module_param(maxvaps, int, 0600);
28 module_param(outdoor, int, 0600);
31 if (!sc->sc_invalid) {
32 del_timer_sync(&sc->sc_dfs_cac_timer);
33 - del_timer_sync(&sc->sc_cal_ch);
34 + if (!sc->sc_beacon_cal)
35 + del_timer_sync(&sc->sc_cal_ch);
38 if (!sc->sc_invalid) {
39 @@ -2611,6 +2615,20 @@
43 +static void ath_set_beacon_cal(struct ath_softc *sc, int val)
45 + if (sc->sc_beacon_cal == !!val)
49 + del_timer_sync(&sc->sc_cal_ch);
51 + sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
52 + add_timer(&sc->sc_cal_ch);
54 + sc->sc_beacon_cal = !!val && beacon_cal;
58 * Stop the device, grabbing the top-level lock to protect
59 * against concurrent entry through ath_init (which can happen
61 "Invoking ath_hal_txstart with sc_bhalq: %d\n",
63 ath_hal_txstart(ah, sc->sc_bhalq);
64 + if (sc->sc_beacon_cal && (jiffies > sc->sc_lastcal + (ath_calinterval * HZ)))
65 + ath_calibrate((unsigned long) sc->sc_dev);
67 sc->sc_stats.ast_be_xmit++; /* XXX per-VAP? */
70 ath_hal_beacontimers(ah, &bs);
71 sc->sc_imask |= HAL_INT_BMISS;
72 ath_hal_intrset(ah, sc->sc_imask);
73 + ath_set_beacon_cal(sc, 0);
75 ath_hal_intrset(ah, 0);
77 @@ -5401,8 +5422,11 @@
79 intval |= HAL_BEACON_ENA;
80 sc->sc_imask |= HAL_INT_SWBA;
81 + ath_set_beacon_cal(sc, 1);
82 ath_beaconq_config(sc);
85 + ath_set_beacon_cal(sc, 0);
87 #ifdef ATH_SUPERG_DYNTURBO
88 ath_beacon_dturbo_config(vap, intval &
89 ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
91 /* Enter DFS wait period */
92 mod_timer(&sc->sc_dfs_cac_timer,
93 jiffies + (sc->sc_dfs_cac_period * HZ));
95 + /* This is a good time to start a calibration */
96 + ath_set_beacon_cal(sc, 1);
99 * re configure beacons when it is a turbo mode switch.
100 @@ -8973,8 +9000,11 @@
101 sc->sc_curchan.channel, sc->sc_curchan.channelFlags,
102 isIQdone ? "done" : "not done");
104 - sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
105 - add_timer(&sc->sc_cal_ch);
106 + sc->sc_lastcal = jiffies;
107 + if (!sc->sc_beacon_cal) {
108 + sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
109 + add_timer(&sc->sc_cal_ch);
114 @@ -9081,7 +9111,8 @@
115 ieee80211_state_name[vap->iv_state],
116 ieee80211_state_name[nstate]);
118 - del_timer(&sc->sc_cal_ch); /* periodic calibration timer */
119 + if (!sc->sc_beacon_cal)
120 + del_timer(&sc->sc_cal_ch); /* periodic calibration timer */
122 ath_hal_setledstate(ah, leds[nstate]); /* set LED */
123 netif_stop_queue(dev); /* before we do anything else */
124 @@ -9306,7 +9337,8 @@
125 "VAP -> DFSWAIT_PENDING \n");
126 /* start calibration timer with a really small value
128 - mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
129 + if (!sc->sc_beacon_cal)
130 + mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
131 /* wake the receiver */
132 netif_wake_queue(dev);
133 /* don't do the other usual stuff... */
134 @@ -9349,7 +9381,7 @@
135 error = avp->av_newstate(vap, nstate, arg);
137 /* Finally, start any timers. */
138 - if (nstate == IEEE80211_S_RUN) {
139 + if (nstate == IEEE80211_S_RUN && !sc->sc_beacon_cal) {
140 /* start periodic recalibration timer */
141 mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
143 Index: madwifi-trunk-r3314/ath/if_athvar.h
144 ===================================================================
145 --- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-02-06 20:27:08.969186784 +0100
146 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-02-06 20:27:24.670081522 +0100
148 struct ieee80211vap **sc_bslot; /* beacon xmit slots */
149 int sc_bnext; /* next slot for beacon xmit */
151 + int sc_beacon_cal; /* use beacon timer for calibration */
152 + u_int64_t sc_lastcal; /* last time the calibration was performed */
153 struct timer_list sc_cal_ch; /* calibration timer */
154 HAL_NODE_STATS sc_halstats; /* station-mode rssi stats */