aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/cdc_ether.c
diff options
context:
space:
mode:
authorOlivier Blin <olivier.blin@softathome.com>2014-10-24 13:43:01 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-28 17:26:19 -0400
commitd80c679bc1526183f1cf4adc54b0b72e8798555e (patch)
treec6235e2e8d6170b6b0ca0d783fda5c2998e4b4dd /drivers/net/usb/cdc_ether.c
parent1efed2d06c703489342ab6af2951683e07509c99 (diff)
cdc-ether: extract usbnet_cdc_update_filter function
This will be used by the set_rx_mode callback. Also move a comment about multicast filtering in this new function. Signed-off-by: Olivier Blin <olivier.blin@softathome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/cdc_ether.c')
-rw-r--r--drivers/net/usb/cdc_ether.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 2a32d9167d3b..bee3689beeb4 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -67,6 +67,32 @@ 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 /* FIXME cdc-ether has some multicast code too, though it complains
80 * in routine cases. info->ether describes the multicast support.
81 * Implement that here, manipulating the cdc filter as needed.
82 */
83
84 usb_control_msg(dev->udev,
85 usb_sndctrlpipe(dev->udev, 0),
86 USB_CDC_SET_ETHERNET_PACKET_FILTER,
87 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
88 cdc_filter,
89 intf->cur_altsetting->desc.bInterfaceNumber,
90 NULL,
91 0,
92 USB_CTRL_SET_TIMEOUT
93 );
94}
95
70/* probes control interface, claims data interface, collects the bulk 96/* probes control interface, claims data interface, collects the bulk
71 * endpoints, activates data interface (if needed), maybe sets MTU. 97 * endpoints, activates data interface (if needed), maybe sets MTU.
72 * all pure cdc, except for certain firmware workarounds, and knowing 98 * all pure cdc, except for certain firmware workarounds, and knowing
@@ -347,16 +373,8 @@ next_desc:
347 * don't do reset all the way. So the packet filter should 373 * don't do reset all the way. So the packet filter should
348 * be set to a sane initial value. 374 * be set to a sane initial value.
349 */ 375 */
350 usb_control_msg(dev->udev, 376 usbnet_cdc_update_filter(dev);
351 usb_sndctrlpipe(dev->udev, 0), 377
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; 378 return 0;
361 379
362bad_desc: 380bad_desc:
@@ -468,10 +486,6 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
468 return status; 486 return status;
469 } 487 }
470 488
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; 489 return 0;
476} 490}
477EXPORT_SYMBOL_GPL(usbnet_cdc_bind); 491EXPORT_SYMBOL_GPL(usbnet_cdc_bind);