git: dab84426a68d - main - Narrow down the probe range for if_ure(4) compatible devices to only match the first vendor specific interface, if any.

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jun 4 13:53:22 UTC 2021


The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=dab84426a68d43efaede62ccf86ca3ef852f8ae3

commit dab84426a68d43efaede62ccf86ca3ef852f8ae3
Author:     Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2021-06-04 13:48:15 +0000
Commit:     Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2021-06-04 13:51:01 +0000

    Narrow down the probe range for if_ure(4) compatible devices
    to only match the first vendor specific interface, if any.
    
    PR:             253374
    MFC after:      1 week
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/dev/usb/net/if_ure.c | 7 ++++---
 sys/dev/usb/usb.h        | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index 2e4053a0e0c6..6439a0bfd71d 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -95,7 +95,10 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0,
  * Various supported device vendors/products.
  */
 static const STRUCT_USB_HOST_ID ure_devs[] = {
-#define	URE_DEV(v,p,i)	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
+#define	URE_DEV(v,p,i)	{ \
+  USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), \
+  USB_IFACE_CLASS(UICLASS_VENDOR), \
+  USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR) }
 	URE_DEV(LENOVO, RTL8153, URE_FLAG_8153),
 	URE_DEV(LENOVO, TBT3LAN, 0),
 	URE_DEV(LENOVO, TBT3LANGEN2, 0),
@@ -488,8 +491,6 @@ ure_probe(device_t dev)
 	uaa = device_get_ivars(dev);
 	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
-	if (uaa->info.bConfigIndex != URE_CONFIG_IDX)
-		return (ENXIO);
 	if (uaa->info.bIfaceIndex != URE_IFACE_IDX)
 		return (ENXIO);
 
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index dcdb62114d63..ad0381366f98 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -520,6 +520,7 @@ typedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t;
 
 #define	UICLASS_VENDOR		0xff
 #define	UISUBCLASS_XBOX360_CONTROLLER	0x5d
+#define	UISUBCLASS_VENDOR	0xff
 #define	UIPROTO_XBOX360_GAMEPAD	0x01
 
 struct usb_endpoint_descriptor {


More information about the dev-commits-src-all mailing list