aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/beacon.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-02-15 02:06:44 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-15 02:06:44 -0500
commitac178ef0ae9eb44fd527d87aa9b6394e05f56e1f (patch)
tree5d6bd46ecf9ce989134d3c460e1ecf5dd1fceadc /drivers/net/wireless/ath9k/beacon.c
parentf3a7c66b5ce0b75a9774a50b5dcce93e5ba28370 (diff)
parent6d08b9b9c6eb2414c4a037407dd121298a74fb36 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/ath9k/beacon.c')
-rw-r--r--drivers/net/wireless/ath9k/beacon.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index 61d37be9717e..2e2ef3529135 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include "core.h" 17#include "ath9k.h"
18 18
19/* 19/*
20 * This function will modify certain transmit queue properties depending on 20 * This function will modify certain transmit queue properties depending on
@@ -23,11 +23,11 @@
23*/ 23*/
24static int ath_beaconq_config(struct ath_softc *sc) 24static int ath_beaconq_config(struct ath_softc *sc)
25{ 25{
26 struct ath_hal *ah = sc->sc_ah; 26 struct ath_hw *ah = sc->sc_ah;
27 struct ath9k_tx_queue_info qi; 27 struct ath9k_tx_queue_info qi;
28 28
29 ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi); 29 ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
30 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) { 30 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
31 /* Always burst out beacon and CAB traffic. */ 31 /* Always burst out beacon and CAB traffic. */
32 qi.tqi_aifs = 1; 32 qi.tqi_aifs = 1;
33 qi.tqi_cwmin = 0; 33 qi.tqi_cwmin = 0;
@@ -63,10 +63,10 @@ static void ath_bstuck_process(struct ath_softc *sc)
63 * Beacons are always sent out at the lowest rate, and are not retried. 63 * Beacons are always sent out at the lowest rate, and are not retried.
64*/ 64*/
65static void ath_beacon_setup(struct ath_softc *sc, 65static void ath_beacon_setup(struct ath_softc *sc,
66 struct ath_vap *avp, struct ath_buf *bf) 66 struct ath_vif *avp, struct ath_buf *bf)
67{ 67{
68 struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; 68 struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
69 struct ath_hal *ah = sc->sc_ah; 69 struct ath_hw *ah = sc->sc_ah;
70 struct ath_desc *ds; 70 struct ath_desc *ds;
71 struct ath9k_11n_rate_series series[4]; 71 struct ath9k_11n_rate_series series[4];
72 struct ath_rate_table *rt; 72 struct ath_rate_table *rt;
@@ -82,8 +82,8 @@ static void ath_beacon_setup(struct ath_softc *sc,
82 82
83 flags = ATH9K_TXDESC_NOACK; 83 flags = ATH9K_TXDESC_NOACK;
84 84
85 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC && 85 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
86 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 86 (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
87 ds->ds_link = bf->bf_daddr; /* self-linked */ 87 ds->ds_link = bf->bf_daddr; /* self-linked */
88 flags |= ATH9K_TXDESC_VEOL; 88 flags |= ATH9K_TXDESC_VEOL;
89 /* Let hardware handle antenna switching. */ 89 /* Let hardware handle antenna switching. */
@@ -96,7 +96,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
96 * SWBA's 96 * SWBA's
97 * XXX assumes two antenna 97 * XXX assumes two antenna
98 */ 98 */
99 antenna = ((sc->beacon.ast_be_xmit / sc->sc_nbcnvaps) & 1 ? 2 : 1); 99 antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1);
100 } 100 }
101 101
102 ds->ds_data = bf->bf_buf_addr; 102 ds->ds_data = bf->bf_buf_addr;
@@ -132,24 +132,24 @@ static void ath_beacon_setup(struct ath_softc *sc,
132 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); 132 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
133 series[0].Tries = 1; 133 series[0].Tries = 1;
134 series[0].Rate = rate; 134 series[0].Rate = rate;
135 series[0].ChSel = sc->sc_tx_chainmask; 135 series[0].ChSel = sc->tx_chainmask;
136 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; 136 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
137 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, 137 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0,
138 ctsrate, ctsduration, series, 4, 0); 138 ctsrate, ctsduration, series, 4, 0);
139} 139}
140 140
141/* Generate beacon frame and queue cab data for a vap */ 141/* Generate beacon frame and queue cab data for a VIF */
142static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) 142static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
143{ 143{
144 struct ath_buf *bf; 144 struct ath_buf *bf;
145 struct ath_vap *avp; 145 struct ath_vif *avp;
146 struct sk_buff *skb; 146 struct sk_buff *skb;
147 struct ath_txq *cabq; 147 struct ath_txq *cabq;
148 struct ieee80211_vif *vif; 148 struct ieee80211_vif *vif;
149 struct ieee80211_tx_info *info; 149 struct ieee80211_tx_info *info;
150 int cabq_depth; 150 int cabq_depth;
151 151
152 vif = sc->sc_vaps[if_id]; 152 vif = sc->vifs[if_id];
153 ASSERT(vif); 153 ASSERT(vif);
154 154
155 avp = (void *)vif->drv_priv; 155 avp = (void *)vif->drv_priv;
@@ -204,10 +204,10 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
204 /* 204 /*
205 * if the CABQ traffic from previous DTIM is pending and the current 205 * if the CABQ traffic from previous DTIM is pending and the current
206 * beacon is also a DTIM. 206 * beacon is also a DTIM.
207 * 1) if there is only one vap let the cab traffic continue. 207 * 1) if there is only one vif let the cab traffic continue.
208 * 2) if there are more than one vap and we are using staggered 208 * 2) if there are more than one vif and we are using staggered
209 * beacons, then drain the cabq by dropping all the frames in 209 * beacons, then drain the cabq by dropping all the frames in
210 * the cabq so that the current vaps cab traffic can be scheduled. 210 * the cabq so that the current vifs cab traffic can be scheduled.
211 */ 211 */
212 spin_lock_bh(&cabq->axq_lock); 212 spin_lock_bh(&cabq->axq_lock);
213 cabq_depth = cabq->axq_depth; 213 cabq_depth = cabq->axq_depth;
@@ -219,7 +219,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
219 * the lock again which is a common function and that 219 * the lock again which is a common function and that
220 * acquires txq lock inside. 220 * acquires txq lock inside.
221 */ 221 */
222 if (sc->sc_nvaps > 1) { 222 if (sc->nvifs > 1) {
223 ath_draintxq(sc, cabq, false); 223 ath_draintxq(sc, cabq, false);
224 DPRINTF(sc, ATH_DBG_BEACON, 224 DPRINTF(sc, ATH_DBG_BEACON,
225 "flush previous cabq traffic\n"); 225 "flush previous cabq traffic\n");
@@ -248,12 +248,12 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
248static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) 248static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id)
249{ 249{
250 struct ieee80211_vif *vif; 250 struct ieee80211_vif *vif;
251 struct ath_hal *ah = sc->sc_ah; 251 struct ath_hw *ah = sc->sc_ah;
252 struct ath_buf *bf; 252 struct ath_buf *bf;
253 struct ath_vap *avp; 253 struct ath_vif *avp;
254 struct sk_buff *skb; 254 struct sk_buff *skb;
255 255
256 vif = sc->sc_vaps[if_id]; 256 vif = sc->vifs[if_id];
257 ASSERT(vif); 257 ASSERT(vif);
258 258
259 avp = (void *)vif->drv_priv; 259 avp = (void *)vif->drv_priv;
@@ -276,7 +276,7 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id)
276 sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc); 276 sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc);
277} 277}
278 278
279int ath_beaconq_setup(struct ath_hal *ah) 279int ath_beaconq_setup(struct ath_hw *ah)
280{ 280{
281 struct ath9k_tx_queue_info qi; 281 struct ath9k_tx_queue_info qi;
282 282
@@ -291,13 +291,13 @@ int ath_beaconq_setup(struct ath_hal *ah)
291int ath_beacon_alloc(struct ath_softc *sc, int if_id) 291int ath_beacon_alloc(struct ath_softc *sc, int if_id)
292{ 292{
293 struct ieee80211_vif *vif; 293 struct ieee80211_vif *vif;
294 struct ath_vap *avp; 294 struct ath_vif *avp;
295 struct ieee80211_hdr *hdr; 295 struct ieee80211_hdr *hdr;
296 struct ath_buf *bf; 296 struct ath_buf *bf;
297 struct sk_buff *skb; 297 struct sk_buff *skb;
298 __le64 tstamp; 298 __le64 tstamp;
299 299
300 vif = sc->sc_vaps[if_id]; 300 vif = sc->vifs[if_id];
301 ASSERT(vif); 301 ASSERT(vif);
302 302
303 avp = (void *)vif->drv_priv; 303 avp = (void *)vif->drv_priv;
@@ -310,11 +310,11 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
310 struct ath_buf, list); 310 struct ath_buf, list);
311 list_del(&avp->av_bcbuf->list); 311 list_del(&avp->av_bcbuf->list);
312 312
313 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP || 313 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
314 !(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 314 !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
315 int slot; 315 int slot;
316 /* 316 /*
317 * Assign the vap to a beacon xmit slot. As 317 * Assign the vif to a beacon xmit slot. As
318 * above, this cannot fail to find one. 318 * above, this cannot fail to find one.
319 */ 319 */
320 avp->av_bslot = 0; 320 avp->av_bslot = 0;
@@ -335,7 +335,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
335 } 335 }
336 BUG_ON(sc->beacon.bslot[avp->av_bslot] != ATH_IF_ID_ANY); 336 BUG_ON(sc->beacon.bslot[avp->av_bslot] != ATH_IF_ID_ANY);
337 sc->beacon.bslot[avp->av_bslot] = if_id; 337 sc->beacon.bslot[avp->av_bslot] = if_id;
338 sc->sc_nbcnvaps++; 338 sc->nbcnvifs++;
339 } 339 }
340 } 340 }
341 341
@@ -384,8 +384,8 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
384 * timestamp then convert to TSF units and handle 384 * timestamp then convert to TSF units and handle
385 * byte swapping before writing it in the frame. 385 * byte swapping before writing it in the frame.
386 * The hardware will then add this each time a beacon 386 * The hardware will then add this each time a beacon
387 * frame is sent. Note that we align vap's 1..N 387 * frame is sent. Note that we align vif's 1..N
388 * and leave vap 0 untouched. This means vap 0 388 * and leave vif 0 untouched. This means vap 0
389 * has a timestamp in one beacon interval while the 389 * has a timestamp in one beacon interval while the
390 * others get a timestamp aligned to the next interval. 390 * others get a timestamp aligned to the next interval.
391 */ 391 */
@@ -416,14 +416,14 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
416 return 0; 416 return 0;
417} 417}
418 418
419void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp) 419void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp)
420{ 420{
421 if (avp->av_bcbuf != NULL) { 421 if (avp->av_bcbuf != NULL) {
422 struct ath_buf *bf; 422 struct ath_buf *bf;
423 423
424 if (avp->av_bslot != -1) { 424 if (avp->av_bslot != -1) {
425 sc->beacon.bslot[avp->av_bslot] = ATH_IF_ID_ANY; 425 sc->beacon.bslot[avp->av_bslot] = ATH_IF_ID_ANY;
426 sc->sc_nbcnvaps--; 426 sc->nbcnvifs--;
427 } 427 }
428 428
429 bf = avp->av_bcbuf; 429 bf = avp->av_bcbuf;
@@ -444,7 +444,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
444void ath9k_beacon_tasklet(unsigned long data) 444void ath9k_beacon_tasklet(unsigned long data)
445{ 445{
446 struct ath_softc *sc = (struct ath_softc *)data; 446 struct ath_softc *sc = (struct ath_softc *)data;
447 struct ath_hal *ah = sc->sc_ah; 447 struct ath_hw *ah = sc->sc_ah;
448 struct ath_buf *bf = NULL; 448 struct ath_buf *bf = NULL;
449 int slot, if_id; 449 int slot, if_id;
450 u32 bfaddr; 450 u32 bfaddr;
@@ -597,7 +597,7 @@ void ath9k_beacon_tasklet(unsigned long data)
597 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bfaddr); 597 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bfaddr);
598 ath9k_hw_txstart(ah, sc->beacon.beaconq); 598 ath9k_hw_txstart(ah, sc->beacon.beaconq);
599 599
600 sc->beacon.ast_be_xmit += bc; /* XXX per-vap? */ 600 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
601 } 601 }
602} 602}
603 603
@@ -619,19 +619,19 @@ void ath9k_beacon_tasklet(unsigned long data)
619void ath_beacon_config(struct ath_softc *sc, int if_id) 619void ath_beacon_config(struct ath_softc *sc, int if_id)
620{ 620{
621 struct ieee80211_vif *vif; 621 struct ieee80211_vif *vif;
622 struct ath_hal *ah = sc->sc_ah; 622 struct ath_hw *ah = sc->sc_ah;
623 struct ath_beacon_config conf; 623 struct ath_beacon_config conf;
624 struct ath_vap *avp; 624 struct ath_vif *avp;
625 enum nl80211_iftype opmode; 625 enum nl80211_iftype opmode;
626 u32 nexttbtt, intval; 626 u32 nexttbtt, intval;
627 627
628 if (if_id != ATH_IF_ID_ANY) { 628 if (if_id != ATH_IF_ID_ANY) {
629 vif = sc->sc_vaps[if_id]; 629 vif = sc->vifs[if_id];
630 ASSERT(vif); 630 ASSERT(vif);
631 avp = (void *)vif->drv_priv; 631 avp = (void *)vif->drv_priv;
632 opmode = avp->av_opmode; 632 opmode = avp->av_opmode;
633 } else { 633 } else {
634 opmode = sc->sc_ah->ah_opmode; 634 opmode = sc->sc_ah->opmode;
635 } 635 }
636 636
637 memset(&conf, 0, sizeof(struct ath_beacon_config)); 637 memset(&conf, 0, sizeof(struct ath_beacon_config));
@@ -647,7 +647,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
647 nexttbtt = TSF_TO_TU(sc->beacon.bc_tstamp >> 32, sc->beacon.bc_tstamp); 647 nexttbtt = TSF_TO_TU(sc->beacon.bc_tstamp >> 32, sc->beacon.bc_tstamp);
648 648
649 /* XXX conditionalize multi-bss support? */ 649 /* XXX conditionalize multi-bss support? */
650 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) { 650 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
651 /* 651 /*
652 * For multi-bss ap support beacons are either staggered 652 * For multi-bss ap support beacons are either staggered
653 * evenly over N slots or burst together. For the former 653 * evenly over N slots or burst together. For the former
@@ -670,7 +670,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
670 nexttbtt, intval, conf.beacon_interval); 670 nexttbtt, intval, conf.beacon_interval);
671 671
672 /* Check for NL80211_IFTYPE_AP and sc_nostabeacons for WDS client */ 672 /* Check for NL80211_IFTYPE_AP and sc_nostabeacons for WDS client */
673 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) { 673 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
674 struct ath9k_beacon_state bs; 674 struct ath9k_beacon_state bs;
675 u64 tsf; 675 u64 tsf;
676 u32 tsftu; 676 u32 tsftu;
@@ -781,15 +781,15 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
781 781
782 ath9k_hw_set_interrupts(ah, 0); 782 ath9k_hw_set_interrupts(ah, 0);
783 ath9k_hw_set_sta_beacon_timers(ah, &bs); 783 ath9k_hw_set_sta_beacon_timers(ah, &bs);
784 sc->sc_imask |= ATH9K_INT_BMISS; 784 sc->imask |= ATH9K_INT_BMISS;
785 ath9k_hw_set_interrupts(ah, sc->sc_imask); 785 ath9k_hw_set_interrupts(ah, sc->imask);
786 } else { 786 } else {
787 u64 tsf; 787 u64 tsf;
788 u32 tsftu; 788 u32 tsftu;
789 ath9k_hw_set_interrupts(ah, 0); 789 ath9k_hw_set_interrupts(ah, 0);
790 if (nexttbtt == intval) 790 if (nexttbtt == intval)
791 intval |= ATH9K_BEACON_RESET_TSF; 791 intval |= ATH9K_BEACON_RESET_TSF;
792 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) { 792 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) {
793 /* 793 /*
794 * Pull nexttbtt forward to reflect the current 794 * Pull nexttbtt forward to reflect the current
795 * TSF 795 * TSF
@@ -818,27 +818,27 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
818 * deal with things. 818 * deal with things.
819 */ 819 */
820 intval |= ATH9K_BEACON_ENA; 820 intval |= ATH9K_BEACON_ENA;
821 if (!(ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 821 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL))
822 sc->sc_imask |= ATH9K_INT_SWBA; 822 sc->imask |= ATH9K_INT_SWBA;
823 ath_beaconq_config(sc); 823 ath_beaconq_config(sc);
824 } else if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) { 824 } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
825 /* 825 /*
826 * In AP mode we enable the beacon timers and 826 * In AP mode we enable the beacon timers and
827 * SWBA interrupts to prepare beacon frames. 827 * SWBA interrupts to prepare beacon frames.
828 */ 828 */
829 intval |= ATH9K_BEACON_ENA; 829 intval |= ATH9K_BEACON_ENA;
830 sc->sc_imask |= ATH9K_INT_SWBA; /* beacon prepare */ 830 sc->imask |= ATH9K_INT_SWBA; /* beacon prepare */
831 ath_beaconq_config(sc); 831 ath_beaconq_config(sc);
832 } 832 }
833 ath9k_hw_beaconinit(ah, nexttbtt, intval); 833 ath9k_hw_beaconinit(ah, nexttbtt, intval);
834 sc->beacon.bmisscnt = 0; 834 sc->beacon.bmisscnt = 0;
835 ath9k_hw_set_interrupts(ah, sc->sc_imask); 835 ath9k_hw_set_interrupts(ah, sc->imask);
836 /* 836 /*
837 * When using a self-linked beacon descriptor in 837 * When using a self-linked beacon descriptor in
838 * ibss mode load it once here. 838 * ibss mode load it once here.
839 */ 839 */
840 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC && 840 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
841 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 841 (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL))
842 ath_beacon_start_adhoc(sc, 0); 842 ath_beacon_start_adhoc(sc, 0);
843 } 843 }
844} 844}