1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -397,6 +397,9 @@ struct ath_beacon {
4 struct ath_descdma bdma;
12 void ath_beacon_tasklet(unsigned long data);
13 --- a/drivers/net/wireless/ath/ath9k/beacon.c
14 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
19 +static void ath9k_reset_beacon_status(struct ath_softc *sc)
21 + sc->beacon.tx_processed = false;
22 + sc->beacon.tx_last = false;
26 * This function will modify certain transmit queue properties depending on
27 * the operating mode of the station (AP or AdHoc). Parameters are AIFS
28 @@ -72,6 +78,8 @@ static void ath_beacon_setup(struct ath_
29 struct ieee80211_supported_band *sband;
32 + ath9k_reset_beacon_status(sc);
35 flags = ATH9K_TXDESC_NOACK;
37 @@ -134,6 +142,8 @@ static struct ath_buf *ath_beacon_genera
38 struct ieee80211_tx_info *info;
41 + ath9k_reset_beacon_status(sc);
43 avp = (void *)vif->drv_priv;
44 cabq = sc->beacon.cabq;
46 @@ -644,6 +654,8 @@ static void ath_beacon_config_adhoc(stru
47 struct ath_common *common = ath9k_hw_common(ah);
48 u32 tsf, delta, intval, nexttbtt;
50 + ath9k_reset_beacon_status(sc);
52 tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE);
53 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD);
55 --- a/drivers/net/wireless/ath/ath9k/main.c
56 +++ b/drivers/net/wireless/ath/ath9k/main.c
57 @@ -2314,6 +2314,48 @@ static bool ath9k_tx_frames_pending(stru
61 +int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
63 + struct ath_softc *sc = hw->priv;
64 + struct ath_hw *ah = sc->sc_ah;
65 + struct ieee80211_vif *vif;
66 + struct ath_vif *avp;
68 + struct ath_tx_status ts;
71 + if (ah->opmode != NL80211_IFTYPE_ADHOC)
74 + vif = sc->beacon.bslot[0];
78 + avp = (void *)vif->drv_priv;
79 + if (!avp->is_bslot_active)
82 + if (!sc->beacon.tx_processed) {
83 + tasklet_disable(&sc->bcon_tasklet);
86 + if (!bf || !bf->bf_mpdu)
89 + status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts);
90 + if (status == -EINPROGRESS)
93 + sc->beacon.tx_processed = true;
94 + sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
97 + tasklet_enable(&sc->bcon_tasklet);
100 + return sc->beacon.tx_last;
103 struct ieee80211_ops ath9k_ops = {
105 .start = ath9k_start,
106 @@ -2338,4 +2380,5 @@ struct ieee80211_ops ath9k_ops = {
107 .set_coverage_class = ath9k_set_coverage_class,
108 .flush = ath9k_flush,
109 .tx_frames_pending = ath9k_tx_frames_pending,
110 + .tx_last_beacon = ath9k_tx_last_beacon,