Commit graph

310 commits

Author SHA1 Message Date
Bjoern A. Zeeb 9e012a9da5 iwn(4): correct debug message: "not" to "no"
Sponosred by:	The FreeBSD Foundation
MFC after:	3 days
2024-06-05 22:05:12 +00:00
Bjoern A. Zeeb 1c6dd33d26 Revert "Widen EPOCH(9) usage in PCI WLAN drivers."
This reverts commit b65f813c1a.
As a side effect this also seems to fix wtap which seems to have
lost the epoch over the input path in between.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-12-01 00:48:54 +00:00
Warner Losh 685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh 71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Warner Losh 95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Justin Hibbits 76614fdc8c Mechanically convert iwi(4) and iwn(4) to IfAPI
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37849
2023-02-06 12:32:05 -05:00
Gordon Bergling dc79640e92 iwn(4): Correct a typo in a kernel error message
- s/settting/setting/

MFC after:	5 days
2022-09-04 12:23:27 +02:00
John Baldwin a571fed7f4 iwi/iwm/iwn: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:39:31 -07:00
John Baldwin d31850654e iwn: Remove write-only extra variable.
extra is used in a commented-out expression to compute
scan_service_time.  Use #if 0 instead of a comment for the disabled
scan_service_time expression and move the unused computation of extra
under the same #if.
2022-04-06 16:45:27 -07:00
Radosław Chmielarz 03d4b58fee iwn: adjust EEPROM read timeout for Intel 4965AGN M2
Reading EEPROM from Intel 4965AGN M2 takes 60 us which was causing panic
on system startup.

PR:		255465
Reviewed by:	markj
MFC after:	1 week
2021-06-06 16:44:47 -04:00
Sofian Brabez 561d34d705 iwnstats: fix build with clang and allow install under /usr/local/sbin
iwnstats was not compiling because of some issues raised by the clang
compiler due to -Werror. As a tool it is not connected to world build.

Add missing field "barker_mrc" initialization in struct
iwn_sensitivity_limits for -Wmissing-field-initializers, remove unused
pointer *is on iwn_stats_*_print functions and unused variables for
-Wunused-parameter and -Wunused-variable.

The value for field "barker_mrc" of struct iwn2030_sensitivity_limits
was obtained from linux 3.2 wireless/iwlwifi driver code (iwl-2000.c:115
.barker_corr_th_min_mrc = 390).

Also set BINDIR in Makefile to make it possible to install under
/usr/local/sbin/iwnstats as it require super user.

Reviewed by:	adrian
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29800
2021-04-20 18:07:56 +00:00
Adrian Chadd b6fd00791f [iwn] Flip over to use VAP flags rather than ic flags for things
net80211 changed a while back to support per-VAP config for things
rather than it being global.  This is to support firmware NICs that
support per-VAP flags and configuration where the firmware will figure
out how to combine them.

However, it introduced a fun timing issue - those changes used to happen
to the shared ic state before newstate() was called, but now they're
also tasks and they can happen /after/.

This isn't a problem for ath(4), but it exposed some interesting
timing and config bugs here.  Notably, I saw short slot NOT being
configured in 5GHz mode during some associations, so 5GHz stuff
would hang or behave poorly.  Other times the follow-up auth has
the right config, so it didn't hang.

So for now, just flip this over to using the per-VAP flags which
are correct when newstate() is called.  net80211 should also have
those flags synch'ed to the global ic state before newstate() runs
and that can come in a subsequent commit.

Whilst here also fix plcp to be consistently logged as a hex value.

Tested:

* iwn(4) Intel 6205, STA mode, both 2GHz and 5GHz

Differential Revision:	https://reviews.freebsd.org/D29379
Reviewed by: bz
2021-03-25 18:26:09 -07:00
Bjoern A. Zeeb fe5ebb23cc Provide MS() and SM() macros for 80211 and wireless drivers.
We have (two versions) of MS() and SM() macros which we use throughout
the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
macros.  Also change one internal case using both _S and _M instead of
just _S away from _M (one of the reasons rtwn and rsu were not changed).

This was done semi-mechanically.  No functional changes intended.

Requested by:	gnn (D26091)
Reviewed by:	adrian (pre line wrap)
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision:	https://reviews.freebsd.org/D26539
2020-09-24 10:57:39 +00:00
Bjoern A. Zeeb c6167b4bf5 WiFi: fix ieee80211_media_change() callers
In r178354 with the introduction of multi-bss ("vap") support factoring
out started and with r193340 ieee80211_media_change() no longer returned
ENETRESET but only 0 or error.
As ieee80211(9) tells the ieee80211_media_change() function should not
be called directly but is registered with ieee80211_vap_attach() instead.

Some drivers have not been fully converted.  After fixing the return
checking some of these functions were simply wrappers between
ieee80211_vap_attach() and ieee80211_media_change(), so remove the extra
function, where possible as well.

PR:		248955
Submitted by:	Tong Zhang (ztong0001 gmail.com) (original)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-09-07 15:35:40 +00:00
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