aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/cdc_ether.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/cdc_ether.c')
-rw-r--r--drivers/net/usb/cdc_ether.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 2a32d9167d3b..d3920b54a92c 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -67,6 +67,35 @@ static const u8 mbm_guid[16] = {
67 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, 67 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
68}; 68};
69 69
70static void usbnet_cdc_update_filter(struct usbnet *dev)
71{
72 struct cdc_state *info = (void *) &dev->data;
73 struct usb_interface *intf = info->control;
74
75 u16 cdc_filter =
76 USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED |
77 USB_CDC_PACKET_TYPE_BROADCAST;
78
79 if (dev->net->flags & IFF_PROMISC)
80 cdc_filter |= USB_CDC_PACKET_TYPE_PROMISCUOUS;
81
82 /* FIXME cdc-ether has some multicast code too, though it complains
83 * in routine cases. info->ether describes the multicast support.
84 * Implement that here, manipulating the cdc filter as needed.
85 */
86
87 usb_control_msg(dev->udev,
88 usb_sndctrlpipe(dev->udev, 0),
89 USB_CDC_SET_ETHERNET_PACKET_FILTER,
90 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
91 cdc_filter,
92 intf->cur_altsetting->desc.bInterfaceNumber,
93 NULL,
94 0,
95 USB_CTRL_SET_TIMEOUT
96 );
97}
98
70/* probes control interface, claims data interface, collects the bulk 99/* probes control interface, claims data interface, collects the bulk
71 * endpoints, activates data interface (if needed), maybe sets MTU. 100 * endpoints, activates data interface (if needed), maybe sets MTU.
72 * all pure cdc, except for certain firmware workarounds, and knowing 101 * all pure cdc, except for certain firmware workarounds, and knowing
@@ -347,16 +376,8 @@ next_desc:
347 * don't do reset all the way. So the packet filter should 376 * don't do reset all the way. So the packet filter should
348 * be set to a sane initial value. 377 * be set to a sane initial value.
349 */ 378 */
350 usb_control_msg(dev->udev, 379 usbnet_cdc_update_filter(dev);
351 usb_sndctrlpipe(dev->udev, 0), 380
352 USB_CDC_SET_ETHERNET_PACKET_FILTER,
353 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
354 USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST,
355 intf->cur_altsetting->desc.bInterfaceNumber,
356 NULL,
357 0,
358 USB_CTRL_SET_TIMEOUT
359 );
360 return 0; 381 return 0;
361 382
362bad_desc: 383bad_desc:
@@ -468,10 +489,6 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
468 return status; 489 return status;
469 } 490 }
470 491
471 /* FIXME cdc-ether has some multicast code too, though it complains
472 * in routine cases. info->ether describes the multicast support.
473 * Implement that here, manipulating the cdc filter as needed.
474 */
475 return 0; 492 return 0;
476} 493}
477EXPORT_SYMBOL_GPL(usbnet_cdc_bind); 494EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
@@ -482,6 +499,7 @@ static const struct driver_info cdc_info = {
482 .bind = usbnet_cdc_bind, 499 .bind = usbnet_cdc_bind,
483 .unbind = usbnet_cdc_unbind, 500 .unbind = usbnet_cdc_unbind,
484 .status = usbnet_cdc_status, 501 .status = usbnet_cdc_status,
502 .set_rx_mode = usbnet_cdc_update_filter,
485 .manage_power = usbnet_manage_power, 503 .manage_power = usbnet_manage_power,
486}; 504};
487 505
@@ -491,6 +509,7 @@ static const struct driver_info wwan_info = {
491 .bind = usbnet_cdc_bind, 509 .bind = usbnet_cdc_bind,
492 .unbind = usbnet_cdc_unbind, 510 .unbind = usbnet_cdc_unbind,
493 .status = usbnet_cdc_status, 511 .status = usbnet_cdc_status,
512 .set_rx_mode = usbnet_cdc_update_filter,
494 .manage_power = usbnet_manage_power, 513 .manage_power = usbnet_manage_power,
495}; 514};
496 515