From: Sujith Manoharan <c_man...@qca.qualcomm.com>

Signed-off-by: Sujith Manoharan <c_man...@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 45 +++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 45d2c48..c6e130d 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -366,6 +366,32 @@ static void ath_chanctx_setup_timer(struct ath_softc *sc, 
u32 tsf_time)
                "Setup chanctx timer with timeout: %d ms\n", 
jiffies_to_msecs(tsf_time));
 }
 
+static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
+                                      struct ath_chanctx *ctx,
+                                      struct ath_vif *avp,
+                                      u32 tsf_time)
+{
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+       avp->noa_index++;
+       avp->offchannel_start = tsf_time;
+       avp->offchannel_duration = sc->sched.offchannel_duration;
+
+       ath_dbg(common, CHAN_CTX,
+               "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
+               avp->offchannel_duration,
+               avp->offchannel_start,
+               avp->noa_index);
+
+       /*
+        * When multiple contexts are active, the NoA
+        * has to be recalculated and advertised after
+        * an offchannel operation.
+        */
+       if (ctx->active && avp->noa_duration)
+               avp->noa_duration = 0;
+}
+
 void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
                       enum ath_chanctx_event ev)
 {
@@ -461,24 +487,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct 
ieee80211_vif *vif,
                 * values and increment the index.
                 */
                if (sc->next_chan == &sc->offchannel.chan) {
-                       avp->noa_index++;
-                       avp->offchannel_start = tsf_time;
-                       avp->offchannel_duration = 
sc->sched.offchannel_duration;
-
-                       ath_dbg(common, CHAN_CTX,
-                               "offchannel noa_duration: %d, noa_start: %d, 
noa_index: %d\n",
-                               avp->offchannel_duration,
-                               avp->offchannel_start,
-                               avp->noa_index);
-
-                       /*
-                        * When multiple contexts are active, the NoA
-                        * has to be recalculated and advertised after
-                        * an offchannel operation.
-                        */
-                       if (ctx->active && avp->noa_duration)
-                               avp->noa_duration = 0;
-
+                       ath_chanctx_offchannel_noa(sc, ctx, avp, tsf_time);
                        break;
                }
 
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to