1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -511,13 +511,12 @@ void ath_deinit_leds(struct ath_softc *s
4 #define SC_OP_BEACONS BIT(1)
5 #define SC_OP_RXAGGR BIT(2)
6 #define SC_OP_TXAGGR BIT(3)
7 -#define SC_OP_FULL_RESET BIT(4)
8 #define SC_OP_PREAMBLE_SHORT BIT(5)
9 #define SC_OP_PROTECT_ENABLE BIT(6)
10 #define SC_OP_RXFLUSH BIT(7)
11 #define SC_OP_LED_ASSOCIATED BIT(8)
12 #define SC_OP_LED_ON BIT(9)
13 -#define SC_OP_SCANNING BIT(10)
14 +#define SC_OP_OFFCHANNEL BIT(10)
15 #define SC_OP_TSF_RESET BIT(11)
16 #define SC_OP_BT_PRIORITY_DETECTED BIT(12)
17 #define SC_OP_BT_SCAN BIT(13)
18 --- a/drivers/net/wireless/ath/ath9k/main.c
19 +++ b/drivers/net/wireless/ath/ath9k/main.c
20 @@ -155,6 +155,27 @@ void ath9k_ps_restore(struct ath_softc *
21 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
24 +static void ath_start_ani(struct ath_common *common)
26 + struct ath_hw *ah = common->ah;
27 + unsigned long timestamp = jiffies_to_msecs(jiffies);
28 + struct ath_softc *sc = (struct ath_softc *) common->priv;
30 + if (!(sc->sc_flags & SC_OP_ANI_RUN))
33 + if (sc->sc_flags & SC_OP_OFFCHANNEL)
36 + common->ani.longcal_timer = timestamp;
37 + common->ani.shortcal_timer = timestamp;
38 + common->ani.checkani_timer = timestamp;
40 + mod_timer(&common->ani.timer,
42 + msecs_to_jiffies((u32)ah->config.ani_poll_interval));
46 * Set/change channels. If the channel is really being changed, it's done
47 * by reseting the chip. To accomplish this we must first cleanup any pending
48 @@ -173,6 +194,11 @@ int ath_set_channel(struct ath_softc *sc
49 if (sc->sc_flags & SC_OP_INVALID)
52 + del_timer_sync(&common->ani.timer);
53 + cancel_work_sync(&sc->paprd_work);
54 + cancel_work_sync(&sc->hw_check_work);
55 + cancel_delayed_work_sync(&sc->tx_complete_work);
60 @@ -192,7 +218,7 @@ int ath_set_channel(struct ath_softc *sc
61 * to flush data frames already in queue because of
62 * changing channel. */
64 - if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
65 + if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL))
68 ath_print(common, ATH_DBG_CONFIG,
69 @@ -213,8 +239,6 @@ int ath_set_channel(struct ath_softc *sc
71 spin_unlock_bh(&sc->sc_resetlock);
73 - sc->sc_flags &= ~SC_OP_FULL_RESET;
75 if (ath_startrecv(sc) != 0) {
76 ath_print(common, ATH_DBG_FATAL,
77 "Unable to restart recv logic\n");
78 @@ -226,6 +250,12 @@ int ath_set_channel(struct ath_softc *sc
80 ath9k_hw_set_interrupts(ah, ah->imask);
82 + if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) {
83 + ath_start_ani(common);
84 + ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
85 + ath_beacon_config(sc, NULL);
91 @@ -440,8 +470,7 @@ set_timer:
92 cal_interval = min(cal_interval, (u32)short_cal_interval);
94 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
95 - if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) &&
96 - !(sc->sc_flags & SC_OP_SCANNING)) {
97 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) {
98 if (!sc->sc_ah->curchan->paprd_done)
99 ieee80211_queue_work(sc->hw, &sc->paprd_work);
101 @@ -449,24 +478,6 @@ set_timer:
105 -static void ath_start_ani(struct ath_common *common)
107 - struct ath_hw *ah = common->ah;
108 - unsigned long timestamp = jiffies_to_msecs(jiffies);
109 - struct ath_softc *sc = (struct ath_softc *) common->priv;
111 - if (!(sc->sc_flags & SC_OP_ANI_RUN))
114 - common->ani.longcal_timer = timestamp;
115 - common->ani.shortcal_timer = timestamp;
116 - common->ani.checkani_timer = timestamp;
118 - mod_timer(&common->ani.timer,
120 - msecs_to_jiffies((u32)ah->config.ani_poll_interval));
124 * Update tx/rx chainmask. For legacy association,
125 * hard code chainmask to 1x1, for 11n association, use
126 @@ -478,7 +489,7 @@ void ath_update_chainmask(struct ath_sof
127 struct ath_hw *ah = sc->sc_ah;
128 struct ath_common *common = ath9k_hw_common(ah);
130 - if ((sc->sc_flags & SC_OP_SCANNING) || is_ht ||
131 + if ((sc->sc_flags & SC_OP_OFFCHANNEL) || is_ht ||
132 (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE)) {
133 common->tx_chainmask = ah->caps.tx_chainmask;
134 common->rx_chainmask = ah->caps.rx_chainmask;
135 @@ -1580,6 +1591,10 @@ static int ath9k_config(struct ieee80211
137 aphy->chan_idx = pos;
138 aphy->chan_is_ht = conf_is_ht(conf);
139 + if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
140 + sc->sc_flags |= SC_OP_OFFCHANNEL;
142 + sc->sc_flags &= ~SC_OP_OFFCHANNEL;
144 if (aphy->state == ATH_WIPHY_SCAN ||
145 aphy->state == ATH_WIPHY_ACTIVE)
146 @@ -1991,7 +2006,6 @@ static void ath9k_sw_scan_start(struct i
148 struct ath_wiphy *aphy = hw->priv;
149 struct ath_softc *sc = aphy->sc;
150 - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
152 mutex_lock(&sc->mutex);
153 if (ath9k_wiphy_scanning(sc)) {
154 @@ -2007,11 +2021,6 @@ static void ath9k_sw_scan_start(struct i
156 aphy->state = ATH_WIPHY_SCAN;
157 ath9k_wiphy_pause_all_forced(sc, aphy);
158 - sc->sc_flags |= SC_OP_SCANNING;
159 - del_timer_sync(&common->ani.timer);
160 - cancel_work_sync(&sc->paprd_work);
161 - cancel_work_sync(&sc->hw_check_work);
162 - cancel_delayed_work_sync(&sc->tx_complete_work);
163 mutex_unlock(&sc->mutex);
166 @@ -2019,15 +2028,9 @@ static void ath9k_sw_scan_complete(struc
168 struct ath_wiphy *aphy = hw->priv;
169 struct ath_softc *sc = aphy->sc;
170 - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
172 mutex_lock(&sc->mutex);
173 aphy->state = ATH_WIPHY_ACTIVE;
174 - sc->sc_flags &= ~SC_OP_SCANNING;
175 - sc->sc_flags |= SC_OP_FULL_RESET;
176 - ath_start_ani(common);
177 - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
178 - ath_beacon_config(sc, NULL);
179 mutex_unlock(&sc->mutex);
182 --- a/drivers/net/wireless/ath/ath9k/recv.c
183 +++ b/drivers/net/wireless/ath/ath9k/recv.c
184 @@ -292,7 +292,7 @@ static void ath_edma_start_recv(struct a
188 - ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_SCANNING));
189 + ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_OFFCHANNEL));
192 static void ath_edma_stop_recv(struct ath_softc *sc)
193 @@ -498,7 +498,7 @@ int ath_startrecv(struct ath_softc *sc)
195 spin_unlock_bh(&sc->rx.rxbuflock);
197 - ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_SCANNING));
198 + ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_OFFCHANNEL));