svn commit: r214694 - stable/8/sys/dev/bge

Pyun YongHyeon yongari at FreeBSD.org
Tue Nov 2 22:44:51 UTC 2010


Author: yongari
Date: Tue Nov  2 22:44:51 2010
New Revision: 214694
URL: http://svn.freebsd.org/changeset/base/214694

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/8/sys/dev/bge/if_bge.c
  stable/8/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Tue Nov  2 22:30:19 2010	(r214693)
+++ stable/8/sys/dev/bge/if_bge.c	Tue Nov  2 22:44:51 2010	(r214694)
@@ -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));
 
@@ -4223,6 +4233,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/8/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/8/sys/dev/bge/if_bgereg.h	Tue Nov  2 22:30:19 2010	(r214693)
+++ stable/8/sys/dev/bge/if_bgereg.h	Tue Nov  2 22:44:51 2010	(r214694)
@@ -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


More information about the svn-src-all mailing list