#
3ee1a36e |
| 22-Nov-2011 |
Peter Grehan <grehan@FreeBSD.org> |
IFC @ r227804
Pull in the virtio drivers from head.
|
#
a2d8240d |
| 21-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Use the correct lock when calling msleep().
This fixes panics that users have been seeing when operating in station mode, where the interface undergoes a lot more resets then in hostap mode (ie whil
Use the correct lock when calling msleep().
This fixes panics that users have been seeing when operating in station mode, where the interface undergoes a lot more resets then in hostap mode (ie whilst doing channel scanning.)
Reported by: arundel, wblock@wonkity.com Sponsored by: Hobnob, Inc.
show more ...
|
#
5856d663 |
| 21-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Fix some whitespace pollution.
|
#
9a842e8b |
| 19-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Begin breaking apart the receive setup/stop path in preparation for more "correct" handling of frames in the RX pending queue during interface transitions.
* ath_stoprecv() doesn't blank out the des
Begin breaking apart the receive setup/stop path in preparation for more "correct" handling of frames in the RX pending queue during interface transitions.
* ath_stoprecv() doesn't blank out the descriptor list - that's what ath_startrecv() does. So, change a comment to reflect that.
* ath_stoprecv() does include a large (3ms) delay to let pending DMA complete. However, I'm under the impression that the stopdma hal method does check for a bit in the PCU to indicate DMA has stopped. So, to help with fast abort and restart, modify ath_stoprecv() to take a flag which indicates whether this is needed.
* Modify the uses of ath_stoprecv() to pass in a flag to support the existing behaviour (ie, do the delay.)
* Remove some duplicate PCU teardown code (which wasn't shutting down DMA, so it wasn't entirely correct..) and replace it with a call to ath_stoprecv(sc, 0) - which disables the DELAY call.
The upshoot of this is now channel change doesn't simply drop completed frames on the floor, but instead it cleanly handles those frames. It still discards pending TX frames in the software and hardware queues as there's no (current) logic which forcibly recalculates the rate control information (or whether they're appropriate to be on the TX queue after a channel change), that'll come later.
This still doesn't stop all the sources of queue stalls but it does tidy up some of the code duplication.
To be complete, queue stalls now occur during normal behaviour - they only occur after some kind of broken behaviour causes an interface or node flush, upsetting the TX/RX BAW. Subsequent commits will incrementally fix these and other related issues.
Sponsored by: Hobnob, Inc.
show more ...
|
#
ef27340c |
| 18-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Flesh out some slightly dirty reset/channel change serialisation code for the ath(4) driver.
Currently, there's nothing stopping reset, channel change and general TX/RX from overlapping with each ot
Flesh out some slightly dirty reset/channel change serialisation code for the ath(4) driver.
Currently, there's nothing stopping reset, channel change and general TX/RX from overlapping with each other. This wasn't a big deal with pre-11n traffic as it just results in some dropped frames. It's possible this may have also caused some inconsistencies and badly-setup hardware.
Since locks can't be held across all of this (the Linux solution) due to LORs with the network stack locks, some state counter variables are used to track what parts of the code the driver is currently in.
When the hardware is being reset, it disables the taskqueue and waits for pending interrupts, tx, rx and tx completion before it begins the reset or channel change.
TX and RX both abort if called during an active reset or channel change.
Finally, the reset path now doesn't flush frames if ATH_RESET_NOLOSS is set. Instead, completed TX and RX frames are passed back up to net80211 before the reset occurs.
This is not without problems:
* Raw frame xmit are just dropped, rather than placed on a queue. The net80211 stack should be the one which queues these frames rather than the driver.
* It's all very messy. It'd be better if these hardware operations were serialised on some kind of work queue, rather than hoping they can be run in parallel.
* The taskqueue block/unblock may occur in parallel with the newstate() function - which shuts down the taskqueue and restarts it once the new state is known. It's likely these operations should be refcounted so the taskqueue is restored once no other areas in the code wish to suspend operations.
* .. interrupt disable/enable should likely be refcounted as well.
With this work, the driver does not drop frames during stuck beacon or fatal errors and thus 11n traffic continues to run correctly. Default and full resets however do still drop frames and it's possible this may occur, causing traffic loss and session stalls.
Sponsored by: Hobnob, Inc.
show more ...
|
#
ddbe3036 |
| 09-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Introduce a work-around for issues with the AR5416 based MAC on SMP devices.
The AR5416 MAC (which shows up in the AR5008, AR9001, AR9002 devices) has issues with PCI transactions on SMP machines. T
Introduce a work-around for issues with the AR5416 based MAC on SMP devices.
The AR5416 MAC (which shows up in the AR5008, AR9001, AR9002 devices) has issues with PCI transactions on SMP machines. This work-around enforces that register access is serialised through a (global for now) spinlock.
This should stop the hangs people have seen with the AR5416 PCI devices on SMP hosts.
Obtained by: Linux, Atheros
show more ...
|
#
31fdf3d6 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Fix the KTR option to compile by default - it was referencing some unmerged interrupt status debugging code from my branch.
* Add ah_intrstate[8] which will have the record of the last call to ath
Fix the KTR option to compile by default - it was referencing some unmerged interrupt status debugging code from my branch.
* Add ah_intrstate[8] which will have the record of the last call to ath_hal_getintr(). * Wrap the KTR code behind ATH_KTR_INTR_DEBUG. * Add the HAL interrupt debugging behind AH_INTERRUPT_DEBUGGING.
This is only done for the AR5416 and later NICs but it will be trivial to add to the earlier NICs if required.
Neither are enabled by default, although to minimise HAL binary API differences, the ah_intrstate[] array is always compiled into the ath_hal struct.
show more ...
|
#
eb6f0de0 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Introduce TX aggregation and software TX queue management for Atheros AR5416 and later wireless devices.
This is a very large commit - the complete history can be found in the user/adrian/if_ath_tx
Introduce TX aggregation and software TX queue management for Atheros AR5416 and later wireless devices.
This is a very large commit - the complete history can be found in the user/adrian/if_ath_tx branch.
Legacy (ie, pre-AR5416) devices also use the per-software TXQ support and (in theory) can support non-aggregation ADDBA sessions. However, the net80211 stack doesn't currently support this.
In summary:
TX path:
* queued frames normally go onto a per-TID, per-node queue * some special frames (eg ADDBA control frames) are thrown directly onto the relevant hardware queue so they can go out before any software queued frames are queued. * Add methods to create, suspend, resume and tear down an aggregation session. * Add in software retransmission of both normal and aggregate frames. * Add in completion handling of aggregate frames, including parsing the block ack bitmap provided by the hardware. * Write an aggregation function which can assemble frames into an aggregate based on the selected rate control and channel configuration. * The per-TID queues are locked based on their target hardware TX queue. This matches what ath9k/atheros does, and thus simplified porting over some of the aggregation logic. * When doing TX aggregation, stick the sequence number allocation in the TX path rather than net80211 TX path, and protect it by the TXQ lock.
Rate control:
* Delay rate control selection until the frame is about to be queued to the hardware, so retried frames can have their rate control choices changed. Frames with a static rate control selection have that applied before each TX, just to simplify the TX path (ie, not have "static" and "dynamic" rate control special cased.) * Teach ath_rate_sample about aggregates - both completion and errors. * Add an EWMA for tracking what the current "good" MCS rate is based on failure rates.
Misc:
* Introduce a bunch of dirty hacks and workarounds so TID mapping and net80211 frame inspection can be kept out of the net80211 layer. Because of the way this code works (and it's from Atheros and Linux ath9k), there is a consistent, 1:1 mapping between TID and AC. So we need to ensure that frames going to a specific TID will _always_ end up on the right AC, and vice versa, or the completion/locking will simply get very confused. I plan on addressing this mess in the future.
Known issues:
* There is no BAR frame transmission just yet. A whole lot of tidying up needs to occur before BAR frame TX can occur in the "correct" place - ie, once the TID TX queue has been drained.
* Interface reset/purge/etc results in frames in the TX and RX queues being removed. This creates holes in the sequence numbers being assigned and the TX/RX AMPDU code (on either side) just hangs.
* There's no filtered frame support at the present moment, so stations going into power saving mode will simply have a number of frames dropped - likely resulting in a traffic "hang".
* Raw frame TX is going to just not function with 11n aggregation. Likely this needs to be modified to always override the sequence number if the frame is going into an aggregation session. However, general raw frame injection currently doesn't work in general in net80211, so let's just ignore this for now until this is sorted out.
* HT protection is just not implemented and won't be until the above is sorted out. In addition, the AR5416 has issues RTS protecting large aggregates (anything >8k), so the work around needs to be ported and tested. Thus, this will be put on hold until the above work is complete.
* The rate control module 'sample' is the only currently supported module; onoe/amrr haven't been tested and have likely bit rotted a little. I'll follow up with some commits to make them work again for non-11n rates, but they won't be updated to handle 11n and aggregation. If someone wishes to do so then they're welcome to send along patches.
* .. and "sample" doesn't really do a good job of 11n TX. Specifically, the metrics used (packet TX time and failure/success rates) isn't as useful for 11n. It's likely that it should be extended to take into account the aggregate throughput possible and then choose a rate which maximises that. Ie, it may be acceptable for a higher MCS rate with a higher failure to be used if it gives a more acceptable throughput/latency then a lower MCS rate @ a lower error rate. Again, patches will be gratefully accepted.
Because of this, ATH_ENABLE_11N is still not enabled by default.
Sponsored by: Hobnob, Inc. Obtained from: Linux, Atheros
show more ...
|
#
1f25c0f7 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Make sure TXEOL is set on default queues. Otherwise we don't get an interrupt on the completion of a TX queue and this can cause TX hangs / timeout.
Sponsored by: Hobnob, Inc.
|
#
9352fb7a |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Refactor out the TX buffer management and completion code in preparation for TX aggregation.
* Add in logic which calls ath_buf bf->bf_comp if it's set. This allows for AMPDU (and RIFS, and FF, if
Refactor out the TX buffer management and completion code in preparation for TX aggregation.
* Add in logic which calls ath_buf bf->bf_comp if it's set. This allows for AMPDU (and RIFS, and FF, if someone desires) code to handle completion - which includes freeing subframes, retransmitting subframes, etc.
* Break out the buffer free, buffer busy/unbusy default completion handler code into separate functions. This allows bf_comp methods to free and unbusy each subframe ath_buf as required.
* Break out the statistics update code into a separate function, just to clean up the TX completion path a little.
Sponsored by: Hobnob, Inc.
show more ...
|
#
6edf1dc7 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Change the descriptor logic to use bf_lastds to point to the last descriptor, rather than using the maths involving bf_desc[bf_nseg - 1].
When doing TX aggregation, the status will be updated in the
Change the descriptor logic to use bf_lastds to point to the last descriptor, rather than using the maths involving bf_desc[bf_nseg - 1].
When doing TX aggregation, the status will be updated in the -final- descriptor of the -final- subframe in an aggregate. Thus bf_lastds may point to the last descriptor in a completely different ath_buf.
Sponsored by: Hobnob, Inc.
show more ...
|
#
e346b073 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Change ath_buf allocation to:
* Immediately return NULL if a buffer isn't available; * Track the "buffers not available" count; * Clear some fields used for tx aggregation; * Add ath_buf_clone() whi
Change ath_buf allocation to:
* Immediately return NULL if a buffer isn't available; * Track the "buffers not available" count; * Clear some fields used for tx aggregation; * Add ath_buf_clone() which clones the majority of buffer state. This is needed when retransmission of a "busy" buffer is required.
Sponsored by: Hobnob, Inc.
show more ...
|
#
2d433424 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Break out the TX DMA stop code into a separate function.
Sponsored by: Hobnob, Inc.
|
#
55c7b877 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Add a 'vap' to ath_keyset().
Add some code (which is currently disabled) which modifies the group multicast key cache behaviour. I haven't yet figured out what the exact/correct behaviour is so I'm
Add a 'vap' to ath_keyset().
Add some code (which is currently disabled) which modifies the group multicast key cache behaviour. I haven't yet figured out what the exact/correct behaviour is so I'm leaving it disabled. It's worth investigating and "correcting", especially for future work with mesh/ibss and encryption.
Sponsored by: Hobnob, Inc.
show more ...
|
#
16d4de92 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Some more various fixes, etc from my 11n branch.
* When doing software TX queue handling and flush, it's possible that the deletion of a VAP (eg a STA shutdown) will queue a "STA Disassociate" f
Some more various fixes, etc from my 11n branch.
* When doing software TX queue handling and flush, it's possible that the deletion of a VAP (eg a STA shutdown) will queue a "STA Disassociate" frame whilst the interface is being deleted. The VAP is then deleted, and the frame ends up being queued to a node that is freed before it can be TX'ed. Things go awry at this point.
There's no way at the present to avoid freeing the underlying node when the vap is being deleted. It's too late in the game.
I suspect the real fix is to make sure the frame is software queued with no completion information somehow, so it doesn't link back to a node whose underlying VAP has been freed. For now, we'll just have to do this.
* Add some comments showing what's going on.
* Move an instance of the ATH_LOCK() around to protect the interrupt set. I'll worry about changing that to a PCU lock later on once the 11n code is in the tree.
Sponsored by: Hobnob, Inc.
show more ...
|
#
f52d3452 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Add KTR tracepoints to the ath driver, in order to debug TX, RX and interrupt handling.
Sponsored by: Hobnob, Inc.
|
#
517526ef |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
In preparation for supporting 11n TX/RX properly, allow for TX queue draining and interface resets to be marked as ATH_RESET_DEFAULT, ATH_RESET_FULL, ATH_RESET_NOLOSS.
Currently a reset is still a r
In preparation for supporting 11n TX/RX properly, allow for TX queue draining and interface resets to be marked as ATH_RESET_DEFAULT, ATH_RESET_FULL, ATH_RESET_NOLOSS.
Currently a reset is still a reset - ie, all tx/rx frames in the hardware queues are purged. This means that those frames will be lost to the 11n TX and RX aggregation state tracking, breaking AMPDU sessions.
The (eventual) new semantics:
* ATH_RESET_DEFAULT: full reset, this is the default for reset situations which I haven't yet figured out what they should be. * ATH_RESET_FULL: A full reset - for things such as channel changes. * ATH_RESET_NOLOSS: Don't flush TX/RX queues - handle pending RX frames and leave TX frames where they are; restart TX DMA from where it was.
show more ...
|
#
4afa805e |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Break out the node cleanup and node free path, in preparation for doing software TX queue management.
The software queued TX frames will be freed by the new cleanup function.
Sponsored by: Hobnob,
Break out the node cleanup and node free path, in preparation for doing software TX queue management.
The software queued TX frames will be freed by the new cleanup function.
Sponsored by: Hobnob, Inc.
show more ...
|
#
96ff485d |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Preparation for correct 802.11n tx/rx handling.
* Change ath_rx_proc() to ath_rx_tasklet(); make that the taskqueue function. This way (eventually) ath_rx_proc() can be called from elsewhere in th
Preparation for correct 802.11n tx/rx handling.
* Change ath_rx_proc() to ath_rx_tasklet(); make that the taskqueue function. This way (eventually) ath_rx_proc() can be called from elsewhere in the packet reset/processing queue so frames aren't just "flushed" during interface resets/reconfigure. This breaks 802.11n RX aggregation tracking. * Extend ath_tx_proc() to take a 'resched' flag, which marks whether to reschedule further RX PCU reads or not. * Change ath_tx_processq() to take a "dosched" flag, which will eventually be used to indicate whether to reschedule the software TX scheduler.
Sponsored by: Hobnob, Inc.
show more ...
|
#
8f939e79 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Merge in some fixes from the if_ath_tx branch.
* Close down some of the kickpcu races, where the interrupt handler can and will run concurrently with the taskqueue. * Close down the TXQ active/com
Merge in some fixes from the if_ath_tx branch.
* Close down some of the kickpcu races, where the interrupt handler can and will run concurrently with the taskqueue. * Close down the TXQ active/completed race between the interrupt handler and the concurrently running tx completion taskqueue function. * Add some tx and rx interrupt count tracking, for debugging. * Fix the kickpcu logic in ath_rx_proc() to not simply drain and restart the TX queue - instead, assume the hardware isn't (too) confused and just restart RX DMA. This may break on previous chipsets, so if it does I'll add a HAL flag and conditionally handle this (ie, for broken chipsets, I'll just restore the "stop PCU / flush things / restart PCU" logic.) * Misc stuff
Sponsored by: Hobnob, Inc.
show more ...
|
#
6b349e5a |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Migrate the STAILQ lists to TAILQs.
A bunch of the 11n TX aggregation logic wants to traverse lists of buffers in various ways. In order to provide O(1) behaviour in this instance, use TAILQs.
This
Migrate the STAILQ lists to TAILQs.
A bunch of the 11n TX aggregation logic wants to traverse lists of buffers in various ways. In order to provide O(1) behaviour in this instance, use TAILQs.
This does blow out the memory footprint and CPU cycles slightly for some of these operations. I may convert some of these back to STAILQs once the rest of the software transmit queue handling has been stabilised.
Sponsored by: Hobnob, Inc.
show more ...
|
#
3dd85b26 |
| 08-Nov-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
Begin merging in some of my 802.11n TX aggregation driver changes.
* Add a PCU lock, which isn't currently used but will eventually be used to serialise some of the driver access.
* Add in all th
Begin merging in some of my 802.11n TX aggregation driver changes.
* Add a PCU lock, which isn't currently used but will eventually be used to serialise some of the driver access.
* Add in all the software TX aggregation state, that's kept per-node and per-TID.
* Add in the software and aggregation state to ath_buf.
* Add in hooks to ath_softc for aggregation state and the (upcoming) aggregation TX state calls.
* Add / fix the HAL access macros.
Obtained from: Linux, ath9k Sponsored by: Hobnob, Inc.
show more ...
|
#
d745c852 |
| 07-Nov-2011 |
Ed Schouten <ed@FreeBSD.org> |
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
|
#
dcfd99a7 |
| 28-Oct-2011 |
Adrian Chadd <adrian@FreeBSD.org> |
When punting frames to the RX tap, free the mbufs since we've tampered with their length.
Without this, an error frame mbuf would:
* have its size adjusted; * thrown at the radiotap code; * then si
When punting frames to the RX tap, free the mbufs since we've tampered with their length.
Without this, an error frame mbuf would:
* have its size adjusted; * thrown at the radiotap code; * then since it's never consumed, the rxbuf/mbuf is then re-added to the RX descriptor list with the small size; * .. and the hardware ends up (sometimes) only DMA'ing part of a frame into the small buffer, chaining RX frames together (setting the more flag).
I discovered this particular issue when doing some promiscuous radiotap testing; I found that I'd occasionally get rs_more set in RX descriptors w/ the first frame length being very small (sub-100 bytes.) The driver handles 2-descriptor RX frames (but not more), so this still worked; it was just odd.
This is suboptimal and may benefit from being replaced with caching the m_pkthdr_len and m_len fields, then restoring them after completion.
show more ...
|
#
70d8f36a |
| 27-Oct-2011 |
Peter Grehan <grehan@FreeBSD.org> |
IFC @ r226824
|