Build brcm47xx against 2.6.25.1
[openwrt.git] / package / madwifi / patches / 330-beaconcal.patch
1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-02-20 21:59:04.037808900 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-20 21:59:07.426001981 +0100
5 @@ -395,6 +395,7 @@
6 static int maxvaps = -1;
7 static int outdoor = -1;
8 static int xchanmode = -1;
9 +static int beacon_cal = 1;
10
11 static const char *hal_status_desc[] = {
12 "No error",
13 @@ -420,6 +421,7 @@
14 };
15
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");
21 @@ -432,6 +434,7 @@
22 MODULE_PARM(ratectl, "s");
23 #else
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);
29 @@ -2595,7 +2598,8 @@
30 }
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);
36 }
37 ath_draintxq(sc);
38 if (!sc->sc_invalid) {
39 @@ -2612,6 +2616,20 @@
40 return 0;
41 }
42
43 +static void ath_set_beacon_cal(struct ath_softc *sc, int val)
44 +{
45 + if (sc->sc_beacon_cal == !!val)
46 + return;
47 +
48 + if (val) {
49 + del_timer_sync(&sc->sc_cal_ch);
50 + } else {
51 + sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
52 + add_timer(&sc->sc_cal_ch);
53 + }
54 + sc->sc_beacon_cal = !!val && beacon_cal;
55 +}
56 +
57 /*
58 * Stop the device, grabbing the top-level lock to protect
59 * against concurrent entry through ath_init (which can happen
60 @@ -2737,6 +2755,12 @@
61 HAL_STATUS status;
62
63 /*
64 + * XXX: starting the calibration too early seems to lead to
65 + * problems with the beacons.
66 + */
67 + sc->sc_lastcal = jiffies;
68 +
69 + /*
70 * Convert to a HAL channel description with the flags
71 * constrained to reflect the current operating mode.
72 */
73 @@ -5142,6 +5166,8 @@
74 "Invoking ath_hal_txstart with sc_bhalq: %d\n",
75 sc->sc_bhalq);
76 ath_hal_txstart(ah, sc->sc_bhalq);
77 + if (sc->sc_beacon_cal && (jiffies > sc->sc_lastcal + (ath_calinterval * HZ)))
78 + ath_calibrate((unsigned long) sc->sc_dev);
79
80 sc->sc_stats.ast_be_xmit++; /* XXX per-VAP? */
81 }
82 @@ -5391,6 +5417,7 @@
83 ath_hal_beacontimers(ah, &bs);
84 sc->sc_imask |= HAL_INT_BMISS;
85 ath_hal_intrset(ah, sc->sc_imask);
86 + ath_set_beacon_cal(sc, 0);
87 } else {
88 ath_hal_intrset(ah, 0);
89 if (reset_tsf)
90 @@ -5402,8 +5429,11 @@
91 */
92 intval |= HAL_BEACON_ENA;
93 sc->sc_imask |= HAL_INT_SWBA;
94 + ath_set_beacon_cal(sc, 1);
95 ath_beaconq_config(sc);
96 - }
97 + } else
98 + ath_set_beacon_cal(sc, 0);
99 +
100 #ifdef ATH_SUPERG_DYNTURBO
101 ath_beacon_dturbo_config(vap, intval &
102 ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
103 @@ -8864,6 +8894,9 @@
104 /* Enter DFS wait period */
105 mod_timer(&sc->sc_dfs_cac_timer,
106 jiffies + (sc->sc_dfs_cac_period * HZ));
107 +
108 + /* This is a good time to start a calibration */
109 + ath_set_beacon_cal(sc, 1);
110 }
111 /*
112 * re configure beacons when it is a turbo mode switch.
113 @@ -8973,8 +9006,11 @@
114 sc->sc_curchan.channel, sc->sc_curchan.channelFlags,
115 isIQdone ? "done" : "not done");
116
117 - sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
118 - add_timer(&sc->sc_cal_ch);
119 + sc->sc_lastcal = jiffies;
120 + if (!sc->sc_beacon_cal) {
121 + sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
122 + add_timer(&sc->sc_cal_ch);
123 + }
124 }
125
126 static void
127 @@ -9081,7 +9117,8 @@
128 ieee80211_state_name[vap->iv_state],
129 ieee80211_state_name[nstate]);
130
131 - del_timer(&sc->sc_cal_ch); /* periodic calibration timer */
132 + if (!sc->sc_beacon_cal)
133 + del_timer(&sc->sc_cal_ch); /* periodic calibration timer */
134
135 ath_hal_setledstate(ah, leds[nstate]); /* set LED */
136 netif_stop_queue(dev); /* before we do anything else */
137 @@ -9306,7 +9343,8 @@
138 "VAP -> DFSWAIT_PENDING \n");
139 /* start calibration timer with a really small value
140 * 1/10 sec */
141 - mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
142 + if (!sc->sc_beacon_cal)
143 + mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
144 /* wake the receiver */
145 netif_wake_queue(dev);
146 /* don't do the other usual stuff... */
147 @@ -9349,7 +9387,7 @@
148 error = avp->av_newstate(vap, nstate, arg);
149
150 /* Finally, start any timers. */
151 - if (nstate == IEEE80211_S_RUN) {
152 + if (nstate == IEEE80211_S_RUN && !sc->sc_beacon_cal) {
153 /* start periodic recalibration timer */
154 mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
155 }
156 Index: madwifi-trunk-r3314/ath/if_athvar.h
157 ===================================================================
158 --- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-02-20 21:58:38.148333545 +0100
159 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-02-20 21:59:07.426001981 +0100
160 @@ -778,6 +778,8 @@
161 struct ieee80211vap **sc_bslot; /* beacon xmit slots */
162 int sc_bnext; /* next slot for beacon xmit */
163
164 + int sc_beacon_cal; /* use beacon timer for calibration */
165 + u_int64_t sc_lastcal; /* last time the calibration was performed */
166 struct timer_list sc_cal_ch; /* calibration timer */
167 HAL_NODE_STATS sc_halstats; /* station-mode rssi stats */
168
This page took 0.046854 seconds and 5 git commands to generate.