From 6961c0f1d598184fe794e20b8ad22a9b949e5edf Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Mon, 4 Dec 2006 14:35:21 +0000 Subject: report full/half duplex state for non-MII interfaces ok brad@ --- sys/dev/pci/if_bge.c | 8 ++++++-- sys/dev/pci/if_em.c | 9 +++++++-- sys/dev/pci/if_ixgb.c | 4 ++-- sys/dev/pci/if_vge.c | 9 +++++++-- 4 files changed, 22 insertions(+), 8 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 052026ee6a8..fe3a0f8523a 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.198 2006/11/26 19:13:39 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.199 2006/12/04 14:35:20 reyk Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -3358,7 +3358,11 @@ bge_link_upd(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_TBI_SEND_CFGS); CSR_WRITE_4(sc, BGE_MAC_STS, 0xFFFFFFFF); - ifp->if_link_state = LINK_STATE_UP; + status = CSR_READ_4(sc, BGE_MAC_MODE); + ifp->if_link_state = + (status & BGE_MACMODE_HALF_DUPLEX) ? + LINK_STATE_HALF_DUPLEX : + LINK_STATE_FULL_DUPLEX; if_link_state_change(ifp); } } else if (sc->bge_link) { diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 0530713d18d..fed9a28c7cf 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.160 2006/11/21 02:42:27 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.161 2006/12/04 14:35:20 reyk Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -1316,7 +1316,12 @@ em_update_link_status(struct em_softc *sc) sc->link_active = 1; sc->smartspeed = 0; ifp->if_baudrate = sc->link_speed * 1000000; - ifp->if_link_state = LINK_STATE_UP; + if (sc->link_duplex == FULL_DUPLEX) + ifp->if_link_state = LINK_STATE_FULL_DUPLEX; + else if (sc->link_duplex == HALF_DUPLEX) + ifp->if_link_state = LINK_STATE_HALF_DUPLEX; + else + ifp->if_link_state = LINK_STATE_UP; if_link_state_change(ifp); } } else { diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 93455c30d59..3af8f43ce9e 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.35 2006/11/28 04:45:08 brad Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.36 2006/12/04 14:35:20 reyk Exp $ */ #include @@ -840,7 +840,7 @@ ixgb_update_link_status(struct ixgb_softc *sc) if (!sc->link_active) { ifp->if_baudrate = 1000000000; sc->link_active = 1; - ifp->if_link_state = LINK_STATE_UP; + ifp->if_link_state = LINK_STATE_FULL_DUPLEX; if_link_state_change(ifp); } } else { diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 15f85660592..844a56c0055 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.31 2006/11/23 02:00:54 brad Exp $ */ +/* $OpenBSD: if_vge.c,v 1.32 2006/12/04 14:35:20 reyk Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1198,7 +1198,12 @@ vge_tick(void *xsc) if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->vge_link = 1; - ifp->if_link_state = LINK_STATE_UP; + if (mii->mii_media_status & IFM_FDX) + ifp->if_link_state = LINK_STATE_FULL_DUPLEX; + else if (mii->mii_media_status & IFM_HDX) + ifp->if_link_state = LINK_STATE_HALF_DUPLEX; + else + ifp->if_link_state = LINK_STATE_UP; if_link_state_change(ifp); if (!IFQ_IS_EMPTY(&ifp->if_snd)) vge_start(ifp); -- cgit v1.2.3