ath9k: do not put the hardware to full-sleep while tx is pending
[oweals/openwrt.git] / package / mac80211 / patches / 563-ath9k_fix_full_sleep_tx.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -118,7 +118,7 @@ void ath9k_ps_restore(struct ath_softc *
4         if (--sc->ps_usecount != 0)
5                 goto unlock;
6  
7 -       if (sc->ps_idle)
8 +       if (sc->ps_idle && !(sc->ps_flags & PS_WAIT_FOR_TX_ACK))
9                 mode = ATH9K_PM_FULL_SLEEP;
10         else if (sc->ps_enabled &&
11                  !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
12 --- a/drivers/net/wireless/ath/ath9k/xmit.c
13 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
14 @@ -1983,7 +1983,7 @@ static void ath_tx_complete(struct ath_s
15                 skb_pull(skb, padsize);
16         }
17  
18 -       if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) {
19 +       if ((sc->ps_flags & PS_WAIT_FOR_TX_ACK) && !txq->axq_depth) {
20                 sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK;
21                 ath_dbg(common, ATH_DBG_PS,
22                         "Going back to sleep after having received TX status (0x%lx)\n",