svn commit: r262362 - in stable/9/sys: conf dev/usb dev/usb/net modules/usb modules/usb/urndis

Hans Petter Selasky hselasky at FreeBSD.org
Sun Feb 23 13:20:10 UTC 2014


Author: hselasky
Date: Sun Feb 23 13:20:08 2014
New Revision: 262362
URL: http://svnweb.freebsd.org/changeset/base/262362

Log:
  MFC r261541, r261543 and r261544:
  Import USB RNDIS driver to FreeBSD from OpenBSD.
  Useful for so-called USB tethering.
  - Imported code from OpenBSD
  - Adapted code to FreeBSD
  - Removed some unused functions
  - Fixed some buffer encoding and decoding issues
  - Optimised data transport path a bit, by sending multiple packets at a time
  - Increased receive buffer to 16K

Added:
  stable/9/sys/dev/usb/net/if_urndis.c
     - copied, changed from r261541, head/sys/dev/usb/net/if_urndis.c
  stable/9/sys/dev/usb/net/if_urndisreg.h
     - copied, changed from r261541, head/sys/dev/usb/net/if_urndisreg.h
  stable/9/sys/modules/usb/urndis/
     - copied from r261541, head/sys/modules/usb/urndis/
Modified:
  stable/9/sys/conf/NOTES
  stable/9/sys/conf/files
  stable/9/sys/dev/usb/usb.h
  stable/9/sys/modules/usb/Makefile
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/conf/NOTES
==============================================================================
--- stable/9/sys/conf/NOTES	Sun Feb 23 13:13:59 2014	(r262361)
+++ stable/9/sys/conf/NOTES	Sun Feb 23 13:20:08 2014	(r262362)
@@ -2751,6 +2751,8 @@ device		upgt
 # Ralink Technology RT2500USB wireless driver
 device		ural
 #
+# RNDIS USB ethernet driver
+device		urndis
 # Realtek RTL8187B/L wireless driver
 device		urtw
 #

Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files	Sun Feb 23 13:13:59 2014	(r262361)
+++ stable/9/sys/conf/files	Sun Feb 23 13:20:08 2014	(r262362)
@@ -2028,9 +2028,10 @@ dev/usb/net/if_mos.c		optional mos
 dev/usb/net/if_rue.c		optional rue
 dev/usb/net/if_udav.c		optional udav
 dev/usb/net/if_usie.c		optional usie
+dev/usb/net/if_urndis.c		optional urndis
 dev/usb/net/ruephy.c		optional rue
 dev/usb/net/usb_ethernet.c	optional aue | axe | axge | cdce | cue | kue | \
-					 mos | rue | udav | ipheth
+					 mos | rue | udav | ipheth | urndis
 dev/usb/net/uhso.c		optional uhso
 #
 # USB WLAN drivers

Copied and modified: stable/9/sys/dev/usb/net/if_urndis.c (from r261541, head/sys/dev/usb/net/if_urndis.c)
==============================================================================
--- head/sys/dev/usb/net/if_urndis.c	Thu Feb  6 08:47:14 2014	(r261541, copy source)
+++ stable/9/sys/dev/usb/net/if_urndis.c	Sun Feb 23 13:20:08 2014	(r262362)
@@ -170,8 +170,11 @@ static const struct usb_ether_methods ur
 };
 
 static const STRUCT_USB_HOST_ID urndis_host_devs[] = {
+#if 0
+	/* XXX this entry has a conflict an entry the umodem driver XXX */
 	{USB_IFACE_CLASS(UICLASS_CDC), USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL),
 	USB_IFACE_PROTOCOL(0xff)},
+#endif
 	{USB_IFACE_CLASS(UICLASS_WIRELESS), USB_IFACE_SUBCLASS(UISUBCLASS_RF),
 	USB_IFACE_PROTOCOL(UIPROTO_RNDIS)},
 	{USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(UISUBCLASS_SYNC),
@@ -838,7 +841,7 @@ urndis_bulk_read_callback(struct usb_xfe
 				DPRINTF("invalid dataoffset %u larger than %u\n",
 				    msg.rm_dataoffset + msg.rm_datalen +
 				    (uint32_t)__offsetof(struct urndis_packet_msg,
-				    rm_dataoffset));
+				    rm_dataoffset), actlen);
 				goto tr_setup;
 			} else if (msg.rm_datalen < (uint32_t)sizeof(struct ether_header)) {
 				ifp->if_ierrors++;

Copied and modified: stable/9/sys/dev/usb/net/if_urndisreg.h (from r261541, head/sys/dev/usb/net/if_urndisreg.h)
==============================================================================
--- head/sys/dev/usb/net/if_urndisreg.h	Thu Feb  6 08:47:14 2014	(r261541, copy source)
+++ stable/9/sys/dev/usb/net/if_urndisreg.h	Sun Feb 23 13:20:08 2014	(r262362)
@@ -53,7 +53,7 @@ struct urndis_softc {
 
 #define	URNDIS_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
 #define	URNDIS_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
-#define	URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (x))
+#define	URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (what))
 
 #define	RNDIS_STATUS_BUFFER_OVERFLOW 	0x80000005L
 #define	RNDIS_STATUS_FAILURE 		0xC0000001L

Modified: stable/9/sys/dev/usb/usb.h
==============================================================================
--- stable/9/sys/dev/usb/usb.h	Sun Feb 23 13:13:59 2014	(r262361)
+++ stable/9/sys/dev/usb/usb.h	Sun Feb 23 13:20:08 2014	(r262362)
@@ -493,8 +493,11 @@ typedef struct usb_interface_assoc_descr
 #define	UICLASS_WIRELESS	0xe0
 #define	UISUBCLASS_RF			0x01
 #define	UIPROTO_BLUETOOTH		0x01
+#define	UIPROTO_RNDIS			0x03
 
 #define	UICLASS_IAD		0xEF	/* Interface Association Descriptor */
+#define	UISUBCLASS_SYNC			0x01
+#define	UIPROTO_ACTIVESYNC		0x01
 
 #define	UICLASS_APPL_SPEC	0xfe
 #define	UISUBCLASS_FIRMWARE_DOWNLOAD	1

Modified: stable/9/sys/modules/usb/Makefile
==============================================================================
--- stable/9/sys/modules/usb/Makefile	Sun Feb 23 13:13:59 2014	(r262361)
+++ stable/9/sys/modules/usb/Makefile	Sun Feb 23 13:20:08 2014	(r262362)
@@ -37,6 +37,7 @@ SUBDIR += atp uhid ukbd ums udbp ufm uep
 SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \
 	  umct umcs umodem umoscom uplcom uslcom uvisor uvscom
 SUBDIR += uether aue axe axge cdce cue ${_kue} mos rue udav uhso ipheth
+SUBDIR += urndis
 SUBDIR += usfs umass urio
 SUBDIR += quirk template
 


More information about the svn-src-stable-9 mailing list