History log of /freebsd-10.1-release/sys/dev/usb/net/if_axe.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 252185 24-Jun-2013 yongari

Add Lenovo USB 2.0 Ethernet adapter.

PR: usb/179920
MFC After: 1 week


# 252143 24-Jun-2013 yongari

When RX checksum offloading is active, AX88772B will prepend a
checksum header. The header contains a received frame length but
the defined length for AX88772B is different with other ASIX
controllers. When the RX checksum is off, AX88772B controller does
not prepend a checksum header so driver has to use normal header
length mask.
This change should fix RX errors when RX checksum offloading is
off.

Tested by: kevlo
MFC After: 1 week


# 251679 13-Jun-2013 kevlo

Remove unused variable sc_tx_bufsz.
The variable is initialized but not used.

Reviewed by: yongari


# 246021 28-Jan-2013 hselasky

Add new USB ID.

Submitted by: Ramil
PR: usb/175639
MFC after: 1 week


# 243857 04-Dec-2012 glebius

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


# 233774 02-Apr-2012 hselasky

Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after: 1 weeks


# 228637 17-Dec-2011 kevlo

Another axe(4), found in ASUS zenbook.


# 227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


# 227309 07-Nov-2011 ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 226743 25-Oct-2011 yongari

Implement TX/RX checksum offloading support for ASIX AX88772B
controller.

AX88772B data sheet does not show detailed information about
checksum offloading related things. It seems the controller has
lots of options to support checksum offloading but I failed to
understand why this feature requires so much complex controller
configuration and status bits.
One of major difference between AX88772B and its predecessor is
AX88772B uses a new RX header format when RX checksum offloading is
enabled. It also requires the received length of a frame should be
multiple of 4. Controller will pad necessary bytes to make the
length of received frame to be multiple of 4. It is driver's
responsibility to offset this pad bytes.
Note, AX88772B could be configured to get partial checksum value in
in RX header. This mode uses different RX header format and
currently we don't use that fature.

This change makes axe(4) use driver specific MII attach handler to
override uether(9)'s default MII attach and announce flow-control
capability for AX88178/AX88772A/AX88772B to PHY drivers. It seems
original AX88772 also supports flow-control but I didn't enable it
due to lack of test/access to the controller. The flow-control
threshold parameter is loaded from EEPROM and there is no way to
override this value without reprogramming EEPROM. For AX88772B,
TX/RX IP/TCP/UDP checksum offloading is announced to network stack.
IPv6 and PPPoE checksum offloading is also supported by controller
but we have no way to take advantage of these features.
Driver already knows PHY address so make PHY driver know that
information and remove unnecessary PHY address check used in
miibus_readreg/miibus_writereg callbacks. Also announce AX88178,
AX88772A and AX88772B support VLAN over-sized frame.

While I'm here clean up headers and remove axe_start() in
axe_init() because the link wouldn't be available right after media
change.


# 226479 17-Oct-2011 yongari

Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.

Reported by: Karim (fodillemlinkarimi <> gmail dot com)


# 224180 18-Jul-2011 hselasky

Only the USB root HUB thread is allowed to attach and detach drivers
to and from USB devices. Remove related DEVMETHOD() lines from USB
drivers.

Reported by: YongHyeon PYUN
MFC after: 3 days


# 224020 14-Jul-2011 yongari

Add initial support for AX88772B USB Fast Ethernet. AX88772B
supports IPv4/IPv6 checksum offloading and VLAN tag insertion/
stripping as well as WOL. Because uether does not provide a way
to announce driver specific offload capabilities to upper stack,
checksum offloading support needs more work and will be done in
future.
Special thanks to ASIX for donating sample hardware.

H/W donated by: ASIX Electronics
Reviewed by: hselasky


# 223486 24-Jun-2011 hselasky

- Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
host, device or dual mode
- Add generic tool to extract these data:
tools/bus_autoconf

Discussed with: imp
Suggested by: Robert Millan <rmh@debian.org>
PR: misc/157903
MFC after: 14 days


# 222581 01-Jun-2011 yongari

Poke correct GPIO pins for newer axe(4) controllers with Marvell
PHY. Newer models seem to use different LED mode that requires
enabling both GPIO1 and GPIO2.

Tested by: marcel


# 221407 03-May-2011 marius

- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP
(reporting IFM_LOOP based on BMCR_LOOP is left in place though as
it might provide useful for debugging). For most mii(4) drivers it
was unclear whether the PHYs driven by them actually support
loopback or not. Moreover, typically loopback mode also needs to
be activated on the MAC, which none of the Ethernet drivers using
mii(4) implements. Given that loopback media has no real use (and
obviously hardly had a chance to actually work) besides for driver
development (which just loopback mode should be sufficient for
though, i.e one doesn't necessary need support for loopback media)
support for it is just dropped as both NetBSD and OpenBSD already
did quite some time ago.
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Restructure the PHY entry points to use a structure of entry points
instead of discrete function pointers, and extend this to include
a "reset" entry point. Make sure any PHY-specific reset routine is
always used, and provide one for lxtphy(4) which disables MII
interrupts (as is done for a few other PHYs we have drivers for).
This includes changing NIC drivers which previously just called the
generic mii_phy_reset() to now actually call the PHY-specific reset
routine, which might be crucial in some cases. While at it, the
redundant checks in these NIC drivers for mii->mii_instance not being
zero before calling the reset routines were removed because as soon
as one PHY driver attaches mii->mii_instance is incremented and we
hardly can end up in their media change callbacks etc if no PHY driver
has attached as mii_attach() would have failed in that case and not
attach a miibus(4) instance.
Consequently, NIC drivers now no longer should call mii_phy_reset()
directly, so it was removed from EXPORT_SYMS.
- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe().
The purpose of that function is to perform the common steps to attach
a PHY driver instance and to hook it up to the miibus(4) instance and to
optionally also handle the probing, addition and initialization of the
supported media. So all a PHY driver without any special requirements
has to do in its bus attach method is to call mii_phy_dev_attach()
along with PHY-specific MIIF_* flags, a pointer to its PHY functions
and the add_media set to one. All PHY drivers were updated to take
advantage of mii_phy_dev_attach() as appropriate. Along with these
changes the capability mask was added to the mii_softc structure so
PHY drivers taking advantage of mii_phy_dev_attach() but still
handling media on their own do not need to fiddle with the MII attach
arguments anyway.
- Keep track of the PHY offset in the mii_softc structure. This is done
for compatibility with NetBSD/OpenBSD.
- Keep track of the PHY's OUI, model and revision in the mii_softc
structure. Several PHY drivers require this information also after
attaching and previously had to wrap their own softc around mii_softc.
NetBSD/OpenBSD also keep track of the model and revision on their
mii_softc structure. All PHY drivers were updated to take advantage
as appropriate.
- Convert the mebers of the MII data structure to unsigned where
appropriate. This is partly inspired by NetBSD/OpenBSD.
- According to IEEE 802.3-2002 the bits actually have to be reversed
when mapping an OUI to the MII ID registers. All PHY drivers and
miidevs where changed as necessary. Actually this now again allows to
largely share miidevs with NetBSD, which fixed this problem already
9 years ago. Consequently miidevs was synced as far as possible.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
weren't explicitly converted to support flow control before. It's
unclear whether flow control actually works with these but typically
it should and their net behavior should be more correct with these
changes in place than without if the MAC driver sets MIIF_DOPAUSE.

Obtained from: NetBSD (partially)
Reviewed by: yongari (earlier version), silence on arch@ and net@


# 217265 11-Jan-2011 jhb

Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by: bde


# 216284 07-Dec-2010 yongari

r184610 changed the way how TX frames are handled on AX88178 and
AX88772 controllers. ASIX added a new feature for AX88178/AX88772
controllers which allows combining multiple TX frames into a single
big frame. This was to overcome one of USB limitation where it
can't generate more than 8k interrupts/sec which in turn means USB
ethernet controllers can not send more than 8k packets per second.
Using ASIX's feature greatly enhanced TX performance(more than 3~4
times) compared to 7.x driver. However it seems r184610 removed
boundary checking for buffered frames which in turn caused
instability issues under certain conditions. In addition, using
ASIX's feature triggered another issue which made USB controller
hang under certain conditions. Restarting ethernet controller
didn't help under this hang condition and unplugging and replugging
the controller was the only solution. I believe there is a silicon
bug in TX frame combining feature on AX88178/AX88772 controllers.

To address these issues, reintroduce the boundary checking for both
AX88178 and AX88772 after copying a frame to USB buffer and do not
use ASIX's multiple frame combining feature. Instead, use USB
controller's multi-frame transmit capability to enhance TX
performance as suggested by Hans[1].
This should fix a long standing axe(4) instability issues reported
on AX88772 and AX88178 controllers. While I'm here remove
unnecessary TX frame length check since upper stack always
guarantee the size of a frame to be less than MCLBYTES.

Special thanks to Derrick Brashear who tried numerous patches
during last 4 months and waited real fix with patience. Without
this enthusiastic support, patience and H/W donation I couldn't fix
it since I was not able to trigger the issue on my box.

Suggested by: hselasky [1]
Tested by: Derrick Brashear (shadow <> gmail dot com>
H/W donated by: Derrick Brashear (shadow <> gmail dot com>
PR: usb/140883


# 215969 28-Nov-2010 yongari

Add initial AX88772A support.

H/W donated by: Derrick Brashear (shadow <> gmail dot com)


# 215968 27-Nov-2010 yongari

Introduce new macro AXE_IS_178_FAMILY and AXE_IS_772. Include
AX88772A and AX88772B for future extension. While here add TX
buffer size for 178 family controllers.


# 215966 27-Nov-2010 yongari

Do full controller initialization in axe_reset() for controllers
that require special configuration from EEPROM. This will put
controllers into known sane state.


# 215964 27-Nov-2010 yongari

Make sure to change to currently selected media.


# 215963 27-Nov-2010 yongari

Do not reinitialize controller if it's already running.


# 215962 27-Nov-2010 yongari

Move axe_reset() to axe_init().


# 215960 27-Nov-2010 yongari

Apply GPIO configuration for all CICADA PHYs.
While I'm here show selected phymode to ease of debugging.


# 213696 11-Oct-2010 yongari

Do not setup interrupt endpoint for axe(4).
It seems axe(4) controllers support interrupt endpoint such that
enabling interrupt endpoint generates about 1000 interrupts/sec.
Controllers transfer 8 bytes data through interrupt endpoint and
the data include link UP/DOWN state as well as some PHY related
information. Previously axe(4) didn't use the transferred data and
didn't even try to read the data. Because axe(4) counts on mii(4)
to detect link state changes there is no need to use interrupt
endpoint here.

This change fixes generation of unnecessary interrupts which was
seen when interface is brought to UP.

No objections from: hselasky


# 213436 04-Oct-2010 yongari

Don't count input error twice. uether_rxbuf() already updated that
counter.


# 213424 04-Oct-2010 yongari

Make upper stack know driver's output status. This change increased
TX performance from 221kpps to 231kpps.


# 213423 04-Oct-2010 yongari

Move updating TX packet counter to the inside of send loop. axe(4)
controllers combine multiple TX requests into single one if there
is room in TX buffer of controller. Updating TX packet counter at
the end of TX completion resulted in incorrect TX packet counter as
axe(4) thought it sent 1 packet. There is no easy way to know how
many combined TX were completed in the callback.
Because this change updates TX packet counter before actual
transmission, it may not be ideal one. But I believe it's better
than showing fake 8kpps under high TX load. With this change, TX
shows 221kpps on Linksus USB200M.


# 212980 21-Sep-2010 sanpei

Add new device ids.
Buffalo (Melco Inc.) LUA3-U2-AGT
Logitec LAN-GTJ/U2A(usb/119981)

PR: usb/119981 and me
Submitted by: "Y.Okabe" <be_works_us at yahoo.com>, hiroo at oikumene.gcd.org
Reviewed by: thompsa
MFC after: 3 days


# 212130 02-Sep-2010 thompsa

Add GPIO programming for more PHY hardware.

Submitted by: yongari


# 212122 01-Sep-2010 thompsa

Add missing MODULE_VERSION() definitions, this resolves problems around
duplicate module loads.

PR: usb/125736
Submitted by: danger, mm
Reviewed by: hselasky


# 207077 22-Apr-2010 thompsa

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after: 1 week


# 201028 26-Dec-2009 thompsa

Use macros to strip off USB_VENDOR_ and USB_PRODUCT_ from some id tables to make
them more compact and readable.


# 200306 09-Dec-2009 thompsa

Add new device ids.

PR: usb/140951, usb/140923
Submitted by: Romain Tartiere, Brett Glass


# 199816 25-Nov-2009 thompsa

Remove overuse of exclamation marks in kernel printfs, there mere fact a
message has been printed is enough to get someones attention. Also remove the
line number for DPRINTF/DPRINTFN, it already prints the funtion name and a
unique message.


# 197567 28-Sep-2009 thompsa

Allow setting of MAC address for AXE based ethernet adapters.

Submitted by: yongari


# 197566 28-Sep-2009 thompsa

Increase the rx buffer size to 16384 bytes, this increases RX performance from
50Mbps to 220Mbps on PLANEX GU-1000T.

Submitted by: yongari


# 196219 14-Aug-2009 jhb

Purge mergeinfo from files that were temporarily renamed while USB2 was
imported into the tree alongside USB.

Approved by: re (mergeinfo blanket)


# 195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


# 194677 23-Jun-2009 thompsa

- Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h


# 194228 14-Jun-2009 thompsa

s/usb2_/usb_|usbd_/ on all function names for the USB stack.


# 193045 29-May-2009 thompsa

s/usb2_/usb_/ on all typedefs for the USB stack.


# 192984 28-May-2009 thompsa

s/usb2_/usb_/ on all C structs for the USB stack.


# 192502 20-May-2009 thompsa

Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.

Submitted by: Hans Petter Selasky


# 192499 20-May-2009 thompsa

- rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by: Hans Petter Selasky [1]


# 191825 05-May-2009 thompsa

Remove USB shutdown methods from device drivers as its the host controllers
responsibility to detach the bus.

PR: usb/133896
Submitted by: Hans Petter Selasky


# 190749 05-Apr-2009 piso

Remove pointeless mergeinfo that crept in from r190633.


# 190734 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159909

- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
"usb2_config" has a new field called "usb_mode" which select for which mode
the current xfer entry is active. Options are: a) Device mode only b) Host
mode only (default-by-zero) c) Both modes. This change was scripted using
the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
the code for the function uses less memory than the table itself.

Submitted by: Hans Petter Selasky


# 190633 01-Apr-2009 piso

Implement an ipfw action to reassemble ip packets: reass.


# 190581 30-Mar-2009 mav

Integrate user/mav/ata branch:

Add ch_suspend/ch_resume methods for PCI controllers and implement them
for AHCI. Refactor AHCI channel initialization according to it.

Fix Port Multipliers operation. It is far from perfect yet, but works now.
Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair.
Previous version was also tested with SiI 4726 PMP.

Hardware sponsored by: Vitsch Electronics / VEHosting.nl


# 189522 08-Mar-2009 thompsa

Fix endian conversion from htole16 to htole32.

Tested with: ARM xscale


# 189275 02-Mar-2009 thompsa

Rename the ushub device class back to uhub as it was in the old usb stack,
moused(8) looks for "uhub/ums" to decide if needs to load the module.

Reported by: Garrett Cooper


# 188942 23-Feb-2009 thompsa

Move the new USB stack into its new home.


# 188746 18-Feb-2009 thompsa

Switch over to usbdevs.h generated at compile time.


# 188553 13-Feb-2009 thompsa

Restore some of the link handling code that was inadvertently removed in
r188412, this broke the GU-1000T adapters.

Submitted by: yongari
Pointy hat: me


# 188412 09-Feb-2009 thompsa

MFp4 //depot/projects/usb; 157100

1. Move most of the ifnet logic into the usb2_ethernet module, this includes,
- make all usb ethernet interfaces named ue%d
- handle all threading in usb2_ethernet
- provide default ioctl handler
- handle mbuf rx
- provide locked callbacks for init,start,stop,etc

2. Cleanup CDC-Ethernet driver.

Submitted by: Hans Petter Selasky
Obtained from: svn.freebsd.org/base/user/thompsa/usb [1]


# 187970 31-Jan-2009 thompsa

Remove check for null softc in attach, it can never happen.


# 187378 18-Jan-2009 thompsa

Just put the ifnet pointer first in the softc like it needs to be rather than
adding another deliciously evil pointer.


# 187259 15-Jan-2009 thompsa

Name the items in the xfer arrays so they can be identified throughout the
code.


# 187192 13-Jan-2009 thompsa

Restore the if_*var.h and if_*reg.h to their original names, they dont need to
be different.


# 186730 03-Jan-2009 alfred

Sync with usb4bsd:

src/lib/libusb20/libusb20_desc.c

Make "libusb20_desc_foreach()" more readable.

src/sys/dev/usb2/controller/*.[ch]
src/sys/dev/usb2/core/*.[ch]

Implement support for USB power save for all HC's.

Implement support for Big-endian EHCI.

Move Huawei quirks back into "u3g" driver.

Improve device enumeration.

src/sys/dev/usb2/ethernet/*[ch]

Patches for supporting new AXE Gigabit chipset.

src/sys/dev/usb2/serial/*[ch]

Fix IOCTL return code.

src/sys/dev/usb2/wlan/*[ch]

Sync with old USB stack.

Submitted by: hps


# 186454 23-Dec-2008 thompsa

Remove CALLOUT_RETURNUNLOCKED from the callouts, there is no reason for them to
drop the lock for us.


# 185950 11-Dec-2008 thompsa

Remove superfluous return statements from the end of void functions.


# 185948 11-Dec-2008 thompsa

Format and wrap function declarations.


# 184610 04-Nov-2008 alfred

Bring in USB4BSD, Hans Petter Selasky rework of the USB stack
that includes significant features and SMP safety.

This commit includes a more or less complete rewrite of the *BSD USB
stack, including Host Controller and Device Controller drivers and
updating all existing USB drivers to use the new USB API:

1) A brief feature list:

- A new and mutex enabled USB API.

- Many USB drivers are now running Giant free.

- Linux USB kernel compatibility layer.

- New UGEN backend and libusb library, finally solves the "driver
unloading" problem. The new BSD licensed libusb20 library is fully
compatible with libusb-0.1.12 from sourceforge.

- New "usbconfig" utility, for easy configuration of USB.

- Full support for Split transactions, which means you can use your
full speed USB audio device on a high speed USB HUB.

- Full support for HS ISOC transactions, which makes writing drivers
for various HS webcams possible, for example.

- Full support for USB on embedded platforms, mostly cache flushing
and buffer invalidating stuff.

- Safer parsing of USB descriptors.

- Autodetect of annoying USB install disks.

- Support for USB device side mode, also called USB gadget mode,
using the same API like the USB host side. In other words the new
USB stack is symmetric with regard to host and device side.

- Support for USB transfers like I/O vectors, means more throughput
and less interrupts.

- ... see the FreeBSD quarterly status reports under "USB project"

2) To enable the driver in the default kernel build:

2.a) Remove all existing USB device options from your kernel config
file.

2.b) Add the following USB device options to your kernel configuration
file:

# USB core support
device usb2_core

# USB controller support
device usb2_controller
device usb2_controller_ehci
device usb2_controller_ohci
device usb2_controller_uhci

# USB mass storage support
device usb2_storage
device usb2_storage_mass

# USB ethernet support, requires miibus
device usb2_ethernet
device usb2_ethernet_aue
device usb2_ethernet_axe
device usb2_ethernet_cdce
device usb2_ethernet_cue
device usb2_ethernet_kue
device usb2_ethernet_rue
device usb2_ethernet_dav

# USB wireless LAN support
device usb2_wlan
device usb2_wlan_rum
device usb2_wlan_ral
device usb2_wlan_zyd

# USB serial device support
device usb2_serial
device usb2_serial_ark
device usb2_serial_bsa
device usb2_serial_bser
device usb2_serial_chcom
device usb2_serial_cycom
device usb2_serial_foma
device usb2_serial_ftdi
device usb2_serial_gensa
device usb2_serial_ipaq
device usb2_serial_lpt
device usb2_serial_mct
device usb2_serial_modem
device usb2_serial_moscom
device usb2_serial_plcom
device usb2_serial_visor
device usb2_serial_vscom

# USB bluetooth support
device usb2_bluetooth
device usb2_bluetooth_ng

# USB input device support
device usb2_input
device usb2_input_hid
device usb2_input_kbd
device usb2_input_ms

# USB sound and MIDI device support
device usb2_sound

2) To enable the driver at runtime:

2.a) Unload all existing USB modules. If USB is compiled into the
kernel then you might have to build a new kernel.

2.b) Load the "usb2_xxx.ko" modules under /boot/kernel having the same
base name like the kernel device option.

Submitted by: Hans Petter Selasky hselasky at c2i dot net
Reviewed by: imp, alfred