ath9k: merge a fix for queue start/stop handling (fixes #18164, #18130)
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 319-ath9k-Use-a-helper-function-to-set-NoA.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:24 +0530
3 Subject: [PATCH] ath9k: Use a helper function to set 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 @@ -392,6 +392,39 @@ static void ath_chanctx_offchannel_noa(s
11                 avp->noa_duration = 0;
12  }
13  
14 +static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
15 +                                        struct ath_vif *avp,
16 +                                        struct ath_beacon_config *cur_conf,
17 +                                        u32 tsf_time,
18 +                                        u32 beacon_int)
19 +{
20 +       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
21 +
22 +       avp->noa_index++;
23 +       avp->noa_start = tsf_time;
24 +
25 +       if (sc->sched.extend_absence)
26 +               avp->noa_duration = (3 * beacon_int / 2) +
27 +                       sc->sched.channel_switch_time;
28 +       else
29 +               avp->noa_duration =
30 +                       TU_TO_USEC(cur_conf->beacon_interval) / 2 +
31 +                       sc->sched.channel_switch_time;
32 +
33 +       if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
34 +           sc->sched.extend_absence)
35 +               avp->periodic_noa = false;
36 +       else
37 +               avp->periodic_noa = true;
38 +
39 +       ath_dbg(common, CHAN_CTX,
40 +               "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
41 +               avp->noa_duration,
42 +               avp->noa_start,
43 +               avp->noa_index,
44 +               avp->periodic_noa);
45 +}
46 +
47  void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
48                        enum ath_chanctx_event ev)
49  {
50 @@ -521,31 +554,9 @@ void ath_chanctx_event(struct ath_softc 
51                  * announcement.
52                  */
53                 if (ctx->active &&
54 -                   (!avp->noa_duration || sc->sched.force_noa_update)) {
55 -                       avp->noa_index++;
56 -                       avp->noa_start = tsf_time;
57 -
58 -                       if (sc->sched.extend_absence)
59 -                               avp->noa_duration = (3 * beacon_int / 2) +
60 -                                       sc->sched.channel_switch_time;
61 -                       else
62 -                               avp->noa_duration =
63 -                                       TU_TO_USEC(cur_conf->beacon_interval) / 2 +
64 -                                       sc->sched.channel_switch_time;
65 -
66 -                       if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
67 -                           sc->sched.extend_absence)
68 -                               avp->periodic_noa = false;
69 -                       else
70 -                               avp->periodic_noa = true;
71 -
72 -                       ath_dbg(common, CHAN_CTX,
73 -                               "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
74 -                               avp->noa_duration,
75 -                               avp->noa_start,
76 -                               avp->noa_index,
77 -                               avp->periodic_noa);
78 -               }
79 +                   (!avp->noa_duration || sc->sched.force_noa_update))
80 +                       ath_chanctx_set_periodic_noa(sc, avp, cur_conf,
81 +                                                    tsf_time, beacon_int);
82  
83                 if (ctx->active && sc->sched.force_noa_update)
84                         sc->sched.force_noa_update = false;