summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-09-08 07:38:34 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-09-08 07:38:34 +0000
commitcc7af6d6f392fc0f3edd65a1d55a0600aaa52299 (patch)
treec2608848f342a4192ddbcfd677c41a34eae0bb6e
parent8aa62324f07d22813b96308137003b7087e161a1 (diff)
IEEE 802.3 Annex 28B.3 explicitly 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 However PHY drivers did not honor the order such that 100BASE-T4 had higher priority than 100BASE-TX full duplex. Fix a long standing bug such that PHY drivers choose the highest common denominator ability. This bug is exposed by a Cisco 3550 switch which inadvertently announces 100BASE-T4 capability even though it is not capable of 100BASE-T4 operation, it is a 100BASE-TX switch. From FreeBSD Tested with dc(4), fxp(4), rl(4), sis(4).
-rw-r--r--sys/dev/mii/amphy.c8
-rw-r--r--sys/dev/mii/dcphy.c10
-rw-r--r--sys/dev/mii/inphy.c8
-rw-r--r--sys/dev/mii/iophy.c9
-rw-r--r--sys/dev/mii/nsphy.c8
-rw-r--r--sys/dev/mii/rlphy.c8
-rw-r--r--sys/dev/mii/ukphy_subr.c6
-rw-r--r--sys/dev/pci/if_txp.c8
8 files changed, 33 insertions, 32 deletions
diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c
index 2b15d02c7c2..a6b46a0c04d 100644
--- a/sys/dev/mii/amphy.c
+++ b/sys/dev/mii/amphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amphy.c,v 1.17 2008/03/12 11:32:17 brad Exp $ */
+/* $OpenBSD: amphy.c,v 1.18 2008/09/08 07:38:33 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -225,10 +225,10 @@ amphy_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|IFM_HDX;
- 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|IFM_HDX;
else if (anlpar & ANLPAR_TX)
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
diff --git a/sys/dev/mii/dcphy.c b/sys/dev/mii/dcphy.c
index 1806cfbdce3..d657fc1b70e 100644
--- a/sys/dev/mii/dcphy.c
+++ b/sys/dev/mii/dcphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcphy.c,v 1.21 2008/07/22 11:20:10 martynas Exp $ */
+/* $OpenBSD: dcphy.c,v 1.22 2008/09/08 07:38:33 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -332,12 +332,12 @@ dcphy_status(struct mii_softc *sc)
if (tstat & DC_TSTAT_LP_CAN_NWAY) {
anlpar = tstat >> 16;
- if (anlpar & ANLPAR_T4 &&
+ if (anlpar & ANLPAR_TX_FD &&
+ sc->mii_capabilities & BMSR_100TXFDX)
+ mii->mii_media_active |= IFM_100_TX|IFM_HDX;
+ else if (anlpar & ANLPAR_T4 &&
sc->mii_capabilities & BMSR_100T4)
mii->mii_media_active |= IFM_100_T4|IFM_HDX;
- else if (anlpar & ANLPAR_TX_FD &&
- sc->mii_capabilities & BMSR_100TXFDX)
- mii->mii_media_active |= IFM_100_TX|IFM_FDX;
else if (anlpar & ANLPAR_TX &&
sc->mii_capabilities & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c
index fb4c572a70c..d76a20b6dce 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/mii/inphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inphy.c,v 1.16 2008/06/26 05:42:16 ray Exp $ */
+/* $OpenBSD: inphy.c,v 1.17 2008/09/08 07:38:33 brad Exp $ */
/* $NetBSD: inphy.c,v 1.18 2000/02/02 23:34:56 thorpej Exp $ */
/*-
@@ -254,10 +254,10 @@ inphy_status(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;
diff --git a/sys/dev/mii/iophy.c b/sys/dev/mii/iophy.c
index 80208893980..52775ee6954 100644
--- a/sys/dev/mii/iophy.c
+++ b/sys/dev/mii/iophy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iophy.c,v 1.15 2008/07/11 15:11:58 brad Exp $ */
+/* $OpenBSD: iophy.c,v 1.16 2008/09/08 07:38:33 brad Exp $ */
/* $NetBSD: iophy.c,v 1.8 2000/02/02 23:34:56 thorpej Exp $ */
/*
@@ -250,10 +250,11 @@ iophy_status(sc)
ext0 = PHY_READ(sc, MII_IOPHY_EXT0);
if (ext0 & EXT0_SPEED) {
- if (bmsr & BMSR_100T4)
- mii->mii_media_active |= IFM_100_T4;
- else
+ if (bmsr & BMSR_100TXFDX ||
+ bmsr & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_TX;
+ else
+ mii->mii_media_active |= IFM_100_T4;
} else
mii->mii_media_active |= IFM_10_T;
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index bc7fa53d13d..05c9fdaa329 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nsphy.c,v 1.23 2008/06/26 05:42:16 ray Exp $ */
+/* $OpenBSD: nsphy.c,v 1.24 2008/09/08 07:38:33 brad Exp $ */
/* $NetBSD: nsphy.c,v 1.25 2000/02/02 23:34:57 thorpej Exp $ */
/*-
@@ -282,10 +282,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|IFM_HDX;
- 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|IFM_HDX;
else if (anlpar & ANLPAR_TX)
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index e44bb707cda..f2b118b43a6 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rlphy.c,v 1.28 2008/06/10 21:15:14 brad Exp $ */
+/* $OpenBSD: rlphy.c,v 1.29 2008/09/08 07:38:33 brad Exp $ */
/*
* Copyright (c) 1998, 1999 Jason L. Wright (jason@thought.net)
@@ -260,10 +260,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|IFM_HDX;
- 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|IFM_HDX;
else if (anlpar & ANLPAR_TX)
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
diff --git a/sys/dev/mii/ukphy_subr.c b/sys/dev/mii/ukphy_subr.c
index 643d646fd94..16b196507b6 100644
--- a/sys/dev/mii/ukphy_subr.c
+++ b/sys/dev/mii/ukphy_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukphy_subr.c,v 1.8 2008/06/26 05:42:17 ray Exp $ */
+/* $OpenBSD: ukphy_subr.c,v 1.9 2008/09/08 07:38:33 brad Exp $ */
/* $NetBSD: ukphy_subr.c,v 1.2 1998/11/05 04:08:02 thorpej Exp $ */
/*-
@@ -101,10 +101,10 @@ ukphy_status(struct mii_softc *phy)
else if ((gtcr & GTCR_ADV_1000THDX) &&
(gtsr & GTSR_LP_1000THDX))
mii->mii_media_active |= IFM_1000_T|IFM_HDX;
- else if (anlpar & ANLPAR_T4)
- mii->mii_media_active |= IFM_100_T4|IFM_HDX;
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|IFM_HDX;
else if (anlpar & ANLPAR_TX)
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index 7c35b04aaf0..22fdd3a4bbe 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_txp.c,v 1.91 2008/05/31 02:08:14 brad Exp $ */
+/* $OpenBSD: if_txp.c,v 1.92 2008/09/08 07:38:33 brad Exp $ */
/*
* Copyright (c) 2001
@@ -1826,10 +1826,10 @@ txp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
}
anlpar &= anar;
- if (anlpar & ANLPAR_T4)
- ifmr->ifm_active |= IFM_100_T4|IFM_HDX;
- 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|IFM_HDX;
else if (anlpar & ANLPAR_TX)
ifmr->ifm_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)