Home | History | Annotate | Download | only in usb
History log of /src/sys/dev/usb/if_aue.c
RevisionDateAuthorComments
 1.191  20-Aug-2022  riastradh usbnet(9): New usbnet_ispromisc(un).

Replaces ifp->if_flags & IFF_PROMISC in multicast filter updates.
 1.190  03-Mar-2022  riastradh usbnet: Omit needless detachcv name parameter to usbnet_attach.
 1.189  03-Mar-2022  riastradh usbnet: Factor usbnet_init_rx_tx out into usbnet_if_init.

Make it private; no need for drivers to call it any more.
 1.188  03-Mar-2022  riastradh usbnet drivers: Prune dead IFF_RUNNING branches in *_uno_init.

usbnet(9) guarantees !IFF_RUNNING now before calling it.
 1.187  03-Mar-2022  riastradh usbnet drivers: Omit needless isdying tests in *_uno_init.

usbnet(9) already checks this immediately before calling *_uno_init.
 1.186  03-Mar-2022  riastradh usbnet drivers: Omit needless usbnet core lock and assertions.

During attach, the caller has exclusive access to the usbnet until
usbnet_attach_ifp. At other times, register access is serialized
either by the usbnet multicast lock or by IFNET_LOCK.
 1.185  03-Mar-2022  riastradh usbnet drivers: Avoid undefined behaviour if read reg fails.

Some callers don't check the error code, e.g. ~all the mii phy
drivers using PHY_READ. Just return zero if the device is gone or
the xfer fails for any other reason.
 1.184  03-Mar-2022  riastradh aue(4): Simplify. No functional change.
 1.183  03-Mar-2022  riastradh aue(4): Enable rx/tx registers on init before usbnet_init_rx_tx.

This way, we still have exclusive access to the registers before
calls to aue_uno_mcast can start happening without the usbnet core
lock.
 1.182  03-Mar-2022  riastradh usbnet drivers: Omit redundant multicast filter update on init.
 1.181  03-Mar-2022  riastradh usbnet: Apply hardware multicast filter updates synchronously again.

To make this work:

1. Do it only under a new lock, unp_mcastlock. This lock lives at
IPL_SOFTCLOCK so it can be taken from network stack callouts. It
is forbidden to acquire the usbnet core lock under unp_mcastlock.

2. Do it only after usbnet_init_rx_tx and before usbnet_stop; if
issued at any other time, drop the update on the floor.

3. Make usbnet_init_rx_tx apply any pending multicast filter updates
under the lock before setting the flag that allows SIOCADDMULTI or
SIOCDELMULTI to apply the updates.

4. Remove core lock asserts from various drivers' register access
routines. This is necessary because the multicast filter updates
are done with register reads/writes, but _cannot_ take the core
lock when the caller holds softnet_lock.

This now programs the hardware multicast filter redundantly in many
drivers which already explicitly call *_uno_mcast from the *_uno_init
routines. This is probably harmless, but it will likely be better to
remove the explicit calls.
 1.180  03-Mar-2022  riastradh usbnet drivers: Stop abusing ifp->if_flags & IFF_ALLMULTI.

This legacy flag is a figment of userland's imagination. The actual
kernel state is ec->ec_flags & ETHER_F_ALLMULTI, protected by the
ETHER_LOCK, so that multicast filter updates -- which run without
IFNET_LOCK -- need not attempt to write racily to ifp->if_flags.
 1.179  03-Mar-2022  riastradh usbnet drivers: Omit needless uno_mcast locked subroutines.

uno_mcast is now called with the core lock already held so there is
no need for a separate locked subroutine.
 1.178  03-Mar-2022  riastradh aue(4): Reduce aue_uno_mcast from aue_uno_init to aue_setiff_locked.

This operation only needs to update the hardware to reflect
SIOCADDMULTI/SIOCDELMULTI. Not clear that everything in aue(4) needs
to be reset -- in fact I'm pretty sure that's undesirable!

WARNING: I have not tested this with a real aue(4) device.
 1.177  03-Mar-2022  riastradh usbnet: Take the core lock around uno_mcast.

Every driver does this already. This will enable us to change the
lock that serializes access to the registers so we can go back to
doing this synchronously in SIOCADDMULTI/SIOCDELMULTI.
 1.176  03-Mar-2022  riastradh usbnet drivers: Omit needless uno_init locked subroutines.

uno_init is now called with the core lock already held so there is no
need for a separate locked subroutine.
 1.175  03-Mar-2022  riastradh usbnet drivers: No need for usbnet_busy in uno_init.

This callback always runs with the IFNET_LOCK held, and the interface
cannot be detached until the IFNET_LOCK is released, so there is no
need to hang onto a reference count here. (None of the usbnet
drivers touch the IFNET_LOCK except to verify it is held sometimes.)
 1.174  03-Mar-2022  riastradh usbnet: Split multicast filter reprogramming into separate operation.
 1.173  03-Mar-2022  riastradh usbnet drivers: Stop timeout loops early if device is detaching.
 1.172  03-Mar-2022  riastradh usbnet: Enter uno_init with the core lock held.

This reduces code in all drivers except urndis(4) and aue(4).

However, it's still safe for urndis to drop the core lock because the
ifnet is locked, and the ifnet lock covers the DOWN->UP (uno_init)
and UP->DOWN (uno_stop) transitions.
 1.171  18-Mar-2020  kre This was still not correct,. USB_DEBUG is what mattered, not AUE_DEBUG,
the two are orthogonal.

Just do it the way that should work, rather than trying to work out
what magic will allow a new variable to be defined so that it appears
exactly when it is needed and not otherwise. The var isn't required,
just do without it.
 1.170  18-Mar-2020  martin Make this compilable w/o AUE_DEBUG
 1.169  18-Mar-2020  christos define un (pointed out by kre@)
 1.168  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.167  14-Mar-2020  christos fix more broken kernhist formats (now I got them all).
 1.166  14-Mar-2020  christos revert the 0x% -> %# change for fixed width formats pointed out by uwe.
 1.165  14-Mar-2020  christos more changes from sc.dying in PR/55068
 1.164  13-Mar-2020  christos PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log
 1.163  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.162  07-Jan-2020  maxv branches: 1.162.2;
Localify, constify.
 1.161  23-Aug-2019  mrg convert aue(4) to usbnet(9).

besides the not-enabled umb(4), this completes the conversion
of all the non-wifi usb network devices.
 1.160  22-Aug-2019  mrg - move software parts into if_aue.c.
- s/Static/static/.
 1.159  22-Aug-2019  mrg fix more kernhist vs 32 bit issues.
 1.158  22-Aug-2019  mrg like most things: turn debug off by default, sysctl to enable
 1.157  22-Aug-2019  mrg usbhist(9):
- add a USBHIST_CALLARGSN() that only prints the message if debug level is N

aue(4):
- switch from printf() to usbhist for debugging
 1.156  07-Aug-2019  msaitoh Fix panic when setting multicast addresses. Write the hash table outside of
ETHER_LOC()/ETHER_UNLOCK().
 1.155  01-Aug-2019  mrg remove unused code and use common ethernet media code where equivalent.
 1.154  28-May-2019  msaitoh branches: 1.154.2;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.153  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.152  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.151  05-May-2019  mrg remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h
 1.150  22-Apr-2019  msaitoh These drivers do ether_ioctl() on SIOC{ADD,DEL}MULTI, SIOC{G,S}IFMEDIA and
default case in the switch statement. Only the default case didn't check the
return value with ENETRESET. Integrate them to one ether_ioctl() with
ENETRESET test. This change might improve some other ioctl()s which return
ENETRESET by calling if_init().
 1.149  11-Apr-2019  msaitoh Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.148  12-Mar-2019  msaitoh Use pmf(9).
 1.147  22-Jan-2019  skrll Update a comment
 1.146  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.145  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.144  29-Jul-2018  riastradh Use callout_halt and usb_rem_task_wait on detach in aue(4).
 1.143  26-Jun-2018  msaitoh branches: 1.143.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.142  21-Jan-2018  skrll branches: 1.142.2;
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.141  12-Jan-2017  maya branches: 1.141.8;
Appease coverity which is having nightmares about strings not being
null-terminated by using strlcpy rather than strncpy when it doesn't
matter.

ok christos.
 1.140  15-Dec-2016  ozaki-r Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.139  04-Dec-2016  skrll Whitespace
 1.138  25-Nov-2016  skrll +#include "opt_usb.h"
 1.137  07-Jul-2016  msaitoh branches: 1.137.2;
KNF. Remove extra spaces. No functional change.
 1.136  10-Jun-2016  ozaki-r 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.135  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.134  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.133  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.132  10-Aug-2014  tls branches: 1.132.2; 1.132.4; 1.132.8;
Merge tls-earlyentropy branch into HEAD.
 1.131  27-Apr-2013  tsutsui branches: 1.131.8;
Change one aprint_error_dev(9) to aprint_debug_dev(9) to avoid console spam.
My aue (BUFFALO LUA2-TX) generates a bunch of
"aue0: 1 usb errors on intr: IOERROR" errors during TRX,
but works without visible problems.
XXX this is not autoconf(9) message
 1.130  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.129  05-Jan-2013  christos - need opt_usb.h if depending on USB_DEBUG
- remove trailing whitespace
- add missing KERNEL_RCSID
 1.128  27-Dec-2012  skrll Consistent/Correct error message from failing usbd_set_config.

Use aprint_error_dev.
 1.127  22-Jul-2012  matt branches: 1.127.2;
Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.126  11-Mar-2012  mrg minor cleanups from usbmp:
- move usbd_delay_ms() into usbdivar.h in the usb_subr.c section
- minor rcsid fixes
- copyright maintenence
 1.125  06-Mar-2012  mrg pull down from usbmp branch:

- rename usb_detach_{wake,waitup}() to usb_detach_{wake,waitup}old()
- use some c99 struct .initialisers
 1.124  02-Feb-2012  tls branches: 1.124.2;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.123  23-Dec-2011  jakllsch Revert previous due to active usbmp branch(es).
 1.122  22-Dec-2011  jakllsch Adjust-away inconsistent and trailing whitespace.
 1.121  03-Nov-2010  dyoung branches: 1.121.8; 1.121.12;
Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),
USB_MATCH(), et cetera. These files produce the same assembly
(according to objdump -d) before and after the change, except for
if_cue.c where two adjacent instructions inexplicably change order.
 1.120  25-Sep-2010  tsutsui Add support for I/O DATA ETX-US2.
Patch from PR kern/43040.
 1.119  05-Apr-2010  joerg Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.118  19-Jan-2010  pooka branches: 1.118.2; 1.118.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.117  08-Dec-2009  jakllsch It's not an error for a Ethernet interface to have a link-layer address.

hi cube
 1.116  06-Dec-2009  dyoung Simplify several device-activation hooks.
 1.115  23-Sep-2009  plunky fix up USB drivers printing of autoconf information

1. expand the USB_ATTACH_SETUP macro (requested by jmcneill)

2. reorder the attach function so that the first thing it does is print
newlines.

3. after this, we can call usbd_devinfo_alloc(), which polls the device
allowing a context switch, and aprint_normal() the device information.

this avoids problems where autoconf messages are getting mixed up.
 1.114  04-Sep-2009  dyoung Change spaces to tabs and remove some unnecessary parentheses. No
functional change intended.
 1.113  04-Sep-2009  dyoung Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1).
 1.112  07-Nov-2008  dyoung *** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.111  24-May-2008  cube branches: 1.111.4; 1.111.6;
Split device_t and softc for all USB device drivers, and related cosmetic
changes.

Matthias Drochner kindly reviewed this patch, and tested ums, ubt, uaudio
and ral. I tested umass myself.
 1.110  07-Feb-2008  dyoung branches: 1.110.6; 1.110.8; 1.110.10; 1.110.12;
Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs. This will ease extending the kernel and sharing of code
between drivers.

First steps: Make the signature of ifioctl_common() match struct
ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
 1.109  19-Jan-2008  dyoung Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for
a non-ENXIO error return from mii_mediachg(). (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines. There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run. I have compiled macppc, sparc64, i386. I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
 1.108  16-Jan-2008  is Move from workqueue to an explicit kthread for setting the multicast
filter, as suggested by cube@. Actual code review by cube@.
This way, a backport of the fix to netbsd-4 is possible.
 1.107  12-Jan-2008  cube workqueue(9) has the non-evident limitation that the caller cannot reuse
the same struct work before workqueue(9) has internally started to work on
the task.

So to make sure that doesn't happen, provide a semaphore not to run the
workqueue multiple times. It might be clearer just skip using workqueue(9)
and use a thread for about everything, but oh well, I leave that to
someone else.

Now is@ can yank his USB-to-Ethernet adapter while the interface is up.
 1.106  05-Dec-2007  ad branches: 1.106.4;
lockmgr -> mutex
 1.105  20-Nov-2007  sborrill branches: 1.105.2;
Some manufacturers use the same vendor and product id for different devices.
We need to sanity check the DeviceClass in this case.

Currently known guilty products:
0x050d/0x0121 Belkin Bluetooth and USB2LAN

If this turns out to be more common, we could use a quirk table.
 1.104  01-Sep-2007  dyoung branches: 1.104.4; 1.104.6;
Change a bazillion occurrences of code resembling this,

error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ec) :
ether_delmulti(ifr, &sc->sc_ec);

if (error == ENETRESET) {

to this,

if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number. This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.103  29-Aug-2007  dyoung Constify: LLADDR() -> CLLADDR().
 1.102  12-Jul-2007  rmind branches: 1.102.2; 1.102.6; 1.102.8;
Implementation of per-CPU work-queues support for workqueue(9) interface.
WQ_PERCPU flag for workqueue and additional argument for workqueue_enqueue()
to assign a CPU might be used. Notes:
- For now, the list is used for workqueue_queue, which is non-optimal,
and will be changed with array, where index would be CPU ID.
- The data structures should be changed to be cache-friendly.

Reviewed by: <yamt>, <tech-kern>
 1.101  13-Mar-2007  drochner Introduce different autoconf interface attributes for USB drivers
matching (and handling) a whole device and those which match an
interface only. This will allow to enforce some rules, eg that
the former don't use interface information for matching or that the
latter don't modify global device state.
The previous way left too much freedom do the drivers which led to
inconsistencies and abuse.
For now, I've not changed locators and submatch rules, this will
happen later.
There should not be any change in behaviour, except in the case of
some drivers which did behave inconsistently:
if_atu, if_axe, uep: matched the configured device in the interface
stage, but did configuration again. I've converted them to match
in the device stage.
ustir, utoppy: matched in the interface stage, but only against
vendor/device information, and used any configuration/interface
without checking. Changed to match in device stage, and added
some simple code to configure and use the first interface.
If you have one of those devices, please test!
 1.100  04-Mar-2007  christos branches: 1.100.2; 1.100.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.99  16-Nov-2006  christos branches: 1.99.2; 1.99.4; 1.99.8; 1.99.10;
__unused removal on arguments; approved by core.
 1.98  31-Oct-2006  joerg Split the USB task queue into two parts, one for normal device tasks and
one for tasks of the host controllers. This is needed for drivers like
ural(4) that want to do synchronous USB transfers from the task handler.
Before the split timeouts could not be handled correctly as the task
thread was still blocked. From FreeBSD.
 1.97  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.96  15-Sep-2006  is branches: 1.96.2;
Simply use the device name for the workqueue name.
 1.95  15-Sep-2006  is aue_ioctl() for the murpose of adding/deleting multicast addresses is called
from interupt context. Defer its processing to a workqueue(9).
This fixes PR 34521.
 1.94  07-Sep-2006  dogcow branches: 1.94.2;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.93  13-Mar-2006  christos branches: 1.93.8;
kern/33071: Dave J. Barnes: Recognize ADMtek ADM8515 USB2.0 Ethernet Converter
 1.92  28-Nov-2005  augustss branches: 1.92.4; 1.92.6; 1.92.8; 1.92.10;
Use usbd_clear_endpoint_stall_async() when clearing endpoint stalls in
an interrupt context. From kern/32172 by darkstar@city-net.com.
 1.91  30-May-2005  christos branches: 1.91.2; 1.91.8;
- const poisoning
- eliminate variable shadowing
 1.90  11-May-2005  augustss Don't keep the devinfo string on the stack, instead use malloc/free.
This should cure some rare stack overflows.
 1.89  03-Nov-2004  rjs Add AEI USB to LAN.
 1.88  30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.87  22-Oct-2004  augustss Add a device. From OpenBSD.
 1.86  23-Apr-2004  itojun use bounded string ops (snprintf, strl*)
 1.85  05-Jan-2004  augustss branches: 1.85.4;
Add an HP adapter. From FreeBSD.
 1.84  05-Jan-2004  schmonz Add Compaq "iPaq" HNE-200 USB Ethernet adapter.
 1.83  23-Nov-2003  augustss Add two more adapters. From FreeBSD.
 1.82  05-Mar-2003  shiba branches: 1.82.2;
Used correct aue_flags in ELECOM LD-USB/T and ELECOM LD-USB/TX.

Submitted by: Yasushi Oshima <oshimaya@sc.starcat.ne.jp>
Takeshi Shibagaki <shiba@netbsd.org>
(refer to [bsd-usb:685],[bsd-usb:686])
Approved by: gehenna, kanaoka
 1.81  29-Sep-2002  augustss Add a Netgear adapter. From OpenBSD.
 1.80  25-Jul-2002  matt Add support for Belkin USB to LAN Converter.
 1.79  11-Jul-2002  augustss Get rid of trailing white space.
 1.78  08-Jul-2002  augustss s/__FUNCTION__/__func__/
 1.77  08-Jul-2002  rh Add support for the SMC 2206USB/ETH EZ Connect adapter (Pegasus II)
 1.76  25-Jun-2002  nathanw Add the now-tested 3Com 3C460B Pegasus-II adapter (Currently US$5 from
cheap web vendors).
 1.75  18-Mar-2002  christos branches: 1.75.4; 1.75.6;
Add Siemens speedstream, from Alicia da Conceicao.
 1.74  17-Mar-2002  augustss Whitespace fixes.
 1.73  02-Feb-2002  gehenna Add entry for ELECOM LD-USBL/TX
 1.72  14-Dec-2001  augustss Integrate fix from PR 10155.
Add ACCTON SS1001.
 1.71  03-Dec-2001  augustss Handle vendor/product lookup with a common routine.
 1.70  30-Nov-2001  augustss Add new devices. From URA Hiroshi in PR 14790.
 1.69  13-Nov-2001  augustss Small changes to behaviour when disconnecting.
 1.68  13-Nov-2001  lukem add RCSIDs
 1.67  10-Oct-2001  augustss Add a reference counter to avoid blowing away the softc while frobbing
the MII registers.
 1.66  28-Sep-2001  augustss Rename Accton adapter (from FreeBSD).
 1.65  03-Aug-2001  augustss branches: 1.65.2;
Add an I/O Data adapter.
 1.64  19-Jul-2001  augustss Prototype for aue_reset_pegasus_II().
 1.63  16-Jul-2001  augustss Add support for Pegasus II adapters (from Linux).
Add a bunch of adapters.
 1.62  16-Jul-2001  augustss Reorganize the table of adapters slightly.
 1.61  16-Jul-2001  augustss Alphabetize.
 1.60  16-Jul-2001  augustss Add SOHOware NUB100. From OpenBSD.
 1.59  04-Jul-2001  augustss branches: 1.59.2;
Add an Abocom adapter.
 1.58  15-Jun-2001  nathanw Move the check for successful attachment to earlier in the detach
routine, to avoid referencing nonexistent data structures.
 1.57  07-Jun-2001  enami Fix typo; print sc->aue_intr_errs instead of sc->aue_rx_errs when
reporting interrupt errors.
 1.56  13-Apr-2001  augustss Do mii frobbing in process context.
Now we can finally get rid of the evil USBD_NO_TSLEEP hack in the aue driver.
 1.55  25-Mar-2001  augustss Comment out some strange code.
 1.54  29-Jan-2001  enami branches: 1.54.2;
Handle allmulti case correctly as a NetBSD network driver;
if we are requested range of multicast address or too many multicast address,
program multicast filter to receive all multicast address. And set/clear
IFF_ALLMULTI flag properly.
 1.53  21-Jan-2001  augustss Change watchdog routine. (From FreeBSD.)
The only thing stopping us from getting totally rid of the evil
USBD_NO_TSLEEP hack is the (broken) assumption in the MII driver that
registers can be read and written without a process context.
 1.52  21-Jan-2001  augustss Get rid of `#ifdef FreeBSD'; they maintain their own version.
 1.51  18-Jan-2001  jdolecek constify
 1.50  14-Dec-2000  thorpej ALTQ'ify.
 1.49  13-Dec-2000  augustss Another Ethernet device. From nagae@tk.airnet.ne.jp in PR kern/11711.
 1.48  15-Nov-2000  thorpej branches: 1.48.2;
Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.47  24-Oct-2000  augustss Tell usbd_set_config_no() to be verbose. It's nice to know whyit fails.
 1.46  12-Oct-2000  augustss Add Kingston KNU101TX Ethernet adapter.
 1.45  08-Oct-2000  augustss Add another DLINK adapter.
 1.44  01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.43  20-Sep-2000  itojun repair multicast filter setup. PR 11037 from Ryoji Kato.
 1.42  01-Jun-2000  augustss branches: 1.42.2;
Bring the coding style into the 80s, i.e., get rid of __P and use
ANSI prototypes and declarations.
 1.41  06-May-2000  augustss branches: 1.41.2;
Handle the Linksys USB100H1 like the other Linksys adapters.
Restructure the code a little.
 1.40  06-May-2000  augustss Add Linksys USB100H1, an Ethernet and HomePNA adapter.
 1.39  23-Apr-2000  augustss Sync with FreeBSD: add two more adapters.
 1.38  04-Apr-2000  augustss Put a ratecheck on error messages from the interrupt pipe.
 1.37  02-Apr-2000  augustss Generate an error message if starting a transfer fails.
 1.36  30-Mar-2000  augustss Afew more OpenBSD portability fixes.
 1.35  29-Mar-2000  augustss Some OpenBSD portability fixes.
 1.34  27-Mar-2000  augustss Change (almost) all static to Static. The symbol `Static' can then be defined
to `' or `static' depending on if you want to debug or not.
 1.33  24-Mar-2000  augustss Some cleanup and renaming of the callouts used in USB drivers.
 1.32  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.31  16-Mar-2000  uch add I/O DATA USB-ET/TX USB ethernet adapter.
 1.30  12-Mar-2000  augustss Avoid accessing the device if it is dying.
 1.29  08-Mar-2000  augustss Clean up code a little and add some more debug messages.
 1.28  06-Mar-2000  thorpej No longer necessary to futz with ifp->if_baudrate here.
 1.27  06-Mar-2000  augustss Use macros from usb.h instead masking out bit explicitely.
 1.26  02-Mar-2000  augustss Use ratecheck() to limit error messages on disconnect.
Break out some common functionality.
 1.25  01-Mar-2000  augustss Protect the use of bpf_mtap so bpf isn't needed.
aue: Limit the number of error messages at disconnect by using ratecheck().
 1.24  17-Feb-2000  augustss Handle detach that happens before attach has finished. (Reported by mycroft.)
 1.23  17-Feb-2000  mycroft Use bpf_mtap() correctly.
 1.22  12-Feb-2000  augustss Add Corega FEther adapter. From PR 9394.
 1.21  02-Feb-2000  augustss Fiddle with some PHY bits on the D-Link adapter as well. From FreeBSD.
 1.20  02-Feb-2000  thorpej Don't dry to diving MIIF_NOISOLATE in the PHY drivers. Instead, pass
flags down from the parent to child vi mii_attach().
 1.19  02-Feb-2000  augustss Generate usb events on attach and detach.
Handle rnd stuff correctly.
 1.18  02-Feb-2000  augustss Support detach.
 1.17  02-Feb-2000  thorpej Bring some order to the chaos which was the MII code function naming
"conventions".
 1.16  28-Jan-2000  augustss Small restructuring: break out opening of pipes into its own function.
 1.15  28-Jan-2000  augustss Remove the hack that handled truncated transfers.
 1.14  19-Jan-2000  augustss Poll the interrupt pipe every 100 ms instead of every 1 ms. The interrupt
pipe is only used to collect statistics so it seems rather stupid to bog
down the processor by doing this every ms.
 1.13  18-Jan-2000  augustss Pretend we can detach. Then we can at least the detach the device
if the attach fails in the middle.
 1.12  17-Jan-2000  augustss Add missing USBD_NO_COPY flag.
 1.11  17-Jan-2000  augustss Compute packet length correctly (from FreeBSD).
 1.10  16-Jan-2000  augustss Update some comments.
 1.9  16-Jan-2000  itojun typo
 1.8  16-Jan-2000  augustss Get rid of some debug gunk.
 1.7  16-Jan-2000  augustss Turn on interface OACTIVE in case of a transmit error.
 1.6  16-Jan-2000  augustss Put back line I lost in FreeBSD code when porting.
 1.5  16-Jan-2000  augustss Some stylistic changes.
 1.4  16-Jan-2000  augustss Avoid even more #include for FreeBSD.
 1.3  16-Jan-2000  augustss Avoid some #include for FreeBSD.
 1.2  16-Jan-2000  augustss Check for the right vendor/product before fiddling with the Broadcom PHY.
 1.1  16-Jan-2000  augustss Add initial version of a driver for the ADMtek AN986 Pegasus USB to
Ethernet chip.
Written by Bill Paul, <wpaul@ee.columbia.edu>, for FreeBSD.
Massaged by Lennart Augustsson.
XXX Needs a thread to avoid a the gruesome USBD_NO_TSLEEP hack.
 1.41.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.42.2.2  13-Mar-2001  he Pull up revision 1.54 (via patch, requested by tsutsui):
Handle allmulti case correctly as a NetBSD network driver;
if we are requested range of multicast address or too many
multicast address, program multicast filter to receive all
multicast address. And set/clear IFF_ALLMULTI flag properly.
 1.42.2.1  20-Sep-2000  itojun pullup 1.42 -> 1.43 (approved by releng-1-5)
repair multicast filter setup. PR 11037 from Ryoji Kato.
 1.48.2.8  21-Apr-2001  bouyer Sync with HEAD
 1.48.2.7  27-Mar-2001  bouyer Sync with HEAD.
 1.48.2.6  11-Feb-2001  bouyer Sync with HEAD.
 1.48.2.5  05-Jan-2001  bouyer Sync with HEAD
 1.48.2.4  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.48.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.48.2.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.48.2.1  15-Nov-2000  bouyer file if_aue.c was added on branch thorpej_scsipi on 2000-11-20 11:43:19 +0000
 1.54.2.11  18-Oct-2002  nathanw Catch up to -current.
 1.54.2.10  01-Aug-2002  nathanw Catch up to -current.
 1.54.2.9  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.54.2.8  28-Feb-2002  nathanw Catch up to -current.
 1.54.2.7  08-Jan-2002  nathanw Catch up to -current.
 1.54.2.6  14-Nov-2001  nathanw Catch up to -current.
 1.54.2.5  22-Oct-2001  nathanw Catch up to -current.
 1.54.2.4  08-Oct-2001  nathanw Catch up to -current.
 1.54.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.54.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.54.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.59.2.7  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.59.2.6  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.59.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.59.2.4  11-Feb-2002  jdolecek Sync w/ -current.
 1.59.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.59.2.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.59.2.1  03-Aug-2001  lukem update to -current
 1.65.2.2  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.65.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.75.6.1  06-Nov-2002  tron Pull up revision 1.77 (requested by rh in ticket #442):
Add support for the SMC 2206USB/ETH EZ Connect adapter (Pegasus II)
 1.75.4.2  29-Aug-2002  gehenna catch up with -current.
 1.75.4.1  15-Jul-2002  gehenna catch up with -current.
 1.82.2.7  11-Dec-2005  christos Sync with head.
 1.82.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.82.2.5  14-Nov-2004  skrll Sync with HEAD.
 1.82.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.82.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.82.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.82.2.1  03-Aug-2004  skrll Sync with HEAD
 1.85.4.1  24-Jan-2005  he Pull up revision 1.88 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.91.8.1  29-Nov-2005  yamt sync with head.
 1.91.2.6  11-Feb-2008  yamt sync with head.
 1.91.2.5  21-Jan-2008  yamt sync with head
 1.91.2.4  07-Dec-2007  yamt sync with head
 1.91.2.3  03-Sep-2007  yamt sync with head.
 1.91.2.2  30-Dec-2006  yamt sync with head.
 1.91.2.1  21-Jun-2006  yamt sync with head.
 1.92.10.1  19-Apr-2006  elad sync with head.
 1.92.8.2  14-Sep-2006  yamt sync with head.
 1.92.8.1  01-Apr-2006  yamt sync with head.
 1.92.6.1  22-Apr-2006  simonb Sync with head.
 1.92.4.1  09-Sep-2006  rpaulo sync with head
 1.93.8.1  22-Sep-2006  riz Pull up following revision(s) (requested by is in ticket #166):
sys/dev/usb/if_aue.c: revision 1.95
sys/dev/usb/if_aue.c: revision 1.96
sys/dev/usb/if_auereg.h: revision 1.17
aue_ioctl() for the murpose of adding/deleting multicast addresses is called
from interupt context. Defer its processing to a workqueue(9).
This fixes PR 34521.
Simply use the device name for the workqueue name.
 1.94.2.1  18-Nov-2006  ad Sync with head.
 1.96.2.2  10-Dec-2006  yamt sync with head.
 1.96.2.1  22-Oct-2006  yamt sync with head
 1.99.10.6  25-Jun-2007  itohy New devices from FreeBSD/OpenBSD:
- ADMtek AN986A Ethernet
- ELCON Goldpfeil P-LAN
- ELECOM LD-USB20
- GIGABYTE GN-BR402W
- Mobility EasiDock Ethernet
- SIIG2 USB TO Ethernet
- SOHOware NUB110 Ethernet

Whitespace police.
 1.99.10.5  22-Jun-2007  itohy Execute callback functions as tasks on FreeBSD.
(FYI, the code does work on NetBSD, but affects the performance, you know.)
 1.99.10.4  18-Jun-2007  itohy Pullup 1.101 (attach driver per interface) with #ifdef USB_USE_IFATTACH.
 1.99.10.3  17-Jun-2007  itohy Pullup 1.100 in a different way.
 1.99.10.2  13-Jun-2007  itohy - Convert to use usbd_map_buffer_mbuf() and eliminate mbuf-memory copy.
- Use common code in usb_ethersubr.[ch] and reduce duplicated code.
- Use ether_ioctl() to handle llinfo (what is it?) properly.

XXX Untested, missing hardware.
 1.99.10.1  22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.99.8.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.99.4.2  24-Mar-2007  yamt sync with head.
 1.99.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.99.2.1  21-Jan-2008  bouyer pullup following revisions (requested by is in ticket #1048):
sys/dev/usb/if_aue.c 1.107, 1.108 via patch
sys/dev/usb/if_auereg.h 1.19, 1.20 via patch

Prevents hang on close by unprotected creation of the formerly used
workqueue item.
 1.100.4.1  11-Jul-2007  mjf Sync with head.
 1.100.2.3  09-Oct-2007  ad Sync with head.
 1.100.2.2  15-Jul-2007  ad Sync with head.
 1.100.2.1  13-Mar-2007  ad Sync with head.
 1.102.8.3  23-Mar-2008  matt sync with HEAD
 1.102.8.2  09-Jan-2008  matt sync with HEAD
 1.102.8.1  06-Nov-2007  matt sync with HEAD
 1.102.6.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.102.6.2  21-Nov-2007  joerg Sync with HEAD.
 1.102.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.102.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.104.6.2  18-Feb-2008  mjf Sync with HEAD.
 1.104.6.1  08-Dec-2007  mjf Sync with HEAD.
 1.104.4.1  21-Nov-2007  bouyer Sync with HEAD
 1.105.2.1  08-Dec-2007  ad Sync with head.
 1.106.4.2  20-Jan-2008  bouyer Sync with HEAD
 1.106.4.1  19-Jan-2008  bouyer Sync with HEAD
 1.110.12.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.110.10.5  09-Oct-2010  yamt sync with head
 1.110.10.4  11-Aug-2010  yamt sync with head.
 1.110.10.3  11-Mar-2010  yamt sync with head
 1.110.10.2  16-Sep-2009  yamt sync with head
 1.110.10.1  04-May-2009  yamt sync with head.
 1.110.8.1  04-Jun-2008  yamt sync with head
 1.110.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.110.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.111.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.111.4.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.118.4.2  05-Mar-2011  rmind sync with head
 1.118.4.1  30-May-2010  rmind sync with head
 1.118.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.118.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.118.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.121.12.3  06-Mar-2012  mrg sync to -current
 1.121.12.2  26-Feb-2012  mrg rename old usb_detach_wakeup/wait to usb_detach_{wake,wakeup}old().
 1.121.12.1  18-Feb-2012  mrg merge to -current.
 1.121.8.4  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.121.8.3  23-Jan-2013  yamt sync with head
 1.121.8.2  30-Oct-2012  yamt sync with head
 1.121.8.1  17-Apr-2012  yamt sync with head
 1.124.2.1  20-Oct-2013  bouyer Pull up following revision(s) (requested by tsutsui in ticket #956):
sys/dev/usb/if_aue.c: revision 1.131
Change one aprint_error_dev(9) to aprint_debug_dev(9) to avoid console spam.
My aue (BUFFALO LUA2-TX) generates a bunch of
"aue0: 1 usb errors on intr: IOERROR" errors during TRX,
but works without visible problems.
XXX this is not autoconf(9) message
 1.127.2.4  03-Dec-2017  jdolecek update from HEAD
 1.127.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.127.2.2  23-Jun-2013  tls resync from head
 1.127.2.1  25-Feb-2013  tls resync with head
 1.131.8.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.132.8.2  26-Jan-2017  skrll Sync with HEAD/nhusb
 1.132.8.1  06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.132.4.17  05-Feb-2017  skrll Sync with HEAD
 1.132.4.16  28-Dec-2016  skrll Destroy all mutexes on detach
 1.132.4.15  12-Dec-2016  skrll Whitespace
 1.132.4.14  12-Dec-2016  skrll WIP MPification
 1.132.4.13  05-Dec-2016  skrll Sync with HEAD
 1.132.4.12  09-Jul-2016  skrll Sync with HEAD
 1.132.4.11  19-Mar-2016  skrll Sync with HEAD
 1.132.4.10  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.132.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.132.4.8  06-Jun-2015  skrll Sync with HEAD
 1.132.4.7  21-Mar-2015  skrll Add prefixes to attach_arg structure member names. No functional change.
 1.132.4.6  19-Mar-2015  skrll Do the same as OpenBSD and get rid of the *_handle typedefs and use
plain structures insteads
 1.132.4.5  06-Dec-2014  skrll KNF. Remove argument name from function declarations.

No functional change.
 1.132.4.4  05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.132.4.3  03-Dec-2014  skrll Remove #include <sys/malloc.h> where it's not (no longer) needed
 1.132.4.2  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.132.4.1  30-Nov-2014  skrll Use C99 types. u_int{8,16,32,64}_t to uint{8,16,32,64}_t.

No functional change.
 1.132.2.3  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.132.2.2  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.132.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.137.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.137.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.141.8.4  13-May-2019  martin Pull up the following, via patch, requested by msaitoh in ticket #1263:

sys/dev/mii/brgphy.c 1.84
sys/dev/mii/ciphy.c 1.33 via patch
sys/dev/mii/rgephy.c 1.53
sys/arch/arm/imx/if_enet.c 1.18
sys/arch/mips/adm5120/dev/if_admsw.c 1.19-1.20
sys/dev/pci/if_bge.c 1.329
sys/dev/pci/if_bnx.c 1.81
sys/dev/pci/if_et.c 1.21
sys/dev/pci/if_lii.c 1.22
sys/dev/pci/if_msk.c 1.87
sys/dev/pci/if_nfe.c 1.68
sys/dev/pci/if_sk.c 1.95
sys/dev/pci/if_ti.c 1.107
sys/dev/pci/if_txp.c 1.52
sys/dev/pci/if_vge.c 1.69
sys/dev/usb/if_axen.c 1.38
sys/dev/usb/if_aue.c 1.149

Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.141.8.3  29-Mar-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1224):

sys/dev/mii/tlphy.c: revision 1.65
sys/dev/usb/if_url.c: revision 1.62
sys/dev/usb/if_aue.c: revision 1.148

mii_phy_add_media() automatically install power handler, but if_media_add()
doesn't. When mii_phy_add_media() isn't used, call pmf_device_register().

-

Use pmf(9).

-

Use pmf(9).
 1.141.8.2  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.141.8.1  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.142.2.3  26-Jan-2019  pgoyette Sync with HEAD
 1.142.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.142.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.143.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.143.2.1  10-Jun-2019  christos Sync with HEAD
 1.154.2.2  02-Sep-2019  martin Ticket #135: something went wrong in the pullup process for this file
(likely overlooked conflict with previously applied rev. 156).
So now actually sync this up to rev 1.161, as the last pullup claimed
 1.154.2.1  09-Aug-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #39):

sys/dev/usb/if_aue.c: revision 1.156

Fix panic when setting multicast addresses. Write the hash table outside of
ETHER_LOC()/ETHER_UNLOCK().
 1.162.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed