fix media priorities:

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.
Fix this. This patch is based on changes in FreeBSD and OpenBSD.

Patch presented on tech-kern and tech-net:
http://mail-index.netbsd.org/tech-kern/2009/02/15/msg004397.html
http://mail-index.netbsd.org/tech-net/2009/02/15/msg001064.html

got no comments, no objections.
This commit is contained in:
cegger 2009-02-16 08:00:42 +00:00
parent 9277c1a831
commit add29455bf
6 changed files with 31 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: inphy.c,v 1.50 2009/01/18 10:37:04 mrg Exp $ */
/* $NetBSD: inphy.c,v 1.51 2009/02/16 08:00:42 cegger Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.50 2009/01/18 10:37:04 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.51 2009/02/16 08:00:42 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: iophy.c,v 1.34 2008/11/17 03:04:27 dyoung Exp $ */
/* $NetBSD: iophy.c,v 1.35 2009/02/16 08:00:42 cegger Exp $ */
/*
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.34 2008/11/17 03:04:27 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.35 2009/02/16 08:00:42 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsphy.c,v 1.55 2008/11/17 03:04:27 dyoung Exp $ */
/* $NetBSD: nsphy.c,v 1.56 2009/02/16 08:00:42 cegger Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.55 2008/11/17 03:04:27 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.56 2009/02/16 08:00:42 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: rlphy.c,v 1.24 2009/01/16 20:52:20 cegger Exp $ */
/* $NetBSD: rlphy.c,v 1.25 2009/02/16 08:00:42 cegger Exp $ */
/* $OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $ */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.24 2009/01/16 20:52:20 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.25 2009/02/16 08:00:42 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ukphy_subr.c,v 1.10 2008/04/28 20:23:53 martin Exp $ */
/* $NetBSD: ukphy_subr.c,v 1.11 2009/02/16 08:00:42 cegger Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.10 2008/04/28 20:23:53 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.11 2009/02/16 08:00:42 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_txp.c,v 1.27 2008/11/07 00:20:07 dyoung Exp $ */
/* $NetBSD: if_txp.c,v 1.28 2009/02/16 08:00:42 cegger Exp $ */
/*
* Copyright (c) 2001
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.27 2008/11/07 00:20:07 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.28 2009/02/16 08:00:42 cegger Exp $");
#include "bpfilter.h"
#include "opt_inet.h"
@ -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)