2
0

310-ath9k-Use-configurable-timeout-for-flush.patch 1.8 KB

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