aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-05-17 06:58:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-05-17 14:31:08 -0400
commit16e23428024e4dc6b5ba5f6d36c57c49d33fe85b (patch)
treeb90bf843fd25d0cb447f03d91095c9e1d2c95e65
parente99c60b58b595eaa1c279922ae29d5397c787294 (diff)
ath9k: fix aggregation stop/flush handling
When aggregation stop is requested, don't run the mac80211 aggregation stop callback yet, while the session is still blocked. Also, when aggregation flush is requested, don't run the callback at all. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c61
3 files changed, 48 insertions, 25 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 8a1888d02070..366002f266f8 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -254,6 +254,7 @@ struct ath_atx_tid {
254 int sched; 254 int sched;
255 int paused; 255 int paused;
256 u8 state; 256 u8 state;
257 bool stop_cb;
257}; 258};
258 259
259struct ath_node { 260struct ath_node {
@@ -351,7 +352,8 @@ void ath_tx_tasklet(struct ath_softc *sc);
351void ath_tx_edma_tasklet(struct ath_softc *sc); 352void ath_tx_edma_tasklet(struct ath_softc *sc);
352int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 353int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
353 u16 tid, u16 *ssn); 354 u16 tid, u16 *ssn);
354void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 355bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
356 bool flush);
355void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 357void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
356 358
357void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); 359void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a18414b5948b..2382d1262e7f 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1687,6 +1687,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1687 u16 tid, u16 *ssn, u8 buf_size) 1687 u16 tid, u16 *ssn, u8 buf_size)
1688{ 1688{
1689 struct ath_softc *sc = hw->priv; 1689 struct ath_softc *sc = hw->priv;
1690 bool flush = false;
1690 int ret = 0; 1691 int ret = 0;
1691 1692
1692 local_bh_disable(); 1693 local_bh_disable();
@@ -1703,12 +1704,13 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1703 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1704 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1704 ath9k_ps_restore(sc); 1705 ath9k_ps_restore(sc);
1705 break; 1706 break;
1706 case IEEE80211_AMPDU_TX_STOP_CONT:
1707 case IEEE80211_AMPDU_TX_STOP_FLUSH: 1707 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: 1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1709 flush = true;
1710 case IEEE80211_AMPDU_TX_STOP_CONT:
1709 ath9k_ps_wakeup(sc); 1711 ath9k_ps_wakeup(sc);
1710 ath_tx_aggr_stop(sc, sta, tid); 1712 if (ath_tx_aggr_stop(sc, sta, tid, flush))
1711 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1713 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1712 ath9k_ps_restore(sc); 1714 ath9k_ps_restore(sc);
1713 break; 1715 break;
1714 case IEEE80211_AMPDU_TX_OPERATIONAL: 1716 case IEEE80211_AMPDU_TX_OPERATIONAL:
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index eab0fcb7ded6..a47bf6924efd 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -164,7 +164,20 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
164 ARRAY_SIZE(bf->rates)); 164 ARRAY_SIZE(bf->rates));
165} 165}
166 166
167static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 167static void ath_tx_clear_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
168{
169 tid->state &= ~AGGR_ADDBA_COMPLETE;
170 tid->state &= ~AGGR_CLEANUP;
171 if (!tid->stop_cb)
172 return;
173
174 ieee80211_start_tx_ba_cb_irqsafe(tid->an->vif, tid->an->sta->addr,
175 tid->tidno);
176 tid->stop_cb = false;
177}
178
179static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
180 bool flush_packets)
168{ 181{
169 struct ath_txq *txq = tid->ac->txq; 182 struct ath_txq *txq = tid->ac->txq;
170 struct sk_buff *skb; 183 struct sk_buff *skb;
@@ -181,16 +194,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
181 while ((skb = __skb_dequeue(&tid->buf_q))) { 194 while ((skb = __skb_dequeue(&tid->buf_q))) {
182 fi = get_frame_info(skb); 195 fi = get_frame_info(skb);
183 bf = fi->bf; 196 bf = fi->bf;
197 if (!bf && !flush_packets)
198 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
184 199
185 if (!bf) { 200 if (!bf) {
186 bf = ath_tx_setup_buffer(sc, txq, tid, skb); 201 ieee80211_free_txskb(sc->hw, skb);
187 if (!bf) { 202 continue;
188 ieee80211_free_txskb(sc->hw, skb);
189 continue;
190 }
191 } 203 }
192 204
193 if (fi->retries) { 205 if (fi->retries || flush_packets) {
194 list_add_tail(&bf->list, &bf_head); 206 list_add_tail(&bf->list, &bf_head);
195 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 207 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
196 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 208 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -201,12 +213,10 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
201 } 213 }
202 } 214 }
203 215
204 if (tid->baw_head == tid->baw_tail) { 216 if (tid->baw_head == tid->baw_tail)
205 tid->state &= ~AGGR_ADDBA_COMPLETE; 217 ath_tx_clear_tid(sc, tid);
206 tid->state &= ~AGGR_CLEANUP;
207 }
208 218
209 if (sendbar) { 219 if (sendbar && !flush_packets) {
210 ath_txq_unlock(sc, txq); 220 ath_txq_unlock(sc, txq);
211 ath_send_bar(tid, tid->seq_start); 221 ath_send_bar(tid, tid->seq_start);
212 ath_txq_lock(sc, txq); 222 ath_txq_lock(sc, txq);
@@ -602,7 +612,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
602 } 612 }
603 613
604 if (tid->state & AGGR_CLEANUP) 614 if (tid->state & AGGR_CLEANUP)
605 ath_tx_flush_tid(sc, tid); 615 ath_tx_flush_tid(sc, tid, false);
606 616
607 rcu_read_unlock(); 617 rcu_read_unlock();
608 618
@@ -1256,18 +1266,23 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1256 return 0; 1266 return 0;
1257} 1267}
1258 1268
1259void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 1269bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
1270 bool flush)
1260{ 1271{
1261 struct ath_node *an = (struct ath_node *)sta->drv_priv; 1272 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1262 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); 1273 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
1263 struct ath_txq *txq = txtid->ac->txq; 1274 struct ath_txq *txq = txtid->ac->txq;
1275 bool ret = !flush;
1276
1277 if (flush)
1278 txtid->stop_cb = false;
1264 1279
1265 if (txtid->state & AGGR_CLEANUP) 1280 if (txtid->state & AGGR_CLEANUP)
1266 return; 1281 return false;
1267 1282
1268 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { 1283 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
1269 txtid->state &= ~AGGR_ADDBA_PROGRESS; 1284 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1270 return; 1285 return ret;
1271 } 1286 }
1272 1287
1273 ath_txq_lock(sc, txq); 1288 ath_txq_lock(sc, txq);
@@ -1279,13 +1294,17 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
1279 * TID can only be reused after all in-progress subframes have been 1294 * TID can only be reused after all in-progress subframes have been
1280 * completed. 1295 * completed.
1281 */ 1296 */
1282 if (txtid->baw_head != txtid->baw_tail) 1297 if (txtid->baw_head != txtid->baw_tail) {
1283 txtid->state |= AGGR_CLEANUP; 1298 txtid->state |= AGGR_CLEANUP;
1284 else 1299 ret = false;
1300 txtid->stop_cb = !flush;
1301 } else {
1285 txtid->state &= ~AGGR_ADDBA_COMPLETE; 1302 txtid->state &= ~AGGR_ADDBA_COMPLETE;
1303 }
1286 1304
1287 ath_tx_flush_tid(sc, txtid); 1305 ath_tx_flush_tid(sc, txtid, flush);
1288 ath_txq_unlock_complete(sc, txq); 1306 ath_txq_unlock_complete(sc, txq);
1307 return ret;
1289} 1308}
1290 1309
1291void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, 1310void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
@@ -2415,6 +2434,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2415 tid->ac = &an->ac[acno]; 2434 tid->ac = &an->ac[acno];
2416 tid->state &= ~AGGR_ADDBA_COMPLETE; 2435 tid->state &= ~AGGR_ADDBA_COMPLETE;
2417 tid->state &= ~AGGR_ADDBA_PROGRESS; 2436 tid->state &= ~AGGR_ADDBA_PROGRESS;
2437 tid->stop_cb = false;
2418 } 2438 }
2419 2439
2420 for (acno = 0, ac = &an->ac[acno]; 2440 for (acno = 0, ac = &an->ac[acno];
@@ -2451,8 +2471,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2451 } 2471 }
2452 2472
2453 ath_tid_drain(sc, txq, tid); 2473 ath_tid_drain(sc, txq, tid);
2454 tid->state &= ~AGGR_ADDBA_COMPLETE; 2474 ath_tx_clear_tid(sc, tid);
2455 tid->state &= ~AGGR_CLEANUP;
2456 2475
2457 ath_txq_unlock(sc, txq); 2476 ath_txq_unlock(sc, txq);
2458 } 2477 }