summaryrefslogtreecommitdiff
path: root/sys/dev/ral
AgeCommit message (Collapse)Author
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-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
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
2023-12-01Revert "Widen EPOCH(9) usage in PCI WLAN drivers."Bjoern A. Zeeb
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
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16sys: Remove $FreeBSD$: one-line .h patternWarner Losh
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2022-09-03net80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATABjoern A. Zeeb
Going through the Frame (Sub)types the "QOS Data" being called "QOS" scheme leads to a naming conflict for QOS_CFPOLL and QOS_CFACKPOLL (if added). Rename QOS* to QOS_DATA* to avoid the conflict and to also better match the standards name. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 5 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36409
2022-05-06ral: Remove unused devclass argument to DRIVER_MODULE.John Baldwin
2021-12-14ral: plug set-but-not-used varsMateusz Guzik
Sponsored by: Rubicon Communications, LLC ("Netgate")
2020-09-01ral: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365165
2020-01-30Widen EPOCH(9) usage in PCI WLAN drivers.Hans Petter Selasky
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
2019-09-12[Bug 240473] add support of Ralink RT5390R Wireless CardMichael Zhilin
This commit adds PCI ID of Ralink RT5390R into ids table of driver ral. Tests show stability of card during day. Network speed is reasonable ( around several megabytes per second). PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240473 Reported by: zetrotrack000@gmail.com Reviewed by: ray Approved by: ray MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D21604 Notes: svn path=/head/; revision=352260
2019-09-09ral(4): Use unsigned to avoid undefined behavior.Pedro F. Giffuni
Found by NetBSD's kUBSan Obtained from: NetBSD (github 5b153f1) Notes: svn path=/head/; revision=352054
2019-08-06ral: rt2860: fix wcid2ni access/size issueKyle Evans
RT2860_WCID_MAX is supposed to describe the max STA index for wcid2ni, and was instead being used as the size -- off-by-one. rt2860_drain_stats_fifo was range-checking wcid only after accessing out-of-bounds potentially. Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (basically) Obtained from: Haiku (58d16d9fe2d5a209cf22823359a8407d138e1a87) Differential Revision: 3 days Notes: svn path=/head/; revision=350657
2019-03-11Fix ieee80211_radiotap(9) usage in wireless drivers:Andriy Voskoboinyk
- 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 Notes: svn path=/head/; revision=344990
2019-01-26Remove 2GHz channel list copies from wireless drivers.Andriy Voskoboinyk
Wrap ieee80211_add_channel_list_2ghz into another function which supplies default (1-14) channel list to it and drop its copies from drivers. Checked with RTL8188EE, country US / JP / KR / UA. MFC after: 2 weeks Notes: svn path=/head/; revision=343474
2018-09-26Remove bogus spaces.Warner Losh
Spaces aren't allowed in these strings. Approved by: re@ (glen) Notes: svn path=/head/; revision=338951
2018-09-26Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,Warner Losh
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) Notes: svn path=/head/; revision=338949
2018-03-09net80211: wrap protection frame allocation into ieee80211_alloc_prot()Andriy Voskoboinyk
Move copy-pasted code for RTS/CTS frame allocation into net80211. While here, add stat / debug message for allocation failures (copied from run(4)) + return error here in bwn(4). Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D14628 Notes: svn path=/head/; revision=330688
2018-01-21Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni
Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
2018-01-13dev: make some use of mallocarray(9).Pedro F. Giffuni
Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
2018-01-02[net80211] convert all of the WME use over to a temporary copy of WME info.Adrian Chadd
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. Notes: svn path=/head/; revision=327479
2017-02-26net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parametersAndriy Voskoboinyk
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 Notes: svn path=/head/; revision=314315
2017-02-17iwi, ral, zyd: fix possible use-after-free.Andriy Voskoboinyk
MFC after: 5 days Notes: svn path=/head/; revision=313906
2016-10-02net80211: ieee80211_ratectl*: switch to reusable KPIAndriy Voskoboinyk
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 Notes: svn path=/head/; revision=306591
2016-09-30ral (rt2860): eliminate duplicate ieee80211_process_callback() callAndriy Voskoboinyk
(left after r287197) MFC after: 1 week Notes: svn path=/head/; revision=306498
2016-06-08- Replace the magic numbers with something more readable.Kevin Lo
- Reset DMA indexes after disabling DMA. Notes: svn path=/head/; revision=301575
2016-05-26ral: add missing ic_getradiocaps() assignment.Andriy Voskoboinyk
Notes: svn path=/head/; revision=300759
2016-05-26ral: switch to ieee80211_add_channel_list_*()Andriy Voskoboinyk
- Use device's channel list instead of default one (from ieee80211_init_channels()). - Add ic_getradiocaps() method. Added channels: - 2GHz (all): 12, 13, 14. - 5GHz: * rt2661: 165 * rt2860: 38, 46, 54, 62, 102, 110, 118, 126, 134, 151, 159, 165, 167, 169, 171, 173. Differential Revision: https://reviews.freebsd.org/D6182 Notes: svn path=/head/; revision=300752
2016-05-25Align radiotap structures in ral(4)Stanislav Galabov
Currently all radiotap structures in ral(4) are packed, but are not aligned, which causes ral based devices to crash when one does 'ifconfig wlan0 up' for a wlan interface with a ral wlandev on arches that care about structure alignment (e.g., MIPS). Adding an aligned attribute helps fix this problem and ral devices can be properly brought up. Reviewed by: adrian Sponsored by: Smartcom - Bulgaria AD Notes: svn path=/head/; revision=300657
2016-05-17The EEPROM is lying about antennas. Don't hardcode things based on the chipKevin Lo
version which is not what the vendor driver happens to do. Notes: svn path=/head/; revision=300006
2016-05-03sys/dev: minor spelling fixes.Pedro F. Giffuni
Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
2016-04-29net80211 + drivers: hide size of 'bands' array behind a macro.Andriy Voskoboinyk
Auto-replace 'howmany(IEEE80211_MODE_MAX, 8)' with 'IEEE80211_MODE_BYTES'. No functional changes. Notes: svn path=/head/; revision=298818
2016-04-26sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298646
2016-04-10Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni
Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
2016-01-07net80211 drivers: fix ieee80211_init_channels() usageAndriy Voskoboinyk
Fix out-of-bounds read (all) / write (11n capable) for drivers that are using ieee80211_init_channels() to initialize channel list. Tested with: * RTL8188EU, STA mode. * RTL8188CUS, STA mode. * WUSB54GC, HOSTAP mode. Approved by: adrian (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4818 Notes: svn path=/head/; revision=293339
2015-12-13net80211: remove hardcoded slot time durations from driversAndriy Voskoboinyk
- Add IEEE80211_GET_SLOTTIME(ic) macro. - Use predefined macroses to set slot time. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4044 Notes: svn path=/head/; revision=292165
2015-10-29Remove the static function declaration.Kevin Lo
Notes: svn path=/head/; revision=290134
2015-10-29- Add a missing prototypeKevin Lo
- Fix typos Notes: svn path=/head/; revision=290133
2015-10-12net80211 drivers: eliminate any references to sc_rxtap_len/sc_txtap_len ↵Adrian Chadd
(never used here) Submitted by: <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3776 Notes: svn path=/head/; revision=289168
2015-10-12net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ↵Adrian Chadd
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 Notes: svn path=/head/; revision=289165
2015-10-03net80211: drop ieee80211_beacon_offsets parameter from ↵Adrian Chadd
ieee80211_beacon_alloc() and ieee80211_beacon_update() Submitted by: <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3659 Notes: svn path=/head/; revision=288636
2015-09-22net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vapAdrian Chadd
Submitted by: Andriy Voskoboinyk <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3658 Notes: svn path=/head/; revision=288095
2015-09-22net80211 & wireless drivers: remove duplicate defines (noop)Adrian Chadd
* IEEE80211_DIR_DSTODS(wh) -> IEEE80211_IS_DSTODS(wh). * N(a) -> nitems(a). * Remove LE_READ_2(p)/LE_READ_4(p) definitions (and include ieee80211_input.h instead). * <drvname>_TXOP_TO_US(txop) -> IEEE80211_TXOP_TO_US(txop). * Put IEEE80211_RV(v) into ieee80211_proto.h and remove local RV(v) definitions. Submitted by: Andriy Voskoboinyk <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3705 Notes: svn path=/head/; revision=288087
2015-09-16Fix a debug message which didn't quite get it right about eeprom version.Kevin Lo
Notes: svn path=/head/; revision=287853
2015-08-27Replay r286410. Change KPI of how device drivers that provide wirelessGleb Smirnoff
connectivity interact with the net80211 stack. Historical background: originally wireless devices created an interface, just like Ethernet devices do. Name of an interface matched the name of the driver that created. Later, wlan(4) layer was introduced, and the wlanX interfaces become the actual interface, leaving original ones as "a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer and a driver became a mix of methods that pass a pointer to struct ifnet as identifier and methods that pass pointer to struct ieee80211com. From user point of view, the parent interface just hangs on in the ifconfig list, and user can't do anything useful with it. Now, the struct ifnet goes away. The struct ieee80211com is the only KPI between a device driver and net80211. Details: - The struct ieee80211com is embedded into drivers softc. - Packets are sent via new ic_transmit method, which is very much like the previous if_transmit. - Bringing parent up/down is done via new ic_parent method, which notifies driver about any changes: number of wlan(4) interfaces, number of them in promisc or allmulti state. - Device specific ioctls (if any) are received on new ic_ioctl method. - Packets/errors accounting are done by the stack. In certain cases, when driver experiences errors and can not attribute them to any specific interface, driver updates ic_oerrors or ic_ierrors counters. Details on interface configuration with new world order: - A sequence of commands needed to bring up wireless DOESN"T change. - /etc/rc.conf parameters DON'T change. - List of devices that can be used to create wlan(4) interfaces is now provided by net.wlan.devices sysctl. Most drivers in this change were converted by me, except of wpi(4), that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann, Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in testing. Reviewed by: adrian Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=287197
2015-08-08Revert the wifi ifnet changes until things are more baked and tested.Adrian Chadd
* 286410 * 286413 * 286416 The initial commit broke a variety of debug and features that aren't in the GENERIC kernels but are enabled in other platforms. Notes: svn path=/head/; revision=286437
2015-08-07Change KPI of how device drivers that provide wireless connectivity interactGleb Smirnoff
with the net80211 stack. Historical background: originally wireless devices created an interface, just like Ethernet devices do. Name of an interface matched the name of the driver that created. Later, wlan(4) layer was introduced, and the wlanX interfaces become the actual interface, leaving original ones as "a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer and a driver became a mix of methods that pass a pointer to struct ifnet as identifier and methods that pass pointer to struct ieee80211com. From user point of view, the parent interface just hangs on in the ifconfig list, and user can't do anything useful with it. Now, the struct ifnet goes away. The struct ieee80211com is the only KPI between a device driver and net80211. Details: - The struct ieee80211com is embedded into drivers softc. - Packets are sent via new ic_transmit method, which is very much like the previous if_transmit. - Bringing parent up/down is done via new ic_parent method, which notifies driver about any changes: number of wlan(4) interfaces, number of them in promisc or allmulti state. - Device specific ioctls (if any) are received on new ic_ioctl method. - Packets/errors accounting are done by the stack. In certain cases, when driver experiences errors and can not attribute them to any specific interface, driver updates ic_oerrors or ic_ierrors counters. Details on interface configuration with new world order: - A sequence of commands needed to bring up wireless DOESN"T change. - /etc/rc.conf parameters DON'T change. - List of devices that can be used to create wlan(4) interfaces is now provided by net.wlan.devices sysctl. Most drivers in this change were converted by me, except of wpi(4), that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in testing. Details here: https://wiki.freebsd.org/projects/ifnet/net80211 Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances of problems are low. The wtap wasn't compilable even before this change. But the ndis driver is complex, and it is likely to be broken with this commit. Help with testing and debugging it is appreciated. Differential Revision: D2655, D2740 Sponsored by: Nginx, Inc. Sponsored by: Netflix Notes: svn path=/head/; revision=286410
2015-05-25Change three methods in struct ieee80211com, namely ic_updateslot,Gleb Smirnoff
ic_update_mcast and ic_update_promisc, to pass pointer to the ieee80211com, not to the ifnet. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=283540