usbnet: Use wwan%d interface name for mobile broadband devices
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Oct 2009 05:15:25 +0000 (05:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2009 07:43:33 +0000 (00:43 -0700)
Add support for usbnet based devices like CDC-Ether to indicate that they
are actually mobile broadband devices. In that case use wwan%d as default
interface name.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ether.c
drivers/net/usb/usbnet.c
include/linux/usb/usbnet.h

index 4a6aff5..71e65fc 100644 (file)
@@ -420,6 +420,14 @@ static const struct driver_info    cdc_info = {
        .status =       cdc_status,
 };
 
+static const struct driver_info mbm_info = {
+       .description =  "Mobile Broadband Network Device",
+       .flags =        FLAG_WWAN,
+       .bind =         cdc_bind,
+       .unbind =       usbnet_cdc_unbind,
+       .status =       cdc_status,
+};
+
 /*-------------------------------------------------------------------------*/
 
 
@@ -532,32 +540,32 @@ static const struct usb_device_id products [] = {
        /* Ericsson F3507g */
        USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-       .driver_info = (unsigned long) &cdc_info,
+       .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) &cdc_info,
+       .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) &cdc_info,
+       .driver_info = (unsigned long) &mbm_info,
 }, {
        /* Ericsson F3307 */
        USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
-       .driver_info = (unsigned long) &cdc_info,
+       .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) &cdc_info,
+       .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) &cdc_info,
+       .driver_info = (unsigned long) &mbm_info,
 },
        { },            // END
 };
index ca5ca5a..8124cf1 100644 (file)
@@ -1295,6 +1295,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
                /* WLAN devices should always be named "wlan%d" */
                if ((dev->driver_info->flags & FLAG_WLAN) != 0)
                        strcpy(net->name, "wlan%d");
+               /* WWAN devices should always be named "wwan%d" */
+               if ((dev->driver_info->flags & FLAG_WWAN) != 0)
+                       strcpy(net->name, "wwan%d");
 
                /* maybe the remote can't receive an Ethernet MTU */
                if (net->mtu > (dev->hard_mtu - net->hard_header_len))
index f814730..86c31b7 100644 (file)
@@ -90,6 +90,7 @@ struct driver_info {
 #define FLAG_WLAN      0x0080          /* use "wlan%d" names */
 #define FLAG_AVOID_UNLINK_URBS 0x0100  /* don't unlink urbs at usbnet_stop() */
 #define FLAG_SEND_ZLP  0x0200          /* hw requires ZLPs are sent */
+#define FLAG_WWAN      0x0400          /* use "wwan%d" names */
 
 
        /* init device ... can sleep, or cause probe() failure */