summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-05-09 06:30:41 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-05-09 06:30:41 +0000
commitb9923405e2471cfa74a023e4e5af5e70a74ffec9 (patch)
tree2633a8f2e3c76fb367e98f457970c3eb0587e3e7
parent537b4a46ccabb1f2e4c4c19a4a221797d8f8b9f6 (diff)
Attempt to fix link status change handling so that the proper RTM_IFINFO
messages are generated when links go down or come up. Works on available devices, put in tree to encourage wide testing. Enables latest dhclient changes to work their magic on bge. Feedback from brad@ ok deraadt@ beck@ reyk@
-rw-r--r--sys/dev/pci/if_bge.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 3682b3be2e8..a7709c21a18 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.226 2008/04/20 01:37:35 brad Exp $ */
+/* $OpenBSD: if_bge.c,v 1.227 2008/05/09 06:30:40 krw Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -3522,15 +3522,14 @@ bge_link_upd(struct bge_softc *sc)
timeout_del(&sc->bge_timeout);
bge_tick(sc);
- if (!BGE_STS_BIT(sc, BGE_STS_LINK) &&
+ if (BGE_STS_BIT(sc, BGE_STS_LINK))
+ BGE_STS_CLRBIT(sc, BGE_STS_LINK);
+
+ else if (!BGE_STS_BIT(sc, BGE_STS_LINK) &&
mii->mii_media_status & IFM_ACTIVE &&
- IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
+ (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) &&
+ (IFM_SUBTYPE(mii->mii_media_active) != (IFM_ETHER|IFM_NONE)))
BGE_STS_SETBIT(sc, BGE_STS_LINK);
- } else if (BGE_STS_BIT(sc, BGE_STS_LINK) &&
- (!(mii->mii_media_status & IFM_ACTIVE) ||
- IFM_SUBTYPE(mii->mii_media_active) == IFM_NONE)) {
- BGE_STS_CLRBIT(sc, BGE_STS_LINK);
- }
/* Clear the interrupt */
CSR_WRITE_4(sc, BGE_MAC_EVT_ENB,
@@ -3582,14 +3581,14 @@ bge_link_upd(struct bge_softc *sc)
timeout_del(&sc->bge_timeout);
bge_tick(sc);
- if (!BGE_STS_BIT(sc, BGE_STS_LINK) &&
+ if (BGE_STS_BIT(sc, BGE_STS_LINK))
+ BGE_STS_CLRBIT(sc, BGE_STS_LINK);
+
+ else if (!BGE_STS_BIT(sc, BGE_STS_LINK) &&
mii->mii_media_status & IFM_ACTIVE &&
- IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
+ (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) &&
+ (IFM_SUBTYPE(mii->mii_media_active) != (IFM_ETHER|IFM_NONE)))
BGE_STS_SETBIT(sc, BGE_STS_LINK);
- else if (BGE_STS_BIT(sc, BGE_STS_LINK) &&
- (!(mii->mii_media_status & IFM_ACTIVE) ||
- IFM_SUBTYPE(mii->mii_media_active) == IFM_NONE))
- BGE_STS_CLRBIT(sc, BGE_STS_LINK);
}
}