aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-20 12:51:53 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-22 16:03:21 -0500
commit1381559ba48a04ca7c98f1b4c487bd44d0b75db5 (patch)
treeea46a8241ffe0b832454cdb4c861ae1105e8e545
parent0a62acb1c9da58b54cb1c9fa6604a36507a61d48 (diff)
ath9k: clean up processing of pending tx frames on reset
Dropping packets from aggregation sessions is usually not a good idea, as it might upset the synchronization of the BlockAck receive window of the remote node. The use of the retry_tx parameter to reset/tx-drain functions also seemed a bit arbitrary. This patch removes this parameter altogether and ensures that pending tx frames are not dropped for no good reason. 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.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c41
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c43
4 files changed, 32 insertions, 59 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 094a9322f092..885affd28f6e 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -334,9 +334,8 @@ void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq);
334void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq); 334void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq);
335void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq); 335void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq);
336void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); 336void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq);
337bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); 337bool ath_drain_all_txq(struct ath_softc *sc);
338void ath_draintxq(struct ath_softc *sc, 338void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq);
339 struct ath_txq *txq, bool retry_tx);
340void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); 339void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
341void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an); 340void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an);
342void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq); 341void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 531fffd801a3..a129f83806f3 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -198,7 +198,7 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
198 if (sc->nvifs > 1) { 198 if (sc->nvifs > 1) {
199 ath_dbg(common, BEACON, 199 ath_dbg(common, BEACON,
200 "Flushing previous cabq traffic\n"); 200 "Flushing previous cabq traffic\n");
201 ath_draintxq(sc, cabq, false); 201 ath_draintxq(sc, cabq);
202 } 202 }
203 } 203 }
204 204
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 407199ba79db..3e5082c5f5f0 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -182,7 +182,7 @@ static void ath_restart_work(struct ath_softc *sc)
182 ath_start_ani(sc); 182 ath_start_ani(sc);
183} 183}
184 184
185static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush) 185static bool ath_prepare_reset(struct ath_softc *sc, bool flush)
186{ 186{
187 struct ath_hw *ah = sc->sc_ah; 187 struct ath_hw *ah = sc->sc_ah;
188 bool ret = true; 188 bool ret = true;
@@ -196,7 +196,7 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
196 ath9k_debug_samp_bb_mac(sc); 196 ath9k_debug_samp_bb_mac(sc);
197 ath9k_hw_disable_interrupts(ah); 197 ath9k_hw_disable_interrupts(ah);
198 198
199 if (!ath_drain_all_txq(sc, retry_tx)) 199 if (!ath_drain_all_txq(sc))
200 ret = false; 200 ret = false;
201 201
202 if (!ath_stoprecv(sc)) 202 if (!ath_stoprecv(sc))
@@ -255,8 +255,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
255 return true; 255 return true;
256} 256}
257 257
258static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, 258static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
259 bool retry_tx)
260{ 259{
261 struct ath_hw *ah = sc->sc_ah; 260 struct ath_hw *ah = sc->sc_ah;
262 struct ath_common *common = ath9k_hw_common(ah); 261 struct ath_common *common = ath9k_hw_common(ah);
@@ -280,7 +279,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
280 hchan = ah->curchan; 279 hchan = ah->curchan;
281 } 280 }
282 281
283 if (!ath_prepare_reset(sc, retry_tx, flush)) 282 if (!ath_prepare_reset(sc, flush))
284 fastcc = false; 283 fastcc = false;
285 284
286 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", 285 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n",
@@ -319,7 +318,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
319 if (test_bit(SC_OP_INVALID, &sc->sc_flags)) 318 if (test_bit(SC_OP_INVALID, &sc->sc_flags))
320 return -EIO; 319 return -EIO;
321 320
322 r = ath_reset_internal(sc, hchan, false); 321 r = ath_reset_internal(sc, hchan);
323 322
324 return r; 323 return r;
325} 324}
@@ -549,23 +548,21 @@ chip_reset:
549#undef SCHED_INTR 548#undef SCHED_INTR
550} 549}
551 550
552static int ath_reset(struct ath_softc *sc, bool retry_tx) 551static int ath_reset(struct ath_softc *sc)
553{ 552{
554 int r; 553 int i, r;
555 554
556 ath9k_ps_wakeup(sc); 555 ath9k_ps_wakeup(sc);
557 556
558 r = ath_reset_internal(sc, NULL, retry_tx); 557 r = ath_reset_internal(sc, NULL);
559 558
560 if (retry_tx) { 559 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
561 int i; 560 if (!ATH_TXQ_SETUP(sc, i))
562 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 561 continue;
563 if (ATH_TXQ_SETUP(sc, i)) { 562
564 spin_lock_bh(&sc->tx.txq[i].axq_lock); 563 spin_lock_bh(&sc->tx.txq[i].axq_lock);
565 ath_txq_schedule(sc, &sc->tx.txq[i]); 564 ath_txq_schedule(sc, &sc->tx.txq[i]);
566 spin_unlock_bh(&sc->tx.txq[i].axq_lock); 565 spin_unlock_bh(&sc->tx.txq[i].axq_lock);
567 }
568 }
569 } 566 }
570 567
571 ath9k_ps_restore(sc); 568 ath9k_ps_restore(sc);
@@ -586,7 +583,7 @@ void ath_reset_work(struct work_struct *work)
586{ 583{
587 struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work); 584 struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work);
588 585
589 ath_reset(sc, true); 586 ath_reset(sc);
590} 587}
591 588
592/**********************/ 589/**********************/
@@ -804,7 +801,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
804 ath9k_hw_cfg_gpio_input(ah, ah->led_pin); 801 ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
805 } 802 }
806 803
807 ath_prepare_reset(sc, false, true); 804 ath_prepare_reset(sc, true);
808 805
809 if (sc->rx.frag) { 806 if (sc->rx.frag) {
810 dev_kfree_skb_any(sc->rx.frag); 807 dev_kfree_skb_any(sc->rx.frag);
@@ -1816,11 +1813,11 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
1816 if (drop) { 1813 if (drop) {
1817 ath9k_ps_wakeup(sc); 1814 ath9k_ps_wakeup(sc);
1818 spin_lock_bh(&sc->sc_pcu_lock); 1815 spin_lock_bh(&sc->sc_pcu_lock);
1819 drain_txq = ath_drain_all_txq(sc, false); 1816 drain_txq = ath_drain_all_txq(sc);
1820 spin_unlock_bh(&sc->sc_pcu_lock); 1817 spin_unlock_bh(&sc->sc_pcu_lock);
1821 1818
1822 if (!drain_txq) 1819 if (!drain_txq)
1823 ath_reset(sc, false); 1820 ath_reset(sc);
1824 1821
1825 ath9k_ps_restore(sc); 1822 ath9k_ps_restore(sc);
1826 ieee80211_wake_queues(hw); 1823 ieee80211_wake_queues(hw);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index ca4a0341294f..ac9ee67fbaa9 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -378,7 +378,7 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
378 378
379static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, 379static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
380 struct ath_buf *bf, struct list_head *bf_q, 380 struct ath_buf *bf, struct list_head *bf_q,
381 struct ath_tx_status *ts, int txok, bool retry) 381 struct ath_tx_status *ts, int txok)
382{ 382{
383 struct ath_node *an = NULL; 383 struct ath_node *an = NULL;
384 struct sk_buff *skb; 384 struct sk_buff *skb;
@@ -490,7 +490,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
490 } else if (!isaggr && txok) { 490 } else if (!isaggr && txok) {
491 /* transmit completion */ 491 /* transmit completion */
492 acked_cnt++; 492 acked_cnt++;
493 } else if ((tid->state & AGGR_CLEANUP) || !retry) { 493 } else if (tid->state & AGGR_CLEANUP) {
494 /* 494 /*
495 * cleanup in progress, just fail 495 * cleanup in progress, just fail
496 * the un-acked sub-frames 496 * the un-acked sub-frames
@@ -1331,23 +1331,6 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid
1331/* Queue Management */ 1331/* Queue Management */
1332/********************/ 1332/********************/
1333 1333
1334static void ath_txq_drain_pending_buffers(struct ath_softc *sc,
1335 struct ath_txq *txq)
1336{
1337 struct ath_atx_ac *ac, *ac_tmp;
1338 struct ath_atx_tid *tid, *tid_tmp;
1339
1340 list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
1341 list_del(&ac->list);
1342 ac->sched = false;
1343 list_for_each_entry_safe(tid, tid_tmp, &ac->tid_q, list) {
1344 list_del(&tid->list);
1345 tid->sched = false;
1346 ath_tid_drain(sc, txq, tid);
1347 }
1348 }
1349}
1350
1351struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) 1334struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
1352{ 1335{
1353 struct ath_hw *ah = sc->sc_ah; 1336 struct ath_hw *ah = sc->sc_ah;
@@ -1477,7 +1460,7 @@ static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
1477} 1460}
1478 1461
1479static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq, 1462static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq,
1480 struct list_head *list, bool retry_tx) 1463 struct list_head *list)
1481{ 1464{
1482 struct ath_buf *bf, *lastbf; 1465 struct ath_buf *bf, *lastbf;
1483 struct list_head bf_head; 1466 struct list_head bf_head;
@@ -1505,8 +1488,7 @@ static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq,
1505 txq->axq_ampdu_depth--; 1488 txq->axq_ampdu_depth--;
1506 1489
1507 if (bf_isampdu(bf)) 1490 if (bf_isampdu(bf))
1508 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0, 1491 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0);
1509 retry_tx);
1510 else 1492 else
1511 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 1493 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
1512 } 1494 }
@@ -1518,7 +1500,7 @@ static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq,
1518 * This assumes output has been stopped and 1500 * This assumes output has been stopped and
1519 * we do not need to block ath_tx_tasklet. 1501 * we do not need to block ath_tx_tasklet.
1520 */ 1502 */
1521void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) 1503void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq)
1522{ 1504{
1523 ath_txq_lock(sc, txq); 1505 ath_txq_lock(sc, txq);
1524 1506
@@ -1526,8 +1508,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1526 int idx = txq->txq_tailidx; 1508 int idx = txq->txq_tailidx;
1527 1509
1528 while (!list_empty(&txq->txq_fifo[idx])) { 1510 while (!list_empty(&txq->txq_fifo[idx])) {
1529 ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx], 1511 ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx]);
1530 retry_tx);
1531 1512
1532 INCR(idx, ATH_TXFIFO_DEPTH); 1513 INCR(idx, ATH_TXFIFO_DEPTH);
1533 } 1514 }
@@ -1536,16 +1517,12 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1536 1517
1537 txq->axq_link = NULL; 1518 txq->axq_link = NULL;
1538 txq->axq_tx_inprogress = false; 1519 txq->axq_tx_inprogress = false;
1539 ath_drain_txq_list(sc, txq, &txq->axq_q, retry_tx); 1520 ath_drain_txq_list(sc, txq, &txq->axq_q);
1540
1541 /* flush any pending frames if aggregation is enabled */
1542 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) && !retry_tx)
1543 ath_txq_drain_pending_buffers(sc, txq);
1544 1521
1545 ath_txq_unlock_complete(sc, txq); 1522 ath_txq_unlock_complete(sc, txq);
1546} 1523}
1547 1524
1548bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) 1525bool ath_drain_all_txq(struct ath_softc *sc)
1549{ 1526{
1550 struct ath_hw *ah = sc->sc_ah; 1527 struct ath_hw *ah = sc->sc_ah;
1551 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1528 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -1581,7 +1558,7 @@ bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
1581 */ 1558 */
1582 txq = &sc->tx.txq[i]; 1559 txq = &sc->tx.txq[i];
1583 txq->stopped = false; 1560 txq->stopped = false;
1584 ath_draintxq(sc, txq, retry_tx); 1561 ath_draintxq(sc, txq);
1585 } 1562 }
1586 1563
1587 return !npend; 1564 return !npend;
@@ -2191,7 +2168,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
2191 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); 2168 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
2192 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); 2169 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
2193 } else 2170 } else
2194 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true); 2171 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
2195 2172
2196 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) 2173 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
2197 ath_txq_schedule(sc, txq); 2174 ath_txq_schedule(sc, txq);