History log of /freebsd-current/sys/dev/usb/wlan/if_rum.c
Revision Date Author Comments
# 713db49d 10-Jan-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

net80211: deal with lost state transitions

Since 5efea30f039c4 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c1e can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks. Try to keep state
changes updated as queued in case we end up with more than one at a
time. While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR: 271979, 271988, 275255, 263613, 274003
Sponsored by: The FreeBSD Foundation (in 2023)
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43389


# 39b70279 03-Nov-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

Revert "Widen EPOCH(9) usage in USB WLAN drivers."

This reverts commit 21c4082de9e2cf9a0fd81a9a981ab06022956847.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 71625ec9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c comment pattern

Remove /^/[*/]\s*\$FreeBSD\$.*\n/


# 62d42655 07-Oct-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Substitute "unsigned int" using the equivalent and shorter "unsigned" keyword.

MFC after: 1 week
Sponsored by: NVIDIA Networking


# bc9372d7 06-May-2022 John Baldwin <jhb@FreeBSD.org>

usb: Remove unused devclass arguments to DRIVER_MODULE.


# f8d2b1f3 15-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

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


# 21c4082d 30-Jan-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

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


# 635588c2 28-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

Drop some unneeded includes from wireless USB drivers.

MFC after: 1 week


# b84b3638 26-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# 63a55eab 10-Mar-2018 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# d1b67106 09-Mar-2018 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# 9fbe631a 01-Jan-2018 Adrian Chadd <adrian@FreeBSD.org>

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


# f6313575 26-Feb-2017 Andriy Voskoboinyk <avos@FreeBSD.org>

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


# 4a19d712 07-Dec-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211 + drivers: convert to ieee80211_crypto_get_key_wepidx().

Proposed by: adrian


# f6930bec 02-Oct-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211: ieee80211_ratectl*: switch to reusable KPI

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


# 887a6324 20-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211: remove IEEE80211_RADIOTAP_TSFT field from transmit definitions.

This field may be used for received frames only.

Differential Revision: https://reviews.freebsd.org/D3826
Differential Revision: https://reviews.freebsd.org/D3827


# d204cea9 07-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: fix possible panic on device detach (similar to r302034).

Tested with WUSB54GC, STA/AP modes.


# 4c90f11b 06-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: use mgmt frame rate for EAPOL frames.


# 93ae4747 05-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: use m_get2() in Rx path.


# c84bb702 06-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: fix frame length checks in Rx path.

Split usbd_xfer_status() check:
- Check xfer length: must be longer, than Rx descriptor size.
- Check frame size: must be shorter than xfer length.
- Discard too short frames.

Tested with WUSB54GC, STA/MONITOR modes.


# c57ee45b 05-Sep-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: do not restart device when protmode / rtsthreshold is changed.


# 7b45c9df 01-May-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: switch to ieee80211_add_channel_list_*()

- Use device's channel list instead of default one
(from ieee80211_init_channels()).
- Add ic_getradiocaps() method.

Added channels:
2GHz band: 12, 13 and 14.
5Ghz band: 34, 38, 42, 46 and 165.

Tested with WUSB54GC, STA / MONITOR modes.

Differential Revision: https://reviews.freebsd.org/D6125


# a061fea6 29-Apr-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211 + drivers: hide size of 'bands' array behind a macro.

Auto-replace 'howmany(IEEE80211_MODE_MAX, 8)' with 'IEEE80211_MODE_BYTES'.
No functional changes.


# 057b4402 26-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: extend use of the howmany() macro when available.

We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.


# 349156a9 21-Mar-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: add legacy power saving support (STA mode).

Tested with WUSB54GC, STA mode + WRT54GC / RTL8188EU in HOSTAP mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5546


# 96e29c26 21-Mar-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: simplify error handling in rum_newstate().

Tested with WUSB54GC, STA mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5544


# 37704427 21-Mar-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: do not try to restore bssid/TSF synchronization when device
is not associated.

Tested with WUSB54GC, STA mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5543


# fd7dae9c 21-Mar-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

rum: separate some microcontroller vendor-specific requests into
rum_do_mcu_request()

This change should be no-op.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D5542


# fe3e4523 14-Feb-2016 Hans Petter Selasky <hselasky@FreeBSD.org>

Reduce the number of supported WLAN keys in the rum driver, else we
risk bit shifting overflows. Found by D5245 / PVS.

MFC after: 1 week


# 0046e186 07-Jan-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211 drivers: fix ieee80211_init_channels() usage

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


# ce036b51 13-Dec-2015 Andriy Voskoboinyk <avos@FreeBSD.org>

wpi, rum and urtwn: update copyright headers

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4489


# bdfff33f 13-Dec-2015 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211: remove hardcoded slot time durations from drivers

- Add IEEE80211_GET_SLOTTIME(ic) macro.
- Use predefined macroses to set slot time.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4044


# f809f280 10-Dec-2015 Warner Losh <imp@FreeBSD.org>

Create a USB_PNP_INFO and use it to export the existing PNP
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


# a14954c5 05-Nov-2015 Andriy Voskoboinyk <avos@FreeBSD.org>

net80211: WME callback cleanup in various drivers

Since r288350, ic_wme_task() is called via ieee80211_runtask(),
so, any additional deferring from the driver side is not needed.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4072


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

net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to 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


# 7682e597 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

Fix to make compile on gcc-4.2.1 (eg mips, sparc64.)


# 1354b52c 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add WME support.

Tested:

* WUSB54GC, HOSTAP and STA modes.
* Me: rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528

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


# f4ac78a2 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): fix stats interpretation in rum_ratectl_task()

Testing:

* WUSB54GC, STA mode

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


# 342ced03 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): set short/long retry limits

Now device will use retry limit, which is set via 'ifconfig <interface>
maxretry <number>'.

Tested:

* Tested on WUSB54GC, STA mode.

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


# c42e124e 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): fix sequence number generation.

* drop erroneous RT2573_TX_MORE_FRAG flag;
* provide RT2573_TX_HWSEQ where needed.

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


# 210ab3c2 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

net80211: drop ieee80211_beacon_offsets parameter from ieee80211_beacon_alloc() and ieee80211_beacon_update()

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


# bc813c40 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

net80211: drop redundant 3rd parameter from iv_key_set().

The MAC can be fetched from the key struct.

I added the ndis updates to make it compile.

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


# ed5711a1 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): drop unused 'node id' parameter.

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


# 2cb9ef8d 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add support for hardware encryption (WEP, TKIP and CCMP).

This diff includes:

* Transmitter Addresses, Keys and TKIP MIC addition to the Security Key Table.
* Proper SEC Control Registers initialization and maintenance.
* Additional flags and values in TX descriptor, which are required for encryption support.
* Error checking in RX path.

Tested:

* Tested on WUSB54GC, STA (WEP, TKIP, CCMP), HOSTAP (CCMP) and IBSS (CCMP, WPA-None) modes.
* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode (CCMP+TKIP)

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


# 0e3b4c60 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): implement iv_update_beacon call (fixes client power save support).

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


# a19dbd8d 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): attach rum_update_slot to ic_updateslot.

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


# b780f864 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): split rum_prepare_beacon() into 'alloc' and 'set' stages

Note: I manually had to merge this; I merged in the "put beacon_offsets
into vap" commit before this.

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


# 50a31b48 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add support for AHDEMO mode.

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


# 42769826 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): simplify rum_set_bssid(), rum_set_macaddr() and rum_update_promisc()

Tested:

* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode

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


# 1ba67b11 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): do not corrupt MAC address

Don't override the NIC MAC address with an overridden MAC address for
a VAP.

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


# aa81f853 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add error handling for rum_enable_tsf_sync() and rum_prepare_beacon()

Tested:

* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode
Note: haven't tested AP mode yet; will do once the rest of the
AP mode / power save commits are in.

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


# 6095f7ca 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): move some code from rum_init() into separate function.

Tested:

* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode

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


# 0698c0b3 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add error handling in initialization path

Tested:

* Tested on WUSB54GC, STA mode.
* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode

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


# b2a76342 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): simplify error handling rum_raw_xmit()

Move the mbuf free responsibility to the caller of the hardware xmit
function, not the hardware xmit function itself.

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


# aca2cf30 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): check mbuf size before accessing its contents

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


# a6ccd477 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add TSF field into radiotap headers

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


# 30c00a2d 03-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

Remove beacon offsets usage from if_rum.

Differential Revision: https://reviews.freebsd.org/D3658


# f28c2f5e 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): add command queue for running sleepable tasks in non-sleepable contexts

Tested:

* Tested on WUSB54GC, STA mode.
* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528

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


# e7b7db3d 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): some non-functional changes / cleanup

* Remove unused sc_txtap_len/sc_rxtap_len fields.
* Remove unused ackrate variable.
* Remove unneded warning in rum_update_mcast().
* Use nitems().
* Replace some hardcoded values for RT2573_MAC_CSR1 register.
* Remove second argument for RUM_LOCK_ASSERT() - it is always the same.

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


# d847071c 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): sync rum_enable_tsf(_sync) with run(4).

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


# a05022b2 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): create few wrappers.

Tested:

rum0: <Belkin Belkin 54g USB Network Adapter, class 0/0, rev 2.00/0.01, addr 22> on usbus0
rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528

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


# cc9ae761 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): move common part of rum_bbp_write() and rum_bbp_read() into rum_bbp_busy().

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


# 6d804321 02-Oct-2015 Adrian Chadd <adrian@FreeBSD.org>

rum(4): reduce code duplication.

Tested:

rum0: <Belkin Belkin 54g USB Network Adapter, class 0/0, rev 2.00/0.01, addr 21> on usbus0
rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528

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


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


# d3fdd08c 19-Aug-2015 Adrian Chadd <adrian@FreeBSD.org>

Further conversions from ifp->if_softc -> ic_softc.


# 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


# 272f6ade 25-May-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Change three methods in struct ieee80211com, namely ic_updateslot,
ic_update_mcast and ic_update_promisc, to pass pointer to the ieee80211com,
not to the ifnet.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 59686fe9 25-May-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Set ic_softc in all 802.11 drivers. Not required right now, but will be
used quite soon.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# c8550c02 25-May-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Make net80211 drivers supply their device name to the net80211 layer, so
that the latter doesn't need to go through struct ifnet to get their name.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# ece4b0bd 05-Jan-2015 Hans Petter Selasky <hselasky@FreeBSD.org>

Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can
be set before the USB device(s) are probed.


# a001989d 19-Sep-2014 Gleb Smirnoff <glebius@FreeBSD.org>

Mechanically convert to if_inc_counter().


# b8e3094c 26-Jul-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix for division by zero.

MFC after: 3 days


# 5945b5f5 08-Jan-2014 Kevin Lo <kevlo@FreeBSD.org>

Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.

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


# 8cfe5440 03-Dec-2013 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix external compiler warning(s). Avoid pointer dereferencing.


# bb2f69e8 05-Nov-2013 Hans Petter Selasky <hselasky@FreeBSD.org>

Check for "ieee80211_vap_setup()" failure in all USB WLAN drivers.

MFC after: 1 week


# 76039bc8 26-Oct-2013 Gleb Smirnoff <glebius@FreeBSD.org>

The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
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.


# fc4153c2 14-Jul-2013 Rui Paulo <rpaulo@FreeBSD.org>

Revert r252725 as it breaks WPA.

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.


# 2173825b 04-Jul-2013 Rui Paulo <rpaulo@FreeBSD.org>

Set ic_cryptocaps to make sure wpa_supplicant works with WEP.


# 3232aae3 21-Mar-2013 Hans Petter Selasky <hselasky@FreeBSD.org>

Add new USB ID.

PR: usb/177173
MFC after: 1 week


# 645e4d17 10-Feb-2013 Hans Petter Selasky <hselasky@FreeBSD.org>

- Streamline detach logic in wlan drivers, so that
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


# c6499ecc 04-Dec-2012 Gleb Smirnoff <glebius@FreeBSD.org>

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


# bb571462 02-Jun-2012 Hans Petter Selasky <hselasky@FreeBSD.org>

Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC in
some of the USB WLAN drivers. This fixes a panic when using monitor mode.

MFC after: 1 week
Submitted by: PseudoCylon


# 6d917491 02-Apr-2012 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after: 1 weeks


# fcd9500f 17-Dec-2011 Bernhard Schmidt <bschmidt@FreeBSD.org>

Fix some net80211 enum nits:
- 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@


# 6472ac3d 07-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

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.


# 8797cafe 17-Oct-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

Fix build after r226465.
Cast void * to char * for arithmetics and make function return "no error".

MFC after: 3 days


# 65d7e4d9 17-Oct-2011 Adrian Chadd <adrian@FreeBSD.org>

Fix an issue with 11g beacon frames which looks to be a limitation
on the largest multi-write size.

From the submitter:

==
I looked further into the magic 88-byte threshold after which the bug
occurs. It turns out that figure included the 24-byte tx_desc, and up
to 64 bytes of beacon frame (header+data).

rum_write_multi doesn't seem happy with writing >64 bytes at a time to
the MAC register. If I break it up into separate calls (e.g. bytes
0-63, then bytes 64-65, written at the appropriate offset) I see the
proper beacon frames being transmitted now.
==

Submitted by: Steven Chamberlain <steven@pyro.eu.org>
MFC after: 3 days


# f1a16106 23-Jun-2011 Hans Petter Selasky <hselasky@FreeBSD.org>

- Move all USB device ID arrays into so-called sections,
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


# f620e64d 29-Apr-2011 Kevin Lo <kevlo@FreeBSD.org>

Guard against default ni_chan

PR: kern/144642
Submitted by: Arthur Hartwig <a_hartwig at fastmaildot fm>


# bd56e71b 17-Jan-2011 Bernhard Schmidt <bschmidt@FreeBSD.org>

Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
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


# 54de08a9 29-Nov-2010 MIHIRA Sanpei Yoshiro <sanpei@FreeBSD.org>

Add new device ids.
Buffalo (Melco Inc.) WLI-UC-G

PR: 141777


# a7c6aabd 06-Nov-2010 Bernhard Schmidt <bschmidt@FreeBSD.org>

Instead of using the AMRR ratectl algo as default for drivers which have
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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# e11ad60d 14-Oct-2010 Hans Petter Selasky <hselasky@FreeBSD.org>

Add new USB device IDs to the list of supported devices.

PR: usb/151043
Approved by: thompsa (mentor)


# 2c7dee3b 07-Oct-2010 Ed Maste <emaste@FreeBSD.org>

In r207768 I silenced a console warning from rum(4). There was legitimate
opposition to the change, since really we need to implement missing
functionality in drivers or the 802.3 layer.

For now, restore a reminder message for a missing rum_update_mcast, but
print it only once.


# 8d8bdb01 01-Sep-2010 Andrew Thompson <thompsa@FreeBSD.org>

We need to grab a node reference count to vap->iv_bss before using it as it is
possible for the node to be replaced and freed at any time by
ieee80211_sta_join1().


# 910cb8fe 01-Sep-2010 Andrew Thompson <thompsa@FreeBSD.org>

Add missing MODULE_VERSION() definitions, this resolves problems around
duplicate module loads.

PR: usb/125736
Submitted by: danger, mm
Reviewed by: hselasky


# ad8e331b 14-Aug-2010 Bernhard Schmidt <bschmidt@FreeBSD.org>

Introduce IEEE80211_C_RATECTL, drivers which use the ratectl framework
should set this capability.

MFC after: 2 weeks


# 0f817de7 14-Jun-2010 Jung-uk Kim <jkim@FreeBSD.org>

Fix typos that broke duration calculations on protection frames. A similar
fix was done for ral(4) long ago and it must be copy-and-paste bugs.

Found by: clang


# 82878b11 11-May-2010 Rui Paulo <rpaulo@FreeBSD.org>

MFC r206367, r206358, r206370, r206371, r206372, r206398, r206415,
r206416, r206417, r206418, r206418:

net80211 ratectl framework.


# 6dd8e071 08-May-2010 Ed Maste <emaste@FreeBSD.org>

Add dummy function for ic_update_mcast (a la if_urtw) to avoid console
spam.


# e50d35e6 03-May-2010 Maxim Sobolev <sobomax@FreeBSD.org>

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


# ad658060 29-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

MFC r207077

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.


# b850ecc1 22-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after: 1 week


# b6108616 07-Apr-2010 Rui Paulo <rpaulo@FreeBSD.org>

net80211 rate control framework (net80211 ratectl).

This framework allows drivers to abstract the rate control algorithm and
just feed the framework with the usable parameters. The rate control
framework will now deal with passing the parameters to the selected
algorithm. Right now we have AMRR (the default) and RSSADAPT but there's
no way to select one with ifconfig, yet.
The objective is to have more rate control algorithms in the net80211
stack so all drivers[0] can use it. Ideally, we'll have the well-known
sample rate control algorithm in the net80211 at some point so all
drivers can use it (not just ath).

[0] all drivers that do rate control in software, that is.

Reviewed by: bschmidt, thompsa, weyongo
MFC after: 1 months


# e7cccdd1 06-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

MFC r203141

Attempt to recover on a TX error rather than stopping all transfers.

Submitted by: Hans Petter Selesky


# 3f3b0d48 06-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

MFC r203139

Add device ID.

PR: usb/142427


# 0283fab7 28-Jan-2010 Andrew Thompson <thompsa@FreeBSD.org>

Attempt to recover on a TX error rather than stopping all transfers.

Submitted by: Hans Petter Selesky


# 031c7388 28-Jan-2010 Andrew Thompson <thompsa@FreeBSD.org>

Add device ID.

PR: usb/142427


# dc72f7b4 30-Dec-2009 Andrew Thompson <thompsa@FreeBSD.org>

MFC r201028

Use macros to strip off USB_VENDOR_ and USB_PRODUCT_ from some id tables to make
them more compact and readable.


# 9e6b5313 26-Dec-2009 Andrew Thompson <thompsa@FreeBSD.org>

Use macros to strip off USB_VENDOR_ and USB_PRODUCT_ from some id tables to make
them more compact and readable.


# 6fb7173c 20-Oct-2009 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r198098:
fixes a TX hang bug that it could happen when if_start callback didn't
be restarted by full of the output queue.

Tested by: bsduser <bsd at acd.homelinux.org>

MFC r198099:
fixes a TX hang that could be possible to happen when the trasfers are
in the high speed that some drivers don't call if_start callback after
marking ~IFF_DRV_OACTIVE.

Approved by: re (kib)


# db63fc93 14-Oct-2009 Weongyo Jeong <weongyo@FreeBSD.org>

fixes a TX hang bug that it could happen when if_start callback didn't
be restarted by full of the output queue.

MFC after: 3 days
Tested by: bsduser <bsd at acd.homelinux.org>


# 67784314 08-Sep-2009 Poul-Henning Kamp <phk@FreeBSD.org>

Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.


# b34421bf 08-Sep-2009 Poul-Henning Kamp <phk@FreeBSD.org>

Add necessary include.


# ed6d949a 22-Jun-2009 Andrew Thompson <thompsa@FreeBSD.org>

- Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h


# a593f6b8 14-Jun-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_|usbd_/ on all function names for the USB stack.


# 515db61d 29-May-2009 Sam Leffler <sam@FreeBSD.org>

validate tx rate(s) in the raw xmit path

Tested by: "Paul B. Mahol" <onemda@gmail.com> (rum, bwi)


# e0a69b51 29-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_/ on all typedefs for the USB stack.


# 760bc48e 28-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_/ on all C structs for the USB stack.


# 9360ae40 20-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.

Submitted by: Hans Petter Selasky


# f29a0724 20-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

- rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by: Hans Petter Selasky [1]


# 5463c4a4 20-May-2009 Sam Leffler <sam@FreeBSD.org>

Overhaul monitor mode handling:
o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO
and remove explicit bpf support from wireless drivers; drivers now
use ieee80211_radiotap_attach to setup shared data structures that
hold the radiotap header for each packet tx/rx
o remove rx timestamp from the rx path; it was used only by the tdma support
for debugging and was mostly useless due to it being 32-bits and mostly
unavailable
o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and
per-com state when there are active taps
o track the number of monitor mode vaps
o use bpf tap and monitor mode vap state to decide when to collect radiotap
state and dispatch frames; drivers no longer explicitly directly check
bpf state or use bpf calls to tap frames
o handle radiotap state updates on channel change in net80211; drivers
should not do this (unless they bypass net80211 which is almost always
a mistake)
o update various drivers to be more consistent/correct in handling radiotap
o update ral to include TSF in radiotap'd frames
o add promisc mode callback to wi

Reviewed by: cbzimmer, rpaulo, thompsa


# 5efea30f 02-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

Create a taskqueue for each wireless interface which provides a serialised
sleepable context for net80211 driver callbacks. This removes the need for USB
and firmware based drivers to roll their own code to defer the chip programming
for state changes, scan requests, channel changes and mcast/promisc updates.
When a driver callback completes the hardware state is now guaranteed to have
been updated and is in sync with net80211 layer.

This nukes around 1300 lines of code from the wireless device drivers making
them more readable and less race prone.

The net80211 layer has been updated as follows
- all state/channel changes are serialised on the taskqueue.
- ieee80211_new_state() always queues and can now be called from any context
- scanning runs from a single taskq function and executes to completion. driver
callbacks are synchronous so the channel, phy mode and rx filters are
guaranteed to be set in hardware before probe request frames are
transmitted.

Help and contributions from Sam Leffler.

Reviewed by: sam


# 4eae601e 05-Apr-2009 Andrew Thompson <thompsa@FreeBSD.org>

MFp4 //depot/projects/usb@159909

- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
"usb2_config" has a new field called "usb_mode" which select for which mode
the current xfer entry is active. Options are: a) Device mode only b) Host
mode only (default-by-zero) c) Both modes. This change was scripted using
the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
the code for the function uses less memory than the table itself.

Submitted by: Hans Petter Selasky


# 2da462e3 31-Mar-2009 Kevin Lo <kevlo@FreeBSD.org>

Add another rum(4) device found in
http://www.fit-pc.com/new/whats-new.html


# 339ccfb3 30-Mar-2009 Sam Leffler <sam@FreeBSD.org>

Hoist 802.11 encapsulation up into net80211:
o call ieee80211_encap in ieee80211_start so frames passed down to drivers
are already encapsulated
o remove ieee80211_encap calls in drivers
o fixup wi so it recreates the 802.3 head it requires from the 802.11
header contents
o move fast-frame aggregation from ath to net80211 (conditional on
IEEE80211_SUPPORT_SUPERG):
- aggregation is now done in ieee80211_start; it is enabled when the
packets/sec exceeds ieee80211_ffppsmin (net.wlan.ffppsmin) and frames
are held on a staging queue according to ieee80211_ffagemax
(net.wlan.ffagemax) to wait for a frame to combine with
- drivers must call back to age/flush the staging queue (ath does this
on tx done, at swba, and on rx according to the state of the tx queues
and/or the contents of the staging queue)
- remove fast-frame-related data structures from ath
- add ieee80211_ff_node_init and ieee80211_ff_node_cleanup to handle
per-node fast-frames state (we reuse 11n tx ampdu state)
o change ieee80211_encap calling convention to include an explicit vap
so frames coming through a WDS vap are recognized w/o setting M_WDS

With these changes any device able to tx/rx 3Kbyte+ frames can use fast-frames.

Reviewed by: thompsa, rpaulo, avatar, imp, sephe


# 26d39e2c 29-Mar-2009 Sam Leffler <sam@FreeBSD.org>

o add ic_rt to track the rate table for the current channel; this enables
calculation of packet transmit times to do things like check txop limits
o remove equivalent driver code and convert to use net80211 state


# 29aca940 29-Mar-2009 Sam Leffler <sam@FreeBSD.org>

Eliminate ic_myaddr so changing the mac address of a device works correctly:
o remove ic_myaddr from ieee80211com
o change ieee80211_ifattach to take the mac address of the physical device
and use that to setup the lladdr.
o replace all references to ic_myaddr in drivers by IF_LLADDR
o related cleanups (e.g. kill dead code)

PR: kern/133178
Reviewed by: thompsa, rpaulo


# 9aef556d 01-Mar-2009 Andrew Thompson <thompsa@FreeBSD.org>

Rename the ushub device class back to uhub as it was in the old usb stack,
moused(8) looks for "uhub/ums" to decide if needs to load the module.

Reported by: Garrett Cooper


# a09d8d73 27-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Remove ic_update_mcast calls that are not implemented.

Spotted by: sam
Pointy hat: me


# 77ddf3d3 27-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Partial sync to //depot/projects/usb

- Reissue the ctrl request on failure
- Ensure Tx and ctrl requests are not interleaved
- Add promisc callbacks

Obtained from: Hans Petter Selasky


# 5d38a4d4 24-Feb-2009 Ed Schouten <ed@FreeBSD.org>

Also use proper capitalisation of FreeBSD in other source files.

Approved by: thompsa


# 96ca458f 23-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Make sure at least two tx slots are free before sending the mbuf since an
additional frame may be sent for 80211 protection.


# 02ac6454 23-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Move the new USB stack into its new home.