freebsd-dev/sys/dev/ath
Adrian Chadd 0b96ef630b Delay sequence number allocation for A-MPDU until just before the frame
is queued to the hardware.

Because multiple concurrent paths can execute ath_start(), multiple
concurrent paths can push frames into the software/hardware TX queue
and since preemption/interrupting can occur, there's the possibility
that a gap in time will occur between allocating the sequence number
and queuing it to the hardware.

Because of this, it's possible that a thread will have allocated a
sequence number and then be preempted by another thread doing the same.
If the second thread sneaks the frame into the BAW, the (earlier) sequence
number of the first frame will be now outside the BAW and will result
in the frame being constantly re-added to the tail of the queue.
There it will live until the sequence numbers cycle around again.

This also creates a hole in the RX BAW tracking which can also cause
issues.

This patch delays the sequence number allocation to occur only just before
the frame is going to be added to the BAW.  I've been wanting to do this
anyway as part of a general code tidyup but I've not gotten around to it.
This fixes the PR.

However, it still makes it quite difficult to try and ensure in-order
queuing and dequeuing of frames. Since multiple copies of ath_start()
can be run at the same time (eg one TXing process thread, one TX completion
task/one RX task) the driver may end up having frames dequeued and pushed
into the hardware slightly/occasionally out of order.

And, to make matters more annoying, net80211 may have the same behaviour -
in the non-aggregation case, the TX code allocates sequence numbers
before it's thrown to the driver.  I'll open another PR to investigate
this and potentially introduce some kind of final-pass TX serialisation
before frames are thrown to the hardware.  It's also very likely worthwhile
adding some debugging code into ath(4) and net80211 to catch when/if this
does occur.

PR:		kern/166190
2012-03-20 04:50:25 +00:00
..
ath_dfs/null Contribute some example code which demonstrates how to initialise the 2012-02-06 20:23:21 +00:00
ath_hal Break out the radar code into a separate source file. 2012-02-20 03:07:07 +00:00
ath_rate Add in some debugging code to check whether the current rate table has 2012-02-26 06:04:44 +00:00
ah_osdep.c Introduce a work-around for issues with the AR5416 based MAC on SMP devices. 2011-11-09 22:39:44 +00:00
ah_osdep.h Fix AR5416 and later parts when building with AH_DEBUG or similar defined: 2009-07-06 20:51:54 +00:00
if_ath_ahb.c Begin merging in some of my 802.11n TX aggregation driver changes. 2011-11-08 02:12:11 +00:00
if_ath_debug.c Delay sequence number allocation for A-MPDU until just before the frame 2012-03-20 04:50:25 +00:00
if_ath_debug.h Add some new ath(4) debugging bits, from my if_ath_tx 11n TX branch. 2011-10-29 07:17:47 +00:00
if_ath_keycache.c Add a 'vap' to ath_keyset(). 2011-11-08 19:25:52 +00:00
if_ath_keycache.h Add a 'vap' to ath_keyset(). 2011-11-08 19:25:52 +00:00
if_ath_led.c Since the only thing with a mux is the AR5416 and later, and we're now 2011-12-26 07:48:29 +00:00
if_ath_led.h Refactor out the software LED config code into a common function, called 2011-12-26 05:46:22 +00:00
if_ath_misc.h Introduce TX aggregation and software TX queue management 2011-11-08 22:43:13 +00:00
if_ath_pci.c Conditionally compile the PCI latency workaround; I think it's 2011-11-08 18:37:52 +00:00
if_ath_sysctl.c Don't flood the cabq/mcastq with frames. 2012-03-10 04:14:04 +00:00
if_ath_sysctl.h Break out most of the HAL related tweaks into a per-HAL instance, 2011-06-23 02:38:36 +00:00
if_ath_tx_ht.c Delay sequence number allocation for A-MPDU until just before the frame 2012-03-20 04:50:25 +00:00
if_ath_tx_ht.h Introduce TX aggregation and software TX queue management 2011-11-08 22:43:13 +00:00
if_ath_tx.c Delay sequence number allocation for A-MPDU until just before the frame 2012-03-20 04:50:25 +00:00
if_ath_tx.h Delay sequence number allocation for A-MPDU until just before the frame 2012-03-20 04:50:25 +00:00
if_ath.c Fix a couple of debugging outputs. 2012-03-16 23:24:27 +00:00
if_athdfs.h Change the prototype so the radar enable can fail. 2012-01-28 21:44:42 +00:00
if_athioctl.h Don't flood the cabq/mcastq with frames. 2012-03-10 04:14:04 +00:00
if_athrate.h Introduce TX aggregation and software TX queue management 2011-11-08 22:43:13 +00:00
if_athvar.h Delay sequence number allocation for A-MPDU until just before the frame 2012-03-20 04:50:25 +00:00