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 drivers: Omit needless uno_mcast locked s...



details:   https://anonhg.NetBSD.org/src/rev/4fd1e4864524
branches:  trunk
changeset: 362529:4fd1e4864524
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:53:04 2022 +0000

description:
usbnet drivers: Omit needless uno_mcast locked subroutines.

uno_mcast is now called with the core lock already held so there is
no need for a separate locked subroutine.

diffstat:

 sys/dev/usb/if_aue.c  |  22 +++++-----------------
 sys/dev/usb/if_axe.c  |  18 +++++-------------
 sys/dev/usb/if_axen.c |  18 +++++-------------
 sys/dev/usb/if_cue.c  |  18 +++++-------------
 sys/dev/usb/if_kue.c  |  18 +++++-------------
 sys/dev/usb/if_mos.c  |  18 +++++-------------
 sys/dev/usb/if_mue.c  |  21 ++++++---------------
 sys/dev/usb/if_smsc.c |  18 +++++-------------
 sys/dev/usb/if_udav.c |  19 +++++--------------
 sys/dev/usb/if_ure.c  |  18 +++++-------------
 sys/dev/usb/if_url.c  |  21 ++++++---------------
 11 files changed, 57 insertions(+), 152 deletions(-)

diffs (truncated from 642 to 300 lines):

diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_aue.c      Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.178 2022/03/03 05:52:55 riastradh Exp $   */
+/*     $NetBSD: if_aue.c,v 1.179 2022/03/03 05:53:04 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.178 2022/03/03 05:52:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.179 2022/03/03 05:53:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -611,10 +611,10 @@
 }
 
 static void
-aue_setiff_locked(struct usbnet *un)
+aue_uno_mcast(struct ifnet *ifp)
 {
+       struct usbnet * const un = ifp->if_softc;
        struct aue_softc * const sc = usbnet_softc(un);
-       struct ifnet * const    ifp = usbnet_ifp(un);
        struct ethercom *       ec = usbnet_ec(un);
        struct ether_multi      *enm;
        struct ether_multistep  step;
@@ -988,7 +988,7 @@
        rv = usbnet_init_rx_tx(un);
 
        /* Load the multicast filter. */
-       aue_setiff_locked(un);
+       aue_uno_mcast(ifp);
 
        /* Enable RX and TX */
        aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB);
@@ -1001,18 +1001,6 @@
 }
 
 static void
-aue_uno_mcast(struct ifnet *ifp)
-{
-
-       AUEHIST_FUNC();
-       AUEHIST_CALLARGSN(5, "aue%jd: enter",
-           device_unit(((struct usbnet *)(ifp->if_softc))->un_dev),
-           0, 0, 0);
-
-       aue_setiff_locked(ifp);
-}
-
-static void
 aue_uno_stop(struct ifnet *ifp, int disable)
 {
        struct usbnet * const   un = ifp->if_softc;
diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.140 2022/03/03 05:52:46 riastradh Exp $   */
+/*     $NetBSD: if_axe.c,v 1.141 2022/03/03 05:53:04 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.140 2022/03/03 05:52:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.141 2022/03/03 05:53:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -426,11 +426,11 @@
 }
 
 static void
-axe_rcvfilt_locked(struct usbnet *un)
+axe_uno_mcast(struct ifnet *ifp)
 {
        AXEHIST_FUNC(); AXEHIST_CALLED();
+       struct usbnet * const un = ifp->if_softc;
        struct axe_softc * const sc = usbnet_softc(un);
-       struct ifnet * const ifp = usbnet_ifp(un);
        struct ethercom *ec = usbnet_ec(un);
        struct ether_multi *enm;
        struct ether_multistep step;
@@ -1301,20 +1301,12 @@
        axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 
        /* Accept multicast frame or run promisc. mode */
-       axe_rcvfilt_locked(un);
+       axe_uno_mcast(ifp);
 
        return usbnet_init_rx_tx(un);
 }
 
 static void
-axe_uno_mcast(struct ifnet *ifp)
-{
-       struct usbnet * const un = ifp->if_softc;
-
-       axe_rcvfilt_locked(un);
-}
-
-static void
 axe_uno_stop(struct ifnet *ifp, int disable)
 {
        struct usbnet * const un = ifp->if_softc;
diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.82 2022/03/03 05:52:46 riastradh Exp $   */
+/*     $NetBSD: if_axen.c,v 1.83 2022/03/03 05:53:04 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.82 2022/03/03 05:52:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.83 2022/03/03 05:53:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -225,9 +225,9 @@
 }
 
 static void
-axen_setiff_locked(struct usbnet *un)
+axen_uno_mcast(struct ifnet *ifp)
 {
-       struct ifnet * const ifp = usbnet_ifp(un);
+       struct usbnet * const un = ifp->if_softc;
        struct ethercom *ec = usbnet_ec(un);
        struct ether_multi *enm;
        struct ether_multistep step;
@@ -569,14 +569,6 @@
        return 0;
 }
 
-static void
-axen_uno_mcast(struct ifnet *ifp)
-{
-       struct usbnet * const un = ifp->if_softc;
-
-       axen_setiff_locked(un);
-}
-
 static int
 axen_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -916,7 +908,7 @@
        axen_setoe_locked(un);
 
        /* Program promiscuous mode and multicast filters. */
-       axen_setiff_locked(un);
+       axen_uno_mcast(ifp);
 
        /* Enable receiver, set RX mode */
        axen_cmd(un, AXEN_CMD_MAC_READ2, 2, AXEN_MAC_RXCTL, &wval);
diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_cue.c      Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.98 2022/03/03 05:52:46 riastradh Exp $    */
+/*     $NetBSD: if_cue.c,v 1.99 2022/03/03 05:53:04 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.98 2022/03/03 05:52:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.99 2022/03/03 05:53:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -357,11 +357,11 @@
 }
 
 static void
-cue_setiff_locked(struct usbnet *un)
+cue_uno_mcast(struct ifnet *ifp)
 {
+       struct usbnet           *un = ifp->if_softc;
        struct cue_softc        *sc = usbnet_softc(un);
        struct ethercom         *ec = usbnet_ec(un);
-       struct ifnet            *ifp = usbnet_ifp(un);
        struct ether_multi      *enm;
        struct ether_multistep  step;
        uint32_t                h, i;
@@ -648,7 +648,7 @@
        cue_csr_write_1(un, CUE_ETHCTL, ctl);
 
        /* Load the multicast filter. */
-       cue_setiff_locked(un);
+       cue_uno_mcast(ifp);
 
        /*
         * Set the number of RX and TX buffers that we want
@@ -667,14 +667,6 @@
        return usbnet_init_rx_tx(un);
 }
 
-static void
-cue_uno_mcast(struct ifnet *ifp)
-{
-       struct usbnet * const   un = ifp->if_softc;
-
-       cue_setiff_locked(un);
-}
-
 /* Stop and reset the adapter.  */
 static void
 cue_uno_stop(struct ifnet *ifp, int disable)
diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c      Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_kue.c      Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_kue.c,v 1.111 2022/03/03 05:52:46 riastradh Exp $   */
+/*     $NetBSD: if_kue.c,v 1.112 2022/03/03 05:53:04 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.111 2022/03/03 05:52:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.112 2022/03/03 05:53:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -318,11 +318,11 @@
 }
 
 static void
-kue_setiff_locked(struct usbnet *un)
+kue_uno_mcast(struct ifnet *ifp)
 {
+       struct usbnet *         un = ifp->if_softc;
        struct ethercom *       ec = usbnet_ec(un);
        struct kue_softc *      sc = usbnet_softc(un);
-       struct ifnet * const    ifp = usbnet_ifp(un);
        struct ether_multi      *enm;
        struct ether_multistep  step;
        int                     i;
@@ -622,19 +622,11 @@
        kue_setword(un, KUE_CMD_SET_URB_SIZE, 64);
 
        /* Load the multicast filter. */
-       kue_setiff_locked(un);
+       kue_uno_mcast(ifp);
 
        return usbnet_init_rx_tx(un);
 }
 
-static void
-kue_uno_mcast(struct ifnet *ifp)
-{
-       struct usbnet * const   un = ifp->if_softc;
-
-       kue_setiff_locked(un);
-}
-
 #ifdef _MODULE
 #include "ioconf.c"
 #endif
diff -r 9fb11c787f9e -r 4fd1e4864524 sys/dev/usb/if_mos.c
--- a/sys/dev/usb/if_mos.c      Thu Mar 03 05:52:55 2022 +0000
+++ b/sys/dev/usb/if_mos.c      Thu Mar 03 05:53:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mos.c,v 1.14 2022/03/03 05:52:46 riastradh Exp $    */
+/*     $NetBSD: if_mos.c,v 1.15 2022/03/03 05:53:04 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.14 2022/03/03 05:52:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.15 2022/03/03 05:53:04 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -458,9 +458,9 @@
 }
 
 static void
-mos_rcvfilt_locked(struct usbnet *un)
+mos_uno_mcast(struct ifnet *ifp)



Home | Main Index | Thread Index | Old Index