aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/beacon.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index d4d8ceced89b..0d13ff74a68b 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -14,6 +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 <linux/dma-mapping.h>
17#include "ath9k.h" 18#include "ath9k.h"
18 19
19#define FUDGE 2 20#define FUDGE 2
@@ -360,6 +361,7 @@ void ath_beacon_tasklet(unsigned long data)
360 struct ath_common *common = ath9k_hw_common(ah); 361 struct ath_common *common = ath9k_hw_common(ah);
361 struct ath_buf *bf = NULL; 362 struct ath_buf *bf = NULL;
362 struct ieee80211_vif *vif; 363 struct ieee80211_vif *vif;
364 struct ath_tx_status ts;
363 int slot; 365 int slot;
364 u32 bfaddr, bc = 0; 366 u32 bfaddr, bc = 0;
365 367
@@ -384,7 +386,9 @@ void ath_beacon_tasklet(unsigned long data)
384 ath_dbg(common, ATH_DBG_BSTUCK, 386 ath_dbg(common, ATH_DBG_BSTUCK,
385 "beacon is officially stuck\n"); 387 "beacon is officially stuck\n");
386 sc->sc_flags |= SC_OP_TSF_RESET; 388 sc->sc_flags |= SC_OP_TSF_RESET;
389 spin_lock(&sc->sc_pcu_lock);
387 ath_reset(sc, true); 390 ath_reset(sc, true);
391 spin_unlock(&sc->sc_pcu_lock);
388 } 392 }
389 393
390 return; 394 return;
@@ -464,6 +468,11 @@ void ath_beacon_tasklet(unsigned long data)
464 ath9k_hw_txstart(ah, sc->beacon.beaconq); 468 ath9k_hw_txstart(ah, sc->beacon.beaconq);
465 469
466 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */ 470 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
471 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
472 spin_lock_bh(&sc->sc_pcu_lock);
473 ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
474 spin_unlock_bh(&sc->sc_pcu_lock);
475 }
467 } 476 }
468} 477}
469 478
@@ -496,7 +505,7 @@ static void ath_beacon_config_ap(struct ath_softc *sc,
496 u32 nexttbtt, intval; 505 u32 nexttbtt, intval;
497 506
498 /* NB: the beacon interval is kept internally in TU's */ 507 /* NB: the beacon interval is kept internally in TU's */
499 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD); 508 intval = TU_TO_USEC(conf->beacon_interval);
500 intval /= ATH_BCBUF; /* for staggered beacons */ 509 intval /= ATH_BCBUF; /* for staggered beacons */
501 nexttbtt = intval; 510 nexttbtt = intval;
502 511
@@ -543,7 +552,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
543 } 552 }
544 553
545 memset(&bs, 0, sizeof(bs)); 554 memset(&bs, 0, sizeof(bs));
546 intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; 555 intval = conf->beacon_interval;
547 556
548 /* 557 /*
549 * Setup dtim and cfp parameters according to 558 * Setup dtim and cfp parameters according to
@@ -652,22 +661,13 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc,
652{ 661{
653 struct ath_hw *ah = sc->sc_ah; 662 struct ath_hw *ah = sc->sc_ah;
654 struct ath_common *common = ath9k_hw_common(ah); 663 struct ath_common *common = ath9k_hw_common(ah);
655 u32 tsf, delta, intval, nexttbtt; 664 u32 tsf, intval, nexttbtt;
656 665
657 ath9k_reset_beacon_status(sc); 666 ath9k_reset_beacon_status(sc);
658 667
659 tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE); 668 intval = TU_TO_USEC(conf->beacon_interval);
660 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD); 669 tsf = roundup(ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE), intval);
661 670 nexttbtt = tsf + intval;
662 if (!sc->beacon.bc_tstamp)
663 nexttbtt = tsf + intval;
664 else {
665 if (tsf > sc->beacon.bc_tstamp)
666 delta = (tsf - sc->beacon.bc_tstamp);
667 else
668 delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));
669 nexttbtt = tsf + intval - (delta % intval);
670 }
671 671
672 ath_dbg(common, ATH_DBG_BEACON, 672 ath_dbg(common, ATH_DBG_BEACON,
673 "IBSS nexttbtt %u intval %u (%u)\n", 673 "IBSS nexttbtt %u intval %u (%u)\n",