summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2006-12-04 14:35:21 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2006-12-04 14:35:21 +0000
commit6961c0f1d598184fe794e20b8ad22a9b949e5edf (patch)
treed6a51cd5257341057a5961e08113fe554f11dff8 /sys/dev
parent55899a0de13423b13a2121ec51128031dd5a6936 (diff)
report full/half duplex state for non-MII interfaces
ok brad@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_bge.c8
-rw-r--r--sys/dev/pci/if_em.c9
-rw-r--r--sys/dev/pci/if_ixgb.c4
-rw-r--r--sys/dev/pci/if_vge.c9
4 files changed, 22 insertions, 8 deletions
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 <dev/pci/if_em.h>
@@ -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 <dev/pci/if_ixgb.h>
@@ -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);