From 42dc4672e2746e5183c5a29733c654f4a9644cce Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Tue, 28 Nov 2006 19:21:17 +0000 Subject: add additional link states to report the half duplex / full duplex state, if known by the driver. this is required to check the full duplex state without depending on the ifmedia ioctl which can't be called in the kernel without process context. ok henning@, brad@ --- sys/dev/mii/mii_physubr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 7819763afe3..b243abb64af 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mii_physubr.c,v 1.27 2005/11/06 21:46:18 brad Exp $ */ +/* $OpenBSD: mii_physubr.c,v 1.28 2006/11/28 19:21:15 reyk Exp $ */ /* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */ /*- @@ -350,9 +350,14 @@ mii_phy_statusmsg(struct mii_softc *sc) int baudrate, link_state, announce = 0; if (mii->mii_media_status & IFM_AVALID) { - if (mii->mii_media_status & IFM_ACTIVE) - link_state = LINK_STATE_UP; - else + if (mii->mii_media_status & IFM_ACTIVE) { + if (mii->mii_media_status & IFM_FDX) + link_state = LINK_STATE_FULL_DUPLEX; + else if (mii->mii_media_status & IFM_HDX) + link_state = LINK_STATE_HALF_DUPLEX; + else + link_state = LINK_STATE_UP; + } else link_state = LINK_STATE_DOWN; } else link_state = LINK_STATE_UNKNOWN; -- cgit v1.2.3