summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2019-05-28 07:41:46 +0000
committermsaitoh <msaitoh@NetBSD.org>2019-05-28 07:41:46 +0000
commitf515fb39dacd0abce2aa9df99560ed9bab4f077b (patch)
tree3724853fb259cb8c671627600852df468717a3bb /sys/dev
parent9cc62795521ef562d9fd83186cdd52e5cc6996a2 (diff)
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bi/if_ni.c9
-rw-r--r--sys/dev/cadence/if_cemac.c6
-rw-r--r--sys/dev/ic/aic6915.c11
-rw-r--r--sys/dev/ic/ath.c9
-rw-r--r--sys/dev/ic/athn.c6
-rw-r--r--sys/dev/ic/atw.c10
-rw-r--r--sys/dev/ic/awi.c13
-rw-r--r--sys/dev/ic/cs89x0.c6
-rw-r--r--sys/dev/ic/dm9000.c4
-rw-r--r--sys/dev/ic/dp8390.c7
-rw-r--r--sys/dev/ic/dp83932.c8
-rw-r--r--sys/dev/ic/elinkxl.c18
-rw-r--r--sys/dev/ic/gem.c7
-rw-r--r--sys/dev/ic/hme.c7
-rw-r--r--sys/dev/ic/i82557.c7
-rw-r--r--sys/dev/ic/i82586.c15
-rw-r--r--sys/dev/ic/i82596.c11
-rw-r--r--sys/dev/ic/lan9118.c11
-rw-r--r--sys/dev/ic/lance.c8
-rw-r--r--sys/dev/ic/lemac.c10
-rw-r--r--sys/dev/ic/mb86960.c7
-rw-r--r--sys/dev/ic/mtd803.c6
-rw-r--r--sys/dev/ic/pdq_ifsubr.c9
-rw-r--r--sys/dev/ic/rtl81x9.c17
-rw-r--r--sys/dev/ic/rtw.c6
-rw-r--r--sys/dev/ic/seeq8005.c14
-rw-r--r--sys/dev/ic/sgec.c9
-rw-r--r--sys/dev/ic/smc83c170.c7
-rw-r--r--sys/dev/ic/tulip.c17
-rw-r--r--sys/dev/ic/wi.c13
-rw-r--r--sys/dev/isa/if_iy.c9
-rw-r--r--sys/dev/marvell/if_gfe.c6
-rw-r--r--sys/dev/marvell/if_mvgbe.c7
-rw-r--r--sys/dev/marvell/if_mvxpe.c7
-rw-r--r--sys/dev/pci/if_age.c6
-rw-r--r--sys/dev/pci/if_alc.c4
-rw-r--r--sys/dev/pci/if_ale.c5
-rw-r--r--sys/dev/pci/if_bge.c7
-rw-r--r--sys/dev/pci/if_bnx.c7
-rw-r--r--sys/dev/pci/if_cas.c6
-rw-r--r--sys/dev/pci/if_de.c13
-rw-r--r--sys/dev/pci/if_dge.c7
-rw-r--r--sys/dev/pci/if_et.c6
-rw-r--r--sys/dev/pci/if_jme.c9
-rw-r--r--sys/dev/pci/if_kse.c11
-rw-r--r--sys/dev/pci/if_lii.c7
-rw-r--r--sys/dev/pci/if_msk.c7
-rw-r--r--sys/dev/pci/if_nfe.c7
-rw-r--r--sys/dev/pci/if_pcn.c7
-rw-r--r--sys/dev/pci/if_sip.c7
-rw-r--r--sys/dev/pci/if_sk.c7
-rw-r--r--sys/dev/pci/if_ste.c11
-rw-r--r--sys/dev/pci/if_stge.c11
-rw-r--r--sys/dev/pci/if_ti.c14
-rw-r--r--sys/dev/pci/if_tl.c9
-rw-r--r--sys/dev/pci/if_txp.c7
-rw-r--r--sys/dev/pci/if_vge.c16
-rw-r--r--sys/dev/pci/if_vr.c10
-rw-r--r--sys/dev/pci/if_vte.c10
-rw-r--r--sys/dev/pci/if_xge.c11
-rw-r--r--sys/dev/pcmcia/if_ray.c8
-rw-r--r--sys/dev/pcmcia/if_xi.c13
-rw-r--r--sys/dev/qbus/if_il.c9
-rw-r--r--sys/dev/qbus/if_qe.c9
-rw-r--r--sys/dev/sbus/be.c7
-rw-r--r--sys/dev/sbus/qe.c6
-rw-r--r--sys/dev/scsipi/if_se.c8
-rw-r--r--sys/dev/usb/if_aue.c13
-rw-r--r--sys/dev/usb/if_axe.c13
-rw-r--r--sys/dev/usb/if_axen.c7
-rw-r--r--sys/dev/usb/if_cue.c13
-rw-r--r--sys/dev/usb/if_kue.c13
-rw-r--r--sys/dev/usb/if_mue.c10
-rw-r--r--sys/dev/usb/if_otus.c9
-rw-r--r--sys/dev/usb/if_udav.c15
-rw-r--r--sys/dev/usb/if_ure.c13
-rw-r--r--sys/dev/usb/if_url.c15
77 files changed, 505 insertions, 215 deletions
diff --git a/sys/dev/bi/if_ni.c b/sys/dev/bi/if_ni.c
index 06a062616ae..c4cfcf20153 100644
--- a/sys/dev/bi/if_ni.c
+++ b/sys/dev/bi/if_ni.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ni.c,v 1.48 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_ni.c,v 1.49 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
*
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.48 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.49 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -795,6 +795,7 @@ ni_add_rxbuf(struct ni_softc *sc, struct ni_dg *data, int idx)
void
ni_setup(struct ni_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp = &sc->sc_if;
struct ni_msg *msg;
struct ni_ptdb *ptdb;
@@ -824,7 +825,8 @@ ni_setup(struct ni_softc *sc)
msg->nm_len += 8;
ifp->if_flags &= ~IFF_ALLMULTI;
if ((ifp->if_flags & IFF_PROMISC) == 0) {
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
i = 1;
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) {
@@ -838,6 +840,7 @@ ni_setup(struct ni_softc *sc)
ETHER_ADDR_LEN);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
} else
msg->nm_opcode2 = NI_CLPTDB;
diff --git a/sys/dev/cadence/if_cemac.c b/sys/dev/cadence/if_cemac.c
index af9e098f290..f568b1390bd 100644
--- a/sys/dev/cadence/if_cemac.c
+++ b/sys/dev/cadence/if_cemac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cemac.c,v 1.20 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_cemac.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2015 Genetec Corporation. All rights reserved.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.20 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -988,6 +988,7 @@ cemac_setaddr(struct ifnet *ifp)
ifp->if_flags &= ~IFF_ALLMULTI;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1030,6 +1031,7 @@ cemac_setaddr(struct ifnet *ifp)
ETHER_NEXT_MULTI(step, enm);
nma++;
}
+ ETHER_UNLOCK(ec);
// program...
DPRINTFN(1,("%s: en0 %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c
index 197080ff47b..4fc0048790a 100644
--- a/sys/dev/ic/aic6915.c
+++ b/sys/dev/ic/aic6915.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aic6915.c,v 1.38 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: aic6915.c,v 1.39 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.38 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.39 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -1306,9 +1306,12 @@ sf_set_filter(struct sf_softc *sc)
* Now set the hash bits for each multicast address in our
* list.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
- if (enm == NULL)
+ if (enm == NULL) {
+ ETHER_UNLOCK(ec);
goto done;
+ }
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
/*
@@ -1319,11 +1322,13 @@ sf_set_filter(struct sf_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
sf_set_filter_hash(sc, enm->enm_addrlo);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/*
* Set "hash only multicast dest, match regardless of VLAN ID".
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index 30a9bc00a61..618562c8dac 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ath.c,v 1.126 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -41,7 +41,7 @@
__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.126 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $");
#endif
/*
@@ -1989,6 +1989,7 @@ ath_calcrxfilter(struct ath_softc *sc, enum ieee80211_state state)
static void
ath_mode_init(struct ath_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp = &sc->sc_if;
struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
@@ -2028,7 +2029,8 @@ ath_mode_init(struct ath_softc *sc)
/* calculate and install multicast filter */
ifp->if_flags &= ~IFF_ALLMULTI;
mfilt[0] = mfilt[1] = 0;
- ETHER_FIRST_MULTI(estep, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(estep, ec, enm);
while (enm != NULL) {
void *dl;
/* XXX Punt on ranges. */
@@ -2047,6 +2049,7 @@ ath_mode_init(struct ath_softc *sc)
ETHER_NEXT_MULTI(estep, enm);
}
+ ETHER_UNLOCK(ec);
ath_hal_setmcastfilter(ah, mfilt[0], mfilt[1]);
DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, MC filter %08x:%08x\n",
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c
index 29592fa8ce3..6a1326fc1c3 100644
--- a/sys/dev/ic/athn.c
+++ b/sys/dev/ic/athn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: athn.c,v 1.20 2019/05/28 07:07:00 msaitoh Exp $ */
+/* $NetBSD: athn.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $ */
/* $OpenBSD: athn.c,v 1.83 2014/07/22 13:12:11 mpi Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.20 2019/05/28 07:07:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $");
#ifndef _MODULE
#include "athn_usb.h" /* for NATHN_USB */
@@ -2737,6 +2737,7 @@ athn_set_multi(struct athn_softc *sc)
goto done;
}
lo = hi = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) {
@@ -2758,6 +2759,7 @@ athn_set_multi(struct athn_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
done:
+ ETHER_UNLOCK(ec);
AR_WRITE(sc, AR_MCAST_FIL0, lo);
AR_WRITE(sc, AR_MCAST_FIL1, hi);
AR_WRITE_BARRIER(sc);
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index 52e09b71b11..4c4ef8be27c 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atw.c,v 1.167 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: atw.c,v 1.168 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.167 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.168 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -2012,17 +2012,21 @@ atw_filter_setup(struct atw_softc *sc)
/*
* Program the 64-bit multicast hash filter.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
hash = atw_calchash(enm->enm_addrlo);
hashes[hash >> 5] |= 1 << (hash & 0x1f);
ETHER_NEXT_MULTI(step, enm);
sc->sc_opmode |= ATW_NAR_MM;
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/ic/awi.c b/sys/dev/ic/awi.c
index cf5d538a3a3..07810693383 100644
--- a/sys/dev/ic/awi.c
+++ b/sys/dev/ic/awi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: awi.c,v 1.97 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: awi.c,v 1.98 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.97 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.98 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -1015,6 +1015,7 @@ awi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
static int
awi_mode_init(struct awi_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp = &sc->sc_if;
int n, error;
struct ether_multi *enm;
@@ -1029,16 +1030,20 @@ awi_mode_init(struct awi_softc *sc)
goto set_mib;
}
sc->sc_mib_mac.aPromiscuous_Enable = 0;
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (n == AWI_GROUP_ADDR_SIZE ||
- !IEEE80211_ADDR_EQ(enm->enm_addrlo, enm->enm_addrhi))
+ !IEEE80211_ADDR_EQ(enm->enm_addrlo, enm->enm_addrhi)) {
+ ETHER_UNLOCK(ec);
goto set_mib;
+ }
IEEE80211_ADDR_COPY(sc->sc_mib_addr.aGroup_Addresses[n],
enm->enm_addrlo);
n++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
for (; n < AWI_GROUP_ADDR_SIZE; n++)
memset(sc->sc_mib_addr.aGroup_Addresses[n], 0,
IEEE80211_ADDR_LEN);
diff --git a/sys/dev/ic/cs89x0.c b/sys/dev/ic/cs89x0.c
index 483a48c8168..488ff7af909 100644
--- a/sys/dev/ic/cs89x0.c
+++ b/sys/dev/ic/cs89x0.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cs89x0.c,v 1.45 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: cs89x0.c,v 1.46 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2004 Christopher Gilbert
@@ -212,7 +212,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.45 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.46 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -1250,6 +1250,7 @@ cs_set_ladr_filt(struct cs_softc *sc, struct ethercom *ec)
* addresses, in which case we will just accept all packets.
* Justification for this is given in the next comment.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -1280,6 +1281,7 @@ cs_set_ladr_filt(struct cs_softc *sc, struct ethercom *ec)
ETHER_NEXT_MULTI(step, enm);
}
}
+ ETHER_UNLOCK(ec);
/* Now program the chip with the addresses */
CS_WRITE_PACKET_PAGE(sc, PKTPG_LOG_ADDR + 0, af[0]);
diff --git a/sys/dev/ic/dm9000.c b/sys/dev/ic/dm9000.c
index 795a58d0f8c..0278208d57d 100644
--- a/sys/dev/ic/dm9000.c
+++ b/sys/dev/ic/dm9000.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dm9000.c,v 1.19 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: dm9000.c,v 1.20 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2009 Paul Fleischer
@@ -918,6 +918,7 @@ dme_set_addr_filter(struct dme_softc *sc)
af[0] = af[1] = af[2] = af[3] = 0x0000;
ifp->if_flags &= ~IFF_ALLMULTI;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
uint16_t hash;
@@ -940,6 +941,7 @@ dme_set_addr_filter(struct dme_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
}
+ ETHER_UNLOCK(ec);
/* Write the multicast address filter */
for (i = 0; i < 4; i++) {
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index 02b526acbda..d112be60ceb 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dp8390.c,v 1.93 2019/04/26 06:33:33 msaitoh Exp $ */
+/* $NetBSD: dp8390.c,v 1.94 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.93 2019/04/26 06:33:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.94 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -960,6 +960,7 @@ dp8390_getmcaf(struct ethercom *ec, uint8_t *af)
}
for (i = 0; i < 8; i++)
af[i] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -975,6 +976,7 @@ dp8390_getmcaf(struct ethercom *ec, uint8_t *af)
ifp->if_flags |= IFF_ALLMULTI;
for (i = 0; i < 8; i++)
af[i] = 0xff;
+ ETHER_UNLOCK(ec);
return;
}
@@ -988,6 +990,7 @@ dp8390_getmcaf(struct ethercom *ec, uint8_t *af)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
}
diff --git a/sys/dev/ic/dp83932.c b/sys/dev/ic/dp83932.c
index 90046b260cf..7e058983d27 100644
--- a/sys/dev/ic/dp83932.c
+++ b/sys/dev/ic/dp83932.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dp83932.c,v 1.43 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: dp83932.c,v 1.44 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.43 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.44 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -1188,6 +1188,7 @@ sonic_set_filter(struct sonic_softc *sc)
entry++;
/* Add the multicast addresses to the CAM. */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1196,6 +1197,7 @@ sonic_set_filter(struct sonic_softc *sc)
* The only way to do this on the SONIC is to enable
* reception of all multicast packets.
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1204,6 +1206,7 @@ sonic_set_filter(struct sonic_softc *sc)
* Out of CAM slots. Have to enable reception
* of all multicast addresses.
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1213,6 +1216,7 @@ sonic_set_filter(struct sonic_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c
index a2d893734ed..babc4685852 100644
--- a/sys/dev/ic/elinkxl.c
+++ b/sys/dev/ic/elinkxl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: elinkxl.c,v 1.130 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: elinkxl.c,v 1.131 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.130 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.131 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -723,13 +723,18 @@ ex_set_mc(struct ex_softc *sc)
goto allmulti;
}
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(estep, ec, enm);
- if (enm == NULL)
+ if (enm == NULL) {
+ ETHER_UNLOCK(ec);
goto nomulti;
+ }
- if ((sc->ex_conf & EX_CONF_90XB) == 0)
+ if ((sc->ex_conf & EX_CONF_90XB) == 0) {
/* No multicast hash filtering. */
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
for (i = 0; i < MCHASHSIZE; i++)
bus_space_write_2(sc->sc_iot, sc->sc_ioh,
@@ -737,14 +742,17 @@ ex_set_mc(struct ex_softc *sc)
do {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
i = ex_mchash(enm->enm_addrlo);
bus_space_write_2(sc->sc_iot, sc->sc_ioh,
ELINK_COMMAND, ELINK_SETHASHFILBIT | i);
ETHER_NEXT_MULTI(estep, enm);
} while (enm != NULL);
+ ETHER_UNLOCK(ec);
mask |= FIL_MULTIHASH;
nomulti:
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 48f2fd45c89..14d7ada0e4e 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gem.c,v 1.118 2019/05/24 06:26:38 msaitoh Exp $ */
+/* $NetBSD: gem.c,v 1.119 2019/05/28 07:41:48 msaitoh Exp $ */
/*
*
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.118 2019/05/24 06:26:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.119 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -2744,6 +2744,7 @@ gem_setladrf(struct gem_softc *sc)
/* Clear hash table */
memset(hash, 0, sizeof(hash));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2758,6 +2759,7 @@ gem_setladrf(struct gem_softc *sc)
*/
ifp->if_flags |= IFF_ALLMULTI;
v |= GEM_MAC_RX_PROMISC_GRP;
+ ETHER_UNLOCK(ec);
goto chipit;
}
@@ -2772,6 +2774,7 @@ gem_setladrf(struct gem_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
v |= GEM_MAC_RX_HASH_FILTER;
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index cbbb2c65ab2..f229dc89948 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hme.c,v 1.104 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: hme.c,v 1.105 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.104 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.105 2019/05/28 07:41:48 msaitoh Exp $");
/* #define HMEDEBUG */
@@ -1568,6 +1568,7 @@ hme_setladrf(struct hme_softc *sc)
* the word.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1581,6 +1582,7 @@ hme_setladrf(struct hme_softc *sc)
*/
hash[3] = hash[2] = hash[1] = hash[0] = 0xffff;
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto chipit;
}
@@ -1594,6 +1596,7 @@ hme_setladrf(struct hme_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c
index f5855d0e790..e7bfaf1aa49 100644
--- a/sys/dev/ic/i82557.c
+++ b/sys/dev/ic/i82557.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.152 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: i82557.c,v 1.153 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.152 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.153 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2227,6 +2227,7 @@ fxp_mc_setup(struct fxp_softc *sc)
* Initialize multicast setup descriptor.
*/
nmcasts = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/*
@@ -2247,6 +2248,7 @@ fxp_mc_setup(struct fxp_softc *sc)
* the config block.
*/
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
return;
}
memcpy(&mcsp->mc_addr[nmcasts][0], enm->enm_addrlo,
@@ -2254,6 +2256,7 @@ fxp_mc_setup(struct fxp_softc *sc)
nmcasts++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* BIG_ENDIAN: no need to swap to store 0 */
mcsp->cb_status = 0;
diff --git a/sys/dev/ic/i82586.c b/sys/dev/ic/i82586.c
index 1fdf555f0df..6fc259cdeba 100644
--- a/sys/dev/ic/i82586.c
+++ b/sys/dev/ic/i82586.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82586.c,v 1.83 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: i82586.c,v 1.84 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -137,7 +137,7 @@ Mode of operation:
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.83 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.84 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -1769,6 +1769,7 @@ ie_mc_reset(struct ie_softc *sc)
again:
size = 0;
sc->mcast_count = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm) {
size += 6;
@@ -1776,10 +1777,12 @@ again:
memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) {
ec->ec_if.if_flags |= IFF_ALLMULTI;
i82586_ioctl(&ec->ec_if, SIOCSIFFLAGS, NULL);
+ ETHER_UNLOCK(ec);
return;
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (size > sc->mcast_addrs_size) {
/* Need to allocate more space */
@@ -1793,15 +1796,19 @@ again:
/*
* We've got the space; now copy the addresses
*/
- ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm) {
- if (sc->mcast_count >= IE_MAXMCAST)
+ if (sc->mcast_count >= IE_MAXMCAST) {
+ ETHER_UNLOCK(ec);
goto again; /* Just in case */
+ }
memcpy(&sc->mcast_addrs[sc->mcast_count], enm->enm_addrlo, 6);
sc->mcast_count++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
sc->want_mcsetup = 1;
}
diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c
index 48bb38df456..ad986d34ba2 100644
--- a/sys/dev/ic/i82596.c
+++ b/sys/dev/ic/i82596.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.40 2019/04/26 06:33:34 msaitoh Exp $ */
+/* $NetBSD: i82596.c,v 1.41 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.40 2019/04/26 06:33:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.41 2019/05/28 07:41:48 msaitoh Exp $");
/* autoconfig and device stuff */
#include <sys/param.h>
@@ -466,7 +466,8 @@ void
iee_cb_setup(struct iee_softc *sc, uint32_t cmd)
{
struct iee_cb *cb = SC_CB(sc, sc->sc_next_cb);
- struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+ struct ethercom *ec = &sc->sc_ethercom;
+ struct ifnet *ifp = &ec->ec_if;
struct ether_multistep step;
struct ether_multi *enm;
@@ -499,7 +500,8 @@ iee_cb_setup(struct iee_softc *sc, uint32_t cmd)
cb = SC_CB(sc, sc->sc_next_cb + 1);
cb->cb_cmd = cmd;
cb->cb_mcast.mc_size = 0;
- ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN) != 0 || cb->cb_mcast.mc_size
@@ -515,6 +517,7 @@ iee_cb_setup(struct iee_softc *sc, uint32_t cmd)
ETHER_NEXT_MULTI(step, enm);
cb->cb_mcast.mc_size += ETHER_ADDR_LEN;
}
+ ETHER_UNLOCK(ec);
if (cb->cb_mcast.mc_size == 0) {
/* Can't do exact mcast filtering, do ALLMULTI mode. */
ifp->if_flags |= IFF_ALLMULTI;
diff --git a/sys/dev/ic/lan9118.c b/sys/dev/ic/lan9118.c
index cb38949b3d8..e20f0635b0c 100644
--- a/sys/dev/ic/lan9118.c
+++ b/sys/dev/ic/lan9118.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lan9118.c,v 1.33 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: lan9118.c,v 1.34 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.33 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.34 2019/05/28 07:41:48 msaitoh Exp $");
/*
* The LAN9118 Family
@@ -865,9 +865,10 @@ lan9118_mac_writereg(struct lan9118_softc *sc, int reg, uint32_t val)
static void
lan9118_set_filter(struct lan9118_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ether_multistep step;
struct ether_multi *enm;
- struct ifnet *ifp = &sc->sc_ec.ec_if;
+ struct ifnet *ifp = &ec->ec_if;
uint32_t mac_cr, h, hashes[2] = { 0, 0 };
mac_cr = lan9118_mac_readreg(sc, LAN9118_MAC_CR);
@@ -885,7 +886,8 @@ lan9118_set_filter(struct lan9118_softc *sc)
if (ifp->if_flags & IFF_ALLMULTI)
mac_cr |= LAN9118_MAC_CR_MCPAS;
else {
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN) != 0) {
@@ -910,6 +912,7 @@ lan9118_set_filter(struct lan9118_softc *sc)
mac_cr |= LAN9118_MAC_CR_HPFILT;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (mac_cr & LAN9118_MAC_CR_HPFILT) {
lan9118_mac_writereg(sc, LAN9118_HASHH, hashes[1]);
lan9118_mac_writereg(sc, LAN9118_HASHL, hashes[0]);
diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c
index d628a0e4157..56237b41553 100644
--- a/sys/dev/ic/lance.c
+++ b/sys/dev/ic/lance.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lance.c,v 1.56 2019/05/23 10:30:36 msaitoh Exp $ */
+/* $NetBSD: lance.c,v 1.57 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.56 2019/05/23 10:30:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.57 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -581,6 +581,8 @@ lance_setladrf(struct ethercom *ec, uint16_t *af)
goto allmulti;
af[0] = af[1] = af[2] = af[3] = 0x0000;
+
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
@@ -592,6 +594,7 @@ lance_setladrf(struct ethercom *ec, uint16_t *af)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -605,6 +608,7 @@ lance_setladrf(struct ethercom *ec, uint16_t *af)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
return;
diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c
index 53a6950bcdf..b1350890314 100644
--- a/sys/dev/ic/lemac.c
+++ b/sys/dev/ic/lemac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lemac.c,v 1.52 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: lemac.c,v 1.53 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1994, 1995, 1997 Matt Thomas <matt@3am-software.com>
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.52 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.53 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -435,6 +435,7 @@ lemac_multicast_op(
static void
lemac_multicast_filter(lemac_softc_t *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ether_multistep step;
struct ether_multi *enm;
@@ -442,16 +443,19 @@ lemac_multicast_filter(lemac_softc_t *sc)
lemac_multicast_op(sc->sc_mctbl, etherbroadcastaddr, TRUE);
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (!LEMAC_ADDREQUAL(enm->enm_addrlo, enm->enm_addrhi)) {
sc->sc_flags |= LEMAC_ALLMULTI;
sc->sc_if.if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
return;
}
lemac_multicast_op(sc->sc_mctbl, enm->enm_addrlo, TRUE);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
sc->sc_flags &= ~LEMAC_ALLMULTI;
sc->sc_if.if_flags &= ~IFF_ALLMULTI;
}
diff --git a/sys/dev/ic/mb86960.c b/sys/dev/ic/mb86960.c
index 0c902d575f9..1595bccde36 100644
--- a/sys/dev/ic/mb86960.c
+++ b/sys/dev/ic/mb86960.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mb86960.c,v 1.91 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: mb86960.c,v 1.92 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.91 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.92 2019/05/28 07:41:48 msaitoh Exp $");
/*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@@ -1551,6 +1551,7 @@ mb86960_getmcaf(struct ethercom *ec, uint8_t *af)
goto allmulti;
memset(af, 0, FE_FILTER_LEN);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -1563,6 +1564,7 @@ mb86960_getmcaf(struct ethercom *ec, uint8_t *af)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1576,6 +1578,7 @@ mb86960_getmcaf(struct ethercom *ec, uint8_t *af)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
return;
diff --git a/sys/dev/ic/mtd803.c b/sys/dev/ic/mtd803.c
index 7b9d1e87347..6ebb69333ac 100644
--- a/sys/dev/ic/mtd803.c
+++ b/sys/dev/ic/mtd803.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mtd803.c,v 1.38 2019/05/23 10:40:39 msaitoh Exp $ */
+/* $NetBSD: mtd803.c,v 1.39 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
*
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.38 2019/05/23 10:40:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.39 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -839,6 +839,7 @@ mtd_setmulti(struct mtd_softc *sc)
return;
}
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/* We need the 6 most significant bits of the CRC */
@@ -849,6 +850,7 @@ mtd_setmulti(struct mtd_softc *sc)
++mcnt;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* Accept multicast bit needs to be on? */
if (mcnt)
diff --git a/sys/dev/ic/pdq_ifsubr.c b/sys/dev/ic/pdq_ifsubr.c
index 59f79d69125..02747c67d67 100644
--- a/sys/dev/ic/pdq_ifsubr.c
+++ b/sys/dev/ic/pdq_ifsubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pdq_ifsubr.c,v 1.65 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: pdq_ifsubr.c,v 1.66 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.65 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.66 2019/05/28 07:41:48 msaitoh Exp $");
#ifdef __NetBSD__
#include "opt_inet.h"
@@ -270,6 +270,7 @@ void
pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addr, size_t num_addrs)
{
pdq_softc_t *sc = pdq->pdq_os_ctx;
+ struct ethercom *ec = PDQ_FDDICOM(sc);
struct ether_multistep step;
struct ether_multi *enm;
@@ -284,7 +285,8 @@ pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addr, size_t num_addrs)
sc->sc_if.if_flags &= ~IFF_ALLMULTI;
#endif
- ETHER_FIRST_MULTI(step, PDQ_FDDICOM(sc), enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL && num_addrs > 0) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) {
((u_short *)addr->lanaddr_bytes)[0] = ((u_short *)enm->enm_addrlo)[0];
@@ -300,6 +302,7 @@ pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addr, size_t num_addrs)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/*
* If not all the address fit into the CAM, turn on all-multicast mode.
*/
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 95153482812..d6a61f9424b 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl81x9.c,v 1.105 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: rtl81x9.c,v 1.106 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.105 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.106 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -524,15 +524,14 @@ rtk_phy_statchg(struct ifnet *ifp)
void
rtk_setmulti(struct rtk_softc *sc)
{
- struct ifnet *ifp;
+ struct ethercom *ec = &sc->ethercom;
+ struct ifnet *ifp = &ec->ec_if;
uint32_t hashes[2] = { 0, 0 };
uint32_t rxfilt;
struct ether_multi *enm;
struct ether_multistep step;
int h, mcnt;
- ifp = &sc->ethercom.ec_if;
-
rxfilt = CSR_READ_4(sc, RTK_RXCFG);
if (ifp->if_flags & IFF_PROMISC) {
@@ -550,12 +549,15 @@ rtk_setmulti(struct rtk_softc *sc)
CSR_WRITE_4(sc, RTK_MAR4, 0);
/* now program new ones */
- ETHER_FIRST_MULTI(step, &sc->ethercom, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
mcnt = 0;
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = rtk_calchash(enm->enm_addrlo);
if (h < 32)
@@ -565,6 +567,7 @@ rtk_setmulti(struct rtk_softc *sc)
mcnt++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index c8bdc5b9023..263b99340ee 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.132 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: rtw.c,v 1.133 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights
* reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.132 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.133 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -2718,6 +2718,7 @@ rtw_pktfilt_load(struct rtw_softc *sc)
/*
* Program the 64-bit multicast hash filter.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/* XXX */
@@ -2731,6 +2732,7 @@ rtw_pktfilt_load(struct rtw_softc *sc)
hashes[hash >> 5] |= (1 << (hash & 0x1f));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* XXX accept all broadcast if scanning */
if ((ifp->if_flags & IFF_BROADCAST) != 0)
diff --git a/sys/dev/ic/seeq8005.c b/sys/dev/ic/seeq8005.c
index bbb5135cf21..3ee7acca3b4 100644
--- a/sys/dev/ic/seeq8005.c
+++ b/sys/dev/ic/seeq8005.c
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.63 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: seeq8005.c,v 1.64 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.63 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.64 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -556,7 +556,8 @@ ea_await_fifo_empty(struct seeq8005_softc *sc)
if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) &
SEEQ_STATUS_FIFO_EMPTY)
return;
- log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(sc->sc_dev));
+ log(LOG_ERR, "%s: DMA FIFO failed to empty\n",
+ device_xname(sc->sc_dev));
}
/*
@@ -1396,6 +1397,8 @@ ea_mc_reset_8004(struct seeq8005_softc *sc)
}
for (i = 0; i < 8; i++)
af[i] = 0;
+
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -1424,6 +1427,7 @@ ea_mc_reset_8004(struct seeq8005_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
ea_select_buffer(sc, SEEQ_BUFCODE_MULTICAST);
@@ -1442,12 +1446,14 @@ ea_mc_reset_8005(struct seeq8005_softc *sc)
naddr = 0;
maxaddrs = 5;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/* Have we got space? */
if (naddr >= maxaddrs ||
memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) {
ec->ec_if.if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
ea_ioctl(&ec->ec_if, SIOCSIFFLAGS, NULL);
return;
}
@@ -1456,6 +1462,8 @@ ea_mc_reset_8005(struct seeq8005_softc *sc)
naddr++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
+
for (; naddr < maxaddrs; naddr++)
sc->sc_config1 &= ~(SEEQ_CFG1_STATION_ADDR1 << naddr);
SEEQ_WRITE16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_CONFIG1,
diff --git a/sys/dev/ic/sgec.c b/sys/dev/ic/sgec.c
index c4cb8d63c99..277f1a1565c 100644
--- a/sys/dev/ic/sgec.c
+++ b/sys/dev/ic/sgec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sgec.c,v 1.50 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: sgec.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.50 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $");
#include "opt_inet.h"
@@ -650,6 +650,7 @@ ze_add_rxbuf(struct ze_softc *sc, int i)
void
ze_setup(struct ze_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ether_multi *enm;
struct ether_multistep step;
struct ze_cdata *zc = sc->sc_zedata;
@@ -674,7 +675,8 @@ ze_setup(struct ze_softc *sc)
*/
j = 16;
ifp->if_flags &= ~IFF_ALLMULTI;
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) {
ifp->if_flags |= IFF_ALLMULTI;
@@ -688,6 +690,7 @@ ze_setup(struct ze_softc *sc)
break;
}
}
+ ETHER_UNLOCK(ec);
/*
* ALLMULTI implies PROMISC in this driver.
diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c
index e01cd71e36d..b13795f26b5 100644
--- a/sys/dev/ic/smc83c170.c
+++ b/sys/dev/ic/smc83c170.c
@@ -1,4 +1,4 @@
-/* $NetBSD: smc83c170.c,v 1.89 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: smc83c170.c,v 1.90 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.89 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.90 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -1278,6 +1278,7 @@ epic_set_mchash(struct epic_softc *sc)
mchash[0] = mchash[1] = mchash[2] = mchash[3] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1289,6 +1290,7 @@ epic_set_mchash(struct epic_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1300,6 +1302,7 @@ epic_set_mchash(struct epic_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto sethash;
diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c
index a05a060cd2b..6b29a0b9a82 100644
--- a/sys/dev/ic/tulip.c
+++ b/sys/dev/ic/tulip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.195 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: tulip.c,v 1.196 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.195 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.196 2019/05/28 07:41:48 msaitoh Exp $");
#include <sys/param.h>
@@ -2613,6 +2613,7 @@ tlp_filter_setup(struct tulip_softc *sc)
sp = TULIP_CDSP(sc);
memset(TULIP_CDSP(sc), 0, TULIP_SETUP_PACKET_LEN);
cnt = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2624,6 +2625,7 @@ tlp_filter_setup(struct tulip_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
if (cnt == (TULIP_MAXADDRS - 2)) {
@@ -2632,6 +2634,7 @@ tlp_filter_setup(struct tulip_softc *sc)
* our station address and broadcast). Go to
* Hash-Perfect mode.
*/
+ ETHER_UNLOCK(ec);
goto hashperfect;
}
cnt++;
@@ -2640,6 +2643,7 @@ tlp_filter_setup(struct tulip_softc *sc)
*sp++ = htole32(TULIP_SP_FIELD(enm->enm_addrlo, 2));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (ifp->if_flags & IFF_BROADCAST) {
/* ...and the broadcast address. */
@@ -2674,6 +2678,7 @@ tlp_filter_setup(struct tulip_softc *sc)
sc->sc_filtmode = TDCTL_Tx_FT_HASH;
sp = TULIP_CDSP(sc);
memset(TULIP_CDSP(sc), 0, TULIP_SETUP_PACKET_LEN);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2685,12 +2690,14 @@ tlp_filter_setup(struct tulip_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
hash = tlp_mchash(enm->enm_addrlo, hashsize);
sp[hash >> 4] |= htole32(1 << (hash & 0xf));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (ifp->if_flags & IFF_BROADCAST) {
/* ...and the broadcast address. */
@@ -2919,6 +2926,7 @@ tlp_al981_filter_setup(struct tulip_softc *sc)
mchash[0] = mchash[1] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2930,6 +2938,7 @@ tlp_al981_filter_setup(struct tulip_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -2937,6 +2946,7 @@ tlp_al981_filter_setup(struct tulip_softc *sc)
mchash[hash >> 5] |= 1 << (hash & 0x1f);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
@@ -2984,6 +2994,7 @@ tlp_asix_filter_setup(struct tulip_softc *sc)
mchash[0] = mchash[1] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2995,6 +3006,7 @@ tlp_asix_filter_setup(struct tulip_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
hash = (ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26)
@@ -3005,6 +3017,7 @@ tlp_asix_filter_setup(struct tulip_softc *sc)
mchash[1] |= (1 << (hash - 32));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/ic/wi.c b/sys/dev/ic/wi.c
index bf17d8fc36d..1fdeb7a4c6b 100644
--- a/sys/dev/ic/wi.c
+++ b/sys/dev/ic/wi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wi.c,v 1.252 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: wi.c,v 1.253 2019/05/28 07:41:48 msaitoh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.252 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.253 2019/05/28 07:41:48 msaitoh Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@@ -2109,6 +2109,7 @@ wi_info_intr(struct wi_softc *sc)
STATIC int
wi_write_multi(struct wi_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp = &sc->sc_if;
int n;
struct wi_mcast mlist;
@@ -2124,17 +2125,21 @@ allmulti:
}
n = 0;
- ETHER_FIRST_MULTI(estep, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(estep, ec, enm);
while (enm != NULL) {
/* Punt on ranges or too many multicast addresses. */
if (!IEEE80211_ADDR_EQ(enm->enm_addrlo, enm->enm_addrhi) ||
- n >= sizeof(mlist) / sizeof(mlist.wi_mcast[0]))
+ n >= sizeof(mlist) / sizeof(mlist.wi_mcast[0])) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
IEEE80211_ADDR_COPY(&mlist.wi_mcast[n], enm->enm_addrlo);
n++;
ETHER_NEXT_MULTI(estep, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist,
IEEE80211_ADDR_LEN * n);
diff --git a/sys/dev/isa/if_iy.c b/sys/dev/isa/if_iy.c
index 1993d514036..4ac17d5c8c8 100644
--- a/sys/dev/isa/if_iy.c
+++ b/sys/dev/isa/if_iy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iy.c,v 1.107 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_iy.c,v 1.108 2019/05/28 07:41:49 msaitoh Exp $ */
/* #define IYDEBUG */
/* #define IYMEMDEBUG */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.107 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.108 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -1333,6 +1333,7 @@ iy_mc_setup(struct iy_softc *sc)
bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(len));
+ ETHER_LOCK(ecp);
ETHER_FIRST_MULTI(step, ecp, enm);
while (enm) {
/*
@@ -1343,6 +1344,7 @@ iy_mc_setup(struct iy_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ecp);
dum = bus_space_read_2(iot, ioh, MEM_PORT_REG); /* dummy read */
__USE(dum);
bus_space_write_2(iot, ioh, XMT_ADDR_REG, last);
@@ -1400,14 +1402,17 @@ iy_mc_reset(struct iy_softc *sc)
/*
* Step through the list of addresses.
*/
+ ETHER_LOCK(ecp);
ETHER_FIRST_MULTI(step, ecp, enm);
while (enm) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) {
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ecp);
goto setupmulti;
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ecp);
/* OK, we really need to do it now: */
#if 0
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE))
diff --git a/sys/dev/marvell/if_gfe.c b/sys/dev/marvell/if_gfe.c
index 71eb42e6fcb..d415dff2b1a 100644
--- a/sys/dev/marvell/if_gfe.c
+++ b/sys/dev/marvell/if_gfe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gfe.c,v 1.53 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.53 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -2024,6 +2024,7 @@ gfe_hash_fill(struct gfe_softc *sc)
sc->sc_flags &= ~GE_ALLMULTI;
if ((ec->ec_if.if_flags & IFF_PROMISC) == 0)
sc->sc_pcr &= ~ETH_EPCR_PM;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2037,6 +2038,7 @@ gfe_hash_fill(struct gfe_softc *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
GE_FUNC_EXIT(sc, "");
return error;
diff --git a/sys/dev/marvell/if_mvgbe.c b/sys/dev/marvell/if_mvgbe.c
index 85770f81a31..7d8821fcf03 100644
--- a/sys/dev/marvell/if_mvgbe.c
+++ b/sys/dev/marvell/if_mvgbe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvgbe.c,v 1.56 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_mvgbe.c,v 1.57 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.56 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.57 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_multiprocessor.h"
@@ -2180,10 +2180,12 @@ mvgbe_filter_setup(struct mvgbe_softc *sc)
goto allmulti;
}
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
/* ranges are complex and somewhat rare */
+ ETHER_UNLOCK(ec);
goto allmulti;
}
/* chip handles some IPv4 multicast specially */
@@ -2199,6 +2201,7 @@ mvgbe_filter_setup(struct mvgbe_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
goto set;
allmulti:
diff --git a/sys/dev/marvell/if_mvxpe.c b/sys/dev/marvell/if_mvxpe.c
index 7a422ddaf8d..fb8ed85edd2 100644
--- a/sys/dev/marvell/if_mvxpe.c
+++ b/sys/dev/marvell/if_mvxpe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvxpe.c,v 1.26 2019/05/24 06:26:38 msaitoh Exp $ */
+/* $NetBSD: if_mvxpe.c,v 1.27 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.26 2019/05/24 06:26:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.27 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_multiprocessor.h"
@@ -2717,10 +2717,12 @@ mvxpe_filter_setup(struct mvxpe_softc *sc)
goto allmulti;
}
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
/* ranges are complex and somewhat rare */
+ ETHER_UNLOCK(ec);
goto allmulti;
}
/* chip handles some IPv4 multicast specially */
@@ -2736,6 +2738,7 @@ mvxpe_filter_setup(struct mvxpe_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
goto set;
allmulti:
diff --git a/sys/dev/pci/if_age.c b/sys/dev/pci/if_age.c
index 1a6470d33e9..ed62ec0b418 100644
--- a/sys/dev/pci/if_age.c
+++ b/sys/dev/pci/if_age.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_age.c,v 1.58 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_age.c,v 1.59 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */
/*-
@@ -31,7 +31,7 @@
/* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.58 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.59 2019/05/28 07:41:49 msaitoh Exp $");
#include "vlan.h"
@@ -2287,12 +2287,14 @@ age_rxfilter(struct age_softc *sc)
/* Program new filter. */
memset(mchash, 0, sizeof(mchash));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c
index 93da2f4fa2b..b1a9d704b6c 100644
--- a/sys/dev/pci/if_alc.c
+++ b/sys/dev/pci/if_alc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_alc.c,v 1.36 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_alc.c,v 1.37 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $ */
/*-
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
@@ -3428,12 +3428,14 @@ alc_iff(struct alc_softc *sc)
/* Program new filter. */
memset(mchash, 0, sizeof(mchash));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
CSR_WRITE_4(sc, ALC_MAR0, mchash[0]);
diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c
index 659eb64cafb..698e60e2026 100644
--- a/sys/dev/pci/if_ale.c
+++ b/sys/dev/pci/if_ale.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ale.c,v 1.30 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_ale.c,v 1.31 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
@@ -32,7 +32,7 @@
/* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.30 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.31 2019/05/28 07:41:49 msaitoh Exp $");
#include "vlan.h"
@@ -2014,6 +2014,7 @@ ale_rxfilter(struct ale_softc *sc)
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
CSR_WRITE_4(sc, ALE_MAR0, mchash[0]);
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 3ae7f55e105..0aecc54ee33 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.332 2019/05/24 05:57:35 msaitoh Exp $ */
+/* $NetBSD: if_bge.c,v 1.333 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.332 2019/05/24 05:57:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.333 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1806,6 +1806,7 @@ bge_setmulti(struct bge_softc *sc)
goto allmulti;
/* Now program new ones. */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1817,6 +1818,7 @@ bge_setmulti(struct bge_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1828,6 +1830,7 @@ bge_setmulti(struct bge_softc *sc)
hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 84631de7c0b..c9b745e411d 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bnx.c,v 1.84 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_bnx.c,v 1.85 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $ */
/*-
@@ -35,7 +35,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.84 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.85 2019/05/28 07:41:49 msaitoh Exp $");
/*
* The following controllers are supported by this driver:
@@ -5620,10 +5620,12 @@ allmulti:
/* Accept one or more multicast(s). */
DBPRINT(sc, BNX_INFO, "Enabling selective multicast mode.\n");
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN)) {
+ ETHER_UNLOCK(ec);
goto allmulti;
}
h = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) &
@@ -5631,6 +5633,7 @@ allmulti:
hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
for (i = 0; i < NUM_MC_HASH_REGISTERS; i++)
REG_WR(sc, BNX_EMAC_MULTICAST_HASH0 + (i * 4),
diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c
index 5580e273ad3..5003a498332 100644
--- a/sys/dev/pci/if_cas.c
+++ b/sys/dev/pci/if_cas.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cas.c,v 1.34 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_cas.c,v 1.35 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */
/*
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.34 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.35 2019/05/28 07:41:49 msaitoh Exp $");
#ifndef _MODULE
#include "opt_inet.h"
@@ -1927,6 +1927,7 @@ cas_iff(struct cas_softc *sc)
for (i = 0; i < 16; i++)
hash[i] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
crc = ether_crc32_le(enm->enm_addrlo,
@@ -1940,6 +1941,7 @@ cas_iff(struct cas_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* Now load the hash table into the chip (if we are using it) */
for (i = 0; i < 16; i++) {
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c
index f4c27cc7183..4fb156a5dca 100644
--- a/sys/dev/pci/if_de.c
+++ b/sys/dev/pci/if_de.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_de.c,v 1.161 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_de.c,v 1.162 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
@@ -37,7 +37,7 @@
* board which support 21040, 21041, or 21140 (mostly).
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.161 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.162 2019/05/28 07:41:49 msaitoh Exp $");
#define TULIP_HDR_DATA
@@ -3205,6 +3205,7 @@ tulip_ifmedia_status(struct ifnet * const ifp, struct ifmediareq *req)
static void
tulip_addr_filter(tulip_softc_t * const sc)
{
+ struct ethercom *ec = TULIP_ETHERCOM(sc);
struct ether_multistep step;
struct ether_multi *enm;
@@ -3237,7 +3238,8 @@ tulip_addr_filter(tulip_softc_t * const sc)
* hardware).
*/
memset(sc->tulip_setupdata, 0, sizeof(sc->tulip_setupdata));
- ETHER_FIRST_MULTI(step, TULIP_ETHERCOM(sc), enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) {
hash = tulip_mchash(enm->enm_addrlo);
@@ -3254,6 +3256,7 @@ tulip_addr_filter(tulip_softc_t * const sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/*
* No reason to use a hash if we are going to be
* receiving every multicast.
@@ -3293,7 +3296,8 @@ tulip_addr_filter(tulip_softc_t * const sc)
/*
* Else can get perfect filtering for 16 addresses.
*/
- ETHER_FIRST_MULTI(step, TULIP_ETHERCOM(sc), enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
for (; enm != NULL; idx++) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) {
#if BYTE_ORDER == BIG_ENDIAN
@@ -3311,6 +3315,7 @@ tulip_addr_filter(tulip_softc_t * const sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/*
* Add the broadcast address.
*/
diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c
index 26db4ddbdb5..70c0607b0b8 100644
--- a/sys/dev/pci/if_dge.c
+++ b/sys/dev/pci/if_dge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_dge.c,v 1.53 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_dge.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.53 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $");
@@ -2267,6 +2267,7 @@ dge_set_filter(struct dge_softc *sc)
for (i = 0; i < MC_TABSIZE; i++)
CSR_WRITE(sc, DGE_MTA + (i << 2), 0);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -2278,6 +2279,7 @@ dge_set_filter(struct dge_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -2293,6 +2295,7 @@ dge_set_filter(struct dge_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c
index 999968d558c..fdfed5aa66b 100644
--- a/sys/dev/pci/if_et.c
+++ b/sys/dev/pci/if_et.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_et.c,v 1.23 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: if_et.c,v 1.24 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.23 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.24 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
#include "vlan.h"
@@ -1218,6 +1218,7 @@ et_setmulti(struct et_softc *sc)
bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
count = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
uint32_t *hp, h;
@@ -1245,6 +1246,7 @@ et_setmulti(struct et_softc *sc)
++count;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
for (i = 0; i < 4; ++i)
CSR_WRITE_4(sc, ET_MULTI_HASH + (i * 4), hash[i]);
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c
index 0290d2d7e4a..2f771e54800 100644
--- a/sys/dev/pci/if_jme.c
+++ b/sys/dev/pci/if_jme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_jme.c,v 1.42 2019/05/28 05:07:13 msaitoh Exp $ */
+/* $NetBSD: if_jme.c,v 1.43 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2008 Manuel Bouyer. All rights reserved.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.42 2019/05/28 05:07:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.43 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -1842,6 +1842,7 @@ jme_mac_config(jme_softc_t *sc)
static void
jme_set_filter(jme_softc_t *sc)
{
+ struct ethercom *ec = &sc->jme_ec;
struct ifnet *ifp = &sc->jme_if;
struct ether_multistep step;
struct ether_multi *enm;
@@ -1879,7 +1880,8 @@ jme_set_filter(jme_softc_t *sc)
rxcfg |= RXMAC_MULTICAST;
memset(hash, 0, sizeof(hash));
- ETHER_FIRST_MULTI(step, &sc->jme_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
#ifdef JEMDBUG
printf("%s: addrs %s %s\n", __func__,
@@ -1898,6 +1900,7 @@ jme_set_filter(jme_softc_t *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
#ifdef JMEDEBUG
printf("%s: hash1 %x has2 %x\n", __func__, hash[0], hash[1]);
#endif
diff --git a/sys/dev/pci/if_kse.c b/sys/dev/pci/if_kse.c
index 6fd446a33fa..4d07c72934f 100644
--- a/sys/dev/pci/if_kse.c
+++ b/sys/dev/pci/if_kse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kse.c,v 1.36 2019/05/23 10:40:39 msaitoh Exp $ */
+/* $NetBSD: if_kse.c,v 1.37 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.36 2019/05/23 10:40:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.37 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -1032,9 +1032,12 @@ kse_set_filter(struct kse_softc *sc)
if (ifp->if_flags & IFF_PROMISC)
return;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
- if (enm == NULL)
+ if (enm == NULL) {
+ ETHER_UNLOCK(ec);
return;
+ }
hashes[0] = hashes[1] = 0;
do {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1046,12 +1049,14 @@ kse_set_filter(struct kse_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
h = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26;
hashes[h >> 5] |= 1 << (h & 0x1f);
ETHER_NEXT_MULTI(step, enm);
} while (enm != NULL);
+ ETHER_UNLOCK(ec);
sc->sc_rxc |= RXC_MHTE;
CSR_WRITE_4(sc, MTR0, hashes[0]);
CSR_WRITE_4(sc, MTR1, hashes[1]);
diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c
index 0cff6099b8c..a3fe898dd88 100644
--- a/sys/dev/pci/if_lii.c
+++ b/sys/dev/pci/if_lii.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lii.c,v 1.24 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_lii.c,v 1.25 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.24 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.25 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -1174,11 +1174,13 @@ lii_setmulti(struct lii_softc *sc)
ifp->if_flags &= ~IFF_ALLMULTI;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
ifp->if_flags |= IFF_ALLMULTI;
mht0 = mht1 = 0;
+ ETHER_UNLOCK(ec);
goto alldone;
}
@@ -1191,6 +1193,7 @@ lii_setmulti(struct lii_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
alldone:
AT_WRITE_4(sc, ATL2_MHT, mht0);
diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c
index 30cfc9c149c..bd91bd837d6 100644
--- a/sys/dev/pci/if_msk.c
+++ b/sys/dev/pci/if_msk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.89 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_msk.c,v 1.90 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */
/*
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.89 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.90 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -371,11 +371,13 @@ allmulti:
}
} else {
/* First find the tail of the list. */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN)) {
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto allmulti;
}
h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) &
@@ -387,6 +389,7 @@ allmulti:
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
reg |= YU_RCR_MUFLEN;
}
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index a2000a00f6e..edade8e9a51 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_nfe.c,v 1.69 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: if_nfe.c,v 1.70 2019/05/28 07:41:49 msaitoh Exp $ */
/* $OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $ */
/*-
@@ -21,7 +21,7 @@
/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.69 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.70 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
#include "vlan.h"
@@ -1897,12 +1897,14 @@ nfe_setmulti(struct nfe_softc *sc)
memcpy(addr, etherbroadcastaddr, ETHER_ADDR_LEN);
memcpy(mask, etherbroadcastaddr, ETHER_ADDR_LEN);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
ifp->if_flags |= IFF_ALLMULTI;
memset(addr, 0, ETHER_ADDR_LEN);
memset(mask, 0, ETHER_ADDR_LEN);
+ ETHER_UNLOCK(ec);
goto done;
}
for (i = 0; i < ETHER_ADDR_LEN; i++) {
@@ -1911,6 +1913,7 @@ nfe_setmulti(struct nfe_softc *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
for (i = 0; i < ETHER_ADDR_LEN; i++)
mask[i] |= addr[i];
diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c
index f954431e8c0..8b27146921d 100644
--- a/sys/dev/pci/if_pcn.c
+++ b/sys/dev/pci/if_pcn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pcn.c,v 1.70 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_pcn.c,v 1.71 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.70 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.71 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1959,6 +1959,7 @@ pcn_set_filter(struct pcn_softc *sc)
sc->sc_initblock.init_ladrf[2] =
sc->sc_initblock.init_ladrf[3] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1970,6 +1971,7 @@ pcn_set_filter(struct pcn_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1984,6 +1986,7 @@ pcn_set_filter(struct pcn_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
return;
diff --git a/sys/dev/pci/if_sip.c b/sys/dev/pci/if_sip.c
index 6b054a8453e..f14558d48db 100644
--- a/sys/dev/pci/if_sip.c
+++ b/sys/dev/pci/if_sip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sip.c,v 1.172 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: if_sip.c,v 1.173 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.172 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.173 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -3041,6 +3041,7 @@ sipcom_sis900_set_filter(struct sip_softc *sc)
/* Set the corresponding bit in the hash table. */
mchash[crc >> 4] |= 1 << (crc & 0xf);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -3052,6 +3053,7 @@ sipcom_sis900_set_filter(struct sip_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -3072,6 +3074,7 @@ sipcom_sis900_set_filter(struct sip_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
goto setit;
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index 4d61e1676a8..eca33813f07 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sk.c,v 1.96 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_sk.c,v 1.97 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.96 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.97 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -633,11 +633,13 @@ allmulti:
} else {
i = 1;
/* First find the tail of the list. */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN)) {
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto allmulti;
}
DPRINTFN(2,("multicast address %s\n",
@@ -670,6 +672,7 @@ allmulti:
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
switch (sc->sk_type) {
diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c
index ab0d0dafdf9..1f77e425405 100644
--- a/sys/dev/pci/if_ste.c
+++ b/sys/dev/pci/if_ste.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ste.c,v 1.55 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_ste.c,v 1.56 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.55 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.56 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -1537,9 +1537,12 @@ ste_set_filter(struct ste_softc *sc)
memset(mchash, 0, sizeof(mchash));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
- if (enm == NULL)
+ if (enm == NULL) {
+ ETHER_UNLOCK(ec);
goto done;
+ }
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1551,6 +1554,7 @@ ste_set_filter(struct ste_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1564,6 +1568,7 @@ ste_set_filter(struct ste_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
sc->sc_ReceiveMode |= RM_ReceiveMulticastHash;
diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c
index 221113ca32c..57065dc43ba 100644
--- a/sys/dev/pci/if_stge.c
+++ b/sys/dev/pci/if_stge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stge.c,v 1.68 2019/05/23 10:51:39 msaitoh Exp $ */
+/* $NetBSD: if_stge.c,v 1.69 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.68 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.69 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -1882,9 +1882,12 @@ stge_set_filter(struct stge_softc *sc)
memset(mchash, 0, sizeof(mchash));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
- if (enm == NULL)
+ if (enm == NULL) {
+ ETHER_UNLOCK(ec);
goto done;
+ }
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1896,6 +1899,7 @@ stge_set_filter(struct stge_softc *sc)
* ranges is for IP multicast routing, for which the
* range is big enough to require all bits set.)
*/
+ ETHER_UNLOCK(ec);
goto allmulti;
}
@@ -1909,6 +1913,7 @@ stge_set_filter(struct stge_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
sc->sc_ReceiveMode |= RM_ReceiveMulticastHash;
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c
index df5e04dc105..9f2a40483b1 100644
--- a/sys/dev/pci/if_ti.c
+++ b/sys/dev/pci/if_ti.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.109 2019/05/23 10:40:39 msaitoh Exp $ */
+/* $NetBSD: if_ti.c,v 1.110 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.109 2019/05/23 10:40:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.110 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -1168,18 +1168,24 @@ ti_setmulti(struct ti_softc *sc)
* Remember all multicast addresses so that we can delete them
* later. Punt if there is a range of addresses or memory shortage.
*/
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
if ((mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF,
- M_NOWAIT)) == NULL)
+ M_NOWAIT)) == NULL) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
memcpy(&mc->mc_addr, enm->enm_addrlo, ETHER_ADDR_LEN);
SIMPLEQ_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* Accept only programmed multicast addresses */
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c
index e17e2ab9537..b7216333864 100644
--- a/sys/dev/pci/if_tl.c
+++ b/sys/dev/pci/if_tl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tl.c,v 1.115 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_tl.c,v 1.116 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.115 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.116 2019/05/28 07:41:49 msaitoh Exp $");
#undef TLDEBUG
#define TL_PRIV_STATS
@@ -1573,13 +1573,15 @@ tl_read_stats(tl_softc_t *sc)
static void
tl_addr_filter(tl_softc_t *sc)
{
+ struct ethercom *ec = &sc->tl_ec;
struct ether_multistep step;
struct ether_multi *enm;
uint32_t hash[2] = {0, 0};
int i;
sc->tl_if.if_flags &= ~IFF_ALLMULTI;
- ETHER_FIRST_MULTI(step, &sc->tl_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
#ifdef TLDEBUG
printf("%s: addrs %s %s\n", __func__,
@@ -1596,6 +1598,7 @@ tl_addr_filter(tl_softc_t *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
#ifdef TLDEBUG
printf("%s: hash1 %x has2 %x\n", __func__, hash[0], hash[1]);
#endif
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index d8db9645f17..2a7bc4f0ace 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.55 2019/05/23 10:30:36 msaitoh Exp $ */
+/* $NetBSD: if_txp.c,v 1.56 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2001
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.55 2019/05/23 10:30:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.56 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -1952,6 +1952,7 @@ again:
else {
hash[0] = hash[1] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -1967,6 +1968,7 @@ again:
* all bits set.)
*/
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto again;
}
@@ -1989,6 +1991,7 @@ again:
hash[hashbit / 32] |= (1 << hashbit % 32);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (mcnt > 0) {
filter |= TXP_RXFILT_HASHMULTI;
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index eee3d2bb547..6924d2872f2 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.71 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_vge.c,v 1.72 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 2004
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.71 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.72 2019/05/28 07:41:49 msaitoh Exp $");
/*
* VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -661,14 +661,17 @@ vge_setmulti(struct vge_softc *sc)
}
/* Now program new ones */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/*
* If multicast range, fall back to ALLMULTI.
*/
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
error = vge_cam_set(sc, enm->enm_addrlo);
if (error)
@@ -676,19 +679,23 @@ vge_setmulti(struct vge_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* If there were too many addresses, use the hash filter. */
if (error) {
vge_cam_clear(sc);
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
/*
* If multicast range, fall back to ALLMULTI.
*/
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = ether_crc32_be(enm->enm_addrlo,
ETHER_ADDR_LEN) >> 26;
@@ -696,6 +703,7 @@ vge_setmulti(struct vge_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
CSR_WRITE_4(sc, VGE_MAR0, hashes[0]);
CSR_WRITE_4(sc, VGE_MAR1, hashes[1]);
diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c
index b62dafc2065..2a8718a1f49 100644
--- a/sys/dev/pci/if_vr.c
+++ b/sys/dev/pci/if_vr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vr.c,v 1.129 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_vr.c,v 1.130 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.129 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.130 2019/05/28 07:41:49 msaitoh Exp $");
@@ -478,11 +478,14 @@ allmulti:
CSR_WRITE_4(sc, VR_MAR1, 0);
/* now program new ones */
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = vr_calchash(enm->enm_addrlo);
@@ -493,6 +496,7 @@ allmulti:
ETHER_NEXT_MULTI(step, enm);
mcnt++;
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/pci/if_vte.c b/sys/dev/pci/if_vte.c
index 8594085bc06..cf97ab701b9 100644
--- a/sys/dev/pci/if_vte.c
+++ b/sys/dev/pci/if_vte.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vte.c,v 1.25 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_vte.c,v 1.26 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2011 Manuel Bouyer. All rights reserved.
@@ -55,7 +55,7 @@
/* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.25 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.26 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1565,6 +1565,7 @@ vte_init_rx_ring(struct vte_softc *sc)
static void
vte_rxfilter(struct vte_softc *sc)
{
+ struct ethercom *ec = &sc->vte_ec;
struct ether_multistep step;
struct ether_multi *enm;
struct ifnet *ifp;
@@ -1601,7 +1602,8 @@ vte_rxfilter(struct vte_softc *sc)
goto chipit;
}
- ETHER_FIRST_MULTI(step, &sc->vte_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
nperf = 0;
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)
@@ -1612,6 +1614,7 @@ vte_rxfilter(struct vte_softc *sc)
mchash[1] = 0xFFFF;
mchash[2] = 0xFFFF;
mchash[3] = 0xFFFF;
+ ETHER_UNLOCK(ec);
goto chipit;
}
/*
@@ -1631,6 +1634,7 @@ vte_rxfilter(struct vte_softc *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (mchash[0] != 0 || mchash[1] != 0 || mchash[2] != 0 ||
mchash[3] != 0)
mcr |= MCR0_MULTICAST;
diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c
index fe51810ed6d..5a744e176b9 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xge.c,v 1.30 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_xge.c,v 1.31 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.30 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.31 2019/05/28 07:41:49 msaitoh Exp $");
#include <sys/param.h>
@@ -887,14 +887,18 @@ xge_mcast_filter(struct xge_softc *sc)
int i, numaddr = 1; /* first slot used for card unicast address */
uint64_t val;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
/* Skip ranges */
+ ETHER_UNLOCK(ec);
goto allmulti;
}
- if (numaddr == MAX_MCAST_ADDR)
+ if (numaddr == MAX_MCAST_ADDR) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
for (val = 0, i = 0; i < ETHER_ADDR_LEN; i++) {
val <<= 8;
val |= enm->enm_addrlo[i];
@@ -908,6 +912,7 @@ xge_mcast_filter(struct xge_softc *sc)
numaddr++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* set the remaining entries to the broadcast address */
for (i = numaddr; i < MAX_MCAST_ADDR; i++) {
PIF_WCSR(RMAC_ADDR_DATA0_MEM, 0xffffffffffff0000ULL);
diff --git a/sys/dev/pcmcia/if_ray.c b/sys/dev/pcmcia/if_ray.c
index ae329de72b3..f48227cc1d6 100644
--- a/sys/dev/pcmcia/if_ray.c
+++ b/sys/dev/pcmcia/if_ray.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ray.c,v 1.93 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_ray.c,v 1.94 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 2000 Christian E. Hopps
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.93 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.94 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -2827,6 +2827,7 @@ ray_update_mcast(struct ray_softc *sc)
/* see if we have any ranges */
if ((count = sc->sc_ec.ec_multicnt) < 17) {
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm) {
/* see if this is a range */
@@ -2837,6 +2838,7 @@ ray_update_mcast(struct ray_softc *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
}
/* track this stuff even when not running */
@@ -2858,12 +2860,14 @@ ray_update_mcast(struct ray_softc *sc)
return;
SRAM_WRITE_FIELD_1(sc, ccs, ray_cmd_update_mcast, c_nmcast, count);
bufp = RAY_HOST_TO_ECF_BASE;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm) {
ray_write_region(sc, bufp, enm->enm_addrlo, ETHER_ADDR_LEN);
bufp += ETHER_ADDR_LEN;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
(void)ray_issue_cmd(sc, ccs, SCP_UPD_MCAST);
}
diff --git a/sys/dev/pcmcia/if_xi.c b/sys/dev/pcmcia/if_xi.c
index 3da9cbc8d94..5b616815c33 100644
--- a/sys/dev/pcmcia/if_xi.c
+++ b/sys/dev/pcmcia/if_xi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xi.c,v 1.89 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_xi.c,v 1.90 2019/05/28 07:41:49 msaitoh Exp $ */
/* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */
/*
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.89 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.90 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -944,7 +944,7 @@ xi_set_address(struct xi_softc *sc)
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
- struct ethercom *ether = &sc->sc_ethercom;
+ struct ethercom *ec = &sc->sc_ethercom;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
struct ether_multistep step;
struct ether_multi *enm;
@@ -965,12 +965,13 @@ xi_set_address(struct xi_softc *sc)
indaddr[i] = enaddr[i];
num = 1;
- if (ether->ec_multicnt > 9) {
+ if (ec->ec_multicnt > 9) {
ifp->if_flags |= IFF_ALLMULTI;
goto done;
}
- ETHER_FIRST_MULTI(step, ether, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
for (; enm; num++) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
sizeof(enm->enm_addrlo)) != 0) {
@@ -980,6 +981,7 @@ xi_set_address(struct xi_softc *sc)
* XXX should we be setting IFF_ALLMULTI here?
*/
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto done;
}
if (sc->sc_chipset >= XI_CHIPSET_MOHAWK)
@@ -990,6 +992,7 @@ xi_set_address(struct xi_softc *sc)
indaddr[num * 6 + i] = enm->enm_addrlo[i];
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
done:
diff --git a/sys/dev/qbus/if_il.c b/sys/dev/qbus/if_il.c
index fbe99bd8585..0a89ece29e3 100644
--- a/sys/dev/qbus/if_il.c
+++ b/sys/dev/qbus/if_il.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_il.c,v 1.34 2019/05/24 08:29:17 msaitoh Exp $ */
+/* $NetBSD: if_il.c,v 1.35 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.34 2019/05/24 08:29:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.35 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -335,6 +335,7 @@ too_many_multis:
goto out;
} else {
int i;
+ struct ethercom *ec = &sc->sc_ec;
register struct ether_addr *ep = sc->sc_maddrs;
struct ether_multi *enm;
struct ether_multistep step;
@@ -345,7 +346,8 @@ too_many_multis:
* multicasts.
*/
i = 0;
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (++i > 63 /* && k != 0 */) {
break;
@@ -353,6 +355,7 @@ too_many_multis:
*ep++ = *(struct ether_addr *)enm->enm_addrlo;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
if (i == 0) {
/* no multicasts! */
} else if (i <= 63) {
diff --git a/sys/dev/qbus/if_qe.c b/sys/dev/qbus/if_qe.c
index 584f7e15b22..a49d758a142 100644
--- a/sys/dev/qbus/if_qe.c
+++ b/sys/dev/qbus/if_qe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_qe.c,v 1.80 2019/05/23 10:57:28 msaitoh Exp $ */
+/* $NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.80 2019/05/23 10:57:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_inet.h"
@@ -769,6 +769,7 @@ qe_add_rxbuf(struct qe_softc *sc, int i)
void
qe_setup(struct qe_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ether_multi *enm;
struct ether_multistep step;
struct qe_cdata *qc = sc->sc_qedata;
@@ -797,7 +798,8 @@ qe_setup(struct qe_softc *sc)
*/
j = 3; k = 0;
ifp->if_flags &= ~IFF_ALLMULTI;
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) {
ifp->if_flags |= IFF_ALLMULTI;
@@ -815,6 +817,7 @@ qe_setup(struct qe_softc *sc)
}
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
idx = sc->sc_nexttx;
qc->qc_xmit[idx].qe_buf_len = -64;
diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c
index b3d92ac2ac2..d91f7e0ba2f 100644
--- a/sys/dev/sbus/be.c
+++ b/sys/dev/sbus/be.c
@@ -1,4 +1,4 @@
-/* $NetBSD: be.c,v 1.92 2019/04/26 06:33:34 msaitoh Exp $ */
+/* $NetBSD: be.c,v 1.93 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.92 2019/04/26 06:33:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.93 2019/05/28 07:41:49 msaitoh Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -1148,6 +1148,7 @@ be_mcreset(struct be_softc *sc)
hash[3] = hash[2] = hash[1] = hash[0] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
@@ -1163,6 +1164,7 @@ be_mcreset(struct be_softc *sc)
*/
hash[3] = hash[2] = hash[1] = hash[0] = 0xffff;
ifp->if_flags |= IFF_ALLMULTI;
+ ETHER_UNLOCK(ec);
goto chipit;
}
@@ -1173,6 +1175,7 @@ be_mcreset(struct be_softc *sc)
hash[crc >> 4] |= 1 << (crc & 0xf);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c
index cca6e5ced5d..7b9fd771084 100644
--- a/sys/dev/sbus/qe.c
+++ b/sys/dev/sbus/qe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: qe.c,v 1.73 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: qe.c,v 1.74 2019/05/28 07:41:49 msaitoh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.73 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.74 2019/05/28 07:41:49 msaitoh Exp $");
#define QEDEBUG
@@ -1092,6 +1092,7 @@ qe_mcreset(struct qe_softc *sc)
hash[3] = hash[2] = hash[1] = hash[0] = 0;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -1119,6 +1120,7 @@ qe_mcreset(struct qe_softc *sc)
hash[crc >> 4] |= 1 << (crc & 0xf);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* We need to byte-swap the hash before writing to the chip. */
for (i = 0; i < 7; i += 2) {
diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c
index ba96dac45a0..31f3a2f3cdd 100644
--- a/sys/dev/scsipi/if_se.c
+++ b/sys/dev/scsipi/if_se.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_se.c,v 1.101 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_se.c,v 1.102 2019/05/28 07:41:50 msaitoh Exp $ */
/*
* Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au>
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.101 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.102 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -888,6 +888,7 @@ sc_set_all_multi(struct se_softc *sc, int set)
struct ether_multi *enm;
struct ether_multistep step;
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
@@ -904,6 +905,7 @@ sc_set_all_multi(struct se_softc *sc, int set)
* typically not possible. The only real alternative
* is to go into promicuous mode and filter by hand.
*/
+ ETHER_UNLOCK(ec);
return (ENODEV);
}
@@ -914,6 +916,8 @@ sc_set_all_multi(struct se_softc *sc, int set)
return (error);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
+
return (error);
}
#endif /* not used */
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 9ec0e856f01..f333496c10f 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.153 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_aue.c,v 1.154 2019/05/28 07:41:50 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.153 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.154 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -582,6 +582,7 @@ aue_crc(void *addrv)
Static void
aue_setmulti(struct aue_softc *sc)
{
+ struct ethercom *ec = &sc->aue_ec;
struct ifnet *ifp;
struct ether_multi *enm;
struct ether_multistep step;
@@ -605,16 +606,20 @@ allmulti:
aue_csr_write_1(sc, AUE_MAR0 + i, 0);
/* now program new ones */
- ETHER_FIRST_MULTI(step, &sc->aue_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo,
- enm->enm_addrhi, ETHER_ADDR_LEN) != 0)
+ enm->enm_addrhi, ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = aue_crc(enm->enm_addrlo);
AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
}
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index e8e1aabb854..648b8862259 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axe.c,v 1.97 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_axe.c,v 1.98 2019/05/28 07:41:50 msaitoh Exp $ */
/* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
/*
@@ -87,7 +87,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.97 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.98 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -471,6 +471,7 @@ static void
axe_setmulti(struct axe_softc *sc)
{
AXEHIST_FUNC(); AXEHIST_CALLED();
+ struct ethercom *ec = &sc->axe_ec;
struct ifnet *ifp = &sc->sc_if;
struct ether_multi *enm;
struct ether_multistep step;
@@ -503,16 +504,20 @@ axe_setmulti(struct axe_softc *sc)
}
/* Now program new ones */
- ETHER_FIRST_MULTI(step, &sc->axe_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26;
hashtbl[h >> 3] |= 1U << (h & 7);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
rxmode |= AXE_RXCMD_MULTICAST;
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 9067e9c5048..92f1efdbc1d 100644
--- a/sys/dev/usb/if_axen.c
+++ b/sys/dev/usb/if_axen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axen.c,v 1.40 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_axen.c,v 1.41 2019/05/28 07:41:50 msaitoh Exp $ */
/* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.40 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.41 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -370,6 +370,7 @@ allmulti: ifp->if_flags |= IFF_ALLMULTI;
/* now program new ones */
DPRINTF(("%s: initializing hash table\n",
device_xname(sc->axen_dev)));
+ ETHER_LOCK(ec);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -377,6 +378,7 @@ allmulti: ifp->if_flags |= IFF_ALLMULTI;
DPRINTF(("%s: allmulti\n",
device_xname(sc->axen_dev)));
memset(hashtbl, 0, sizeof(hashtbl));
+ ETHER_UNLOCK(ec);
goto allmulti;
}
h = ether_crc32_be(enm->enm_addrlo,
@@ -387,6 +389,7 @@ allmulti: ifp->if_flags |= IFF_ALLMULTI;
ether_sprintf(enm->enm_addrlo)));
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
rxmode |= AXEN_RXCTL_ACPT_MCAST;
}
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 52bb105540d..81a17145760 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cue.c,v 1.83 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_cue.c,v 1.84 2019/05/28 07:41:50 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.83 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.84 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -356,6 +356,7 @@ cue_crc(const char *addr)
Static void
cue_setmulti(struct cue_softc *sc)
{
+ struct ethercom *ec = &sc->cue_ec;
struct ifnet *ifp;
struct ether_multi *enm;
struct ether_multistep step;
@@ -381,16 +382,20 @@ allmulti:
sc->cue_mctab[i] = 0;
/* now program new ones */
- ETHER_FIRST_MULTI(step, &sc->cue_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo,
- enm->enm_addrhi, ETHER_ADDR_LEN) != 0)
+ enm->enm_addrhi, ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = cue_crc(enm->enm_addrlo);
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index f6b6bf83826..5a968e78eea 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kue.c,v 1.95 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_kue.c,v 1.96 2019/05/28 07:41:50 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.95 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.96 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -315,6 +315,7 @@ kue_load_fw(struct kue_softc *sc)
static void
kue_setmulti(struct kue_softc *sc)
{
+ struct ethercom *ec = &sc->kue_ec;
struct ifnet *ifp = GET_IFP(sc);
struct ether_multi *enm;
struct ether_multistep step;
@@ -334,17 +335,21 @@ allmulti:
sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI;
i = 0;
- ETHER_FIRST_MULTI(step, &sc->kue_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (i == KUE_MCFILTCNT(sc) ||
memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
memcpy(KUE_MCFILT(sc, i), enm->enm_addrlo, ETHER_ADDR_LEN);
ETHER_NEXT_MULTI(step, enm);
i++;
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/usb/if_mue.c b/sys/dev/usb/if_mue.c
index 4e48bbabbf8..9da2b38d319 100644
--- a/sys/dev/usb/if_mue.c
+++ b/sys/dev/usb/if_mue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mue.c,v 1.47 2019/05/26 17:48:47 mlelstv Exp $ */
+/* $NetBSD: if_mue.c,v 1.48 2019/05/28 07:41:50 msaitoh Exp $ */
/* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */
/*
@@ -20,7 +20,7 @@
/* Driver for Microchip LAN7500/LAN7800 chipsets. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.47 2019/05/26 17:48:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.48 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1349,6 +1349,7 @@ mue_prepare_tso(struct mue_softc *sc, struct mbuf *m)
static void
mue_setmulti(struct mue_softc *sc)
{
+ struct ethercom *ec = &sc->mue_ec;
struct ifnet *ifp = GET_IFP(sc);
const uint8_t *enaddr = CLLADDR(ifp->if_sadl);
struct ether_multi *enm;
@@ -1386,13 +1387,15 @@ allmulti: rxfilt |= MUE_RFE_CTL_MULTICAST;
pfiltbl[0][0] = MUE_ENADDR_HI(enaddr) | MUE_ADDR_FILTX_VALID;
pfiltbl[0][1] = MUE_ENADDR_LO(enaddr);
i = 1;
- ETHER_FIRST_MULTI(step, &sc->mue_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
ETHER_ADDR_LEN)) {
memset(pfiltbl, 0, sizeof(pfiltbl));
memset(hashtbl, 0, sizeof(hashtbl));
rxfilt &= ~MUE_RFE_CTL_MULTICAST_HASH;
+ ETHER_UNLOCK(ec);
goto allmulti;
}
if (i < MUE_NUM_ADDR_FILTX) {
@@ -1410,6 +1413,7 @@ allmulti: rxfilt |= MUE_RFE_CTL_MULTICAST;
i++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
rxfilt |= MUE_RFE_CTL_PERFECT;
ifp->if_flags &= ~IFF_ALLMULTI;
if (rxfilt & MUE_RFE_CTL_MULTICAST_HASH)
diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c
index e58b03f0f2b..0f7b28ed3a8 100644
--- a/sys/dev/usb/if_otus.c
+++ b/sys/dev/usb/if_otus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_otus.c,v 1.37 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_otus.c,v 1.38 2019/05/28 07:41:50 msaitoh Exp $ */
/* $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.37 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.38 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2275,6 +2275,7 @@ otus_ioctl(struct ifnet *ifp, u_long cmd, void *data)
Static int
otus_set_multi(struct otus_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp;
struct ether_multi *enm;
struct ether_multistep step;
@@ -2290,7 +2291,8 @@ otus_set_multi(struct otus_softc *sc)
goto done;
}
lo = hi = 0;
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
ifp->if_flags |= IFF_ALLMULTI;
@@ -2305,6 +2307,7 @@ otus_set_multi(struct otus_softc *sc)
ETHER_NEXT_MULTI(step, enm);
}
done:
+ ETHER_UNLOCK(ec);
mutex_enter(&sc->sc_write_mtx);
hi |= 1 << 31; /* Make sure the broadcast bit is set. */
otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, lo);
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 44a14b074b1..42d9d4fe105 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_udav.c,v 1.58 2019/05/23 10:57:29 msaitoh Exp $ */
+/* $NetBSD: if_udav.c,v 1.59 2019/05/28 07:41:50 msaitoh Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.58 2019/05/23 10:57:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.59 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -783,6 +783,7 @@ udav_activate(device_t self, enum devact act)
Static void
udav_setmulti(struct udav_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp;
struct ether_multi *enm;
struct ether_multistep step;
@@ -806,7 +807,7 @@ udav_setmulti(struct udav_softc *sc)
UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_ALL | UDAV_RCR_PRMSC);
return;
} else if (ifp->if_flags & IFF_ALLMULTI) {
- allmulti:
+allmulti:
ifp->if_flags |= IFF_ALLMULTI;
UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_ALL);
UDAV_CLRBIT(sc, UDAV_RCR, UDAV_RCR_PRMSC);
@@ -819,16 +820,20 @@ udav_setmulti(struct udav_softc *sc)
udav_csr_write(sc, UDAV_MAR, hashes, sizeof(hashes));
/* now program new ones */
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = UDAV_CALCHASH(enm->enm_addrlo);
hashes[h>>3] |= 1 << (h & 0x7);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
/* disable all multicast */
ifp->if_flags &= ~IFF_ALLMULTI;
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index 22c0dcb9cfe..ab984de3236 100644
--- a/sys/dev/usb/if_ure.c
+++ b/sys/dev/usb/if_ure.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ure.c,v 1.6 2019/05/23 13:10:52 msaitoh Exp $ */
+/* $NetBSD: if_ure.c,v 1.7 2019/05/28 07:41:50 msaitoh Exp $ */
/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
/*-
* Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org>
@@ -29,7 +29,7 @@
/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.6 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.7 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -412,6 +412,7 @@ ure_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
static void
ure_iff(struct ure_softc *sc)
{
+ struct ethercom *ec = &sc->ure_ec;
struct ifnet *ifp = GET_IFP(sc);
struct ether_multi *enm;
struct ether_multistep step;
@@ -440,11 +441,14 @@ allmulti: ifp->if_flags |= IFF_ALLMULTI;
} else {
rxmode |= URE_RCR_AM;
- ETHER_FIRST_MULTI(step, &sc->ure_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN))
+ ETHER_ADDR_LEN)) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
hash = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN)
>> 26;
@@ -455,6 +459,7 @@ allmulti: ifp->if_flags |= IFF_ALLMULTI;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
hash = bswap32(hashes[0]);
hashes[0] = bswap32(hashes[1]);
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index 901d28ca06f..d722b28d676 100644
--- a/sys/dev/usb/if_url.c
+++ b/sys/dev/usb/if_url.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_url.c,v 1.64 2019/05/23 10:57:29 msaitoh Exp $ */
+/* $NetBSD: if_url.c,v 1.65 2019/05/28 07:41:50 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.64 2019/05/23 10:57:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.65 2019/05/28 07:41:50 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -658,6 +658,7 @@ url_activate(device_t self, enum devact act)
Static void
url_setmulti(struct url_softc *sc)
{
+ struct ethercom *ec = &sc->sc_ec;
struct ifnet *ifp;
struct ether_multi *enm;
struct ether_multistep step;
@@ -676,7 +677,7 @@ url_setmulti(struct url_softc *sc)
URL_SETBIT2(sc, URL_RCR, URL_RCR_AAM | URL_RCR_AAP);
return;
} else if (ifp->if_flags & IFF_ALLMULTI) {
- allmulti:
+allmulti:
ifp->if_flags |= IFF_ALLMULTI;
URL_SETBIT2(sc, URL_RCR, URL_RCR_AAM);
URL_CLRBIT2(sc, URL_RCR, URL_RCR_AAP);
@@ -688,11 +689,14 @@ url_setmulti(struct url_softc *sc)
url_csr_write_4(sc, URL_MAR4, 0);
/* now program new ones */
- ETHER_FIRST_MULTI(step, &sc->sc_ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
- ETHER_ADDR_LEN) != 0)
+ ETHER_ADDR_LEN) != 0) {
+ ETHER_UNLOCK(ec);
goto allmulti;
+ }
h = url_calchash(enm->enm_addrlo);
if (h < 32)
@@ -702,6 +706,7 @@ url_setmulti(struct url_softc *sc)
mcnt++;
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(ec);
ifp->if_flags &= ~IFF_ALLMULTI;