Source-Changes-HG archive

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

[src/trunk]: src/sys - usbnet_rx_loop_cb's usbd_xfer parameter is never used ...



details:   https://anonhg.NetBSD.org/src/rev/e0cf89a964c5
branches:  trunk
changeset: 458884:e0cf89a964c5
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Aug 15 05:52:23 2019 +0000

description:
- usbnet_rx_loop_cb's usbd_xfer parameter is never used and available
  in the usbnet_chain if needed.  remove it
- usbnet media status change already set link to false, don't repeat
  this in every driver
- don't clear link in stop, nothing was re-enabling it for non-MII
- add optional uno_tick_cb(struct usbnet *un) that is called from the
  usbnet tick timer
- remove wrong debug sysctl prototype

rx_loop and timer are kernel versions changes, but hopefully this is
the last one for usbnet.  working with 3 more drivers now (cue, mue
and url), leaving only aue, kue, upl and umb undone (aue may work
with previously supported devices, mine doesn't work with our driver,
kue and upl have patches for testing and umb is undone.)

diffstat:

 sys/dev/usb/if_axe.c    |  11 ++++-------
 sys/dev/usb/if_axen.c   |  13 +++++--------
 sys/dev/usb/if_cdce.c   |  10 ++++------
 sys/dev/usb/if_smsc.c   |  13 +++++--------
 sys/dev/usb/if_udav.c   |  15 +++++----------
 sys/dev/usb/if_ure.c    |  13 +++++--------
 sys/dev/usb/if_urndis.c |  10 ++++------
 sys/dev/usb/usbnet.c    |  30 +++++++++++++++++++-----------
 sys/dev/usb/usbnet.h    |  12 +++++++++---
 sys/sys/param.h         |   4 ++--
 10 files changed, 62 insertions(+), 69 deletions(-)

diffs (truncated from 504 to 300 lines):

diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.114 2019/08/14 03:44:58 mrg Exp $ */
+/*     $NetBSD: if_axe.c,v 1.115 2019/08/15 05:52:23 mrg 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.114 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.115 2019/08/15 05:52:23 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -262,8 +262,7 @@
 static usbd_status axe_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static usbd_status axe_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void    axe_mii_statchg(struct ifnet *);
-static void    axe_rx_loop(struct usbnet *, struct usbd_xfer *,
-                           struct usbnet_chain *, uint32_t);
+static void    axe_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static unsigned axe_tx_prepare(struct usbnet *, struct mbuf *,
                               struct usbnet_chain *);
 
@@ -380,7 +379,6 @@
                return;
 
        val = 0;
-       usbnet_set_link(un, false);
        if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
                val |= AXE_MEDIA_FULL_DUPLEX;
                if (AXE_IS_178_FAMILY(un)) {
@@ -1010,8 +1008,7 @@
 }
 
 static void
-axe_rx_loop(struct usbnet * un, struct usbd_xfer *xfer,
-           struct usbnet_chain *c, uint32_t total_len)
+axe_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
 {
        AXEHIST_FUNC(); AXEHIST_CALLED();
        struct axe_softc * const sc = usbnet_softc(un);
diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.63 2019/08/14 03:44:58 mrg Exp $ */
+/*     $NetBSD: if_axen.c,v 1.64 2019/08/15 05:52:23 mrg 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.63 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.64 2019/08/15 05:52:23 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -83,8 +83,7 @@
 static usbd_status axen_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static usbd_status axen_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void    axen_mii_statchg(struct ifnet *);
-static void    axen_rxeof_loop(struct usbnet *, struct usbd_xfer *,
-                   struct usbnet_chain *, uint32_t);
+static void    axen_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static unsigned        axen_tx_prepare(struct usbnet *, struct mbuf *,
                                struct usbnet_chain *);
 static int     axen_init(struct ifnet *);
@@ -96,7 +95,7 @@
        .uno_write_reg = axen_mii_write_reg,
        .uno_statchg = axen_mii_statchg,
        .uno_tx_prepare = axen_tx_prepare,
-       .uno_rx_loop = axen_rxeof_loop,
+       .uno_rx_loop = axen_rx_loop,
        .uno_init = axen_init,
 };
 
@@ -168,7 +167,6 @@
        if (usbnet_isdying(un))
                return;
 
-       usbnet_set_link(un, false);
        if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
            (IFM_ACTIVE | IFM_AVALID)) {
                switch (IFM_SUBTYPE(mii->mii_media_active)) {
@@ -755,8 +753,7 @@
 }
 
 static void
-axen_rxeof_loop(struct usbnet *un, struct usbd_xfer *xfer,
-               struct usbnet_chain *c, uint32_t total_len)
+axen_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len)
 {
        struct ifnet *ifp = usbnet_ifp(un);
        uint8_t *buf = c->unc_buf;
diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_cdce.c
--- a/sys/dev/usb/if_cdce.c     Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_cdce.c     Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cdce.c,v 1.65 2019/08/14 03:44:58 mrg Exp $ */
+/*     $NetBSD: if_cdce.c,v 1.66 2019/08/15 05:52:23 mrg Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul%windriver.com@localhost>
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.65 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.66 2019/08/15 05:52:23 mrg Exp $");
 
 #include <sys/param.h>
 
@@ -78,8 +78,7 @@
 CFATTACH_DECL_NEW(cdce, sizeof(struct usbnet), cdce_match, cdce_attach,
     usbnet_detach, usbnet_activate);
 
-static void    cdce_rx_loop(struct usbnet *, struct usbd_xfer *,
-                            struct usbnet_chain *, uint32_t);
+static void    cdce_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static unsigned        cdce_tx_prepare(struct usbnet *, struct mbuf *,
                                struct usbnet_chain *);
 static int     cdce_init(struct ifnet *);
@@ -272,8 +271,7 @@
 }
 
 static void
-cdce_rx_loop(struct usbnet * un, struct usbd_xfer *xfer,
-            struct usbnet_chain *c, uint32_t total_len)
+cdce_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
 {
        struct ifnet            *ifp = usbnet_ifp(un);
 
diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c     Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_smsc.c     Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_smsc.c,v 1.57 2019/08/14 03:44:58 mrg Exp $ */
+/*     $NetBSD: if_smsc.c,v 1.58 2019/08/15 05:52:23 mrg 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.57 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.58 2019/08/15 05:52:23 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -190,8 +190,7 @@
 static int      smsc_ioctl_cb(struct ifnet *, u_long, void *);
 static unsigned         smsc_tx_prepare(struct usbnet *, struct mbuf *,
                     struct usbnet_chain *);
-static void     smsc_rxeof_loop(struct usbnet *, struct usbd_xfer *,
-                   struct usbnet_chain *, uint32_t);
+static void     smsc_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 
 static struct usbnet_ops smsc_ops = {
        .uno_stop = smsc_stop_cb,
@@ -200,7 +199,7 @@
        .uno_write_reg = smsc_miibus_writereg,
        .uno_statchg = smsc_miibus_statchg,
        .uno_tx_prepare = smsc_tx_prepare,
-       .uno_rx_loop = smsc_rxeof_loop,
+       .uno_rx_loop = smsc_rx_loop,
        .uno_init = smsc_init,
 };
 
@@ -347,7 +346,6 @@
        uint32_t flow;
        uint32_t afc_cfg;
 
-       usbnet_set_link(un, false);
        if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
            (IFM_ACTIVE | IFM_AVALID)) {
                switch (IFM_SUBTYPE(mii->mii_media_active)) {
@@ -938,8 +936,7 @@
 }
 
 void
-smsc_rxeof_loop(struct usbnet * un, struct usbd_xfer *xfer,
-    struct usbnet_chain *c, uint32_t total_len)
+smsc_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
 {
        USMSCHIST_FUNC(); USMSCHIST_CALLED();
        struct smsc_softc * const sc = usbnet_softc(un);
diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_udav.c
--- a/sys/dev/usb/if_udav.c     Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_udav.c     Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_udav.c,v 1.67 2019/08/14 03:44:58 mrg Exp $ */
+/*     $NetBSD: if_udav.c,v 1.68 2019/08/15 05:52:23 mrg 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.67 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.68 2019/08/15 05:52:23 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -67,8 +67,7 @@
 
 static unsigned udav_tx_prepare(struct usbnet *, struct mbuf *,
                                struct usbnet_chain *);
-static void udav_rxeof_loop(struct usbnet *, struct usbd_xfer *,
-                           struct usbnet_chain *, uint32_t);
+static void udav_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static void udav_stop_cb(struct ifnet *, int);
 static int udav_ioctl_cb(struct ifnet *, u_long, void *);
 static usbd_status udav_mii_read_reg(struct usbnet *, int, int, uint16_t *);
@@ -139,7 +138,7 @@
        .uno_write_reg = udav_mii_write_reg,
        .uno_statchg = udav_mii_statchg,
        .uno_tx_prepare = udav_tx_prepare,
-       .uno_rx_loop = udav_rxeof_loop,
+       .uno_rx_loop = udav_rx_loop,
        .uno_init = udav_init,
 };
 
@@ -252,8 +251,6 @@
        }
 
        bool have_mii = !ISSET(un->un_flags, UDAV_NO_PHY);
-       if (!have_mii)
-               usbnet_set_link(un, true);
 
        /* initialize interface information */
        usbnet_attach_ifp(un, have_mii,
@@ -688,8 +685,7 @@
 }
 
 static void
-udav_rxeof_loop(struct usbnet *un, struct usbd_xfer *xfer,
-               struct usbnet_chain *c, uint32_t total_len)
+udav_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len)
 {
        struct ifnet *ifp = usbnet_ifp(un);
        uint8_t *buf = c->unc_buf;
@@ -863,7 +859,6 @@
        if (usbnet_isdying(un))
                return;
 
-       usbnet_set_link(un, false);
        if (mii->mii_media_status & IFM_ACTIVE &&
            IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
                DPRINTF(("%s: %s: got link\n",
diff -r 041bd28e27a9 -r e0cf89a964c5 sys/dev/usb/if_ure.c
--- a/sys/dev/usb/if_ure.c      Thu Aug 15 04:21:33 2019 +0000
+++ b/sys/dev/usb/if_ure.c      Thu Aug 15 05:52:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ure.c,v 1.26 2019/08/14 03:44:58 mrg Exp $  */
+/*     $NetBSD: if_ure.c,v 1.27 2019/08/15 05:52:23 mrg 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.26 2019/08/14 03:44:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.27 2019/08/15 05:52:23 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -88,8 +88,7 @@
 static void    ure_miibus_statchg(struct ifnet *);
 static unsigned ure_tx_prepare(struct usbnet *, struct mbuf *,
                               struct usbnet_chain *);
-static void    ure_rxeof_loop(struct usbnet *, struct usbd_xfer *,
-                              struct usbnet_chain *, uint32_t);
+static void    ure_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
 static int     ure_init(struct ifnet *);
 
 static int     ure_match(device_t, cfdata_t, void *);
@@ -105,7 +104,7 @@
        .uno_write_reg = ure_mii_write_reg,
        .uno_statchg = ure_miibus_statchg,
        .uno_tx_prepare = ure_tx_prepare,
-       .uno_rx_loop = ure_rxeof_loop,
+       .uno_rx_loop = ure_rx_loop,
        .uno_init = ure_init,
 };
 
@@ -300,7 +299,6 @@
        if (usbnet_isdying(un))
                return;
 
-       usbnet_set_link(un, false);



Home | Main Index | Thread Index | Old Index