Thu Mar 3 05:52:46 2022 UTC ()
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.
(riastradh)
diff -r1.176 -r1.177 src/sys/dev/usb/if_aue.c
diff -r1.139 -r1.140 src/sys/dev/usb/if_axe.c
diff -r1.81 -r1.82 src/sys/dev/usb/if_axen.c
diff -r1.97 -r1.98 src/sys/dev/usb/if_cue.c
diff -r1.110 -r1.111 src/sys/dev/usb/if_kue.c
diff -r1.13 -r1.14 src/sys/dev/usb/if_mos.c
diff -r1.70 -r1.71 src/sys/dev/usb/if_mue.c
diff -r1.79 -r1.80 src/sys/dev/usb/if_smsc.c
diff -r1.84 -r1.85 src/sys/dev/usb/if_udav.c
diff -r1.46 -r1.47 src/sys/dev/usb/if_ure.c
diff -r1.85 -r1.86 src/sys/dev/usb/if_url.c
diff -r1.80 -r1.81 src/sys/dev/usb/usbnet.c
--- src/sys/dev/usb/if_aue.c 2022/03/03 05:52:35 1.176
+++ src/sys/dev/usb/if_aue.c 2022/03/03 05:52:46 1.177
@@ -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 @@
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 @@
* 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
--- src/sys/dev/usb/if_axe.c 2022/03/03 05:52:35 1.139
+++ src/sys/dev/usb/if_axe.c 2022/03/03 05:52:46 1.140
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
axe_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
static void
--- src/sys/dev/usb/if_axen.c 2022/03/03 05:52:35 1.81
+++ src/sys/dev/usb/if_axen.c 2022/03/03 05:52:46 1.82
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
axen_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static int
--- src/sys/dev/usb/if_cue.c 2022/03/03 05:52:35 1.97
+++ src/sys/dev/usb/if_cue.c 2022/03/03 05:52:46 1.98
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
cue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
/* Stop and reset the adapter. */
--- src/sys/dev/usb/if_kue.c 2022/03/03 05:52:35 1.110
+++ src/sys/dev/usb/if_kue.c 2022/03/03 05:52:46 1.111
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
kue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
#ifdef _MODULE
--- src/sys/dev/usb/if_mos.c 2022/03/03 05:52:35 1.13
+++ src/sys/dev/usb/if_mos.c 2022/03/03 05:52:46 1.14
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
mos_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
void
--- src/sys/dev/usb/if_mue.c 2022/03/03 05:52:35 1.70
+++ src/sys/dev/usb/if_mue.c 2022/03/03 05:52:46 1.71
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
mue_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static void
--- src/sys/dev/usb/if_smsc.c 2022/03/03 05:52:35 1.79
+++ src/sys/dev/usb/if_smsc.c 2022/03/03 05:52:46 1.80
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
smsc_setiff_locked(un);
-
- usbnet_unlock_core(un);
}
static int
--- src/sys/dev/usb/if_udav.c 2022/03/03 05:51:44 1.84
+++ src/sys/dev/usb/if_udav.c 2022/03/03 05:52:46 1.85
@@ -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 @@
{
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. */
--- src/sys/dev/usb/if_ure.c 2022/03/03 05:52:35 1.46
+++ src/sys/dev/usb/if_ure.c 2022/03/03 05:52:46 1.47
@@ -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 @@
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
-
ure_rcvfilt_locked(un);
-
- usbnet_unlock_core(un);
}
static int
--- src/sys/dev/usb/if_url.c 2022/03/03 05:52:35 1.85
+++ src/sys/dev/usb/if_url.c 2022/03/03 05:52:46 1.86
@@ -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 @@
{
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. */
--- src/sys/dev/usb/usbnet.c 2022/03/03 05:52:27 1.80
+++ src/sys/dev/usb/usbnet.c 2022/03/03 05:52:46 1.81
@@ -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 @@
*/
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);
}