Commit Graph

296 Commits

Author SHA1 Message Date
Adrian Chadd
60a9489509 [iwn] Set default ampdu parameters.
These are from the linux iwlwifi driver ;the default use smaller
maximum AMPDUs (8k) and a much smaller density (none.)  The latter
could cause stability issues.

Tested:

* Tested on Intel 6300, STA mode.

Differential Revision: https://reviews.freebsd.org/D25113
2020-06-05 04:24:34 +00:00
Hans Petter Selasky
b65f813c1a Widen EPOCH(9) usage in PCI WLAN drivers.
Make sure all occurrences of ieee80211_input_xxx() in sys/dev are
covered by a network epoch section. Do not depend on the interrupt
handler nor any taskqueues being in a network epoch section.

This patch should unbreak the PCI WLAN drivers after r357004.

Pointy hat:	glebius@
Sponsored by:	Mellanox Technologies
2020-01-30 10:28:01 +00:00
Andriy Voskoboinyk
786ac7035f Fix ieee80211_radiotap(9) usage in wireless drivers:
- Alignment issues:
 * Add missing __packed attributes + padding across all drivers; in
most places there was an assumption that padding will be always
minimally suitable; in few places - e.g., in urtw(4) / rtwn(4) -
padding was just missing.
 * Add __aligned(8) attribute for all Rx radiotap headers since they can
contain 64-bit TSF timestamp; it cannot appear in Tx radiotap headers, so
just drop the attribute here. Refresh ieee80211_radiotap(9) man page
accordingly.

- Since net80211 automatically updates channel frequency / flags in
ieee80211_radiotap_chan_change() drop duplicate setup for these fields
in drivers.

Tested with Netgear WG111 v3 (urtw(4)), STA mode.

MFC after:	2 weeks
2019-03-11 01:27:01 +00:00
Andriy Voskoboinyk
61b38ede81 iwn(4): plug initialization path vs interrupt handler races
There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR:		192641
MFC after:	5 days
2019-02-06 01:34:14 +00:00
Andriy Voskoboinyk
264eeebe12 iwn(4): drop i_seq field initialization for A-MPDU frames.
It is done by net80211 since r319460.

MFC after:	24 days
X-MFC-With:	343094
2019-01-22 01:44:47 +00:00
Andriy Voskoboinyk
d4e1661a09 iwn(4): drop return code from iwn_*attach functions (they cannot fail)
While here, add missing trace 'end' marker in iwn5000_attach().

MFC after:	1 week
2019-01-21 00:09:54 +00:00
Andriy Voskoboinyk
0613dc6f15 iwn(4): (partially) rewrite A-MPDU Tx path
Generic Tx stats fixes:
- do not try to parse "aggregation status" for single frames; send them
to iwn_tx_done() instead;
- try to attach mbuf / node reference pair to reported BA events;
allows to fix reported status for ieee80211_tx_complete() and ifnet counters
(previously all A-MPDU frames were counted as failed - see PR 210211);
requires few more firmware bug workarounds;
- preserve short / long retry counters for wlan_amrr(4)
(disabled for now - causes significant performance degradation).
- Add new IWN_DEBUG_AMPDU debug category.
- Add one more check into iwn_tx_data() to prevent aggregation ring
overflow.
- Workaround 'seqno % 256' != 'current Tx slot' case (until D9195 is not
in the tree).
- Improve watchdog timer updates (previously watchdog check was omitted
when at least one frame was transmitted).
- Stop Tx when memory leak in currently used ring was detected (unlikely
to happen).
- Few other minor fixes.

Was previously tested with:
 - Intel 6205, STA mode (Tx aggregation behaves much better now).
 - Intel 4965AGN, STA mode (still unstable).

PR:		192641, 210211
Reviewed by:	adrian, dhw
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10728
2019-01-16 12:33:06 +00:00
Warner Losh
0dc34160f3 Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,
mfi, mps, mpr, mvs, my, oce, pcn, ral, rl. This only labels existing
pci device tables, and has no probe / attach code changes.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Approved by: re (glen)
2018-09-26 17:12:30 +00:00
Eitan Adler
fd3150d8bf iwn: Add the missing IWN_SDID_6035_5 subdevice
Obtained from:	Haiku (da166fc6469b98397de98a7ccc13b82a3cd3b290)
2018-06-30 04:30:08 +00:00
Eitan Adler
a0d30ad6a1 iwn: Correct Centrino Advanced-N 6235 constants
The iwn 6235 is a 2x2 device (see
https://ark.intel.com/products/66890/Intel-Centrino-Advanced-N-6235-Dual-Band)

Reviewed by:	adrian, kevans
Obtained from:	Haiku
2018-06-28 21:59:45 +00:00
Adrian Chadd
9fbe631a1a [net80211] convert all of the WME use over to a temporary copy of WME info.
This removes the direct WME info access in the ieee80211com struct and instead
provides a method of fetching the data.  Right now it's a no-op but eventually
it'll turn into a per-VAP method for drivers that support it (eg iwn, iwm,
upcoming ath10k work) as things like p2p support require this kind of behaviour.

Tested:

* ath(4), STA and AP mode

TODO:

* yes, this is slightly stack size-y, but it is an important first step
  to get drivers migrated over to a sensible WME API.  A lot of per-phy things
  need to be converted to per-VAP before P2P, 11ac firmware, etc stuff shows up.
2018-01-02 00:07:28 +00:00
Andriy Voskoboinyk
c422c270b5 iwn: use correct mask for queue ids (0xf -> 0x1f). 2017-04-02 13:24:58 +00:00
Andriy Voskoboinyk
350086f249 iwn: remove unneeded cast. 2017-03-28 22:40:51 +00:00
Andriy Voskoboinyk
50e04f492d iwn: drop duplicate synchronization requests.
Rx descriptor / payload is already synchronized in iwn_notif_intr()
(before accessing desc->type / desc->qid fields).

Tested with Intel 6205, STA mode.
2017-03-28 22:31:48 +00:00
Andriy Voskoboinyk
53d5e4e71c iwn: fix debug message 2017-03-26 18:06:51 +00:00
Andriy Voskoboinyk
60ff4558ee iwn: fix error handling for one well-known corner case. 2017-03-26 17:59:51 +00:00
Andriy Voskoboinyk
d25646a482 iwn: drop unneeded bus_dmamap_sync() calls.
1) They are using wrong tag (Tx) + map (Rx) combination.
2) Rx descriptor is already synchronized in iwn_notif_intr()
3) It's not needed for transmitted data since device does not change
mbuf contents.

Tested with Intel 6205 (amd64), STA mode.
2017-03-26 16:46:39 +00:00
Andriy Voskoboinyk
15044a59f3 iwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().
Some code was additionally moved for (future) lock splitting.

Tested with Intel 6205, STA mode.

Differential Revision:	https://reviews.freebsd.org/D10106
2017-03-26 09:41:08 +00:00
Andriy Voskoboinyk
b4750b8855 iwn: omit unneeded bus_dmamap_sync() calls when compiled without
'options IWN_DEBUG'
2017-03-26 09:10:01 +00:00
Andriy Voskoboinyk
7d6a0b8e00 iwn: fix return code conflict in iwn_init_locked()
Do not try to use errno(2) codes here; instead, just return unique
value (1) when radio is disabled via hardware switch and another
one (-1) for any other error in initialization path.

Tested with Intel 6205, STA mode.
2017-03-25 22:07:21 +00:00
Andriy Voskoboinyk
64b92f2691 iwn: do not try to update node configuration when the node does not exist.
Firmware will just respond with status '0x8' (node does not exist) or
will hang -> cause 'device timeout's (sometimes).
2017-03-25 15:57:47 +00:00
Andriy Voskoboinyk
8972534f35 iwn: add few missing notification types into iwn_intr_str() 2017-03-25 13:15:43 +00:00
Andriy Voskoboinyk
9d5228cd85 iwn: add promiscuous mode support.
Tested with Intel 6205, STA / MONITOR modes.
2017-03-08 22:49:22 +00:00
Andriy Voskoboinyk
acd63c37d6 iwn: deduplicate (RXON + txpower + broadcast node) command sequence.
Was previously applied to wpi(4) as a part of r278366.

Tested with Intel 6205, STA / MONITOR modes.
2017-03-07 07:49:25 +00:00
Andriy Voskoboinyk
6977499ccf iwn: drop 'channel' parameter from iwn*_set_txpower()
For 4965 just extract 'is_chan_5ghz' flag from the RXON structure
(like it was done in r281287); for others it was never used.

Tested with Intel 6205, STA mode.
2017-03-04 23:07:54 +00:00
Andriy Voskoboinyk
7ab1926316 iwn: fix data rate parsing for Rx radiotap header.
Tested with Intel 6205, MONITOR mode + RTL8188EU, STA mode.
2017-03-01 00:42:38 +00:00
Andriy Voskoboinyk
f631357540 net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
directly from the node.

- Use ni_txparms directly instead of calculating them manually every time
- Move M_EAPOL flag check upper; otherwise it may be skipped due to
'ucastrate' / 'mcastrate' check
- Use 'mgtrate' for control frames too (see ifconfig(8), mgtrate parameter)
- Add few more M_EAPOL checks where it was missing (zyd(4), ural(4),
urtw(4))
- Few unrelated cleanups

Tested with:
 - Intel 6205 (iwn(4)), STA mode;
 - WUSB54GC (rum(4)), HOSTAP mode + RTL8188EU (rtwn(4)), STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9811
2017-02-26 20:49:35 +00:00
Andriy Voskoboinyk
c7a9c7f627 iwn: stop all watchdogs on device shutdown.
Tested with Intel 6205, STA mode.

MFC after:	5 days
2017-02-26 01:05:27 +00:00
Andriy Voskoboinyk
d7de0a2c2a iwn: some initialization / RF switch state change fixes.
- Check return code from initialization path; otherwise, vap state
may be wrong after an error.
- Do not try to run iwn_stop() / iwn_init() multiple times.
- Merge iwn_radio_on/off() and move RFKILL bit check into the task.
- Try to handle possible RF switch state change in S3 state (PR 181694).

PR:		181694
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9797
2017-02-25 00:40:50 +00:00
Adrian Chadd
617f8b101e [net80211] RX parameter shuffle in net80211 in preparation for 4x4 NICs and 160MHz channels.
* Migrate the rx_params stuff out from ieee80211_freebsd.h where it doesn't belong -
  this isn't freebsd specific anymore.

* Don't use a hard-coded number of chains in the ioctl header; now we can shuffle
  MAX_CHAINS around so it can be used in the right spot.

* Extend the signal/noisefloor levels in the mimo stats struct to userland to include
  the signal and noisefloor levels for each 20MHz slice of a 160MHz channel.

* Bump the number of EVM pilots in preparation for 4x4 and 160MHz channels.

Tested:

* ath(4), STA mode
* iwn(4), STA mode
* local ath10k port, STA mode

TODO:

* 11ax chips will come with 5GHz 8x8 hardware for lots of MU-MIMO - I'll re-bump it
  at that point.

Note:

* This breaks the driver and ifconfig ABI; please recompile  the kernel,
  ifconfig and wpa_supplicant/hostapd.
2017-02-20 02:08:08 +00:00
Oleksandr Tymoshenko
a728ea8ea2 [iwn] Several fixes for DMA part of iwn(4)
- Perform DMS sync when accessing/initializing ICT table
- Fix some DMA sync operations to use matching tags

Reviewed by:	avos
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8804
2016-12-21 22:35:26 +00:00
Oleksandr Tymoshenko
c837b8e35f [iwn] Perform BUS_DMASYNC_PREREAD when initializing RX buffer
BUS_DMASYNC_PREREAD is required when setting up RX buffer, otherwise
data provided by card can be overwritten by data evicted from cache

Also use proper tag when setting up RX descriptor

Reviewed by:	adrian, avos, ivadasz
Differential Revision:	https://reviews.freebsd.org/D8717
2016-12-10 17:59:34 +00:00
Andriy Voskoboinyk
f6930bec33 net80211: ieee80211_ratectl*: switch to reusable KPI
Replace various void * / int argument combinations with common structures:
- ieee80211_ratectl_tx_status for *_tx_complete();
- ieee80211_ratectl_tx_stats for *_tx_update();

While here, improve amrr_tx_update() for a bit:
1. In case, if receiver is not known (typical for Ralink USB drivers),
refresh Tx rate for all nodes on the interface.
2. There was a misuse:
- otus(4) sends non-decreasing counters (as originally intended);
- but ural(4), rum(4) and run(4) are using 'read & clear' registers
to obtain statistics for some period of time (and those 'last period'
values are used as arguments for tx_update()). If arguments are not big
enough, they are just discarded after the next call.

Fix: move counting into *_tx_update()
(now otus(4) will zero out all node counters after every tx_update() call)

Tested with:
- Intel 3945BG (wpi(4)), STA mode.
- WUSB54GC (rum(4)), STA / HOSTAP mode.
- RTL8188EU (urtwn(4)), STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8037
2016-10-02 20:35:55 +00:00
Andriy Voskoboinyk
1447d404e0 iwn: add watchdog for scanning.
Restart device if scanning was not done in time.

Tested by:	david@catwhisker.org

PR:		209198
Differential Revision:	https://reviews.freebsd.org/D6176
2016-05-26 11:12:36 +00:00
Andriy Voskoboinyk
bec488d17d iwn: fix comments for iwn_read_eeprom_channels().
It's used for all channels (20MHz and 40MHz).
2016-05-06 17:39:12 +00:00
Andriy Voskoboinyk
a7d1e7a9ec iwn: fix device reset after watchdog timeout.
Simple device reset (stop/start) is not enough here;
post-init state changes must be applied too.
2016-05-04 12:51:27 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Andriy Voskoboinyk
b8ad211534 iwn: do not buffer frames for non-passive channels (it's not needed). 2016-05-02 15:14:16 +00:00
Andriy Voskoboinyk
f5c911273a iwn: switch to ieee80211_add_channel*()
Switch to add_channel / add_channel_ht40 + pass channel's TX power
for the last.

Tested by:	dhw
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D6141
2016-05-01 22:00:40 +00:00
Pedro F. Giffuni
4ed3c0e713 sys: Make use of our rounddown() macro when sys/param.h is available.
No functional change.
2016-04-30 14:41:18 +00:00
Adrian Chadd
598003be2d [iwn] Don't try to seamlessly recover from a firmware panic; just restart
the interface.

I know this may be unpopular, but iwn is not yet completely ready for
a transparent firmware restart.  I have this thing panic my laptop
reliably because 11n state isn't kept in sync and the TX completion
path ends up trying to free a null node reference.
2016-04-03 23:39:58 +00:00
Andriy Voskoboinyk
86d9f8fc65 wpi, iwn: fix check in find_eeprom_channel()
Return correct eeprom_chan structure pointer for 7, 8, 11 and 12 5Ghz
channels.
2016-04-03 14:38:26 +00:00
Kevin Lo
277db30576 Remove bogus cast. 2016-02-19 01:57:51 +00:00
Andriy Voskoboinyk
1c6b43df0a wpi, iwn: implement ic_getradiocaps method
This will allow to restore channel list after switching interface
to more restrictive regdomain.

Tested with Intel 3945BG (wpi) only.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4863
2016-01-12 00:24:40 +00:00
Andriy Voskoboinyk
55d352400f iwn: reduce code duplication in iwn_read_firmware()
- Separate 'firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); sc->fw_fp = NULL;'
into iwn_unload_firmware().
- Move error handling to the end of iwn_read_firmware().

No functional changes.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4768
2016-01-04 21:11:27 +00:00
Andriy Voskoboinyk
502b7052ee iwn(4): various simple fixes
- Fix mbuf leaks in iwn_raw_xmit() and iwn_xmit_task()
(regression since r288178).
- Check IWN_FLAG_RUNNING flag under lock.
- Remove m->m_pkthdr.rcvif initialization (fixed in r283994).
- Enclose some values in return statements into parentheses.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4069
2015-11-05 22:44:36 +00:00
Kevin Lo
b020e15ebd Remove BUS_DMA_NOWAIT from bus_dma_tag_create() invocations as it's
no valid flag there.
2015-10-21 06:23:57 +00:00
Kevin Lo
4b0d8bec6b Switch PCI register reads from using magic numbers to using the names
defined in pcireg.h
2015-10-21 02:50:22 +00:00
Adrian Chadd
d957a93abe net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ieee80211_raw_output().
This doesn't free the mbuf upon error; the driver ic_raw_xmit method is still
doing that.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3774
2015-10-12 04:55:20 +00:00
Adrian Chadd
d3a4ade3b8 net80211: free node reference in the ieee80211_parent_xmitpkt() when error happened.
Move error handling into ieee80211_parent_xmitpkt() instead of spreading it
between functions.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3772
2015-10-12 04:30:38 +00:00