diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-11-28 19:21:17 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-11-28 19:21:17 +0000 |
commit | 42dc4672e2746e5183c5a29733c654f4a9644cce (patch) | |
tree | df76318348d55acb95fe86483447a0ed376640df /sys | |
parent | 0e1919712e2589382b2029732a09c5ce9488a2cb (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')
-rw-r--r-- | sys/dev/mii/mii_physubr.c | 13 | ||||
-rw-r--r-- | sys/net/if.h | 5 |
2 files changed, 13 insertions, 5 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; diff --git a/sys/net/if.h b/sys/net/if.h index ddc6f8d76a8..5c6026faba0 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.84 2006/11/16 13:09:27 henning Exp $ */ +/* $OpenBSD: if.h,v 1.85 2006/11/28 19:21:15 reyk Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -150,6 +150,9 @@ struct ifqueue { #define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */ #define LINK_STATE_DOWN 1 /* link is down */ #define LINK_STATE_UP 2 /* link is up */ +#define LINK_STATE_HALF_DUPLEX 3 /* link is up and half duplex */ +#define LINK_STATE_FULL_DUPLEX 4 /* link is up and full duplex */ +#define LINK_STATE_IS_UP(_s) ((_s) >= LINK_STATE_UP) /* * Structure defining a queue for a network interface. |