summaryrefslogtreecommitdiff
path: root/sys/dev/ath/if_ath.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow 802.11n hardware to support multi-rate retry when RTS/CTS isAdrian Chadd2012-07-311-0/+9
| | | | | | | | | | | | | | | | | | | enabled. The legacy (pre-802.11n) hardware doesn't support this - although the AR5212 era hardware supports MRR, it doesn't have all the bits needed to support MRR + RTS/CTS. The AR5416 and later support a packet duration and RTS/CTS flags per rate scenario, so we should support it. Tested: * AR9280, STA PR: kern/170302 Notes: svn path=/head/; revision=238961
* Migrate some more TX side setup routines to be methods.Adrian Chadd2012-07-311-17/+30
| | | | Notes: svn path=/head/; revision=238931
* Fix breakage introduced in r238824 - correctly calculate the descriptorAdrian Chadd2012-07-291-1/+7
| | | | | | | | | | | | | | | wrapping. The previous code was only wrapping descriptor "block" boundaries rather than individual descriptors. It sounds equivalent but it isn't. r238824 changed the descriptor allocation to enforce that an individual descriptor doesn't wrap a 4KiB boundary rather than the whole block of descriptors. Eg, for TX descriptors, they're allocated in blocks of 10 descriptors for each ath_buf (for scatter/gather DMA.) Notes: svn path=/head/; revision=238884
* Add a missing call to ath_txdma_teardown().Adrian Chadd2012-07-281-0/+1
| | | | Notes: svn path=/head/; revision=238854
* Modify ath_descdma_cleanup() to handle ath_descdma instances with noAdrian Chadd2012-07-271-18/+23
| | | | | | | | | | | buffers. ath_descdma is now being used for things other than the classical combination of ath_buf + ath_desc allocations. In this particular case, don't try to free and blank out the ath_buf list if it's not passed in. Notes: svn path=/head/; revision=238832
* Migrate the descriptor allocation function to not care about the numberAdrian Chadd2012-07-271-8/+8
| | | | | | | | | | | | | | | | | | of buffers, only the number of descriptors. This involves: * Change the allocation function to not use nbuf at all; * When calling it, pass in "nbuf * ndesc" to correctly update how many descriptors are being allocated. Whilst here, fix the descriptor allocation code to correctly allocate a larger buffer size if the Merlin 4KB WAR is required. It overallocates descriptors when allocating a block that doesn't ever have a 4KB boundary being crossed, but that can be fixed at a later stage. Notes: svn path=/head/; revision=238824
* Refactor out the descriptor allocation code from the buffer allocationAdrian Chadd2012-07-271-10/+51
| | | | | | | | | | code. The TX EDMA completion path is going to need descriptors allocated but not any buffers. This code will form the basis for that. Notes: svn path=/head/; revision=238822
* Modify ath_descdma_setup() to take a descriptor size parameter.Adrian Chadd2012-07-231-5/+6
| | | | | | | | | | | | | | | | The AR9300 and later descriptors are 128 bytes, however I'd like to make sure that isn't used for earlier chips. * Populate the TX descriptor length field in the softc with sizeof(ath_desc) * Use this field when allocating the TX descriptors * Pre-AR93xx TX/RX descriptors will use the ath_desc size; newer ones will query the HAL for these sizes. Notes: svn path=/head/; revision=238729
* Begin separating out the TX DMA setup in preparation for TX EDMA support.Adrian Chadd2012-07-231-3/+18
| | | | | | | | | | | | | | | * Introduce TX DMA setup/teardown methods, mirroring what's done in the RX path. Although the TX DMA descriptor is setup via ath_desc_alloc() / ath_desc_free(), there TX status descriptor ring will be allocated in this path. * Remove some of the TX EDMA capability probing from the RX path and push it into the new TX EDMA path. Notes: svn path=/head/; revision=238710
* Begin modifying the descriptor allocation functions to support a variableAdrian Chadd2012-07-231-9/+10
| | | | | | | | | | | sized TX descriptor. This is required for the AR93xx EDMA support which requires 128 byte TX descriptors (which is significantly larger than the earlier hardware.) Notes: svn path=/head/; revision=238708
* Enable the basic node-based rate control statistics via an ioctl().Adrian Chadd2012-07-201-0/+40
| | | | Notes: svn path=/head/; revision=238634
* Ensure that error is set.Adrian Chadd2012-07-141-0/+1
| | | | | | | Noticed by: rui Notes: svn path=/head/; revision=238440
* Don't free the descriptor allocation/map if it doesn't exist.Adrian Chadd2012-07-141-4/+6
| | | | | | | I missed this in my previous commit. Notes: svn path=/head/; revision=238435
* Fix EDMA RX to actually work without panicing the machine.Adrian Chadd2012-07-141-0/+61
| | | | | | | | | | | | | I was setting up the RX EDMA buffer to be 4096 bytes rather than the RX data buffer portion. The hardware was likely getting very confused and DMAing descriptor portions into places it shouldn't, leading to memory corruption and occasional panics. Whilst here, don't bother allocating descriptors for the RX EDMA case. We don't use those descriptors. Instead, just allocate ath_buf entries. Notes: svn path=/head/; revision=238432
* Flip on EDMA RX of both HP and LP queue frames.Adrian Chadd2012-07-101-1/+13
| | | | | | | | Yes, this is in the legacy interrupt path. The NIC does support MSI but I haven't yet sat down and written that code. Notes: svn path=/head/; revision=238343
* Migrate the ATH_KTR_* fields out to if_ath_debug.h .Adrian Chadd2012-07-101-3/+0
| | | | Notes: svn path=/head/; revision=238339
* Further preparations for the RX EDMA support.Adrian Chadd2012-07-091-19/+25
| | | | | | | | Break out the DMA descriptor setup/teardown code into a method. The EDMA RX code doesn't allocate descriptors, just ath_buf entries. Notes: svn path=/head/; revision=238284
* Begin abstracting out the RX path in preparation for RX EDMA support.Adrian Chadd2012-07-031-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RX EDMA support requires a modified approach to the RX descriptor handling. Specifically: * There's now two RX queues - high and low priority; * The RX queues are implemented as FIFOs; they're now an array of pointers to buffers; * .. and the RX buffer and descriptor are in the same "buffer", rather than being separate. So to that end, this commit abstracts out most of the RX related functions from the bulk of the driver. Notably, the RX DMA/buffer allocation isn't updated, primarily because I haven't yet fleshed out what it should look like. Whilst I'm here, create a set of matching but mostly unimplemented EDMA stubs. Tested: * AR9280, station mode TODO: * Thorough AP and other mode testing for non-EDMA chips; * Figure out how to allocate RX buffers suitable for RX EDMA, including correctly setting the mbuf length to compensate for the RX descriptor and completion status area. Notes: svn path=/head/; revision=238055
* Shuffle these initialisations to where they should be.Adrian Chadd2012-06-241-7/+7
| | | | Notes: svn path=/head/; revision=237527
* Introduce an optional ath(4) radiotap vendor extension.Adrian Chadd2012-06-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | This includes a few new fields in each RXed frame: * per chain RX RSSI (ctl and ext); * current RX chainmask; * EVM information; * PHY error code; * basic RX status bits (CRC error, PHY error, etc). This is primarily to allow me to do some userland PHY error processing for radar and spectral scan data. However since EVM and per-chain RSSI is provided, others may find it useful for a variety of tasks. The default is to not compile in the radiotap vendor extensions, primarily because tcpdump doesn't seem to handle the particular vendor extension layout I'm using, and I'd rather not break existing code out there that may be (badly) parsing the radiotap data. Instead, add the option 'ATH_ENABLE_RADIOTAP_VENDOR_EXT' to your kernel configuration file to enable these options. Notes: svn path=/head/; revision=237522
* After some discussion with bschmidt@, it's likely better to just goAdrian Chadd2012-06-171-37/+4
| | | | | | | | | | through ieee80211_suspend_all() and ieee80211_resume_all(). All the other wireless drivers are doing that particular dance. PR: kern/169084 Notes: svn path=/head/; revision=237179
* oops, remove this, it wasn't supposed to be committed.Adrian Chadd2012-06-161-3/+0
| | | | Notes: svn path=/head/; revision=237173
* Fix build.Konstantin Belousov2012-06-161-1/+1
| | | | Notes: svn path=/head/; revision=237170
* Shuffle some more fields in ath_buf so it's not too big.Adrian Chadd2012-06-161-0/+3
| | | | | | | | | This shaves off 20 bytes - from 288 bytes to 268 bytes. However, it's still too big. Notes: svn path=/head/; revision=237153
* Convert ath(4) to just use ieee80211_suspend_all() and ieee80211_resume_all().Adrian Chadd2012-06-151-0/+16
| | | | | | | | | | | | | | | The existing code tries to use the beacon miss timer to signal that the AP has gone away. Unfortunately this doesn't seem to be behaving itself. I'll try to investigate why this is for the sake of completeness. The result is the STA will stay "associated" to the AP it was associated with when it suspended. It never receives a bmiss notification so it never tries reassociating. PR: kern/169084 Notes: svn path=/head/; revision=237108
* Disable BGSCAN for 802.11n for now. Until scanning during traffic isAdrian Chadd2012-06-141-6/+2
| | | | | | | | | | | fixed for 802.11n TX, this needs to be disabled or users wlil see randomly hanging aggregation sessions. Whilst I'm here, remove the warning about 802.11n being full of dragons. It's nowhere near that scary now. Notes: svn path=/head/; revision=237043
* Implement a global (all non-mgmt traffic) TX ath_buf limitation whenAdrian Chadd2012-06-141-3/+48
| | | | | | | | | | | | | | | | | | | | ath_start() is called. This (defaults to 10 frames) gives for a little headway in the TX ath_buf allocation, so buffer cloning is still possible. This requires a lot omre experimenting and tuning. It also doesn't stop a node/TID from consuming all of the available ath_buf's, especially when the node is going through high packet loss or only talking at a low TX rate. It also doesn't stop a paused TID from taking all of the ath_bufs. I'll look at fixing that up in subsequent commits. PR: kern/168170 Notes: svn path=/head/; revision=237038
* Implement a separate, smaller pool of ath_buf entries for use by managementAdrian Chadd2012-06-131-13/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | traffic. * Create sc_mgmt_txbuf and sc_mgmt_txdesc, initialise/free them appropriately. * Create an enum to represent buffer types in the API. * Extend ath_getbuf() and _ath_getbuf_locked() to take the above enum. * Right now anything sent via ic_raw_xmit() allocates via ATH_BUFTYPE_MGMT. This may not be very useful. * Add ATH_BUF_MGMT flag (ath_buf.bf_flags) which indicates the current buffer is a mgmt buffer and should go back onto the mgmt free list. * Extend 'txagg' to include debugging output for both normal and mgmt txbufs. * When checking/clearing ATH_BUF_BUSY, do it on both TX pools. Tested: * STA mode, with heavy UDP injection via iperf. This filled the TX queue however BARs were still going out successfully. TODO: * Initialise the mgmt buffers with ATH_BUF_MGMT and then ensure the right type is being allocated and freed on the appropriate list. That'd save a write operation (to bf->bf_flags) on each buffer alloc/free. * Test on AP mode, ensure that BAR TX and probe responses go out nicely when the main TX queue is filled (eg with paused traffic to a TID, awaiting a BAR to complete.) PR: kern/168170 Notes: svn path=/head/; revision=237000
* Replace the direct sc_txbuf manipulation with a pair of functions.Adrian Chadd2012-06-131-3/+21
| | | | | | | | | | This is preparation work for having a separate ath_buf queue for management traffic. PR: kern/168170 Notes: svn path=/head/; revision=236993
* Add a new ioctl for ath(4) which returns the aggregate statistics.Adrian Chadd2012-06-101-0/+3
| | | | Notes: svn path=/head/; revision=236833
* Mostly revert previous commit(s). After doing a bunch of local testing,Adrian Chadd2012-06-051-11/+0
| | | | | | | | | | | | | | it turns out that it negatively affects performance. I'm stil investigating exactly why deferring the IO causes such negative TCP performance but doesn't affect UDP preformance. Leave the ath_tx_kick() change in there however; it's going to be useful to have that there for if_transmit() work. PR: kern/168649 Notes: svn path=/head/; revision=236599
* Create a function - ath_tx_kick() - which is called where ath_start() isAdrian Chadd2012-06-051-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | called to "kick" along TX. For now, schedule a taskqueue call. Later on I may go back to the direct call of ath_rx_tasklet() - but for now, this will do. I've tested UDP and TCP TX. UDP TX still achieves 240MBit, but TCP TX gets stuck at around 100MBit or so, instead of the 150MBit it should be at. I'll re-test with no ACPI/power/sleep states enabled at startup and see what effect it has. This is in preparation for supporting an if_transmit() path, which will turn ath_tx_kick() into a NUL operation (as there won't be an ifnet queue to service.) Tested: * AR9280 STA TODO: * test on AR5416, AR9160, AR928x STA/AP modes PR: kern/168649 Notes: svn path=/head/; revision=236597
* Migrate the TX path to a taskqueue for now, until a better way ofAdrian Chadd2012-06-041-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementing parallel TX and TX/RX completion can be done without simply abusing long-held locks. Right now, multiple concurrent ath_start() entries can result in frames being dequeued out of order. Well, they're dequeued in order fine, but if there's any preemption or race between CPUs between: * removing the frame from the ifnet, and * calling and runningath_tx_start(), until the frame is placed on a software or hardware TXQ Then although dequeueing the frame is in-order, queueing it to the hardware may be out of order. This is solved in a lot of other drivers by just holding a TX lock over a rather long period of time. This lets them continue to direct dispatch without races between dequeue and hardware queue. Note to observers: if_transmit() doesn't necessarily solve this. It removes the ifnet from the main path, but the same issue exists if there's some intermediary queue (eg a bufring, which as an aside also may pull in ifnet when you're using ALTQ.) So, until I can sit down and code up a much better way of doing parallel TX, I'm going to leave the TX path using a deferred taskqueue task. What I will likely head towards is doing a direct dispatch to hardware or software via if_transmit(), but it'll require some driver changes to allow queues to be made without using the really large ath_buf / ath_desc entries. TODO: * Look at how feasible it'll be to just do direct dispatch to ath_tx_start() from if_transmit(), avoiding doing _any_ intermediary serialisation into a global queue. This may break ALTQ for example, so I have to be delicate. * It's quite likely that I should break up ath_tx_start() so it deposits frames onto the software queues first, and then only fill in the 802.11 fields when it's being queued to the hardware. That will make the if_transmit() -> software queue path very quick and lightweight. * This has some very bad behaviour when using ACPI and Cx states. I'll do some subsequent analysis using KTR and schedgraph and file a follow-up PR or two. PR: kern/168649 Notes: svn path=/head/; revision=236583
* oops - ath_hal_disablepcie is actually destined for another purpose,Adrian Chadd2012-05-251-3/+9
| | | | | | | | | | not to disable the PCIe PHY in prepration for reset. Extend the enablepci method to have a "poweroff" flag, which if equal to true means the hardware is about to go to sleep. Notes: svn path=/head/; revision=235972
* Prepare for improved (read: pcie) suspend/resume support.Adrian Chadd2012-05-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Flesh out the pcie disable method for 11n chips, as they were defaulting to the AR5212 (empty) PCIe disable method. * Add accessor macros for the HAL PCIe enable/disable calls. * Call disable on ath_suspend() * Call enable on ath_resume() NOTE: * This has nothing to do with the NIC sleep/run state - the NIC still will stay in network-run state rather than supporting network-sleep state. This is preparation work for supporting correct suspend/resume WARs for the 11n PCIe NICs. TODO: * It may be feasible at this point to keep the chip powered down during initial probe/attach and only power it up upon the first configure/reset pass. This however would require correct (for values of "correct") tracking of the NIC power configuration state from the driver and that just isn't attempted at the moment. Tested: * AR9280 on my Lenovo T60, but with no suspend/resume pass (yet). Notes: svn path=/head/; revision=235957
* Migrate most of the beacon handling functions out to if_ath_beacon.c.Adrian Chadd2012-05-201-746/+2
| | | | | | | This is also in preparation for supporting AR9300 and later NICs. Notes: svn path=/head/; revision=235680
* Migrate the TDMA management functions out of if_ath.c into if_ath_tdma.c.Adrian Chadd2012-05-201-367/+8
| | | | | | | | | There's some TX path TDMA code in if_ath_tx.c which should be migrated out, but first I should likely try and verify/fix/repair the TDMA support in 9.x and -HEAD. Notes: svn path=/head/; revision=235679
* Migrate the bulk of the RX routines out from if_ath.c to if_ath_rx.[ch].Adrian Chadd2012-05-201-911/+6
| | | | | | | | | | | | | | | | | | | | | | * migrate the rx processing out into if_ath_rx.c * migrate the TSF functions into if_ath_tsf.h, as inlines This is in prepration for supporting the EDMA RX routines, required to support the AR93xx series NICs. TODO: * ath_start() shouldn't be private, but it's called as part of the RX path. I should likely migrate ath_rx_tasklet() back into if_ath.c and then return this to be 'static'. The RX code really shouldn't need to see TX routines (and vice versa.) * ath_beacon_* should be in if_ath_beacon.[ch]. * ath_tdma_* should be in if_ath_tdma.[ch] ... Notes: svn path=/head/; revision=235676
* Re-enable this particular DELAY() for now, at least until theAdrian Chadd2012-05-071-0/+2
| | | | | | | | | | | | TX and RX PCU stop/drain routines have been thoroughly debugged. It's also very likely that I should add hooks back up to the interface glue (if_ath_pci / if_ath_ahb) to do any relevant bus flushes that are required. A WMAC DDR flush may be required for the AR9130 SoC. Notes: svn path=/head/; revision=235134
* Add a comment about this DELAY(), I'm not sure whether it's supposedAdrian Chadd2012-04-281-0/+4
| | | | | | | to be for a DDR/FIFO flush or something else. Notes: svn path=/head/; revision=234748
* Run the fatal proc as a proc, rather than where it currently is.Adrian Chadd2012-04-171-1/+2
| | | | | | | Otherwise the reset path will sleep, which it can't do in this context. Notes: svn path=/head/; revision=234369
* Fix the default, non-superg compile.Adrian Chadd2012-04-111-0/+2
| | | | | | | Pointy-hat-to: adrian Notes: svn path=/head/; revision=234117
* Fix compilation with IEEE80211_ENABLE_SUPERG defined.Adrian Chadd2012-04-101-0/+1
| | | | | | | PR: kern/164951 Notes: svn path=/head/; revision=234110
* Blank the aggregate stats whenever the zero ioctl is called.Adrian Chadd2012-04-101-0/+2
| | | | Notes: svn path=/head/; revision=234091
* Squirrel away SYNC interrupt debugging if it's enabled in the HAL.Adrian Chadd2012-04-101-1/+13
| | | | | | | | Bus errors will show up as various SYNC interrupts which will be passed back up to ath_intr(). Notes: svn path=/head/; revision=234090
* Revert this for now - it may work for -8 and -9 and -HEAD, but notAdrian Chadd2012-04-101-14/+0
| | | | | | | | | "-HEAD driver + net80211 on -9 kernel." I'll figure this out at some later stage. Notes: svn path=/head/; revision=234089
* * Since the API changed along the -CURRENT path (december 2011),Adrian Chadd2012-04-101-2/+22
| | | | | | | | | | | | | | | | | | | | | add a FreeBSD_version check. It should work fine for compiling on -HEAD, 9.x and 8.x. * Conditionally compile the 11n options only when 11n is enabled. The above changes allow the ath(4) driver to compile and run on 8.1-RELEASE (Hi old PC-BSD!) but with the 11n stuff disabled. I've done a test against the net80211 and tools in 8.1-RELEASE. The NIC used in testing is the AR2427 in an EEEPC. Just to be clear - this change is to allow the -HEAD ath/hal/rate code to run on 9.x _and_ 8.x with no source changes. However, when running on earlier kernels, it should only be used for legacy mode. (Don't define ATH_ENABLE_11N.) Notes: svn path=/head/; revision=234085
* Store away the RTS aggregate limit from the HAL.Adrian Chadd2012-04-071-0/+7
| | | | | | | | | This will be used by some upcoming code to ensure that aggregates are enforced to be a certain size. The AR5416 has a limitation on RTS protected aggregates (8KiB). Notes: svn path=/head/; revision=233967
* Remove duplicate txflags field from ath_buf.Adrian Chadd2012-04-071-5/+4
| | | | | | | | rename bf_state.bfs_flags to bf_state.bfs_txflags, as that is what it effectively is. Notes: svn path=/head/; revision=233966
* Disable the HWQ contents upon a TX queue reset, rather than a TX queue flush.Adrian Chadd2012-04-041-0/+4
| | | | | | | | This is designed to assist in figuring out what the hardware state is when something like a queue hang has occured. Notes: svn path=/head/; revision=233898