summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-03 05:52:46 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-03 05:52:46 +0000
commitfc75e9aa455ba7265f6003b68d9bcba36b6b90c1 (patch)
tree715e5f5efc54d1084f5ad385a327ff816064124b /sys/dev
parentd7fcdbca218f79e52d16ff2585334808f13a4ddb (diff)
usbnet: Take the core lock around uno_mcast.
Every driver does this already. This will enable us to change the lock that serializes access to the registers so we can go back to doing this synchronously in SIOCADDMULTI/SIOCDELMULTI.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_aue.c7
-rw-r--r--sys/dev/usb/if_axe.c8
-rw-r--r--sys/dev/usb/if_axen.c8
-rw-r--r--sys/dev/usb/if_cue.c8
-rw-r--r--sys/dev/usb/if_kue.c8
-rw-r--r--sys/dev/usb/if_mos.c8
-rw-r--r--sys/dev/usb/if_mue.c8
-rw-r--r--sys/dev/usb/if_smsc.c8
-rw-r--r--sys/dev/usb/if_udav.c8
-rw-r--r--sys/dev/usb/if_ure.c8
-rw-r--r--sys/dev/usb/if_url.c8
-rw-r--r--sys/dev/usb/usbnet.c9
12 files changed, 28 insertions, 68 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 4be9ee2a6f8..ba01de56c61 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.176 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_aue.c,v 1.177 2022/03/03 05:52:46 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.176 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.177 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1003,7 +1003,6 @@ aue_uno_init(struct ifnet *ifp)
static void
aue_uno_mcast(struct ifnet *ifp)
{
- struct usbnet * const un = ifp->if_softc;
AUEHIST_FUNC();
AUEHIST_CALLARGSN(5, "aue%jd: enter",
@@ -1014,9 +1013,7 @@ aue_uno_mcast(struct ifnet *ifp)
* XXX I feel like this is pretty heavy-handed! Maybe we could
* make do with aue_setiff_locked instead?
*/
- usbnet_lock_core(un);
aue_uno_init(ifp);
- usbnet_unlock_core(un);
}
static void
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 9a31875f7e4..ad2218fa34d 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.139 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_axe.c,v 1.140 2022/03/03 05:52:46 riastradh 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.139 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.140 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1311,11 +1311,7 @@ axe_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
axe_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
static void
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 18fb2337a21..39507faf78b 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.81 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.82 2022/03/03 05:52:46 riastradh 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.81 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.82 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -574,11 +574,7 @@ axen_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
axen_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static int
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index dc1aad04d2c..69761bd883f 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.97 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_cue.c,v 1.98 2022/03/03 05:52:46 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.97 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.98 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -672,11 +672,7 @@ cue_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
cue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
/* Stop and reset the adapter. */
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 4b2b77a9f5e..d5d13c0d57a 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.110 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_kue.c,v 1.111 2022/03/03 05:52:46 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.110 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.111 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -632,11 +632,7 @@ kue_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
kue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
#ifdef _MODULE
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index b1528b3a8b9..4f85c1b539a 100644
--- a/sys/dev/usb/if_mos.c
+++ b/sys/dev/usb/if_mos.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mos.c,v 1.13 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_mos.c,v 1.14 2022/03/03 05:52:46 riastradh Exp $ */
/* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */
/*
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.13 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.14 2022/03/03 05:52:46 riastradh Exp $");
#include <sys/param.h>
@@ -764,11 +764,7 @@ mos_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
mos_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
void
diff --git a/sys/dev/usb/if_mue.c b/sys/dev/usb/if_mue.c
index 14ca350c499..7dbc60a6fc5 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.70 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_mue.c,v 1.71 2022/03/03 05:52:46 riastradh 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.70 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.71 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1281,11 +1281,7 @@ mue_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
mue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static void
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index 82a04caa3c0..1cc04c6337b 100644
--- a/sys/dev/usb/if_smsc.c
+++ b/sys/dev/usb/if_smsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_smsc.c,v 1.79 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.80 2022/03/03 05:52:46 riastradh Exp $ */
/* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.79 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.80 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -762,11 +762,7 @@ smsc_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
smsc_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static int
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 9c75418b475..5bee35ca338 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.84 2022/03/03 05:51:44 riastradh Exp $ */
+/* $NetBSD: if_udav.c,v 1.85 2022/03/03 05:52:46 riastradh 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.84 2022/03/03 05:51:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.85 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -716,11 +716,7 @@ udav_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
udav_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index 56f5ea81810..5ec39032edf 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.46 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_ure.c,v 1.47 2022/03/03 05:52:46 riastradh Exp $ */
/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
/*-
@@ -30,7 +30,7 @@
/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.46 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.47 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -795,11 +795,7 @@ ure_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
ure_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
static int
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index e21e8ee3388..10d9d9a3f12 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.85 2022/03/03 05:52:35 riastradh Exp $ */
+/* $NetBSD: if_url.c,v 1.86 2022/03/03 05:52:46 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.85 2022/03/03 05:52:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.86 2022/03/03 05:52:46 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -550,11 +550,7 @@ url_uno_mcast(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
url_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index e90b7f7249f..b8ac0f80d06 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.81 2022/03/03 05:52:46 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.81 2022/03/03 05:52:46 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1060,8 +1060,11 @@ usbnet_mcast_task(void *arg)
*/
IFNET_LOCK(ifp);
if (ifp->if_flags & IFF_RUNNING) {
- if (un->un_ops->uno_mcast)
+ if (un->un_ops->uno_mcast) {
+ mutex_enter(&un->un_pri->unp_core_lock);
(*un->un_ops->uno_mcast)(ifp);
+ mutex_exit(&un->un_pri->unp_core_lock);
+ }
}
IFNET_UNLOCK(ifp);
}