ath9k: merge a fix for queue start/stop handling (fixes #18164, #18130)
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 304-ath9k-Enable-multi-channel-properly.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:09 +0530
3 Subject: [PATCH] ath9k: Enable multi-channel properly
4
5 In MCC mode, currently the decision to enable
6 the multi-channel state machine is done
7 based on the association status if one of
8 the interfaces assigned to a context is in
9 station mode.
10
11 This allows the driver to switch to the other
12 context before the current station is able to
13 complete the 4-way handshake in case it is
14 required and this causes problems.
15
16 Instead, enable multi-channel mode when the
17 station moves to the authorized state. This
18 disallows an early switch to the other channel.
19
20 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
21 ---
22
23 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
24 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
25 @@ -362,7 +362,7 @@ enum ath_chanctx_event {
26         ATH_CHANCTX_EVENT_BEACON_SENT,
27         ATH_CHANCTX_EVENT_TSF_TIMER,
28         ATH_CHANCTX_EVENT_BEACON_RECEIVED,
29 -       ATH_CHANCTX_EVENT_ASSOC,
30 +       ATH_CHANCTX_EVENT_AUTHORIZED,
31         ATH_CHANCTX_EVENT_SWITCH,
32         ATH_CHANCTX_EVENT_ASSIGN,
33         ATH_CHANCTX_EVENT_UNASSIGN,
34 --- a/drivers/net/wireless/ath/ath9k/channel.c
35 +++ b/drivers/net/wireless/ath/ath9k/channel.c
36 @@ -171,7 +171,7 @@ static const char *chanctx_event_string(
37                 case_rtn_string(ATH_CHANCTX_EVENT_BEACON_SENT);
38                 case_rtn_string(ATH_CHANCTX_EVENT_TSF_TIMER);
39                 case_rtn_string(ATH_CHANCTX_EVENT_BEACON_RECEIVED);
40 -               case_rtn_string(ATH_CHANCTX_EVENT_ASSOC);
41 +               case_rtn_string(ATH_CHANCTX_EVENT_AUTHORIZED);
42                 case_rtn_string(ATH_CHANCTX_EVENT_SWITCH);
43                 case_rtn_string(ATH_CHANCTX_EVENT_ASSIGN);
44                 case_rtn_string(ATH_CHANCTX_EVENT_UNASSIGN);
45 @@ -510,7 +510,7 @@ void ath_chanctx_event(struct ath_softc 
46  
47                 ath_chanctx_setup_timer(sc, tsf_time);
48                 break;
49 -       case ATH_CHANCTX_EVENT_ASSOC:
50 +       case ATH_CHANCTX_EVENT_AUTHORIZED:
51                 if (sc->sched.state != ATH_CHANCTX_STATE_FORCE_ACTIVE ||
52                     avp->chanctx != sc->cur_chan)
53                         break;
54 --- a/drivers/net/wireless/ath/ath9k/main.c
55 +++ b/drivers/net/wireless/ath/ath9k/main.c
56 @@ -1569,6 +1569,13 @@ static int ath9k_sta_state(struct ieee80
57                         "Remove station: %pM\n", sta->addr);
58         }
59  
60 +       if (ath9k_is_chanctx_enabled()) {
61 +               if (old_state == IEEE80211_STA_ASSOC &&
62 +                   new_state == IEEE80211_STA_AUTHORIZED)
63 +                       ath_chanctx_event(sc, vif,
64 +                                         ATH_CHANCTX_EVENT_AUTHORIZED);
65 +       }
66 +
67         return ret;
68  }
69  
70 @@ -1761,12 +1768,6 @@ static void ath9k_bss_info_changed(struc
71                 avp->assoc = bss_conf->assoc;
72  
73                 ath9k_calculate_summary_state(sc, avp->chanctx);
74 -
75 -               if (ath9k_is_chanctx_enabled()) {
76 -                       if (bss_conf->assoc)
77 -                               ath_chanctx_event(sc, vif,
78 -                                                 ATH_CHANCTX_EVENT_ASSOC);
79 -               }
80         }
81  
82         if (changed & BSS_CHANGED_IBSS) {