summaryrefslogtreecommitdiff
path: root/sys/dev/ath
AgeCommit message (Collapse)Author
2025-10-31ath(4): Fix a typo in a device messsageGordon Bergling
- s/Orignal/Original/ MFC after: 5 days
2025-09-30ath: fix ath_buf leak if ath_tx_tag_crypto() returns an errorAdrian Chadd
If ath_tx_tag_crypto() returns an error, then ath_tx_normal_setup() should consume the mbuf and return an error, so the caller knows to free the ath_buf. But it wasn't. This fixes issues I've seen locally where a an AP VAP constantly hits error conditions (due to other RF/PHY/MAC chipset issues which I haven't yet figured out) and encryption fails because the station goes away whilst something's being queued. Locally tested: * AR9380, AP mode (2G HT20, 5G HT20, 5G HT40)
2025-09-19net80211: convert the rest of the native net80211 drivers to SEQNO_OFFLOADAdrian Chadd
* Convert the rest of the drivers to implement driver/offloaded sequence number handling. * For drivers that implement their own sequence number space handling for A-MPDU, only call ieee80211_output_seqno_assign() if the frame isn't tagged with M_AMPDU_MPDU, which mirrors the original net80211 sequence number behaviour. (Except of course, the assignment is now happening during final encap/transmit, not early in encap.) Locally tested (sta mode): * ath * iwn * bwi * bwn * iwm * otus * ral Differential Revision: https://reviews.freebsd.org/D50772 Okayed by: bz
2025-08-30net80211 / LinuxKPI: 802.11: revert / redo enum ieee80211_sta_rx_bwBjoern A. Zeeb
The initial thought of migrating the LinuxKPI 802.11 enum into net80211 for shared use did not work out well. Currently in the need for yet another adjustment, I decided to undo/de-couple net80211 and LinuxKPI 802.11 again. The enum name now gets used in LinuxKPI based wifi drivers and it turns out it is spelt differntly than what I used initially. This creates a conflict. net80211 still in the need to be able to express BW_320 in an uint8_t will likely be fine with the current solution as well. Rename the enum and prefixes in net80211 to "net80211" instead of "ieee80211". Apart from the names/prefix we leave the values the same. In LinuxKPI add the enum with the expected name and use it there throughout to make modern versions of LinuxKPI based wifi drivers compile. Sponsored by: The FreeBSD Foundation Fixes: ca389486a9599, 2c8b0d6205f6f MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D52064
2025-06-11machine/stdarg.h -> sys/stdarg.hBrooks Davis
Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-04-28ath(4): Fix a typo in a source code commentGordon Bergling
- s/chang/change/ MFC after: 3 days
2025-03-01ath_rate_sample: fix setting HT ratesAdrian Chadd
ieee80211_node_set_txrate_ht_mcsrate() takes an MCS rate from 0..76, the high bit (IEEE80211_RATE_MCS) must not be set. This is definitely my fault - I likely didn't get to testing this diff when I changed it from ieee80211_node_set_txrate_dot11rate() just before landing. Differential Revision: https://reviews.freebsd.org/D49197 Reviewed by: bz
2025-03-01ath: fix 20MHz HT short-gi logic.Adrian Chadd
This was broken in an earlier commit (ca389486a9599768e0ba69dca13c208020623083). PR: kern/285096 Differential Revision: https://reviews.freebsd.org/D49196 Fixes: ca389486a9599768e0ba69dca13c208020623083 Reviewed by: bz
2025-02-26sys: convert ni->ni_txrate references use to the new net80211 APIAdrian Chadd
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
2025-01-26ath(4): Fix a typo in a source code commentGordon Bergling
- s/isnt/isn’t/ MFC after: 3 days
2024-12-18ath_rate_sample: correct the "best rate" calculationAdrian Chadd
This should be a *9 rather than a *10 so higher stream MCS rates (eg comparing MCS0 and MCS8) that have slightly longer average transmit times (but better burst transmit times) get considered. This mirrors what the later code does when considering if a rate change is needed. Locally tested: * AR9280, AP mode * AR9380, AP mode Differential Revision: https://reviews.freebsd.org/D47988 Reviewed by: imp
2024-12-08net80211 / LinuxKPI 802.11: use enum ieee80211_sta_rx_bw for ni_chwBjoern A. Zeeb
net80211 node ni_chw currently encodes the channel width as Mhz number. LinuxKPI 802.11 uses enum ieee80211_sta_rx_bw for the same. Rather than keeping the "20" and "40" throughout the code (eventually expanded to 80/160/320) switch them over to use the enum throughout and add a print mask for debug output. While designed as bitmask it is not supposed to be used as such; the bitmask is only used to be able to use %b with a print mask. Once we get to 320Mhz channel widths we would otherwise also need to extend the uint8_t in struct ieee80211_node; making enum ieee80211_sta_rx_bw __packed allows us for three more channel widths without breaking the KBI (if we were not to use %b with a print_mask but use a lookup function for the string we could extend it for a long time). Sponsored by: The FreeBSD Foundation MFC after: 14 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D47891
2024-12-02ath: use the new net80211 methods for AMPDU density/limit, short-GIAdrian Chadd
Now that net80211 has this code, just leverage it instead of rolling our own. Differential Revision: https://reviews.freebsd.org/D47748 Reviewed by: bz
2024-11-18net80211: add IEEE80211_IS_QOS_NULL()Adrian Chadd
This will be useful when fixing up the sequence number generation and checks, as the rules around how sequence numbers are generated have been clarified in 802.11-2016 and later. QoS-NULL frames are explicitly marked as "any sequence number". But for now, just create a macro and use it in the one place it's currently being used as a check - ath(4). * Add IEEE80211_IS_QOS_NULL(). * Change the "will this frame go into the TX block-ack window" check in the ath(4) transmit path. Note this changes the check to be more specific, but both paths already had previous checks to ensure they're QoS data frames. Locally tested: * ath(4), AR9380, STA mode w/ AMPDU TX/RX enabled and negotiated Differential Revision: https://reviews.freebsd.org/D47645
2024-11-17net80211: migrate FC0_TYPE_MASK / FC0_SUBTYPE_MASK frame type checks to macrosAdrian Chadd
* 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
2024-10-23Fix enum warning in ath_hal's ar9002Dimitry Andric
This fixes a clang 19 warning: sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c:57:32: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_ANT_SETTING') [-Werror,-Wenum-compare] 57 | (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) { | ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~ The `ah_diversity` field of `struct ath_hal_5212` is of type `HAL_BOOL`, not the enum type `HAL_ANT_SETTING`. In other code, `ah_diversity` is set to `AH_TRUE` whenever the related field `ah_antControl` is set to `HAL_ANT_VARIABLE`. It is not entirely clear to me what the intended statement is here: the test as it is written now compares the enum value 0 to `ah_diversity`, so in effect it enables the following block whenever `ah_diversity` is `AH_TRUE`. Write it like that, to avoid the compiler warning. MFC after: 3 days
2024-09-03ath(4): Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
2024-07-15net80211: migrate the group/unicast key check into inline functionsAdrian Chadd
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
2024-02-22ath(4): always enable 11nBjoern A. Zeeb
Enabling 11n for ath(4) so far was handled by a kernel option, which was only enabled for certain kernel configurations. In order to allow loading ath(4) as a module with 11n support on all platforms, remove the kernel option and unconditionally enable 11n in ath(4). Reported by: pkubaj Discussed with: adrian in D43549. Reviewed by: adrian, imp Differential Revision: https://reviews.freebsd.org/D43964
2024-02-02ath: Fix typo (triple M)Jose Luis Duran
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/963
2023-12-25ath: Handle errors from copyout() in ath_rate_fetch_node_stats()Mark Johnston
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43096
2023-12-01ath: Revert "Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that ↵Bjoern A. Zeeb
process" This reverts commit 6c3e93cb5a4aa4b8a2d8d4d326f2a7c34d3a4458 for sys/dev/ath/if_ath.c only. Sponsored by: The FreeBSD Foundation MFC after: 3 days
2023-12-01Revert "[ath] Attempt to fix epoch handling."Bjoern A. Zeeb
This reverts commit af2441fbc7fa9e522e7f8697e5a181bdd4ff9e00. Sponsored by: The FreeBSD Foundation MFC after: 3 days
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-11-23ath(4): Fix a typo in a source code commentGordon Bergling
- s/mutiple/multiple/ MFC after: 3 days
2023-11-14ath_hal: Fix a couple of type mismatches in function prototypesJohn Baldwin
Reported by: GCC 13 via -Wenum-int-mismatch Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D42584
2023-10-02net80211 / drivers: remove public use of ieee80211_node_incref()Bjoern A. Zeeb
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
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-09ath(4): Remove MIPS SoC build glue and AR9130 from FreeBSD HALMarius Strobl
All of these are obsoleted by the general removal of MIPS support. Actually, corresponding to the removed AH_SUPPORT_x, there is more superfluous support sprinkled across the HAL source. However, that code is left in place for now in order to ease a sync to NetBSD. Reviewed by: emaste (w/ man page fix) Approved by: adrian Differential Revision: https://reviews.freebsd.org/D41355
2023-08-08ath(4): Remove MIPS AHB frontend and join PCI one w/ main support againMarius Strobl
Following the removal of general MIPS support, there's no longer a need to have the AHB bus-frontend in place, which according to Linux sources also isn't used with any non-MIPS SoCs. For simplicity, PCI bus support is only made conditional on the main one again, i. e. device ath_pci is removed, and built into the main module, i. e. if_ath_pci.ko obsoleted, respectively. Effectively, this reverts the following commits and associated changes: dba9c8597747c6c9bf3d2ec68f7eb90552878dc7 e849bb3ecbb1963344a22ae77fc96f89fbebf40c Approved by: adrian Relnotes: yes Differential Revision: https://reviews.freebsd.org/D41354
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
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
2023-02-06ath(4) IfAPI fixupsJustin Hibbits
Use the if_getcounter() IfAPI instead of accessing the ifnet directly. Sponsored by: Juniper Networks, Inc.
2023-01-19ath(4): Fix a sysctl description and a typo in a commentGordon Bergling
- s/delimeter/delimiter/ MFC after: 7 days
2022-12-21DrvAPI: Trivial mechanical conversions for various driversJustin Hibbits
Mechanically convert the following drivers, with trivial changes: * ipw(4) * igc(4) * enetc(4) * malo(4) * nfe(4) * bxe(4) * awg(4) * otus(4) * rtwn(4) * bnxt(4) * ath(4) Sponsored by: Juniper Networks, Inc.
2022-12-07ath: Fix mismatches in array bounds.John Baldwin
Reported by: GCC -Warray-parameter Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37542
2022-09-03ath(4): Fix two typos in source code commentsGordon Bergling
- s/overriden/overridden/ MFC after: 3 days
2022-05-06ath: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-04-09ath(4): Remove a double word in a few source code commentsGordon Bergling
- s/for for/for/ MFC after: 3 days
2022-03-27ath: Fix a typo in a source code commentGordon Bergling
- s/ony/only/ MFC after: 3 days
2021-05-22ath: bump the default node queue size to 128 frames, not 64Adrian Chadd
It turns out that, silly adrian, setting it to 64 means only two AMPDU frames of 32 subframes each. Thus, whilst those are in-flight, any subsequent queues frames to that node get dropped. This ends up being pretty no bueno for performance if any receive is also going on at that point. Instead, set it to 128 for the time being to ensure that SOME frames get queued in the meantime. This results in some frames being immediately available in the software queue for transmit when the two existing A-MPDU frames have been completely sent, rather than the queue remaining empty until at least one is sent. It's not the best solution - I still think I'm scheduling receive far more often than giving time to schedule transmit work - but at least now I'm not starving the transmit side. Before this, a bidirectional iperf would show receive at ~ 150mbit/sec. but the transmit side at like 10kbit/sec. With it set to 128 it's now 150mbit/sec receive, and ~ 10mbit receive. It's better than 10kbit/sec, but still not as far as I'd like it to be. Tested: * AR9380/QCA934x (TL-WDR4300 AP), Macbook pro test STA + AR9380 test STA
2021-05-22[ath] Handle STA + AP beacon programming without stomping over HW AP beacon ↵Adrian Chadd
programming I've been using STA+AP modes at home for a couple years now and I've been finding and fixing a lot of weird corner cases. This is the eventual patchset I've landed on. * Don't force beacon resync in STA mode if we're using sw beacon tracking. This stops a variety of stomping issues when the STA VAP is reconfigured; the AP hardware beacons were being stomped on! * Use the first AP VAP to configure beacons on, rather than the first VAP. This prevents weird behaviour in ath_beacon_config() when the hardware is being reconfigured and the STA VAP was the first one created. * Ensure the beacon interval / timing programming is within the AR9300 HAL bounds by masking off any flags that may have been there before shifting the value up to 1/8 TUs rather than the 1 TU resolution the previous chips used. Now I don't get weird beacon reprogramming during startup, STA state changes and hardware recovery which showed up as HI-LARIOUS beacon configurations and STAs that would just disconnect from the AP very frequently. Tested: * AR9344/AR9380, STA and AP and STA+AP modes
2021-05-22[ath] Add ast_tsfoor to the sysctl statistics array.Adrian Chadd
2021-04-18[ath] Add ath_hal_getnav and ath_hal_setnav so the driver layerAdrian Chadd
can check the NAV as appropriate.
2021-04-18[ath_hal] Add get/set NAV functionsAdrian Chadd
The NAV (network allocation vector) register reflects the current MAC tracking of NAV - when it will stay quiet before transmitting. Other devices transmit their frame durations in their 802.11 PHY headers and all devices that hear a frame - even if it's one in an encoding they don't understand - will understand the low bitrate PHY header that includes the frame duration. So, they'll set NAV to this value so they'll stay quiet until the transmit completes. Anyway, sometimes the PHY NAV header is garbled and sometimes, notably older broadcom devices, will fake a long NAV so they can get "cleaner" air for local calibration. When this happens, the hardware will stay quiet for quite some time and this can lead to missed/stuck beacons, or (for Very Large Values) a MAC hang. This code just adds the ability to get/set the NAV; the driver will need to take care of using it during transmit hangs and beacon misses to see if it's due to a trash looking NAV.
2021-03-12[ath] do a cold reset if TSFOOR triggersAdrian Chadd
TSFOOR happens if a beacon with a given TSF isn't received within the programmed/expected TSF value, plus/minus a fudge range. (OOR == out of range.) If this happens then it could be because the baseband/mac is stuck, or the baseband is deaf. So, do a cold reset and resync the beacon to try and unstick the hardware. It also happens when a bad AP decides to err, slew its TSF because they themselves are resetting and they don't preserve the TSF "well." This has fixed a bunch of weird corner cases on my 2GHz AP radio upstairs here where it occasionally goes deaf due to how much 2GHz noise is up here (and ANI gets a little sideways) and this unsticks the station VAP. For AP modes a hung baseband/mac usually ends up as a stuck beacon and those have been addressed for a long time by just resetting the hardware. But similar hangs in station mode didn't have a similar recovery mechanism. Tested: * AR9380, STA mode, 2GHz/5GHz * AR9580, STA mode, 5GHz * QCA9344 SoC w/ on-board wifi (TL-WDR4300/3600 devices); 2GHz STA mode
2021-03-12[ath] validate ts_antenna before updating tx statisticsAdrian Chadd
Right now ts_antenna is either 0 or 1 in each supported HAL so this is purely a sanity check. Later on if I ever get magical free time I may add some extensions for the NICs that can have slightly more complicated antenna switches for transmit and I'd like this to not bust memory.
2021-03-08ath_hal: Stop printing messages during bootMark Johnston
ath_hal is compiled into the kernel by default and so always prints a message to dmesg even when the system has no ath hardware. MFC after: 1 week Sponsored by: The FreeBSD Foundation
2020-12-08[ath] also remove the magic size value here for the transmit antenna statistics.Adrian Chadd
Notes: svn path=/head/; revision=368451
2020-12-08[ath] Don't use hard-coded values in the sanity check.Adrian Chadd
Don't use hard-coded values in the phy error and receive antenna checks. Notes: svn path=/head/; revision=368450