mac80211: merge a few pending upstream fixes
[openwrt/staging/hauke.git] / package / kernel / mac80211 / patches / 318-ath9k-Use-a-helper-function-for-offchannel-NoA.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:23 +0530
3 Subject: [PATCH] ath9k: Use a helper function for offchannel NoA
4
5 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
6 ---
7
8 --- a/drivers/net/wireless/ath/ath9k/channel.c
9 +++ b/drivers/net/wireless/ath/ath9k/channel.c
10 @@ -366,6 +366,32 @@ static void ath_chanctx_setup_timer(stru
11 "Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
12 }
13
14 +static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
15 + struct ath_chanctx *ctx,
16 + struct ath_vif *avp,
17 + u32 tsf_time)
18 +{
19 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
20 +
21 + avp->noa_index++;
22 + avp->offchannel_start = tsf_time;
23 + avp->offchannel_duration = sc->sched.offchannel_duration;
24 +
25 + ath_dbg(common, CHAN_CTX,
26 + "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
27 + avp->offchannel_duration,
28 + avp->offchannel_start,
29 + avp->noa_index);
30 +
31 + /*
32 + * When multiple contexts are active, the NoA
33 + * has to be recalculated and advertised after
34 + * an offchannel operation.
35 + */
36 + if (ctx->active && avp->noa_duration)
37 + avp->noa_duration = 0;
38 +}
39 +
40 void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
41 enum ath_chanctx_event ev)
42 {
43 @@ -461,24 +487,7 @@ void ath_chanctx_event(struct ath_softc
44 * values and increment the index.
45 */
46 if (sc->next_chan == &sc->offchannel.chan) {
47 - avp->noa_index++;
48 - avp->offchannel_start = tsf_time;
49 - avp->offchannel_duration = sc->sched.offchannel_duration;
50 -
51 - ath_dbg(common, CHAN_CTX,
52 - "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
53 - avp->offchannel_duration,
54 - avp->offchannel_start,
55 - avp->noa_index);
56 -
57 - /*
58 - * When multiple contexts are active, the NoA
59 - * has to be recalculated and advertised after
60 - * an offchannel operation.
61 - */
62 - if (ctx->active && avp->noa_duration)
63 - avp->noa_duration = 0;
64 -
65 + ath_chanctx_offchannel_noa(sc, ctx, avp, tsf_time);
66 break;
67 }
68