Commit Graph

185 Commits

Author SHA1 Message Date
Bernhard Schmidt
b29bf00c95 fix a panic resulting from a stray '&'
MFC after:	1 week
2012-11-27 19:09:36 +00:00
Bernhard Schmidt
7a7a0b8301 We need to defer passing the DELBA request to the firmware until the aggr
queue is empty or the firmware will go nuts.

PR:		kern/167806
Tested by:	osa@, Brandon Gooch (earlier version),
		    Bojan Petrovic (earlier version)
MFC after:	3 days
2012-06-27 16:07:01 +00:00
Bernhard Schmidt
547ea37a96 Fix a TX aggregation issue, if after the last compressed BA notification
the TX queue is empty, there won't be a TX done notification, effectly
resulting in an mbuf leak. The correct way to handle this is to free
up mbufs on both BA and TX done notifications up to the last sent seqno.

Tested by:	osa@
MFC after:	3 days
2012-06-27 15:55:34 +00:00
Marius Strobl
f3a4392048 Remove nitems() now that it lives in <sys/param.h> since r236486. 2012-06-02 20:00:52 +00:00
Bernhard Schmidt
149daddbd1 remove unused vap variable
MFC after:	1 week
2012-05-20 10:02:24 +00:00
Bernhard Schmidt
f5546f8dd8 Discard frames after a DELBA which where queued during an active BA
session.

MFC after:	1 week
2012-05-20 10:00:36 +00:00
Bernhard Schmidt
c22cec03cd Add some more 100/130 series device IDs.
MFC after:	3 days
2012-05-20 09:29:14 +00:00
Adrian Chadd
2aa563dfeb Migrate the net80211 TX aggregation state to be from per-AC to per-TID.
TODO:

* Test mwl(4) more thoroughly!

Reviewed by:	bschmidt (for iwn)
2012-04-15 20:29:39 +00:00
Bernhard Schmidt
5ea748f578 Use the M_AMPDU_MPDU flag to determine when to manually set the seqno and
use a BA queue.
2012-04-15 18:25:17 +00:00
Bernhard Schmidt
d3287f9a2e strip (R) to match manpage and pci_vendors
MFC after:	1 week
2012-03-27 18:27:45 +00:00
Bernhard Schmidt
5465c7a0d4 Add support for 6150 series devices.
Tested by:	Shane Riddle <sh4neriddle at yahoo dot com>
MFC after:	1 week
2012-03-27 17:45:50 +00:00
Bernhard Schmidt
ada977b103 Use suspend/resume methods provided by net80211. This ensures that the
appropriate state handling takes place, not doing so results in the
device doing nothing until manual intervention.

Reviewed by:	iwasaki
Tested by:	iwasaki (iwi)
MFC after:	4 weeks
2012-03-23 19:32:30 +00:00
Bernhard Schmidt
0f7a9c77e3 On state changes from RUN to anything else the AGGR sessions are
cleared/dropped leading to qid2tap[n] being NULL as there no longer
is a tap. Now, if there have been lots of frames queued the firmware
processes and returns those after the tap is gone.

Tested by:	osa
MFC after:	1 week
2012-01-27 17:39:02 +00:00
Bernhard Schmidt
3e51210689 Don't rely on MCS7 being at index 7 while determining the amount
of antennas to use. Not all APs enable all MCS rates.

Poked by:	Lucius Windschuh <lwindschuh at googlemail dot com>
MFC after:	1 week
2012-01-03 09:42:31 +00:00
Bernhard Schmidt
fcd9500f91 Fix some net80211 enum nits:
- ic_vap_create() uses an ieee80211_opmode argument
- ieee80211_rate2media() takes an ieee80211_phymode argument
- ieee80211_plcp2rate() takes an ieee80211_phytype argument
- cast to enum ieee80211_protmode and ieee80211_roamingmode to silence
  compiler warnings

Submitted by:	arundel@
2011-12-17 10:23:17 +00:00
Bernhard Schmidt
26ddc9835a The DC calibration result obtained during initialization can't be
passed over to the runtime firmware on 6050 devices. Instead let
the runtime firmware do the calibration itself. This fixes support
for the 6050 series devices.

Obtained from:	OpenBSD
Submitted by:	kevlo
Tested by:	lx, Tz-Huan Huang(earlier version)
2011-11-21 22:19:12 +00:00
Bernhard Schmidt
80abcbf807 Let net80211 also know about stopped BA sessions. This fixes some issues
where the driver assumed that BA resources are still available due to
net80211 saying so.

PR:		161407, 159768
Tested by:	cperciva, rene
MFC after:	3 days
2011-10-24 07:37:01 +00:00
Bernhard Schmidt
a7978bab76 Fix bmiss notifications, events should be sent when NOT scanning.
MFC after:	3 days
2011-10-13 18:17:03 +00:00
Marius Strobl
a131219c6e Recognize the Intel(R) Centrino(R) Wireless-N 130.
PR:	161162
2011-10-09 21:36:14 +00:00
Adrian Chadd
f3536faf94 Manually set the channel when using monitor mode - the firmware
doesn't select it automatically.

Submitted by:	nox
Reviewed by:	bschmidt
Approved by:	re
PR:		kern/160815
2011-09-20 04:30:23 +00:00
Bernhard Schmidt
19da774130 Make sure to drop the IEEE80211_RATE_BASIC flag even for MCS rates.
Reported by:	Maciej Milewski <milu at dat dot pl>
Tested by:	Maciej Milewski <milu at dat dot pl>
2011-06-10 17:06:25 +00:00
Bernhard Schmidt
de9358edc6 Enable HT40 (40MHz channel width) support. 2011-06-04 15:22:01 +00:00
Bernhard Schmidt
98b4acc4c3 Only consider QoS frames for TX packet aggregation. 2011-06-04 11:56:20 +00:00
Bernhard Schmidt
bf6998c568 The firmware of 4965 series adapters seems to die while trying to send
probe requests at 1Mbps while being associated on a 5GHz channel. Sending
those at 6Mbps does work, so use that instead during a background scan.
This workaround allows us to re-enable background scan support for the
4965 adapters.

Also, just enabling one antenna on 5GHz results in better reception of
beacons:
test            00:26:5a:c6:14:1a   40   54M -71:-95  200 E    WME HTCAP ATH
vs
test            00:26:5a:c6:14:1a   40   54M -92:-95  200 E    WME HTCAP ATH
Due to roam:rssi thresholds set to 7 by default it might have been
impossible to associate to that network. While here use
IEEE80211_IS_CHAN_5GHZ() to determine the band.
2011-06-04 11:43:09 +00:00
Bernhard Schmidt
129145a426 Add module version to iwi/ipw/wpi and iwn.
The version is used to check if a module is already preset, not setting
it results in:

can't re-use a leaf (ipw)!
module_register: module pci/ipw already exists!
Module pci/ipw failed to register: 17

while trying to load the module due to an entry in loader.conf. With this
commit we get the expected:

module ipw already present!

Reported by:	Dru Lavigne, bz
Tested by:	bz
MFC after:	1 week
2011-05-31 19:08:25 +00:00
Bernhard Schmidt
4f6760821e Only update the scheduler's byte count table for aggregation queues.
The other queues, especially the command queue, uses the FIFO mode
which doesn't require the byte count table because queued entries are
processed in order.

Pointed out by:	Lucius Windschuh <lwindschuh at googlemail dot com>
2011-05-15 08:09:36 +00:00
Bernhard Schmidt
7d3ddebe0a Enable 11n (sans HT40) support. 2011-05-08 12:23:01 +00:00
Bernhard Schmidt
b5d2f6bf26 Notify firmware about various HT parameters once associated. 2011-05-08 12:11:20 +00:00
Bernhard Schmidt
97fadf57df Add support for TX packet aggregation. 2011-05-08 12:06:12 +00:00
Bernhard Schmidt
b2ad04c708 Add support for RX packet aggregation. 2011-05-08 11:58:23 +00:00
Bernhard Schmidt
fa818eae51 Add support for transmitting frames at MCS rates. 2011-05-08 11:54:38 +00:00
Bernhard Schmidt
1647639a26 Prepare for transmitting frames at MCS rates:
- instead of calling iwn_plcp_signal() for every frame, map the expected
  value directly within wn->ridx
- concat plcp, rflags and xrflags, there is no clean byte boundary within
  the flags, for example the antenna setting uses bit 6, 7 and 8
- there is still need for a custom rate to plcp mapping, as those expected
  by the hardware are not conform to the std
2011-05-08 11:49:50 +00:00
Bernhard Schmidt
e9823bf8c9 Read chainmask information before announcing it. 2011-05-08 11:05:03 +00:00
Bernhard Schmidt
d86e3b2227 Add HT capabilities to probe requests. 2011-05-08 11:03:16 +00:00
Bernhard Schmidt
c9ce626212 Disable background scan support for 4965 adapters.
On legacy channels every once in a while the firmware throws a SYSASSERT
on line 208. On HT channels though this does always happen and I'm not
aware of any workaround currently.
2011-05-08 11:01:53 +00:00
Bernhard Schmidt
b648a23887 RX aggregation is slightly different then the legacy path, we will only
receive one RX_PHY for each aggregate and not one RX_PHY per frame.
2011-05-08 10:57:44 +00:00
Bernhard Schmidt
45e562203f Allocate all TX rings, those will be use for TX packet aggregation. 2011-05-08 10:54:50 +00:00
Bernhard Schmidt
3c2a1fc39d Use the enhanced TX power information availabe on newer EEPROMs. 2011-05-08 10:35:16 +00:00
Bernhard Schmidt
c07d5014de Hook HT channel setup. 2011-05-08 10:31:22 +00:00
Bernhard Schmidt
688f94830d The 6000 series adapters have a slightly different offset for band 6,
2GHz HT40 channels.
2011-05-08 10:21:42 +00:00
Bernhard Schmidt
3016ab149d Re-add 2 device IDs which got lost.
Pointed out by:	benjsc
2011-05-08 10:19:29 +00:00
Bernhard Schmidt
9cfb2cd173 Now that all bits are in for 1030/6230 adapters enable those.
While here pull the adapter names from the Linux driver and sort
the list by ID.
2011-04-20 17:49:05 +00:00
Bernhard Schmidt
57becf59ea The 6000 series gen2 adapters have 2 firmware images, one with
advanced btcoex support and one without.
2011-04-20 17:43:20 +00:00
Bernhard Schmidt
8bb237d949 Add basic support for advanced bluetooth coexistence required
for 6005 gen2b (1030/6030) adapters.
2011-04-20 16:59:27 +00:00
Bernhard Schmidt
d37f258ba9 Enable DC calibration for all 6000 series devices, except those
with an internal PA.
Override the chainmask also for the 6050.
2011-04-19 19:51:35 +00:00
Bernhard Schmidt
9ff2129fbe 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
Bernhard Schmidt
9dd0e40b62 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
Bernhard Schmidt
552e368d27 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
Bernhard Schmidt
61a504f68f 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
Bernhard Schmidt
a987f807de Just a whitespace sync, some more style(9) conform then others. 2011-04-16 14:40:42 +00:00
Bernhard Schmidt
6cc1bb61fa Sync comments with OpenBSD. 2011-04-16 14:38:57 +00:00
Bernhard Schmidt
80ee921916 Sync debug and error messages with OpenBSD. 2011-04-16 14:38:01 +00:00
Bernhard Schmidt
786b72c5bc 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
Bernhard Schmidt
5fd12c76a8 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
Bernhard Schmidt
4e61a8e57c 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
Bernhard Schmidt
baa8b4ad20 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
Bernhard Schmidt
3096855e8c 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
Bernhard Schmidt
7223fe84f2 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
Bernhard Schmidt
0df53de1c3 Prevent double-free, also use the same error codes as OpenBSD. 2011-04-16 11:11:22 +00:00
Bernhard Schmidt
47c2ecefcc Add missing bus_dmamap_sync calls as well as remove two duplicate ones.
Obtained from:	OpenBSD
2011-04-16 10:52:11 +00:00
Bernhard Schmidt
fac0198998 Unify TX/RX ring allocation, finish the descriptior DMA stuff before
starting with data.
2011-04-16 10:38:27 +00:00
Bernhard Schmidt
a59641a1a4 Make sure to destroy all DMA tags and maps. 2011-04-16 10:35:02 +00:00
Bernhard Schmidt
1f43fb20f2 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
Bernhard Schmidt
58e6c20852 scratch_paddr has the same address pre-assigned, use that instead. 2011-04-16 09:39:08 +00:00
Bernhard Schmidt
f75e83846a In case a new mbuf can't be loaded, reuse the old one. 2011-04-16 09:34:40 +00:00
Bernhard Schmidt
3f01dc2d9d 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
Bernhard Schmidt
5c222f4bc8 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
Bernhard Schmidt
65aa0234f0 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
Bernhard Schmidt
1eccdf31c1 Pass errors that might happen during state transitions up to net80211. 2011-04-16 07:21:00 +00:00
Bernhard Schmidt
c2c3b03223 Obtain the channel number directly from the laster RXON command, also
chan is an uint8_t.
2011-04-16 07:17:03 +00:00
Bernhard Schmidt
f6bb3360b6 fix the order of the prototypes from the previosu commit 2011-04-15 20:40:49 +00:00
Bernhard Schmidt
89a84499e4 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
Bernhard Schmidt
083e216732 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
Bernhard Schmidt
518e267e38 remove debug left-overs 2011-04-15 20:19:18 +00:00
Bernhard Schmidt
af2e228dc4 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
Bernhard Schmidt
16b483cb8d Split out bluetooth coexistence setup. 2011-04-15 17:10:52 +00:00
Bernhard Schmidt
b558f70709 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
Bernhard Schmidt
a7387751dd Only handle beacon misses while in RUN state and not scanning. 2011-04-15 16:55:45 +00:00
Bernhard Schmidt
69e775c384 Don't timeout when stopping DMA channels.
Obtained from:	OpenBSD
2011-04-15 16:50:37 +00:00
Bernhard Schmidt
9289984d4b 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
Bernhard Schmidt
8dace48f6b iwn_cleanup() is just a wrapper around iwn_detach(), call it directly
instead.
2011-04-14 17:31:34 +00:00
Bernhard Schmidt
b2d64bef7e 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
Bernhard Schmidt
abd8979b98 Remove IWN_FLAG_HAS_5GHZ and IWN_PCI_BAR0, both unused. 2011-04-14 17:19:33 +00:00
John Baldwin
3b0a4aef96 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
Bernhard Schmidt
bd56e71b4b 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
Bernhard Schmidt
1b6b62c900 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
Bernhard Schmidt
2d5c617a52 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
Bernhard Schmidt
a7c6aabdc3 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
Bernhard Schmidt
71203720f3 Fix typo in previous commit. 2010-09-19 12:52:23 +00:00
Bernhard Schmidt
d8ac0e6633 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
Bernhard Schmidt
0fc7c4008f Group functions used for initial calibration. 2010-09-19 12:39:04 +00:00
Bernhard Schmidt
ad8e331bf2 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
Bernhard Schmidt
ef403f3689 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
Bernhard Schmidt
7832b1f674 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
Bernhard Schmidt
76e46e73c3 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
Bernhard Schmidt
b1429c8528 - Add new IDs for 6000 series devices.
- The 6000 series WiMAX devices need a separate firmware.
- The b-gen devices are not hooked because the hardware revision type
  is not know.

Obtained from:	OpenBSD
MFC after:	1 week
2010-07-15 09:30:54 +00:00
Bernhard Schmidt
f901a391d4 Fix some small whitespace nits.
MFC after:	3 days
2010-07-15 08:05:20 +00:00
Bernhard Schmidt
07baa68089 Remove duplicate vendor:device entry.
MFC after:	3 days
2010-07-15 07:45:37 +00:00
Bernhard Schmidt
98f4f952f3 Fix TX retry rate handling. tx->linkq is an index to a rate table
beginning with the highest available rate. Currently we always use
54m for the first retry no matter what AMRR has choosen. Fix this
by setting the index to the next lower rate.

Approved by:	rpaulo (mentor)
Tested by:	Brandon Gooch <jamesbrandongooch at gmail.com>
MFC after:	2 weeks
2010-06-14 18:26:10 +00:00
Bernhard Schmidt
2e3a546047 Add a workaround for a bug in the firmware regarding the transition
from passive to active scans. Basicly disable it by increasing the
amount packets to be received to an amount which can't be reached
during dwell times.

Approved by:	rpaulo (mentor)
MFC after:	3 days
2010-05-06 17:53:04 +00:00