1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/

IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs.  This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by:	re (kib)
MFC after:	6 weeks
This commit is contained in:
Robert Watson 2009-06-26 11:45:06 +00:00
parent be80e49a01
commit eb956cd041
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195049
74 changed files with 165 additions and 169 deletions

View File

@ -413,7 +413,7 @@ ate_setmcast(struct ate_softc *sc)
*/
mcaf[0] = 0;
mcaf[1] = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -421,14 +421,14 @@ ate_setmcast(struct ate_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
af[index >> 3] |= 1 << (index & 7);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/*
* Write the hash to the hash register. This card can also
* accept unicast packets as well as multicast packets using this
* register for easier bridging operations, but we don't take
* advantage of that. Locks here are to avoid LOR with the
* IF_ADDR_LOCK, but might not be strictly necessary.
* if_maddr_rlock, but might not be strictly necessary.
*/
WR4(sc, ETH_HSL, mcaf[0]);
WR4(sc, ETH_HSH, mcaf[1]);

View File

@ -435,7 +435,7 @@ npe_setmcast(struct npe_softc *sc)
memset(clr, 0, ETHER_ADDR_LEN);
memset(set, 0xff, ETHER_ADDR_LEN);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -445,7 +445,7 @@ npe_setmcast(struct npe_softc *sc)
set[i] &= mac[i];
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < ETHER_ADDR_LEN; i++) {
mask[i] = set[i] | ~clr[i];

View File

@ -2073,7 +2073,7 @@ ae_rxfilter(ae_softc_t *sc)
* Load multicast tables.
*/
bzero(mchash, sizeof(mchash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2081,7 +2081,7 @@ ae_rxfilter(ae_softc_t *sc)
ifma->ifma_addr), ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]);
AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]);
AE_WRITE_4(sc, AE_MAC_REG, rxcfg);

View File

@ -3131,7 +3131,7 @@ age_rxfilter(struct age_softc *sc)
/* Program new filter. */
bzero(mchash, sizeof(mchash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -3139,7 +3139,7 @@ age_rxfilter(struct age_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
CSR_WRITE_4(sc, AGE_MAR1, mchash[1]);

View File

@ -3446,7 +3446,7 @@ alc_rxfilter(struct alc_softc *sc)
goto chipit;
}
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -3454,7 +3454,7 @@ alc_rxfilter(struct alc_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
chipit:
CSR_WRITE_4(sc, ALC_MAR0, mchash[0]);

View File

@ -3048,7 +3048,7 @@ ale_rxfilter(struct ale_softc *sc)
/* Program new filter. */
bzero(mchash, sizeof(mchash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -3056,7 +3056,7 @@ ale_rxfilter(struct ale_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, ALE_MAR0, mchash[0]);
CSR_WRITE_4(sc, ALE_MAR1, mchash[1]);

View File

@ -2408,7 +2408,7 @@ ath_update_mcast(struct ifnet *ifp)
* Merge multicast addresses to form the hardware filter.
*/
mfilt[0] = mfilt[1] = 0;
IF_ADDR_LOCK(ifp); /* XXX need some fiddling to remove? */
if_maddr_rlock(ifp); /* XXX need some fiddling to remove? */
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
caddr_t dl;
u_int32_t val;
@ -2423,7 +2423,7 @@ ath_update_mcast(struct ifnet *ifp)
pos &= 0x3f;
mfilt[pos / 32] |= (1 << (pos % 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
} else
mfilt[0] = mfilt[1] = ~0;
ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]);

View File

@ -7260,7 +7260,7 @@ bce_set_rx_mode(struct bce_softc *sc)
/* Accept one or more multicast(s). */
DBPRINT(sc, BCE_INFO_MISC, "Enabling selective multicast mode.\n");
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -7268,7 +7268,7 @@ bce_set_rx_mode(struct bce_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF;
hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < NUM_MC_HASH_REGISTERS; i++)
REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]);

View File

@ -1111,14 +1111,14 @@ bfe_set_rx_mode(struct bfe_softc *sc)
val |= BFE_RXCONF_ALLMULTI;
else {
val &= ~BFE_RXCONF_ALLMULTI;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(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);
if_maddr_runlock(ifp);
}
CSR_WRITE_4(sc, BFE_RXCONF, val);

View File

@ -1186,7 +1186,7 @@ bge_setmulti(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0);
/* Now program new ones. */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1194,7 +1194,7 @@ bge_setmulti(struct bge_softc *sc)
ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F;
hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < 4; i++)
CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]);

View File

@ -1072,7 +1072,7 @@ bm_setladrf(struct bm_softc *sc)
/* Clear the hash table. */
memset(hash, 0, sizeof(hash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
if (inm->ifma_addr->sa_family != AF_LINK)
continue;
@ -1085,7 +1085,7 @@ bm_setladrf(struct bm_softc *sc)
/* Set the corresponding bit in the filter. */
hash[crc >> 4] |= 1 << (crc & 0xf);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
/* Write out new hash table */

View File

@ -2531,7 +2531,7 @@ cas_setladrf(struct cas_softc *sc)
/* Clear the hash table. */
memset(hash, 0, sizeof(hash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
if (inm->ifma_addr->sa_family != AF_LINK)
continue;
@ -2544,7 +2544,7 @@ cas_setladrf(struct cas_softc *sc)
/* Set the corresponding bit in the filter. */
hash[crc >> 4] |= 1 << (15 - (crc & 15));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
v |= CAS_MAC_RX_CONF_HFILTER;

View File

@ -1022,7 +1022,7 @@ cs_setmode(struct cs_softc *sc)
* Set up the filter to only accept multicast
* frames we're interested in.
*/
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
struct sockaddr_dl *dl =
(struct sockaddr_dl *)ifma->ifma_addr;
@ -1032,7 +1032,7 @@ cs_setmode(struct cs_softc *sc)
mask = (u_int16_t) (1 << (index & 0xf));
af[port] |= mask;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
cs_writereg(sc, PP_LAF + 0, af[0]);

View File

@ -1110,7 +1110,7 @@ dc_setfilt_21143(struct dc_softc *sc)
else
DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1118,7 +1118,7 @@ dc_setfilt_21143(struct dc_softc *sc)
LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
sp[h >> 4] |= htole32(1 << (h & 0xF));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (ifp->if_flags & IFF_BROADCAST) {
h = dc_mchash_le(sc, ifp->if_broadcastaddr);
@ -1185,7 +1185,7 @@ dc_setfilt_admtek(struct dc_softc *sc)
return;
/* Now program new ones. */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1200,7 +1200,7 @@ dc_setfilt_admtek(struct dc_softc *sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]);
CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]);
@ -1258,7 +1258,7 @@ dc_setfilt_asix(struct dc_softc *sc)
return;
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1268,7 +1268,7 @@ dc_setfilt_asix(struct dc_softc *sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0);
CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]);
@ -1313,7 +1313,7 @@ dc_setfilt_xircom(struct dc_softc *sc)
else
DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1321,7 +1321,7 @@ dc_setfilt_xircom(struct dc_softc *sc)
LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
sp[h >> 4] |= htole32(1 << (h & 0xF));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (ifp->if_flags & IFF_BROADCAST) {
h = dc_mchash_le(sc, ifp->if_broadcastaddr);

View File

@ -3041,7 +3041,7 @@ tulip_addr_filter(tulip_softc_t * const sc)
multicnt = 0;
ifp = sc->tulip_ifp;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
/* Copy MAC address on stack to align. */
if (ifp->if_input != NULL)
@ -3134,7 +3134,7 @@ tulip_addr_filter(tulip_softc_t * const sc)
*sp++ = TULIP_SP_MAC(eaddr[2]);
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
static void

View File

@ -2538,7 +2538,7 @@ em_set_multi(struct adapter *adapter)
if (mta == NULL)
panic("em_set_multi memory failure\n");
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2550,7 +2550,7 @@ em_set_multi(struct adapter *adapter)
&mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN);
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) {
reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL);

View File

@ -1886,7 +1886,7 @@ igb_set_multi(struct adapter *adapter)
IOCTL_DEBUGOUT("igb_set_multi: begin");
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1898,7 +1898,7 @@ igb_set_multi(struct adapter *adapter)
&mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN);
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) {
reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL);

View File

@ -1614,7 +1614,7 @@ ed_ds_getmcaf(struct ed_softc *sc, uint32_t *mcaf)
mcaf[0] = 0;
mcaf[1] = 0;
IF_ADDR_LOCK(sc->ifp);
if_maddr_rlock(sc->ifp);
TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1622,7 +1622,7 @@ ed_ds_getmcaf(struct ed_softc *sc, uint32_t *mcaf)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
af[index >> 3] |= 1 << (index & 7);
}
IF_ADDR_UNLOCK(sc->ifp);
if_maddr_runlock(sc->ifp);
}
int

View File

@ -1361,7 +1361,7 @@ et_setmulti(struct et_softc *sc)
}
count = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
uint32_t *hp, h;
@ -1387,7 +1387,7 @@ et_setmulti(struct et_softc *sc)
++count;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < 4; ++i)
CSR_WRITE_4(sc, ET_MULTI_HASH + (i * 4), hash[i]);

View File

@ -870,13 +870,13 @@ ex_setmulti(struct ex_softc *sc)
ifp = sc->ifp;
count = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
if (maddr->ifma_addr->sa_family != AF_LINK)
continue;
count++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI)
|| count > 63) {
@ -904,7 +904,7 @@ ex_setmulti(struct ex_softc *sc)
CSR_WRITE_2(sc, IO_PORT_REG, 0);
CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
if (maddr->ifma_addr->sa_family != AF_LINK)
continue;
@ -915,7 +915,7 @@ ex_setmulti(struct ex_softc *sc)
CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/* Program our MAC address as well */
/* XXX: Is this necessary? The Linux driver does this

View File

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

View File

@ -2851,7 +2851,7 @@ fxp_mc_addrs(struct fxp_softc *sc)
nmcasts = 0;
if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2864,7 +2864,7 @@ fxp_mc_addrs(struct fxp_softc *sc)
&sc->mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN);
nmcasts++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN);
return (nmcasts);

View File

@ -2201,7 +2201,7 @@ gem_setladrf(struct gem_softc *sc)
/* Clear the hash table. */
memset(hash, 0, sizeof(hash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
if (inm->ifma_addr->sa_family != AF_LINK)
continue;
@ -2214,7 +2214,7 @@ gem_setladrf(struct gem_softc *sc)
/* Set the corresponding bit in the filter. */
hash[crc >> 4] |= 1 << (15 - (crc & 15));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
v |= GEM_MAC_RX_HASH_FILTER;

View File

@ -1710,7 +1710,7 @@ hme_setladrf(struct hme_softc *sc, int reenable)
* the word.
*/
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
if (inm->ifma_addr->sa_family != AF_LINK)
continue;
@ -1723,7 +1723,7 @@ hme_setladrf(struct hme_softc *sc, int reenable)
/* Set the corresponding bit in the filter. */
hash[crc >> 4] |= 1 << (crc & 0xf);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
chipit:
/* Now load the hash table into the chip */

View File

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

View File

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

View File

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

View File

@ -1883,7 +1883,7 @@ ixgbe_set_multi(struct adapter *adapter)
IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1892,7 +1892,7 @@ ixgbe_set_multi(struct adapter *adapter)
IXGBE_ETH_LENGTH_OF_ADDRESS);
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
update_ptr = mta;
ixgbe_update_mc_addr_list(&adapter->hw,

View File

@ -3122,7 +3122,7 @@ jme_set_filter(struct jme_softc *sc)
rxcfg |= RXMAC_MULTICAST;
bzero(mchash, sizeof(mchash));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -3135,7 +3135,7 @@ jme_set_filter(struct jme_softc *sc)
/* Set the corresponding bit in the hash table. */
mchash[crc >> 5] |= 1 << (crc & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, JME_MAR0, mchash[0]);
CSR_WRITE_4(sc, JME_MAR1, mchash[1]);

View File

@ -605,7 +605,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af)
}
af[0] = af[1] = af[2] = af[3] = 0x0000;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -619,7 +619,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af)
/* Set the corresponding bit in the filter. */
af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
/*

View File

@ -393,7 +393,7 @@ lge_setmulti(sc)
CSR_WRITE_4(sc, LGE_MAR1, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -404,7 +404,7 @@ lge_setmulti(sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, LGE_MAR0, hashes[0]);
CSR_WRITE_4(sc, LGE_MAR1, hashes[1]);

View File

@ -1577,14 +1577,14 @@ malo_setmcastfilter(struct malo_softc *sc)
(ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)))
goto all;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
if (nmc == MALO_HAL_MCAST_MAX) {
ifp->if_flags |= IFF_ALLMULTI;
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
goto all;
}
IEEE80211_ADDR_COPY(mp,
@ -1592,7 +1592,7 @@ malo_setmcastfilter(struct malo_softc *sc)
mp += IEEE80211_ADDR_LEN, nmc++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
malo_hal_setmcast(sc->malo_mh, nmc, macs);

View File

@ -1731,7 +1731,7 @@ mge_setup_multicast(struct mge_softc *sc)
memset(smt, 0, sizeof(smt));
memset(omt, 0, sizeof(omt));
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1745,7 +1745,7 @@ mge_setup_multicast(struct mge_softc *sc)
omt[i >> 2] |= v << ((i & 0x03) << 3);
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) {

View File

@ -601,7 +601,7 @@ msk_rxfilter(struct msk_if_softc *sc_if)
mchash[1] = 0xffff;
} else {
mode |= GM_RXCR_UCF_ENA;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -612,7 +612,7 @@ msk_rxfilter(struct msk_if_softc *sc_if)
/* Set the corresponding bit in the hash table. */
mchash[crc >> 5] |= 1 << (crc & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mchash[0] != 0 || mchash[1] != 0)
mode |= GM_RXCR_MCF_ENA;
}

View File

@ -1130,7 +1130,7 @@ mxge_set_multicast_list(mxge_softc_t *sc)
/* Walk the multicast list, and add each address */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1146,11 +1146,11 @@ mxge_set_multicast_list(mxge_softc_t *sc)
"MXGEFW_JOIN_MULTICAST_GROUP, error status:"
"%d\t", err);
/* abort, leaving multicast filtering off */
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
return;
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/* Enable multicast filtering */
err = mxge_send_cmd(sc, MXGEFW_DISABLE_ALLMULTI, &cmd);
if (err != 0) {

View File

@ -337,7 +337,7 @@ my_setmulti(struct my_softc * sc)
CSR_WRITE_4(sc, MY_MAR1, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -349,7 +349,7 @@ my_setmulti(struct my_softc * sc)
hashes[1] |= (1 << (h - 32));
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxfilt |= MY_AM;

View File

@ -2491,7 +2491,7 @@ nfe_setmulti(struct nfe_softc *sc)
bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
u_char *addrp;
@ -2505,7 +2505,7 @@ nfe_setmulti(struct nfe_softc *sc)
mask[i] &= ~mcaddr;
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < ETHER_ADDR_LEN; i++) {
mask[i] |= addr[i];

View File

@ -863,7 +863,7 @@ nge_rxfilter(struct nge_softc *sc)
* that needs to be updated, and the lower 4 bits represent
* which bit within that byte needs to be set.
*/
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -875,7 +875,7 @@ nge_rxfilter(struct nge_softc *sc)
NGE_FILTADDR_MCAST_LO + (index * 2));
NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
done:
CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt);

View File

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

View File

@ -2238,7 +2238,7 @@ xge_setmulti(xge_lldev_t *lldev)
}
/* Updating address list */
IF_ADDR_LOCK(ifnetp);
if_maddr_rlock(ifnetp);
index = 0;
TAILQ_FOREACH(ifma, &ifnetp->if_multiaddrs, ifma_link) {
if(ifma->ifma_addr->sa_family != AF_LINK) {
@ -2247,7 +2247,7 @@ xge_setmulti(xge_lldev_t *lldev)
lladdr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
index += 1;
}
IF_ADDR_UNLOCK(ifnetp);
if_maddr_runlock(ifnetp);
if((!lldev->all_multicast) && (index)) {
lldev->macaddr_count = (index + 1);
@ -2263,7 +2263,7 @@ xge_setmulti(xge_lldev_t *lldev)
}
/* Add new addresses */
IF_ADDR_LOCK(ifnetp);
if_maddr_rlock(ifnetp);
index = 0;
TAILQ_FOREACH(ifma, &ifnetp->if_multiaddrs, ifma_link) {
if(ifma->ifma_addr->sa_family != AF_LINK) {
@ -2273,7 +2273,7 @@ xge_setmulti(xge_lldev_t *lldev)
xge_hal_device_macaddr_set(hldev, (offset + index), lladdr);
index += 1;
}
IF_ADDR_UNLOCK(ifnetp);
if_maddr_runlock(ifnetp);
_exit:
return;

View File

@ -371,7 +371,7 @@ pcn_setmulti(sc)
pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -379,7 +379,7 @@ pcn_setmulti(sc)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
hashes[h >> 4] |= 1 << (h & 0xF);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < 4; i++)
pcn_csr_write(sc, PCN_CSR_MAR0 + i, hashes[i]);

View File

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

View File

@ -640,7 +640,7 @@ re_set_rxmode(struct rl_softc *sc)
goto done;
}
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -651,7 +651,7 @@ re_set_rxmode(struct rl_softc *sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (hashes[0] != 0 || hashes[1] != 0) {
/*

View File

@ -494,7 +494,7 @@ sf_rxfilter(struct sf_softc *sc)
/* Now program new ones. */
i = 1;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead,
ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -514,7 +514,7 @@ sf_rxfilter(struct sf_softc *sc)
sf_sethash(sc,
LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 0);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
done:
csr_write_4(sc, SF_RXFILT, rxfilt);

View File

@ -773,7 +773,7 @@ sis_setmulti_ns(struct sis_softc *sc)
CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0);
}
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -786,7 +786,7 @@ sis_setmulti_ns(struct sis_softc *sc)
bit -= 0x10;
SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave);
@ -825,7 +825,7 @@ sis_setmulti_sis(struct sis_softc *sc)
for (i = 0; i < n; i++)
hashes[i] = 0;
i = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -834,7 +834,7 @@ sis_setmulti_sis(struct sis_softc *sc)
hashes[h >> 4] |= 1 << (h & 0xf);
i++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (i > n) {
ctl |= SIS_RXFILTCTL_ALLMULTI;
for (i = 0; i < n; i++)

View File

@ -759,7 +759,7 @@ sk_rxfilter_genesis(sc_if)
hashes[1] = 0xFFFFFFFF;
} else {
i = 1;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead,
ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -783,7 +783,7 @@ sk_rxfilter_genesis(sc_if)
hashes[1] |= (1 << (h - 32));
mode |= XM_MODE_RX_USE_HASH;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
SK_XM_WRITE_4(sc_if, XM_MODE, mode);
@ -811,7 +811,7 @@ sk_rxfilter_yukon(sc_if)
hashes[1] = 0xFFFFFFFF;
} else {
mode |= YU_RCR_UFLEN;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -822,7 +822,7 @@ sk_rxfilter_yukon(sc_if)
/* Set the corresponding bit in the hash table. */
hashes[crc >> 5] |= 1 << (crc & 0x1f);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (hashes[0] != 0 || hashes[1] != 0)
mode |= YU_RCR_MUFLEN;
}

View File

@ -1404,10 +1404,10 @@ sn_getmcf(struct ifnet *ifp, uint8_t *mcf)
bzero(mcf, MCFSZ);
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK) {
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
return 0;
}
index = ether_crc32_le(LLADDR((struct sockaddr_dl *)
@ -1420,6 +1420,6 @@ sn_getmcf(struct ifnet *ifp, uint8_t *mcf)
}
af[index2 >> 3] |= 1 << (index2 & 7);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
return 1; /* use multicast filter */
}

View File

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

View File

@ -594,7 +594,7 @@ ste_setmulti(sc)
CSR_WRITE_2(sc, STE_MAR3, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -605,7 +605,7 @@ ste_setmulti(sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_2(sc, STE_MAR0, hashes[0] & 0xFFFF);
CSR_WRITE_2(sc, STE_MAR1, (hashes[0] >> 16) & 0xFFFF);

View File

@ -2683,7 +2683,7 @@ stge_set_multi(struct stge_softc *sc)
bzero(mchash, sizeof(mchash));
count = 0;
IF_ADDR_LOCK(sc->sc_ifp);
if_maddr_rlock(sc->sc_ifp);
TAILQ_FOREACH(ifma, &sc->sc_ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2697,7 +2697,7 @@ stge_set_multi(struct stge_softc *sc)
mchash[crc >> 5] |= 1 << (crc & 0x1f);
count++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
mode &= ~(RM_ReceiveMulticast | RM_ReceiveAllFrames);
if (count > 0)

View File

@ -1851,7 +1851,7 @@ ti_setmulti(sc)
}
/* Now program new ones. */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1866,7 +1866,7 @@ ti_setmulti(sc)
SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
ti_add_mcast(sc, &mc->mc_addr);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/* Re-enable interrupts. */
CSR_WRITE_4(sc, TI_MB_HOSTINTR, intrs);

View File

@ -952,7 +952,7 @@ tl_setmulti(sc)
hashes[1] = 0xFFFFFFFF;
} else {
i = 1;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -975,7 +975,7 @@ tl_setmulti(sc)
else
hashes[1] |= (1 << (h - 32));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
tl_dio_write32(sc, TL_HASH1, hashes[0]);

View File

@ -1899,7 +1899,7 @@ tsec_setup_multicast(struct tsec_softc *sc)
return;
}
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -1910,7 +1910,7 @@ tsec_setup_multicast(struct tsec_softc *sc)
hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F));
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
for (i = 0; i < 8; i++)
TSEC_WRITE(sc, TSEC_REG_GADDR(i), hashtable[i]);

View File

@ -1400,7 +1400,7 @@ epic_set_mc_table(epic_softc_t *sc)
filter[2] = 0;
filter[3] = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1408,7 +1408,7 @@ epic_set_mc_table(epic_softc_t *sc)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
filter[h >> 4] |= 1 << (h & 0xF);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
CSR_WRITE_4(sc, MC0, filter[0]);
CSR_WRITE_4(sc, MC1, filter[1]);

View File

@ -2725,7 +2725,7 @@ txp_set_filter(struct txp_softc *sc)
mchash[0] = mchash[1] = 0;
mcnt = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2735,7 +2735,7 @@ txp_set_filter(struct txp_softc *sc)
mchash[crc >> 5] |= 1 << (crc & 0x1f);
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt > 0) {
filter |= TXP_RXFILT_HASHMULTI;

View File

@ -551,7 +551,7 @@ aue_setmulti(struct usb_ether *ue)
AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -559,7 +559,7 @@ aue_setmulti(struct usb_ether *ue)
ifma->ifma_addr), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1);
hashtbl[(h >> 3)] |= 1 << (h & 0x7);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/* write the hashtable */
for (i = 0; i != 8; i++)

View File

@ -475,7 +475,7 @@ axe_setmulti(struct usb_ether *ue)
}
rxmode &= ~AXE_RXCMD_ALLMULTI;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -484,7 +484,7 @@ axe_setmulti(struct usb_ether *ue)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
hashtbl[h / 8] |= 1 << (h % 8);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl);
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);

View File

@ -318,7 +318,7 @@ cue_setmulti(struct usb_ether *ue)
}
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -326,7 +326,7 @@ cue_setmulti(struct usb_ether *ue)
h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
hashtbl[h >> 3] |= 1 << (h & 0x7);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/*
* Also include the broadcast address in the filter

View File

@ -368,7 +368,7 @@ kue_setmulti(struct usb_ether *ue)
sc->sc_rxfilt &= ~KUE_RXFILT_ALLMULTI;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -383,7 +383,7 @@ kue_setmulti(struct usb_ether *ue)
KUE_MCFILT(sc, i), ETHER_ADDR_LEN);
i++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (i == KUE_MCFILTCNT(sc))
sc->sc_rxfilt |= KUE_RXFILT_ALLMULTI;

View File

@ -494,7 +494,7 @@ rue_setmulti(struct usb_ether *ue)
rue_csr_write_4(sc, RUE_MAR4, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -507,7 +507,7 @@ rue_setmulti(struct usb_ether *ue)
hashes[1] |= (1 << (h - 32));
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxcfg |= RUE_RCR_AM;

View File

@ -494,7 +494,7 @@ udav_setmulti(struct usb_ether *ue)
udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl));
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -503,7 +503,7 @@ udav_setmulti(struct usb_ether *ue)
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
hashtbl[h / 8] |= 1 << (h % 8);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
/* disable all multicast */
UDAV_CLRBIT(sc, UDAV_RCR, UDAV_RCR_ALL);

View File

@ -809,9 +809,7 @@ upgt_set_multi(void *arg)
* XXX don't know how to set a device. Lack of docs. Just try to set
* IFF_ALLMULTI flag here.
*/
IF_ADDR_LOCK(ifp);
ifp->if_flags |= IFF_ALLMULTI;
IF_ADDR_UNLOCK(ifp);
}
static void

View File

@ -1945,9 +1945,7 @@ urtw_set_multi(void *arg)
* XXX don't know how to set a device. Lack of docs. Just try to set
* IFF_ALLMULTI flag here.
*/
IF_ADDR_LOCK(ifp);
ifp->if_flags |= IFF_ALLMULTI;
IF_ADDR_UNLOCK(ifp);
}
static usb_error_t

View File

@ -2016,7 +2016,7 @@ zyd_set_multi(struct zyd_softc *sc)
low = 0xffffffff;
high = 0xffffffff;
} else {
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2027,7 +2027,7 @@ zyd_set_multi(struct zyd_softc *sc)
else
high |= 1 << (v - 32);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
/* reprogram multicast global hash table */

View File

@ -569,7 +569,7 @@ vge_setmulti(sc)
}
/* Now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -597,7 +597,7 @@ vge_setmulti(sc)
CSR_WRITE_4(sc, VGE_MAR0, hashes[0]);
CSR_WRITE_4(sc, VGE_MAR1, hashes[1]);
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
return;
}

View File

@ -482,7 +482,7 @@ vr_set_filter(struct vr_softc *sc)
/* Now program new ones. */
error = 0;
mcnt = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
if ((sc->vr_quirks & VR_Q_CAM) != 0) {
/*
* For hardwares that have CAM capability, use
@ -523,7 +523,7 @@ vr_set_filter(struct vr_softc *sc)
mcnt++;
}
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt > 0)
rxfilt |= VR_RXCFG_RX_MULTI;

View File

@ -605,7 +605,7 @@ wb_setmulti(sc)
CSR_WRITE_4(sc, WB_MAR1, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -617,7 +617,7 @@ wb_setmulti(sc)
hashes[1] |= (1 << (h - 32));
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxfilt |= WB_NETCFG_RX_MULTI;

View File

@ -1582,7 +1582,7 @@ wi_write_multi(struct wi_softc *sc)
}
n = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -1592,7 +1592,7 @@ wi_write_multi(struct wi_softc *sc)
(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)));
n++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist,
IEEE80211_ADDR_LEN * n);
}

View File

@ -2116,7 +2116,7 @@ wlconfig(struct wl_softc *sc)
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);
if_maddr_rlock(sc->ifp);
TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -2127,7 +2127,7 @@ wlconfig(struct wl_softc *sc)
outw(PIOP1(base), addrp[4] + (addrp[5] << 8));
++cnt;
}
IF_ADDR_UNLOCK(sc->ifp);
if_maddr_runlock(sc->ifp);
outw(PIOR1(base), OFFSET_CU + 6); /* mc-cnt */
outw(PIOP1(base), cnt * WAVELAN_ADDR_SIZE);
if (wlcmd(sc, "config()-mcaddress") == 0)

View File

@ -1390,7 +1390,7 @@ xe_set_multicast(struct xe_softc *scp)
/* Iterate over multicast address list */
count = 0;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) {
if (maddr->ifma_addr->sa_family != AF_LINK)
continue;
@ -1413,7 +1413,7 @@ xe_set_multicast(struct xe_softc *scp)
/* Nowhere else to put them on CE2 */
break;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
DEVPRINTF(2, (scp->dev, "set_multicast: count = %u\n", count));

View File

@ -724,10 +724,10 @@ xl_setmulti(struct xl_softc *sc)
return;
}
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
mcnt++;
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxfilt |= XL_RXFILTER_ALLMULTI;
@ -766,7 +766,7 @@ xl_setmulti_hash(struct xl_softc *sc)
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -788,7 +788,7 @@ xl_setmulti_hash(struct xl_softc *sc)
h | XL_CMD_RX_SET_HASH | XL_HASH_SET);
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxfilt |= XL_RXFILTER_MULTIHASH;

View File

@ -1168,7 +1168,7 @@ admsw_set_filter(struct admsw_softc *sc)
ifp->if_flags &= ~IFF_ALLMULTI;
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
@ -1176,7 +1176,7 @@ admsw_set_filter(struct admsw_softc *sc)
anymc |= vlan_matrix[i];
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
}
conf = REG_READ(CPUP_CONF_REG);

View File

@ -551,10 +551,10 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook)
* lose a race while we check if the membership
* already exists.
*/
IF_ADDR_LOCK(priv->ifp);
if_maddr_rlock(priv->ifp);
ifma = if_findmulti(priv->ifp,
(struct sockaddr *)&sa_dl);
IF_ADDR_UNLOCK(priv->ifp);
if_maddr_runlock(priv->ifp);
if (ifma != NULL) {
error = EADDRINUSE;
} else {

View File

@ -697,7 +697,7 @@ rl_setmulti(struct rl_softc *sc)
CSR_WRITE_4(sc, RL_MAR4, 0);
/* now program new ones */
IF_ADDR_LOCK(ifp);
if_maddr_rlock(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@ -709,7 +709,7 @@ rl_setmulti(struct rl_softc *sc)
hashes[1] |= (1 << (h - 32));
mcnt++;
}
IF_ADDR_UNLOCK(ifp);
if_maddr_runlock(ifp);
if (mcnt)
rxfilt |= RL_RXCFG_RX_MULTI;