freebsd-dev/sys
Adrian Chadd e1e8b05256 [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.
2016-05-04 01:36:19 +00:00
..
amd64 sys/amd64: Small spelling fixes. 2016-05-03 22:13:04 +00:00
arm ACK the interrupt after disabling it, this avoid an interrupt storm. 2016-04-30 18:07:13 +00:00
arm64 Disable ACPI on arm64 ad it has only had minimal testing and is causing 2016-04-26 14:21:39 +00:00
boot Change a rounding operation that had missing braces into a roundup2() 2016-05-03 00:09:13 +00:00
bsm
cam Fix a memory leak in the devctl notify code. 2016-05-03 14:30:26 +00:00
cddl Fix a use-after-free when "zpool import" fails 2016-04-29 21:29:37 +00:00
compat sys/compat/linux*: spelling fixes. 2016-04-30 00:53:10 +00:00
conf Misc. build: minor spelling fixes. 2016-05-03 22:01:48 +00:00
contrib Revert AccessWidth/BitOffset support for AcpiHwWrite() and AcpiHwRead() for 2016-04-30 06:48:48 +00:00
crypto aesni(4): Initialize error before use 2016-04-20 03:05:32 +00:00
ddb Enhance the ddb examine (x) command. 2016-05-02 19:32:06 +00:00
dev [bwn] accurately(ish) account transmit/recieve failures for rate control. 2016-05-04 01:36:19 +00:00
fs Rationalize license numbering in fdescfs(5) 2016-04-30 16:01:37 +00:00
gdb
geom sys: Make use of our rounddown() macro when sys/param.h is available. 2016-04-30 14:41:18 +00:00
gnu Change OpenWRT imported dtsi files 2016-04-20 14:29:03 +00:00
i386 xen/i386: enable the platform hypercall for i386 2016-05-03 08:05:14 +00:00
isa sys/isa: minor spelling fixes. 2016-05-03 21:51:52 +00:00
kern Add EVFILT_VNODE open, read and close notifications. 2016-05-03 15:17:43 +00:00
kgssapi kgssapi: insignificant spelling fix. 2016-05-03 22:05:03 +00:00
libkern sys: Make use of our rounddown() macro when sys/param.h is available. 2016-04-30 14:41:18 +00:00
mips When attempting to satisfy mmap() requests for superpage alignment on 2016-04-30 19:29:03 +00:00
modules Misc. build: minor spelling fixes. 2016-05-03 22:01:48 +00:00
net sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
net80211 sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
netgraph sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
netinet sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
netinet6 sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
netipsec sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
netnatm kernel: use our nitems() macro when it is available through param.h. 2016-04-19 23:48:27 +00:00
netpfil sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
netsmb sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
nfs NFS: spelling fixes on comments. 2016-04-29 16:07:25 +00:00
nfsclient
nfsserver
nlm Remove slightly used const values that can be replaced with nitems(). 2016-04-21 15:38:28 +00:00
ofed Fix NOIP kernels to compile. 2016-04-24 15:56:05 +00:00
opencrypto
pc98 Move 'device pci' for the PCI bus driver to the MI NOTES file. 2016-04-29 23:53:55 +00:00
powerpc powerpc: Replace rounddown() from r298856 with roundup(). 2016-04-30 19:50:59 +00:00
riscv Rework the list of all pmaps: embed the list link into pmap. 2016-04-26 14:38:18 +00:00
rpc sys: Make use of our rounddown() macro when sys/param.h is available. 2016-04-30 14:41:18 +00:00
security sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
sparc64 Move 'device pci' for the PCI bus driver to the MI NOTES file. 2016-04-29 23:53:55 +00:00
sys sys/sys: missed in r298981. 2016-05-03 16:37:09 +00:00
teken
tests
tools Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified 2016-02-02 07:02:51 +00:00
ufs UFS: spelling fixes on comments. 2016-04-29 20:43:51 +00:00
vm sys/vm: minor spelling fixes in comments. 2016-05-02 20:16:29 +00:00
x86 Work around (ignore) broken SRAT tables 2016-05-03 20:14:04 +00:00
xdr RPC: for pointers replace 0 with NULL. 2016-04-14 17:06:37 +00:00
xen xenbus: add a comment with the names of the generated accessors 2016-01-15 14:34:31 +00:00
Makefile Add riscv to the list of architectures for cscope. 2016-02-29 16:39:27 +00:00