History log of /freebsd-current/sys/dev/bwn/if_bwn.c
Revision Date Author Comments
# 59dba901 13-Dec-2023 Frank Hilgendorf <frank.hilgendorf@posteo.de>

bwn: remove unused ic_headroom

Unlike bwi(4), bwn(4) does not rely on ic_headroom (despite having it
set) but splits the bwn_txhdr (first) segment into its own transaction.
Remove ic_headroom to avoid net80211 troubles with not enough space in
the mbuf around ieee80211_mbuf_adjust().

PR: 275616
MFC after: 3 days


# 1c6dd33d 03-Nov-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

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

This reverts commit b65f813c1ab99448278961c5ca80dc422b1eae29.
As a side effect this also seems to fix wtap which seems to have
lost the epoch over the input path in between.

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/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# b338e3ea 09-May-2022 John Baldwin <jhb@FreeBSD.org>

bwi/bwn: Remove unused devclass arguments to DRIVER_MODULE.


# dbd330fc 28-Feb-2022 Warner Losh <imp@FreeBSD.org>

bwn: Remove useless variable

type is a write-only variable. Eliminate it.

Sponsored by: Netflix


# fe5ebb23 24-Sep-2020 Bjoern A. Zeeb <bz@FreeBSD.org>

Provide MS() and SM() macros for 80211 and wireless drivers.

We have (two versions) of MS() and SM() macros which we use throughout
the wireless code. Change all but three places (ath_hal, rtwn, and rsu)
to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
macros. Also change one internal case using both _S and _M instead of
just _S away from _M (one of the reasons rtwn and rsu were not changed).

This was done semi-mechanically. No functional changes intended.

Requested by: gnn (D26091)
Reviewed by: adrian (pre line wrap)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26539


# 7163a849 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

bwn: clean up empty lines in .c and .h files


# 7029da5c 26-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 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.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718


# 6c3e93cb 11-Feb-2020 Gleb Smirnoff <glebius@FreeBSD.org>

Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
incoming packets in taskqueue context.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23518


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

Widen EPOCH(9) usage in PCI WLAN drivers.

Make sure all occurrences of ieee80211_input_xxx() in sys/dev are
covered by a network epoch section. Do not depend on the interrupt
handler nor any taskqueues being in a network epoch section.

This patch should unbreak the PCI WLAN drivers after r357004.

Pointy hat: glebius@
Sponsored by: Mellanox Technologies


# ecb278f2 01-Jul-2019 Landon J. Fuller <landonf@FreeBSD.org>

bwn(4): Include SROM revision when printing device identification.


# 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


# 838b61c1 31-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

bwn(4): reuse ieee80211_tx_complete function.

MFC after: 1 week


# c2a5a6c1 12-Dec-2018 Mark Johnston <markj@FreeBSD.org>

Fix a possible mbuf double free in bwn_dma_tx_start().

If bus_dmamap_load_mbuf() fails following a defrag, the caller of
bwn_dma_tx_start() would free the original mbuf after m_defrag() had
already done so. Fix this by returning the defragged mbuf to the
caller instead. Update bwn_pio_tx_start() similarly for consistency.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by: landonf
Tested by: landonf
MFC after: 3 days
admbug: 820
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18342


# 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


# 0f18e6f6 13-Feb-2018 Landon J. Fuller <landonf@FreeBSD.org>

bwn(4): Conditionalize "RX decryption attempted" message on a new
BWN_DEBUG_HWCRYPTO debug flag.

The MAC will attempt decryption (and set BWN_RX_MAC_DEC) even if a key has
not been supplied to the hardware; this is expected behavior, and there's
no need to spam users' console with this debugging printf.


# d177c199 05-Feb-2018 Landon J. Fuller <landonf@FreeBSD.org>

bwn(4): migrate bwn(4) to the native bhnd(9) interface, and drop siba_bwn.

- Remove the shim interface that allowed bwn(4) to use either siba_bwn or
bhnd(4), replacing all siba_bwn calls with their bhnd(4) bus equivalents.
- Drop the legay, now-unused siba_bwn bus driver.
- Clean up bhnd(4) board flag defines referenced by bwn(4).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13518


# ac2fffa4 21-Jan-2018 Pedro F. Giffuni <pfg@FreeBSD.org>

Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9).

The use of mallocarray(9) has rocketed the required swap to build FreeBSD.
This is likely caused by the allocation size attributes which put extra pressure
on the compiler.

Given that most of these checks are superfluous we have to choose better
where to use mallocarray(9). We still have more uses of mallocarray(9) but
hopefully this is enough to bring swap usage to a reasonable level.

Reported by: wosch
PR: 225197


# 19a63eb5 17-Jan-2018 Landon J. Fuller <landonf@FreeBSD.org>

bwn(4): Enable, by default, the opt-in support for bhnd(4) introduced in
r326454.

bwn(4)/bhnd(4) has been tested with most chipsets currently supported by
bwn(4), and this change should be transparent to existing bwn(4) users;
please report any regressions that you do encounter.

To revert to using siba_bwn(4) instead of bhnd(4), place the following
lines in loader.conf(5):

hw.bwn_pci.preferred="0"

Once we're satisfied that the switch to bhnd(4) has seen sufficient broader
testing, bwn(4) will be migrated to use the native bhnd(9) interface
directly, and support for siba_bwn(4) will be dropped (see D13518).

Sponsored by: The FreeBSD Foundation


# 26c1d774 13-Jan-2018 Pedro F. Giffuni <pfg@FreeBSD.org>

dev: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these is likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.


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


# 0bffd217 13-Dec-2017 Landon J. Fuller <landonf@FreeBSD.org>

Add basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.

- Add the BCM4322X D11 core revision and missing BCM43224 PCI device ID to
our device tables.
- Disable the DMA engine parity check (rather than adding parity support
to the to-be-replaced bwn(4) DMA implementation).

Currently, N-PHY support in bwn(4) is GPL licensed, and is not included by
default. Until this is replaced with Broadcom's ISC-licensed N-PHY
implementation, bwn(4) must be rebuilt to enable N-PHY support.

To build bwn(4) with N-PHY support, add the following lines to your kernel
configuration file and rebuild the kernel (and modules):

options BWN_GPL_PHY

To test bwn(4) with a BCM43224/BCM43225 device, install the firmware from
the net/bwn-firmware-kmod port, and place the following lines in
loader.conf(5):

hw.bwn_pci.preferred="1"

if_bwn_pci_load="YES
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation


# 8d14ca9c 01-Dec-2017 Landon J. Fuller <landonf@FreeBSD.org>

Introduce bwn(4) support for the bhnd(4) bus.

Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support
for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi
adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect
found in post-2009 Broadcom Wi-Fi hardware, are not supported by
siba_bwn(4).

The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port)
provides a unified kernel interface to a superset of the hardware supported
by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern
PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as
Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their
SSB or BCMA backplane.

This diff introduces opt-in bwn(4) support for bhnd(4) by providing:

- A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via
bhnd(4) instead of siba_bwn(4).
- A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally
probes at a higher priority than the siba_bwn(4) PCI driver.
- A set of compatibility shims that perform translation of bwn(4)'s
siba_bwn function calls into their bhnd(9) API equivalents when bwn(4)
is attached via a bhnd(4) bus parent. When bwn(4) is attached via
siba_bwn(4), all siba_bwn function calls are simply passed through to
their original implementations.

To test bwn(4) with bhnd(4), place the following lines in loader.conf(5):

hw.bwn_pci.preferred="1"

if_bwn_pci_load="YES
bwn_v4_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"

To verify that bwn(4) is using bhnd(4), you can check dmesg:

bwn0: <Broadcom 802.11 MAC/PHY/Radio, rev 15> ... on bhnd0

... or devinfo(8):

pcib2
pci2
bwn_pci0
bhndb0
bhnd0
bwn0
...

bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently
supported by bwn(4), including:

- BCM4312
- BCM4318
- BCM4321

With minimal changes to the DMA code (not included in this commit), I was
also able to test support for newer BCMA devices by bringing up basic
working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets:

- BCM43224
- BCM43225

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation & Plausible Labs
Differential Revision: https://reviews.freebsd.org/D13041


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# 7013b24d 06-Apr-2017 Conrad Meyer <cem@FreeBSD.org>

bwn(4): Fix trivial null dereference

Reported by: PVS-Studio
Sponsored by: Dell EMC Isilon


# 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


# 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


# 4594925d 06-Jun-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] don't use a 1MB CCK RTS frame for 11a OFDM transmissions.


# 14b258b8 05-Jun-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] Add missing firmware release calls.

This trips me up whenever I'm fooling around with partially supported
NICs that fail to fully attach or initialise - the firmware gets loaded
and references, but something fails - and the firmware references
aren't cleaned up.


# 4bfbed72 05-Jun-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] Enable PHY-LP 5GHz support for the one NIC I have tested it on so far.

After perusing the PHY-LP code (don't ask why; honest) I discovered that
it /has/ 5GHz support - but it's not ever used. I found one NIC - a
BCM4312 w/ pci id 0x4315 - which advertised dual-band PHY-LP support.

Turns out it works.

Whilst here, move up the support bit logging code so I can use it
to debug this.

Tested:

* BCM4312 (pci id 0x4315); 5GHz STA operation


# 40dcddfc 23-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] begin separating out the attach path from the SIBA specific bits.

* convert phy_getinfo() to take a "gmode" flag, rather than the siba
TGSHIGH flags and then check for 2GHz. This should ensure that
gmode is set correctly even on DUALPHY NICs.
* move the siba_powerup() call and the TGSHIGH decoding into a
call to bwn_is_bus_siba(), and return an error if it's called
on anything else. We don't yet do anything else, but when we do..

Tested:

* BCM4322, 11a STA


# a7978cf3 23-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] add extra debugging for non-SIBA devices.

This is a no-op at the present moment, but will eventually remind me
where the SIBA specific demons lie.

Tested:

* BCM4322, STA mode


# 4328ca5a 20-May-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

wi: fix a typo.

The max size of bitmask is IEEE80211_MODE_BYTES, not IEEE80211_MODE_MAX.

Reuse it in bwn(4) while I'm here.

Noticed by: kevlo


# 0550ee24 18-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] quieten the "invalid firmware state".

That pops up in the rev 5xx / 6xx microcode on the later cores
(4312, 4322.) I'm not sure why this is happening yet and I'll
dig into it, but Linux b43 does the same thing.


# 4afc7f78 18-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] program in the MAC capabilities somewhere where later microcode
expects it.

Obtained from: Linux b43


# a5d89c93 18-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] add extra debugging.


# fefdffc6 18-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] toggle the PHY clock during chip reset.

Tested:

* BCM4311, STA mode
* BCM4312, STA mode
* BCM4321, STA mode
* BCM4322, STA mde


# 867d6884 18-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] enable dual-phy on BCM4322MC.

Tested (with later commits):

* BCM4322MC, STA mode, 2G + 5G


# a74bf020 17-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] add initial 5xx firmware API support

* Add the new TX/RX frame formats;
* Use the right TX/RX format based on the frame info;
* Disable the 5xx firmware check, since now it should
somewhat work (but note, we don't yet use it unless
you manually add ucode11/initvals11 from the 5.x driver
to bwn-kmod-firmware;

* Misc: update some comments/debugging now I know what's
actually going on.

Tested:

* BCM4321MC, STA mode, both 4xx and 666 firmware, DMA mode

TODO:

* The newer firmware ends up logging "warn: firmware state (0)";
not sure yet what's going on there. But, yes, it still works.
I'm committing this via a BCM4321MC, 11a station, firmware
rev 666.

Obtained from: Linux b43 (TX/RX descriptor format for 5xx)


# 3095d9fb 17-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] correctly calculate RSSI level.

Tested:

* BCM4311, PHY-G, STA mode
* BCM4312, PHY-LP, STA mode
* BCM4321, PHY-N, STA moe


# 0a275378 17-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] print out a very obvious notice that GPLv2 code is compiled in if it is.


# f629a238 17-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] always allocate maximum size txhdr entries; prepare for fw 598

* always allocate maximum size txhdr entries
* set the right rx header offset/framesize based on firmware

This still isn't what's completely required for fw 598 support; there's
more to come.

Tested:

* Apple BCM94321MC 11abgn NIC, 11a STA mode, firmware version 4xx.

Obtained from: DragonflyBSD (txhdr entry sizing), fw 598 RX header size (linux b43)


# ac31839d 17-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] Add PHY-N call hooks.


# a9710824 16-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] add opt_wlan.h / opt_bwn.h for build-time control

This is a separate commit as I have local changes to bwn for now and
this needs a manual merge/commit.

Sponsored by: Palm Springs


# 5217d130 16-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] switch to ieee80211_add_channel()

This is an updated version of D6140.

Tested:

* BCM4321 11abgn, STA mode (11a)

Submitted by: avos
Differential Revision: https://reviews.freebsd.org/D6140


# f52cfd7f 16-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] check DUALPHY; add BCM4322 to the don't-override list.

* DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than
two separate PHYs/MACs (which we almost but don't quite yet support.)
Use it.

* Add the BCM4322 PCI ID to the list of devices we don't override.
This means the 2g/5g flags are preserved, and thus we get 5GHz
operation (with N-PHY, of course.)

Tested:

* BCM4311, STA mode (11bg)
* BCM4312, STA mode (11bg)
* BCM4321, STA mode (11abg)

Sponsored by: Palm Springs


# 16ff0ae7 15-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] use contigmalloc to allocate descriptors.

We can't assume malloc() returns physically contiguous memory.

Submitted by: Imre Vadasz <imre@vdsz.com>
Obtained from: DragonflyBSD


# 2ad2bda1 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] handle core rev 12, we can mostly do that new.


# c3d021a6 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] disable 11na channel setup for now, since we definitely, positively
don't do 11na yet.


# 45606ae1 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] fill out phyctl_1 fields for N-PHY (and later, eventually.)

N-PHY and later require a lot more plcp specific setup for the PHY
to know what to transmit. I've been spoilt by the atheros, intel
and realtek parts where you don't have to hand-assemble the PLCP
but .. well, apparently Broadcom require a lot more work.

This, and PHY-N itself, was the last major missing bit to get 11a
OFDM transmit to work. Without this, CCK transmit worked but
OFDM transmit would always fail (with stat.phy_err set to 0x80.)

I have no idea what 0x80 is, and I went mad reading the broadcom
vendor driver to try and figure it out.

Tested:

* BCM4312 (PHY-LP)
* BCM4321 (PHY-N), 11a, 11bg.


# 80c3f552 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] set the 5ghz transmit flag for 5ghz transmit.

Turns out trying to do 11a transmit without this set works poorly.


# e9e6f47e 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] disable writing slottime timing out to improve performance.

this is from b43 linux, there's a comment in there which notes
one nic family suffers performance degredation with this being set.


# 7fb49b1e 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] make rf-kill work for PHY-N.


# d54c38a3 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] decode the RX RSSI for PHY-N.

I'm still figuring this out, but it at least works somewhat.


# 6553a04c 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] use the new enum type.


# 1fb1f6f9 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] debugging changes.

Now that I have 5g working on PHY-N, that "changing band" message
happens quite a bit. Make it a debug log, not an explicit printf.


# 53a9eeb7 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] Explicitly only work for SIBA parts; add some placeholder debugging.

Set phy-full-init always to 1 for now; PHY-N supports being able to do
partial init for things like fast channel changes but I'm going to
ignore it all.


# 9193516e 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] TX logging / completion fixes

* Log the per-completion status out if requested
* If we get a PHY failure, the retrycnt is set to 0 and ack=0, so
the logic was incorrect. So, for ack=0, ensure we don't log
a retrycnt of 0 (or rate control breaks) or a negative retrycnt
(or rate control also breaks.)

Tested:

* BCM4321 (11abgn N-PHY), BCM4312 (LP-PHY)


# 0cfd65ec 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] add in new microcode and phy initval information.

This is required for PHY-N and later hardware.

Tested:

* BCN4321 (11abgn), PHY-N


# 52bef765 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] implement reset improvements in preparation for PHY-N support

* Ensure we set 20MHz wide channels (hard-coded) for PHY-N.
* Change the core rese tto take a flag saying "gmode" vesus uint32_t
flags. This is important for BCMA support where the "gmode" bit
is different.
* Refactor out the mac-phy clock reset routine (usde by PHY-N).

Tested:

* BCM4321 (PHY-N), BCM4312 (PHY-LP)

TODO:

* Checkpoint test on PHY-G hardware, just to check.


# baed0627 14-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] disable bgscan for now.

I'll re-enable this when I've verified all of the locking / concurrency
access to the hardware is "right".

Tested:

* BCM4321 (PHY-N), BCM4312 (PHY-LP)


# 3b075014 05-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] fix signed-ness of the rssi parameter.

It's a uint8_t from the hardware.

Found by: gcc


# af4ae173 05-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] implement firmware tx/rx versioning and fix RSSI calculation.

Different versions of firmware have different requirments for TX/RX
packet layouts (and other things, of course.) Currently the driver
checks between 3xx and 4xx firmware by using the BWN_ISOLDFMT() macro,
which doesn't take into account the 5xx firmware (which I think I need
for the HT and N series PHY chips. I'll know when I do the port.)
BWN_HDRSIZE() also needs to learn about the 5xx series firmware
as well.

So:

* add a firmware version enum
* populate it based on the firmware version we read at load time
* don't finish loading if the firmware is the 5xx firmware; any
code using BWN_ISOLDFMT or BWN_HDRSIZE needs updating (most notably
the TX and RX bits.)

Then, for RX RSSI:

* write down and reimplement the b43 rssi calculation method;
* use it for the correct PHYs (which are all the ones we support);
* do the RSSI calculation before radiotap, not after.

Tested:

* Broadcom BCM4312, STA mode

Obtained from: Linux b43 (careful writing and reimplementing; lots of integer math..)


# 148ed571 04-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] [bhnd] initial support for using bhnd for if_bwn devices.

This is an initial work in progress to use the replacement bhnd
bus code for devices which support it.

* Add manpage updates for bhnd, bhndb, siba
* Add kernel options for bhnd, bhndbus, etc
* Add initial support in if_bwn_pci / if_bwn_mac for using bhnd
as the bus transport for suppoted NICs
* if_bwn_pci will eventually be the PCI bus glue to interface to bwn,
which will use the right backend bus to attach to, versus direct
nexus/bhnd attachments (as found in embedded broadcom devices.)

The PCI glue defaults to probing at a lower level than the bwn glue,
so bwn should still attach as per normal without a boot time tunable set.

It's also not fully fleshed out - the bwn probe/attach code needs to be
broken out into platform and bus specific things (just like ath, ath_pci,
ath_ahb) before we can shift the driver over to using this.

Tested:

* BCM4311, STA mode
* BCM4312, STA mode

Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision: https://reviews.freebsd.org/D6191


# d191ae19 03-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] fix rate control feedback.

* Add a debug print for the xmit completion status fields.
Yes, I like staring at a stream of DWORDS.

* Set the retrycnt to the number of full frame retries for now;
I'll figure out how to factor rts/cts failures into it when
I figure out what the difference is.

It's -1 because it's not "retries", it's "tries".

It now passes the youtube test.

Tested:

* BCM4312, STA mode


# e1e8b052 03-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] accurately(ish) account transmit/recieve failures for rate control.

I noticed that it'd associate fine, but it'd quickly stop exchanging traffic.
Receive was okay, but transmit just failed.

Then I went "wlandebug +rate". I discovered it started at 36M OFDM, and then
quickly rose to 54M, which then showed 0% transmit success.

Then, I dug into how the completion path works. We are reading 'ack=0'
in the TX status side, so .. then I discovered we were only processing the
TX completion status /if/ ack=1. So, we'd only ever count successes;
we'd never count failures, and thus the rate control code thought
everything was a-ok.

We also have to set retrycnt to something non-zero so it indeed does
bring the rate down upon failure.

So:

* Delete the rate control completion code from the tx completion
routine, it's just duplicate and never worked. Putting it behind
'if (status->ack) was pointless.

* Move it to the PIO and DMA completion routines which actually
do free the node reference and mbuf. We know at that point
what the status is, so do it there.

* Fake a retrycnt of 1 for now, so we at least count failures.

Also:

* Start adding comments about weird stuff I find with rate selection.
In this instance, we shouldn't be selecting a fallback rate that
doesn't match the currently configured mode (11a, 11b, 11g, etc.)

This isn't perfect - AMRR does try 54mbit and takes a few packets
before it figures out it's a bad idea - but it's better than nothing.

This makes the bwn(4) driver actually useful for the first time since
I've tried using it - and that dates back to 2011. I've resisted
successfully until now.

Tested:

* Broadcom BCM4312 802.11b/g Wireless, STA mode
WLAN (chipid 0x4312 rev 15) PHY (analog 6 type 5 rev 1) RADIO (manuf 0x17f ver 0x2062 rev 2)

TODO:

* See if the fallback rate actually /is/ working
* Question my own sanity over touching this driver in the first place.


# b0436c3a 03-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] ensure the fallback rate stays in the same PHY mode.

Falling back from 6MB OFDM to 5MB CCK (a) may not work well in the
11bg PHYs, (b) won't work at all if you're 11g only, and (c) plainly
won't work for the 11a PHY.

So, don't do that!

Tested:

* BCM4312 802.11b/g Wireless, STA mode
WLAN (chipid 0x4312 rev 15) PHY (analog 6 type 5 rev 1) RADIO (manuf 0x17f ver 0x2062 rev 2)


# 7860c0c3 02-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] update bwn_dummy_transmission().

This is based on the b43 code. It'll be used by the upcoming 11n phy.

Obtained from: Linux b43 (concept)


# 6dbb9b3c 02-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] migrate bwn_dummy_transmission() back to main, as it'll be used by other PHYs.

The Linux b43 driver uses this in other PHYs besides the g PHY.


# d546e47a 02-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] break out the 'g' phy code into a separate source file.

* Break out the 'g' phy code;
* Break out the debugging bits into a separate source file, since
some debugging prints are done in the phy code;
* Make some more chip methods in if_bwn.c public.

This brings the size of if_bwn.c down to 6,805 lines which is now
approaching managable.


# b9768303 02-May-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] break out the LP PHY code into a separate file.

This (and eventually migrating the other PHY code out) is in preparation
for adding the 11n PHY. No, the 11ac PHY (for the BCM4260 softmac part) isn't
yet open source, so we can't grow that. Yet.

This trims ~3,700 lines of code from if_bwn.c, bringing it down to a slightly
less crazy sounding 10,446 lines of code.


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


# 73a1170a 19-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: use our nitems() macro when it is avaliable through param.h.

No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in: freebsd-current


# d475bf23 30-Mar-2016 Adrian Chadd <adrian@FreeBSD.org>

[bwn] fix time_before -> ieee80211_time_before()

Noticed by: Jia-Shiun Li <jiashiun@gmail.com>


# cbc4d2db 01-Mar-2016 John Baldwin <jhb@FreeBSD.org>

Remove taskqueue_enqueue_fast().

taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167. It has been a compat shim ever
since. It's time for the compat shim to go.

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: sephe
Differential Revision: https://reviews.freebsd.org/D5131


# 8ec07310 01-Feb-2016 Gleb Smirnoff <glebius@FreeBSD.org>

These files were getting sys/malloc.h and vm/uma.h with header pollution
via sys/mbuf.h


# 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


# 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


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


# 2cb71df1 17-Aug-2015 Adrian Chadd <adrian@FreeBSD.org>

Convert more ifp->if_softc -> ic->ic_softc.

These should be a big no-op.

Tested:

* make universe


# 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


# d3f9e6a7 12-Jul-2015 Adrian Chadd <adrian@FreeBSD.org>

Fixes the RF switch state polling by comparing with the revision of the
PHY instead of the revision of the RADIO.

This fixes the RF switch state polling.

This is from DragonflyBSD, Commit 202e28d1f65e9f35df6032400df3242a3bafb483

Obtained from: DragonflyBSD


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


# 6f954fb3 22-Mar-2015 Alexander Motin <mav@FreeBSD.org>

Remove MAXBSIZE use from drivers where it has nothing to do.

In some cases limits are just not needed, in others -- DFLTPHYS is the
right constant to use instead.

MFC after: 1 month


# c8dfaf38 18-Sep-2014 Gleb Smirnoff <glebius@FreeBSD.org>

Mechanically convert to if_inc_counter().


# af3b2549 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Pull in r267961 and r267973 again. Fix for issues reported will follow.


# 37a107a4 27-Jun-2014 Glen Barber <gjb@FreeBSD.org>

Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

1) no output from sysctl(8)
2) erroneously returning ENOMEM with tools like truss(1)
or uname(1)
truss: can not get etype: Cannot allocate memory


# 3da1cf1e 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies


# 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


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


# c2553fb9 06-May-2013 Hiren Panchasara <hiren@FreeBSD.org>

Fixing a clang warning about using uninitialized variable.

PR: 176712
Suggested by: jhb
Approved by: sbruno (mentor)


# 114a94cc 23-Apr-2013 Eitan Adler <eadler@FreeBSD.org>

Revert r249800 as
- it is incorrect: In the 'back' case you want to reuse the previous
mbuf.
- it was not reviewed by wireless@

Requested by: jhb, adrian


# 48e512f2 23-Apr-2013 Eitan Adler <eadler@FreeBSD.org>

Avoid warning about uninitalized variable

PR: kern/176712
Submitted by: Hiren Panchasara <hiren.panchasara@gmail.com> (earlier vesion)
Approved by: cperciva (mentor)


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

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


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


# 848e30ff 22-Nov-2011 Marius Strobl <marius@FreeBSD.org>

s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mention
of kobj(9) from device drivers.


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


# 87804318 08-Oct-2011 Christian Brueffer <brueffer@FreeBSD.org>

Remove dead code, "error" doesn't change between this check and the
previous one.

CID: 3254
Found with: Coverity Prevent(tm)
MFC after: 1 week


# 3b0a4aef 23-Mar-2011 John Baldwin <jhb@FreeBSD.org>

Do a sweep of the tree replacing calls to pci_find_extcap() with calls to
pci_find_cap() instead.


# 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


# 6dc7dc9a 12-Jan-2011 Matthew D Fleming <mdf@FreeBSD.org>

sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.

Commit the rest of the devices.


# 7df9d5ac 06-Dec-2010 Kevin Lo <kevlo@FreeBSD.org>

Fix double ;;


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


# 4e33fc94 12-Oct-2010 Joel Dahl <joel@FreeBSD.org>

Small grammar nit in a printf message.


# 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


# 0f3801fa 22-Jul-2010 Weongyo Jeong <weongyo@FreeBSD.org>

Fixes a mistake to calculate CALC_COEFF2() value that tmp[3] is
used even if it's unreachable.

PR: kern/144505
Submitted by: Henning Petersen <henning.petersen at t-online dot de>
MFC after: 1 week


# 6dcc706b 10-Jul-2010 Weongyo Jeong <weongyo@FreeBSD.org>

Fixes a bug for LP PHY that some frames have 2 padding bytes at the
start so we should adjust the mbuf if the driver is running in PIO mode.
Now it should work well with WPA authentication and association for LP
PHY devices.

Tested by: Warren Block <wblock at wonkity.com>
MFC after: 1 month


# 67555781 24-May-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r208120:
- fixes a bug that it didn't initialize the ratectl after association;
so ni_txrate returned 0 which is a invalid result.
- The fourth argument of ieee80211_ratectl_tx_complete() could be not
NULL.

Reported by: Gustau P?rez <gperez at entel.upc.edu>
Tested by: Gustau P?rez <gperez at entel.upc.edu>,
Ian FREISLICH <ianf at clue.co.za>


# f5101b53 15-May-2010 Weongyo Jeong <weongyo@FreeBSD.org>

- fixes a bug that it didn't initialize the ratectl after association;
so ni_txrate returned 0 which is a invalid result.
- The fourth argument of ieee80211_ratectl_tx_complete() could be not
NULL.

Reported by: Gustau P?rez <gperez at entel.upc.edu>
Tested by: Gustau P?rez <gperez at entel.upc.edu>,
Ian FREISLICH <ianf at clue.co.za>
MFC after: 3 days


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

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

net80211 ratectl framework.


# 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


# 13f80c05 01-May-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r207176:
ifp->if_ipackets++ when RX packet interrupts are occurred.


# 7d04a6be 24-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

ifp->if_ipackets++ when RX packet interrupts are occurred.

MFC after: 3 days


# 06c84dc0 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r205141:
enables S/W beacon miss handler.

Reported by: imp


# 87ecd62c 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r205003:
Revert r204992 and just wrap it all in ifdef INVARIANTS to fix the debug
and non-debug cases

MFC r204992:
fixes a compile error if INVARIANTS is disabled.

Pointy hat to: me
Submitted by: Michael Butler <imb at protected-networks dot net>

MFC r204983:
Fix build breakage introduced in r204922.

MFC r204923:
uses KOBJMETHOD_END macro to indicate the end of method table.

Submitted by: yongari

MFC r204922:
o uses bus accessor macros to read values from ivar so no more values
are referenced directly from ivar pointer. It's to do like what other
buses do. [1]
o changes exported prototypes. It doesn't use struct siba_* structures
anymore that instead of it it uses only device_t.
o removes duplicate code and debug messages.
o style(9)

Pointed out by: imp [1]


# 489d21bb 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204657:
fixes an attached-at-boot issue that bwn(4) using device_identify
interface didn't be attached automatically at boot time so changes a
approach to attach children based on leveraging some newbus niceties.

Submitted by: nwhitehorn


# dcad5dbe 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204542:
calculates the integer square root if a positive integer X is larger
than 256 instead of using sqrt_table.

Reported by: Joe Marcus Clarke <marcus at freebsd dot org>


# b0b1f91e 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204437:
fixes a bug to load firmware images for LP PHY. For LP PHY always,
`lp_' string is contained in its full image names.


# 95def843 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204436:
supports the adhoc demo mode that it's tested on modified aircrack-ng
suite and worked.

Submitted by: Paul B Mahol <onemda at gmail dot com>


# be58dd85 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204385:
don't need to check BWN_RX_PHYST0_SHORTPRMBL flag because it's already
handled in later.

Reported from: imp, nwhitehorn


# 460ea5b2 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204257:
o adds sysctl variables to show device statistics.
o records RTS success/fail statistics.

Pointed by: imp


# f60b0763 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204256:
fixes a compile error; invalid type argument of '->'.


# 286546e3 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204242:
Fix compilation problems with INVARIANTS.

# also limit RX decryption attempted messages to 50

Reviewed by: weongyo

Approved by: imp (implicit)


# 5533a0c4 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r204081:
o print msgs with length if the frame is too short to pass to
net80211.
o print key index for debugging if the frame is attempted to decrypt
for WEP, AES or TKIP though currently HW decryption isn't supported.


# 3e1e21c9 20-Apr-2010 Weongyo Jeong <weongyo@FreeBSD.org>

MFC r203945:
adds bwn(4) driver for supporting Broadcom BCM43xx chipsets.

o uses v4 firmware instead of v3. A port will be committed to
create the bwn firmware module.
o supports B/G and LP(low power) PHYs.
o supports 32 / 64 bits DMA operations.
o tested on big / little endian machines so should work on all
architectures.

It'd not connected to the build until the firmware port is committed.


# 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


# 2fe9b8d4 13-Mar-2010 Weongyo Jeong <weongyo@FreeBSD.org>

enables S/W beacon miss handler.

Reported by: imp


# 3c7703ea 10-Mar-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Fix build breakage introduced in r204922.


# 5a646f0e 09-Mar-2010 Weongyo Jeong <weongyo@FreeBSD.org>

uses KOBJMETHOD_END macro to indicate the end of method table.

Submitted by: yongari


# b9b64aa5 09-Mar-2010 Weongyo Jeong <weongyo@FreeBSD.org>

o uses bus accessor macros to read values from ivar so no more values
are referenced directly from ivar pointer. It's to do like what other
buses do. [1]
o changes exported prototypes. It doesn't use struct siba_* structures
anymore that instead of it it uses only device_t.
o removes duplicate code and debug messages.
o style(9)

Pointed out by: imp [1]


# 37fb01d6 03-Mar-2010 Weongyo Jeong <weongyo@FreeBSD.org>

fixes an attached-at-boot issue that bwn(4) using device_identify
interface didn't be attached automatically at boot time so changes a
approach to attach children based on leveraging some newbus niceties.

Submitted by: nwhitehorn


# ae5e95fa 01-Mar-2010 Weongyo Jeong <weongyo@FreeBSD.org>

calculates the integer square root if a positive integer X is larger
than 256 instead of using sqrt_table.

Reported by: Joe Marcus Clarke <marcus at freebsd dot org>


# 8600d132 27-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

fixes a bug to load firmware images for LP PHY. For LP PHY always,
`lp_' string is contained in its full image names.


# 7478ae97 27-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

supports the adhoc demo mode that it's tested on modified aircrack-ng
suite and worked.

Submitted by: Paul B Mahol <onemda at gmail dot com>


# 5fb654dc 26-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

don't need to check BWN_RX_PHYST0_SHORTPRMBL flag because it's already
handled in later.

Reported from: imp, nwhitehorn


# d2ee7771 23-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

o adds sysctl variables to show device statistics.
o records RTS success/fail statistics.

Pointed by: imp


# e355ad55 23-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

fixes a compile error; invalid type argument of '->'.


# 0d05eee2 22-Feb-2010 Warner Losh <imp@FreeBSD.org>

Fix compilation problems with INVARIANTS.

# also limit RX decryption attempted messages to 50

Reviewed by: weongyo


# ef0894bf 18-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

o print msgs with length if the frame is too short to pass to net80211.
o print key index for debugging if the frame is attempted to decrypt for
WEP, AES or TKIP though currently HW decryption isn't supported.


# 45d9abdb 15-Feb-2010 Weongyo Jeong <weongyo@FreeBSD.org>

adds bwn(4) driver for supporting Broadcom BCM43xx chipsets.

o uses v4 firmware instead of v3. A port will be committed to create
the bwn firmware module.
o supports B/G and LP(low power) PHYs.
o supports 32 / 64 bits DMA operations.
o tested on big / little endian machines so should work on all
architectures.

It'd not connected to the build until the firmware port is committed.