use cp instead of $(CP), because bzImage might be a symlink
[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-06 20:27:16.005587752 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-06 22:06:51.778996341 +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 @@ -2594,7 +2597,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 @@ -2611,6 +2615,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 @@ -5141,6 +5159,8 @@
61 "Invoking ath_hal_txstart with sc_bhalq: %d\n",
62 sc->sc_bhalq);
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);
66
67 sc->sc_stats.ast_be_xmit++; /* XXX per-VAP? */
68 }
69 @@ -5390,6 +5410,7 @@
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);
74 } else {
75 ath_hal_intrset(ah, 0);
76 if (reset_tsf)
77 @@ -5401,8 +5422,11 @@
78 */
79 intval |= HAL_BEACON_ENA;
80 sc->sc_imask |= HAL_INT_SWBA;
81 + ath_set_beacon_cal(sc, 1);
82 ath_beaconq_config(sc);
83 - }
84 + } else
85 + ath_set_beacon_cal(sc, 0);
86 +
87 #ifdef ATH_SUPERG_DYNTURBO
88 ath_beacon_dturbo_config(vap, intval &
89 ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
90 @@ -8864,6 +8888,9 @@
91 /* Enter DFS wait period */
92 mod_timer(&sc->sc_dfs_cac_timer,
93 jiffies + (sc->sc_dfs_cac_period * HZ));
94 +
95 + /* This is a good time to start a calibration */
96 + ath_set_beacon_cal(sc, 1);
97 }
98 /*
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");
103
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);
110 + }
111 }
112
113 static void
114 @@ -9081,7 +9111,8 @@
115 ieee80211_state_name[vap->iv_state],
116 ieee80211_state_name[nstate]);
117
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 */
121
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
127 * 1/10 sec */
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);
136
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));
142 }
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
147 @@ -778,6 +778,8 @@
148 struct ieee80211vap **sc_bslot; /* beacon xmit slots */
149 int sc_bnext; /* next slot for beacon xmit */
150
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 */
155
This page took 0.04957 seconds and 5 git commands to generate.