From db68bb1b4ab774dcad79ccda2d9ae4ee41ca964c Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 22 Feb 2018 14:37:35 +0100 Subject: [PATCH] kernel/u4b: Some additional work for the recent cdce(4) addition. * Add a manual page from FreeBSD. * Add to LINT64. * Adjust devd(8) configuration so that cdce.ko automatically loads upon plugging. --- etc/devd/usb.conf | 158 ++++++++++++++++++++++++++++++++++++++- share/man/man4/Makefile | 2 + share/man/man4/cdce.4 | 159 ++++++++++++++++++++++++++++++++++++++++ share/man/man4/ipheth.4 | 4 +- share/man/man4/urndis.4 | 4 +- share/man/man4/usb.4 | 5 +- sys/config/LINT64 | 5 ++ 7 files changed, 330 insertions(+), 7 deletions(-) create mode 100644 share/man/man4/cdce.4 diff --git a/etc/devd/usb.conf b/etc/devd/usb.conf index 970a04c7bf..92c9bf46d2 100644 --- a/etc/devd/usb.conf +++ b/etc/devd/usb.conf @@ -91,6 +91,14 @@ nomatch 32 { action "kldload -n if_aue"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0402"; + match "product" "0x5632"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -315,6 +323,14 @@ nomatch 32 { action "kldload -n uipaq"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x049f"; + match "product" "0x505a"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -443,6 +459,14 @@ nomatch 32 { action "kldload -n uplcom"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x04dd"; + match "product" "(0x8004|0x8005|0x8006|0x8007|0x9031)"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -651,6 +675,14 @@ nomatch 32 { action "kldload -n if_run"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0525"; + match "product" "0xa4a2"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -943,7 +975,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x067b"; - match "product" "(0x04bb|0x0609|0x0611|0x0612|0x1234|0x206a|0x2303|0x331a|0xaaa0|0xaaa2)"; + match "product" "(0x04bb|0x0609|0x0611|0x0612|0x1234|0x206a|0x2303)"; + action "kldload -n uplcom"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x067b"; + match "product" "0x2501"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x067b"; + match "product" "(0x331a|0xaaa0|0xaaa2)"; action "kldload -n uplcom"; }; @@ -1675,6 +1723,14 @@ nomatch 32 { action "kldload -n if_axe"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0bb2"; + match "product" "0x6098"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -1915,6 +1971,14 @@ nomatch 32 { action "kldload -n uvisor"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0e7e"; + match "product" "0x1001"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -2311,7 +2375,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1465|0x14ac|0x1520|0x1c05|0x1c0b)"; + match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1465|0x14ac|0x1520)"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "product" "0x155b"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "product" "(0x1c05|0x1c0b)"; action "kldload -n u3g"; }; @@ -3115,6 +3195,14 @@ nomatch 32 { action "kldload -n uipaq"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x22b8"; + match "product" "(0x600c|0x6027)"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -3395,6 +3483,46 @@ nomatch 32 { action "kldload -n umodem"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x16"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x46"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x76"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x03"; + match "intprotocol" "0x16"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "(host|device)"; @@ -3501,6 +3629,30 @@ nomatch 32 { action "kldload -n uaudio"; }; +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "(host|device)"; + match "intclass" "0x02"; + match "intsubclass" "0x06"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "(host|device)"; + match "intclass" "0x02"; + match "intsubclass" "0x0a"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "(host|device)"; + match "intclass" "0x02"; + match "intsubclass" "0x0d"; + action "kldload -n if_cdce"; +}; + nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; @@ -3523,5 +3675,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 1670 USB entries processed +# 1691 USB entries processed diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 59ab577641..49d5feb94e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -59,6 +59,7 @@ MAN= aac.4 \ carp.4 \ ccd.4 \ cd.4 \ + cdce.4 \ ch.4 \ ciss.4 \ clockmod.4 \ @@ -428,6 +429,7 @@ MLINKS+=bktr.4 brooktree.4 MLINKS+=bnx.4 if_bnx.4 MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwn.4 if_bwn.4 +MLINKS+=cdce.4 if_cdce.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=dc.4 if_dc.4 diff --git a/share/man/man4/cdce.4 b/share/man/man4/cdce.4 new file mode 100644 index 0000000000..de69848f93 --- /dev/null +++ b/share/man/man4/cdce.4 @@ -0,0 +1,159 @@ +.\" Copyright (c) 2004 Daniel Hartmeier +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" - Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" - 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 COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "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 +.\" COPYRIGHT HOLDERS OR CONTRIBUTORS 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. +.\" +.\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ +.\" $FreeBSD: head/share/man/man4/cdce.4 291238 2015-11-24 08:34:48Z kevlo $ +.\" +.Dd February 22, 2018 +.Dt CDCE 4 +.Os +.Sh NAME +.Nm cdce +.Nd "USB Communication Device Class Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device miibus" +.Cd "device uether" +.Cd "device cdce" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_cdce_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for USB Host-to-Host (aka USB-to-USB) and +USB-to-Ethernet bridges based on the USB Communication Device Class +(CDC) and Ethernet subclass. +.Pp +The USB bridge appears as a regular network interface on both sides, +transporting Ethernet frames. +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Pp +USB 1.x bridges support speeds of up to 12Mbps, and USB 2.0 speeds of +up to 480Mbps. +.Pp +Packets are +received and transmitted over separate USB bulk transfer endpoints. +.Pp +The +.Nm +driver does not support different media types or options. +.Sh HARDWARE +The following devices are supported by the +.Nm +driver: +.Pp +.Bl -bullet -compact +.It +Prolific PL-2501 Host-to-Host Bridge Controller +.It +Sharp Zaurus PDA +.It +Terayon TJ-715 DOCSIS Cable Modem +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "cdce%d: no union descriptor" +The driver could not fetch an interface descriptor from the USB +device. +For a manually added USB vendor/product, the CDCE_NO_UNION flag +can be tried to work around the missing descriptor. +.It "cdce%d: no data interface" +.It "cdce%d: could not read endpoint descriptor" +.It "cdce%d: unexpected endpoint" +.It "cdce%d: could not find data bulk in/out" +For a manually added USB vendor/product, these errors indicate +that the bridge is not compatible with the driver. +.It "cdce%d: watchdog timeout" +A packet was queued for transmission and a transmit command was +issued, however the device failed to acknowledge the transmission +before a timeout expired. +.It "cdce%d: no memory for rx list -- packet dropped!" +Memory allocation through MGETHDR or MCLGET failed, the system +is running low on mbufs. +.It "cdce%d: abort/close rx/tx pipe failed" +.It "cdce%d: rx/tx list init failed" +.It "cdce%d: open rx/tx pipe failed" +.It "cdce%d: usb error on rx/tx" +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr ifmedia 4 , +.Xr intro 4 , +.Xr ipheth 4 , +.Xr netintro 4 , +.Xr urndis 4 , +.Xr usb 4 , +.Xr ifconfig 8 +.Rs +.%T "Universal Serial Bus Class Definitions for Communication Devices" +.%O http://www.usb.org/developers/devclass_docs/usbcdc11.pdf +.Re +.Rs +.%T "Data sheet Prolific PL-2501 Host-to-Host Bridge/Network Controller" +.%O http://tech.prolific.com.tw/visitor/fcabdl.asp?fid=20679530 +.Re +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 3.6 , +.Nx 3.0 +and +.Fx 6.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Craig Boston Aq Mt craig@tobuj.gank.org +based on the +.Xr aue 4 +driver written by +.An Bill Paul Aq Mt wpaul@windriver.com +and ported to +.Ox +by +.An Daniel Hartmeier Aq Mt dhartmei@openbsd.org . +.Sh CAVEATS +Many USB devices notoriously fail to report their class and interfaces +correctly. +Undetected products might work flawlessly when their vendor and product IDs +are added to the driver manually. diff --git a/share/man/man4/ipheth.4 b/share/man/man4/ipheth.4 index 7e67b2dd38..623fa69d2e 100644 --- a/share/man/man4/ipheth.4 +++ b/share/man/man4/ipheth.4 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD: head/share/man/man4/ipheth.4 272294 2014-09-30 05:36:16Z gavin $ .\" -.Dd November 10, 2014 +.Dd February 22, 2018 .Dt IPHETH 4 .Os .Sh NAME @@ -75,7 +75,7 @@ Apple iPad tethering (all models) .El .Sh SEE ALSO .Xr arp 4 , -.\".Xr cdce 4 , +.Xr cdce 4 , .Xr intro 4 , .Xr netintro 4 , .Xr urndis 4 , diff --git a/share/man/man4/urndis.4 b/share/man/man4/urndis.4 index def369661a..7a44c44388 100644 --- a/share/man/man4/urndis.4 +++ b/share/man/man4/urndis.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD: head/share/man/man4/urndis.4 264731 2014-04-21 16:35:19Z gjb $ .\" -.Dd July 7, 2014 +.Dd February 22, 2018 .Dt URNDIS 4 .Os .Sh NAME @@ -70,6 +70,8 @@ For more information on configuring this device, see .Xr ifconfig 8 . .Sh SEE ALSO .Xr arp 4 , +.Xr cdce 4 , +.Xr ipheth 4 , .Xr netintro 4 , .Xr usb 4 , .Xr ifconfig 8 diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4 index 9aa0e64a46..033de15d6b 100644 --- a/share/man/man4/usb.4 +++ b/share/man/man4/usb.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD: head/share/man/man4/usb.4 258618 2013-11-26 07:52:40Z lwhsu $ .\" -.Dd December 6, 2014 +.Dd February 22, 2018 .Dt USB 4 .Os .Sh NAME @@ -102,6 +102,8 @@ ADMtek AN986 Pegasus Ethernet driver ASIX Electronics AX88x7x/760 USB Ethernet driver .It Xr axge 4 ASIX Electronics AX88178A/AX88179 USB Gigabit Ethernet driver +.It Xr cdce 4 +USB Communication Device Class Ethernet driver .It Xr cue 4 CATC USB-EL1210A Ethernet driver .It Xr ipheth 4 @@ -265,6 +267,7 @@ specifications can be found at: .Xr aue 4 , .Xr axe 4 , .Xr axge 4 , +.Xr cdce 4 , .Xr cue 4 , .Xr ehci 4 , .Xr ipheth 4 , diff --git a/sys/config/LINT64 b/sys/config/LINT64 index 9bd4cd2601..975e1db8d8 100644 --- a/sys/config/LINT64 +++ b/sys/config/LINT64 @@ -1952,6 +1952,11 @@ device axe # ASIX Electronics AX88178A/AX88179 USB 2.0/3.0 gigabit ethernet driver. device axge # +# Devices which communicate using Ethernet over USB, particularly +# Communication Device Class (CDC) Ethernet specification. Supports +# Sharp Zaurus PDAs, some DOCSIS cable modems and so on. +device cdce +# # CATC USB-EL1201A USB ethernet. Supports the CATC Netmate # and Netmate II, and the Belkin F5U111. device cue -- 2.41.0