1.\" 2.\" SPDX-License-Identifier: BSD-2-Clause 3.\" 4.\" Copyright (c) 2004 Daniel Hartmeier 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" - Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" - Redistributions in binary form must reproduce the above 14.\" copyright notice, this list of conditions and the following 15.\" disclaimer in the documentation and/or other materials provided 16.\" with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ 32.\" 33.Dd December 23, 2025 34.Dt CDCE 4 35.Os 36.Sh NAME 37.Nm cdce 38.Nd USB Communication Device Class Ethernet (ECM/NCM) driver 39.Sh SYNOPSIS 40To compile this driver into the kernel, 41place the following lines in your 42kernel configuration file: 43.Bd -ragged -offset indent 44.Cd "device uhci" 45.Cd "device ohci" 46.Cd "device usb" 47.Cd "device miibus" 48.Cd "device uether" 49.Cd "device cdce" 50.Ed 51.Pp 52Mobile Devices (e.g., Huawei E3372, E5573 and others) 53may need additionally the u3g command port: 54.Bd -ragged -offset indent 55.Cd "device ucom" 56.Cd "device u3g" 57.Ed 58.Pp 59Alternatively, to load the driver as a 60module at boot time, place the following line in 61.Xr loader.conf 5 : 62.Bd -literal -offset indent 63if_cdce_load="YES" 64.Ed 65.Sh DESCRIPTION 66The 67.Nm 68driver provides support for USB Host-to-Host (aka USB-to-USB) and 69USB-to-Ethernet bridges based on the USB Communication Device Class 70Ethernet Control Model (CDC ECM) and Network Control Model (CDC NCM) 71specifications. 72It also provides device-side CDC ECM support. 73.Pp 74The USB bridge appears as a regular network interface on both sides, 75transporting Ethernet frames. 76.Pp 77For more information on configuring this device, see 78.Xr ifconfig 8 . 79.Pp 80USB 1.x bridges support speeds of up to 12Mbps, and USB 2.0 speeds of 81up to 480Mbps. 82.Pp 83Packets are 84received and transmitted over separate USB bulk transfer endpoints. 85.Pp 86The 87.Nm 88driver does not support different media types or options. 89.Sh HARDWARE 90The 91.Nm 92driver supports USB Ethernet interfaces implementing the 93USB Communication Device Class Ethernet Control Model (CDC ECM) or 94Network Control Model (CDC NCM) protocol, such as: 95.Pp 96.Bl -bullet -compact 97.It 98Android USB tethering 99.It 100iPhone USB tethering 101.It 102Realtek RTL8153 USB 3.0 to Gigabit Ethernet controller 103.It 104Prolific PL-2501 Host-to-Host Bridge controller 105.It 106Sharp Zaurus PDA 107.It 108Terayon TJ-715 DOCSIS Cable Modem 109.It 110Huawei 3G/4G LTE (e.g., E3372, E5573) and other mobile network devices 111.El 112.Sh EXAMPLES 113Mobile 114.Nm 115Network Devices may need a connect command sequence via the 116.Xr u3g 4 117serial command port before activating the NCM/ECM/ACM network interface. 118For example: 119.Pp 120.Dl echo 'AT^NDISUP=1,1,"internet"' > /dev/cuaU[0].0 121.Pp 122Wwhere 123.Dq internet 124is your providers apn name. 125.Sh DIAGNOSTICS 126.Bl -diag 127.It "cdce%d: no union descriptor" 128The driver could not fetch an interface descriptor from the USB 129device. 130For a manually added USB vendor/product, the CDCE_NO_UNION flag 131can be tried to work around the missing descriptor. 132.It "cdce%d: no data interface" 133.It "cdce%d: could not read endpoint descriptor" 134.It "cdce%d: unexpected endpoint" 135.It "cdce%d: could not find data bulk in/out" 136For a manually added USB vendor/product, these errors indicate 137that the bridge is not compatible with the driver. 138.It "cdce%d: watchdog timeout" 139A packet was queued for transmission and a transmit command was 140issued, however the device failed to acknowledge the transmission 141before a timeout expired. 142.It "cdce%d: no memory for rx list -- packet dropped!" 143Memory allocation through MGETHDR or MCLGET failed, the system 144is running low on mbufs. 145.It "cdce%d: abort/close rx/tx pipe failed" 146.It "cdce%d: rx/tx list init failed" 147.It "cdce%d: open rx/tx pipe failed" 148.It "cdce%d: usb error on rx/tx" 149.El 150.Sh SEE ALSO 151.Xr arp 4 , 152.Xr cdceem 4 , 153.Xr intro 4 , 154.Xr ipheth 4 , 155.Xr netintro 4 , 156.Xr u3g 4 , 157.Xr ucom 4 , 158.Xr urndis 4 , 159.Xr usb 4 , 160.Xr ifconfig 8 161.Rs 162.%T "Universal Serial Bus Class Definitions for Communication Devices" 163.%U http://www.usb.org/developers/devclass_docs/usbcdc11.pdf 164.Re 165.Rs 166.%T "Data sheet Prolific PL-2501 Host-to-Host Bridge/Network Controller" 167.%U http://tech.prolific.com.tw/visitor/fcabdl.asp?fid=20679530 168.Re 169.Sh HISTORY 170The 171.Nm 172device driver first appeared in 173.Ox 3.6 , 174.Nx 3.0 175and 176.Fx 6.0 . 177.Sh AUTHORS 178.An -nosplit 179The 180.Nm 181driver was written by 182.An Craig Boston Aq Mt craig@tobuj.gank.org 183based on the 184.Xr aue 4 185driver written by 186.An Bill Paul Aq Mt wpaul@windriver.com 187and ported to 188.Ox 189by 190.An Daniel Hartmeier Aq Mt dhartmei@openbsd.org . 191.Sh CAVEATS 192Many USB devices notoriously fail to report their class and interfaces 193correctly. 194Undetected products might work flawlessly when their vendor and product IDs 195are added to the driver manually. 196