summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-06-26 11:45:06 +0000
committerrwatson <rwatson@FreeBSD.org>2009-06-26 11:45:06 +0000
commitbe5740a255fbcb1d4053e709cb7f22bb96320eb0 (patch)
tree30aee113c454323f30d4c201e18a0f29e2938074 /sys/dev/usb
parentffea8e20279ff0d82924add1cef0d8e16d9538a5 (diff)
downloadFreeBSD-src-be5740a255fbcb1d4053e709cb7f22bb96320eb0.zip
FreeBSD-src-be5740a255fbcb1d4053e709cb7f22bb96320eb0.tar.gz
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
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/net/if_aue.c4
-rw-r--r--sys/dev/usb/net/if_axe.c4
-rw-r--r--sys/dev/usb/net/if_cue.c4
-rw-r--r--sys/dev/usb/net/if_kue.c4
-rw-r--r--sys/dev/usb/net/if_rue.c4
-rw-r--r--sys/dev/usb/net/if_udav.c4
-rw-r--r--sys/dev/usb/wlan/if_upgt.c2
-rw-r--r--sys/dev/usb/wlan/if_urtw.c2
-rw-r--r--sys/dev/usb/wlan/if_zyd.c4
9 files changed, 14 insertions, 18 deletions
diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c
index 550186d..142780f 100644
--- a/sys/dev/usb/net/if_aue.c
+++ b/sys/dev/usb/net/if_aue.c
@@ -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++)
diff --git a/sys/dev/usb/net/if_axe.c b/sys/dev/usb/net/if_axe.c
index 3c72b38..ae9d512 100644
--- a/sys/dev/usb/net/if_axe.c
+++ b/sys/dev/usb/net/if_axe.c
@@ -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);
diff --git a/sys/dev/usb/net/if_cue.c b/sys/dev/usb/net/if_cue.c
index 4bb0da2..dcbef61 100644
--- a/sys/dev/usb/net/if_cue.c
+++ b/sys/dev/usb/net/if_cue.c
@@ -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
diff --git a/sys/dev/usb/net/if_kue.c b/sys/dev/usb/net/if_kue.c
index 85a43a2..281d54f 100644
--- a/sys/dev/usb/net/if_kue.c
+++ b/sys/dev/usb/net/if_kue.c
@@ -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;
diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c
index b942e50..7b92bc5 100644
--- a/sys/dev/usb/net/if_rue.c
+++ b/sys/dev/usb/net/if_rue.c
@@ -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;
diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c
index 926b0a3..20853e0 100644
--- a/sys/dev/usb/net/if_udav.c
+++ b/sys/dev/usb/net/if_udav.c
@@ -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);
diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c
index 9ab02a7..ff3220b 100644
--- a/sys/dev/usb/wlan/if_upgt.c
+++ b/sys/dev/usb/wlan/if_upgt.c
@@ -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
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
index 0f8fe44..5c10a6f 100644
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -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
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index 8216a75..9bdb6ea 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -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 */
OpenPOWER on IntegriCloud