NetBSD-Bugs archive

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

Re: kern/40120: NetBSD 5.0 BETA bge(4) driver not working correctly for some (fiber) interface cards



Hi,

one might suspect that the EINVAL comes from the driver, and
there are precious few entries where EINVAL is returned in the
if_bge.c driver.  With the patch below in place, I got this on
the console when I tried to ifconfig the interface with an
address:

bge2: not ethernet? IFM_TYPE(ifm_media) = 0x0

and the expected and reported error on ifconfig:

wilma# ifconfig bge2 inet 130.242.82.186 netmask 0xfffffffc
ifconfig: SIOCAIFADDR: Invalid argument
wilma# 

Index: if_bge.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.152.4.1
diff -u -p -r1.152.4.1 if_bge.c
--- if_bge.c    15 Nov 2008 02:39:17 -0000      1.152.4.1
+++ if_bge.c    29 Jan 2009 15:15:50 -0000
@@ -4222,8 +4222,12 @@ bge_ifmedia_upd(struct ifnet *ifp)
 
        /* If this is a 1000baseX NIC, enable the TBI port. */
        if (sc->bge_tbi) {
-               if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
+               if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) {
+                       aprint_error_dev(sc->bge_dev, 
+                               "not ethernet? IFM_TYPE(ifm_media) = 0x%x\n",
+                               IFM_TYPE(ifm->ifm_media));
                        return(EINVAL);
+               }
                switch(IFM_SUBTYPE(ifm->ifm_media)) {
                case IFM_AUTO:
                        break;
@@ -4237,6 +4241,9 @@ bge_ifmedia_upd(struct ifnet *ifp)
                        }
                        break;
                default:
+                       aprint_error_dev(sc->bge_dev,
+                               "Unknown media subtype: 0x%x\n",
+                               IFM_SUBTYPE(ifm->ifm_media));
                        return(EINVAL);
                }
                /* XXX 802.3x flow control for 1000BASE-SX */

So... The plot thickens.

There's apparently something strange or wrong with the way the
media interface is hooked up or initialized for the fibre cards.
However, that code is unchanged since the initial import of the
driver.  Perhaps that is the problem -- I see the "else" branch
testing for sc->bge_tbi in bge_attach() does an mii_attach(),
while we don't do it for the bge_tbi interfaces.  I'll need to
get someone more familiar with the network driver infrastructure
and MII handling specifically to take a closer look.

Regards,

- Havard


Home | Main Index | Thread Index | Old Index