usbnet drivers: No need for usbnet_busy in uno_mcast.

This callback always runs with IFNET_LOCK held, and during a task
that usbnet_detach prevents scheduling anew and waits for finishing
before completing the detach, so there is no need to hang onto a
reference count here.
This commit is contained in:
riastradh 2022-03-03 05:51:27 +00:00
parent 9cfb26a542
commit 23fe390cac
10 changed files with 20 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_axe.c,v 1.135 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_axe.c,v 1.136 2022/03/03 05:51:27 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.135 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.136 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -1326,11 +1326,9 @@ axe_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
axe_rcvfilt_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_axen.c,v 1.77 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_axen.c,v 1.78 2022/03/03 05:51:27 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.77 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.78 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -580,11 +580,9 @@ axen_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
axen_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cue.c,v 1.95 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_cue.c,v 1.96 2022/03/03 05:51:27 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.95 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.96 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -683,11 +683,9 @@ cue_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
cue_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_kue.c,v 1.108 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_kue.c,v 1.109 2022/03/03 05:51:27 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.108 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.109 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -643,11 +643,9 @@ kue_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
kue_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mos.c,v 1.11 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_mos.c,v 1.12 2022/03/03 05:51:27 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.11 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.12 2022/03/03 05:51:27 riastradh Exp $");
#include <sys/param.h>
@ -773,11 +773,9 @@ mos_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
mos_rcvfilt_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mue.c,v 1.67 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_mue.c,v 1.68 2022/03/03 05:51:27 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.67 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.68 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -1294,11 +1294,9 @@ mue_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
mue_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_smsc.c,v 1.75 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_smsc.c,v 1.76 2022/03/03 05:51:27 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.75 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.76 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -774,11 +774,9 @@ smsc_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
smsc_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_udav.c,v 1.82 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_udav.c,v 1.83 2022/03/03 05:51:27 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.82 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.83 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -719,11 +719,9 @@ udav_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
udav_setiff_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ure.c,v 1.44 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_ure.c,v 1.45 2022/03/03 05:51:27 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.44 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.45 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -804,11 +804,9 @@ ure_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
ure_rcvfilt_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_url.c,v 1.82 2022/03/03 05:51:17 riastradh Exp $ */
/* $NetBSD: if_url.c,v 1.83 2022/03/03 05:51:27 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.82 2022/03/03 05:51:17 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.83 2022/03/03 05:51:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -561,11 +561,9 @@ url_uno_mcast(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
usbnet_lock_core(un);
usbnet_busy(un);
url_rcvfilt_locked(un);
usbnet_unbusy(un);
usbnet_unlock_core(un);
}