Subject: if_ne_pcmcia.c & D-Link DFE-670TXD (PCMCIA 10/100 Net card)
To: None <current-users@NetBSD.org>
From: None <aliver@xexil.com>
List: current-users
Date: 10/21/2003 02:55:46
There is a message in CVS from LukeM on version  1.90.4.1 of
src/sys/dev/pcmcia/if_ne_pcmcia.c which indicates that the D-Link
DFE-670TXD card has had support added. However, when using NetBSD -current
or 1.6.1 I get the following message:

ne2 at pcmcia0 function 0 port 0x400-0x40f port 0x410-0x41f
ne2 (manf 00000149 prod 00004530) cis D-Link DFE-670TXD: can't match ethernet vendor code

The device seems to have an interface name allocated to it, but it can't
be configured by ifconfig or used in any other fashion that I know of. I
wonder why the interface is allowed to exist if the device is actually
unusable. Wouldn't it be better to disable / remove the device when it
fails in this way?

I checked the code and it would seem as if the card is being supported
using a generic NE2000 driver which also works with the NetGear FA410TXC
card and a Linksys card of similar heritage.

As best I can tell the error message comes from if_ne_pcmcia.c and stems
from the fact that, in my case, the card's PCMCIA CIS is matched as being
handled by this driver, but the function ne2000_match(); is not able to
recognize the card as a fully fledged (supported) NE2000. I think my
version of the DFE-670TXD is newer than the one Lukem may have been aiming
to support. The funny thing is that I looked at the array of structures
called ne2000devs[] which enumerates the vitals of the CIS info for
supported devices and I can see some hexadecimal values (0x00, 0x50, 0xba)
which I'm guessing are part of the manufacturer ID and minor vision codes.
I went and looked in FreeBSD's driver for this card (which works - ugh)
and they are identical. I can also verify that the #define in pcmciadevs.h
for the CIS description string is correct.

I also noticed something a bit weird (probably due to my own ignorance).
The ne2000_match() function is called like so:

ne_dev = ne2000_match(pa->card, pa->pf->number, i);

But when the error is reported it is as so:

printf("%s (manf %08x prod %08x) cis %s %s: "
                       "can't match ethernet vendor code\n",
                       dsc->sc_dev.dv_xname,
                       pa->manufacturer, pa->product,
                       pa->card->cis1_info[0], pa->card->cis1_info[1]);


Wouldn't it make more sense to print the values of pa->card and
pa->pf->number in the error message instead of pa->manufacturer and
pa->product?  That way if a card didn't match and the driver maintainer
gets a problem report, he can more easily know how to properly support the
card. Also, is there any handy "pretty-print" function to get all the info
on a card that I might need so that I can more easily get a handle on all
the various codes and identifiers?

Any help is appreciated greatly. I'd be happy to send a patch if I can get
it working. I'm sure it'd be very trivial work.

-- 

aliver