From b9923405e2471cfa74a023e4e5af5e70a74ffec9 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Fri, 9 May 2008 06:30:41 +0000 Subject: 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@ --- sys/dev/pci/if_bge.c | 27 +++++++++++++-------------- 1 file 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); } } -- cgit v1.2.3