Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Fix a link detect bug on non-autopoll systems. S...
details: https://anonhg.NetBSD.org/src/rev/174a05947a17
branches: trunk
changeset: 787824:174a05947a17
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Jul 05 07:08:26 2013 +0000
description:
Fix a link detect bug on non-autopoll systems. Same as OpenBSD
(rev.1.329 and 1.336) and FreeBSD (r213710).
diffstat:
sys/dev/pci/if_bge.c | 33 ++++++++++++++++++++++-----------
1 files changed, 22 insertions(+), 11 deletions(-)
diffs (76 lines):
diff -r c75742e02323 -r 174a05947a17 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c Fri Jul 05 02:18:37 2013 +0000
+++ b/sys/dev/pci/if_bge.c Fri Jul 05 07:08:26 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.255 2013/07/03 15:21:35 msaitoh Exp $ */
+/* $NetBSD: if_bge.c,v 1.256 2013/07/05 07:08:26 msaitoh Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.255 2013/07/03 15:21:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.256 2013/07/05 07:08:26 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1446,10 +1446,20 @@
* Get flow control negotiation result.
*/
if (IFM_SUBTYPE(mii->mii_media.ifm_cur->ifm_media) == IFM_AUTO &&
- (mii->mii_media_active & IFM_ETH_FMASK) != sc->bge_flowflags) {
+ (mii->mii_media_active & IFM_ETH_FMASK) != sc->bge_flowflags)
sc->bge_flowflags = mii->mii_media_active & IFM_ETH_FMASK;
- mii->mii_media_active &= ~IFM_ETH_FMASK;
- }
+
+ if (!BGE_STS_BIT(sc, BGE_STS_LINK) &&
+ mii->mii_media_status & IFM_ACTIVE &&
+ IFM_SUBTYPE(mii->mii_media_active) != 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);
+
+ if (!BGE_STS_BIT(sc, BGE_STS_LINK))
+ return;
/* Set the port mode (MII/GMII) to match the link speed. */
mac_mode = CSR_READ_4(sc, BGE_MAC_MODE) &
@@ -1464,7 +1474,7 @@
tx_mode &= ~BGE_TXMODE_FLOWCTL_ENABLE;
rx_mode &= ~BGE_RXMODE_FLOWCTL_ENABLE;
- if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) {
+ if ((mii->mii_media_active & IFM_FDX) != 0) {
if (sc->bge_flowflags & IFM_ETH_TXPAUSE)
tx_mode |= BGE_TXMODE_FLOWCTL_ENABLE;
if (sc->bge_flowflags & IFM_ETH_RXPAUSE)
@@ -5767,11 +5777,6 @@
BGE_STS_CLRBIT(sc, BGE_STS_LINK);
if_link_state_change(ifp, LINK_STATE_DOWN);
}
- /*
- * Discard link events for MII/GMII cards if MI auto-polling disabled.
- * This should not happen since mii callouts are locked now, but
- * we keep this check for debug.
- */
} else if (BGE_STS_BIT(sc, BGE_STS_AUTOPOLL)) {
/*
* Some broken BCM chips have BGE_STATFLAG_LINKSTATE_CHANGED
@@ -5793,6 +5798,12 @@
IFM_SUBTYPE(mii->mii_media_active) == IFM_NONE))
BGE_STS_CLRBIT(sc, BGE_STS_LINK);
}
+ } else {
+ /*
+ * For controllers that call mii_tick, we have to poll
+ * link status.
+ */
+ mii_pollstat(mii);
}
/* Clear the attention */
Home |
Main Index |
Thread Index |
Old Index