History log of /freebsd-current/sys/dev/usb/wlan/if_rsureg.h
Revision Date Author Comments
# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 786ac703 10-Mar-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# f20e36c1 30-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# 701957cb 28-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# ef06a176 11-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: fix and enable Rx TCP checksum offloading.

Tested with Asus USB-N10, STA mode.


# f06ccf88 10-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: add promiscuous mode support.

- Add partial promiscuous mode support (no management frames;
they cannot be received by the firmware and net80211 at the same time).
- Add monitor mode support (all frames).

Tested with Asus, USB-N10.


# 7a4575d0 10-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: increase Rx buffer size from 8k to 30k.

This is required for USB Rx aggregation
(and fixes 'could not allocate RX mbuf' / few other failures).

While here, reduce the number of Rx buffers from 100 to 1 -
the driver never uses more than one Rx buffer.

Tested with Asus USB-N10.


# 88e8709e 10-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: add TSF field into Rx radiotap.

Tested with Asus USB-N10.


# e1b3ed8f 08-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: fix incorrect register addresses.


# 31847d94 05-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: add hardware crypto support (WEP, TKIP and CCMP).

This change includes firmware commands for key setup +
some additional checking via CAMREAD / CAMWRITE registers.
Nothing (except rsu_delete_key() for pairwise keys) is deferred;
to ensure that things are done in order rsu_set_key() will wait
until key deletion task will be finished.

Tested with Asus USB-N10 (all ciphers).

Differences from initial (reviewed) patch:
- Pause AC queues before disassociation - since CMD_DISCONNECT clears
crypto state all pending frames must be processed / dropped before it.
- Check sc_running flag before trying to set static keys.
- Clear key index from bitmap even when firmware command fails
(it will be invalidated via CAMWRITE anyway).

Reviewed by: adrian, kevlo
Tested by: kevlo
Differential Revision: https://reviews.freebsd.org/D8706


# c057023b 04-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: fix RSSI reporting, partially revert r288414.

- Append RCR_APP_PHYSTS bit after firmware loading - otherwise
firmware will reset the register and this modification will be lost.
(without it Rx PHY descriptor section will contain garbage).
- Check if R92S_RXDW0_PHYST bit is set (like it is done in rtwn(4)) -
even if infosz is non-zero the section may not contain anything useful.
- In case, if descriptor is absent (A-MPDU?) use last calibrated RSSI
(rtwn(4) uses RSSI from the previous (sub)frame; probably, this
approach should be used here too).

Tested with Asus USB-N10, STA mode.


# bcb07181 03-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: remove unused structures / variables.


# 935b4fcc 27-Nov-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: add support for hardware multicast filter setup.

The algorithm is the same as in rtwn(4).

Tested with Asus USB-N10 (STA) + RTL8188CUS (AP).


# 5dbbb84e 26-Nov-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: various scanning fixes.

- Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data
frames when associated.
- Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN
ic flag; the last is never set since r170530.
- Eliminate software scan (net80211) <-> site_survey (driver) race:
* override ic_scan_curchan and ic_scan_mindwell pointers so net80211
will not try to finish scanning automatically;
* inform net80211 about current status via ieee80211_cancel_scan()
and ieee80211_scan_done();
* remove corresponding workaround from rsu_join_bss().

Now the driver can associate to an AP with hidden SSID.

Tested with Asus USB-N10.


# babfcab6 26-Nov-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).

Without this fix firmware ignores all but first 32 commands
(= almost everything (except plain Tx / Rx) stops working).

Tested with ASUS USB-N10.


# 4f4a7a03 11-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

net80211 drivers: eliminate any references to sc_rxtap_len/sc_txtap_len (never used here)

Submitted by: <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3776


# a3767659 29-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

modify the rssi logic a bit to actually return a useful rssi.

The fullmac firmware doesn't seem to populate a useful rssi indicator
in the RX descriptor, so if one plotted said values, they'd basically
look like garbage.

The reference driver implements a "get current rssi" firmware command
which I guess is really meant for station operation only (as hostap
operation would need rssi per station, not a single firmware read.)

So:

* populate sc_currssi during each calibration run;
* use this in the RX path instead of trying to reconstruct the RSSI
value and passing it around as a pointer;
* do up a quick hack to map the rssi hardware value to some useful
signal level;
* the survey results provide an RSSI value between 0..100, so just
do another quick hack to map it into some usefulish signal level;
* supply a faked noise floor - I haven't yet found how to pull it
out of the firmware.

The scan results and the station RSSI information is now more useful
for indicating signal strength / distance.


# 85dafc69 29-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

rsu(4): Add support for 1T2R and 2T2R NICs.

This logic is mostly crimed from the reference driver and the linux
r92su driver.

I verified that it (a) worked on the rsu hardware I have, and (b)
did traffic testing whilst watching what ath(4) sent as a hostap.
It successfully sent MCS8..15 rates (which requires 2-stream reception)
as well as MCS0..7 (which is 1-stream.)

Tested:

* RTL8712, 1T1R NIC, MCS rates 0..7.
* RTL8712, 1T2R NIC, MCS rates 0..15

TODO:

* Find a 2T2R NIC!


# 0cf00015 22-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vap

Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3658


# 44369387 21-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Send a power command to the firmware to shut down the radio as well
during rsu_stop().


# 6acf853d 21-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Begin fleshing out basic power-on / power-off and A-MPDU TX support.

* Add a new method to control NIC poweron / network-sleep / power off;
* Add in A-MPDU TX negotiation support, but comment it out because it
does break TX traffic;
* blank out the tx buffer before sending a firmware message, just in case;
* go into network-sleep once associated;

TODO:

* figure out why ampdu negotiation isn't working and breaking TX traffic,
then enable it.


# 77435f18 20-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Convert if_rsu to use a deferred transmit task rather than using rsu_start()
to do it directly.

Ensure that we re-queue starting transmit upon TX completion.

This solves two issues:

* It stops tx stalls - before this, if the transmit path filled the
mbuf queue then it'd never start another transmit.

* It enforces ordering - this is very required for 802.11n which
requires frames to be transmitted in the order they're queued.
Since everything remotely involved in USB has an unlock/thing/relock
pattern with that mutex, the only way to guarantee TX ordering is
to 100% defer it into a separate thread.

This now survives an iperf test and gets a reliable 30mbit/sec.


# 23386fa4 18-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Add in a temporary (hah!) workaround for net80211 scanning versus NIC
requirements.

Don't start the opmode and join path until a pending survey is finished.
This seems to reliably fix things.

Ideally I'd just finish off the net80211 pluggable scan stuff and implement
the methods here so if_rsu can just drive the scan machinery.
However, that's a .. later thing.

Whilst here, remove the getbuf debugging; it's okay to run out of transmit
buffers under load; it however isn't okay to not be able to send commands.
I'll fix that later.


# 237c4b43 17-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Add a very hacked up station only A-MPDU negotiation path.

This is enough to set things up; there are still lots of retransmits
seen but it's enough to get things working.


# bc6a9865 16-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Use the H2C endpoint for sending firmware commands, rather than the voice
data queues.

This is similar to the openbsd and rtlwifi/r92su drivers.

Note: this driver still assumes it's a 4-endpoint device; I'll enforce
that in a follow-up commit.


# 47b0d9dd 16-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Prepare for 11n - get the number of endpoints and whether 11n is available.


# ddf4995d 16-Sep-2015 Adrian Chadd <adrian@FreeBSD.org>

Bump RX_LIST_COUNT so we don't fall behind during active traffic.


# 7a79cebf 27-Aug-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Replay r286410. Change KPI of how device drivers that provide wireless
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.


# ba2c1fbc 07-Aug-2015 Adrian Chadd <adrian@FreeBSD.org>

Revert the wifi ifnet changes until things are more baked and tested.

* 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.


# 79d2c5e8 07-Aug-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Change KPI of how device drivers that provide wireless 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 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


# 910593b5 04-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Fixes for the RSU driver:
- The R92S_TCR register is an 8-bit register. Don't access it like a
16-bit register.
- Disable parsing the delete station event, due to many false events.
- Ensure that there is only one transfer queue for each endpoint, so
that packets transmitted don't get out of order.

MFC after: 1 week


# 400b4e53 21-May-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

- Split transmit queue into one for each type. Apparently there will
be a race when using a single active queue for all transmit types.
- Last argument of usb_pause_mtx() is ticks and not milliseconds.
- Remove unused watchdog.
- Remove some unused fields from the RSU softc structure.
- Workaround usbd_transfer_start() recursion from inside of completion
callback.

MFC after: 3 days


# 31d98677 29-Jul-2013 Rui Paulo <rpaulo@FreeBSD.org>

Import OpenBSD's rsu(4) WLAN driver.
Support chipsets are the Realtek RTL8188SU, RTL8191SU, and RTL8192SU.

Many thanks to Idwer Vollering for porting/writing the man page and for
testing.

Reviewed by: adrian, hselasky
Obtained from: OpenBSD
Tested by: kevlo, Idwer Vollering <vidwer at gmail.com>