Date: Tue, 2 Nov 2010 22:48:52 +0000 (UTC) From: Pyun YongHyeon <yongari@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r214696 - stable/7/sys/dev/bge Message-ID: <201011022248.oA2MmqSL094684@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: yongari Date: Tue Nov 2 22:48:52 2010 New Revision: 214696 URL: http://svn.freebsd.org/changeset/base/214696 Log: MFC r213081,213225,213280: r213081: Always show asic/chip revision in device attach phase. There are too many bge(4) controllers there and model name does not necessarily match asic/chip revision. Relying on VPD string made it hard to identify exact asic/chip revision so the first step to debug bge(4) was getting exact asic/chip information with verbose boot which may not be available on production server. r213255: Set the number of RX frames to receive after RX MBUF low watermark has reached. This reduced number of dropped frames when flow-control is enabled. Previously it dropped incoming frames once RX MBUF low watermark has reached. The value used in MAC RX MBUF low watermark is greater than or equal to 4 so receiving two more RX frames should not be a problem. Obtained from: OpenBSD r213280: After r207391, brgphy(4) passes resolved flow-control settings to parent driver. Use that information to configure flow-control. One drawback is there is no way to disable flow-control as we still don't have proper way to not advertise RX/TX pause capability to link partner. But I don't think it would cause severe problems and users can selectively disable flow-control in switch port. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:48:18 2010 (r214695) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:48:52 2010 (r214696) @@ -882,10 +882,21 @@ bge_miibus_statchg(device_t dev) else BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_MII); - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) + if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) { BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); - else + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) + BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) + BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } else { BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } } /* @@ -2644,12 +2655,11 @@ bge_attach(device_t dev) goto fail; } - if (bootverbose) - device_printf(dev, - "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", - sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, - (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : - ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); + device_printf(dev, + "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", + sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, + (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : + ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); BGE_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -4219,6 +4229,14 @@ bge_init_locked(struct bge_softc *sc) /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); + /* + * Set the number of good frames to receive after RX MBUF + * Low Watermark has been reached. After the RX MAC receives + * this number of frames, it will drop subsequent incoming + * frames until the MBUF High Watermark is reached. + */ + CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:48:18 2010 (r214695) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:48:52 2010 (r214696) @@ -632,6 +632,7 @@ #define BGE_RX_BD_RULES_CTL15 0x04F8 #define BGE_RX_BD_RULES_MASKVAL15 0x04FC #define BGE_RX_RULES_CFG 0x0500 +#define BGE_MAX_RX_FRAME_LOWAT 0x0504 #define BGE_SERDES_CFG 0x0590 #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011022248.oA2MmqSL094684>