314-ath9k-rename-tx_complete_work-to-hw_check_work.patch 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 25 Jan 2017 12:57:05 +0100
  3. Subject: [PATCH] ath9k: rename tx_complete_work to hw_check_work
  4. Also include common MAC alive check. This should make the hang checks
  5. more reliable for modes where beacons are not sent and is used as a
  6. starting point for further hang check improvements
  7. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  11. @@ -108,7 +108,7 @@ int ath_descdma_setup(struct ath_softc *
  12. #define ATH_AGGR_MIN_QDEPTH 2
  13. /* minimum h/w qdepth for non-aggregated traffic */
  14. #define ATH_NON_AGGR_MIN_QDEPTH 8
  15. -#define ATH_TX_COMPLETE_POLL_INT 1000
  16. +#define ATH_HW_CHECK_POLL_INT 1000
  17. #define ATH_TXFIFO_DEPTH 8
  18. #define ATH_TX_ERROR 0x01
  19. @@ -745,7 +745,7 @@ void ath9k_csa_update(struct ath_softc *
  20. #define ATH_PAPRD_TIMEOUT 100 /* msecs */
  21. #define ATH_PLL_WORK_INTERVAL 100
  22. -void ath_tx_complete_poll_work(struct work_struct *work);
  23. +void ath_hw_check_work(struct work_struct *work);
  24. void ath_reset_work(struct work_struct *work);
  25. bool ath_hw_check(struct ath_softc *sc);
  26. void ath_hw_pll_work(struct work_struct *work);
  27. @@ -1053,7 +1053,7 @@ struct ath_softc {
  28. #ifdef CPTCFG_ATH9K_DEBUGFS
  29. struct ath9k_debug debug;
  30. #endif
  31. - struct delayed_work tx_complete_work;
  32. + struct delayed_work hw_check_work;
  33. struct delayed_work hw_pll_work;
  34. struct timer_list sleep_timer;
  35. --- a/drivers/net/wireless/ath/ath9k/init.c
  36. +++ b/drivers/net/wireless/ath/ath9k/init.c
  37. @@ -681,6 +681,7 @@ static int ath9k_init_softc(u16 devid, s
  38. INIT_WORK(&sc->hw_reset_work, ath_reset_work);
  39. INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
  40. INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
  41. + INIT_DELAYED_WORK(&sc->hw_check_work, ath_hw_check_work);
  42. ath9k_init_channel_context(sc);
  43. --- a/drivers/net/wireless/ath/ath9k/link.c
  44. +++ b/drivers/net/wireless/ath/ath9k/link.c
  45. @@ -20,20 +20,13 @@
  46. * TX polling - checks if the TX engine is stuck somewhere
  47. * and issues a chip reset if so.
  48. */
  49. -void ath_tx_complete_poll_work(struct work_struct *work)
  50. +static bool ath_tx_complete_check(struct ath_softc *sc)
  51. {
  52. - struct ath_softc *sc = container_of(work, struct ath_softc,
  53. - tx_complete_work.work);
  54. struct ath_txq *txq;
  55. int i;
  56. - bool needreset = false;
  57. -
  58. - if (sc->tx99_state) {
  59. - ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  60. - "skip tx hung detection on tx99\n");
  61. - return;
  62. - }
  63. + if (sc->tx99_state)
  64. + return true;
  65. for (i = 0; i < IEEE80211_NUM_ACS; i++) {
  66. txq = sc->tx.txq_map[i];
  67. @@ -41,25 +34,36 @@ void ath_tx_complete_poll_work(struct wo
  68. ath_txq_lock(sc, txq);
  69. if (txq->axq_depth) {
  70. if (txq->axq_tx_inprogress) {
  71. - needreset = true;
  72. ath_txq_unlock(sc, txq);
  73. - break;
  74. - } else {
  75. - txq->axq_tx_inprogress = true;
  76. + goto reset;
  77. }
  78. +
  79. + txq->axq_tx_inprogress = true;
  80. }
  81. ath_txq_unlock(sc, txq);
  82. }
  83. - if (needreset) {
  84. - ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  85. - "tx hung, resetting the chip\n");
  86. - ath9k_queue_reset(sc, RESET_TYPE_TX_HANG);
  87. + return true;
  88. +
  89. +reset:
  90. + ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  91. + "tx hung, resetting the chip\n");
  92. + ath9k_queue_reset(sc, RESET_TYPE_TX_HANG);
  93. + return false;
  94. +
  95. +}
  96. +
  97. +void ath_hw_check_work(struct work_struct *work)
  98. +{
  99. + struct ath_softc *sc = container_of(work, struct ath_softc,
  100. + hw_check_work.work);
  101. +
  102. + if (!ath_hw_check(sc) ||
  103. + !ath_tx_complete_check(sc))
  104. return;
  105. - }
  106. - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
  107. - msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT));
  108. + ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work,
  109. + msecs_to_jiffies(ATH_HW_CHECK_POLL_INT));
  110. }
  111. /*
  112. --- a/drivers/net/wireless/ath/ath9k/main.c
  113. +++ b/drivers/net/wireless/ath/ath9k/main.c
  114. @@ -181,7 +181,7 @@ void ath9k_ps_restore(struct ath_softc *
  115. static void __ath_cancel_work(struct ath_softc *sc)
  116. {
  117. cancel_work_sync(&sc->paprd_work);
  118. - cancel_delayed_work_sync(&sc->tx_complete_work);
  119. + cancel_delayed_work_sync(&sc->hw_check_work);
  120. cancel_delayed_work_sync(&sc->hw_pll_work);
  121. #ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
  122. @@ -198,7 +198,8 @@ void ath_cancel_work(struct ath_softc *s
  123. void ath_restart_work(struct ath_softc *sc)
  124. {
  125. - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
  126. + ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work,
  127. + ATH_HW_CHECK_POLL_INT);
  128. if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah))
  129. ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work,
  130. @@ -2091,7 +2092,7 @@ void __ath9k_flush(struct ieee80211_hw *
  131. int timeout;
  132. bool drain_txq;
  133. - cancel_delayed_work_sync(&sc->tx_complete_work);
  134. + cancel_delayed_work_sync(&sc->hw_check_work);
  135. if (ah->ah_flags & AH_UNPLUGGED) {
  136. ath_dbg(common, ANY, "Device has been unplugged!\n");
  137. @@ -2129,7 +2130,8 @@ void __ath9k_flush(struct ieee80211_hw *
  138. ath9k_ps_restore(sc);
  139. }
  140. - ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0);
  141. + ieee80211_queue_delayed_work(hw, &sc->hw_check_work,
  142. + ATH_HW_CHECK_POLL_INT);
  143. }
  144. static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw)
  145. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  146. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  147. @@ -2916,8 +2916,6 @@ int ath_tx_init(struct ath_softc *sc, in
  148. return error;
  149. }
  150. - INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work);
  151. -
  152. if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
  153. error = ath_tx_edma_init(sc);