of the Broadcom BCM5201 PHY on the LinkSys USB100TX adapter so that the
link LED correctly (lights up amber for 10mbps link, green for 100mbps
link).
Note that the sticker on the bottom of the adapter says amber for 10
and green for 100, but the appendix in the manual that comes with
the adapter says green for 10 and amber for 100. Given that there doesn't
seem to be any way to make the hardware produce the latter combination,
I think it's safe to say the sticker is right and the manual is wrong.
I'm just shocked, shocked I tell you.
USB-EL1202A chipset. Between this and the other two drivers, we should
have support for pretty much every USB ethernet adapter on the market.
The only other USB chip that I know of is the SMC USB97C196, and right
now I don't know of any adapters that use it (including the ones made
by SMC :/ ).
Note that the CATC chip supports a nifty feature: read and write combining.
This allows multiple ethernet packets to be transfered in a single USB
bulk in/out transaction. However I'm again having trouble with large
bulk in transfers like I did with the ADMtek chip, which leads me to
believe that our USB stack needs some work before we can really make
use of this feature. When/if things improve, I intend to revisit the
aue and cue drivers. For now, I've lost enough sanity points.
Do not not not call m_freem() in the txeof routines. Let the netisr routine
do it. This also makes the tx netisr queuing much simpler (I can just use
another ifqueue instead of the mess I had before.)
Thanks to Bosko Milekic for making me actually think about what I was
doing for a minute.
- Add vendor/device ID for Corega USB-T ethernet adapter to necessary
places so that it will work with the kue driver.
- Add vendor/device ID for CATC Netmate devices for driver to be added
soon.
- Get really crazy about netisr stuff: avoid doing any mbuf allocations
or deallocations at splbio/splusb.
- Fix if_aue driver so that it works with LinkSys USB100TX: you need
to flip the GPIO bits just the right way to put the PHY in the right
mode.
drive the transmitter, we have to check the interface's send queue in the
TX end of frame handler (i.e. the usb bulk out callback) and push out new
transmissions if the queue has packets in it and the transmitter is
ready. But the txeof handler is also called from a USB callback running
at splusb() too.
Grrr.
Packets are received inside USB bulk transfer callbacks, which run at
splusb() (actually splbio()). The packet input queues are meant to be
manipulated at splimp(). However the locking apparently breaks down under
certain circumstances and the input queues can get trampled.
There's a similar problem with if_ppp, which is driven by hardware/tty
interrupts from the serial driver, but which must also manipulate the
packet input queues at splimp(). The fix there is to use a netisr, and
that's the fix I used here. (I can hear you groaning back there. Hush up.)
The usb_ethersubr module maintains a single queue of its own. When a
packet is received in the USB callback routine, it's placed on this
queue with usb_ether_input(). This routine also schedules a soft net
interrupt with schednetisr(). The ISR routine then runs later, at
splnet, outside of the USB callback/interrupt context, and passes the
packet to ether_input(), hopefully in a safe manner.
The reason this is implemented as a separate module is that there are
a limited number of NETISRs that we can use, and snarfing one up for
each driver that needs it is wasteful (there will be three once I get
the CATC driver done). It also reduces code duplication to a certain
small extent. Unfortunately, it also needs to be linked in with the
usb.ko module in order for the USB ethernet drivers to share it.
Also removed some uneeded includes from if_aue.c and if_kue.c
Fix suggested by: peter
Not rejected as a hairbrained idea by: n_hibma
Note: the .INF file for LinkSys's driver says the vendor ID is 0x66b,
however this does not agree with the vendor ID listed for LinkSys in
the company list from www.usb.org. In fact, 0x66b doesn't seem to appear
in the company list at all. Furthermore, this same vendor ID crops
up in some of the D-Link .INF files. Frankly I don't know what the heck
is going on here, but I need to add 0x66b to usbdevs and call it
something, so here we are.
certain PHY addresses in aue_miibus_readreg(). Not all adapters based
on the Pegasus chip may have their PHYs wired for the same MII bus
addresses: the logic that I used for my ADMtek eval board might not
apply to other adapters, so make sure to only use it if this is really
an ADMtek eval board (check the vendor/device ID).
This will hopefully make the LinkSys USB100TX adapter work correctly.
an URB before sending ZLP) set to the default. Choosing a bad value
can apparently cause a lockup on some machines/controllers.
Reported by: Doug Ambrisko
ethernet adapters that are supported by the aue and kue drivers.
There are actually a couple more out there from Accton, Asante and
EXP Computer, however I was not able to find any Windows device
drivers for these on their servers, and hence could not harvest
their vendor/device ID info. If somebody has one of these things
and can look in the .inf file that comes with the Windows driver,
I'd appreciate knowing what it says for 'VID' and 'PID.'
Additional adapters include: the D-Link DSB-650 and DSB-650TX, the
SMC 2102USB, 2104USB and 2202USB, the ATen UC10T, and the Netgear EA101.
These are all mentioned in the man pages, relnotes and LINT.
Also correct the date in the kue(4) man page. I wrote this thing
on Jan, 4 2000, not 1999.
machine but leave your KLSI adapter plugged into your USB port, it
may stay powered on and retain its firmware in memory. Trying to load
the firmware again in this case will wedge the chip. Try to detect this
in the kue_load_fw() routine and bail if the firmware is already
loaded and running.
Also, in the probe/match routine, force the revision code to the
hardware default and force a rescan of the quirk database. This is
necessary because the adapter will return a different revision code
if the firmware has been loaded. Without the firmware, the revision
code is 0x002. With the firmware, the revision code is 0x202. This
confuses the quirk mechanism, which won't match a quirk to a device
unless the revision code agrees with the quirk table entry.
This makes probe/attach of these devices somewhat more reliable.
Also add a few comments about the device's operation.
Kawasaki LSI KL5KUSB101B chip, including the LinkSys USB10T, the
Entrega NET-USB-E45, the Peracom USB Ethernet Adapter, the 3Com
3c19250 and the ADS Technologies USB-10BT. This device is 10mbs
half-duplex only, so there's miibus or ifmedia support. This device
also requires firmware to be loaded into it, however KLSI allows
redistribution of the firmware images (I specifically asked about
this; they said it was ok).
Special thanks to Annelise Anderson for getting me in touch with
KLSI (eventually) and thanks to KLSI for providing the necessary
programming info.
Highlights:
- Add driver files to /sys/dev/usb
- update usbdevs and regenerate attendate files
- update usb_quirks.c
- Update HARDWARE.TXT and RELNOTES.TXT for i386 and alpha
- Update LINT, GENERIC and others for i386, alpha and pc98
- Add man page
- Add module
- Update sysinstall and userconfig.c
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
- In uhci_intr() check to see if sc->sc_bus.bdev is NULL, and if it is,
ack any pending interrupts and disable them, then return. It is possible
for interrupts to be delivered the moment a handler is set up at attach
time in uhci_pci.c, particularly when attempting to kldload the usb.ko
module after the system is already up. However the driver isn't ready
to field interrupts at that time and certain pointers in the softc
struct aren't initialized yet, and we invariably end up falling off
the end of one of them. The effect is that kldloading the usb module
will panic the system in uhci_intr(). This added sanity check stops
this from happening: I can now kldload the usb.ko module without any
problems and load/attach other USB drivers after it.
Of course the uhci driver has no detach method, but that's another
problem.
- In uhci_run(), set the UHCI_CMD_MAXP bit in the command register to
allow 64-byte packets to be used for full speed bandwidth reclamation.
Certain high speed devices (in this case the ADMtek USB ethernet
adapter) require this bit to be set, otherwise babble errors occur
at the end of large (between 1100 and 1500 byte) transfers. This
should not affect other devices, although supposedly it is less efficient
than the 32-byte setting. Unfortunately, this is a per-bus setting,
not a per-device setting, so we can't just enable it for certain
devices on the USB bus.
device_add_child_ordered(). 'ivars' may now be set using the
device_set_ivars() function.
This makes it easier for us to change how arbitrary data structures are
associated with a device_t. Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.
Despite my best efforts I've probably forgotten something so let me know
if this breaks anything. I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.
Reviewed by: peter, dfr
by identifying the version in the PCI drivers.
The OHCI driver just presets this to 1.0 as it is not specified in the
PCI registers anywhere. This should be revisited once USB 2.0 is in
wide spread use.
are queued. Traverse the queues vertically and then horizontally.
This means that TDs for one xfer are transmitted back to back until the
first NAK or error condition. Up to now we transmitted a TD per frame
and transmitted the next TD in the next frame.
The old approach is more fair if you have the end of the queue point at
the beginning of the control transfer queue, but also a lot more overhead
due to the fact that the QHs have to be read more often.
The new approach squirts the packets down the line as fast as possible
for one transfer and then does the next one. In the current situation,
with fairly empty USB buses, this is a more sensible approach. We might
have to revisit the scheduler later however.
It speeds up large transfers (Zip drive, Host-To-Host adapters) on UHCI
by a factor of 5 and makes it as fast as OHCI on the bus.
The next problem to solve is the question why the limit is 300kb/s and
not 1000/kb/s (kb == kilobyte).
- more req[uest]->xfer changes.
- get the corresponding NetBSD Id's right
ohci.c
- move untimeout above print statement
- remove usb_delay that panics the system (tsleep in intr context) when
ohcidebug > 5.
ugen.c
- create the devices for endpoints with make_dev.
uhub.c
- change from using usbdebug to uhubdebug
- add more debugging statements
and shiny usbd daemon to handle events.
usb_port.h:
- Add a macro to retrieve the unit number from a USBBASEDEVICE
usb.h, usb_subr.c:
- Add fields to the device_info struct.
usb_subr.c:
- Fill in the new fields.
- Remove the notification of the event up a bit to make sure all the
information is still available to fill the usb_devinfo struct.
This requires recompilation of usbdevs (src/usr.sbin/usbdevs) and the
ezdownload/ezupload (ports/misc/ezload) utilities in any case.