aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iwm/if_iwm.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Widen EPOCH(9) usage in PCI WLAN drivers."Bjoern A. Zeeb2023-12-011-5/+0
| | | | | | | | | This reverts commit b65f813c1ab99448278961c5ca80dc422b1eae29. 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
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* iwi/iwm/iwn: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-061-3/+1
|
* iwm: plug set-but-not-used varsMateusz Guzik2022-04-221-1/+10
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* iwm: Fix -Wunused-but-set-variable warningsMark Johnston2022-02-281-6/+3
| | | | MFC after: 1 week
* iwm: plug some of set-but-not-used varsMateusz Guzik2021-12-141-7/+0
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* iwm: update if_iwmreg.h to the latest (as of today) openbsd changesAdrian Chadd2021-10-271-102/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This updates the if_iwmreg.h definitions to; OpenBSD: if_iwmreg.h,v 1.65 2021/10/11 09:03:22 stsp Exp A few things haven't been fully converted, namely: * I left a couple things as enums for now just to reduce the other diffs needed; but they're the same values * The IWM_SCD_QUEUE_* macros have different offsets which I didn't update in case they broke things / changed based on later firmware. But they also may be real bugfixes which are needed for later chips. It'll need more testing before flipping this on. The c file updates are: * Use the newer names for things if the name changed but the semantics didn't * Explicitly use the earlier firmware structs which maintain compat with the current firmware and code. The newer ones are in here and they'll get converted when more openbsd code is merged into this tree. * Use the older iwm rate table for now, which has entries for legacy rates, HT and VHT. Our code works with that right now, updating it to openbsd's err, "different" version can be done at a later date when HT/VHT support is added. Notably, a bunch of definitions were deleted that weren't used. They're not used either in the openbsd/dfbsd drivers so I think it's safe to delete them in the long run. Test Plan: 7260 hw 0x140 Subscribers: imp Differential Revision: https://reviews.freebsd.org/D32627 Reviewed by: md5 Obtained From: OpenBSD
* net80211/drivers: improve ieee80211_rx_stats for bandBjoern A. Zeeb2021-10-221-0/+5
| | | | | | | | | | | | | While IEEE80211_R_BAND was defined, there was no place to store the band. Add a field for that, adjust ieee80211_lookup_channel_rxstatus() to require it, and update drivers passing "R_{FREQ|IEEE}" in already to provide the band as well. For the moment keep the fall-back code requiring all three fields. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D30662
* iwm(4): Add support for Intel Killer(R) Wireless-AC 1550iMark Johnston2021-01-141-0/+2
| | | | | | PR: 252578 Submitted by: shu <ankohuu@outlook.com> MFC after: 1 week
* iwm: fix regression from r365419 (ieee80211_media_change())Bjoern A. Zeeb2020-09-111-24/+2
| | | | | | | | | | | | | | | | | | | In r365419 ieee80211_media_change() callers were updated to not longer act on the obselete ENETRESET return code. While in the old days iwm has done a stop/init cycle in these cases, this was not executed since r193340. As a consequence simplify iwm code as well by passing ieee80211_media_change() right to ieee80211_vap_attach() as there is no more need for a local implementation. Reported by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) Tested by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) MFC after: 3 days X-MFC: fix is already in stable/12 PR: 248955 Notes: svn path=/head/; revision=365633
* WiFi: fix ieee80211_media_change() callersBjoern A. Zeeb2020-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=365419
* iwm: improve rfkill handlingAndriy Gapon2020-05-201-7/+42
| | | | | | | | | | | | | | Previously the driver handled the bit within itself, but did not expose the state change to net80211 and interface layers. This change uses net80211 KPI for rfkill signaling. The code is modeled after similar code in iwn and wpi. Reviewed by: adrian MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24923 Notes: svn path=/head/; revision=361273
* iwm: Print the command code for any unhandled commands.Mark Johnston2020-04-271-3/+2
| | | | | | | | Reported by: Marc Veldman <marc@bumblingdork.com> MFC after: 1 week Notes: svn path=/head/; revision=360373
* Widen EPOCH(9) usage in PCI WLAN drivers.Hans Petter Selasky2020-01-301-0/+5
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=357291
* iwm(4): Remove _mvm from the namespace.Mark Johnston2019-11-271-139/+138
| | | | | | | | | | | | | This was inherited from iwlwifi, which drives devices supported by both iwn(4) and iwm(4) in FreeBSD. In iwm(4) _mvm is meaningless, so remove it. OpenBSD made the same change a long time ago. No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=355144
* iwm(4): Fix version string formatting.Mark Johnston2019-11-271-1/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=355143
* iwm: Sync device initialization and reset code with iwlwifi.Mark Johnston2019-11-071-1/+11
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354516
* iwm: Use the default station for all transmits.Mark Johnston2019-11-071-5/+1
| | | | | | | | | | | This is what iwlwifi seems to do, and the previous behaviour triggered firmware panics during transmit on a 9560. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354514
* iwm: Set flag for pad bytes in offload_assist.Mark Johnston2019-11-071-3/+4
| | | | | | | | | | | Though we don't otherwise use firmware's offload capabilities, we need to set this flag when the MAC header's size isn't a multiple of four. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354513
* iwm: Use antenna B for TX on 9000-series chips.Mark Johnston2019-11-071-1/+4
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354512
* iwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.Mark Johnston2019-11-071-7/+9
| | | | | | | | | | Do not configure bluetooth on newer chips, it causes firmware panics. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354510
* iwm: Fix scheduler configuration for aux and cmd queue configuration.Mark Johnston2019-11-071-12/+19
| | | | | | | | | | | | | - Configure the scheduler only for the management queue. - Fix a bug when enabling the schduler: the queues are specified using a bitmask. - Fix style in the area. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354509
* iwm: Implement the new receive path.Mark Johnston2019-11-071-86/+312
| | | | | | | | | | | | | This is the multiqueue receive code required for 9000-series chips. Note that we still only configure a single RX queue for now. Multiqueue support will require MSI-X configuration and a scheme for managing a global pool of RX buffers. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354508
* iwm: Enable all 31 tx queues.Mark Johnston2019-11-071-1/+3
| | | | | | | | | | | | | For now iwm only ever uses queue 0 and the management queue, but my 9560 raises a software error interrupt during initialization if this flag is not set. iwlwifi sets it for all 7000- and 8000-series hardware, so we might as well do it unconditionally. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354507
* iwm: Add device configuration definitions for 9000-series chips.Mark Johnston2019-11-071-0/+6
| | | | | | | | | | | | | Match such chips using the device ID. We should really be checking the subdevice as well, since a smaller number of 9460 and 9560 devices actually belong to a new series of devices and require different firmware, but that will require some extra logic in iwm_attach(). Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=354504
* iwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.Mark Johnston2019-11-071-1/+0
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354503
* iwm: Use the same delays as iwlwifi when resetting the device.Mark Johnston2019-11-071-4/+6
| | | | | | | | | | | This is required for initialization to succeed for newer device families. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354502
* iwm: Add a device family definition for 9000 chips.Mark Johnston2019-11-071-14/+15
| | | | | | | | | | | Convert existing device family checks to avoid assuming that the device family is always one of IWM_DEVICE_FAMILY_7000 or _8000. Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=354501
* iwm: Define a name for TLV 48.Mark Johnston2019-11-071-1/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354497
* iwm: Avoid calling iwm_start() each time a descriptor is reclaimed.Mark Johnston2019-11-071-12/+19
| | | | | | | | | | | Only perform the call when a qfull bit transitions. While here, avoid assignments in declarations in iwm_mvm_rx_tx_cmd(). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354496
* iwm: Call iwm_dev_check() earlier in iwm_attach().Mark Johnston2019-11-071-7/+4
| | | | | | | | | | | | This ensures that the driver softc reflects device capabilities as early as possible, for use by device initialization code that is conditional on certain capabilities. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354495
* iwm: Simplify fw_has_{api,capa}().Mark Johnston2019-11-071-10/+6
| | | | | | | | | | No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354494
* iwm: Fix style in the TX path.Mark Johnston2019-11-071-17/+15
| | | | | | | | | | | | Also ensure that the htole* macros are applied correctly when specifying the segment length and upper address bits. No functional change intended (unless you use iwm(4) on a big-endian machine). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354492
* iwm: Drain callouts after stopping the device during detach.Mark Johnston2019-07-031-5/+4
| | | | | | | | | | | | | | | | Otherwise there is a window where they may be rescheduled. This typically manifested as a page fault shortly after unloading if_iwm.ko. Close the race by draining callouts after calling iwm_stop_device(), which is also what Dragonfly does. Change whitespace to reduce gratuitous diffs with Dragonfly. Reported and tested by: seanc MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=349711
* iwm(4): use correct channel list source for Intel 3168Andriy Voskoboinyk2019-03-111-3/+5
| | | | | | | | | | | | Intel 3168 uses another EEPROM section to store channel flags; port missing bits from iwlwifi to make it work. PR: 230750, 236235 Tested by: Bert JW Regeer <xistence@0x58.com> MFC after: 3 days Notes: svn path=/head/; revision=345002
* Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.Bjoern A. Zeeb2019-01-261-9/+2
| | | | | | | | | | | | | | | | | | | | | | * There's no reason to have a while() loop here, because: - if msleep returns 0, that means we were woken up by the interrupt handler, and we are going to exit immediately as sc_fw_chunk_done will now be 1 (there is nothing else that sleeps on sc_fw.) - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will exit immediately because of the if-test. So, just use a single msleep() and then check sc_fw_chunk_done as before. * The comment said we were sleeping for 5 seconds, but the msleep was only for 1. Before r314065, this was 1 second and so was the comment, and in that commit the comment was changed and the function call wasn't. Possibly fixes failures to initialize uCode on certain devices. Submitted by: Augustin Cavalier (waddlesplash gmail.com) Obtained from: Haiku 132990ecdcb072f2ce597b5d497ff3e5b1f09c20 MFC after: 10 days Notes: svn path=/head/; revision=343477
* iwm - Update alive response handling, add v4 and remove old versions.Kyle Evans2019-01-241-64/+37
| | | | | | | | Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (3820e2bf3331ced3541d1811a38c5a5136dfab93) Notes: svn path=/head/; revision=343388
* iwm - Fix race during detach, where a callout is left after driver is gone.Kyle Evans2019-01-241-0/+3
| | | | | | | | Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (ba3b4ff9a1fc04a349df05d6d3449f4d9b15c4be) Notes: svn path=/head/; revision=343387
* if_iwm - Stop iwm_watchdog callout when idle.Kyle Evans2019-01-241-2/+7
| | | | | | | | Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (6a8683b0e9d734f23bd9647e117da198c2b9a74e) Notes: svn path=/head/; revision=343386
* iwm - Always clear watchdog timer, when bringing down firmware state.Kyle Evans2019-01-241-4/+3
| | | | | | | | Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (8abdc2b36a45c4e9c95fc8263ca532ea26633dcb) Notes: svn path=/head/; revision=343385
* iwm - Clear Time Event active state, when receiving End Notification.Kyle Evans2019-01-241-8/+2
| | | | | | | | | | | | | | | | * This hopefully avoids some firmware panics, I was occasionally seeing, when iwm disconnects upon losing signal to an access point at some point. * This is synchronizing the if_iwm_time_event.c file a bit more from the corresponding Linux iwlwifi/mvm/time-event.c. Taken-From: Linux iwlwifi Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (e8cb71584a6a72232c13151d60e57f7f229220eb) Notes: svn path=/head/; revision=343384
* iwm - Improve firmware Time Event handling.Kyle Evans2019-01-241-2/+11
| | | | | | | | | | | | | * This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc change, and syncing with the Linux iwlwifi code. Taken-From: Linux iwlwifi, and OpenBSD Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (706a3044afd27c3fecfdf57bec1695310e53e228) Notes: svn path=/head/; revision=343383
* iwm - Avoid Tx watchdog timeout, when dropping a connection.Kyle Evans2019-01-241-0/+4
| | | | | | | | Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (3e12596fb5c55351517cdd741d72979388a8c75c) Notes: svn path=/head/; revision=343382
* iwm - Track firmware state better, and improve handling in iwm_newstate().Kyle Evans2019-01-241-157/+136
| | | | | | | | | | | | | | | | | | | | | * This avoids firmware resets in all the cases in iwm_newstate(). Instead iwm_bring_down_firmware() is called, which tears down all the STA connection state, according to the sc->sc_firmware_state value. * Improve the behaviour of the LED blinking a bit, so it only blinks when there really is a wireless scan going on. * Print the newstate arg in debug output of iwm_newstate(), to help in debugging. This is inspired by the firmware state maintaining change in OpenBSD's iwm, by stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a). Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (8a41b10ac639d0609878696808387a6799d39b57) Notes: svn path=/head/; revision=343381
* if_iwm - Configure the PCIe LTR, fix PCI express capability accesses.Kyle Evans2019-01-241-0/+18
| | | | | | | | | | Taken-From: Linux iwlwifi Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (08a7ad5a5ff65aaaf2df6a609be7a4e1df43efc3) Notes: svn path=/head/; revision=343379
* iwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.Kyle Evans2019-01-241-38/+36
| | | | | | | | | | * Rename some structs and struct members for firmware handling. Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (4b1006a6e4d0f61d48c67b46e1f791e30837db67) Notes: svn path=/head/; revision=343377
* if_iwm - Check sc->sc_attached flag in suspend/resume callbacks.Kyle Evans2019-01-241-0/+7
| | | | | | | | | | | | * There is (almost) nothing to do in suspend/resume if if_iwm has failed during initialization (e.g. because of firmware load failure) and was already uninitialized by iwm_detach_local(). Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (67b5e090efb225654815fed91020db6cfc16bb19) Notes: svn path=/head/; revision=343376
* if_iwm - Move iwm_read_firmware() call into iwm_attach().Kyle Evans2019-01-241-65/+43
| | | | | | | | | | | | | | | | | | | | | | * We should load the firmware exactly once before the driver really initializes the hardware the first time, and unload it at detach time. There is no need to retrieve the firmware during execution of iwm_mvm_load_ucode_wait_alive(), we should make sure we already have the firmware data at hand before that. * The existing sc_preinit_hook code fails to deal with the case where if_iwm is loaded by the loader (or is statically linked) and the firmware needs to be loaded from disk. So we can just call iwm_read_firmware() from iwm_attach() directly. * A separate solution will have to be added to properly defer the firmware loading during bootup, until the necessary filesystem is mounted. Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (0104ee1f4cb6a2313c00c2526c6ae98d42e5041d) Notes: svn path=/head/; revision=343375
* if_iwm - The iwm_prepare_card_hw() in iwm_attach() is only needed on 8K hw.Kyle Evans2019-01-241-11/+8
| | | | | | | | | | | | | | * Doing the iwm_prepare_card_hw() call in iwm_attach() only on Family 8000 hardware matches the code in Linux iwlwifi. * While there remove DEFAULT_MAX_TX_POWER definition which is unused, and has a value different from IWL_DEFAULT_MAX_TX_POWER in iwlwifi. Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (e8560f8dc58df12a7c79a6bb4e6ccb156e001085) Notes: svn path=/head/; revision=343374
* if_iwm - Update firmware rs table, instead of indexing the table in tx cmds.Kyle Evans2019-01-241-92/+79
| | | | | | | | | | | | | | | | | | | | | | * Rather than providing a non-zero index into the firmware RS table, we should always use index 0 and update the firmware RS table whenever our chosen tx rate for data-frames changes. * Send IWM_LQ_CMD updates when the tx rate gets updated by the net80211 rate control (which is after we tell the tx status to the net80211 rate-control in iwm_mvm_rx_tx_cmd_single()). * Disregard frames transferred with a different tx rate than the currently selected rate for the rate-control calculations. This way we avoid counting management frames (which are sent at a slow, and fixed rate), as well as frames we added to the tx queue just before a new IWM_LQ_CMD update took effect. Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku) Obtained from: DragonFlyBSD (5d6b465e288ac5b52d7115688d4e6516acbbea1c) Notes: svn path=/head/; revision=343373