aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
Commit message (Collapse)AuthorAgeFilesLines
...
* Overhaul bus_dma(9) usage in driver:Pyun YongHyeon2011-11-142-403/+604
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Notes: svn path=/head/; revision=227512
* Export sysctl node for various interrupt moderation parameters andPyun YongHyeon2011-11-141-14/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Notes: svn path=/head/; revision=227509
* It's bad idea to allocate large memory, 4KB, from stack.Pyun YongHyeon2011-11-142-29/+35
| | | | | | | | | | Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. Notes: svn path=/head/; revision=227505
* Remove a few bits of FreeBSD 2.x compatibility code.Robert Millan2011-11-141-4/+0
| | | | | | | Approved by: kib (mentor) Notes: svn path=/head/; revision=227503
* Disable writing to the extension CYCPWR1 register.Adrian Chadd2011-11-122-11/+0
| | | | | | | | | This seems to make ANI behave better on the AR5416/AR5418. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227468
* - This patch adds custom IOCTLs to read and write the 4 GPIO pins on theHans Petter Selasky2011-11-122-11/+86
| | | | | | | | | | | | cp2103 usb-to-serial chip. - This patch also makes the line status polling asynchronous, to reduce the time needed to change the GPIO pins. Submitted by: JD Louw MFC after: 1 week Notes: svn path=/head/; revision=227463
* Enable power save mode for the USB storage device driver.Hans Petter Selasky2011-11-121-0/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=227462
* Style change.Hans Petter Selasky2011-11-1227-99/+106
| | | | | | | | | | | | | | | - Make it easier to port the USB code to other platforms by only using one set of memory functions for clearing and copying memory. None of the memory copies are overlapping. This means using bcopy() is not required. - Fix a compile warning when USB_HAVE_BUSDMA=0 - Add missing semicolon in avr32dci. - Update some comments. MFC after: 1 week Notes: svn path=/head/; revision=227461
* In r191367 the need for if_free_type() was removed and a new memberBrooks Davis2011-11-111-1/+3
| | | | | | | | | | | if_alloctype was used to store the origional interface type. Take advantage of this change by removing all existing uses of if_free_type() in favor of if_free(). MFC after: 1 Month Notes: svn path=/head/; revision=227459
* - add a missing "be" and "in"Eitan Adler2011-11-111-1/+1
| | | | | | | | | | | | | | - fix other errors introduced when committing r226436 - add 'function' to a sentence where it makes sense Submitted by: delphij Submitted by: dougb Submitted by: jhb Approved by: dougb Approved by: jhb Notes: svn path=/head/; revision=227458
* - add support for CP-104EL-A and CP-104JU to pucEitan Adler2011-11-111-0/+27
| | | | | | | | | PR: 151365 Submitted by: Joerg Niendorf <f5d10a@internode.on.net> Approved by: jhb Notes: svn path=/head/; revision=227457
* To send a frame, controller requires a prepended TX header andPyun YongHyeon2011-11-111-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | the length of frame should be treated as multiple of 4. Actual frame length is set in the TX header. The TX header position should be aligned on 4 byte boundary and actual frame start position should be aligned on 4 byte boundary as well. This means we need 4(TX header length) + 3(frame length fixup) additional free space in TX buffer in addition to actual frame length. Make sure TX handler check these additional bytes. ae_tx_avail_size() returns actual free space in TX buffer to ease the calculation of available TX buffer space in caller. While I'm here, replace magic number to appropriate sizeof operator to enhance readability. This change should fix controller lockup issue happened under certain conditions but it still does not fix watchdog timeout. It seems the watchdog timeout is side-effect of TxS and TxD mismatches. The root cause of TxD/TxD mismatch is not known yet but it looks like silicon bug. I guess driver may have to reinitialize controller whenever it sees TxS and TxD mismatches but leave it as it was at this moment. PR: kern/145918 Notes: svn path=/head/; revision=227452
* Correct device id comments.Adrian Chadd2011-11-111-2/+2
| | | | Notes: svn path=/head/; revision=227434
* Remove dead ifdef. Driver should always check raised interrupt isPyun YongHyeon2011-11-101-3/+0
| | | | | | | for the device. Notes: svn path=/head/; revision=227432
* style.Pyun YongHyeon2011-11-101-63/+44
| | | | | | | No functional changes. Notes: svn path=/head/; revision=227431
* Bump this up to where it used to be.Adrian Chadd2011-11-091-9/+1
| | | | | | | | | | | | | | | | | | I need to investigate this a little closer, but it seems that in noisy environments the NF load takes longer than 5 * DELAY(10) and this is messing up future NF calibrations. (The background: NF calibrations begin at the value programmed in after the load has completed, so if this is never loaded in, the NF calibrations only ever start at the currently calibrated NF value, rather than starting at something high (say -50.) More investigation about the effect on 11n RX and calibration results are needed. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227411
* Introduce a work-around for issues with the AR5416 based MAC on SMP devices.Adrian Chadd2011-11-097-1/+70
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=227410
* Do a dummy read to flush the interrupt ACK that we just performed,Xin LI2011-11-091-0/+6
| | | | | | | | | | | | | | | ensuring that everything is really, truly consistent. This fixes certain cases where one will see various: mfi0: COMMAND 0xffffffXXXXXXXXXX TIMEOUT AFTER XX SECONDS MFC after: 3 days Submitted by: scottl Ok'ed by: jhb Notes: svn path=/head/; revision=227409
* Commit a missing fix - the AR_SREV_KIWI_10_OR_LATER() check.Adrian Chadd2011-11-091-4/+8
| | | | Notes: svn path=/head/; revision=227408
* Even though the HAL doesn't currently support Kiwi 1.0/1.1,Adrian Chadd2011-11-091-1/+1
| | | | | | | | | be "more correct" about the Kiwi setup. Obtained from: Atheros Notes: svn path=/head/; revision=227405
* Fix size of USB 3.0 descriptor field.Hans Petter Selasky2011-11-092-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=227401
* If software retransmit occurs with an ath_buf marked ATH_BUF_BUSY,Adrian Chadd2011-11-091-3/+58
| | | | | | | | | | | | | | | | | | | | it's cloned and that clone is retransmitted. This means that the ath_buf pointer squirreled away on the baw window array is suddenly wrong and was causing all kinds of console output. This updates the pointer in that particular BAW slot to the new ath_buf after ensuring that: * the new and old buffers have the same seqno; * the current slot pointer matches the old buffer pointer. This quietens the debugging output (again), restoring said debugging to only signify when a broken condition has occured. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227398
* Fix size of USB 3.0 descriptor field.Hans Petter Selasky2011-11-092-2/+3
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=227396
* Flip on processing interrupt profile events for mips24k.Adrian Chadd2011-11-091-1/+61
| | | | | | | | | | | | | | This is a bit hackish and should be made more generic (ie, support more than two hard-coded performance counter+config register pairs) so it can be used for mips74k and other chips. All this does is process the initial interrupt event. It doesn't (yet) handle callgraph events, so even if you route the exception/interrupt to this routine and flip the bit on, it will hang and crash pmc unless you disable callgraph support when you enable a sample based PMC. Notes: svn path=/head/; revision=227395
* * Force the MAC to wakeup before we try resetting it, to ensureAdrian Chadd2011-11-091-1/+17
| | | | | | | | | | it actually _gets_ reset properly. * Add some more comments describing why things are done. Obtained from: Atheros Notes: svn path=/head/; revision=227388
* Tidy up the AR9287 HAL a tiny bit - fix up AR9280 references.Adrian Chadd2011-11-091-9/+2
| | | | Notes: svn path=/head/; revision=227387
* Some minor corrections to a modem driver.Hans Petter Selasky2011-11-091-9/+6
| | | | | | | | PR: usb/162307 MFC after: 3 days Notes: svn path=/head/; revision=227383
* Migrate the AR5416 ANI code to use the previously introduced methodAdrian Chadd2011-11-091-12/+19
| | | | | | | | | | | | to fetch the current channel busy statistics, rather than duplicating it here. This forms the (very crude) basis for doing basic channel surveying. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227381
* Disable OFDM weak signal detection by default. Leave this to beAdrian Chadd2011-11-091-1/+1
| | | | | | | | | | | | | | | | enabled if required by STA operation. This quietens a lot of OFDM errors seen in hostap mode, where there are no beacon RSSI levels to tune the dynamic range of the baseband. This may reduce reception range at the fringes, but does increase stability. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227380
* Use a restricted set of parameters when operating in hostap mode.Adrian Chadd2011-11-091-0/+10
| | | | | | | | | | | | | | The 5ghz hostap mode (where DFS is being done) requires ANI to be disabled or the radar detection parameters don't work as advertised (as they're based on signal strength level, and tweaking ANI affects the signal strangth, dynamic range and power increase the baseband is looking for in order to detect it as a "signal".) Obtained from: Linux, Atheros Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227379
* Add logic to ANI to tweak the firstep parameter when in hostap mode.Adrian Chadd2011-11-091-0/+25
| | | | | | | | | | | This is normally done based on the beacon RSSI but this isn't available in hostap mode. Obtained from: Atheros Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227378
* .. and add some ANI fixes missing from the last ANI commit.Adrian Chadd2011-11-091-10/+8
| | | | | | | | Obtained from: Atheros Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227377
* Include some ANI fixes for the AR5416.Adrian Chadd2011-11-091-27/+27
| | | | | | | | | | | | | | | * If we fall through from an ANI command (eg because it's out of range, or it's disabled) then fall through to the next ANI command rather then being stuck there. * Fix some off-by-one comparisons, meaning the final level in some parameters were never tweaked. Obtained from: Atheros Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227376
* Add a new HAL parameter which forces a full reset rather than warm reset.Adrian Chadd2011-11-093-2/+13
| | | | | | | | | | | This forces a full reset of the baseband/radio and seems needed to clear some issues (with Merlin at least) when the baseband gets confused in a very noisy environment. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227375
* Port over a new routine which grabs the percentage of time spent in TX ↵Adrian Chadd2011-11-093-1/+60
| | | | | | | | | | | | | | | frame, RX frame, RX clear, RX extension clear. This is useful for estimating channel business. The same routines should be written for AR5210->AR5212 where appopriate. Obtained from: Atheros Notes: svn path=/head/; revision=227374
* Add in some more PCI/PCIe differentiation.Adrian Chadd2011-11-092-6/+12
| | | | Notes: svn path=/head/; revision=227373
* Try to make it more obvious when users are using the PCI or PCIe versions ofAdrian Chadd2011-11-092-5/+12
| | | | | | | the 11n chips. Notes: svn path=/head/; revision=227372
* Fix the compile to work when IEEE80211_DEBUG isn't defined.Adrian Chadd2011-11-091-0/+2
| | | | | | | Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227371
* Fix the KTR option to compile by default - it was referencingAdrian Chadd2011-11-083-0/+21
| | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227365
* Introduce TX aggregation and software TX queue managementAdrian Chadd2011-11-0811-355/+4114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=227364
* Add support to the TX descriptor printing code to follow ath_bufAdrian Chadd2011-11-081-19/+30
| | | | | | | | | chains. This allows for debugging of aggregate frames. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227363
* Make sure TXEOL is set on default queues. Otherwise we don't get anAdrian Chadd2011-11-081-0/+1
| | | | | | | | | | interrupt on the completion of a TX queue and this can cause TX hangs / timeout. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227362
* Refactor out the TX buffer management and completion code inAdrian Chadd2011-11-082-102/+236
| | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227361
* Change the descriptor logic to use bf_lastds to point to the lastAdrian Chadd2011-11-082-8/+25
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227360
* Change ath_buf allocation to:Adrian Chadd2011-11-082-0/+73
| | | | | | | | | | | | | * 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. Notes: svn path=/head/; revision=227359
* Break out the TX DMA stop code into a separate function.Adrian Chadd2011-11-081-6/+23
| | | | | | | Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227358
* Add a 'vap' to ath_keyset().Adrian Chadd2011-11-083-6/+23
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227357
* Some more various fixes, etc from my 11n branch.Adrian Chadd2011-11-081-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. Notes: svn path=/head/; revision=227356
* Add KTR tracepoints to the ath driver, in order to debug TX, RXAdrian Chadd2011-11-081-1/+23
| | | | | | | | | and interrupt handling. Sponsored by: Hobnob, Inc. Notes: svn path=/head/; revision=227354
* In preparation for supporting 11n TX/RX properly, allow for TX queue drainingAdrian Chadd2011-11-083-17/+21
| | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227353