mac80211: merge a few pending upstream fixes
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 311-ath9k-Fix-MCC-flush-timeout.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:16 +0530
3 Subject: [PATCH] ath9k: Fix MCC flush timeout
4
5 In MCC mode, the duration for a channel context
6 is half the beacon interval and having a large
7 flush timeout will adversely affect GO operation,
8 since the default value of 200ms will overshoot
9 the advertised NoA absence duration.
10
11 The scheduler initiates a channel context switch
12 only when the slot duration for the current
13 context expires, so there is no possibility of
14 having a fixed timeout for flush.
15
16 Since the channel_switch_time is added to the
17 absence duration when the GO sets up the NoA
18 attribute, this is the maximum time that we
19 have to flush the TX queues. The duration is very
20 small, but we don't have a choice in MCC mode.
21
22 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
23 ---
24
25 --- a/drivers/net/wireless/ath/ath9k/channel.c
26 +++ b/drivers/net/wireless/ath/ath9k/channel.c
27 @@ -199,6 +199,7 @@ static const char *chanctx_state_string(
28 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
29 {
30 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
31 + struct ath_chanctx *ictx;
32 struct ath_vif *avp;
33 bool active = false;
34 u8 n_active = 0;
35 @@ -206,6 +207,8 @@ void ath_chanctx_check_active(struct ath
36 if (!ctx)
37 return;
38
39 + ictx = ctx;
40 +
41 list_for_each_entry(avp, &ctx->vifs, list) {
42 struct ieee80211_vif *vif = avp->vif;
43
44 @@ -228,12 +231,23 @@ void ath_chanctx_check_active(struct ath
45 n_active++;
46 }
47
48 + spin_lock_bh(&sc->chan_lock);
49 +
50 if (n_active <= 1) {
51 + ictx->flush_timeout = HZ / 5;
52 clear_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags);
53 + spin_unlock_bh(&sc->chan_lock);
54 return;
55 }
56 - if (test_and_set_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags))
57 +
58 + ictx->flush_timeout = usecs_to_jiffies(sc->sched.channel_switch_time);
59 +
60 + if (test_and_set_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags)) {
61 + spin_unlock_bh(&sc->chan_lock);
62 return;
63 + }
64 +
65 + spin_unlock_bh(&sc->chan_lock);
66
67 if (ath9k_is_chanctx_enabled()) {
68 ath_chanctx_event(sc, NULL,