aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/beacon.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2008-08-11 07:01:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:03 -0400
commita8fff50e4d6aad520b261b3c32e2c67a7dfb7228 (patch)
tree0001651d0920c358eaec46e17ce22ee106ae82c4 /drivers/net/wireless/ath9k/beacon.c
parent2ad67de3c8a21354b8b2721d5d2baabb7c5013c9 (diff)
ath9k: Updated Beacon generation to use mac80211-style
This change moves ath9k to use mac80211-generated Beacon frames instead of trying to allocate a single Beacon frame and then update it. In addition, the remaining ath_skb_{map,unmap}_single() wrapper calls are replaced with direct pci_{map,unmap}_single() calls in beacon.c. Power save buffering for multicast/broadcast frames is not yet converted to use mac80211-style (frames to be buffered inside mac80211, not in driver). Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/beacon.c')
-rw-r--r--drivers/net/wireless/ath9k/beacon.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index e0ca0172f8be..8abcd3e8a301 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -172,6 +172,7 @@ static void empty_mcastq_into_cabq(struct ath_hal *ah,
172 mcastq->axq_link = NULL; 172 mcastq->axq_link = NULL;
173} 173}
174 174
175/* TODO: use ieee80211_get_buffered_bc() to fetch power saved mcast frames */
175/* This is only run at DTIM. We move everything from the vap's mcast queue 176/* This is only run at DTIM. We move everything from the vap's mcast queue
176 * to the hardware cab queue. Caller must hold the mcastq lock. */ 177 * to the hardware cab queue. Caller must hold the mcastq lock. */
177static void trigger_mcastq(struct ath_hal *ah, 178static void trigger_mcastq(struct ath_hal *ah,
@@ -206,7 +207,6 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
206 int cabq_depth; 207 int cabq_depth;
207 int mcastq_depth; 208 int mcastq_depth;
208 int is_beacon_dtim = 0; 209 int is_beacon_dtim = 0;
209 unsigned int curlen;
210 struct ath_txq *cabq; 210 struct ath_txq *cabq;
211 struct ath_txq *mcastq; 211 struct ath_txq *mcastq;
212 avp = sc->sc_vaps[if_id]; 212 avp = sc->sc_vaps[if_id];
@@ -223,33 +223,27 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
223 } 223 }
224 bf = avp->av_bcbuf; 224 bf = avp->av_bcbuf;
225 skb = (struct sk_buff *) bf->bf_mpdu; 225 skb = (struct sk_buff *) bf->bf_mpdu;
226 if (skb) {
227 pci_unmap_single(sc->pdev, bf->bf_dmacontext,
228 skb_end_pointer(skb) - skb->head,
229 PCI_DMA_TODEVICE);
230 }
226 231
227 /* 232 skb = ieee80211_beacon_get(sc->hw, avp->av_if_data);
228 * Update dynamic beacon contents. If this returns 233 bf->bf_mpdu = skb;
229 * non-zero then we need to remap the memory because 234 if (skb == NULL)
230 * the beacon frame changed size (probably because 235 return NULL;
231 * of the TIM bitmap). 236 bf->bf_buf_addr = bf->bf_dmacontext =
232 */ 237 pci_map_single(sc->pdev, skb->data,
233 curlen = skb->len; 238 skb_end_pointer(skb) - skb->head,
239 PCI_DMA_TODEVICE);
234 240
241 /* TODO: convert to use ieee80211_get_buffered_bc() */
235 /* XXX: spin_lock_bh should not be used here, but sparse bitches 242 /* XXX: spin_lock_bh should not be used here, but sparse bitches
236 * otherwise. We should fix sparse :) */ 243 * otherwise. We should fix sparse :) */
237 spin_lock_bh(&mcastq->axq_lock); 244 spin_lock_bh(&mcastq->axq_lock);
238 mcastq_depth = avp->av_mcastq.axq_depth; 245 mcastq_depth = avp->av_mcastq.axq_depth;
239 246
240 if (ath_update_beacon(sc, if_id, &avp->av_boff, skb, mcastq_depth) ==
241 1) {
242 ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE,
243 get_dma_mem_context(bf, bf_dmacontext));
244 bf->bf_buf_addr = ath_skb_map_single(sc, skb, PCI_DMA_TODEVICE,
245 get_dma_mem_context(bf, bf_dmacontext));
246 } else {
247 pci_dma_sync_single_for_cpu(sc->pdev,
248 bf->bf_buf_addr,
249 skb_tailroom(skb),
250 PCI_DMA_TODEVICE);
251 }
252
253 /* 247 /*
254 * if the CABQ traffic from previous DTIM is pending and the current 248 * if the CABQ traffic from previous DTIM is pending and the current
255 * beacon is also a DTIM. 249 * beacon is also a DTIM.
@@ -262,7 +256,8 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
262 cabq_depth = cabq->axq_depth; 256 cabq_depth = cabq->axq_depth;
263 spin_unlock_bh(&cabq->axq_lock); 257 spin_unlock_bh(&cabq->axq_lock);
264 258
265 is_beacon_dtim = avp->av_boff.bo_tim[4] & 1; 259 if (avp->av_boff.bo_tim)
260 is_beacon_dtim = avp->av_boff.bo_tim[4] & 1;
266 261
267 if (mcastq_depth && is_beacon_dtim && cabq_depth) { 262 if (mcastq_depth && is_beacon_dtim && cabq_depth) {
268 /* 263 /*
@@ -408,8 +403,9 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
408 bf = avp->av_bcbuf; 403 bf = avp->av_bcbuf;
409 if (bf->bf_mpdu != NULL) { 404 if (bf->bf_mpdu != NULL) {
410 skb = (struct sk_buff *)bf->bf_mpdu; 405 skb = (struct sk_buff *)bf->bf_mpdu;
411 ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, 406 pci_unmap_single(sc->pdev, bf->bf_dmacontext,
412 get_dma_mem_context(bf, bf_dmacontext)); 407 skb_end_pointer(skb) - skb->head,
408 PCI_DMA_TODEVICE);
413 dev_kfree_skb_any(skb); 409 dev_kfree_skb_any(skb);
414 bf->bf_mpdu = NULL; 410 bf->bf_mpdu = NULL;
415 } 411 }
@@ -439,9 +435,8 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
439 __le64 val; 435 __le64 val;
440 int intval; 436 int intval;
441 437
442 /* FIXME: Use default value for now: Sujith */ 438 intval = sc->hw->conf.beacon_int ?
443 439 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
444 intval = ATH_DEFAULT_BINTVAL;
445 440
446 /* 441 /*
447 * The beacon interval is in TU's; the TSF in usecs. 442 * The beacon interval is in TU's; the TSF in usecs.
@@ -466,8 +461,10 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
466 memcpy(&wh[1], &val, sizeof(val)); 461 memcpy(&wh[1], &val, sizeof(val));
467 } 462 }
468 463
469 bf->bf_buf_addr = ath_skb_map_single(sc, skb, PCI_DMA_TODEVICE, 464 bf->bf_buf_addr = bf->bf_dmacontext =
470 get_dma_mem_context(bf, bf_dmacontext)); 465 pci_map_single(sc->pdev, skb->data,
466 skb_end_pointer(skb) - skb->head,
467 PCI_DMA_TODEVICE);
471 bf->bf_mpdu = skb; 468 bf->bf_mpdu = skb;
472 469
473 return 0; 470 return 0;
@@ -493,8 +490,9 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
493 bf = avp->av_bcbuf; 490 bf = avp->av_bcbuf;
494 if (bf->bf_mpdu != NULL) { 491 if (bf->bf_mpdu != NULL) {
495 struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; 492 struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
496 ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, 493 pci_unmap_single(sc->pdev, bf->bf_dmacontext,
497 get_dma_mem_context(bf, bf_dmacontext)); 494 skb_end_pointer(skb) - skb->head,
495 PCI_DMA_TODEVICE);
498 dev_kfree_skb_any(skb); 496 dev_kfree_skb_any(skb);
499 bf->bf_mpdu = NULL; 497 bf->bf_mpdu = NULL;
500 } 498 }
@@ -520,8 +518,9 @@ void ath_beacon_free(struct ath_softc *sc)
520 list_for_each_entry(bf, &sc->sc_bbuf, list) { 518 list_for_each_entry(bf, &sc->sc_bbuf, list) {
521 if (bf->bf_mpdu != NULL) { 519 if (bf->bf_mpdu != NULL) {
522 struct sk_buff *skb = (struct sk_buff *) bf->bf_mpdu; 520 struct sk_buff *skb = (struct sk_buff *) bf->bf_mpdu;
523 ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, 521 pci_unmap_single(sc->pdev, bf->bf_dmacontext,
524 get_dma_mem_context(bf, bf_dmacontext)); 522 skb_end_pointer(skb) - skb->head,
523 PCI_DMA_TODEVICE);
525 dev_kfree_skb_any(skb); 524 dev_kfree_skb_any(skb);
526 bf->bf_mpdu = NULL; 525 bf->bf_mpdu = NULL;
527 } 526 }
@@ -643,8 +642,8 @@ void ath9k_beacon_tasklet(unsigned long data)
643 * on the tsf to safeguard against missing an swba. 642 * on the tsf to safeguard against missing an swba.
644 */ 643 */
645 644
646 /* FIXME: Use default value for now - Sujith */ 645 intval = sc->hw->conf.beacon_int ?
647 intval = ATH_DEFAULT_BINTVAL; 646 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
648 647
649 tsf = ath9k_hw_gettsf64(ah); 648 tsf = ath9k_hw_gettsf64(ah);
650 tsftu = TSF_TO_TU(tsf>>32, tsf); 649 tsftu = TSF_TO_TU(tsf>>32, tsf);
@@ -760,7 +759,8 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
760 * Protocol stack doesn't support dynamic beacon configuration, 759 * Protocol stack doesn't support dynamic beacon configuration,
761 * use default configurations. 760 * use default configurations.
762 */ 761 */
763 conf.beacon_interval = ATH_DEFAULT_BINTVAL; 762 conf.beacon_interval = sc->hw->conf.beacon_int ?
763 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
764 conf.listen_interval = 1; 764 conf.listen_interval = 1;
765 conf.dtim_period = conf.beacon_interval; 765 conf.dtim_period = conf.beacon_interval;
766 conf.dtim_count = 1; 766 conf.dtim_count = 1;