aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/wlan
Commit message (Collapse)AuthorAgeFilesLines
* rsu: migrate to new net80211 encryption key APIAdrian Chadd2026-02-221-7/+12
| | | | | | | Migrate to the new encryption key API rather than poking at the key struct directly. Differential Revision: https://reviews.freebsd.org/D54483
* run: rum: migrate to new net80211 encryption key APIAdrian Chadd2026-02-112-15/+26
| | | | | | | | | | | Migrate to the new encryption key API rather than poking at the key struct directly. Locally tested: * STA mode - run0: MAC/BBP RT2860 (rev 0x0101), RF RT2820 (MIMO 2T2R), address 00:0e:2e:e5:ae:3a Differential Revision: https://reviews.freebsd.org/D54462
* mtw(4): Fix warm reboot initialization failures for MT7601UAbdelkader Boudih2026-01-141-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mtw(4) driver works correctly on initial boot, but fails to initialize the MT7601U WiFi adapter after a warm reboot. Users must either physically unplug and replug the USB adapter, or perform a full power cycle to restore functionality, if usb power is always powered (only a replug works) The root cause is that warm reboot does not power-cycle USB devices, leaving the MT7601U in a stale state from the previous session. The MCU retains its ready flag and the device ignores initialization commands, resulting in timeout waiting for MCU to initialize errors. At the OS Level, pinging 1.1.1.1 will work, but the speed will be very slow. In addition in debug mode, we see thousand of error logs. This patch addresses the issue by: * Performing USB re-enumeration on attach to reset the device state * Detecting when the MCU is already marked ready (stale from previous session) and forcing a reset of the MCU before loading firmware * Increasing the firmware load timeout from 3s to 10s to accommodate slower initialization after reset * Increasing MCU ready poll attempts from 100 to 300 with longer delays to handle devices that take longer to become ready after reset Note: The increase was random, lower value might work. Test Plan: Tested on MacBook Pro (late-2015) and a MacMini with MediaTek MT7601U USB adapter across multiple warm reboot cycles. With the mac-mini and a another desktop, the issue happens only if connected via an always powered usb hub port in the monitor. The laptop don't power cycle it power. Differential Revision: https://reviews.freebsd.org/D54659 Reviewed by: adrian
* mtw: convert to new net80211 crypto key APIAdrian Chadd2025-11-141-8/+16
| | | | | | | | | | * constify mtw_write_region_1()'s data field * convert to use ieee80211_crypto_get_*() * .. note that rx/tx mic data routines are explicitly being called, as this NIC is doing TKIP + MIC offload Differential Revision: https://reviews.freebsd.org/D53704 Reviewed by: bz
* usb(4): Fix typos in upgt(4) and zyd(4)Gordon Bergling2025-10-292-4/+4
| | | | | | | - s/frequence/frequency/ - s/finsihed/finished/ MFC after: 5 days
* usb: update wifi drivers to use IEEE80211_FEXT_SEQNO_OFFLOADAdrian Chadd2025-09-206-0/+30
| | | | | | | | | | | | | | | | Migrate the following wifi drivers to use the seqno offload option. Locally tested (STA mode) on: * mtw * uath * upgt * ural * urtw * uzyd Differential Revision: https://reviews.freebsd.org/D50771 Okayed by: bz
* rsu: implement A-MPDU TX; add TODO items for further workAdrian Chadd2025-09-092-20/+51
| | | | | | | | | | | | | | | | | | | | | * Enable A-MPDU TX by fixing the A-MPDU TX establish routine; always assign sequence numbers from net80211 (for now); and fix the descriptor programming. * Add TODO items around CAM allocation for keys, MAC ID stuff which we likely need to fix for working IBSS/AP behaviour, and whatever other bits and pieces I noticed. * Disable amsdu2ampdu, we can decap A-MSDU just fine in net80211, doubly so if we somehow get A-MSDU inside an A-MPDU. I've tested / verified that A-MPDU TX and A-MPDU RX is correctly established and functioning by using rtwn in monitor mode. I used an old r92su linux out of tree driver for comparison. Differential Revision: https://reviews.freebsd.org/D50748 Okayed by: bz
* rsu: enable seqno offloadAdrian Chadd2025-09-091-0/+4
| | | | | | | | | | Enable sequence number offload. This should both enable the sequence number offloading and disable the net80211 TX lock from being acquired/released/checked. Differential Revision: https://reviews.freebsd.org/D50749 Okayed by: bz
* run: enable seqno offloadAdrian Chadd2025-09-091-0/+14
| | | | | | | | | | Enable sequence number offload. This should both enable the sequence number offloading and disable the net80211 TX lock from being acquired/released/checked. Differential Revision: https://reviews.freebsd.org/D50747 Okayed by: bz
* mtw: fix display of the MAC revisionKevin Lo2025-06-191-1/+6
| | | | | Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D50542
* if_run: Add sitecom device idNia Alarie2025-04-011-0/+1
| | | | | | Reviewed by: thj, adrian Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D49588
* if_rsu: Add sitecom device idNia Alarie2025-04-011-0/+1
| | | | | | Approved by: thj, adrian Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D49588
* mtw: fix compilation with IEEE80211_SUPPORT_SUPERG enabledAdrian Chadd2025-03-281-3/+6
| | | | | | | | It looks like this was missed during the driver development and porting. Differential Revision: https://reviews.freebsd.org/D49512 Reviewed by: thj
* uath: add support for GCMP-128 encryptionAdrian Chadd2025-03-271-0/+6
| | | | | | | | | | | | Explicitly set the software ciphers; add support for GCMP-128. Locally tested: * AR5523 11abg NIC, 2/5GHz STA operation, GCMP forced in wpa_supplicant.conf Differential Revision: https://reviews.freebsd.org/D49370 Reviewed by: bz
* usb: Kill left-over cdefs.h includesWarner Losh2025-03-047-7/+0
| | | | | | | | | These includes were for __FBSD_RCSID() macro. They weren't formatted like the rest of the tree so weren't trimmed automatically when that script was run. Trim them now. MFC After: 1 week Sponsored by: Netflix
* sys: convert ni->ni_txrate references use to the new net80211 APIAdrian Chadd2025-02-267-11/+18
| | | | | | | | | | | This just mechanically converts things. * For linuxkpi, it was just used for display. * For uath, it was just used for display, as firmware doesn't report it up. Differential Revision: https://reviews.freebsd.org/D48602 Reviewed by: bz, thj
* mtw: Use correct cmd for radioJesper Schmitz Mouridsen2025-02-141-1/+1
| | | | | Approved by: adrian, wireless Differential Revision: https://reviews.freebsd.org/D49003
* mtw: Pass the right pointer to the constructed command in mtw_mcu_radioJohn Baldwin2025-02-121-1/+1
| | | | | | This was just using random stack garbage before. Reported by: GCC -Wunused-but-set-variable
* uath: Avoid a NULL dereferenceJose Luis Duran2025-02-121-4/+6
| | | | | | | | PR: 284643 Reviewed by: adrian Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48948
* mt7601U: Importing if_mtw from OpenBSDJesper Schmitz Mouridsen2025-02-033-0/+6501
| | | | | | | | | Added ht20 mode, based on if_run from FreeBSD, and if_mtw.c from OpenBSD. PR: 247545 Approved by: adrian, wireless Differential Revision: https://reviews.freebsd.org/D45179
* uath: flush data/commands to the firmware before changing channel / stateAdrian Chadd2024-11-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver wasn't stable - it would start fine, but during scan it would eventually hang and no further command endpoint transfers would complete. After adding some debugging and looking at the logs I noticed that things went sideways once a /data/ frame was sent. The channel change config happened between the data frame being sent and being completed. My guess is that the firmware doesn't like a channel change and reset whilst there's pending data frames. Checking the Linux driver I found that it was doing a flush before a channel change, and we're doing it afterwards. This acts like a fence around ensuring scheduled TX work has completed. In net80211 the transmit path and the control path aren't serialised, so it's very often the case that ioctls, state changes, etc occur whilst in parallel there are frame transmits being scheduled. This seems to happen more frequently on a more recent, high core (8) machine with XHCI. I remember testing this driver years ago on single and dual core CPU laptops with no problems. So, add some flushes - before a channel change, and during a transition to AUTH when the BSS config is being programmed into the firmware. These two fences seem enough to reliably associate as a 2GHz and 5GHz STA. Note that this isn't entirely blocking all newly queued transmit work from occuring until after the NIC has finished configuration. That will need some further investigation. Locally tested: * Wistron NuWeb AR5523 dual-band NIC, STA mode, 2/5GHz Differential Revision: https://reviews.freebsd.org/D47655
* usb: fix the ID for the dual-band Wistron AR5523 USB NICAdrian Chadd2024-11-191-0/+1
| | | | | | | | | | | | | | | | | | | Use the correct ID, as I have one of these NICs. Add the previous one back in case it's out there in the wild. @emaste did a bit of a dig into the product numbers. @sam did change the ID from 0x0828 -> 082a in a commit a long while back. It's worth reading the code review for further details. However, I do have one of these NICs and I verified that it indeed has the given ID, and with some follow-up work to fix some race conditions, it works fine in 2GHz 11bg and 5GHz 11a operation. Differential Revision: https://reviews.freebsd.org/D47654 Obtained from: Linux, drivers/net/wireless/ath/ar5523/ar5523.c
* net80211: migrate FC0_TYPE_MASK / FC0_SUBTYPE_MASK frame type checks to macrosAdrian Chadd2024-11-176-20/+7
| | | | | | | | | | | | | * Add macros for the management and control frame type checks that I've come across in the drivers. * Delete some now old code (eg ath's ieee80211_is_action()) as there's now a macro for it. Local testing: * not yet, I have a lot of wifi devices to find and test against Differential Revision: https://reviews.freebsd.org/D47500
* net80211: migrate the group/unicast key check into inline functionsAdrian Chadd2024-07-152-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The way that net80211 and drivers are checking for the /type/ of key is to check if it's in the vap WEP key array and if so, it's a group key. If not, it's a unicast key. That's not only kind of terrible, but it's also going to be problematic with future 802.11 support (for multiple unicast keys and IGTK keys for management frame protection.) So as part of this, remove the places where this is done and instead use a pair inline functions - ieee80211_is_key_global() and ieee80211_is_key_unicast(). They currenly still use the same logic but the drivers and net80211 stack isn't doing it itself. There are still open questions about why keys are not being correctly tagged as GROUP, GTK, PTK, etc. That will be investigated and addressed in follow-up work as a pre-cursor to MFP, IGTK, etc. as mentioned above. Testing: * iwn, rtwn - STA mode Differential Revision: https://reviews.freebsd.org/D45516
* uath(4): Fix a typo in a source code commentGordon Bergling2024-02-221-1/+1
| | | | | | - s/parmeter/parameter/ MFC after: 3 days
* net80211: deal with lost state transitionsBjoern A. Zeeb2024-02-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 5efea30f039c4 we can possibly lose a state transition which can cause trouble further down the road. The reproducer from 643d6dce6c1e can trigger these for example. Drivers for firmware based wireless cards have worked around some of this (and other) problems in the past. Add an array of tasks rather than a single one as we would simply get npending > 1 and lose order with other tasks. Try to keep state changes updated as queued in case we end up with more than one at a time. While this is not ideal either (call it a hack) it will sort the problem for now. We will queue in ieee80211_new_state_locked() and do checks there and dequeue in ieee80211_newstate_cb(). If we still overrun the (currently) 8 slots we will drop the state change rather than overwrite the last one. When dequeing we will update iv_nstate and keep it around for historic reasons for the moment. The longer term we should make the callers of ieee80211_new_state[_locked]() actually use the returned errors and act appropriately but that will touch a lot more places and drivers (possibly incl. changed behaviour for ioctls). rtwn(4) and rum(4) should probably be revisted and net80211 internals removed (for rum(4) at least the current logic still seems prone to races). PR: 271979, 271988, 275255, 263613, 274003 Sponsored by: The FreeBSD Foundation (in 2023) MFC after: 3 days Reviewed by: cc Differential Revision: https://reviews.freebsd.org/D43389
* Revert "Enter the network epoch in USB WiFi drivers when processing input"Bjoern A. Zeeb2023-12-011-3/+0
| | | | | | | This reverts commit 17c328b6aebfa03cd1c2cbfbbc617e3b341bf1e4. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Revert "Widen EPOCH(9) usage in USB WLAN drivers."Bjoern A. Zeeb2023-12-017-21/+0
| | | | | | | This reverts commit 21c4082de9e2cf9a0fd81a9a981ab06022956847. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211 / drivers: remove public use of ieee80211_node_incref()Bjoern A. Zeeb2023-10-021-1/+1
| | | | | | | | | | | | | | | ieee80211_node_incref() is the FreeBSD implementation of ieee80211_ref_node(). Not being interested in the node returned it was used as a shortcut in 3 drivers (ath, uath, wpi). Replace the call with the public KPI of ieee80211_ref_node() and ignore the result. This leaves us with the single internal call going ieee80211_ref_node() -> ieee80211_node_incref() and that should help increasing portability but also limiting the places to trace for node reference operations. Sponsored by: The FreeBSD Foundation MFC after: 4 weeks
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-14/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-1616-16/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Mechanically convert usb ethernet drivers to DrvAPIJustin Hibbits2023-03-063-13/+13
| | | | | | Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37812
* if_rsu: Fix mismatches in array bounds.John Baldwin2022-12-071-3/+4
| | | | | | Reported by: GCC -Warray-parameter Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37551
* usb(4): Substitute "unsigned int" using the equivalent and shorter ↵Hans Petter Selasky2022-10-076-12/+12
| | | | | | | "unsigned" keyword. MFC after: 1 week Sponsored by: NVIDIA Networking
* upgt(4): Adjust all pause calls to use milliseconds instead of ticks.Hans Petter Selasky2022-06-091-2/+2
| | | | | MFC after: 1 week Sponsored by: NVIDIA Networking
* urtw(4): Adjust all pause calls to use milliseconds instead of ticks.Hans Petter Selasky2022-06-091-55/+61
| | | | | MFC after: 1 week Sponsored by: NVIDIA Networking
* usb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-068-22/+10
|
* uath(4): Fix incorrect byte-swapping and a buffer length check.Hans Petter Selasky2022-04-301-4/+3
| | | | | | | PR: 263638 Reported by: Jeff Gibbons <jgibbons@protogate.com> MFC after: 1 week Sponsored by: NVIDIA Networking
* if_urtw: Remove unused variables.John Baldwin2022-04-081-8/+6
|
* if_upgt: Remove unused variables.John Baldwin2022-04-081-6/+2
|
* net80211/drivers: improve ieee80211_rx_stats for bandBjoern A. Zeeb2021-10-221-0/+2
| | | | | | | | | | | | | 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
* run(4): add support for DLINK DWA-130 rev F1 wireless adaptor.Dmitry Chagin2021-05-231-0/+1
| | | | | | PR: 256092 Submitted by: Francois Briere <purplefiasco at gmail.com> MFC After: 2 weeks
* run(4): add support for ASUS USB-N14 wireless adaptor.Dmitry Chagin2021-05-221-0/+1
| | | | | | PR: 255759 Submitted by: john.lmurdoch at gmail.com MFC After: 1 week
* rsu: add KASSERT to document maximum mbuf size in rsu_tx_startEd Maste2021-03-221-0/+1
| | | | | | PR: 254479 Reviewed by: markj Sponsored by: The FreeBSD Foundation
* rsu: Don't modify read-only firmware block.John Baldwin2020-12-301-19/+18
| | | | | | | | | | | | | | | | | | | | | | The firmware header loaded into an rsu(4) device has to be customized to reflect device settings. The driver was overwriting the header from the shared firmware image before sending it to the device. If two devices attached at the same time with different settings, one device could potentially get a corrupted header. The recent changes in a095390344fb1795c1b118a2f84da8f6a7f254ab exposed this bug in the form of a panic as the firmware blobs are now marked read-only in object files and mapped read-only by the kernel. To avoid the bug, change the driver to allocate a copy of the firmware header on the stack that is initialized before writing it to the device. PR: 252163 Reported by: vidwer+fbsdbugs@gmail.com Tested by: vidwer+fbsdbugs@gmail.com Reviewed by: hselasky, bz, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27850
* WiFi: fix ieee80211_media_change() callersBjoern A. Zeeb2020-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* usb: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0111-27/+9
| | | | Notes: svn path=/head/; revision=365084