From 3649b613e3cbcb8fbe2b38bc9d275f892828c2f6 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 5 Oct 2008 11:57:49 +0000 Subject: Always update published link state even if the internal link state doesn't change. Prevents us from getting stuck in LINK_STATE_UNKNOWN. Fixes PR 5914. tested by deraadt@, sthen@ ok deraadt@ --- sys/dev/pci/if_em.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/dev/pci') diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 85042fc2691..0012e3bdb13 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.190 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.191 2008/10/05 11:57:48 kettenis Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -1407,6 +1407,8 @@ em_update_link_status(struct em_softc *sc) sc->link_active = 1; sc->smartspeed = 0; ifp->if_baudrate = sc->link_speed * 1000000; + } + if (!LINK_STATE_IS_UP(ifp->if_link_state)) { if (sc->link_duplex == FULL_DUPLEX) ifp->if_link_state = LINK_STATE_FULL_DUPLEX; else @@ -1418,6 +1420,8 @@ em_update_link_status(struct em_softc *sc) ifp->if_baudrate = sc->link_speed = 0; sc->link_duplex = 0; sc->link_active = 0; + } + if (ifp->if_link_state != LINK_STATE_DOWN) { ifp->if_link_state = LINK_STATE_DOWN; if_link_state_change(ifp); } -- cgit v1.2.3