72
73
struct sk_buff *skb = bf->bf_mpdu;
73
74
struct ath_hw *ah = sc->sc_ah;
74
75
struct ath_common *common = ath9k_hw_common(ah);
76
struct ath9k_11n_rate_series series[4];
77
int flags, ctsrate = 0, ctsduration = 0;
76
struct ath_tx_info info;
78
77
struct ieee80211_supported_band *sband;
78
u8 chainmask = ah->txchainmask;
81
81
ath9k_reset_beacon_status(sc);
84
flags = ATH9K_TXDESC_NOACK;
88
83
sband = &sc->sbands[common->hw->conf.channel->band];
89
84
rate = sband->bitrates[rateidx].hw_value;
90
85
if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
91
86
rate |= sband->bitrates[rateidx].hw_value_short;
93
ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN,
94
ATH9K_PKT_TYPE_BEACON,
96
ATH9K_TXKEYIX_INVALID,
100
/* NB: beacon's BufLen must be a multiple of 4 bytes */
101
ath9k_hw_filltxdesc(ah, ds, roundup(skb->len, 4),
102
true, true, ds, bf->bf_buf_addr,
105
memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
107
series[0].Rate = rate;
108
series[0].ChSel = ath_txchainmask_reduction(sc,
109
common->tx_chainmask, series[0].Rate);
110
series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
111
ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration,
88
memset(&info, 0, sizeof(info));
89
info.pkt_len = skb->len + FCS_LEN;
90
info.type = ATH9K_PKT_TYPE_BEACON;
91
info.txpower = MAX_RATE_POWER;
92
info.keyix = ATH9K_TXKEYIX_INVALID;
93
info.keytype = ATH9K_KEY_TYPE_CLEAR;
94
info.flags = ATH9K_TXDESC_NOACK;
96
info.buf_addr[0] = bf->bf_buf_addr;
97
info.buf_len[0] = roundup(skb->len, 4);
102
info.qcu = sc->beacon.beaconq;
104
info.rates[0].Tries = 1;
105
info.rates[0].Rate = rate;
106
info.rates[0].ChSel = ath_txchainmask_reduction(sc, chainmask, rate);
108
ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
115
111
static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
464
461
ath9k_hw_txstart(ah, sc->beacon.beaconq);
466
463
sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
464
if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
465
spin_lock_bh(&sc->sc_pcu_lock);
466
ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
467
spin_unlock_bh(&sc->sc_pcu_lock);
510
512
/* Set the computed AP beacon timers */
512
514
ath9k_hw_disable_interrupts(ah);
515
sc->sc_flags |= SC_OP_TSF_RESET;
513
516
ath9k_beacon_init(sc, nexttbtt, intval);
514
517
sc->beacon.bmisscnt = 0;
515
ath9k_hw_set_interrupts(ah, ah->imask);
518
ath9k_hw_set_interrupts(ah);
519
ath9k_hw_enable_interrupts(ah);
639
643
ath9k_hw_set_sta_beacon_timers(ah, &bs);
640
644
ah->imask |= ATH9K_INT_BMISS;
643
* If the beacon config is called beacause of TSFOOR,
644
* Interrupts will be enabled back at the end of ath9k_tasklet
646
if (!(sc->ps_flags & PS_TSFOOR_SYNC))
647
ath9k_hw_set_interrupts(ah, ah->imask);
646
ath9k_hw_set_interrupts(ah);
647
ath9k_hw_enable_interrupts(ah);
650
650
static void ath_beacon_config_adhoc(struct ath_softc *sc,
653
653
struct ath_hw *ah = sc->sc_ah;
654
654
struct ath_common *common = ath9k_hw_common(ah);
655
u32 tsf, delta, intval, nexttbtt;
655
u32 tsf, intval, nexttbtt;
657
657
ath9k_reset_beacon_status(sc);
659
tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE);
660
intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD);
662
if (!sc->beacon.bc_tstamp)
663
nexttbtt = tsf + intval;
665
if (tsf > sc->beacon.bc_tstamp)
666
delta = (tsf - sc->beacon.bc_tstamp);
668
delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));
669
nexttbtt = tsf + intval - (delta % intval);
659
intval = TU_TO_USEC(conf->beacon_interval);
660
tsf = roundup(ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE), intval);
661
nexttbtt = tsf + intval;
672
663
ath_dbg(common, ATH_DBG_BEACON,
673
664
"IBSS nexttbtt %u intval %u (%u)\n",
687
678
ath9k_hw_disable_interrupts(ah);
688
679
ath9k_beacon_init(sc, nexttbtt, intval);
689
680
sc->beacon.bmisscnt = 0;
691
* If the beacon config is called beacause of TSFOOR,
692
* Interrupts will be enabled back at the end of ath9k_tasklet
694
if (!(sc->ps_flags & PS_TSFOOR_SYNC))
695
ath9k_hw_set_interrupts(ah, ah->imask);
682
ath9k_hw_set_interrupts(ah);
683
ath9k_hw_enable_interrupts(ah);
698
686
static bool ath9k_allow_beacon_config(struct ath_softc *sc,
834
822
/* Re-enable beaconing */
835
823
ah->imask |= ATH9K_INT_SWBA;
836
ath9k_hw_set_interrupts(ah, ah->imask);
824
ath9k_hw_set_interrupts(ah);
838
826
/* Disable SWBA interrupt */
839
827
ah->imask &= ~ATH9K_INT_SWBA;
840
ath9k_hw_set_interrupts(ah, ah->imask);
828
ath9k_hw_set_interrupts(ah);
841
829
tasklet_kill(&sc->bcon_tasklet);
842
830
ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq);