tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

RFC: usb ethernet common code



hi folks.


i recently fixed a bunch of problems in several usb ethernet
drivers and there's a lot of copied code among them.

to avoid this i wrote this patch which introduces a common
library for usb ethernet drivers and converts if_axen.c to
use it.  these are the areas handled:

 - USB endpoint pipe handling
 - rx and tx chain handling
 - generic handlers or support for several struct ifnet callbacks
 - MII bus locking
 - interrupt handling
 - partial autoconf handling

for if_axen.c, the code reduction is 1902 to 1166 lines, and
i expect similiar savings for the other drivers as well.

i plan to convert other drivers i have handy (cdce, ure, axe),
but i'd like others with more network clue than i do to consider
the interfaces i've implemented.  some of them may seem ugly,
but i was unable to see a better method without forcing less
code sharing.

   https://www.netbsd.org/~mrg/usb_net.v15.diff

there is one issue left to deal with: this will require that
usb_net.c to be part of the base USB stack, or, fork this code
into its own module and ensure all other modules have the right
dependency.  i haven't thought about this byeond assuming that
itw ill be as simple as a usb_net module that other modules
have as a dep.

thanks.


.mrg.


Home | Main Index | Thread Index | Old Index