Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up following revision(s) (requested by mrg in ticket...



details:   https://anonhg.NetBSD.org/src/rev/55f19046078a
branches:  netbsd-9
changeset: 458274:55f19046078a
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 01 13:00:36 2019 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #135):

        distrib/sets/lists/comp/mi                      1.2279
        distrib/sets/lists/modules/mi                   1.123
        share/man/man9/Makefile                         1.438
        share/man/man9/usbnet.9                         1.1-1.9
        sys/dev/ic/rndisreg.h                           1.3
        sys/dev/usb/TODO                                1.47-1.52
        sys/dev/usb/TODO.usbmp                          1.15,1.16
        sys/dev/usb/files.usb                           1.157-1.167
        sys/dev/usb/if_aue.c                            1.155-1.161
        sys/dev/usb/if_auereg.h                         1.30-1.32
        sys/dev/usb/if_axe.c                            1.103-1.119
        sys/dev/usb/if_axen.c                           1.51-1.53,1.55-1.67
        sys/dev/usb/if_axenreg.h                        1.15
        sys/dev/usb/if_cdce.c                           1.54-1.67
        sys/dev/usb/if_cue.c                            1.85,1.86
        sys/dev/usb/if_cuereg.h                         1.23
        sys/dev/usb/if_kue.c                            1.97-1.100
        sys/dev/usb/if_kuereg.h                         1.23,1.24
        sys/dev/usb/if_mue.c                            1.51-1.55
        sys/dev/usb/if_muereg.h                         1.6
        sys/dev/usb/if_muevar.h                         1.9
        sys/dev/usb/if_smsc.c                           1.46-1.61
        sys/dev/usb/if_smscreg.h                        1.6
        sys/dev/usb/if_smscvar.h                        delete
        sys/dev/usb/if_udav.c                           1.60-1.71
        sys/dev/usb/if_udavreg.h                        1.14,1.15
        sys/dev/usb/if_upl.c                            1.65,1.66
        sys/dev/usb/if_ure.c                            1.15-1.31
        sys/dev/usb/if_urevar.h                         1.4,1.5
        sys/dev/usb/if_url.c                            1.67-1.70
        sys/dev/usb/if_urlreg.h                         1.14
        sys/dev/usb/if_urndis.c                         1.22-1.33
        sys/dev/usb/if_urtwn.c                          1.72
        sys/dev/usb/ohci.c                              1.290
        sys/dev/usb/uhub.c                              1.143
        sys/dev/usb/usb.c                               1.180
        sys/dev/usb/usb.h                               1.118
        sys/dev/usb/usb_mem.c                           1.71
        sys/dev/usb/usb_subr.c                          1.238,1.239
        sys/dev/usb/usbdevs                             1.772
        sys/dev/usb/usbdi.c                             1.183,1.186
        sys/dev/usb/usbdi.h                             1.97
        sys/dev/usb/usbdi_util.c                        1.75
        sys/dev/usb/usbhist.h                           1.5,1.6
        sys/dev/usb/usbnet.c                            1.1-1.24
        sys/dev/usb/usbnet.h                            1.1-1.14
        sys/dev/usb/usbroothub.c                        1.9
        sys/dev/usb/xhci.c                              1.109,1.110
        sys/modules/Makefile                            1.223
        sys/modules/usbnet/Makefile                     1.1

usbnet(9): Add common framework for USB network devices.
This bring various safety fixes to all updated drivers,
and includes locking clean up, detach safety when being
used or not, separate rx/tx locks to improve performance,
porting to NET_MPSAFE, many edge/error case bugs in
drivers fixed, as well as resovling PRs 54303 and 54308.
These drivers are converted: axe(4), axen(4), aue(4),
cdce(4), cue(4), kue(4), mue(4), smsc(4), udav(4),
upl(4), ure(4), url(4), and urndis(4).

diffstat:

 distrib/sets/lists/comp/mi    |     5 +-
 distrib/sets/lists/modules/mi |     4 +-
 share/man/man9/Makefile       |    15 +-
 share/man/man9/usbnet.9       |   894 +++++++++++++++++++++++
 sys/dev/ic/rndisreg.h         |    11 +-
 sys/dev/usb/TODO              |    28 +-
 sys/dev/usb/TODO.usbmp        |    44 +-
 sys/dev/usb/files.usb         |    32 +-
 sys/dev/usb/if_auereg.h       |    78 +-
 sys/dev/usb/if_axe.c          |  1376 ++++++-----------------------------
 sys/dev/usb/if_axen.c         |  1571 ++++++++--------------------------------
 sys/dev/usb/if_axenreg.h      |    11 +-
 sys/dev/usb/if_cdce.c         |   876 ++--------------------
 sys/dev/usb/if_cue.c          |  1125 ++++++----------------------
 sys/dev/usb/if_cuereg.h       |    73 +-
 sys/dev/usb/if_kue.c          |   903 +++++------------------
 sys/dev/usb/if_kuereg.h       |    67 +-
 sys/dev/usb/if_mue.c          |  1524 +++++++++++----------------------------
 sys/dev/usb/if_muereg.h       |     6 +-
 sys/dev/usb/if_muevar.h       |    67 +-
 sys/dev/usb/if_smsc.c         |  1440 ++++++++++---------------------------
 sys/dev/usb/if_smscreg.h      |     8 +-
 sys/dev/usb/if_smscvar.h      |   106 --
 sys/dev/usb/if_udav.c         |  1418 ++++++++----------------------------
 sys/dev/usb/if_udavreg.h      |    62 +-
 sys/dev/usb/if_upl.c          |   909 ++--------------------
 sys/dev/usb/if_ure.c          |  1362 +++++++++--------------------------
 sys/dev/usb/if_urevar.h       |    75 +-
 sys/dev/usb/if_url.c          |  1354 +++++++---------------------------
 sys/dev/usb/if_urlreg.h       |    60 +-
 sys/dev/usb/if_urndis.c       |   971 ++++++-------------------
 sys/dev/usb/if_urtwn.c        |    11 +-
 sys/dev/usb/ohci.c            |     6 +-
 sys/dev/usb/uhub.c            |    24 +-
 sys/dev/usb/usb.c             |    19 +-
 sys/dev/usb/usb.h             |    23 +-
 sys/dev/usb/usb_mem.c         |    12 +-
 sys/dev/usb/usb_subr.c        |   173 ++-
 sys/dev/usb/usbdi.c           |    98 +-
 sys/dev/usb/usbdi.h           |     5 +-
 sys/dev/usb/usbdi_util.c      |   130 +-
 sys/dev/usb/usbhist.h         |    14 +-
 sys/dev/usb/usbnet.c          |  1566 ++++++++++++++++++++++++++++++++++++++++
 sys/dev/usb/usbnet.h          |   397 ++++++++++
 sys/dev/usb/usbroothub.c      |    19 +-
 sys/dev/usb/xhci.c            |     9 +-
 sys/modules/Makefile          |     3 +-
 sys/modules/usbnet/Makefile   |    12 +
 48 files changed, 6594 insertions(+), 12402 deletions(-)

diffs (truncated from 25915 to 300 lines):

diff -r 66fcb3ec5e88 -r 55f19046078a distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Sun Sep 01 11:12:45 2019 +0000
+++ b/distrib/sets/lists/comp/mi        Sun Sep 01 13:00:36 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2278.2.3 2019/08/16 19:28:26 martin Exp $
+#      $NetBSD: mi,v 1.2278.2.4 2019/09/01 13:00:37 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -11967,6 +11967,7 @@
 ./usr/share/man/cat9/uprintf.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/usbd_status.0             comp-sys-catman         .cat
 ./usr/share/man/cat9/usbdi.0                   comp-sys-catman         .cat
+./usr/share/man/cat9/usbnet.0                  comp-sys-catman         .cat
 ./usr/share/man/cat9/useracc.0                 comp-obsolete           obsolete
 ./usr/share/man/cat9/userret.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/ustore.0                  comp-sys-catman         .cat
@@ -19854,6 +19855,7 @@
 ./usr/share/man/html9/uprintf.html             comp-sys-htmlman        html
 ./usr/share/man/html9/usbd_status.html         comp-sys-htmlman        html
 ./usr/share/man/html9/usbdi.html               comp-sys-htmlman        html
+./usr/share/man/html9/usbnet.html              comp-sys-htmlman        html
 ./usr/share/man/html9/userret.html             comp-sys-htmlman        html
 ./usr/share/man/html9/ustore.html              comp-sys-htmlman        html
 ./usr/share/man/html9/ustore_16.html           comp-sys-htmlman        html
@@ -27948,6 +27950,7 @@
 ./usr/share/man/man9/uprintf.9                 comp-sys-man            .man
 ./usr/share/man/man9/usbd_status.9             comp-sys-man            .man
 ./usr/share/man/man9/usbdi.9                   comp-sys-man            .man
+./usr/share/man/man9/usbnet.9                  comp-sys-man            .man
 ./usr/share/man/man9/useracc.9                 comp-obsolete           obsolete
 ./usr/share/man/man9/userret.9                 comp-sys-man            .man
 ./usr/share/man/man9/ustore.9                  comp-sys-man            .man
diff -r 66fcb3ec5e88 -r 55f19046078a distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Sun Sep 01 11:12:45 2019 +0000
+++ b/distrib/sets/lists/modules/mi     Sun Sep 01 13:00:36 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.122 2019/06/20 03:31:55 pgoyette Exp $
+# $NetBSD: mi,v 1.122.2.1 2019/09/01 13:00:37 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -440,6 +440,8 @@
 ./@MODULEDIR@/umap/umap.kmod                   base-kernel-modules     kmod
 ./@MODULEDIR@/union                            base-kernel-modules     kmod
 ./@MODULEDIR@/union/union.kmod                 base-kernel-modules     kmod
+./@MODULEDIR@/usbnet                           base-kernel-modules     kmod
+./@MODULEDIR@/usbnet/usbnet.kmod               base-kernel-modules     kmod
 ./@MODULEDIR@/usbverbose                       base-kernel-modules     kmod
 ./@MODULEDIR@/usbverbose/usbverbose.kmod       base-kernel-modules     kmod
 ./@MODULEDIR@/v7fs                             base-kernel-modules     kmod
diff -r 66fcb3ec5e88 -r 55f19046078a share/man/man9/Makefile
--- a/share/man/man9/Makefile   Sun Sep 01 11:12:45 2019 +0000
+++ b/share/man/man9/Makefile   Sun Sep 01 13:00:36 2019 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: Makefile,v 1.437 2019/05/08 14:25:39 isaki Exp $
+#       $NetBSD: Makefile,v 1.437.2.1 2019/09/01 13:00:37 martin Exp $
 
 #      Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -53,17 +53,18 @@
        SET.9 setbit.9 setjmp.9 shutdownhook_establish.9 \
        signal.9 skpc.9 sockopt.9 softintr.9 spl.9 specificdata.9 \
        spi.9 splraiseipl.9 \
+       store.9 \
        suspendsched.9 \
        sysctl.9 sysmon_envsys.9 sysmon_pswitch.9 sysmon_taskq.9 tc.9 \
        tcp_congctl.9 threadpool.9 timecounter.9 time_second.9 todr.9 \
        ts2timo.9 tvtohz.9 \
-       ucas.9 uiomove.9 ucom.9 userret.9 \
+       ubc.9 ucas.9 ucom.9 ufetch.9 uiomove.9 \
+       usbd_status.9 usbdi.9 usbnet.9 \
+       userret.9 \
+       uvm.9 uvm_hotplug.9 uvm_km.9 uvm_map.9 \
        vattr.9 veriexec.9 vcons.9 vfs.9 vfs_hooks.9 vfsops.9 vfssubr.9 \
-       video.9 vme.9 \
-       vnfileops.9 vnode.9 vnodeops.9 vnsubr.9 \
-       ubc.9 ufetch.9 usbd_status.9 usbdi.9 ustore.9 uvm.9 uvm_hotplug.9 \
-       uvm_km.9 uvm_map.9 \
-       vmem.9 wapbl.9 wdc.9 workqueue.9 \
+       video.9 vme.9 vnfileops.9 vnode.9 vnodeops.9 vnsubr.9 vmem.9  \
+       wapbl.9 wdc.9 workqueue.9 \
        wsbell.9 wscons.9 wsdisplay.9 wsfont.9 wskbd.9 wsmouse.9 \
        xcall.9
 
diff -r 66fcb3ec5e88 -r 55f19046078a share/man/man9/usbnet.9
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man9/usbnet.9   Sun Sep 01 13:00:36 2019 +0000
@@ -0,0 +1,894 @@
+.\"    $NetBSD: usbnet.9,v 1.9.2.2 2019/09/01 13:00:37 martin Exp $
+.\"
+.\" Copyright (c) 2019 Matthew R. Green
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\"    derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd August 22, 2019
+.Dt USBNET 9
+.Os
+.Sh NAME
+.Nm usbnet
+.Nd common USB Ethernet driver framework
+.Sh SYNOPSIS
+.In dev/usb/usbnet.h
+.Ss Functions offered by usbnet.h
+.Ft void
+.Fn usbnet_set_link "struct usbnet *un" "bool link"
+.Ft void
+.Fn usbnet_set_dying "struct usbnet *un" "bool dying"
+.Ft struct ifnet *
+.Fn usbnet_ifp "struct usbnet *un"
+.Ft struct ethercom *
+.Fn usbnet_ec "struct usbnet *un"
+.Ft struct mii_data *
+.Fn usbnet_mii "struct usbnet *un"
+.Ft krndsource_t *
+.Fn usbnet_rndsrc "struct usbnet *un"
+.Ft void *
+.Fn usbnet_softc "struct usbnet *un"
+.Ft bool
+.Fn usbnet_havelink "struct usbnet *un"
+.Ft bool
+.Fn usbnet_isdying "struct usbnet *un"
+.Ft void
+.Fn usbnet_lock "struct usbnet *un"
+.Ft void
+.Fn usbnet_unlock "struct usbnet *un"
+.Ft kmutex_t *
+.Fn usbnet_mutex "struct usbnet *un"
+.Ft void
+.Fn usbnet_isowned "struct usbnet *un"
+.Ft void
+.Fn usbnet_lock_rx "struct usbnet *un"
+.Ft void
+.Fn usbnet_unlock_rx "struct usbnet *un"
+.Ft kmutex_t *
+.Fn usbnet_mutex_rx "struct usbnet *un"
+.Ft void
+.Fn usbnet_isowned_rx "struct usbnet *un"
+.Ft void
+.Fn usbnet_lock_tx "struct usbnet *un"
+.Ft void
+.Fn usbnet_unlock_tx "struct usbnet *un"
+.Ft kmutex_t *
+.Fn usbnet_mutex_tx "struct usbnet *un"
+.Ft void
+.Fn usbnet_isowned_tx "struct usbnet *un"
+.Ft int
+.Fn usbnet_init_rx_tx "struct usbnet *un" "unsigned rxflags" "unsigned txflags"
+.Ft void
+.Fn usbnet_lock_mii "struct usbnet *un"
+.Ft void
+.Fn usbnet_lock_mii_un_locked "struct usbnet *un"
+.Ft void
+.Fn usbnet_unlock_mii "struct usbnet *un"
+.Ft void
+.Fn usbnet_unlock_mii_un_locked "struct usbnet *un"
+.Ft kmutex_t *
+.Fn usbnet_mutex_mii "struct usbnet *un"
+.Ft void
+.Fn usbnet_isowned_mii "struct usbnet *un"
+.Ft int
+.Fn usbnet_miibus_readreg "device_t dev" "int phy" "int reg" "uint16_t *val"
+.Ft int
+.Fn usbnet_miibus_writereg "device_t dev" "int phy" "int reg" "uint16_t val"
+.Ft void
+.Fn usbnet_miibus_statchg "struct ifnet *"
+.Ft void
+.Fn usbnet_enqueue "struct usbnet *un" "uint8_t *buf" "size_t buflen" "int csum_flags" "uint32_t csum_data" "int mbuf_flags"
+.Ft void
+.Fn usbnet_input "struct usbnet *un" "uint8_t *buf" "size_t buflen"
+.Ft void
+.Fn usbnet_attach "struct usbnet *un" "const char *detname"
+.Ft void
+.Fn usbnet_attach_ifp "struct usbnet *un" "unsigned if_flags" "unsigned if_extflags" "const struct usbnet_mii *unm"
+.Ft int
+.Fn usbnet_detach "device_t dev" "int flags"
+.Ft int
+.Fn usbnet_activate "device_t dev" "devact_t act"
+.Ft void
+.Fn usbnet_stop "struct usbnet *un" "struct ifnet *ifp" "int disable"
+.Sh DESCRIPTION
+The
+.Nm
+framework provides methods usable for USB Ethernet drivers.
+The framework has support for these features:
+.Bl -bullet -offset 8n
+.It
+Partial autoconf handling
+.It
+USB endpoint pipe handling
+.It
+Rx and Tx chain handling
+.It
+Generic handlers or support for several struct ifnet callbacks
+.It
+MII bus locking
+.It
+Interrupt handling
+.El
+.Pp
+.Nm
+provides many or all of the traditional
+.Dq softc
+members inside
+.Va struct usbnet ,
+which can be used directly as the device softc structure if
+no additional storage is required.
+A structure exists for receive and transmit chain management,
+.Va struct usbnet_chain ,
+that tracks the metadata for each transfer descriptor available,
+minimum of one each for Rx and Tx slot, and will be passed
+to the Rx and Tx callbacks.
+.Pp
+There is a
+.Va struct usbnet_ops
+structure that provides a number of optional and required callbacks
+that will be described below.
+.Pp
+For autoconfiguration the device attach routine is expected to
+ensure that this device's
+.Va struct usbnet
+is the first member of the device softc, if it can not be used directly
+as the device softc, as well as set up the necessary structure members,
+find end-points, find the Ethernet address if relevant, call
+.Fn usbnet_attach ,
+set up interface, Ethernet, and MII capabilities, and finally call
+.Fn usbnet_attach_ifp .
+The device detach routine should free any resources allocated
+by attach and then call
+.Fn usbnet_detach ,
+possibly directly using
+.Fn usbnet_detach
+as most consumers have no additional resources not owned and
+released by the
+.Nm
+framework itself.
+The device activate function should be set to
+.Fn usbnet_activate .
+.Pp
+To manage all Rx and Tx chains the
+.Dq uno_init
+callback of
+.Va struct usbnet_ops
+should perform any device specific initialization and then call
+.Fn usbnet_init_rx_tx
+which will allocate chains, set up and open pipes, and start the
+Rx transfers so that packets can arrived.
+These allocations and pipes can be closed and destroyed by calling
+.Fn usbnet_stop .
+Both of
+.Fn usbnet_init_rx_tx
+and
+.Fn usbnet_stop
+must be called with the
+.Nm
+lock held, see
+.Fn usbnet_lock
+and
+.Fn usbnet_unlock .
+See the
+.Sx RECEIVE AND SEND
+section for details on using the chains.
+.Pp
+The interface init, ioctl, start, and stop, routines are handled by the
+framework with callbacks for device-specific handling.
+For interface init (i.e., when bringing the interface up), the
+.Dq uno_init
+callback should perform any device specific initialization and then call
+.Fn usbnet_init_rx_tx
+to finalize Rx and Tx queue initialization.
+For interface ioctl, most of the handling is in the framework and the
+optional
+.Dq uno_ioctl
+callback should be used to program special settings
+like multicast filters or offload handling.
+If ioctl handling requires capturing device-specific ioctls then the
+.Dq uno_override_ioctl
+callback may be used instead to replace the framework's



Home | Main Index | Thread Index | Old Index