Subject: Re: A new wm driver
To: Pascal Renauld <>
From: Thor Lancelot Simon <>
List: tech-kern
Date: 12/17/2003 15:02:12
On Wed, Dec 17, 2003 at 02:40:34PM -0500, Pascal Renauld wrote:
> In fact, the line breakdown is as following:
> wc -l if_wm*.{c,h}
>     3238 if_wm.c
>     5051 if_wm_hw.c
>     2099 if_wm_hw.h
>      134 if_wm_osdep.h
>      433 if_wmreg.h
>    10955 total
> if_wm_hw.c and if_wm_hw.h are dedicated to tuning and represent around 
> 7100 lines. I think it speaks for itself. The *generic* part of the 
> driver is around 3700 lines.

I think the debate is as not as to whether "it speaks for itself", it's
as to just what, exactly, it's saying.  You seem to think it's saying
"I'm fast!".  I happen to suspect it's saying "I'm bloated and contain a
lot of redundant code that could be factored back out into common routines
for more than one IC".

Assuming that "more lines of code" = "better software" is a pretty odd
point of view.  I thought that went out at some point in the 1960s.

I am looking at the FreeBSD "em" driver, which you say you started with,
because there doesn't appear to be a reachable FTP server at the
address you gave (  There's some stuff in if_em_hw.c
that we don't have, and probably want -- support for adaptive interframe
spacing, support for adjusting the collision distance, support for adjusting
the DMA priority of transmit and receive -- but it's comparatively small.
Most of what's in that file, in the FreeBSD driver, at least, is code that
in NetBSD would live in a PHY driver; this driver (em) seems to have a lot
of specific knowledge of individual PHYs.  Doesn't FreeBSD have a generic
PHY framework?  If not, that could explain a lot of the difference in size.

A lot of the code in this file either is already in, or should be in, the
"makphy" driver in NetBSD AFAICT.

> Again, the source code is available from FTP with anonymous access at 
> If some people find it useful, please send feedbacks, 
> otherwise just ignore it.

Again, if I could actually reach that FTP server, I'd download the code.