Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb usbnet: Take the core lock around uno_mcast.



details:   https://anonhg.NetBSD.org/src/rev/f90403f67fd4
branches:  trunk
changeset: 362527:f90403f67fd4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:52:46 2022 +0000

description:
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:

 sys/dev/usb/if_aue.c  |  7 ++-----
 sys/dev/usb/if_axe.c  |  8 ++------
 sys/dev/usb/if_axen.c |  8 ++------
 sys/dev/usb/if_cue.c  |  8 ++------
 sys/dev/usb/if_kue.c  |  8 ++------
 sys/dev/usb/if_mos.c  |  8 ++------
 sys/dev/usb/if_mue.c  |  8 ++------
 sys/dev/usb/if_smsc.c |  8 ++------
 sys/dev/usb/if_udav.c |  8 ++------
 sys/dev/usb/if_ure.c  |  8 ++------
 sys/dev/usb/if_url.c  |  8 ++------
 sys/dev/usb/usbnet.c  |  9 ++++++---
 12 files changed, 28 insertions(+), 68 deletions(-)

diffs (truncated from 367 to 300 lines):

diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_aue.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_cue.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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.  */
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_kue.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_mos.c
--- a/sys/dev/usb/if_mos.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_mos.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_mue.c
--- a/sys/dev/usb/if_mue.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_mue.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c     Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_smsc.c     Thu Mar 03 05:52:46 2022 +0000
@@ -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
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_udav.c
--- a/sys/dev/usb/if_udav.c     Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_udav.c     Thu Mar 03 05:52:46 2022 +0000
@@ -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. */
diff -r f0fe6f5aa773 -r f90403f67fd4 sys/dev/usb/if_ure.c
--- a/sys/dev/usb/if_ure.c      Thu Mar 03 05:52:35 2022 +0000
+++ b/sys/dev/usb/if_ure.c      Thu Mar 03 05:52:46 2022 +0000
@@ -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);
-



Home | Main Index | Thread Index | Old Index