mac80211: update to 2014-10-08
[openwrt.git] / package / kernel / mac80211 / patches / 310-ath9k-Use-configurable-timeout-for-flush.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:15 +0530
3 Subject: [PATCH] ath9k: Use configurable timeout for flush
4
5 The timeout value for flushing the TX queues
6 is hardcoded at 200ms right now. Use a channel
7 context-specific value instead to allow adjustments
8 to the timeout in case MCC is enabled.
9
10 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
11 ---
12
13 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
14 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
15 @@ -345,6 +345,7 @@ struct ath_chanctx {
16         u64 tsf_val;
17         u32 last_beacon;
18  
19 +       int flush_timeout;
20         u16 txpower;
21         bool offchannel;
22         bool stopped;
23 --- a/drivers/net/wireless/ath/ath9k/channel.c
24 +++ b/drivers/net/wireless/ath/ath9k/channel.c
25 @@ -117,6 +117,7 @@ void ath_chanctx_init(struct ath_softc *
26                 cfg80211_chandef_create(&ctx->chandef, chan, NL80211_CHAN_HT20);
27                 INIT_LIST_HEAD(&ctx->vifs);
28                 ctx->txpower = ATH_TXPOWER_MAX;
29 +               ctx->flush_timeout = HZ / 5; /* 200ms */
30                 for (j = 0; j < ARRAY_SIZE(ctx->acq); j++)
31                         INIT_LIST_HEAD(&ctx->acq[j]);
32         }
33 --- a/drivers/net/wireless/ath/ath9k/main.c
34 +++ b/drivers/net/wireless/ath/ath9k/main.c
35 @@ -2034,7 +2034,7 @@ void __ath9k_flush(struct ieee80211_hw *
36         struct ath_softc *sc = hw->priv;
37         struct ath_hw *ah = sc->sc_ah;
38         struct ath_common *common = ath9k_hw_common(ah);
39 -       int timeout = HZ / 5; /* 200 ms */
40 +       int timeout;
41         bool drain_txq;
42  
43         cancel_delayed_work_sync(&sc->tx_complete_work);
44 @@ -2049,6 +2049,13 @@ void __ath9k_flush(struct ieee80211_hw *
45                 return;
46         }
47  
48 +       spin_lock_bh(&sc->chan_lock);
49 +       timeout = sc->cur_chan->flush_timeout;
50 +       spin_unlock_bh(&sc->chan_lock);
51 +
52 +       ath_dbg(common, CHAN_CTX,
53 +               "Flush timeout: %d\n", jiffies_to_msecs(timeout));
54 +
55         if (wait_event_timeout(sc->tx_wait, !ath9k_has_tx_pending(sc),
56                                timeout) > 0)
57                 drop = false;