Home | History | Annotate | Download | only in usb
History log of /src/sys/dev/usb/if_urtwn.c
RevisionDateAuthorComments
 1.120  24-Aug-2025  nat Revert the last two commits to urtwn(4).

The dummy xfer is no longer required now that xhci(4) has been fixed.
 1.119  21-Aug-2025  nat Opps...Fix typo.
 1.118  21-Aug-2025  nat Fix errors when using urtwn(4) with xhci host cntrollers.

Openbsd had changed their xhci stack to send an empty xfer to accomodate
urtwn devices over xhci.

This achieves the same thing (but in the xhci driver itself).
The flow would be tx pkt-> empty xfer for each packet to transfer.
It also helps to schedule only one transfer per pipe at a time.

This avoids the dreaded "device timeout" condition and the wifi link remains
connected and operational.

Analysed by Harold Gutch and earlier isssues identified by Greg Troxel.
 1.117  21-Aug-2025  nat Fix typo.

Found by Harold Gutch (hgutch@).
 1.116  21-Aug-2025  nat Safety first!

Ensure that the receive packet processing does not exceed beyond xfer length.
 1.115  21-Aug-2025  nat Use the right packet spacing for the 8192EU.

From OpenBSD and confrimed by my own analysis.
 1.114  21-Aug-2025  nat Plug an xfer leak in the tx error path.
 1.113  21-Aug-2025  nat Set the pipe index on usb xfer creation.
 1.112  29-Jul-2025  hgutch branches: 1.112.2;
Add Asus USB-N10 Nano B1.

While there, remove duplicate Asus RTL8192CU_3 from match list.
 1.111  10-Nov-2024  riastradh if_urtwn.c: Indentation fixes.

No functional change intended.
 1.110  10-Nov-2024  mlelstv Add MBUFTRACE
 1.109  28-Feb-2024  riastradh branches: 1.109.2;
urtwn(4): Ditch old queued commands on overflow.

Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965
 1.108  06-Jan-2024  maya Add Mercusys NW150US V2 USB support

No changes needed, other than recognizing it as working.

From Daeil Lee in PR/57819
 1.107  01-Aug-2023  mrg fix simple mis-matched function prototype and definitions.

most of these are like, eg

void foo(int[2]);

with either of these

void foo(int*) { ... }
void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
 1.106  20-Jul-2023  mrg various debug updates for some usb drivers

- several new *_DEBUG_DEFAULT options that allow usb debug values to
be set to a default that is non-zero:
EHCI_DEBUG_DEFAULT, UGEN_DEBUG_DEFAULT, URTWN_DEBUG_DEFAULT,
UMS_DEBUG_DEFAULT, and USB_DEBUG_DEFAULT
- ugen debug uses fewer usbhist lines for the same info
- ums.c converted from printf() to usbhist
 1.105  31-Jul-2022  mlelstv branches: 1.105.4;
Don't report errors as timeout.
 1.104  23-Jun-2022  brook if_urtwn.c: add the TRENDnet TEW-648UBM
 1.103  06-Apr-2022  mlelstv revert accidental last commit (except ukbd.c)
 1.102  06-Apr-2022  mlelstv remove debug printf
 1.101  21-Oct-2021  jnemeth add Edimax N150 adapter; tested on my PBP
 1.100  17-Sep-2021  nat Sprinkle a little delay.
 1.99  17-Sep-2021  nat Initialize firmware mailbox counter when firmware is reset.
 1.98  17-Sep-2021  nat Serialize sending of firmware commands to device.
 1.97  17-Sep-2021  nat Use urtwn_delay_ms were possibile.

NFC intended.
 1.96  02-Mar-2021  nat Opps....Remove irrelavent debug code and don't free_m before IFQ_DEQUEUE().

Identified and reported by Patrick Welche and remedy found by Martin Husemann.
 1.95  26-Feb-2021  nat Also free assocated mbufs.
 1.94  21-Feb-2021  mrg replace printf "ERROR<n>" with device_printf() and useful messages.
 1.93  02-Feb-2021  yamt if_urtwn.c: Plug a few leaks

Can be a cause of PR/55968
 1.92  02-Feb-2021  yamt if_urtwn: Add a missing newline to an aprint_error_dev message
 1.91  01-Feb-2021  riastradh urtwn(4): Check for allocation failure in urtwn_tx_beacon.

Candidate fix for PR kern/55968.
 1.90  01-Feb-2021  nia add another TPLINK RTL8192EU variant

to avoid confusion use TP-Link's names for these variants, matching
FreeBSD
 1.89  31-Jan-2021  nia urtwn(4): add TPLINK WN821N to the list of USB device ids

reported by kfmut on the unitedbsd forums.
 1.88  27-Jun-2020  jdolecek branches: 1.88.2;
mark several init-only functions as noinline to avoid bumping into the
stack limit
 1.87  02-May-2020  mrg don't forget to destroy the new sc_media_mtx mutex.

now re-plugging and re-using the same softc doesn't give mutex
already initialised error.
 1.86  16-Apr-2020  nat Correct rx packet count for 8192EU. Tested OK.
 1.85  04-Apr-2020  skrll branches: 1.85.2;
Add D-Link DWA-121 rev B1 to list of supported devices

From Miguel Landaeta in kern/55140
 1.84  15-Mar-2020  thorpej Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
access to media-related structures / hardware regsiters. Converted
drivers use the new ifmedia_init_with_lock() function for this. The
new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
a compatibility lock to be used instead. Several media-related entry
points must be aware of this compatibility lock, and are able to acquire
it recursively a limited number of times, if needed. This is a SPIN
mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex. The mcx driver still needs to be fully converted to
NET_MPSAFE.
 1.83  14-Mar-2020  christos revert the 0x% -> %# change for fixed width formats pointed out by uwe.
 1.82  13-Mar-2020  christos PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log
 1.81  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.80  15-Jan-2020  skrll Use modern interfaces and kill tsleep/wakeup. From nick-nhusb branch.
 1.79  15-Jan-2020  skrll Trailing whitespace
 1.78  13-Dec-2019  maxv branches: 1.78.2;
Fix gross use-after-free. Found by a custom query on LGTM.
 1.77  01-Dec-2019  mlelstv Don't deregister twice with pmf.
 1.76  01-Dec-2019  mlelstv Reset MCU ready status before resetting the MCU.
Fixes PR kern/54728
 1.75  26-Nov-2019  gson Change 0x%jx -> %#jx as suggested by christos.
 1.74  26-Nov-2019  gson Convert debug printfs to usbhist.
 1.73  10-Oct-2019  bad use ether_snprintf instead of open coding it.
 1.72  19-Aug-2019  mrg move the call to rnd_attach_source() earlier and add a matching
call to rnd_detach_source() into detach.

fixes an attach-detach-reattach issue where the rnd source was
already known.
 1.71  25-Jul-2019  msaitoh branches: 1.71.2;
Avoid undefined behavior. Found by KUBSan.
 1.70  15-Jun-2019  msaitoh Add rnd(9) support.
 1.69  07-Mar-2019  christos add SIOCS80211CHANNEL special handling in monitor mode (from OpenBSD)
 1.68  01-Feb-2019  christos Add a software beacon.
XXX: As all the other usb software beacons this is driven at fixed intervals
when usb task fires.
 1.67  20-Dec-2018  tih Add D-Link DWA-131 rev E "Wireless N300 Nano USB Adapter"

OK: jmcneill
 1.66  15-Dec-2018  msaitoh Make IODATA WN-G150UMW work:
- Increase delay to prevent "could not send firmware command". The value
is taken from FreeBSD.
-Increase delay to prevent "timeout waiting for firmware readiness". The
vaule is taken from Linux.
 1.65  13-Nov-2018  mlelstv Fix race in attachment.
 1.64  12-Sep-2018  christos Don't have modules depend on bpf; they will find the dependency dynamically
at runtime. Otherwise builtin modules will complain about non-builtin bpf.
 1.63  02-Aug-2018  riastradh Fix usb_rem_task_wait API.

- Return whether it removed task from queue or not.
. True if it was on the queue and we intercepted it before it ran.
. False if we could not intercept it: either it wasn't queued,
or it already ran. (Up to caller to distinguish these cases.)
- Pass an optional interlock like callout_halt.

While here, simplify.

ok mrg@
 1.62  30-Jul-2018  jmcneill Skip urtwn_chip_stop for 88E family chips as we do for 92EU.

Doing "ifconfig urtwn0 down" with an RTL8188EU on Pinebook causes the
device to disappear from the built-in GL850G USB 2.0 hub. Since this
happens at reboot, an unplug/replug cycle is the only way to make the
device re-appear. Bypassing urtwn_chip_stop works around this issue.
 1.61  29-Jul-2018  riastradh Use usb_rem_task_wait in urtwn(4) detach.
 1.60  29-Jun-2018  thorpej - Unify the "rtwn" and "urtwn" register definitions and initialization
tables into common header files shared by both drivers.
- Fix some register and bit definitions, from OpenBSD and verified against
the vendor driver.
- Add some additional register / descriptor defnitions, from OpenBSD.
 1.59  26-Jun-2018  msaitoh branches: 1.59.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.58  01-Jun-2018  nat Fix support for 8192eu, notably TPLINK TL-WN823NV2, by using the right
registers when setting receiver gain.

Ok christos@.
 1.57  08-Feb-2018  dholland branches: 1.57.2;
Typos.
 1.56  21-Jan-2018  skrll PR kern/52931 Kernel panics with Atheros usb wireless interface

Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs
 1.55  17-Nov-2017  skrll PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory

Patch from PR slighly updated by me
 1.54  31-Oct-2017  khorben Also attach the RTL8192EU from TP-LINK
 1.53  03-May-2017  jnemeth branches: 1.53.2;
PR/52212 - Kai-Uwe Eckhardt -- add TP-Link TL-WN722N v2
 1.52  04-Dec-2016  skrll branches: 1.52.6;
Whitespace
 1.51  25-Nov-2016  skrll +#include "opt_usb.h"
 1.50  04-Nov-2016  mlelstv match RTL8188EU device from vendor ABOCOM.
 1.49  12-Oct-2016  nat Add support for Realtek 8192EU.

OK christos@
 1.48  12-Oct-2016  nat IQ Calibration for urtwn devices.

Addresses PR/47781.

OK christos@
 1.47  12-Oct-2016  nat Stop urtwn devices from usb suspend, allow remote wifi activity wakeup.

Addresses PR/51111.

OK christos@
 1.46  04-Oct-2016  christos PR/51529: Jake Slazenger: D-Link DWA 125 rev. D1 USB wireless network adapter
support
 1.45  10-Jun-2016  ozaki-r branches: 1.45.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.44  26-May-2016  ozaki-r Introduce M_CLEARCTX and use it instead of open-coding rcvif

No functional change.
 1.43  26-May-2016  ozaki-r Use M_GETCTX

No functional change.
 1.42  23-Apr-2016  skrll Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.41  18-Jan-2016  nonaka Use correct register definition.
 1.40  17-Jan-2016  christos PR/50672: Andriy Voskoboinyk: fix write to the wrong register.
 1.39  10-Dec-2015  leot Add support for Realtek RTL8188CU_3.
 1.38  08-Mar-2015  christos kill trailing spaces
 1.37  08-Mar-2015  christos sync with OpenBSD
 1.36  11-Jan-2015  jmcneill Pass the correct length to firmware_free. The code previously did
len = firmware_get_size(..) and then used len as a counter while loading
firmware. The result was that in the success path, len = 0. This commit
introduces a new "fwlen" (const) to store the firmware size, and passes it
to firmware_free instead of "len".
 1.35  07-Jan-2015  ozaki-r Pass a correct firmware size (instead of 0) to firmware_free

firmware_free now uses kmem_free(9) instead of free(9),
so we need to pass a correct size to it.
 1.34  25-Jul-2014  nonaka branches: 1.34.2; 1.34.4; 1.34.8;
Added ELECOM WDC-150SU2M support.
 1.33  20-Jul-2014  nonaka Add ASUSTeK USB-N10 NANO support.
 1.32  20-Jul-2014  nonaka Added support for the Realtek RTL8188EUS and RTL8188ETV chipsets from FreeBSD.
 1.31  02-Jul-2014  christos remember to call deregister.
 1.30  08-May-2014  mrg add (empty, pretty much like all other usb) pmf support.
 1.29  16-Feb-2014  christos branches: 1.29.2;
move default last, add symbolic mask.
 1.28  16-Feb-2014  christos whitespace police
 1.27  16-Feb-2014  nonaka Use INFRA not ADHOC when opmode is M_STA.
 1.26  14-Feb-2014  christos ibss and hostap support from stsp @ openbsd.
 1.25  10-Aug-2013  jnemeth PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 usb wifi adapter
 1.24  07-Apr-2013  nonaka branches: 1.24.4;
Use rx_data, not tx_data at urtwn_free_rx_list().
 1.23  30-Mar-2013  christos replace macro with inline function
 1.22  12-Mar-2013  christos more locking and int -> size_t from Anon Ymous
 1.21  05-Feb-2013  christos don't count an output packet on a stall.
 1.20  05-Feb-2013  christos cache the pipe before the container is put in the free list (and can change)
 1.19  28-Jan-2013  christos ke monitor mode work:
1) Call urtwn_rxfilter_init() after urtwn_mac_init() as the later sets
R92C_RCR[0:15] and the former sets R92C_RCR[0-31].
2) The FCS is not included in the packets returned by the hardware as
R92C_RCR[31] is not set. Set the bpf wr_flags appropriately.
3) Stop if we get a packet of zero length from the hardware. (This
was mistakenly removed earlier.)
4) When switching to IEEE80211_S_RUN in IEEE80211_M_MONITOR mode, set
the rxfilter to pass all frames and the nettype to NOLINK.
5) A few comments.
 1.18  22-Jan-2013  jmcneill - Add a USBD_MPSAFE flag to usbd_open_pipe. If not set, acquire KERNEL_LOCK
before invoking xfer callbacks on this pipe.
- Add an extra flags parameter to usb_init_task. If USBD_TASKQ_MPSAFE is not
present, acquire KERNEL_LOCK before invoking the task callback.
 1.17  22-Jan-2013  jmcneill simplify the locking in urtwn_start
 1.16  21-Jan-2013  jmcneill some more urtwn fixes:
- support manual roaming (used by wpa_supplicant)
- simplify ioctl handler
- add our own reset callback
- acquire KERNEL_LOCK before using net80211 or the network stack
- clear IFF_OACTIVE even in the event of an endpoint stall
 1.15  21-Jan-2013  christos remove trailing lines
 1.14  21-Jan-2013  jmcneill ic->ic_bss->ni_chan -> ic->ic_curchan
 1.13  20-Jan-2013  jmcneill use ic_curchan not ic_ibss_chan
 1.12  20-Jan-2013  christos more (and less) locking fixes
 1.11  18-Jan-2013  jmcneill if doing #ifdef INET, you need opt_inet.h!
 1.10  18-Jan-2013  jmcneill make this work with lockdebug. while here, set urtwn_debug=0 now that
USB_DEBUG implies URTWN_DEBUG
 1.9  05-Jan-2013  christos fix debug variables.
- include opt_usb.h in usb.h so that USB_DEBUG gets set properly in it.
- normalize and sort debugging variables
 1.8  05-Jan-2013  christos add include "opt_usb.h" where needed.
 1.7  05-Jan-2013  christos - need opt_usb.h if depending on USB_DEBUG
- remove trailing whitespace
- add missing KERNEL_RCSID
 1.6  27-Dec-2012  skrll Consistent/Correct error message from failing usbd_set_config.

Use aprint_error_dev.
 1.5  14-Jun-2012  riz branches: 1.5.2; 1.5.4;
Add firmware for the RealTek RTL8192CU family of wireless chipsets, and
adapt the urtwn(4) driver to use the new files. The firmware files were
extracted from the Linux driver at www.realtek.com, version 0005.1230.2011
and the license permits redistribution without modification.

While I'm here, install the files in /libdata/firmware/if_urtwn, like
most of the other network adapter firmware.

urtwn(4) can now operate without needing external files installed. Tested
on my Edimax adapter.
 1.4  01-Jun-2012  nonaka Add a dependency on bpf module.
 1.3  30-May-2012  nonaka Add some device IDs from OpenBSD.
 1.2  30-May-2012  skrll Release the mutex on error in urtwn_alloc_tx_list.

From jmcneill.
 1.1  25-Mar-2012  nonaka branches: 1.1.2; 1.1.4;
Added urtwn(4), a driver for Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network devices.
 1.1.4.5  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.4  23-Jan-2013  yamt sync with head
 1.1.4.3  30-Oct-2012  yamt sync with head
 1.1.4.2  17-Apr-2012  yamt sync with head
 1.1.4.1  25-Mar-2012  yamt file if_urtwn.c was added on branch yamt-pagecache on 2012-04-17 00:08:06 +0000
 1.1.2.3  02-Jun-2012  mrg sync to latest -current.
 1.1.2.2  05-Apr-2012  mrg sync to latest -current.
 1.1.2.1  25-Mar-2012  mrg file if_urtwn.c was added on branch jmcneill-usbmp on 2012-04-05 21:33:33 +0000
 1.5.4.4  03-Dec-2017  jdolecek update from HEAD
 1.5.4.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.4.2  23-Jun-2013  tls resync from head
 1.5.4.1  25-Feb-2013  tls resync with head
 1.5.2.3  13-Aug-2012  riz Pull up following revision(s) (requested by abs in ticket #497):
external/realtek/urtwn/Makefile: revision 1.1
external/realtek/Makefile.inc: revision 1.1
external/realtek/urtwn/dist/rtl8192cfw.bin: revision 1.1
distrib/sets/lists/base/mi: revision 1.997
external/README: revision 1.15
etc/mtree/NetBSD.dist.base: revision 1.101
external/realtek/urtwn/dist/Realtek-Firmware-License.txt: revision 1.1
share/man/man4/urtwn.4: revision 1.4
external/realtek/Makefile: revision 1.1
external/realtek/urtwn/dist/rtl8192cfwU.bin: revision 1.1
sys/dev/usb/if_urtwn.c: revision 1.5
external/Makefile: revision 1.18
Add firmware for the RealTek RTL8192CU family of wireless chipsets, and
adapt the urtwn(4) driver to use the new files. The firmware files were
extracted from the Linux driver at www.realtek.com, version 0005.1230.2011
and the license permits redistribution without modification.
While I'm here, install the files in /libdata/firmware/if_urtwn, like
most of the other network adapter firmware.
urtwn(4) can now operate without needing external files installed. Tested
on my Edimax adapter.
 1.5.2.2  14-Jun-2012  sborrill Pull up the following revisions(s) (requested by riz in ticket #326):
distrib/sets/lists/base/mi: 1.989
distrib/sets/lists/man/mi: 1.1385
etc/mtree/NetBSD.dist.base: 1.99
share/man/man4/Makefile: 1.583
share/man/man4/urtwn.4: 1.1
share/man/man4/usb.4: 1.97
sys/arch/amd64/conf/GENERIC: 1.351
sys/arch/i386/conf/GENERIC: 1.1068
sys/dev/usb/files.usb: 1.121
sys/dev/usb/if_urtwn.c: 1.1-1.4
sys/dev/usb/if_urtwn_data.h: 1.1
sys/dev/usb/if_urtwnreg.h: 1.1
sys/dev/usb/if_urtwnvar.h: 1.1
sys/dev/usb/usbdevices.config: 1.13
sys/dev/usb/usbdevs: 1.621 via patch
sys/dev/usb/usbdevs.h: regen
sys/dev/usb/usbdevs_data.h: regen
sys/modules/if_urtwn/Makefile: 1.1
sys/modules/if_urtwn/if_urtwn.ioconf: 1.1

Add support for urtwn(4) wireless. Ported from OpenBSD
 1.5.2.1  14-Jun-2012  sborrill file if_urtwn.c was added on branch netbsd-6 on 2012-06-14 09:48:47 +0000
 1.24.4.2  18-May-2014  rmind sync with head
 1.24.4.1  28-Aug-2013  rmind sync with head
 1.29.2.1  10-Aug-2014  tls Rebase.
 1.34.8.2  26-Jan-2017  skrll Sync with HEAD/nhusb
 1.34.8.1  06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.34.4.17  28-Aug-2017  skrll Sync with HEAD
 1.34.4.16  28-Jan-2017  skrll Remove tsleep(9) and wakeup(9) from urtwn(4)
 1.34.4.15  05-Dec-2016  skrll Sync with HEAD
 1.34.4.14  09-Jul-2016  skrll Sync with HEAD
 1.34.4.13  29-May-2016  skrll Sync with HEAD
 1.34.4.12  19-Mar-2016  skrll Sync with HEAD
 1.34.4.11  28-Dec-2015  skrll Strictly follow the sequence abort pipe, destroy xfers, and close pipe as
API now requires. Plug some memory leaks in some drivers while doing
this.

Also, remove up_refcnt as it was broken and helped leak more memory.
 1.34.4.10  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.34.4.9  06-Oct-2015  skrll Move from usbd_{alloc,free}_xfer and usbd_{alloc,free}_buffer to
usbd_{create,destroy}_xfer. The API change will allow future changes
to HCDs to simplify the transfer resource allocation and activation.

Several devices tested including ucom, umass, smsc, uvideo, and uaudio.
 1.34.4.8  06-Apr-2015  skrll Sync with HEAD
 1.34.4.7  21-Mar-2015  skrll Add prefixes to attach_arg structure member names. No functional change.
 1.34.4.6  19-Mar-2015  skrll Do the same as OpenBSD and get rid of the *_handle typedefs and use
plain structures insteads
 1.34.4.5  23-Dec-2014  skrll KNF. No brackets around return value.
 1.34.4.4  05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.34.4.3  03-Dec-2014  skrll Remove #include <sys/malloc.h> where it's not (no longer) needed
 1.34.4.2  03-Dec-2014  skrll Trailing whitespace.
 1.34.4.1  02-Dec-2014  skrll Step #1 of memory allocation re-organisation.

Centralised the buffer allocation routine which now supports DMA
and non-DMA capable host controllers. Remove the
ubm_{alloc,free}m methods from usbd_bus_methods.

The buffer allocation is only allowed in thread context and,
therefore, negates the usefulness of the reserve dma code which
is removed in this change.

USBD_NO_COPY is also no longer required as usbd_transfer and
usbd_transfer_complete now track buffer usage and handle any
copying.
 1.34.2.5  08-Aug-2018  martin Pull up following revision(s) (requested by riastradh in ticket #1626):

sys/dev/usb/if_cue.c: revision 1.80
sys/dev/usb/umcs.c: revision 1.11
sys/dev/usb/umcs.c: revision 1.12
sys/dev/usb/if_ural.c: revision 1.56
sys/dev/usb/if_run.c: revision 1.28
sys/dev/usb/if_ural.c: revision 1.57
sys/dev/usb/if_run.c: revision 1.29
sys/dev/usb/uatp.c: revision 1.16
sys/dev/usb/uatp.c: revision 1.17
sys/dev/usb/if_axe.c: revision 1.91
sys/dev/usb/if_axe.c: revision 1.92
sys/dev/usb/if_zyd.c: revision 1.49
sys/dev/usb/if_axen.c: revision 1.15
sys/dev/usb/if_url.c: revision 1.60
sys/dev/usb/if_udav.c: revision 1.54
sys/dev/usb/if_axen.c: revision 1.16
sys/dev/usb/if_udav.c: revision 1.55
sys/dev/usb/if_athn_usb.c: revision 1.28
sys/dev/usb/if_athn_usb.c: revision 1.29
sys/dev/usb/if_urtw.c: revision 1.16
sys/dev/usb/if_urtw.c: revision 1.17
sys/dev/usb/if_cue.c: revision 1.79
sys/dev/usb/if_rum.c: revision 1.62
sys/dev/usb/if_urtwn.c: revision 1.61
sys/dev/usb/if_rum.c: revision 1.63
sys/dev/usb/if_urtwn.c: revision 1.63
sys/dev/usb/usb.c: revision 1.170
sys/dev/usb/usb.c: revision 1.171
sys/dev/usb/if_smsc.c: revision 1.35
sys/dev/usb/if_smsc.c: revision 1.36
sys/dev/usb/if_zyd.c: revision 1.50
sys/dev/usb/if_aue.c: revision 1.144
sys/dev/usb/if_aue.c: revision 1.145
sys/dev/usb/usb_subr.c: revision 1.225
sys/dev/usb/usb_subr.c: revision 1.226
sys/dev/usb/if_upgt.c: revision 1.21
sys/dev/usb/usbdi.h: revision 1.93
sys/dev/usb/if_upgt.c: revision 1.22
sys/dev/usb/if_url.c: revision 1.59
sys/dev/usb/usbdi.h: revision 1.95
sys/dev/usb/if_otus.c: revision 1.34
sys/dev/usb/if_atu.c: revision 1.62
sys/dev/usb/if_otus.c: revision 1.35
sys/dev/usb/if_atu.c: revision 1.63

New function usb_rem_task_wait(dev, task, queue).

If task is scheduled to run, removes it from the queue. If it may
have already begun to run, waits for it to complete. Caller must
guarantee it will not switch to another queue. If caller guarantees
it will not be scheduled again, then usb_rem_task_wait guarantees it
is not running on return.

This will enable us to fix a litany of bugs in detach where we
currently fail to wait for a pending task.

Use usb_rem_task_wait in various drivers.
 1.34.2.4  06-Jun-2018  martin Pull up following revision(s) (requested by maya in ticket #1613):

sys/dev/usb/if_urtwn.c: revision 1.53
sys/dev/usb/usbdevs: revision 1.733

PR/52212 - Kai-Uwe Eckhardt -- add TP-Link TL-WN722N v2
 1.34.2.3  19-Feb-2018  snj Pull up following revision(s) (requested by skrll in ticket #1556):
sys/dev/usb/if_athn_usb.c: 1.25
sys/dev/usb/if_atu.c: 1.56
sys/dev/usb/if_aue.c: 1.142
sys/dev/usb/if_axe.c: 1.84
sys/dev/usb/if_axen.c: 1.12
sys/dev/usb/if_cdce.c: 1.45
sys/dev/usb/if_cue.c: 1.77
sys/dev/usb/if_kue.c: 1.91
sys/dev/usb/if_otus.c: 1.32
sys/dev/usb/if_rum.c: 1.59
sys/dev/usb/if_run.c: 1.25
sys/dev/usb/if_smsc.c: 1.33
sys/dev/usb/if_udav.c: 1.52
sys/dev/usb/if_upgt.c: 1.18
sys/dev/usb/if_upl.c: 1.61
sys/dev/usb/if_ural.c: 1.53
sys/dev/usb/if_url.c: 1.57
sys/dev/usb/if_urndis.c: 1.17
sys/dev/usb/if_urtw.c: 1.14
sys/dev/usb/if_urtwn.c: 1.56
sys/dev/usb/if_zyd.c: 1.45
sys/dev/usb/irmce.c: 1.4
sys/dev/usb/pseye.c: 1.24
sys/dev/usb/ubt.c: 1.60
sys/dev/usb/ucom.c: 1.120
sys/dev/usb/udsir.c: 1.6
sys/dev/usb/ugen.c: 1.137
sys/dev/usb/uhso.c: 1.27
sys/dev/usb/uirda.c: 1.43
sys/dev/usb/ulpt.c: 1.99
sys/dev/usb/umass.c: 1.163
sys/dev/usb/umidi.c: 1.74
sys/dev/usb/uscanner.c: 1.82
sys/dev/usb/usscanner.c: 1.43
sys/dev/usb/ustir.c: 1.39
sys/dev/usb/utoppy.c: 1.30
sys/dev/usb/uvideo.c: 1.46
PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs
 1.34.2.2  03-Jan-2018  snj Pull up following revision(s) (requested by skrll in ticket #1528):
sys/dev/usb/if_urtwn.c: revision 1.55
PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory
Patch from PR slighly updated by me
 1.34.2.1  05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.45.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.45.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.52.6.1  11-May-2017  pgoyette Sync with HEAD
 1.53.2.7  10-Mar-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1942):

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965
 1.53.2.6  14-Dec-2019  martin Pull up following revision(s) (requested by mlelstv in ticket #1472):

sys/dev/usb/if_urtwn.c: revision 1.76

Reset MCU ready status before resetting the MCU.
Fixes PR kern/54728
 1.53.2.5  18-Dec-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #1140):
share/man/man4/urtwn.4: revision 1.16
sys/dev/usb/if_urtwn.c: revision 1.66

Add IO-DATA WN-G150UMW.

-

Make IODATA WN-G150UMW work:

- Increase delay to prevent "could not send firmware command". The value
is taken from FreeBSD.
-Increase delay to prevent "timeout waiting for firmware readiness". The
value is taken from Linux.
 1.53.2.4  08-Aug-2018  martin Pull up following revision(s) (requested by riastradh in ticket #963):

sys/dev/usb/if_cue.c: revision 1.80
sys/dev/usb/umcs.c: revision 1.11
sys/dev/usb/umcs.c: revision 1.12
sys/dev/usb/if_ural.c: revision 1.56
sys/dev/usb/if_run.c: revision 1.28
sys/dev/usb/if_ural.c: revision 1.57
sys/dev/usb/if_run.c: revision 1.29
sys/dev/usb/uatp.c: revision 1.16
sys/dev/usb/uatp.c: revision 1.17
sys/dev/usb/if_axe.c: revision 1.91
sys/dev/usb/if_axe.c: revision 1.92
sys/dev/usb/if_zyd.c: revision 1.49
sys/dev/usb/if_axen.c: revision 1.15
sys/dev/usb/if_url.c: revision 1.60
sys/dev/usb/if_udav.c: revision 1.54
sys/dev/usb/if_axen.c: revision 1.16
sys/dev/usb/if_udav.c: revision 1.55
sys/dev/usb/if_athn_usb.c: revision 1.28
sys/dev/usb/if_athn_usb.c: revision 1.29
sys/dev/usb/if_urtw.c: revision 1.16
sys/dev/usb/if_urtw.c: revision 1.17
sys/dev/usb/if_cue.c: revision 1.79
sys/dev/usb/if_rum.c: revision 1.62
sys/dev/usb/if_urtwn.c: revision 1.61
sys/dev/usb/if_rum.c: revision 1.63
sys/dev/usb/if_urtwn.c: revision 1.63
sys/dev/usb/usb.c: revision 1.170
sys/dev/usb/usb.c: revision 1.171
sys/dev/usb/if_smsc.c: revision 1.35
sys/dev/usb/if_smsc.c: revision 1.36
sys/dev/usb/if_zyd.c: revision 1.50
sys/dev/usb/if_aue.c: revision 1.144
sys/dev/usb/if_aue.c: revision 1.145
sys/dev/usb/usb_subr.c: revision 1.225
sys/dev/usb/usb_subr.c: revision 1.226
sys/dev/usb/if_upgt.c: revision 1.21
sys/dev/usb/usbdi.h: revision 1.93
sys/dev/usb/if_upgt.c: revision 1.22
sys/dev/usb/if_url.c: revision 1.59
sys/dev/usb/usbdi.h: revision 1.95
sys/dev/usb/if_otus.c: revision 1.34
sys/dev/usb/if_atu.c: revision 1.62
sys/dev/usb/if_otus.c: revision 1.35
sys/dev/usb/if_atu.c: revision 1.63

New function usb_rem_task_wait(dev, task, queue).

If task is scheduled to run, removes it from the queue. If it may
have already begun to run, waits for it to complete. Caller must
guarantee it will not switch to another queue. If caller guarantees
it will not be scheduled again, then usb_rem_task_wait guarantees it
is not running on return.

This will enable us to fix a litany of bugs in detach where we
currently fail to wait for a pending task.

Use usb_rem_task_wait in various drivers.
 1.53.2.3  07-Jun-2018  martin Pull up following revision(s) (requested by nat in ticket #847):

sys/dev/usb/if_urtwn.c: revision 1.58

Fix support for 8192eu, notably TPLINK TL-WN823NV2, by using the right
registers when setting receiver gain.

Ok christos@.
 1.53.2.2  31-Jan-2018  martin Pull up following revision(s) (requested by skrll in ticket #509):
sys/dev/usb/if_ural.c: revision 1.53
sys/dev/usb/if_run.c: revision 1.25
sys/dev/usb/ustir.c: revision 1.39
sys/dev/usb/irmce.c: revision 1.4
sys/dev/usb/if_urtwn.c: revision 1.56
sys/dev/usb/pseye.c: revision 1.24
sys/dev/usb/if_rum.c: revision 1.59
sys/dev/usb/if_upl.c: revision 1.61
sys/dev/usb/ucom.c: revision 1.120
sys/dev/usb/if_zyd.c: revision 1.45
sys/dev/usb/if_axen.c: revision 1.12
sys/dev/usb/umidi.c: revision 1.74
sys/dev/usb/if_udav.c: revision 1.52
sys/dev/usb/if_athn_usb.c: revision 1.25
sys/dev/usb/usscanner.c: revision 1.43
sys/dev/usb/ualea.c: revision 1.6 - 1.9
sys/dev/usb/if_upgt.c: revision 1.18
sys/dev/usb/if_atu.c: revision 1.56
sys/dev/usb/utoppy.c: revision 1.30
sys/dev/usb/ubt.c: revision 1.60
sys/dev/usb/if_urtw.c: revision 1.14
sys/dev/usb/uirda.c: revision 1.43
sys/dev/usb/umass.c: revision 1.163
sys/dev/usb/if_cdce.c: revision 1.45
sys/dev/usb/if_cue.c: revision 1.77
sys/dev/usb/if_kue.c: revision 1.91
sys/dev/usb/uvideo.c: revision 1.46
sys/dev/usb/uhso.c: revision 1.27
sys/dev/usb/if_smsc.c: revision 1.33
sys/dev/usb/ugen.c: revision 1.137
sys/dev/usb/if_axe.c: revision 1.84
sys/dev/usb/if_aue.c: revision 1.142
sys/dev/usb/uscanner.c: revision 1.82
sys/dev/usb/if_urndis.c: revision 1.17
sys/dev/usb/udsir.c: revision 1.6
sys/dev/usb/if_url.c: revision 1.57
sys/dev/usb/if_otus.c: revision 1.32
sys/dev/usb/ulpt.c: revision 1.99

PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs

ualea: Tidy up a bit. Fulfil requests completely.
Don't subtract uninitialized pktsize in error path.
 1.53.2.1  23-Nov-2017  martin Pull up following revision(s) (requested by skrll in ticket #383):
sys/dev/usb/if_urtwn.c: revision 1.55
PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory
Patch from PR slighly updated by me
 1.57.2.6  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.57.2.5  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.57.2.4  30-Sep-2018  pgoyette Ssync with HEAD
 1.57.2.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.57.2.2  28-Jul-2018  pgoyette Sync with HEAD
 1.57.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.59.2.18  27-Apr-2020  nat Software crypto definitions from FreeBSD.
 1.59.2.17  27-Apr-2020  nat Fix resource leak in rx/tx free lists.
 1.59.2.16  25-Apr-2020  nat Remove configuring 40Mhz channels for now.

Avoid duplicate state transitions in urtwn_newstate.
Avoid changing channel parameters in urtwn_newstate.

Rework of tx desc parameters for all types of packets.

Don't create a percpuq as the stack is not expecting it //XXX not sure

Tested connections to an open 11n network with 8188CUS, 8192CU and 8192EU
usb adaptors.
 1.59.2.15  25-Apr-2020  nat Compete some more of 11n support.
htcaps and streams values from FreeBSD.
 1.59.2.14  21-Apr-2020  martin Sync with HEAD
 1.59.2.13  19-Apr-2020  nat Initial 11n support for urtwn.

Compile tested only... More to come.
 1.59.2.12  17-Apr-2020  martin Make it compilable with URTWN_DEBUG
 1.59.2.11  16-Apr-2020  nat Update with 92EU changes from -current.
 1.59.2.10  16-Apr-2020  nat Use if_stat functions.
 1.59.2.9  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59.2.8  26-Jun-2019  phil Remove extra if_register() call.
Move temporary call to vap_create() to end of attach to make sure
attach works when vap_create() will not be called as part of attach.
 1.59.2.7  10-Jun-2019  christos Sync with HEAD
 1.59.2.6  15-Aug-2018  phil Final changes for 200 hour contract. Still a lot of work to do.
With these changes, Station mode works with an open AP.
 1.59.2.5  03-Aug-2018  phil State Save:
Scanning works, can see the broadcasts and stations.
Association appears to work. (open networks only, no encryption yet.)
IP traffic doesn't flow yet, not sure where the error is.
Added back more NetBSD ioctls not in the FreeBSD code. Still have
more to go.
Updated my TESTWIFI kernel config.
 1.59.2.4  28-Jul-2018  phil End of the week state save:
Got workqueues doing FreeBSD tasks. (still questions on how correct it is.)
Incremental changes in many places.
Still *lots* of debugging code that needs to go away some day.
"ifconfig urtwn0 up" now does not crash, still needs scan to work properly.
 1.59.2.3  20-Jul-2018  phil State save:
urtwn: ifp->if_softc points to a vap, not the urtwn softc, fix code for this.
add missing routines, need to get them filled out correctly.
80211: Add back some NetBSD ioctls, start working on the sysctl tree.
 1.59.2.2  16-Jul-2018  phil State save.
urtwn now can attach and shows up in the "ifconfig -a" list.
 1.59.2.1  12-Jul-2018  phil State save. New kernel config for this brach only. TESTWIFI does
produce a kernel. It is not working. athn files not compiling yet
and commented out of the TESTWIFI kernel, which only has urtwn 802.11
driver enabled. ieee80211_alq.c and ieee80211_ddb.c not compiling yet.
 1.71.2.9  30-Jul-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1965):

sys/dev/usb/if_urtwn.c: revision 1.112
sys/dev/usb/usbdevs.h (regen)
sys/dev/usb/usbdevs_data.h (regen)

Add Asus USB-N10 Nano B1.
While there, remove duplicate Asus RTL8192CU_3 from match list.
 1.71.2.8  20-Jun-2024  martin Pull up following revision(s) (requested by nia in ticket #1846):

sys/dev/usb/if_urtwn.c: revision 1.108
sys/dev/usb/usbdevs: revision 1.812

Add Mercusys and Mercusys MW150USV2
From Daeil Lee in PR/57819

Add Mercusys NW150US V2 USB support

No changes needed, other than recognizing it as working.
From Daeil Lee in PR/57819
 1.71.2.7  10-Mar-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1810):

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965
 1.71.2.6  23-Oct-2021  martin Pull up following revision(s) (requested by jnemeth in ticket #1364):

sys/dev/usb/if_urtwn.c: revision 1.101

add Edimax N150 adapter; tested on my PBP
 1.71.2.5  22-Mar-2021  martin Pull up following revision(s) (requested by nat in ticket #1234),
all via patch:

sys/dev/usb/if_urtwn.c: revision 1.93
sys/dev/usb/if_urtwn.c: revision 1.95
sys/dev/usb/if_urtwn.c: revision 1.96

if_urtwn.c: Plug a few leaks
Can be a cause of PR/55968

Also free assocated mbufs.

Opps....Remove irrelavent debug code and don't free_m before IFQ_DEQUEUE().
Identified and reported by Patrick Welche and remedy found by Martin Husemann.
 1.71.2.4  04-Feb-2021  martin Pull up following revision(s) (requested by nia in ticket #1197):

sys/dev/usb/if_urtwn.c: revision 1.89,1.90
sys/dev/usb/usbdevs: revision 1.788,1.789

urtwn(4): add TPLINK WN821N to the list of USB device ids
reported by kfmut on the unitedbsd forums.

add another TPLINK RTL8192EU variant
to avoid confusion use TP-Link's names for these variants, matching
FreeBSD
 1.71.2.3  24-Apr-2020  martin Pull up following revision(s) (requested by maya in ticket #848):

sys/dev/usb/usbdevs: revision 1.778
sys/dev/usb/if_urtwn.c: revision 1.85

Add D-Link DWA-121 rev B1 to list of supported devices
From Miguel Landaeta in kern/55140
 1.71.2.2  14-Dec-2019  martin Pull up following revision(s) (requested by mlelstv in ticket #551):

sys/dev/usb/if_urtwn.c: revision 1.76
sys/dev/usb/if_urtwn.c: revision 1.77

Reset MCU ready status before resetting the MCU.

Fixes PR kern/54728

Don't deregister twice with pmf.
 1.71.2.1  01-Sep-2019  martin Pull up following revision(s) (requested by mrg in ticket #135):

distrib/sets/lists/comp/mi 1.2279
distrib/sets/lists/modules/mi 1.123
share/man/man9/Makefile 1.438
share/man/man9/usbnet.9 1.1-1.9
sys/dev/ic/rndisreg.h 1.3
sys/dev/usb/TODO 1.47-1.52
sys/dev/usb/TODO.usbmp 1.15,1.16
sys/dev/usb/files.usb 1.157-1.167
sys/dev/usb/if_aue.c 1.155-1.161
sys/dev/usb/if_auereg.h 1.30-1.32
sys/dev/usb/if_axe.c 1.103-1.119
sys/dev/usb/if_axen.c 1.51-1.53,1.55-1.67
sys/dev/usb/if_axenreg.h 1.15
sys/dev/usb/if_cdce.c 1.54-1.67
sys/dev/usb/if_cue.c 1.85,1.86
sys/dev/usb/if_cuereg.h 1.23
sys/dev/usb/if_kue.c 1.97-1.100
sys/dev/usb/if_kuereg.h 1.23,1.24
sys/dev/usb/if_mue.c 1.51-1.55
sys/dev/usb/if_muereg.h 1.6
sys/dev/usb/if_muevar.h 1.9
sys/dev/usb/if_smsc.c 1.46-1.61
sys/dev/usb/if_smscreg.h 1.6
sys/dev/usb/if_smscvar.h delete
sys/dev/usb/if_udav.c 1.60-1.71
sys/dev/usb/if_udavreg.h 1.14,1.15
sys/dev/usb/if_upl.c 1.65,1.66
sys/dev/usb/if_ure.c 1.15-1.31
sys/dev/usb/if_urevar.h 1.4,1.5
sys/dev/usb/if_url.c 1.67-1.70
sys/dev/usb/if_urlreg.h 1.14
sys/dev/usb/if_urndis.c 1.22-1.33
sys/dev/usb/if_urtwn.c 1.72
sys/dev/usb/ohci.c 1.290
sys/dev/usb/uhub.c 1.143
sys/dev/usb/usb.c 1.180
sys/dev/usb/usb.h 1.118
sys/dev/usb/usb_mem.c 1.71
sys/dev/usb/usb_subr.c 1.238,1.239
sys/dev/usb/usbdevs 1.772
sys/dev/usb/usbdi.c 1.183,1.186
sys/dev/usb/usbdi.h 1.97
sys/dev/usb/usbdi_util.c 1.75
sys/dev/usb/usbhist.h 1.5,1.6
sys/dev/usb/usbnet.c 1.1-1.24
sys/dev/usb/usbnet.h 1.1-1.14
sys/dev/usb/usbroothub.c 1.9
sys/dev/usb/xhci.c 1.109,1.110
sys/modules/Makefile 1.223
sys/modules/usbnet/Makefile 1.1

usbnet(9): Add common framework for USB network devices.
This bring various safety fixes to all updated drivers,
and includes locking clean up, detach safety when being
used or not, separate rx/tx locks to improve performance,
porting to NET_MPSAFE, many edge/error case bugs in
drivers fixed, as well as resovling PRs 54303 and 54308.
These drivers are converted: axe(4), axen(4), aue(4),
cdce(4), cue(4), kue(4), mue(4), smsc(4), udav(4),
upl(4), ure(4), url(4), and urndis(4).
 1.78.2.2  29-Feb-2020  ad Sync with head.
 1.78.2.1  17-Jan-2020  ad Sync with head.
 1.85.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.88.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.105.4.4  23-Sep-2025  martin Pull up following revision(s) (requested by nat in ticket #1158):
sys/dev/usb/if_urtwn.c: revision 1.114
sys/dev/usb/if_urtwn.c: revision 1.115
sys/dev/usb/if_urtwn.c: revision 1.116
sys/dev/usb/if_urtwn.c: revision 1.117
sys/dev/usb/if_urtwn.c: revision 1.113

Set the pipe index on usb xfer creation.

Plug an xfer leak in the tx error path.

Use the right packet spacing for the 8192EU.
From OpenBSD and confrimed by my own analysis.

Safety first!
Ensure that the receive packet processing does not exceed beyond xfer length.

Fix typo.
Found by Harold Gutch (hgutch@).
 1.105.4.3  30-Jul-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1142):

sys/dev/usb/if_urtwn.c: revision 1.112
sys/dev/usb/usbdevs.h (regen)
sys/dev/usb/usbdevs_data.h (regen)

Add Asus USB-N10 Nano B1.
While there, remove duplicate Asus RTL8192CU_3 from match list.
 1.105.4.2  20-Jun-2024  martin Pull up following revision(s) (requested by nia in ticket #702):

sys/dev/usb/if_urtwn.c: revision 1.108
sys/dev/usb/usbdevs: revision 1.812

Add Mercusys and Mercusys MW150USV2
From Daeil Lee in PR/57819

Add Mercusys NW150US V2 USB support

No changes needed, other than recognizing it as working.
From Daeil Lee in PR/57819
 1.105.4.1  10-Mar-2024  martin Pull up following revision(s) (requested by riastradh in ticket #616):

sys/dev/usb/if_urtwn.c: revision 1.109

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965
 1.109.2.1  02-Aug-2025  perseant Sync with HEAD
 1.112.2.1  12-Sep-2025  snj Pull up following revision(s) (requested by nat in ticket #29):

sys/dev/usb/if_urtwn.c: revisions 1.113-1.117

Set the pipe index on usb xfer creation.
--
Plug an xfer leak in the tx error path.
--
Use the right packet spacing for the 8192EU.
From OpenBSD and confrimed by my own analysis.
--
Safety first!
Ensure that the receive packet processing does not exceed beyond xfer length.
--
Fix typo.
Found by Harold Gutch (hgutch@).

RSS XML Feed