tech-kern archive

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

fix media priorities



Hi,

IEEE 802.3 Annex 28B.3 specifies the following relative
priorities of the technologies supported by
802.3 Selector Field value:

1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T

Our drivers give 100BASE-T4 a higher priority than
100BASE-TX full duplex.

Attached patch fixes this.
(Patch is based on changes in FreeBSD and OpenBSD)

I wrote this patch in consequence of PR 40586.

Comments ?

Christoph

Index: pci/if_txp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_txp.c,v
retrieving revision 1.27
diff -u -p -r1.27 if_txp.c
--- pci/if_txp.c        7 Nov 2008 00:20:07 -0000       1.27
+++ pci/if_txp.c        15 Feb 2009 00:11:28 -0000
@@ -1886,10 +1886,10 @@ txp_ifmedia_sts(ifp, ifmr)
                        return;
                }
 
-               if (anlpar & ANLPAR_T4)
-                       ifmr->ifm_active |= IFM_100_T4;
-               else if (anlpar & ANLPAR_TX_FD)
+               if (anlpar & ANLPAR_TX_FD)
                        ifmr->ifm_active |= IFM_100_TX|IFM_FDX;
+               else if (anlpar & ANLPAR_T4)
+                       ifmr->ifm_active |= IFM_100_T4;
                else if (anlpar & ANLPAR_TX)
                        ifmr->ifm_active |= IFM_100_TX;
                else if (anlpar & ANLPAR_10_FD)
Index: mii/inphy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/inphy.c,v
retrieving revision 1.50
diff -u -p -r1.50 inphy.c
--- mii/inphy.c 18 Jan 2009 10:37:04 -0000      1.50
+++ mii/inphy.c 15 Feb 2009 00:11:28 -0000
@@ -251,10 +251,10 @@ inphy_status(struct mii_softc *sc)
                }
 
                scr = PHY_READ(sc, MII_INPHY_SCR);
-               if ((bmsr & BMSR_100T4) && (scr & SCR_T4))
-                       mii->mii_media_active |= IFM_100_T4;
-               else if (scr & SCR_S100)
+               if (scr & SCR_S100)
                        mii->mii_media_active |= IFM_100_TX;
+               else if ((bmsr & BMSR_100T4) && (scr & SCR_T4))
+                       mii->mii_media_active |= IFM_100_T4;
                else
                        mii->mii_media_active |= IFM_10_T;
                if (scr & SCR_FDX)
Index: mii/iophy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/iophy.c,v
retrieving revision 1.34
diff -u -p -r1.34 iophy.c
--- mii/iophy.c 17 Nov 2008 03:04:27 -0000      1.34
+++ mii/iophy.c 15 Feb 2009 00:11:28 -0000
@@ -240,14 +240,13 @@ iophy_status(struct mii_softc *sc)
                }
                ext0 = PHY_READ(sc, MII_IOPHY_EXT0);
 
-               if (ext0 & EXT0_SPEED)
-                       if (bmsr & BMSR_100T4) {
-                               mii->mii_media_active |= IFM_100_T4;
-                               return;
-                       } else {
+               if (ext0 & EXT0_SPEED) {
+                       if ((bmsr & BMSR_100TXFDX) || (bmsr & BMSR_100TXHDX)) {
                                mii->mii_media_active |= IFM_100_TX;
+                       } else if (bmsr & BMSR_100T4) {
+                               mii->mii_media_active |= IFM_100_T4;
                        }
-               else
+               } else
                        mii->mii_media_active |= IFM_10_T;
 
                if (ext0 & EXT0_DUPLEX)
Index: mii/nsphy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/nsphy.c,v
retrieving revision 1.55
diff -u -p -r1.55 nsphy.c
--- mii/nsphy.c 17 Nov 2008 03:04:27 -0000      1.55
+++ mii/nsphy.c 15 Feb 2009 00:11:28 -0000
@@ -286,10 +286,10 @@ nsphy_status(struct mii_softc *sc)
                if (PHY_READ(sc, MII_ANER) & ANER_LPAN) {
                        anlpar = PHY_READ(sc, MII_ANAR) &
                            PHY_READ(sc, MII_ANLPAR);
-                       if (anlpar & ANLPAR_T4)
-                               mii->mii_media_active |= IFM_100_T4;
-                       else if (anlpar & ANLPAR_TX_FD)
+                       if (anlpar & ANLPAR_TX_FD)
                                mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+                       else if (anlpar & ANLPAR_T4)
+                               mii->mii_media_active |= IFM_100_T4;
                        else if (anlpar & ANLPAR_TX)
                                mii->mii_media_active |= IFM_100_TX;
                        else if (anlpar & ANLPAR_10_FD)
Index: mii/rlphy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/rlphy.c,v
retrieving revision 1.24
diff -u -p -r1.24 rlphy.c
--- mii/rlphy.c 16 Jan 2009 20:52:20 -0000      1.24
+++ mii/rlphy.c 15 Feb 2009 00:11:28 -0000
@@ -259,10 +259,10 @@ rlphy_status(struct mii_softc *sc)
 
                if ((anlpar = PHY_READ(sc, MII_ANAR) &
                    PHY_READ(sc, MII_ANLPAR))) {
-                       if (anlpar & ANLPAR_T4)
-                               mii->mii_media_active |= IFM_100_T4;
-                       else if (anlpar & ANLPAR_TX_FD)
+                       if (anlpar & ANLPAR_TX_FD)
                                mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+                       else if (anlpar & ANLPAR_T4)
+                               mii->mii_media_active |= IFM_100_T4;
                        else if (anlpar & ANLPAR_TX)
                                mii->mii_media_active |= IFM_100_TX;
                        else if (anlpar & ANLPAR_10_FD)
Index: mii/ukphy_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/ukphy_subr.c,v
retrieving revision 1.10
diff -u -p -r1.10 ukphy_subr.c
--- mii/ukphy_subr.c    28 Apr 2008 20:23:53 -0000      1.10
+++ mii/ukphy_subr.c    15 Feb 2009 00:11:28 -0000
@@ -103,10 +103,10 @@ ukphy_status(struct mii_softc *phy)
                else if ((gtcr & GTCR_ADV_1000THDX) &&
                         (gtsr & GTSR_LP_1000THDX))
                        mii->mii_media_active |= IFM_1000_T;
-               else if (anlpar & ANLPAR_T4)
-                       mii->mii_media_active |= IFM_100_T4;
                else if (anlpar & ANLPAR_TX_FD)
                        mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+               else if (anlpar & ANLPAR_T4)
+                       mii->mii_media_active |= IFM_100_T4;
                else if (anlpar & ANLPAR_TX)
                        mii->mii_media_active |= IFM_100_TX;
                else if (anlpar & ANLPAR_10_FD)


Home | Main Index | Thread Index | Old Index