Source-Changes-HG archive

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

[src/trunk]: src Add a port of the umb(4) driver from OpenBSD



details:   https://anonhg.NetBSD.org/src/rev/817f777cfce0
branches:  trunk
changeset: 363520:817f777cfce0
user:      khorben <khorben%NetBSD.org@localhost>
date:      Tue Jul 31 16:44:28 2018 +0000

description:
Add a port of the umb(4) driver from OpenBSD

The umb(4) driver provides support for USB MBIM (Mobile Broadband
Interface Model) devices.

MBIM devices establish connections via cellular networks such as GPRS,
UMTS, and LTE. They appear as a regular point-to-point network interface, transporting raw IP frames.

Required configuration parameters like PIN and APN have to be set with
umbctl(8), a new tool specific to this driver. The IP address is configured
automatically; the default route and DNS server information have to be set
separately.

The driver is not fully functional yet, it is therefore still marked as
experimental and disabled by default. Any help welcome to complete it!

Tested on NetBSD/amd64, with a Sierra Wireless EM7345 LTE modem on a Lenovo
ThinkPad T440s. No functional change expected otherwise.

diffstat:

 distrib/sets/lists/base/mi        |     3 +-
 distrib/sets/lists/base/rescue.mi |     3 +-
 distrib/sets/lists/comp/mi        |     4 +-
 distrib/sets/lists/debug/mi       |     3 +-
 distrib/sets/lists/man/mi         |     8 +-
 rescue/list                       |     3 +-
 sbin/Makefile                     |     4 +-
 sbin/umbctl/Makefile              |     6 +
 sbin/umbctl/umbctl.8              |   165 ++
 sbin/umbctl/umbctl.c              |   482 ++++++
 share/man/man4/Makefile           |     4 +-
 share/man/man4/umb.4              |    91 +
 sys/arch/amd64/conf/GENERIC       |     5 +-
 sys/arch/i386/conf/GENERIC        |     5 +-
 sys/dev/usb/Makefile              |     4 +-
 sys/dev/usb/files.usb             |     7 +-
 sys/dev/usb/if_umb.c              |  2889 +++++++++++++++++++++++++++++++++++++
 sys/dev/usb/if_umbreg.h           |   407 +++++
 sys/dev/usb/mbim.h                |   697 ++++++++
 sys/dev/usb/usb.h                 |    23 +-
 sys/dev/usb/usbdi.c               |    35 +-
 sys/dev/usb/usbdi.h               |     4 +-
 sys/net/if_types.h                |     3 +-
 sys/sys/sockio.h                  |     6 +-
 24 files changed, 4830 insertions(+), 31 deletions(-)

diffs (truncated from 5204 to 300 lines):

diff -r 0333db461175 -r 817f777cfce0 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Tue Jul 31 16:28:56 2018 +0000
+++ b/distrib/sets/lists/base/mi        Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1181 2018/07/24 15:29:05 christos Exp $
+# $NetBSD: mi,v 1.1182 2018/07/31 16:44:28 khorben Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -616,6 +616,7 @@
 ./sbin/tbrconfig                               base-router-root
 ./sbin/ttyflags                                        base-sysutil-root
 ./sbin/tunefs                                  base-sysutil-root
+./sbin/umbctl                                  base-netutil-root
 ./sbin/umount                                  base-sysutil-root
 ./sbin/veriexecctl                             base-sysutil-root
 ./sbin/verifiedexec_load                       base-obsolete           obsolete
diff -r 0333db461175 -r 817f777cfce0 distrib/sets/lists/base/rescue.mi
--- a/distrib/sets/lists/base/rescue.mi Tue Jul 31 16:28:56 2018 +0000
+++ b/distrib/sets/lists/base/rescue.mi Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rescue.mi,v 1.41 2018/04/11 00:26:38 rin Exp $
+# $NetBSD: rescue.mi,v 1.42 2018/07/31 16:44:28 khorben Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -152,6 +152,7 @@
 ./rescue/tetris                                        base-rescue-root
 ./rescue/ttyflags                              base-rescue-root
 ./rescue/tunefs                                        base-rescue-root
+./rescue/umbctl                                        base-rescue-root
 ./rescue/umount                                        base-rescue-root
 ./rescue/veriexecctl                           base-rescue-root
 ./rescue/vi                                    base-rescue-root
diff -r 0333db461175 -r 817f777cfce0 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Tue Jul 31 16:28:56 2018 +0000
+++ b/distrib/sets/lists/comp/mi        Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2213 2018/07/31 13:04:10 rjs Exp $
+#      $NetBSD: mi,v 1.2214 2018/07/31 16:44:28 khorben Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -736,6 +736,8 @@
 ./usr/include/dev/tc/tcdsvar.h                 comp-obsolete           obsolete
 ./usr/include/dev/tc/tcreg.h                   comp-obsolete           obsolete
 ./usr/include/dev/tc/tcvar.h                   comp-obsolete           obsolete
+./usr/include/dev/usb/if_umbreg.h              comp-c-include
+./usr/include/dev/usb/mbim.h                   comp-c-include
 ./usr/include/dev/usb/ukyopon.h                        comp-c-include
 ./usr/include/dev/usb/urio.h                   comp-c-include
 ./usr/include/dev/usb/usb.h                    comp-c-include
diff -r 0333db461175 -r 817f777cfce0 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi       Tue Jul 31 16:28:56 2018 +0000
+++ b/distrib/sets/lists/debug/mi       Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.258 2018/07/24 15:29:05 christos Exp $
+# $NetBSD: mi,v 1.259 2018/07/31 16:44:29 khorben Exp $
 ./etc/mtree/set.debug                           comp-sys-root
 ./usr/lib                                      comp-sys-usr            compatdir
 ./usr/lib/i18n/libBIG5_g.a                     comp-c-debuglib         debuglib,compatfile
@@ -430,6 +430,7 @@
 ./usr/libdata/debug/sbin/tbrconfig.debug       comp-router-debug       debug
 ./usr/libdata/debug/sbin/ttyflags.debug                comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/tunefs.debug          comp-sysutil-debug      debug
+./usr/libdata/debug/sbin/umbctl.debug          comp-netutil-debug      debug
 ./usr/libdata/debug/sbin/umount.debug          comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/veriexecctl.debug     comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/wdogctl.debug         comp-sysutil-debug      debug
diff -r 0333db461175 -r 817f777cfce0 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Tue Jul 31 16:28:56 2018 +0000
+++ b/distrib/sets/lists/man/mi Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1602 2018/07/27 12:02:26 rkujawa Exp $
+# $NetBSD: mi,v 1.1603 2018/07/31 16:44:29 khorben Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1866,6 +1866,7 @@
 ./usr/share/man/cat4/ukyopon.0                 man-sys-catman          .cat
 ./usr/share/man/cat4/ulpt.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/umass.0                   man-sys-catman          .cat
+./usr/share/man/cat4/umb.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/umcs.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/umct.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/umidi.0                   man-sys-catman          .cat
@@ -3152,6 +3153,7 @@
 ./usr/share/man/cat8/trsp.0                    man-obsolete            obsolete
 ./usr/share/man/cat8/ttyflags.0                        man-sysutil-catman      .cat
 ./usr/share/man/cat8/tunefs.0                  man-sysutil-catman      .cat
+./usr/share/man/cat8/umbctl.0                  man-isdn-catman         .cat
 ./usr/share/man/cat8/umount.0                  man-sysutil-catman      .cat
 ./usr/share/man/cat8/unbound-anchor.0          man-netutil-catman      .cat,unbound
 ./usr/share/man/cat8/unbound-checkconf.0       man-netutil-catman      .cat,unbound
@@ -4937,6 +4939,7 @@
 ./usr/share/man/html4/ukyopon.html             man-sys-htmlman         html
 ./usr/share/man/html4/ulpt.html                        man-sys-htmlman         html
 ./usr/share/man/html4/umass.html               man-sys-htmlman         html
+./usr/share/man/html4/umb.html                 man-sys-htmlman         html
 ./usr/share/man/html4/umcs.html                        man-sys-htmlman         html
 ./usr/share/man/html4/umct.html                        man-sys-htmlman         html
 ./usr/share/man/html4/umidi.html               man-sys-htmlman         html
@@ -6010,6 +6013,7 @@
 ./usr/share/man/html8/trpt.html                        man-netutil-htmlman     html
 ./usr/share/man/html8/ttyflags.html            man-sysutil-htmlman     html
 ./usr/share/man/html8/tunefs.html              man-sysutil-htmlman     html
+./usr/share/man/html8/umbctl.html              man-isdn-htmlman        html
 ./usr/share/man/html8/umount.html              man-sysutil-htmlman     html
 ./usr/share/man/html8/unbound-anchor.html      man-netutil-htmlman     html,unbound
 ./usr/share/man/html8/unbound-checkconf.html   man-netutil-htmlman     html,unbound
@@ -7932,6 +7936,7 @@
 ./usr/share/man/man4/ukyopon.4                 man-sys-man             .man
 ./usr/share/man/man4/ulpt.4                    man-sys-man             .man
 ./usr/share/man/man4/umass.4                   man-sys-man             .man
+./usr/share/man/man4/umb.4                     man-sys-man             .man
 ./usr/share/man/man4/umcs.4                    man-sys-man             .man
 ./usr/share/man/man4/umct.4                    man-sys-man             .man
 ./usr/share/man/man4/umidi.4                   man-sys-man             .man
@@ -9215,6 +9220,7 @@
 ./usr/share/man/man8/trsp.8                    man-obsolete            obsolete
 ./usr/share/man/man8/ttyflags.8                        man-sysutil-man         .man
 ./usr/share/man/man8/tunefs.8                  man-sysutil-man         .man
+./usr/share/man/man8/umbctl.8                  man-isdn-man            .man
 ./usr/share/man/man8/umount.8                  man-sysutil-man         .man
 ./usr/share/man/man8/unbound-anchor.8          man-netutil-man         .man,unbound
 ./usr/share/man/man8/unbound-checkconf.8       man-netutil-man         .man,unbound
diff -r 0333db461175 -r 817f777cfce0 rescue/list
--- a/rescue/list       Tue Jul 31 16:28:56 2018 +0000
+++ b/rescue/list       Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: list,v 1.49 2018/04/11 00:26:38 rin Exp $
+#      $NetBSD: list,v 1.50 2018/07/31 16:44:29 khorben Exp $
 
 SRCDIRS        bin
 
@@ -114,6 +114,7 @@
 PROG   sysctl
 PROG   ttyflags
 PROG   tunefs
+PROG   umbctl
 PROG   umount
 PROG   wdogctl
 PROG   veriexecctl
diff -r 0333db461175 -r 817f777cfce0 sbin/Makefile
--- a/sbin/Makefile     Tue Jul 31 16:28:56 2018 +0000
+++ b/sbin/Makefile     Tue Jul 31 16:44:28 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.132 2018/01/14 22:44:04 christos Exp $
+#      $NetBSD: Makefile,v 1.133 2018/07/31 16:44:29 khorben Exp $
 #      @(#)Makefile    8.5 (Berkeley) 3/31/94
 
 # Not ported: XNSrouted enpload scsiformat startslip
@@ -14,7 +14,7 @@
        newbtconf nologin nvmectl \
        ping pppoectl raidctl reboot rcorder rndctl route routed \
        savecore scan_ffs scsictl shutdown slattach svhlabel swapctl sysctl \
-       ttyflags umount veriexecctl wdogctl wsconsctl
+       ttyflags umbctl umount veriexecctl wdogctl wsconsctl
 
 # support for various file systems
 SUBDIR+= newfs_ext2fs fsck_ext2fs
diff -r 0333db461175 -r 817f777cfce0 sbin/umbctl/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/umbctl/Makefile      Tue Jul 31 16:44:28 2018 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 2018/07/31 16:44:29 khorben Exp $
+
+PROG=  umbctl
+MAN=   umbctl.8
+
+.include <bsd.prog.mk>
diff -r 0333db461175 -r 817f777cfce0 sbin/umbctl/umbctl.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/umbctl/umbctl.8      Tue Jul 31 16:44:28 2018 +0000
@@ -0,0 +1,165 @@
+.\"    $NetBSD: umbctl.8,v 1.1 2018/07/31 16:44:29 khorben Exp $
+.\"
+.\" Copyright (c) 2018 by Pierre Pronchery <khorben%defora.org@localhost>
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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.
+.\"
+.\" From: pppoectl.8,v 1.30 2016/09/12 05:35:20 sevan Exp $
+.\"
+.\" $Id: umbctl.8,v 1.1 2018/07/31 16:44:29 khorben Exp $
+.\"
+.\" last edit-date: [Thu Aug 31 10:47:33 2000]
+.\"
+.Dd July 24, 2018
+.Dt UMBCTL 8
+.Os
+.Sh NAME
+.Nm umbctl
+.Nd "display or set parameters for a MBIM interface (4G/LTE)"
+.Sh SYNOPSIS
+.Nm umbctl
+.Op Fl v
+.Ar ifname
+.Op Ar parameter Ns Op \&= Ns Ar value
+.Op Ar ...
+.Pp
+.Nm umbctl
+.Op Fl v
+.Op Fl f Ar config-file
+.Ar ifname
+.Op Ar parameter Ns Op \&= Ns Ar value
+.Op Ar ...
+.Pp
+.Sh DESCRIPTION
+.Bl -tag -width indent
+.It Fl v
+enables verbose mode.
+.It Fl f
+parse
+.Ar config-file
+for
+.Ar parameter Ns Op \&= Ns Ar value
+pairs, one per line, as if they had been specified on the command line.
+This allows the password or PIN codes to be not passed as command line
+arguments.
+Comments starting with # to the end of the current line are ignored.
+.El
+.Pp
+The
+.Xr umb 4
+driver may require a number of additional arguments or optional
+parameters besides the settings that can be adjusted with
+.Xr ifconfig 8 .
+These may be credentials or other tunable connectivity variables.
+The
+.Nm
+utility can be used to display the current settings, or adjust these
+parameters as required.
+.Pp
+For whatever intent
+.Nm
+is being called, at least the parameter
+.Ar ifname
+needs to be specified, naming the interface for which the settings
+are to be performed or displayed.
+Use
+.Xr ifconfig 8
+or
+.Xr netstat 1
+to see which interfaces are available.
+.Pp
+If no other parameter is given,
+.Nm
+will just list the current status for
+.Ar ifname
+and exit.
+.Pp
+If any additional parameter is supplied, superuser privileges are
+required, and the command works in
+.Ql set
+mode.
+This is normally done quietly, unless the option
+.Fl v
+is also enabled, which will cause a final printout of the status as
+described above once all other actions have been taken.
+.Pp
+The parameters currently supported include:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxxx
+.It Ar apn Ns \&= Ns Em access-point
+Set the APN to
+.Em access-point .
+.It Ar username Ns \&= Ns Em username
+Set the username to
+.Em username .
+.It Ar password Ns \&= Ns Em password
+Set the password to
+.Em password .
+.It Ar pin Ns \&= Ns Em pin-code
+Enter the PIN
+.Em pin-code .
+.It Ar puk Ns \&= Ns Em puk-code
+Enter the PUK
+.Em puk-code .
+.It Ar roaming
+Allow data connections when roaming.
+.It Ar -roaming



Home | Main Index | Thread Index | Old Index