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: Split multicast filter reprogramming int...



details:   https://anonhg.NetBSD.org/src/rev/2ff71b56b8d2
branches:  trunk
changeset: 362516:2ff71b56b8d2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:51:06 2022 +0000

description:
usbnet: Split multicast filter reprogramming into separate operation.

diffstat:

 sys/dev/usb/if_aue.c  |  35 +++++++++++++++--------------------
 sys/dev/usb/if_axe.c  |  23 +++++++----------------
 sys/dev/usb/if_axen.c |  24 ++++++++++++++++++------
 sys/dev/usb/if_cue.c  |  23 +++++++----------------
 sys/dev/usb/if_kue.c  |  23 +++++++----------------
 sys/dev/usb/if_mos.c  |  23 +++++++----------------
 sys/dev/usb/if_mue.c  |  24 ++++++++++++++++++------
 sys/dev/usb/if_smsc.c |  24 ++++++++++++++++++------
 sys/dev/usb/if_udav.c |  23 +++++++----------------
 sys/dev/usb/if_ure.c  |  23 +++++++----------------
 sys/dev/usb/if_url.c  |  23 +++++++----------------
 sys/dev/usb/usbnet.c  |  28 +++++++++++-----------------
 sys/dev/usb/usbnet.h  |  16 +++++++++++-----
 13 files changed, 140 insertions(+), 172 deletions(-)

diffs (truncated from 847 to 300 lines):

diff -r a565d5ea5147 -r 2ff71b56b8d2 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Thu Mar 03 05:50:57 2022 +0000
+++ b/sys/dev/usb/if_aue.c      Thu Mar 03 05:51:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.173 2022/03/03 05:50:57 riastradh Exp $   */
+/*     $NetBSD: if_aue.c,v 1.174 2022/03/03 05:51:06 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.173 2022/03/03 05:50:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.174 2022/03/03 05:51:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -240,7 +240,7 @@
 static void aue_reset_pegasus_II(struct aue_softc *);
 
 static void aue_uno_stop(struct ifnet *, int);
-static int aue_uno_ioctl(struct ifnet *, u_long, void *);
+static void aue_uno_mcast(struct ifnet *);
 static int aue_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static int aue_uno_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void aue_uno_mii_statchg(struct ifnet *);
@@ -252,7 +252,7 @@
 
 static const struct usbnet_ops aue_ops = {
        .uno_stop = aue_uno_stop,
-       .uno_ioctl = aue_uno_ioctl,
+       .uno_mcast = aue_uno_mcast,
        .uno_read_reg = aue_uno_mii_read_reg,
        .uno_write_reg = aue_uno_mii_write_reg,
        .uno_statchg = aue_uno_mii_statchg,
@@ -1013,28 +1013,23 @@
        return rv;
 }
 
-static int
-aue_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
+static void
+aue_uno_mcast(struct ifnet *ifp)
 {
        struct usbnet * const un = ifp->if_softc;
 
        AUEHIST_FUNC();
-       AUEHIST_CALLARGSN(5, "aue%jd: enter cmd %#jx data %#jx",
+       AUEHIST_CALLARGSN(5, "aue%jd: enter",
            device_unit(((struct usbnet *)(ifp->if_softc))->un_dev),
-           cmd, (uintptr_t)data, 0);
+           0, 0, 0);
 
-       switch (cmd) {
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               usbnet_lock_core(un);
-               aue_uno_init(ifp);
-               usbnet_unlock_core(un);
-               break;
-       default:
-               break;
-       }
-
-       return 0;
+       /*
+        * 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 a565d5ea5147 -r 2ff71b56b8d2 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Mar 03 05:50:57 2022 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Mar 03 05:51:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.133 2022/03/03 05:50:22 riastradh Exp $   */
+/*     $NetBSD: if_axe.c,v 1.134 2022/03/03 05:51:06 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.133 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.134 2022/03/03 05:51:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -259,7 +259,7 @@
        axe_match, axe_attach, usbnet_detach, usbnet_activate);
 
 static void    axe_uno_stop(struct ifnet *, int);
-static int     axe_uno_ioctl(struct ifnet *, u_long, void *);
+static void    axe_uno_mcast(struct ifnet *);
 static int     axe_uno_init(struct ifnet *);
 static int     axe_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static int     axe_uno_mii_write_reg(struct usbnet *, int, int, uint16_t);
@@ -276,7 +276,7 @@
 
 static const struct usbnet_ops axe_ops = {
        .uno_stop = axe_uno_stop,
-       .uno_ioctl = axe_uno_ioctl,
+       .uno_mcast = axe_uno_mcast,
        .uno_read_reg = axe_uno_mii_read_reg,
        .uno_write_reg = axe_uno_mii_write_reg,
        .uno_statchg = axe_uno_mii_statchg,
@@ -1324,27 +1324,18 @@
        return ret;
 }
 
-static int
-axe_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
+static void
+axe_uno_mcast(struct ifnet *ifp)
 {
        struct usbnet * const un = ifp->if_softc;
 
        usbnet_lock_core(un);
        usbnet_busy(un);
 
-       switch (cmd) {
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               axe_rcvfilt_locked(un);
-               break;
-       default:
-               break;
-       }
+       axe_rcvfilt_locked(un);
 
        usbnet_unbusy(un);
        usbnet_unlock_core(un);
-
-       return 0;
 }
 
 static void
diff -r a565d5ea5147 -r 2ff71b56b8d2 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Mar 03 05:50:57 2022 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Mar 03 05:51:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.75 2022/03/03 05:50:22 riastradh Exp $   */
+/*     $NetBSD: if_axen.c,v 1.76 2022/03/03 05:51:06 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.75 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.76 2022/03/03 05:51:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -80,6 +80,7 @@
 
 static void    axen_uno_stop(struct ifnet *, int);
 static int     axen_uno_ioctl(struct ifnet *, u_long, void *);
+static void    axen_uno_mcast(struct ifnet *);
 static int     axen_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static int     axen_uno_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void    axen_uno_mii_statchg(struct ifnet *);
@@ -92,6 +93,7 @@
 static const struct usbnet_ops axen_ops = {
        .uno_stop = axen_uno_stop,
        .uno_ioctl = axen_uno_ioctl,
+       .uno_mcast = axen_uno_mcast,
        .uno_read_reg = axen_uno_mii_read_reg,
        .uno_write_reg = axen_uno_mii_write_reg,
        .uno_statchg = axen_uno_mii_statchg,
@@ -559,10 +561,6 @@
        usbnet_busy(un);
 
        switch (cmd) {
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               axen_setiff_locked(un);
-               break;
        case SIOCSIFCAP:
                axen_setoe_locked(un);
                break;
@@ -576,6 +574,20 @@
        return 0;
 }
 
+static void
+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);
+}
+
 static int
 axen_match(device_t parent, cfdata_t match, void *aux)
 {
diff -r a565d5ea5147 -r 2ff71b56b8d2 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Thu Mar 03 05:50:57 2022 +0000
+++ b/sys/dev/usb/if_cue.c      Thu Mar 03 05:51:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.93 2022/03/03 05:50:22 riastradh Exp $    */
+/*     $NetBSD: if_cue.c,v 1.94 2022/03/03 05:51:06 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.93 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.94 2022/03/03 05:51:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -141,14 +141,14 @@
 static unsigned cue_uno_tx_prepare(struct usbnet *, struct mbuf *,
                                   struct usbnet_chain *);
 static void cue_uno_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
-static int cue_uno_ioctl(struct ifnet *, u_long, void *);
+static void cue_uno_mcast(struct ifnet *);
 static void cue_uno_stop(struct ifnet *, int);
 static int cue_uno_init(struct ifnet *);
 static void cue_uno_tick(struct usbnet *);
 
 static const struct usbnet_ops cue_ops = {
        .uno_stop = cue_uno_stop,
-       .uno_ioctl = cue_uno_ioctl,
+       .uno_mcast = cue_uno_mcast,
        .uno_tx_prepare = cue_uno_tx_prepare,
        .uno_rx_loop = cue_uno_rx_loop,
        .uno_init = cue_uno_init,
@@ -680,27 +680,18 @@
        return rv;
 }
 
-static int
-cue_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
+static void
+cue_uno_mcast(struct ifnet *ifp)
 {
        struct usbnet * const   un = ifp->if_softc;
 
        usbnet_lock_core(un);
        usbnet_busy(un);
 
-       switch (cmd) {
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               cue_setiff_locked(un);
-               break;
-       default:
-               break;
-       }
+       cue_setiff_locked(un);
 
        usbnet_unbusy(un);
        usbnet_unlock_core(un);
-
-       return 0;
 }
 
 /* Stop and reset the adapter.  */
diff -r a565d5ea5147 -r 2ff71b56b8d2 sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c      Thu Mar 03 05:50:57 2022 +0000
+++ b/sys/dev/usb/if_kue.c      Thu Mar 03 05:51:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_kue.c,v 1.106 2022/03/03 05:50:22 riastradh Exp $   */
+/*     $NetBSD: if_kue.c,v 1.107 2022/03/03 05:51:06 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.106 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.107 2022/03/03 05:51:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -174,11 +174,11 @@
 static void kue_uno_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static unsigned kue_uno_tx_prepare(struct usbnet *, struct mbuf *,
                                   struct usbnet_chain *);
-static int kue_uno_ioctl(struct ifnet *, u_long, void *);
+static void kue_uno_mcast(struct ifnet *);
 static int kue_uno_init(struct ifnet *);



Home | Main Index | Thread Index | Old Index