svn commit: r207711 - stable/7/sys/dev/sge

Pyun YongHyeon yongari at FreeBSD.org
Thu May 6 18:26:43 UTC 2010


Author: yongari
Date: Thu May  6 18:26:43 2010
New Revision: 207711
URL: http://svn.freebsd.org/changeset/base/207711

Log:
  MFC r207375-207377.
  r207375:
    Preserve unknown bits of RX MAC control register when driver
    programs RX filter configuration. It seems RX MAC control register
    is one of key registers to get various offloading features as well
    as performance. Blindly clearing unrelated bits can result in
    unexpected results.
  
    Tested by:    xclin <xclin <> cs dot nctu dot edu dot tw >
  
  r207376:
    Remove wrong link state chage.
  
  r207377:
    Explicitly marks SiS190 to differentiate it from SiS191.

Modified:
  stable/7/sys/dev/sge/if_sge.c
  stable/7/sys/dev/sge/if_sgereg.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/sge/if_sge.c
==============================================================================
--- stable/7/sys/dev/sge/if_sge.c	Thu May  6 18:17:36 2010	(r207710)
+++ stable/7/sys/dev/sge/if_sge.c	Thu May  6 18:26:43 2010	(r207711)
@@ -453,8 +453,9 @@ sge_rxfilter(struct sge_softc *sc)
 	SGE_LOCK_ASSERT(sc);
 
 	ifp = sc->sge_ifp;
-	hashes[0] = hashes[1] = 0;
-	rxfilt = AcceptMyPhys;
+	rxfilt = CSR_READ_2(sc, RxMacControl);
+	rxfilt &= ~(AcceptBroadcast | AcceptAllPhys | AcceptMulticast);
+	rxfilt |= AcceptMyPhys;
 	if ((ifp->if_flags & IFF_BROADCAST) != 0)
 		rxfilt |= AcceptBroadcast;
 	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
@@ -463,20 +464,20 @@ sge_rxfilter(struct sge_softc *sc)
 		rxfilt |= AcceptMulticast;
 		hashes[0] = 0xFFFFFFFF;
 		hashes[1] = 0xFFFFFFFF;
-		goto done;
-	}
-	rxfilt |= AcceptMulticast;
-	/* Now program new ones. */
-	IF_ADDR_LOCK(ifp);
-	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-		crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-		    ifma->ifma_addr), ETHER_ADDR_LEN);
-		hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+	} else {
+		rxfilt |= AcceptMulticast;
+		hashes[0] = hashes[1] = 0;
+		/* Now program new ones. */
+		IF_ADDR_LOCK(ifp);
+		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+			if (ifma->ifma_addr->sa_family != AF_LINK)
+				continue;
+			crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+			    ifma->ifma_addr), ETHER_ADDR_LEN);
+			hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		}
+		IF_ADDR_UNLOCK(ifp);
 	}
-	IF_ADDR_UNLOCK(ifp);
-done:
 	CSR_WRITE_2(sc, RxMacControl, rxfilt | 0x02);
 	CSR_WRITE_4(sc, RxHashTable, hashes[0]);
 	CSR_WRITE_4(sc, RxHashTable2, hashes[1]);
@@ -571,7 +572,7 @@ sge_attach(device_t dev)
 	}
 	sc->sge_rev = pci_get_revid(dev);
 	if (pci_get_device(dev) == SIS_DEVICEID_190)
-		sc->sge_flags |= SGE_FLAG_FASTETHER;
+		sc->sge_flags |= SGE_FLAG_FASTETHER | SGE_FLAG_SIS190;
 	/* Reset the adapter. */
 	sge_reset(sc);
 
@@ -1590,7 +1591,6 @@ sge_ifmedia_upd(struct ifnet *ifp)
 	sc = ifp->if_softc;
 	SGE_LOCK(sc);
 	mii = device_get_softc(sc->sge_miibus);
-	sc->sge_flags &= ~SGE_FLAG_LINK;
 	if (mii->mii_instance) {
 		struct mii_softc *miisc;
 		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)

Modified: stable/7/sys/dev/sge/if_sgereg.h
==============================================================================
--- stable/7/sys/dev/sge/if_sgereg.h	Thu May  6 18:17:36 2010	(r207710)
+++ stable/7/sys/dev/sge/if_sgereg.h	Thu May  6 18:26:43 2010	(r207711)
@@ -331,6 +331,7 @@ struct sge_softc {
 	int			sge_timer;
 	int			sge_flags;
 #define	SGE_FLAG_FASTETHER	0x0001
+#define	SGE_FLAG_SIS190		0x0002
 #define	SGE_FLAG_RGMII		0x0010
 #define	SGE_FLAG_SPEED_1000	0x2000
 #define	SGE_FLAG_FDX		0x4000


More information about the svn-src-all mailing list