Merge branch 'usbnet-multicast-filter-support-for-cdc-ncm-devices'

Bjørn Mork says:

====================
usbnet: multicast filter support for cdc ncm devices

This revives a 2 year old patch set from Miguel Rodríguez
Pérez, which appears to have been lost somewhere along the
way.  I've based it on the last version I found (v4), and
added one patch which I believe must have been missing in
the original.

I kept Oliver's ack on one of the patches, since both the patch and
the motivation still is the same.  Hope this is OK..

Thanks to the anonymous user <wxcafe@wxcafe.net> for bringing up this
problem in https://bugs.debian.org/965074

This is only build and load tested by me.  I don't have any device
where I can test the actual functionality.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2020-07-17 12:42:47 -07:00
commit 79814d8179
4 changed files with 11 additions and 5 deletions

View File

@ -63,10 +63,8 @@ static const u8 mbm_guid[16] = {
0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
}; };
static void usbnet_cdc_update_filter(struct usbnet *dev) void usbnet_cdc_update_filter(struct usbnet *dev)
{ {
struct cdc_state *info = (void *) &dev->data;
struct usb_interface *intf = info->control;
struct net_device *net = dev->net; struct net_device *net = dev->net;
u16 cdc_filter = USB_CDC_PACKET_TYPE_DIRECTED u16 cdc_filter = USB_CDC_PACKET_TYPE_DIRECTED
@ -86,12 +84,13 @@ static void usbnet_cdc_update_filter(struct usbnet *dev)
USB_CDC_SET_ETHERNET_PACKET_FILTER, USB_CDC_SET_ETHERNET_PACKET_FILTER,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
cdc_filter, cdc_filter,
intf->cur_altsetting->desc.bInterfaceNumber, dev->intf->cur_altsetting->desc.bInterfaceNumber,
NULL, NULL,
0, 0,
USB_CTRL_SET_TIMEOUT USB_CTRL_SET_TIMEOUT
); );
} }
EXPORT_SYMBOL_GPL(usbnet_cdc_update_filter);
/* probes control interface, claims data interface, collects the bulk /* probes control interface, claims data interface, collects the bulk
* endpoints, activates data interface (if needed), maybe sets MTU. * endpoints, activates data interface (if needed), maybe sets MTU.

View File

@ -792,6 +792,7 @@ static const struct net_device_ops cdc_ncm_netdev_ops = {
.ndo_stop = usbnet_stop, .ndo_stop = usbnet_stop,
.ndo_start_xmit = usbnet_start_xmit, .ndo_start_xmit = usbnet_start_xmit,
.ndo_tx_timeout = usbnet_tx_timeout, .ndo_tx_timeout = usbnet_tx_timeout,
.ndo_set_rx_mode = usbnet_set_rx_mode,
.ndo_get_stats64 = usbnet_get_stats64, .ndo_get_stats64 = usbnet_get_stats64,
.ndo_change_mtu = cdc_ncm_change_mtu, .ndo_change_mtu = cdc_ncm_change_mtu,
.ndo_set_mac_address = eth_mac_addr, .ndo_set_mac_address = eth_mac_addr,
@ -1895,6 +1896,7 @@ static const struct driver_info cdc_ncm_info = {
.status = cdc_ncm_status, .status = cdc_ncm_status,
.rx_fixup = cdc_ncm_rx_fixup, .rx_fixup = cdc_ncm_rx_fixup,
.tx_fixup = cdc_ncm_tx_fixup, .tx_fixup = cdc_ncm_tx_fixup,
.set_rx_mode = usbnet_cdc_update_filter,
}; };
/* Same as cdc_ncm_info, but with FLAG_WWAN */ /* Same as cdc_ncm_info, but with FLAG_WWAN */
@ -1908,6 +1910,7 @@ static const struct driver_info wwan_info = {
.status = cdc_ncm_status, .status = cdc_ncm_status,
.rx_fixup = cdc_ncm_rx_fixup, .rx_fixup = cdc_ncm_rx_fixup,
.tx_fixup = cdc_ncm_tx_fixup, .tx_fixup = cdc_ncm_tx_fixup,
.set_rx_mode = usbnet_cdc_update_filter,
}; };
/* Same as wwan_info, but with FLAG_NOARP */ /* Same as wwan_info, but with FLAG_NOARP */
@ -1921,6 +1924,7 @@ static const struct driver_info wwan_noarp_info = {
.status = cdc_ncm_status, .status = cdc_ncm_status,
.rx_fixup = cdc_ncm_rx_fixup, .rx_fixup = cdc_ncm_rx_fixup,
.tx_fixup = cdc_ncm_tx_fixup, .tx_fixup = cdc_ncm_tx_fixup,
.set_rx_mode = usbnet_cdc_update_filter,
}; };
static const struct usb_device_id cdc_devs[] = { static const struct usb_device_id cdc_devs[] = {

View File

@ -1108,12 +1108,13 @@ static void __handle_link_change(struct usbnet *dev)
clear_bit(EVENT_LINK_CHANGE, &dev->flags); clear_bit(EVENT_LINK_CHANGE, &dev->flags);
} }
static void usbnet_set_rx_mode(struct net_device *net) void usbnet_set_rx_mode(struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
usbnet_defer_kevent(dev, EVENT_SET_RX_MODE); usbnet_defer_kevent(dev, EVENT_SET_RX_MODE);
} }
EXPORT_SYMBOL_GPL(usbnet_set_rx_mode);
static void __handle_set_rx_mode(struct usbnet *dev) static void __handle_set_rx_mode(struct usbnet *dev)
{ {

View File

@ -207,6 +207,7 @@ struct cdc_state {
struct usb_interface *data; struct usb_interface *data;
}; };
extern void usbnet_cdc_update_filter(struct usbnet *dev);
extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
extern int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf); extern int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf);
extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
@ -273,6 +274,7 @@ extern int usbnet_set_link_ksettings(struct net_device *net,
extern u32 usbnet_get_link(struct net_device *net); extern u32 usbnet_get_link(struct net_device *net);
extern u32 usbnet_get_msglevel(struct net_device *); extern u32 usbnet_get_msglevel(struct net_device *);
extern void usbnet_set_msglevel(struct net_device *, u32); extern void usbnet_set_msglevel(struct net_device *, u32);
extern void usbnet_set_rx_mode(struct net_device *net);
extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
extern int usbnet_nway_reset(struct net_device *net); extern int usbnet_nway_reset(struct net_device *net);