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



The following reply was made to PR kern/40120; it has been noted by GNATS.

From: Havard Eidnes <he%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost, pettai%nordu.net@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/40120: NetBSD 5.0 BETA bge(4) driver not working
 correctly for some (fiber) interface cards
Date: Fri, 30 Jan 2009 15:20:21 +0100 (CET)

 Hi,
 
 I found out what the problem was.  The fix is a "one-line diff".
 
 The "struct ifmedia" has a ifm_media word, which has as a comment
 "current user-set media word".  This word is used by ifmedia_ioctl()
 as an input value.  However, contrary to what one might think, the
 ifmedia_set() routine does *not* set this word: it only sets the
 ifm_cur pointer to the member in the "media list" which matched what
 ifmedia_set() was told to set the media to (if found).
 
 So the one-line diff is to, after ifmedia_set() has been called in
 the bge_tbi case to also manually initialize bge_ifmedia.ifm_media,
 like this:
 
 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   30 Jan 2009 14:05:42 -0000
 @@ -2845,6 +2845,9 @@ bge_attach(device_t parent, device_t sel
                            0, NULL);
                ifmedia_add(&sc->bge_ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
                ifmedia_set(&sc->bge_ifmedia, IFM_ETHER|IFM_AUTO);
 +              /* Pretend the user requested this setting */
 +              sc->bge_ifmedia.ifm_media =
 +                      sc->bge_ifmedia.ifm_cur->ifm_media;
        } else {
                /*
                 * Do transceiver setup.
 
 A corresponding change can be seen in FreeBSD's cvs repository, but
 it was hidden away bundled together with some handling of BGE 5704
 cards (TBI variangs, aka. fibre cards), revision 1.71, visible here:
 
 
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/bge/if_bge.c.diff?r1=1.70;r2=1.71;f=h
 
 Regards,
 
 - Havard
 


Home | Main Index | Thread Index | Old Index