Deleted Added
full compact
if_ath_tx.c (250796) if_ath_tx.c (250866)
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3 * Copyright (c) 2010-2012 Adrian Chadd, Xenion Pty Ltd
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGES.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3 * Copyright (c) 2010-2012 Adrian Chadd, Xenion Pty Ltd
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGES.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 250796 2013-05-19 01:33:17Z adrian $");
32__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 250866 2013-05-21 18:13:57Z adrian $");
33
34/*
35 * Driver for the Atheros Wireless LAN controller.
36 *
37 * This software is derived from work of Atsushi Onoe; his contribution
38 * is greatly appreciated.
39 */
40

--- 3062 unchanged lines hidden (view full) ---

3103 */
3104 ATH_TID_INSERT_TAIL(atid, bf, bf_list);
3105
3106 /*
3107 * If the hardware queue isn't busy, direct dispatch
3108 * the head frame in the list. Don't schedule the
3109 * TID - let it build some more frames first?
3110 *
33
34/*
35 * Driver for the Atheros Wireless LAN controller.
36 *
37 * This software is derived from work of Atsushi Onoe; his contribution
38 * is greatly appreciated.
39 */
40

--- 3062 unchanged lines hidden (view full) ---

3103 */
3104 ATH_TID_INSERT_TAIL(atid, bf, bf_list);
3105
3106 /*
3107 * If the hardware queue isn't busy, direct dispatch
3108 * the head frame in the list. Don't schedule the
3109 * TID - let it build some more frames first?
3110 *
3111 * When running A-MPDU, always just check the hardware
3112 * queue depth against the aggregate frame limit.
3113 * We don't want to burst a large number of single frames
3114 * out to the hardware; we want to aggressively hold back.
3115 *
3111 * Otherwise, schedule the TID.
3112 */
3116 * Otherwise, schedule the TID.
3117 */
3113 if (txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit) {
3118 /* XXX TXQ locking */
3119 if (txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit_aggr) {
3114 bf = ATH_TID_FIRST(atid);
3115 ATH_TID_REMOVE(atid, bf, bf_list);
3116
3117 /*
3118 * Ensure it's definitely treated as a non-AMPDU
3119 * frame - this information may have been left
3120 * over from a previous attempt.
3121 */

--- 7 unchanged lines hidden (view full) ---

3129 __func__);
3130 } else {
3131 DPRINTF(sc, ATH_DEBUG_SW_TX,
3132 "%s: ampdu; swq'ing\n",
3133 __func__);
3134
3135 ath_tx_tid_sched(sc, atid);
3136 }
3120 bf = ATH_TID_FIRST(atid);
3121 ATH_TID_REMOVE(atid, bf, bf_list);
3122
3123 /*
3124 * Ensure it's definitely treated as a non-AMPDU
3125 * frame - this information may have been left
3126 * over from a previous attempt.
3127 */

--- 7 unchanged lines hidden (view full) ---

3135 __func__);
3136 } else {
3137 DPRINTF(sc, ATH_DEBUG_SW_TX,
3138 "%s: ampdu; swq'ing\n",
3139 __func__);
3140
3141 ath_tx_tid_sched(sc, atid);
3142 }
3137 } else if (txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit) {
3143 /*
3144 * If we're not doing A-MPDU, be prepared to direct dispatch
3145 * up to both limits if possible. This particular corner
3146 * case may end up with packet starvation between aggregate
3147 * traffic and non-aggregate traffic: we wnat to ensure
3148 * that non-aggregate stations get a few frames queued to the
3149 * hardware before the aggregate station(s) get their chance.
3150 *
3151 * So if you only ever see a couple of frames direct dispatched
3152 * to the hardware from a non-AMPDU client, check both here
3153 * and in the software queue dispatcher to ensure that those
3154 * non-AMPDU stations get a fair chance to transmit.
3155 */
3156 /* XXX TXQ locking */
3157 } else if ((txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit_nonaggr) &&
3158 (txq->axq_aggr_depth < sc->sc_hwq_limit_aggr)) {
3138 /* AMPDU not running, attempt direct dispatch */
3139 DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__);
3140 /* See if clrdmask needs to be set */
3141 ath_tx_update_clrdmask(sc, atid, bf);
3142
3143 /*
3144 * Update the current leak count if
3145 * we're leaking frames; and set the

--- 2188 unchanged lines hidden (view full) ---

5334
5335 /*
5336 * Break out if ath_tx_form_aggr() indicated
5337 * there can't be any further progress (eg BAW is full.)
5338 * Checking for an empty txq is done above.
5339 *
5340 * XXX locking on txq here?
5341 */
3159 /* AMPDU not running, attempt direct dispatch */
3160 DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__);
3161 /* See if clrdmask needs to be set */
3162 ath_tx_update_clrdmask(sc, atid, bf);
3163
3164 /*
3165 * Update the current leak count if
3166 * we're leaking frames; and set the

--- 2188 unchanged lines hidden (view full) ---

5355
5356 /*
5357 * Break out if ath_tx_form_aggr() indicated
5358 * there can't be any further progress (eg BAW is full.)
5359 * Checking for an empty txq is done above.
5360 *
5361 * XXX locking on txq here?
5362 */
5342 if (txq->axq_aggr_depth >= sc->sc_hwq_limit ||
5363 /* XXX TXQ locking */
5364 if (txq->axq_aggr_depth >= sc->sc_hwq_limit_aggr ||
5343 (status == ATH_AGGR_BAW_CLOSED ||
5344 status == ATH_AGGR_LEAK_CLOSED))
5345 break;
5346 }
5347}
5348
5349/*
5350 * Schedule some packets from the given node/TID to the hardware.
5365 (status == ATH_AGGR_BAW_CLOSED ||
5366 status == ATH_AGGR_LEAK_CLOSED))
5367 break;
5368 }
5369}
5370
5371/*
5372 * Schedule some packets from the given node/TID to the hardware.
5373 *
5374 * XXX TODO: this routine doesn't enforce the maximum TXQ depth.
5375 * It just dumps frames into the TXQ. We should limit how deep
5376 * the transmit queue can grow for frames dispatched to the given
5377 * TXQ.
5378 *
5379 * To avoid locking issues, either we need to own the TXQ lock
5380 * at this point, or we need to pass in the maximum frame count
5381 * from the caller.
5351 */
5352void
5353ath_tx_tid_hw_queue_norm(struct ath_softc *sc, struct ath_node *an,
5354 struct ath_tid *tid)
5355{
5356 struct ath_buf *bf;
5357 struct ath_txq *txq = sc->sc_ac2q[tid->ac];
5358

--- 88 unchanged lines hidden (view full) ---

5447 struct ath_tid *tid, *next, *last;
5448
5449 ATH_TX_LOCK_ASSERT(sc);
5450
5451 /*
5452 * Don't schedule if the hardware queue is busy.
5453 * This (hopefully) gives some more time to aggregate
5454 * some packets in the aggregation queue.
5382 */
5383void
5384ath_tx_tid_hw_queue_norm(struct ath_softc *sc, struct ath_node *an,
5385 struct ath_tid *tid)
5386{
5387 struct ath_buf *bf;
5388 struct ath_txq *txq = sc->sc_ac2q[tid->ac];
5389

--- 88 unchanged lines hidden (view full) ---

5478 struct ath_tid *tid, *next, *last;
5479
5480 ATH_TX_LOCK_ASSERT(sc);
5481
5482 /*
5483 * Don't schedule if the hardware queue is busy.
5484 * This (hopefully) gives some more time to aggregate
5485 * some packets in the aggregation queue.
5486 *
5487 * XXX It doesn't stop a parallel sender from sneaking
5488 * in transmitting a frame!
5455 */
5489 */
5456 if (txq->axq_aggr_depth >= sc->sc_hwq_limit) {
5490 /* XXX TXQ locking */
5491 if (txq->axq_aggr_depth + txq->fifo.axq_depth >= sc->sc_hwq_limit_aggr) {
5457 sc->sc_aggr_stats.aggr_sched_nopkt++;
5458 return;
5459 }
5492 sc->sc_aggr_stats.aggr_sched_nopkt++;
5493 return;
5494 }
5495 if (txq->axq_depth >= sc->sc_hwq_limit_nonaggr) {
5496 sc->sc_aggr_stats.aggr_sched_nopkt++;
5497 return;
5498 }
5460
5461 last = TAILQ_LAST(&txq->axq_tidq, axq_t_s);
5462
5463 TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) {
5464 /*
5465 * Suspend paused queues here; they'll be resumed
5466 * once the addba completes or times out.
5467 */

--- 16 unchanged lines hidden (view full) ---

5484 if (tid->axq_depth != 0)
5485 ath_tx_tid_sched(sc, tid);
5486
5487 /*
5488 * Give the software queue time to aggregate more
5489 * packets. If we aren't running aggregation then
5490 * we should still limit the hardware queue depth.
5491 */
5499
5500 last = TAILQ_LAST(&txq->axq_tidq, axq_t_s);
5501
5502 TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) {
5503 /*
5504 * Suspend paused queues here; they'll be resumed
5505 * once the addba completes or times out.
5506 */

--- 16 unchanged lines hidden (view full) ---

5523 if (tid->axq_depth != 0)
5524 ath_tx_tid_sched(sc, tid);
5525
5526 /*
5527 * Give the software queue time to aggregate more
5528 * packets. If we aren't running aggregation then
5529 * we should still limit the hardware queue depth.
5530 */
5492 if (txq->axq_depth >= sc->sc_hwq_limit) {
5531 /* XXX TXQ locking */
5532 if (txq->axq_aggr_depth + txq->fifo.axq_depth >= sc->sc_hwq_limit_aggr) {
5493 break;
5494 }
5533 break;
5534 }
5535 if (txq->axq_depth >= sc->sc_hwq_limit_nonaggr) {
5536 break;
5537 }
5495
5496 /*
5497 * If this was the last entry on the original list, stop.
5498 * Otherwise nodes that have been rescheduled onto the end
5499 * of the TID FIFO list will just keep being rescheduled.
5500 *
5501 * XXX What should we do about nodes that were paused
5502 * but are pending a leaking frame in response to a ps-poll?

--- 526 unchanged lines hidden ---
5538
5539 /*
5540 * If this was the last entry on the original list, stop.
5541 * Otherwise nodes that have been rescheduled onto the end
5542 * of the TID FIFO list will just keep being rescheduled.
5543 *
5544 * XXX What should we do about nodes that were paused
5545 * but are pending a leaking frame in response to a ps-poll?

--- 526 unchanged lines hidden ---