aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ral
Commit message (Collapse)AuthorAgeFilesLines
* MFC r352260:Michael Zhilin2019-09-201-0/+1
| | | | | | | | | | | | | | | | | [Bug 240473] add support of Ralink RT5390R Wireless Card 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 Differential Revision: https://reviews.freebsd.org/D21604 Notes: svn path=/stable/12/; revision=352562
* MFC r350630, r350657: static analysis fixes from HaikuKyle Evans2019-08-162-2/+4
| | | | | | | | | | | | | | | | | r350630: oce(4): potential out of bounds access before vector validation r350657: ral: rt2860: fix wcid2ni access/size issue 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. Notes: svn path=/stable/12/; revision=351143
* MFC r344990:Andriy Voskoboinyk2019-03-283-4/+4
| | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/stable/12/; revision=345634
* MFC r343474:Andriy Voskoboinyk2019-02-103-13/+3
| | | | | | | | | | | Remove 2GHz channel list copies from wireless drivers. Wrap ieee80211_add_channel_list_2ghz into another function which supplies default (1-14) channel list to it and drop its copies from drivers. Notes: svn path=/stable/12/; revision=343975
* Remove bogus spaces.Warner Losh2018-09-261-1/+1
| | | | | | | | | Spaces aren't allowed in these strings. Approved by: re@ (glen) Notes: svn path=/head/; revision=338951
* Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,Warner Losh2018-09-261-0/+2
| | | | | | | | | | | | | 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
* net80211: wrap protection frame allocation into ieee80211_alloc_prot()Andriy Voskoboinyk2018-03-092-50/+20
| | | | | | | | | | | | 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
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-212-5/+5
| | | | | | | | | | | | | | | | | | 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
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-132-5/+5
| | | | | | | | | | | | | | 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
* [net80211] convert all of the WME use over to a temporary copy of WME info.Adrian Chadd2018-01-022-7/+10
| | | | | | | | | | | | | | | | | | | | 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
* net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parametersAndriy Voskoboinyk2017-02-263-17/+14
| | | | | | | | | | | | | | | | | | | | | | 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
* iwi, ral, zyd: fix possible use-after-free.Andriy Voskoboinyk2017-02-171-1/+1
| | | | | | | MFC after: 5 days Notes: svn path=/head/; revision=313906
* net80211: ieee80211_ratectl*: switch to reusable KPIAndriy Voskoboinyk2016-10-027-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ral (rt2860): eliminate duplicate ieee80211_process_callback() callAndriy Voskoboinyk2016-09-301-4/+0
| | | | | | | | | (left after r287197) MFC after: 1 week Notes: svn path=/head/; revision=306498
* - Replace the magic numbers with something more readable.Kevin Lo2016-06-082-5/+25
| | | | | | | - Reset DMA indexes after disabling DMA. Notes: svn path=/head/; revision=301575
* ral: add missing ic_getradiocaps() assignment.Andriy Voskoboinyk2016-05-261-0/+1
| | | | Notes: svn path=/head/; revision=300759
* ral: switch to ieee80211_add_channel_list_*()Andriy Voskoboinyk2016-05-263-21/+96
| | | | | | | | | | | | | | | | | | - 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
* Align radiotap structures in ral(4)Stanislav Galabov2016-05-252-4/+4
| | | | | | | | | | | | | | | | 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
* The EEPROM is lying about antennas. Don't hardcode things based on the chipKevin Lo2016-05-173-47/+27
| | | | | | | version which is not what the vendor driver happens to do. Notes: svn path=/head/; revision=300006
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-2/+2
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* net80211 + drivers: hide size of 'bands' array behind a macro.Andriy Voskoboinyk2016-04-293-3/+3
| | | | | | | | Auto-replace 'howmany(IEEE80211_MODE_MAX, 8)' with 'IEEE80211_MODE_BYTES'. No functional changes. Notes: svn path=/head/; revision=298818
* sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni2016-04-262-2/+2
| | | | | | | | 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
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* net80211 drivers: fix ieee80211_init_channels() usageAndriy Voskoboinyk2016-01-073-18/+18
| | | | | | | | | | | | | | | | | 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
* net80211: remove hardcoded slot time durations from driversAndriy Voskoboinyk2015-12-133-5/+5
| | | | | | | | | | | - 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
* Remove the static function declaration.Kevin Lo2015-10-291-2/+1
| | | | Notes: svn path=/head/; revision=290134
* - Add a missing prototypeKevin Lo2015-10-292-13/+14
| | | | | | | - Fix typos Notes: svn path=/head/; revision=290133
* net80211 drivers: eliminate any references to sc_rxtap_len/sc_txtap_len ↵Adrian Chadd2015-10-123-7/+1
| | | | | | | | | | (never used here) Submitted by: <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3776 Notes: svn path=/head/; revision=289168
* net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ↵Adrian Chadd2015-10-123-11/+0
| | | | | | | | | | | | | 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
* net80211: drop ieee80211_beacon_offsets parameter from ↵Adrian Chadd2015-10-033-8/+4
| | | | | | | | | | 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
* net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vapAdrian Chadd2015-09-224-10/+7
| | | | | | | | Submitted by: Andriy Voskoboinyk <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3658 Notes: svn path=/head/; revision=288095
* net80211 & wireless drivers: remove duplicate defines (noop)Adrian Chadd2015-09-223-22/+11
| | | | | | | | | | | | | | * 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
* Fix a debug message which didn't quite get it right about eeprom version.Kevin Lo2015-09-161-1/+1
| | | | Notes: svn path=/head/; revision=287853
* Replay r286410. Change KPI of how device drivers that provide wirelessGleb Smirnoff2015-08-277-544/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert the wifi ifnet changes until things are more baked and tested.Adrian Chadd2015-08-087-350/+544
| | | | | | | | | | | | * 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
* Change KPI of how device drivers that provide wireless connectivity interactGleb Smirnoff2015-08-077-544/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change three methods in struct ieee80211com, namely ic_updateslot,Gleb Smirnoff2015-05-253-32/+29
| | | | | | | | | | | 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
* Set ic_softc in all 802.11 drivers. Not required right now, but will beGleb Smirnoff2015-05-253-0/+3
| | | | | | | | | | used quite soon. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=283537
* Make net80211 drivers supply their device name to the net80211 layer, soGleb Smirnoff2015-05-253-0/+3
| | | | | | | | | | that the latter doesn't need to go through struct ifnet to get their name. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=283527
* Add preliminary support for the Ralink RT5390 and RT5392 chipsets.Kevin Lo2015-02-113-121/+517
| | | | | | | Committed over the D-Link DWA-525 rev A2 on amd64 with WPA. Notes: svn path=/head/; revision=278551
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-193-32/+32
| | | | Notes: svn path=/head/; revision=271849
* Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.Kevin Lo2014-01-083-7/+7
| | | | | | | | | | | | | | The origin of WEP comes from IEEE Std 802.11-1997 where it defines whether the frame body of MAC frame has been encrypted using WEP algorithm or not. IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates whether the frame is protected by a cryptographic encapsulation algorithm. Reviewed by: adrian, rpaulo Notes: svn path=/head/; revision=260444
* - Add support for using MSI instead of INTx, controllable via the tunableMarius Strobl2013-12-291-44/+42
| | | | | | | | | | | | | | | | | | | | | hw.ral.msi_disable (defaulting to using MSI). - Probe with BUS_PROBE_DEFAULT instead of 0. - Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0 devices. - Use PCIR_BAR instead of a homegrown macro. - There's no need to keep track of resource IDs. - Release resources again in case attaching fails. - Quiesce the interrupt before detaching. - Sprinkle const. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Trim headers. - Nuke dupe $FreeBSD$. MFC after: 1 week Notes: svn path=/head/; revision=260061
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-303-9/+9
| | | | | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-263-0/+3
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Implement basic 802.11n awareness in the PHY and AMRR rate control code.Adrian Chadd2013-07-043-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add 802.11n 2ghz and 5ghz tables, including legacy rates and up to MCS23 rates (3x3.) * Populate the rate code -> rate index lookup table with MCS _and_ normal rates, but _not_ the basic rate flag. Since the basic rate flag is the same as the MCS flag, we can only use one. * Introduce some accessor inlines that do PLCP and rate table lookup/access and enforce that it doesn't set the basic rate bit. They're not designed for MCS rates, so it will panic. * Start converting drivers that use the rate table stuff to use the accessor inlines and strip the basic flag. * Teach AMRR about basic 11n - it's still as crap for MCS as it is being used by iwn, so it's not a step _backwardS_. * Convert iwn over to accept 11n MCS rates rather than 'translate' legacy to MCS rates. It doesn't use a lookup table any longer; instead it's a function which takes the current node (for HT parameters) and the rate code, and returns the hardware PLCP code to use. Tested: * ath - it's a no-op, and it works that way * iwn - both 11n and non-11n Notes: svn path=/head/; revision=252727
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-043-10/+10
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Add support for Ralink RT2800/RT3000 chipsets.Bernhard Schmidt2012-05-104-3/+5617
| | | | | | | | | | Thanks to ray@, Sevan and Sergey Dyatko for feedback and testing! Obtained from: OpenBSD MFC after: 3 weeks Notes: svn path=/head/; revision=235233
* Fix some net80211 enum nits:Bernhard Schmidt2011-12-172-14/+14
| | | | | | | | | | | | | - ic_vap_create() uses an ieee80211_opmode argument - ieee80211_rate2media() takes an ieee80211_phymode argument - ieee80211_plcp2rate() takes an ieee80211_phytype argument - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence compiler warnings Submitted by: arundel@ Notes: svn path=/head/; revision=228621
* Don't hardcode assumptions about basic rates, similar to what the rt2661Bernhard Schmidt2011-04-092-21/+23
| | | | | | | support code does. While here remove an unnecessary loop. Notes: svn path=/head/; revision=220502