Commit Graph

90 Commits

Author SHA1 Message Date
bschmidt
6128b7ccd7 Pull some features out of the firmware:
- If a ENH_SENS TLV section exit the firmware is capable of doing
  enhanced sensitivity calibration.
- Newer devices/firmwares have more calibration commands therefore
  hardcoding the noise gain/reset commands no longer works. It is
  supposed to use the next index after the newest calibration type
  support. Read the command index of the TLV section if available.
2011-04-19 19:47:41 +00:00
bschmidt
d47945ce8b Add some new features:
- 6000 series devices need enhanced sensitivity calibration.
- 6000 series devices need a different setting for the shadow reg.
- set the IWN_FLAG_HAS_11N bit if the EEPROM says the device has 11n
  support.

Obtained from:	OpenBSD
2011-04-16 14:56:13 +00:00
bschmidt
5f1e6f7da3 Bring over the HAL/OPS changes, instead of two const structs it is now
slightly more dynamic.

Obtained from:	OpenBSD
2011-04-16 14:51:46 +00:00
bschmidt
13b495cd85 Read RX/TX chainmasks directly of the EEPROM. Some chips are known to
have the wrong/broken information stored, keep the hardcoded values for
those.

Obtained from:	OpenBSD
2011-04-16 14:49:29 +00:00
bschmidt
688aa54089 Just a whitespace sync, some more style(9) conform then others. 2011-04-16 14:40:42 +00:00
bschmidt
28acd24a60 Sync comments with OpenBSD. 2011-04-16 14:38:57 +00:00
bschmidt
0e01d92c6f Sync debug and error messages with OpenBSD. 2011-04-16 14:38:01 +00:00
bschmidt
414ffc4eda Shuffle code around a bit. Mostly to group functional connected things,
others to get the same order as the OpenBSD code.
2011-04-16 14:36:43 +00:00
bschmidt
e0b1e85870 Rename some stuff in favour of the OpenBSD names:
- prefer EDCA over WME
- qid for a TXQ ID
- reg for register values
2011-04-16 13:40:32 +00:00
bschmidt
20e8c16a03 Fix WME/QoS handling:
- move the TX queue selection into iwn_tx_data/iwn_tx_data_raw
- extract traffic identifier and use it
- do not expect ACKs for frames marked as such
2011-04-16 13:25:19 +00:00
bschmidt
52a6150689 Remove if_ierrors which do not necessarily indicate a RX error, also
do account send packets. While here use the IWN_TX_FAIL constant.
2011-04-16 13:12:12 +00:00
bschmidt
d10ef1ad6b Instead of hardcoding TX rates and using that to fill the retry table
use the neogotiated ni_rates instead.
2011-04-16 12:42:54 +00:00
bschmidt
322300a743 Replace RX/TX ring allocation error messages with something more sane
and remove those where the caller already prints one.
2011-04-16 11:14:42 +00:00
bschmidt
ad65a3b837 Prevent double-free, also use the same error codes as OpenBSD. 2011-04-16 11:11:22 +00:00
bschmidt
7100785646 Add missing bus_dmamap_sync calls as well as remove two duplicate ones.
Obtained from:	OpenBSD
2011-04-16 10:52:11 +00:00
bschmidt
5e7a436f9a Unify TX/RX ring allocation, finish the descriptior DMA stuff before
starting with data.
2011-04-16 10:38:27 +00:00
bschmidt
ebcc30282e Make sure to destroy all DMA tags and maps. 2011-04-16 10:35:02 +00:00
bschmidt
7c20ac5e15 Rewrite DMA segment handling to be more inline with the OpenBSD code.
Also change the m_len == 0 hack to have less code churn.
2011-04-16 10:32:46 +00:00
bschmidt
021ca1d5e8 scratch_paddr has the same address pre-assigned, use that instead. 2011-04-16 09:39:08 +00:00
bschmidt
aa270ec747 In case a new mbuf can't be loaded, reuse the old one. 2011-04-16 09:34:40 +00:00
bschmidt
a6840d80df OpenBSD uses IWN_RBUF_SIZE not MJUMPAGESIZE for the RX path, also replace
caddr_t with void * to be in sync.
2011-04-16 08:59:21 +00:00
bschmidt
d72bcb668e Remove the flags argument of iwn_dma_contig_alloc(), it is always set
as BUS_DMA_NOWAIT. While here also set BUS_DMA_COHERENT.
2011-04-16 08:57:17 +00:00
bschmidt
fb5d86e081 RSSI related syncs with the OpenBSD code:
- read RSSI only for the active chains
- cast RSSI/NF to int8_t before passing it up to radiotap
- remove the htole64() for the timestamp

Obtained from:	OpenBSD
2011-04-16 07:32:57 +00:00
bschmidt
faacd12d69 Pass errors that might happen during state transitions up to net80211. 2011-04-16 07:21:00 +00:00
bschmidt
20625a61f2 Obtain the channel number directly from the laster RXON command, also
chan is an uint8_t.
2011-04-16 07:17:03 +00:00
bschmidt
52481f8930 fix the order of the prototypes from the previosu commit 2011-04-15 20:40:49 +00:00
bschmidt
f3e88fddee The 6005 series devices need additional temperature offset calibration
as well as the IWN_GP_DRIVER_CALIB_VER6 bit set.

Obtained from:	OpenBSD
2011-04-15 20:35:15 +00:00
bschmidt
23c4ff42c1 Revert some of local calibration changes in favour of the OpenBSD
implementation. This includes the fix required for the 6050 series
devices.
2011-04-15 20:31:02 +00:00
bschmidt
36c570a8f4 remove debug left-overs 2011-04-15 20:19:18 +00:00
bschmidt
ca2dade4ee Split up watchdog and calibration callout. This allows us to use different
timing on both and to remove some monitor mode specific hacks (which has
no calibration).
2011-04-15 20:17:52 +00:00
bschmidt
5c6bf37865 Split out bluetooth coexistence setup. 2011-04-15 17:10:52 +00:00
bschmidt
ad2a1e9bd6 Fixes for firmware handling:
- there is a local variable for sc->fw_dma, use that instead
- OpenBSD uses 5*hz to wait for firmware to be loaded
- in case the firmware module contains invalid data, actually release it
2011-04-15 16:59:56 +00:00
bschmidt
bf7dbef3fe Only handle beacon misses while in RUN state and not scanning. 2011-04-15 16:55:45 +00:00
bschmidt
0c4b8beabc Don't timeout when stopping DMA channels.
Obtained from:	OpenBSD
2011-04-15 16:50:37 +00:00
bschmidt
17965a03aa Instead of trying to figure out which rxon.flags to clear, restart
from scratch. Remove htole16() calls, rxon.chan is an uint8_t,
ieee80211_chan2ieee() does return an ic_ieee as an int, but I heavily
doubt a htole16() will buy us anything here.
2011-04-14 17:42:21 +00:00
bschmidt
e8c8ce01fd iwn_cleanup() is just a wrapper around iwn_detach(), call it directly
instead.
2011-04-14 17:31:34 +00:00
bschmidt
edf1993df3 Reuse net80211 code:
- IWN_TXOP_TO_US is equal to IEEE80211_TXOP_TO_US
- use IEEE80211_DUR_TU
- ieee80211_add_rates/ieee80211_add_xrates are public, use em
- copied ieee80211_add_ssid it is not public
2011-04-14 17:26:13 +00:00
bschmidt
7b24235d45 Remove IWN_FLAG_HAS_5GHZ and IWN_PCI_BAR0, both unused. 2011-04-14 17:19:33 +00:00
jhb
00c3c01f4f Do a sweep of the tree replacing calls to pci_find_extcap() with calls to
pci_find_cap() instead.
2011-03-23 13:10:15 +00:00
bschmidt
c0217db66a Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
This fixes hostap mode for at least ral(4) and run(4), because there is
no sufficient call into drivers which could be used initialize the node
related ratectl variables.

MFC after:	3 days
2011-01-17 20:15:15 +00:00
bschmidt
80d6042924 Fixes for monitor mode:
- Do not call iwn_calib_reset() for monitor mode. We do not want to query
  information and do runtime calibration while in monitor mode. Poking the
  firmware with adjustments for calibration results in firmware asserts.
  This could happened on RUN -> RUN transition only.
- Adjust blink rate for monitor mode. It's supposed to not freak out and
  turn off after a while.
- While here, remove one useless assignment of calib.state, it gets
  overwritten later in the function.

Submitted by:	Brandon Gooch <jamesbrandongooch at gmail.com>
MFC after:	1 week
2010-12-06 18:28:39 +00:00
bschmidt
f8b10ad3cb For 6000 series and newer devices the DC calibration results are no
longer requested of the boot firmware. Instead of sending those results
to the runtime firmware the firmware is told to do the DC calibration
itself.

MFC after:	1 week
2010-12-05 09:00:32 +00:00
bschmidt
5fd0b74a4c Instead of using the AMRR ratectl algo as default for drivers which have
the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
a driver calls ieee80211_ratectl_init() check if the NONE algo is still
selected and try to use AMRR in that case. Drivers are still free to use
any other algo by calling ieee80211_ratectl_set() prior to the
ieee80211_ratectl_init() call.

After this change it is now safe to assume that a ratectl algo is always
available and selected, which renders the IEEE80211_C_RATECTL flag pretty
much useless. Therefore revert r211314 and 211546.

Reviewed by:	rpaulo
MFC after:	2 weeks
2010-11-06 18:17:20 +00:00
bschmidt
a63dfcea1b Fix typo in previous commit. 2010-09-19 12:52:23 +00:00
bschmidt
f16827fbee Rewrite parts of the calibration code which is run while bringing up
the device:
- unobscure some of the code by moving it into its own functions
- get rid of some magic numbers
- create similar structure as the reference driver has, this should
  make further syncs easier
2010-09-19 12:47:41 +00:00
bschmidt
3e08179d72 Group functions used for initial calibration. 2010-09-19 12:39:04 +00:00
bschmidt
267bcceb3d Introduce IEEE80211_C_RATECTL, drivers which use the ratectl framework
should set this capability.

MFC after:	2 weeks
2010-08-14 20:12:10 +00:00
bschmidt
85997188c8 Handle RUN->ASSOC->RUN transition correctly, as in not trigger a
firmware error. Convert if statements to a switch statement while
I'm here.

Tested by:	Benjamin Kaduk <kaduk at mit.edu>
MFC after:	2 weeks
2010-07-15 11:52:20 +00:00
bschmidt
f67e656794 Add support for firmware images in "type-length-value" format.
Obtained from:	OpenBSD
MFC after:	2 weeks
2010-07-15 10:37:49 +00:00
bschmidt
c7180de9b5 Detect active chains differently to work around a firmware bug which
would mark non-existing chains as active.

Obtained from:	OpenBSD
MFC after:	1 week
2010-07-15 09:34:00 +00:00