netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor
@ 2010-04-23 11:07 Jonas Sjoquist
  2010-04-28  0:09 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Sjoquist @ 2010-04-23 11:07 UTC (permalink / raw)
  To: oneukum, davem; +Cc: netdev

From: Jonas Sjöquist <jonas.sjoquist@ericsson.com>

This patch removes vid/pid for Ericsson MBM devices from the whitelist set of
devices. The MBM devices are instead identified by GUID.

In order for cdc_ether to handle these devices the GUID in the MDLM descriptor
is tested. All MBM devices currently handled by cdc_ether as well as future
CDC Ethernet MBM devices can be identified by the GUID.

This is the same solution used in Carl Nordbeck's mbm driver,
http://kerneltrap.org/mailarchive/linux-usb/2008/11/17/4141384/thread

I post this as RFC to get feedback on however cdc_ether is the correct place to
do the binding, or if it should be done in a separate driver, e.g. zaurus.

Signed-off-by: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
---
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index c8cdb7f..811b2dc 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -64,6 +64,11 @@ static int is_wireless_rndis(struct usb_interface_descriptor *desc)
 
 #endif
 
+static const u8 mbm_guid[16] = {
+	0xa3, 0x17, 0xa8, 0x8b, 0x04, 0x5e, 0x4f, 0x01,
+	0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
+};
+
 /*
  * probes control interface, claims data interface, collects the bulk
  * endpoints, activates data interface (if needed), maybe sets MTU.
@@ -79,6 +84,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 	int				status;
 	int				rndis;
 	struct usb_driver		*driver = driver_of(intf);
+	struct usb_cdc_mdlm_desc	*desc = NULL;
+	struct usb_cdc_mdlm_detail_desc *detail = NULL;
 
 	if (sizeof dev->data < sizeof *info)
 		return -EDOM;
@@ -229,6 +236,34 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 			 * side link address we were given.
 			 */
 			break;
+		case USB_CDC_MDLM_TYPE:
+			if (desc) {
+				dev_dbg(&intf->dev, "extra MDLM descriptor\n");
+				goto bad_desc;
+			}
+
+			desc = (void *)buf;
+
+			if (desc->bLength != sizeof(*desc))
+				goto bad_desc;
+
+			if (memcmp(&desc->bGUID, mbm_guid, 16))
+				goto bad_desc;
+			break;
+		case USB_CDC_MDLM_DETAIL_TYPE:
+			if (detail) {
+				dev_dbg(&intf->dev, "extra MDLM detail descriptor\n");
+				goto bad_desc;
+			}
+
+			detail = (void *)buf;
+
+			if (detail->bGuidDescriptorType == 0) {
+				if (detail->bLength < (sizeof(*detail) + 1))
+					goto bad_desc;
+			} else
+				goto bad_desc;
+			break;
 		}
 next_desc:
 		len -= buf [0];	/* bLength */
@@ -542,80 +577,10 @@ static const struct usb_device_id	products [] = {
 			USB_CDC_PROTO_NONE),
 	.driver_info = (unsigned long) &cdc_info,
 }, {
-	/* Ericsson F3507g */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3507g ver. 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3607gw */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3607gw ver 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3607gw ver 3 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3307 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson F3307 ver 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson C3607w */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Ericsson C3607w ver 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Toshiba F3507g */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Toshiba F3607gw */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Toshiba F3607gw ver 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Dell F3507g */
-	USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Dell F3607gw */
-	USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
-}, {
-	/* Dell F3607gw ver 2 */
-	USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-	.driver_info = (unsigned long) &mbm_info,
+	USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
+			USB_CDC_PROTO_NONE),
+	.driver_info = (unsigned long)&mbm_info,
+
 },
 	{ },		// END
 };


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor
  2010-04-23 11:07 [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor Jonas Sjoquist
@ 2010-04-28  0:09 ` David Miller
  2010-04-28  8:51   ` Oliver Neukum
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2010-04-28  0:09 UTC (permalink / raw)
  To: jonas.sjoquist; +Cc: oneukum, netdev

From: Jonas Sjoquist <jonas.sjoquist@ericsson.com>
Date: Fri, 23 Apr 2010 13:07:45 +0200

> From: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
> 
> This patch removes vid/pid for Ericsson MBM devices from the whitelist set of
> devices. The MBM devices are instead identified by GUID.
> 
> In order for cdc_ether to handle these devices the GUID in the MDLM descriptor
> is tested. All MBM devices currently handled by cdc_ether as well as future
> CDC Ethernet MBM devices can be identified by the GUID.
> 
> This is the same solution used in Carl Nordbeck's mbm driver,
> http://kerneltrap.org/mailarchive/linux-usb/2008/11/17/4141384/thread
> 
> I post this as RFC to get feedback on however cdc_ether is the correct place to
> do the binding, or if it should be done in a separate driver, e.g. zaurus.
> 
> Signed-off-by: Jonas Sjöquist <jonas.sjoquist@ericsson.com>

Can someone knowledgable with the cdc_ether driver review this change?

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor
  2010-04-28  0:09 ` David Miller
@ 2010-04-28  8:51   ` Oliver Neukum
  2010-04-30 23:28     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2010-04-28  8:51 UTC (permalink / raw)
  To: David Miller; +Cc: jonas.sjoquist, netdev

Am Mittwoch, 28. April 2010 02:09:59 schrieb David Miller:
> From: Jonas Sjoquist <jonas.sjoquist@ericsson.com>
> Date: Fri, 23 Apr 2010 13:07:45 +0200
> 
> > From: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
> > 
> > This patch removes vid/pid for Ericsson MBM devices from the whitelist set of
> > devices. The MBM devices are instead identified by GUID.
> > 
> > In order for cdc_ether to handle these devices the GUID in the MDLM descriptor
> > is tested. All MBM devices currently handled by cdc_ether as well as future
> > CDC Ethernet MBM devices can be identified by the GUID.
> > 
> > This is the same solution used in Carl Nordbeck's mbm driver,
> > http://kerneltrap.org/mailarchive/linux-usb/2008/11/17/4141384/thread
> > 
> > I post this as RFC to get feedback on however cdc_ether is the correct place to
> > do the binding, or if it should be done in a separate driver, e.g. zaurus.
> > 
> > Signed-off-by: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
> 
> Can someone knowledgable with the cdc_ether driver review this change?

The patch looks good.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor
  2010-04-28  8:51   ` Oliver Neukum
@ 2010-04-30 23:28     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-04-30 23:28 UTC (permalink / raw)
  To: oneukum; +Cc: jonas.sjoquist, netdev

From: Oliver Neukum <oneukum@suse.de>
Date: Wed, 28 Apr 2010 10:51:44 +0200

> Am Mittwoch, 28. April 2010 02:09:59 schrieb David Miller:
>> From: Jonas Sjoquist <jonas.sjoquist@ericsson.com>
>> Date: Fri, 23 Apr 2010 13:07:45 +0200
>> 
>> > From: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
>> > 
>> > This patch removes vid/pid for Ericsson MBM devices from the whitelist set of
>> > devices. The MBM devices are instead identified by GUID.
>> > 
>> > In order for cdc_ether to handle these devices the GUID in the MDLM descriptor
>> > is tested. All MBM devices currently handled by cdc_ether as well as future
>> > CDC Ethernet MBM devices can be identified by the GUID.
>> > 
>> > This is the same solution used in Carl Nordbeck's mbm driver,
>> > http://kerneltrap.org/mailarchive/linux-usb/2008/11/17/4141384/thread
>> > 
>> > I post this as RFC to get feedback on however cdc_ether is the correct place to
>> > do the binding, or if it should be done in a separate driver, e.g. zaurus.
>> > 
>> > Signed-off-by: Jonas Sjöquist <jonas.sjoquist@ericsson.com>
>> 
>> Can someone knowledgable with the cdc_ether driver review this change?
> 
> The patch looks good.

Applied to net-next-2.6, thanks everyone.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-30 23:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23 11:07 [PATCH/RFC Resubmission] cdc_ether: Identify MBM devices by GUID in MDLM descriptor Jonas Sjoquist
2010-04-28  0:09 ` David Miller
2010-04-28  8:51   ` Oliver Neukum
2010-04-30 23:28     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).