aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/beacon.c')
-rw-r--r--drivers/net/wireless/ath9k/beacon.c88
1 files changed, 18 insertions, 70 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index d186cd41c235..377d2df05316 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -14,13 +14,9 @@
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 /* Implementation of beacon processing. */
18
19#include "core.h" 17#include "core.h"
20 18
21/* 19/*
22 * Configure parameters for the beacon queue
23 *
24 * This function will modify certain transmit queue properties depending on 20 * This function will modify certain transmit queue properties depending on
25 * the operating mode of the station (AP or AdHoc). Parameters are AIFS 21 * the operating mode of the station (AP or AdHoc). Parameters are AIFS
26 * settings and channel width min/max 22 * settings and channel width min/max
@@ -54,9 +50,15 @@ static int ath_beaconq_config(struct ath_softc *sc)
54 } 50 }
55} 51}
56 52
53static void ath_bstuck_process(struct ath_softc *sc)
54{
55 DPRINTF(sc, ATH_DBG_BEACON,
56 "%s: stuck beacon; resetting (bmiss count %u)\n",
57 __func__, sc->sc_bmisscount);
58 ath_reset(sc, false);
59}
60
57/* 61/*
58 * Setup the beacon frame for transmit.
59 *
60 * Associates the beacon frame buffer with a transmit descriptor. Will set 62 * Associates the beacon frame buffer with a transmit descriptor. Will set
61 * up all required antenna switch parameters, rate codes, and channel flags. 63 * up all required antenna switch parameters, rate codes, and channel flags.
62 * Beacons are always sent out at the lowest rate, and are not retried. 64 * Beacons are always sent out at the lowest rate, and are not retried.
@@ -68,7 +70,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
68 struct ath_hal *ah = sc->sc_ah; 70 struct ath_hal *ah = sc->sc_ah;
69 struct ath_desc *ds; 71 struct ath_desc *ds;
70 struct ath9k_11n_rate_series series[4]; 72 struct ath9k_11n_rate_series series[4];
71 const struct ath9k_rate_table *rt; 73 struct ath_rate_table *rt;
72 int flags, antenna; 74 int flags, antenna;
73 u8 rix, rate; 75 u8 rix, rate;
74 int ctsrate = 0; 76 int ctsrate = 0;
@@ -106,10 +108,10 @@ static void ath_beacon_setup(struct ath_softc *sc,
106 * XXX everything at min xmit rate 108 * XXX everything at min xmit rate
107 */ 109 */
108 rix = 0; 110 rix = 0;
109 rt = sc->sc_currates; 111 rt = sc->hw_rate_table[sc->sc_curmode];
110 rate = rt->info[rix].rateCode; 112 rate = rt->info[rix].ratecode;
111 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) 113 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
112 rate |= rt->info[rix].shortPreamble; 114 rate |= rt->info[rix].short_preamble;
113 115
114 ath9k_hw_set11n_txdesc(ah, ds, 116 ath9k_hw_set11n_txdesc(ah, ds,
115 skb->len + FCS_LEN, /* frame length */ 117 skb->len + FCS_LEN, /* frame length */
@@ -138,14 +140,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
138 ctsrate, ctsduration, series, 4, 0); 140 ctsrate, ctsduration, series, 4, 0);
139} 141}
140 142
141/* 143/* Generate beacon frame and queue cab data for a vap */
142 * Generate beacon frame and queue cab data for a vap.
143 *
144 * Updates the contents of the beacon frame. It is assumed that the buffer for
145 * the beacon frame has been allocated in the ATH object, and simply needs to
146 * be filled for this cycle. Also, any CAB (crap after beacon?) traffic will
147 * be added to the beacon frame at this point.
148*/
149static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) 144static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
150{ 145{
151 struct ath_buf *bf; 146 struct ath_buf *bf;
@@ -275,14 +270,6 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id)
275 sc->sc_bhalq, ito64(bf->bf_daddr), bf->bf_desc); 270 sc->sc_bhalq, ito64(bf->bf_daddr), bf->bf_desc);
276} 271}
277 272
278/*
279 * Setup a h/w transmit queue for beacons.
280 *
281 * This function allocates an information structure (struct ath9k_txq_info)
282 * on the stack, sets some specific parameters (zero out channel width
283 * min/max, and enable aifs). The info structure does not need to be
284 * persistant.
285*/
286int ath_beaconq_setup(struct ath_hal *ah) 273int ath_beaconq_setup(struct ath_hal *ah)
287{ 274{
288 struct ath9k_tx_queue_info qi; 275 struct ath9k_tx_queue_info qi;
@@ -295,14 +282,6 @@ int ath_beaconq_setup(struct ath_hal *ah)
295 return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi); 282 return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
296} 283}
297 284
298
299/*
300 * Allocate and setup an initial beacon frame.
301 *
302 * Allocate a beacon state variable for a specific VAP instance created on
303 * the ATH interface. This routine also calculates the beacon "slot" for
304 * staggared beacons in the mBSSID case.
305*/
306int ath_beacon_alloc(struct ath_softc *sc, int if_id) 285int ath_beacon_alloc(struct ath_softc *sc, int if_id)
307{ 286{
308 struct ieee80211_vif *vif; 287 struct ieee80211_vif *vif;
@@ -321,7 +300,6 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
321 if (!avp->av_bcbuf) { 300 if (!avp->av_bcbuf) {
322 /* Allocate beacon state for hostap/ibss. We know 301 /* Allocate beacon state for hostap/ibss. We know
323 * a buffer is available. */ 302 * a buffer is available. */
324
325 avp->av_bcbuf = list_first_entry(&sc->sc_bbuf, 303 avp->av_bcbuf = list_first_entry(&sc->sc_bbuf,
326 struct ath_buf, list); 304 struct ath_buf, list);
327 list_del(&avp->av_bcbuf->list); 305 list_del(&avp->av_bcbuf->list);
@@ -427,12 +405,6 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
427 return 0; 405 return 0;
428} 406}
429 407
430/*
431 * Reclaim beacon resources and return buffer to the pool.
432 *
433 * Checks the VAP to put the beacon frame buffer back to the ATH object
434 * queue, and de-allocates any skbs that were sent as CAB traffic.
435*/
436void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp) 408void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
437{ 409{
438 if (avp->av_bcbuf != NULL) { 410 if (avp->av_bcbuf != NULL) {
@@ -458,13 +430,6 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
458 } 430 }
459} 431}
460 432
461/*
462 * Tasklet for Sending Beacons
463 *
464 * Transmit one or more beacon frames at SWBA. Dynamic updates to the frame
465 * contents are done as needed and the slot time is also adjusted based on
466 * current state.
467*/
468void ath9k_beacon_tasklet(unsigned long data) 433void ath9k_beacon_tasklet(unsigned long data)
469{ 434{
470 struct ath_softc *sc = (struct ath_softc *)data; 435 struct ath_softc *sc = (struct ath_softc *)data;
@@ -481,9 +446,7 @@ void ath9k_beacon_tasklet(unsigned long data)
481 446
482 if (sc->sc_flags & SC_OP_NO_RESET) { 447 if (sc->sc_flags & SC_OP_NO_RESET) {
483 show_cycles = ath9k_hw_GetMibCycleCountsPct(ah, 448 show_cycles = ath9k_hw_GetMibCycleCountsPct(ah,
484 &rx_clear, 449 &rx_clear, &rx_frame, &tx_frame);
485 &rx_frame,
486 &tx_frame);
487 } 450 }
488 451
489 /* 452 /*
@@ -605,9 +568,10 @@ void ath9k_beacon_tasklet(unsigned long data)
605 if (sc->sc_updateslot == UPDATE) { 568 if (sc->sc_updateslot == UPDATE) {
606 sc->sc_updateslot = COMMIT; /* commit next beacon */ 569 sc->sc_updateslot = COMMIT; /* commit next beacon */
607 sc->sc_slotupdate = slot; 570 sc->sc_slotupdate = slot;
608 } else if (sc->sc_updateslot == COMMIT && sc->sc_slotupdate == slot) 571 } else if (sc->sc_updateslot == COMMIT && sc->sc_slotupdate == slot) {
609 ath_setslottime(sc); /* commit change to hardware */ 572 ath9k_hw_setslottime(sc->sc_ah, sc->sc_slottime);
610 573 sc->sc_updateslot = OK;
574 }
611 if (bfaddr != 0) { 575 if (bfaddr != 0) {
612 /* 576 /*
613 * Stop any current dma and put the new frame(s) on the queue. 577 * Stop any current dma and put the new frame(s) on the queue.
@@ -630,20 +594,6 @@ void ath9k_beacon_tasklet(unsigned long data)
630} 594}
631 595
632/* 596/*
633 * Tasklet for Beacon Stuck processing
634 *
635 * Processing for Beacon Stuck.
636 * Basically resets the chip.
637*/
638void ath_bstuck_process(struct ath_softc *sc)
639{
640 DPRINTF(sc, ATH_DBG_BEACON,
641 "%s: stuck beacon; resetting (bmiss count %u)\n",
642 __func__, sc->sc_bmisscount);
643 ath_reset(sc, false);
644}
645
646/*
647 * Configure the beacon and sleep timers. 597 * Configure the beacon and sleep timers.
648 * 598 *
649 * When operating as an AP this resets the TSF and sets 599 * When operating as an AP this resets the TSF and sets
@@ -886,8 +836,6 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
886 } 836 }
887} 837}
888 838
889/* Function to collect beacon rssi data and resync beacon if necessary */
890
891void ath_beacon_sync(struct ath_softc *sc, int if_id) 839void ath_beacon_sync(struct ath_softc *sc, int if_id)
892{ 840{
893 /* 841 /*