Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2005 21:30:43 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80554 for review
Message-ID:  <200507192130.j6JLUhIN091164@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80554

Change 80554 by rwatson@rwatson_zoo on 2005/07/19 21:29:46

	Merge change 80541 from rwatson_netperf to netsmp:
	
	Lock device driver use of multicast address lists on network
	interfaces.

Affected files ...

.. //depot/projects/netsmp/src/sys/dev/ath/if_ath.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/awi/awi.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/bfe/if_bfe.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/bge/if_bge.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/ed/if_ed.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/em/if_em.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/ex/if_ex.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/fe/if_fe.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/fxp/if_fxp.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/gem/if_gem.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/hme/if_hme.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/ie/if_ie.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/if_ndis/if_ndis.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/ixgb/if_ixgb.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/lge/if_lge.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/lnc/if_lnc.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/my/if_my.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/nge/if_nge.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/nve/if_nve.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/owi/if_owi.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/pdq/pdq_ifsubr.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/ray/if_ray.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/re/if_re.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/sn/if_sn.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/snc/dp83932.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/tx/if_tx.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/txp/if_txp.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_aue.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_axe.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_cue.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_kue.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_rue.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_udav.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/vge/if_vge.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/wi/if_wi.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/wl/if_wl.c#2 edit
.. //depot/projects/netsmp/src/sys/dev/xe/if_xe.c#2 edit
.. //depot/projects/netsmp/src/sys/net/if_vlan.c#2 edit
.. //depot/projects/netsmp/src/sys/net/rtsock.c#2 edit
.. //depot/projects/netsmp/src/sys/netinet/in_var.h#2 edit
.. //depot/projects/netsmp/src/sys/netinet6/in6_var.h#2 edit
.. //depot/projects/netsmp/src/sys/netinet6/mld6.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_dc.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_de.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_pcn.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_rl.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_sf.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_sis.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_sk.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_ste.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_ti.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_tl.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_vr.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_wb.c#2 edit
.. //depot/projects/netsmp/src/sys/pci/if_xl.c#2 edit

Differences ...

==== //depot/projects/netsmp/src/sys/dev/ath/if_ath.c#2 (text+ko) ====

@@ -1662,6 +1662,7 @@
 	/* calculate and install multicast filter */
 	if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
 		mfilt[0] = mfilt[1] = 0;
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			caddr_t dl;
 
@@ -1674,6 +1675,7 @@
 			pos &= 0x3f;
 			mfilt[pos / 32] |= (1 << (pos % 32));
 		}
+		IF_ADDR_UNLOCK(ifp);
 	} else {
 		mfilt[0] = mfilt[1] = ~0;
 	}

==== //depot/projects/netsmp/src/sys/dev/awi/awi.c#2 (text+ko) ====

@@ -1146,15 +1146,19 @@
 #ifdef __FreeBSD__
 	if (ifp->if_flags & IFF_ALLMULTI)
 		goto set_mib;
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
-		if (n == AWI_GROUP_ADDR_SIZE)
+		if (n == AWI_GROUP_ADDR_SIZE) {
+			IF_ADDR_UNLOCK(ifp);
 			goto set_mib;
+		}
 		IEEE80211_ADDR_COPY(sc->sc_mib_addr.aGroup_Addresses[n],
 		    LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
 		n++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 #else
 	ETHER_FIRST_MULTI(step, &sc->sc_ic.ic_ec, enm);
 	while (enm != NULL) {

==== //depot/projects/netsmp/src/sys/dev/bfe/if_bfe.c#2 (text+ko) ====

@@ -883,12 +883,14 @@
 		val |= BFE_RXCONF_ALLMULTI;
 	else {
 		val &= ~BFE_RXCONF_ALLMULTI;
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (ifma->ifma_addr->sa_family != AF_LINK)
 				continue;
 			bfe_cam_write(sc,
 			    LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++);
 		}
+		IF_ADDR_UNLOCK(ifp);
 	}
 
 	CSR_WRITE_4(sc, BFE_RXCONF, val);

==== //depot/projects/netsmp/src/sys/dev/bge/if_bge.c#2 (text+ko) ====

@@ -1171,6 +1171,7 @@
 		CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 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;
@@ -1178,6 +1179,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F;
 		hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	for (i = 0; i < 4; i++)
 		CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]);

==== //depot/projects/netsmp/src/sys/dev/ed/if_ed.c#2 (text+ko) ====

@@ -1778,6 +1778,7 @@
 	mcaf[0] = 0;
 	mcaf[1] = 0;
 
+	IF_ADDR_LOCK(sc->ifp);
 	TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1785,6 +1786,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
 		af[index >> 3] |= 1 << (index & 7);
 	}
+	IF_ADDR_UNLOCK(sc->ifp);
 }
 
 int

==== //depot/projects/netsmp/src/sys/dev/em/if_em.c#2 (text+ko) ====

@@ -1596,7 +1596,8 @@
                 E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
                 msec_delay(5);
         }
-        
+
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
         LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -1611,6 +1612,7 @@
                       &mta[mcnt*ETH_LENGTH_OF_ADDRESS], ETH_LENGTH_OF_ADDRESS);
                 mcnt++;
         }
+	IF_ADDR_UNLOCK(ifp);
 
         if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) {
                 reg_rctl = E1000_READ_REG(&adapter->hw, RCTL);

==== //depot/projects/netsmp/src/sys/dev/ex/if_ex.c#2 (text+ko) ====

@@ -840,11 +840,13 @@
 	ifp = sc->ifp;
 
 	count = 0;
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
 		if (maddr->ifma_addr->sa_family != AF_LINK)
 			continue;
 		count++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI)
 			|| count > 63) {
@@ -871,7 +873,8 @@
 		CSR_WRITE_2(sc, IO_PORT_REG, 0);
 		CSR_WRITE_2(sc, IO_PORT_REG, 0);
 		CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6);
-		
+
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
 			if (maddr->ifma_addr->sa_family != AF_LINK)
 				continue;
@@ -882,6 +885,7 @@
 			CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
 			CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
 		}
+		IF_ADDR_UNLOCK(ifp);
 
 		/* Program our MAC address as well */
 		/* XXX: Is this necessary?  The Linux driver does this

==== //depot/projects/netsmp/src/sys/dev/fe/if_fe.c#2 (text+ko) ====

@@ -2060,6 +2060,7 @@
 	struct ifmultiaddr *ifma;
 
 	filter = fe_filter_nothing;
+	IF_ADDR_LOCK(sc->ifp);
 	TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -2072,6 +2073,7 @@
 
 		filter.data[index >> 3] |= 1 << (index & 7);
 	}
+	IF_ADDR_UNLOCK(sc->ifp);
 	return ( filter );
 }
 

==== //depot/projects/netsmp/src/sys/dev/fxp/if_fxp.c#2 (text+ko) ====

@@ -2484,6 +2484,7 @@
 
 	nmcasts = 0;
 	if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0) {
+		IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
 		LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -2500,6 +2501,7 @@
 			    &sc->mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN);
 			nmcasts++;
 		}
+		IF_ADDR_UNLOCK(ifp);
 	}
 	mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN);
 	return (nmcasts);

==== //depot/projects/netsmp/src/sys/dev/gem/if_gem.c#2 (text+ko) ====

@@ -1894,6 +1894,7 @@
 	/* Clear hash table */
 	memset(hash, 0, sizeof(hash));
 
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
 		if (inm->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1906,6 +1907,7 @@
 		/* Set the corresponding bit in the filter. */
 		hash[crc >> 4] |= 1 << (15 - (crc & 15));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	v |= GEM_MAC_RX_HASH_FILTER;
 	ifp->if_flags &= ~IFF_ALLMULTI;

==== //depot/projects/netsmp/src/sys/dev/hme/if_hme.c#2 (text+ko) ====

@@ -1679,6 +1679,7 @@
 	 * the word.
 	 */
 
+	IF_ADDR_LOCK(sc->sc_ifp);
 	TAILQ_FOREACH(inm, &sc->sc_ifp->if_multiaddrs, ifma_link) {
 		if (inm->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1691,6 +1692,7 @@
 		/* Set the corresponding bit in the filter. */
 		hash[crc >> 4] |= 1 << (crc & 0xf);
 	}
+	IF_ADDR_UNLOCK(sc->sc_ifp);
 
 	ifp->if_flags &= ~IFF_ALLMULTI;
 

==== //depot/projects/netsmp/src/sys/dev/ie/if_ie.c#2 (text+ko) ====

@@ -1676,6 +1676,7 @@
 	 * Step through the list of addresses.
 	 */
 	sc->mcast_count = 0;
+	IF_ADDR_LOCK(sc->ifp);
 	TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1690,6 +1691,7 @@
 		      &(sc->mcast_addrs[sc->mcast_count]), 6);
 		sc->mcast_count++;
 	}
+	IF_ADDR_UNLOCK(sc->ifp);
 
 setflag:
 	sc->want_mcsetup = 1;

==== //depot/projects/netsmp/src/sys/dev/if_ndis/if_ndis.c#2 (text+ko) ====

@@ -265,6 +265,7 @@
 	sc->ndis_filter |= NDIS_PACKET_TYPE_MULTICAST;
 
 	len = 0;
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -272,11 +273,13 @@
 		    mclist + (ETHER_ADDR_LEN * len), ETHER_ADDR_LEN);
 		len++;
 		if (len > mclistsz) {
+			IF_ADDR_UNLOCK(ifp);
 			sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
 			sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST;
 			goto out;
 		}
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	len = len * ETHER_ADDR_LEN;
 	error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len);

==== //depot/projects/netsmp/src/sys/dev/ixgb/if_ixgb.c#2 (text+ko) ====

@@ -1065,6 +1065,7 @@
 
 	IOCTL_DEBUGOUT("ixgb_set_multi: begin");
 
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
 	LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -1077,6 +1078,7 @@
 		      &mta[mcnt * IXGB_ETH_LENGTH_OF_ADDRESS], IXGB_ETH_LENGTH_OF_ADDRESS);
 		mcnt++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (mcnt > MAX_NUM_MULTICAST_ADDRESSES) {
 		reg_rctl = IXGB_READ_REG(&adapter->hw, RCTL);

==== //depot/projects/netsmp/src/sys/dev/lge/if_lge.c#2 (text+ko) ====

@@ -390,6 +390,7 @@
 	CSR_WRITE_4(sc, LGE_MAR1, 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;
@@ -400,6 +401,7 @@
 		else
 			hashes[1] |= (1 << (h - 32));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	CSR_WRITE_4(sc, LGE_MAR0, hashes[0]);
 	CSR_WRITE_4(sc, LGE_MAR1, hashes[1]);

==== //depot/projects/netsmp/src/sys/dev/lnc/if_lnc.c#2 (text+ko) ====

@@ -239,6 +239,7 @@
 	 */
 
 	bzero(sc->init_block->ladrf, MULTICAST_FILTER_LEN);
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -247,6 +248,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
 		sc->init_block->ladrf[index >> 3] |= 1 << (index & 7);
 	}
+	IF_ADDR_UNLOCK(ifp);
 }
 
 void

==== //depot/projects/netsmp/src/sys/dev/my/if_my.c#2 (text+ko) ====

@@ -346,6 +346,7 @@
 	CSR_WRITE_4(sc, MY_MAR1, 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;
@@ -357,6 +358,7 @@
 			hashes[1] |= (1 << (h - 32));
 		mcnt++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (mcnt)
 		rxfilt |= MY_AM;

==== //depot/projects/netsmp/src/sys/dev/nge/if_nge.c#2 (text+ko) ====

@@ -705,6 +705,7 @@
 	 * that needs to be updated, and the lower 4 bits represent
 	 * which bit within that byte needs to be set.
 	 */
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -716,6 +717,7 @@
 		    NGE_FILTADDR_MCAST_LO + (index * 2));
 		NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	CSR_WRITE_4(sc, NGE_RXFILT_CTL, filtsave);
 

==== //depot/projects/netsmp/src/sys/dev/nve/if_nve.c#2 (text+ko) ====

@@ -1074,6 +1074,7 @@
 		return;
 	}
 	/* Setup multicast filter */
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		u_char *addrp;
 
@@ -1087,6 +1088,7 @@
 			oraddr[i] |= mcaddr;
 		}
 	}
+	IF_ADDR_UNLOCK(ifp);
 	for (i = 0; i < 6; i++) {
 		hwfilter.acMulticastAddress[i] = andaddr[i] & oraddr[i];
 		hwfilter.acMulticastMask[i] = andaddr[i] | (~oraddr[i]);

==== //depot/projects/netsmp/src/sys/dev/owi/if_owi.c#2 (text+ko) ====

@@ -1213,6 +1213,7 @@
 		return;
 	}
 
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1225,6 +1226,7 @@
 			break;
 		}
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	mcast.wi_len = (i * 3) + 1;
 	wi_write_record(sc, (struct wi_ltv_gen *)&mcast);

==== //depot/projects/netsmp/src/sys/dev/pdq/pdq_ifsubr.c#2 (text+ko) ====

@@ -273,6 +273,7 @@
     PDQ_IFNET(sc)->if_flags &= ~IFF_ALLMULTI;
 #endif
 
+    IF_ADDR_LOCK(PDQ_IFNET(sc));
     for (ifma = TAILQ_FIRST(&PDQ_IFNET(sc)->if_multiaddrs); ifma && num_addrs > 0;
 	 ifma = TAILQ_NEXT(ifma, ifma_link)) {
 	    char *mcaddr;
@@ -285,6 +286,7 @@
 	    addr++;
 	    num_addrs--;
     }
+    IF_ADDR_UNLOCK(PDQ_IFNET(sc));
     /*
      * If not all the address fit into the CAM, turn on all-multicast mode.
      */

==== //depot/projects/netsmp/src/sys/dev/ray/if_ray.c#2 (text+ko) ====

@@ -2704,6 +2704,7 @@
 	 * The multicast list is only 16 items long so use promiscuous
 	 * mode and don't bother updating the multicast list.
 	 */
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 		count++;
 	if (count == 0) {
@@ -2711,6 +2712,7 @@
 		return;
 	} else if (count > 16) {
 		ifp->if_flags |= IFF_ALLMULTI;
+		IF_ADDR_UNLOCK(ifp);
 		ray_com_runq_done(sc);
 		return;
 	} else if (ifp->if_flags & IFF_ALLMULTI)
@@ -2732,6 +2734,7 @@
 		);
 		bufp += ETHER_ADDR_LEN;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	ray_com_ecf(sc, com);
 }

==== //depot/projects/netsmp/src/sys/dev/re/if_re.c#2 (text+ko) ====

@@ -601,6 +601,7 @@
 	CSR_WRITE_4(sc, RL_MAR4, 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;
@@ -612,6 +613,7 @@
 			hashes[1] |= (1 << (h - 32));
 		mcnt++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (mcnt)
 		rxfilt |= RL_RXCFG_RX_MULTI;

==== //depot/projects/netsmp/src/sys/dev/sn/if_sn.c#2 (text+ko) ====

@@ -1410,6 +1410,7 @@
 
 	bzero(mcf, MCFSZ);
 
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 	    if (ifma->ifma_addr->sa_family != AF_LINK)
 		return 0;
@@ -1423,5 +1424,6 @@
 	    }
 	    af[index2 >> 3] |= 1 << (index2 & 7);
 	}
+	IF_ADDR_UNLOCK(ifp);
 	return 1;  /* use multicast filter */
 }

==== //depot/projects/netsmp/src/sys/dev/snc/dp83932.c#2 (text+ko) ====

@@ -675,6 +675,7 @@
 	ifp->if_flags &= ~IFF_ALLMULTI;
 
 	/* Loop through multicast addresses */
+	IF_ADDR_LOCK(ifp);
         TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
                 if (ifma->ifma_addr->sa_family != AF_LINK)
                         continue;
@@ -688,6 +689,7 @@
 			 LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
 		mcount++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	NIC_PUT(sc, SNCR_CDP, LOWER(sc->v_cda));
 	NIC_PUT(sc, SNCR_CDC, MAXCAM);

==== //depot/projects/netsmp/src/sys/dev/tx/if_tx.c#2 (text+ko) ====

@@ -1409,6 +1409,7 @@
 	filter[2] = 0;
 	filter[3] = 0;
 
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
 	LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -1420,6 +1421,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
 		filter[h >> 4] |= 1 << (h & 0xF);
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	CSR_WRITE_4(sc, MC0, filter[0]);
 	CSR_WRITE_4(sc, MC1, filter[1]);

==== //depot/projects/netsmp/src/sys/dev/txp/if_txp.c#2 (text+ko) ====

@@ -1774,6 +1774,7 @@
 	else {
 		hash[0] = hash[1] = 0;
 
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (ifma->ifma_addr->sa_family != AF_LINK)
 				continue;
@@ -1797,6 +1798,7 @@
 			hashbit = (u_int16_t)(crc & (64 - 1));
 			hash[hashbit / 32] |= (1 << hashbit % 32);
 		}
+		IF_ADDR_UNLOCK(ifp);
 
 		if (mcnt > 0) {
 			filter |= TXP_RXFILT_HASHMULTI;

==== //depot/projects/netsmp/src/sys/dev/usb/if_aue.c#2 (text+ko) ====

@@ -539,6 +539,7 @@
 		aue_csr_write_1(sc, AUE_MAR0 + i, 0);
 
 	/* now program new ones */
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -551,6 +552,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1);
 		AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	return;
 }

==== //depot/projects/netsmp/src/sys/dev/usb/if_axe.c#2 (text+ko) ====

@@ -338,6 +338,7 @@
 	} else
 		rxmode &= ~AXE_RXCMD_ALLMULTI;
 
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -350,6 +351,7 @@
 		    ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
 		hashtbl[h / 8] |= 1 << (h % 8);
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl);
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);

==== //depot/projects/netsmp/src/sys/dev/usb/if_cue.c#2 (text+ko) ====

@@ -356,6 +356,7 @@
 		sc->cue_mctab[i] = 0;
 
 	/* now program new ones */
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -367,6 +368,7 @@
 		h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
 		sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	/*
 	 * Also include the broadcast address in the filter

==== //depot/projects/netsmp/src/sys/dev/usb/if_kue.c#2 (text+ko) ====

@@ -327,6 +327,7 @@
 
 	sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI;
 
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -345,6 +346,7 @@
 		    KUE_MCFILT(sc, i), ETHER_ADDR_LEN);
 		i++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (i == KUE_MCFILTCNT(sc))
 		sc->kue_rxfilt |= KUE_RXFILT_ALLMULTI;

==== //depot/projects/netsmp/src/sys/dev/usb/if_rue.c#2 (text+ko) ====

@@ -500,6 +500,7 @@
 	rue_csr_write_4(sc, RUE_MAR4, 0);
 
 	/* now program new ones */
+	IF_ADDR_LLOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -516,6 +517,7 @@
 			hashes[1] |= (1 << (h - 32));
 		mcnt++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (mcnt)
 		rxcfg |= RUE_RCR_AM;

==== //depot/projects/netsmp/src/sys/dev/usb/if_udav.c#2 (text+ko) ====

@@ -1044,6 +1044,7 @@
 		ETHER_NEXT_MULTI(step, enm);
 	}
 #elif defined(__FreeBSD__)
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version >= 500000
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
 #else
@@ -1056,6 +1057,7 @@
 		    ifma->ifma_addr));
 		hashes[h>>3] |= 1 << (h & 0x7);
 	}
+	IF_ADDR_UNLOCK(ifp);
 #endif
 
 	/* disable all multicast */

==== //depot/projects/netsmp/src/sys/dev/vge/if_vge.c#2 (text+ko) ====

@@ -594,6 +594,7 @@
 	}
 
 	/* 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;
@@ -626,6 +627,7 @@
 		CSR_WRITE_4(sc, VGE_MAR0, hashes[0]);
 		CSR_WRITE_4(sc, VGE_MAR1, hashes[1]);
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	return;
 }

==== //depot/projects/netsmp/src/sys/dev/wi/if_wi.c#2 (text+ko) ====

@@ -1739,6 +1739,7 @@
 	}
 
 	n = 0;
+	IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
 	LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -1752,6 +1753,7 @@
 		    (LLADDR((struct sockaddr_dl *)ifma->ifma_addr)));
 		n++;
 	}
+	IF_ADDR_UNLOCK(ifp);
 	return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist,
 	    IEEE80211_ADDR_LEN * n);
 }

==== //depot/projects/netsmp/src/sys/dev/wl/if_wl.c#2 (text+ko) ====

@@ -2121,6 +2121,7 @@
     outw(PIOP1(base), 0);				/* ac_status */
     outw(PIOP1(base), AC_MCSETUP|AC_CW_EL);		/* ac_command */
     outw(PIOR1(base), OFFSET_CU + 8);
+    IF_ADDR_LOCK(sc->ifp);
     TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
 	if (ifma->ifma_addr->sa_family != AF_LINK)
 	    continue;
@@ -2131,6 +2132,7 @@
         outw(PIOP1(base), addrp[4] + (addrp[5] << 8));
         ++cnt;
     }
+    IF_ADDR_UNLOCK(sc->ifp);
     outw(PIOR1(base), OFFSET_CU + 6);		/* mc-cnt */
     outw(PIOP1(base), cnt * WAVELAN_ADDR_SIZE);
     if (wlcmd(sc, "config()-mcaddress") == 0)

==== //depot/projects/netsmp/src/sys/dev/xe/if_xe.c#2 (text+ko) ====

@@ -1274,6 +1274,7 @@
 
   /* Iterate over multicast address list */
   count = 0;
+  IF_ADDR_LOCK(ifp);
 #if __FreeBSD_version < 500000
   LIST_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
 #else
@@ -1295,6 +1296,7 @@
 	/* Nowhere else to put them on CE2 */
 	break;
   }
+  IF_ADDR_UNLOCK(ifp);
 
   DEVPRINTF(2, (scp->dev, "set_multicast: count = %u\n", count));
 

==== //depot/projects/netsmp/src/sys/net/if_vlan.c#2 (text+ko) ====

@@ -188,21 +188,27 @@
 	}
 
 	/* 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;
 		mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT);
-		if (mc == NULL)
+		if (mc == NULL) {
+			IF_ADDR_UNLOCK(ifp);
 			return (ENOMEM);
+		}
 		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
 		    (char *)&mc->mc_addr, ETHER_ADDR_LEN);
 		SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
 		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
 		    LLADDR(&sdl), ETHER_ADDR_LEN);
 		error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
-		if (error)
+		if (error) {
+			IF_ADDR_UNLOCK(ifp);
 			return (error);
+		}
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	return (0);
 }

==== //depot/projects/netsmp/src/sys/net/rtsock.c#2 (text+ko) ====

@@ -1178,6 +1178,11 @@
 			continue;
 		ifa = ifaddr_byindex(ifp->if_index);
 		info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL;
+
+		/*
+		 * XXXRW: Can't acquire IF_ADDR_LOCK() due to call
+	 	 * to SYSCTL_OUT().
+		 */
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (af && af != ifma->ifma_addr->sa_family)
 				continue;

==== //depot/projects/netsmp/src/sys/netinet/in_var.h#2 (text+ko) ====

@@ -177,6 +177,8 @@
 /*
  * Macro for looking up the in_multi record for a given IP multicast address
  * on a given interface.  If no matching record is found, "inm" is set null.
+ *
+ * Caller must hold IF_ADDR_LOCK().
  */
 #define IN_LOOKUP_MULTI(addr, ifp, inm) \
 	/* struct in_addr addr; */ \
@@ -185,6 +187,7 @@
 do { \
 	struct ifmultiaddr *ifma; \
 \
+	IF_ADDR_LOCK_ASSERT(ifp);
 	TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \
 		if (ifma->ifma_addr->sa_family == AF_INET \
 		    && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \

==== //depot/projects/netsmp/src/sys/netinet6/in6_var.h#2 (text+ko) ====

@@ -535,6 +535,8 @@
  * Macros for looking up the in6_multi record for a given IP6 multicast
  * address on a given interface. If no matching record is found, "in6m"
  * returns NLL.
+ *
+ * Caller must hold IF_ADDR_LOCK(ifp).
  */
 
 #define IN6_LOOKUP_MULTI(addr, ifp, in6m)			\
@@ -543,6 +545,7 @@
 /* struct in6_multi *in6m; */					\
 do { \
 	struct ifmultiaddr *ifma; \
+	IF_ADDR_LOCK_ASSERT(ifp); \
 	TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \
 		if (ifma->ifma_addr->sa_family == AF_INET6 \
 		    && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \

==== //depot/projects/netsmp/src/sys/netinet6/mld6.c#2 (text+ko) ====

@@ -266,6 +266,7 @@
 		mld6_all_nodes_linklocal.s6_addr16[1] =
 			htons(ifp->if_index); /* XXX */
 
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (ifma->ifma_addr->sa_family != AF_INET6)
 				continue;
@@ -296,6 +297,7 @@
 				}
 			}
 		}
+		IF_ADDR_UNLOCK(ifp);
 
 		if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr))
 			mldh->mld_addr.s6_addr16[1] = 0; /* XXX */

==== //depot/projects/netsmp/src/sys/pci/if_dc.c#2 (text+ko) ====

@@ -1110,6 +1110,7 @@
 	else
 		DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
 
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1117,6 +1118,7 @@
 		    LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
 		sp[h >> 4] |= htole32(1 << (h & 0xF));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (ifp->if_flags & IFF_BROADCAST) {
 		h = dc_mchash_le(sc, ifp->if_broadcastaddr);
@@ -1179,6 +1181,7 @@
 		return;
 
 	/* 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;
@@ -1193,6 +1196,7 @@
 		else
 			hashes[1] |= (1 << (h - 32));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]);
 	CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]);
@@ -1250,6 +1254,7 @@
 		return;
 
 	/* 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;
@@ -1259,6 +1264,7 @@
 		else
 			hashes[1] |= (1 << (h - 32));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0);
 	CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]);
@@ -1302,6 +1308,7 @@
 	else
 		DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
 
+	IF_ADDR_LOCK(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
 			continue;
@@ -1309,6 +1316,7 @@
 		    LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
 		sp[h >> 4] |= htole32(1 << (h & 0xF));
 	}
+	IF_ADDR_UNLOCK(ifp);
 
 	if (ifp->if_flags & IFF_BROADCAST) {
 		h = dc_mchash_le(sc, ifp->if_broadcastaddr);

==== //depot/projects/netsmp/src/sys/pci/if_de.c#2 (text+ko) ====

@@ -3003,6 +3003,7 @@
 #endif
 
     multicnt = 0;
+    IF_ADDR_LOCK(sc->tulip_ifp);
     TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) {
 
 	    if (ifma->ifma_addr->sa_family == AF_LINK)
@@ -3125,6 +3126,7 @@
 #endif
 	}
     }
+    IF_ADDR_UNLOCK(sc->tulip_ifp);
 #if defined(IFF_ALLMULTI)
     if (sc->tulip_flags & TULIP_ALLMULTI)
 	sc->tulip_ifp->if_flags |= IFF_ALLMULTI;

==== //depot/projects/netsmp/src/sys/pci/if_pcn.c#2 (text+ko) ====


>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507192130.j6JLUhIN091164>