summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2006-11-28 19:21:17 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2006-11-28 19:21:17 +0000
commit42dc4672e2746e5183c5a29733c654f4a9644cce (patch)
treedf76318348d55acb95fe86483447a0ed376640df /sys/dev
parent0e1919712e2589382b2029732a09c5ce9488a2cb (diff)
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@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mii/mii_physubr.c13
1 files changed, 9 insertions, 4 deletions
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;