ath9k: merge a fix for queue start/stop handling (fixes #18164, #18130)
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 320-ath9k-Use-a-helper-function-for-bmiss.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:25 +0530
3 Subject: [PATCH] ath9k: Use a helper function for bmiss
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,31 @@ 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_handle_bmiss(struct ath_softc *sc,
15 +                                    struct ath_chanctx *ctx,
16 +                                    struct ath_vif *avp)
17 +{
18 +       /*
19 +        * Clear the extend_absence flag if it had been
20 +        * set during the previous beacon transmission,
21 +        * since we need to revert to the normal NoA
22 +        * schedule.
23 +        */
24 +       if (ctx->active && sc->sched.extend_absence) {
25 +               avp->noa_duration = 0;
26 +               sc->sched.extend_absence = false;
27 +       }
28 +
29 +       /* If at least two consecutive beacons were missed on the STA
30 +        * chanctx, stay on the STA channel for one extra beacon period,
31 +        * to resync the timer properly.
32 +        */
33 +       if (ctx->active && sc->sched.beacon_miss >= 2) {
34 +               avp->noa_duration = 0;
35 +               sc->sched.extend_absence = true;
36 +       }
37 +}
38 +
39  static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
40                                        struct ath_chanctx *ctx,
41                                        struct ath_vif *avp,
42 @@ -524,25 +549,7 @@ void ath_chanctx_event(struct ath_softc 
43                         break;
44                 }
45  
46 -               /*
47 -                * Clear the extend_absence flag if it had been
48 -                * set during the previous beacon transmission,
49 -                * since we need to revert to the normal NoA
50 -                * schedule.
51 -                */
52 -               if (ctx->active && sc->sched.extend_absence) {
53 -                       avp->noa_duration = 0;
54 -                       sc->sched.extend_absence = false;
55 -               }
56 -
57 -               /* If at least two consecutive beacons were missed on the STA
58 -                * chanctx, stay on the STA channel for one extra beacon period,
59 -                * to resync the timer properly.
60 -                */
61 -               if (ctx->active && sc->sched.beacon_miss >= 2) {
62 -                       avp->noa_duration = 0;
63 -                       sc->sched.extend_absence = true;
64 -               }
65 +               ath_chanctx_handle_bmiss(sc, ctx, avp);
66  
67                 /* Prevent wrap-around issues */
68                 if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))