NetBSD-Bugs archive

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

kern/44630: rgephy(4) likes auto-negotiation too much



>Number:         44630
>Category:       kern
>Synopsis:       rgephy(4) likes auto-negotiation too much
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 24 06:20:00 +0000 2011
>Originator:     River Tarnell
>Release:        NetBSD 5.1.0_PATCH
>Organization:
TCX.ORG.UK
>Environment:
System: NetBSD tamara.TCX.ORG.UK 5.1.0_PATCH NetBSD 5.1.0_PATCH (TAMARA) #2: 
Thu Feb 24 06:06:17 GMT 2011 
root%tamara.TCX.ORG.UK@localhost:/usr/src/sys/arch/amd64/compile/TAMARA amd64
Architecture: x86_64
Machine: amd64
>Description:
rgephy(4) enables auto-negotiation even when the user explicitly
specifies a media type.  This is unfortunate, because if the switch is
forced to 100-FD, the card will fail to negotiate and fall back to
100-HD.  The duplex mismatch makes it so slow as to be unusable.

# ifconfig re0 media 100basetx mediaopt full-duplex
# ifconfig re0
        ...
        media: Ethernet 100baseTX full-duplex (100baseTX half-duplex)
>How-To-Repeat:
See description.
>Fix:
This patch will use the user's specified media type unconditionally if
the link1 flag is set on the interface.  This is the same fix FreeBSD
uses in r215298.  From what I understand, some hardware revisions
become confused by this, which is why it's not enabled by default.

Index: rgephy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/rgephy.c,v
retrieving revision 1.21.10.1
diff -u -r1.21.10.1 rgephy.c
--- rgephy.c    19 Jun 2009 21:51:43 -0000      1.21.10.1
+++ rgephy.c    24 Feb 2011 06:06:08 -0000
@@ -244,10 +244,16 @@
                        }
 
                        if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) {
+                               /*
+                                * To prevent problems with some (older?) 
+                                * hardware revisions, always enable autoneg
+                                * unless link1 is specified.
+                                */
+                               if ((mii->mii_ifp->if_flags & IFF_LINK1) == 0)
+                                       speed |= RGEPHY_BMCR_AUTOEN | 
RGEPHY_BMCR_STARTNEG;
                                PHY_WRITE(sc, RGEPHY_MII_1000CTL, 0);
                                PHY_WRITE(sc, RGEPHY_MII_ANAR, anar);
-                               PHY_WRITE(sc, RGEPHY_MII_BMCR, speed |
-                                   RGEPHY_BMCR_AUTOEN | RGEPHY_BMCR_STARTNEG);
+                               PHY_WRITE(sc, RGEPHY_MII_BMCR, speed);
                                break;
                        }
 



Home | Main Index | Thread Index | Old Index