Skip to content

Commit e1e499e

Browse files
holtmanndavem330
authored andcommitted
usbnet: Use wwan%d interface name for mobile broadband devices
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>
1 parent 0bfbedb commit e1e499e

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

drivers/net/usb/cdc_ether.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ static const struct driver_info cdc_info = {
420420
.status = cdc_status,
421421
};
422422

423+
static const struct driver_info mbm_info = {
424+
.description = "Mobile Broadband Network Device",
425+
.flags = FLAG_WWAN,
426+
.bind = cdc_bind,
427+
.unbind = usbnet_cdc_unbind,
428+
.status = cdc_status,
429+
};
430+
423431
/*-------------------------------------------------------------------------*/
424432

425433

@@ -532,32 +540,32 @@ static const struct usb_device_id products [] = {
532540
/* Ericsson F3507g */
533541
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
534542
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
535-
.driver_info = (unsigned long) &cdc_info,
543+
.driver_info = (unsigned long) &mbm_info,
536544
}, {
537545
/* Ericsson F3507g ver. 2 */
538546
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
539547
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
540-
.driver_info = (unsigned long) &cdc_info,
548+
.driver_info = (unsigned long) &mbm_info,
541549
}, {
542550
/* Ericsson F3607gw */
543551
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
544552
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
545-
.driver_info = (unsigned long) &cdc_info,
553+
.driver_info = (unsigned long) &mbm_info,
546554
}, {
547555
/* Ericsson F3307 */
548556
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
549557
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
550-
.driver_info = (unsigned long) &cdc_info,
558+
.driver_info = (unsigned long) &mbm_info,
551559
}, {
552560
/* Toshiba F3507g */
553561
USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
554562
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
555-
.driver_info = (unsigned long) &cdc_info,
563+
.driver_info = (unsigned long) &mbm_info,
556564
}, {
557565
/* Dell F3507g */
558566
USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
559567
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
560-
.driver_info = (unsigned long) &cdc_info,
568+
.driver_info = (unsigned long) &mbm_info,
561569
},
562570
{ }, // END
563571
};

drivers/net/usb/usbnet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
12951295
/* WLAN devices should always be named "wlan%d" */
12961296
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
12971297
strcpy(net->name, "wlan%d");
1298+
/* WWAN devices should always be named "wwan%d" */
1299+
if ((dev->driver_info->flags & FLAG_WWAN) != 0)
1300+
strcpy(net->name, "wwan%d");
12981301

12991302
/* maybe the remote can't receive an Ethernet MTU */
13001303
if (net->mtu > (dev->hard_mtu - net->hard_header_len))

include/linux/usb/usbnet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct driver_info {
9090
#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
9191
#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
9292
#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
93+
#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
9394

9495

9596
/* init device ... can sleep, or cause probe() failure */

0 commit comments

Comments
 (0)