ea79ab151f2586374034cbc74fb5fcf752387739
[openwrt.git] / package / mac80211 / patches / 573-ath9k_beacon_stop.patch
1 --- a/drivers/net/wireless/ath/ath9k/mac.c
2 +++ b/drivers/net/wireless/ath/ath9k/mac.c
3 @@ -174,84 +174,30 @@ bool ath9k_hw_abort_tx_dma(struct ath_hw
4 }
5 EXPORT_SYMBOL(ath9k_hw_abort_tx_dma);
6
7 -bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
8 +bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q)
9 {
10 -#define ATH9K_TX_STOP_DMA_TIMEOUT 4000 /* usec */
11 +#define ATH9K_TX_STOP_DMA_TIMEOUT 1000 /* usec */
12 #define ATH9K_TIME_QUANTUM 100 /* usec */
13 - struct ath_common *common = ath9k_hw_common(ah);
14 - struct ath9k_hw_capabilities *pCap = &ah->caps;
15 - struct ath9k_tx_queue_info *qi;
16 - u32 tsfLow, j, wait;
17 - u32 wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM;
18 -
19 - if (q >= pCap->total_queues) {
20 - ath_dbg(common, ATH_DBG_QUEUE,
21 - "Stopping TX DMA, invalid queue: %u\n", q);
22 - return false;
23 - }
24 -
25 - qi = &ah->txq[q];
26 - if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
27 - ath_dbg(common, ATH_DBG_QUEUE,
28 - "Stopping TX DMA, inactive queue: %u\n", q);
29 - return false;
30 - }
31 + int wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM;
32 + int wait;
33
34 REG_WRITE(ah, AR_Q_TXD, 1 << q);
35
36 for (wait = wait_time; wait != 0; wait--) {
37 if (ath9k_hw_numtxpending(ah, q) == 0)
38 break;
39 - udelay(ATH9K_TIME_QUANTUM);
40 - }
41
42 - if (ath9k_hw_numtxpending(ah, q)) {
43 - ath_dbg(common, ATH_DBG_QUEUE,
44 - "%s: Num of pending TX Frames %d on Q %d\n",
45 - __func__, ath9k_hw_numtxpending(ah, q), q);
46 -
47 - for (j = 0; j < 2; j++) {
48 - tsfLow = REG_READ(ah, AR_TSF_L32);
49 - REG_WRITE(ah, AR_QUIET2,
50 - SM(10, AR_QUIET2_QUIET_DUR));
51 - REG_WRITE(ah, AR_QUIET_PERIOD, 100);
52 - REG_WRITE(ah, AR_NEXT_QUIET_TIMER, tsfLow >> 10);
53 - REG_SET_BIT(ah, AR_TIMER_MODE,
54 - AR_QUIET_TIMER_EN);
55 -
56 - if ((REG_READ(ah, AR_TSF_L32) >> 10) == (tsfLow >> 10))
57 - break;
58 -
59 - ath_dbg(common, ATH_DBG_QUEUE,
60 - "TSF has moved while trying to set quiet time TSF: 0x%08x\n",
61 - tsfLow);
62 - }
63 -
64 - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
65 -
66 - udelay(200);
67 - REG_CLR_BIT(ah, AR_TIMER_MODE, AR_QUIET_TIMER_EN);
68 -
69 - wait = wait_time;
70 - while (ath9k_hw_numtxpending(ah, q)) {
71 - if ((--wait) == 0) {
72 - ath_err(common,
73 - "Failed to stop TX DMA in 100 msec after killing last frame\n");
74 - break;
75 - }
76 - udelay(ATH9K_TIME_QUANTUM);
77 - }
78 -
79 - REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
80 + udelay(ATH9K_TIME_QUANTUM);
81 }
82
83 REG_WRITE(ah, AR_Q_TXD, 0);
84 +
85 return wait != 0;
86
87 #undef ATH9K_TX_STOP_DMA_TIMEOUT
88 #undef ATH9K_TIME_QUANTUM
89 }
90 -EXPORT_SYMBOL(ath9k_hw_stoptxdma);
91 +EXPORT_SYMBOL(ath9k_hw_stop_dma_queue);
92
93 void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
94 {
95 --- a/drivers/net/wireless/ath/ath9k/mac.h
96 +++ b/drivers/net/wireless/ath/ath9k/mac.h
97 @@ -675,7 +675,7 @@ void ath9k_hw_txstart(struct ath_hw *ah,
98 void ath9k_hw_cleartxdesc(struct ath_hw *ah, void *ds);
99 u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
100 bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
101 -bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q);
102 +bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q);
103 bool ath9k_hw_abort_tx_dma(struct ath_hw *ah);
104 void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs);
105 bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
106 --- a/drivers/net/wireless/ath/ath9k/beacon.c
107 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
108 @@ -373,6 +373,7 @@ void ath_beacon_tasklet(unsigned long da
109 ath_dbg(common, ATH_DBG_BSTUCK,
110 "missed %u consecutive beacons\n",
111 sc->beacon.bmisscnt);
112 + ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq);
113 ath9k_hw_bstuck_nfcal(ah);
114 } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) {
115 ath_dbg(common, ATH_DBG_BSTUCK,
116 @@ -450,16 +451,6 @@ void ath_beacon_tasklet(unsigned long da
117 sc->beacon.updateslot = OK;
118 }
119 if (bfaddr != 0) {
120 - /*
121 - * Stop any current dma and put the new frame(s) on the queue.
122 - * This should never fail since we check above that no frames
123 - * are still pending on the queue.
124 - */
125 - if (!ath9k_hw_stoptxdma(ah, sc->beacon.beaconq)) {
126 - ath_err(common, "beacon queue %u did not stop?\n",
127 - sc->beacon.beaconq);
128 - }
129 -
130 /* NB: cabq traffic should already be queued and primed */
131 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bfaddr);
132 ath9k_hw_txstart(ah, sc->beacon.beaconq);
133 @@ -780,7 +771,7 @@ void ath9k_set_beaconing_status(struct a
134 ah->imask &= ~ATH9K_INT_SWBA;
135 ath9k_hw_set_interrupts(ah, ah->imask);
136 tasklet_kill(&sc->bcon_tasklet);
137 - ath9k_hw_stoptxdma(ah, sc->beacon.beaconq);
138 + ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq);
139 }
140 ath9k_ps_restore(sc);
141 }
This page took 0.052992 seconds and 3 git commands to generate.