aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/wlan/if_ural.c
Commit message (Collapse)AuthorAgeFilesLines
* usb: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365084
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (2 of many)Pawel Biernacki2020-02-151-1/+2
| | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Reviewed by: hselasky, kib Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D23632 Notes: svn path=/head/; revision=357972
* Widen EPOCH(9) usage in USB WLAN drivers.Hans Petter Selasky2020-01-301-0/+3
| | | | | | | | | | This patch should unbreak the USB WLAN drivers after r357004. Pointy hat: glebius@ Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=357288
* Drop some unneeded includes from wireless USB drivers.Andriy Voskoboinyk2019-01-291-4/+0
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=343541
* Remove 2GHz channel list copies from wireless drivers.Andriy Voskoboinyk2019-01-261-5/+1
| | | | | | | | | | | | | 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
* usb/wlan/*: properly include "opt_wlan.h" into all driversAndriy Voskoboinyk2018-03-101-0/+2
| | | | | | | | Without it driver cannot be loaded when wlan(4) module is built with 'options IEEE80211_DEBUG_REFCNT'. Notes: svn path=/head/; revision=330749
* net80211: wrap protection frame allocation into ieee80211_alloc_prot()Andriy Voskoboinyk2018-03-091-24/+10
| | | | | | | | | | | | 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
* net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parametersAndriy Voskoboinyk2017-02-261-7/+5
| | | | | | | | | | | | | | | | | | | | | | 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
* net80211: ieee80211_ratectl*: switch to reusable KPIAndriy Voskoboinyk2016-10-021-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ural: switch to ieee80211_add_channel_list_*()Andriy Voskoboinyk2016-05-261-7/+33
| | | | | | | | | | | - Use device's channel list instead of default one (+ 12, 13 and 14 2GHz channels). - Add ic_getradiocaps() method. Differential Revision: https://reviews.freebsd.org/D6170 Notes: svn path=/head/; revision=300749
* net80211 + drivers: hide size of 'bands' array behind a macro.Andriy Voskoboinyk2016-04-291-1/+1
| | | | | | | | 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-261-1/+1
| | | | | | | | 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
* zyd, run, ural: do not corrupt MAC addressAndriy Voskoboinyk2016-03-031-3/+3
| | | | | | | | | | | | Do not use ic_macaddr as a storage for current BSSID; it may be reused in vap creation procedure; similar to r288619. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5513 Notes: svn path=/head/; revision=296356
* net80211 drivers: fix ieee80211_init_channels() usageAndriy Voskoboinyk2016-01-071-6/+7
| | | | | | | | | | | | | | | | | 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-131-1/+1
| | | | | | | | | | | - 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
* Create a USB_PNP_INFO and use it to export the existing PNPWarner Losh2015-12-111-0/+1
| | | | | | | | | | | | | | tables. Some drivers needed some slight re-arrangement of declarations to accommodate this. Change the USB pnp tables slightly to allow better compatibility with the system by moving linux driver info from start of each entry to the end. All other PNP tables in the system have the per-device flags and such at the end of the elements rather that at the beginning. Differential Review: https://reviews.freebsd.org/D3458 Notes: svn path=/head/; revision=292080
* net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ↵Adrian Chadd2015-10-121-3/+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-031-1/+1
| | | | | | | | | | 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
* ural(4): reduce copy-paste in ural_newstate().Adrian Chadd2015-10-031-14/+11
| | | | | | | | Submitted by: <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3656 Notes: svn path=/head/; revision=288533
* net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vapAdrian Chadd2015-09-221-1/+1
| | | | | | | | 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-221-6/+2
| | | | | | | | | | | | | | - 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=288088
* Use M_WAITOK rather than M_NOWAIT since it's not used withinKevin Lo2015-09-161-1/+1
| | | | | | | interrupt context. Notes: svn path=/head/; revision=287854
* Remove checks for a NULL return value from M_WAITOK allocations.Kevin Lo2015-09-161-4/+1
| | | | Notes: svn path=/head/; revision=287852
* Replay r286410. Change KPI of how device drivers that provide wirelessGleb Smirnoff2015-08-271-171/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Further conversions from ifp->if_softc -> ic_softc.Adrian Chadd2015-08-201-8/+8
| | | | Notes: svn path=/head/; revision=286950
* Revert the wifi ifnet changes until things are more baked and tested.Adrian Chadd2015-08-081-106/+178
| | | | | | | | | | | | * 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-071-178/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-251-4/+4
| | | | | | | | | | | 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-251-0/+1
| | | | | | | | | | 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-251-0/+1
| | | | | | | | | | 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
* Make a bunch of USB debug SYSCTLs tunable, so that their value(s) canHans Petter Selasky2015-01-051-1/+1
| | | | | | | be set before the USB device(s) are probed. Notes: svn path=/head/; revision=276701
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-191-9/+9
| | | | Notes: svn path=/head/; revision=271866
* Fix for division by zero.Hans Petter Selasky2014-07-261-0/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=269127
* Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.Kevin Lo2014-01-081-2/+2
| | | | | | | | | | | | | | 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
* Fix external compiler warning(s). Avoid pointer dereferencing.Hans Petter Selasky2013-12-041-2/+2
| | | | Notes: svn path=/head/; revision=258919
* Check for "ieee80211_vap_setup()" failure in all USB WLAN drivers.Hans Petter Selasky2013-11-061-2/+7
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=257743
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | 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
* Revert r252725 as it breaks WPA.Rui Paulo2013-07-141-6/+0
| | | | | | | | | We need to fix wpa_supplicant because it checks whether the card has ic_cryptocaps set. Since net80211 can do software encryption this check in wpa_supplicant is wrong. Notes: svn path=/head/; revision=253340
* Set ic_cryptocaps to make sure wpa_supplicant works with WEP.Rui Paulo2013-07-041-0/+6
| | | | Notes: svn path=/head/; revision=252725
* - Streamline detach logic in wlan drivers, so thatHans Petter Selasky2013-02-101-3/+14
| | | | | | | | | | | | | | freed memory cannot be used during detach. - Remove all panic() calls from the urtw driver because panic() is not appropriate here. - Remove redundant checks for device detached in device detach callbacks. - Use DEVMETHOD_END to mark end of device methods. MFC after: 2 weeks Notes: svn path=/head/; revision=246614
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-1/+1
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC inHans Petter Selasky2012-06-021-1/+12
| | | | | | | | | | some of the USB WLAN drivers. This fixes a panic when using monitor mode. MFC after: 1 week Submitted by: PseudoCylon Notes: svn path=/head/; revision=236439
* Fix compiler warnings, mostly signed issues,Hans Petter Selasky2012-04-021-4/+4
| | | | | | | | | when USB modules are compiled with WARNS=9. MFC after: 1 weeks Notes: svn path=/head/; revision=233774
* Fix some net80211 enum nits:Bernhard Schmidt2011-12-171-7/+7
| | | | | | | | | | | | | - 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
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* - Move all USB device ID arrays into so-called sections,Hans Petter Selasky2011-06-241-1/+1
| | | | | | | | | | | | | | | sorted according to the mode which they support: host, device or dual mode - Add generic tool to extract these data: tools/bus_autoconf Discussed with: imp Suggested by: Robert Millan <rmh@debian.org> PR: misc/157903 MFC after: 14 days Notes: svn path=/head/; revision=223486
* Pull ieee80211_ratectl_node_init() calls from drivers into net80211.Bernhard Schmidt2011-01-171-2/+0
| | | | | | | | | | | This fixes hostap mode for at least ral(4) and run(4), because there is no sufficient call into drivers which could be used initialize the node related ratectl variables. MFC after: 3 days Notes: svn path=/head/; revision=217511
* Instead of using the AMRR ratectl algo as default for drivers which haveBernhard Schmidt2010-11-061-1/+0
| | | | | | | | | | | | | | | | | | the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if a driver calls ieee80211_ratectl_init() check if the NONE algo is still selected and try to use AMRR in that case. Drivers are still free to use any other algo by calling ieee80211_ratectl_set() prior to the ieee80211_ratectl_init() call. After this change it is now safe to assume that a ratectl algo is always available and selected, which renders the IEEE80211_C_RATECTL flag pretty much useless. Therefore revert r211314 and 211546. Reviewed by: rpaulo MFC after: 2 weeks Notes: svn path=/head/; revision=214894
* We need to grab a node reference count to vap->iv_bss before using it as it isAndrew Thompson2010-09-021-3/+7
| | | | | | | | possible for the node to be replaced and freed at any time by ieee80211_sta_join1(). Notes: svn path=/head/; revision=212127
* Add missing MODULE_VERSION() definitions, this resolves problems aroundAndrew Thompson2010-09-011-0/+1
| | | | | | | | | | | duplicate module loads. PR: usb/125736 Submitted by: danger, mm Reviewed by: hselasky Notes: svn path=/head/; revision=212122