mac80211: fix key flush handling in AP+STA
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 323-ath9k-Fix-HW-scan-abort.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:28 +0530
3 Subject: [PATCH] ath9k: Fix HW scan abort
4
5 Instead of using ATH_CHANCTX_EVENT_ASSIGN to abort
6 a HW scan when a new interface becomes active, use the
7 mgd_prepare_tx() callback. This allows us to make
8 sure that the GO's channel becomes operational by
9 using flush_work().
10
11 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
12 ---
13
14 --- a/drivers/net/wireless/ath/ath9k/channel.c
15 +++ b/drivers/net/wireless/ath/ath9k/channel.c
16 @@ -743,22 +743,6 @@ void ath_chanctx_event(struct ath_softc 
17                 ieee80211_queue_work(sc->hw, &sc->chanctx_work);
18                 break;
19         case ATH_CHANCTX_EVENT_ASSIGN:
20 -               /*
21 -                * When adding a new channel context, check if a scan
22 -                * is in progress and abort it since the addition of
23 -                * a new channel context is usually followed by VIF
24 -                * assignment, in which case we have to start multi-channel
25 -                * operation.
26 -                */
27 -               if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
28 -                       ath_dbg(common, CHAN_CTX,
29 -                               "Aborting HW scan to add new context\n");
30 -
31 -                       spin_unlock_bh(&sc->chan_lock);
32 -                       del_timer_sync(&sc->offchannel.timer);
33 -                       ath_scan_complete(sc, true);
34 -                       spin_lock_bh(&sc->chan_lock);
35 -               }
36                 break;
37         case ATH_CHANCTX_EVENT_CHANGE:
38                 break;
39 --- a/drivers/net/wireless/ath/ath9k/main.c
40 +++ b/drivers/net/wireless/ath/ath9k/main.c
41 @@ -2365,7 +2365,6 @@ static int ath9k_add_chanctx(struct ieee
42                         conf->def.chan->center_freq);
43  
44                 ath_chanctx_set_channel(sc, ctx, &conf->def);
45 -               ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_ASSIGN);
46  
47                 mutex_unlock(&sc->mutex);
48                 return 0;
49 @@ -2496,6 +2495,19 @@ static void ath9k_mgd_prepare_tx(struct 
50         if (!changed)
51                 goto out;
52  
53 +       if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
54 +               ath_dbg(common, CHAN_CTX,
55 +                       "%s: Aborting HW scan\n", __func__);
56 +
57 +               mutex_unlock(&sc->mutex);
58 +
59 +               del_timer_sync(&sc->offchannel.timer);
60 +               ath_scan_complete(sc, true);
61 +               flush_work(&sc->chanctx_work);
62 +
63 +               mutex_lock(&sc->mutex);
64 +       }
65 +
66         go_ctx = ath_is_go_chanctx_present(sc);
67  
68         if (go_ctx) {