Commit Graph

489 Commits

Author SHA1 Message Date
Adrian Chadd
209be66e26 [rsu] Update wme ie API use.
Whoops, forgot to land this one too!
2020-06-16 01:11:40 +00:00
Adrian Chadd
e649b526cc [run] Fix up tx/rx frame size.
This specifically fixes that TX frames are large enough now to hold a 3900 odd
byte AMSDU (the little ones); me flipping it on earlier messed up transmit!

Tested:

* if_run, STA mode, TX/RX TCP/UDP iperf.  TCP is now back to normal and
  correctly does ~ 3200 byte AMSDU/fast frames (2x1600ish byte MSDUs).
2020-06-03 22:30:44 +00:00
Adrian Chadd
6bc40d8d83 [run] note that PHY_HT is for mixed mode.
Submitted by:	Ashish Gupta <ashishgu@andrew.cmu.edu>
Differential Revision:	https://reviews.freebsd.org/D25108
2020-06-02 22:37:53 +00:00
Adrian Chadd
bb7234be77 [run] Set the number of HT chains.
* Set the tx/rx chains based on the existing MIMO eeprom reads
* Add 3-chain rates

Tested:

* MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), 2g/5g STA
* MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), 2g/5g STA
2020-06-02 22:36:17 +00:00
Adrian Chadd
8b05d37a76 [run] Add 11NA flags for 5G NICs that support HT.
Now that I'm a proud owner of an ASUS USB-N66, I can test 2G/5G and
3-stream configurations.

For now, just flip on 5G HT rates.  I've tested this in both
5G HT20 and 5G 11a modes.  It's still one stream for now until
we verify that the number of streams reported (ie the MIMO below)
is actually the number of 11n streams, NOT the number of antennas.
(They don't have to match! You can have more antennas than MIMO
streams!)

Tested:

* run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R)
2020-06-02 16:40:58 +00:00
Adrian Chadd
c775d4ac42 [run] Don't add 11ng channels (2GHz) for RF2020
Don't also add the 11ng channels if we're not in 11n mode or net80211 will
get super weird.
2020-05-30 00:07:42 +00:00
Adrian Chadd
700af579c5 [run] Set ampdu rxmax same as linux; RF2020 isn't an 11n NIC
This is from the linux driver:

* set the ampdu rx max to 32k for 1 stream devics like mine, and
  64k for larger ones
* Don't enable 11n bits for RF2020
2020-05-30 00:06:26 +00:00
Adrian Chadd
f520d76129 [run] Add initial 802.11n support.
* Enable self-generated 11n frames
* add MCS rates for 1-stream and 2-stream rates; will do 3-stream
  once the rest of this tests out OK with other people.
* Hard-code 1 stream for now
* Add A-MPDU RX mbuf tagging
* RTS/CTS if doing RTSCTS in HT protmode as well as legacy; they're
  separate configuration flags
* Update the amrr rate index stuff - walk the rates array like others
  to find the right one - this now works for MCS and CCK/OFDM rates
* Add support for atheros fast frames/AMSDU support as we can generate
  those in net80211.

TODO:

* HT40 isn't enabled yet
* No A-MPDU support just yet; that requires some more firmware research
  and maybe porting some ath(4) A-MPDU support/tracking into net80211
* Short preamble flags aren't set yet for MCS; need to check the linux
  driver and see what's going on there
* Add 3x3 rates and set tx/rx stream configuration appropriately
* More 5GHz testing; I have a 3x3 dual band USB NIC coming soon that'll
  let me test this.
* Figure out why the RX path isn't performing as fast as it could -
  there's only a single buffer loaded at a time for the receive path
  in the USB bulk handler and this may not be super useful.

Tested:

* RT5390 usb, 1x1, RF5370 (2GHz radio), STA mode - A-MSDU TX, A-MPDU RX

Submitted by:	Ashish Gupta <ashishgu@andrew.cmu.edu>
Differential Revision:	https://reviews.freebsd.org/D22840
2020-05-29 15:56:44 +00:00
Pawel Biernacki
f8d2b1f3f7 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (2 of many)
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
2020-02-15 18:52:12 +00:00
Hans Petter Selasky
21c4082de9 Widen EPOCH(9) usage in USB WLAN drivers.
This patch should unbreak the USB WLAN drivers after r357004.

Pointy hat:	glebius@
Sponsored by:	Mellanox Technologies
2020-01-30 09:41:48 +00:00
Gleb Smirnoff
17c328b6ae Enter the network epoch in USB WiFi drivers when processing input
mbuf queues.

Submitted by:	Idwer Vollering <vidwer gmail.com>
2020-01-24 21:04:33 +00:00
Gleb Smirnoff
9c601934f6 Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:26:53 +00:00
Gleb Smirnoff
3e7e87441c Convert to if_foreach_llmaddr() KPI.
Reviewed by:	hselasky
2019-10-14 20:26:17 +00:00
Conrad Meyer
e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Andriy Voskoboinyk
8942762122 urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8)
Tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode.

MFC after:	1 week
2019-04-10 08:17:56 +00:00
Andriy Voskoboinyk
1ea35ead5a run(4): properly set F_DATAPAD radiotap flag if frame has padding between
frame header and data.

This will fix 'Mysterious OLPC stuff' for received frames and wrong
CCMP / TKIP / data decoding for transmitted frames in net/wireshark
dissector.

While here, drop unneeded comment - net80211 handles padding requirements
for Tx & Rx without driver adjustment.

Tested with D-Link DWA-140 rev B3, STA mode.

MFC after:	1 week
2019-03-31 14:18:02 +00:00
Andriy Voskoboinyk
e4c17012d0 run(4): do not clear PROTECTED bit if frame was not decrypted by NIC.
Tested with D-Link DWA-140 rev B3, STA / MONITOR modes.

MFC after:	1 week
2019-03-31 13:41:20 +00:00
Andriy Voskoboinyk
39abb4482d uath(4), urtw(4): restart driver if device does not respond after Tx request
MFC after:	1 week
2019-03-31 09:52:36 +00:00
Andriy Voskoboinyk
cb5d2742ff urtw(4): export TSF timestamp for received frames via radiotap
Tested with Netgear WG111 v3 (RTL8187B), STA mode.

MFC after:	1 week
2019-03-30 09:24:06 +00:00
Andriy Voskoboinyk
ae6f61b116 run(4): merge some common TSF-related code into run_disable_tsf()
No functional change intended.

MFC after:	5 days
2019-03-25 09:10:07 +00:00
Andriy Voskoboinyk
b3ec1ab8dc urtw(4): add promiscuous mode callback
Also, pass control frames to the host while in MONITOR mode and / or
when promiscuous mode is enabled.

Tested with Netgear WG111 v3 (RTL8187B), STA / MONITOR modes.

MFC after:	2 weeks
2019-03-11 02:02:04 +00:00
Andriy Voskoboinyk
786ac7035f 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.

Tested with Netgear WG111 v3 (urtw(4)), STA mode.

MFC after:	2 weeks
2019-03-11 01:27:01 +00:00
Andriy Voskoboinyk
f3f08e16a3 net80211(4): hide casts for 'i_seq' field offset calculation inside
ieee80211_getqos() and reuse it in various places.

Checked with RTL8188EE, HOSTAP mode + RTL8188CUS, STA mode.

MFC after:	2 weeks
2019-02-10 23:58:56 +00:00
Andriy Voskoboinyk
6ecec3817e run(4): fix allocated memory type for ieee80211_node(4).
PR:		177366
MFC after:	3 days
2019-02-02 16:07:56 +00:00
Andriy Voskoboinyk
943607571a run(4): revert previous commit; there were no compiler warning
(at least, from clang(1)).
2019-02-02 16:06:06 +00:00
Andriy Voskoboinyk
bce0fd800a run(4): fix allocated memory type and -Wincompatible-pointer-types
compiler warning.

PR:		177366
MFC after:	3 days
2019-02-02 16:01:16 +00:00
Andriy Voskoboinyk
f20e36c166 rsu(4): add support for ifconfig(8) 'maxretry' option.
Tested with Asus USB-N10, STA mode; maxretry 0 / 1 / 6 / 12
Checked with RTL8188EE, MONITOR mode.

MFC after:	1 week
2019-01-30 13:19:05 +00:00
Andriy Voskoboinyk
e42b993273 upgt(4): unbreak build with UPGT_DEBUG
MFC after:	1 week
2019-01-29 03:31:36 +00:00
Andriy Voskoboinyk
635588c25c Drop some unneeded includes from wireless USB drivers.
MFC after:	1 week
2019-01-29 03:28:47 +00:00
Andriy Voskoboinyk
701957cbb6 rsu(4): do not ignore mgmtrate / mcastrate / ucastrate.
Enforce net80211 rates for control / management / multicast / EAPOL frames
and allow to override rate for unicast frames via ifconfig(8) 'ucastrate'
option; by default it still uses f/w rate adaptation for unicast frames.

MFC after:	1 week
2019-01-28 11:39:54 +00:00
Andriy Voskoboinyk
b84b36380e 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.

Checked with RTL8188EE, country US / JP / KR / UA.

MFC after:	2 weeks
2019-01-26 17:00:55 +00:00
Andriy Voskoboinyk
c15f336dae urtw(4): add length checks in Rx path.
- Check if buffer can contain Rx descriptor before accessing it.
- Verify upper / lower bounds for frame length.
- Do not pass too short frames into ieee80211_find_rxnode().

While here:
- Move cleanup to the function end.
- Reuse IEEE80211_IS_DATA() macro.

MFC after:	1 week
2019-01-21 00:53:38 +00:00
Andriy Voskoboinyk
fb10d4ee38 run(4): add more length checks in Rx path.
- Discard frames that are bigger than MCLBYTES (to prevent buffer overrun).
- Check buffer length before accessing its contents.
- Fix len <-> dmalen check - the last includes Rx Wireless information
structure size.
- Fix out-of-bounds read during Rx node search for ACK / CTS frames
(monitor mode only).

While here:
- Mark few suspicious places with comments.
- Move common cleanup to the function end.

MFC after:	1 week
2019-01-21 00:03:35 +00:00
Andriy Voskoboinyk
98d2a76e37 rtwn, rsu: add more USB ids.
PR:		233638
Submitted by:	cezary.sliwa@gmail.com
MFC after:	3 days
2018-12-10 09:45:57 +00:00
Gavin Atkinson
76cffa7a7e run(4): Support the D-Link DWA-125 rev A3
Submitted by:	Ali Mashtizadeh
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D16029
2018-07-21 14:56:15 +00:00
Ben Widawsky
2c6d9edb2c run(4): Add a new USB device ID.
Summary:
Add the device id of the Panda Wireless PAU06 which seems to be
the already-supported combination of RT5392 MAC and RF RT5372
radio.

Reviewed By: allanjude, eadler, jhb
Approved By: jhb
Differential Revision: https://reviews.freebsd.org/D16211
2018-07-11 02:32:06 +00:00
Matt Macy
d7c5a620e2 ifnet: Replace if_addr_lock rwlock with epoch + mutex
Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366
2018-05-18 20:13:34 +00:00
Andriy Voskoboinyk
46e18fc6d4 urtw(4), zyd(4): reduce code verbosity.
No functional change intended.
2018-03-16 00:38:10 +00:00
Andriy Voskoboinyk
2757acf673 urtw(4): provide names for some commonly used rate indices + drop
now-unused urtw_rate2rtl()
2018-03-16 00:09:16 +00:00
Andriy Voskoboinyk
63a55eab9b usb/wlan/*: properly include "opt_wlan.h" into all drivers
Without it driver cannot be loaded when wlan(4) module is built with
'options IEEE80211_DEBUG_REFCNT'.
2018-03-10 23:16:24 +00:00
Andriy Voskoboinyk
2e0d057248 run(4): drop few unused variables.
Found by: Clang static analyzer
2018-03-10 22:52:39 +00:00
Andriy Voskoboinyk
d1b671061b net80211: wrap protection frame allocation into ieee80211_alloc_prot()
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
2018-03-09 11:33:56 +00:00
Adrian Chadd
9fbe631a1a [net80211] convert all of the WME use over to a temporary copy of WME info.
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.
2018-01-02 00:07:28 +00:00
Pedro F. Giffuni
9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Andriy Voskoboinyk
76ff59295f rsu(4): trim code for Rx rate calculation.
Include ridx <-> rate conversion functions from rtwn(4) +
reuse already calculated value for ieee80211_radiotap(9).

Tested with Asus USB-N10, STA mode.
2017-11-02 00:17:52 +00:00
Andriy Voskoboinyk
6acad03d6f uath(4): fix varible types, add missing checks for descriptor / command
header structure fields.

Reported by:	hselasky
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D11786
2017-09-30 21:00:46 +00:00
Andriy Voskoboinyk
a08e9300f3 zyd: code cleanup + drop unneeded cast.
No functional change intended.
2017-07-30 22:17:08 +00:00
Hans Petter Selasky
bd9175e1aa Properly range check length of parsed information elements in RSU driver.
Found by:		Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-07-30 16:45:28 +00:00
Andriy Voskoboinyk
f631357540 net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
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
2017-02-26 20:49:35 +00:00