Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: usb: int51x1: use usbnet_cdc_update_filter

The int51x1 driver uses the same requests as USB CDC to handle packet
filtering, but provides its own definitions and function to handle it.
The chip datasheet says the requests are CDC compliant. Replace this
unnecessary code with a reference to usbnet_cdc_update_filter.

Also fix the broken datasheet link and remove an empty comment.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Link: https://patch.msgid.link/20260126044049.40359-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ethan Nelson-Moore and committed by
Jakub Kicinski
15e9abc2 bbabce5d

+4 -36
+1
drivers/net/usb/Kconfig
··· 564 564 config USB_NET_INT51X1 565 565 tristate "Intellon PLC based usb adapter" 566 566 depends on USB_USBNET 567 + select USB_NET_CDCETHER 567 568 help 568 569 Choose this option if you're using a 14Mb USB-based PLC 569 570 (Powerline Communications) solution with an Intellon
+3 -36
drivers/net/usb/int51x1.c
··· 4 4 * 5 5 * Intellon usb PLC (Powerline Communications) usb net driver 6 6 * 7 - * http://www.tandel.be/downloads/INT51X1_Datasheet.pdf 7 + * https://web.archive.org/web/20101025091240id_/http://www.tandel.be/downloads/INT51X1_Datasheet.pdf 8 8 * 9 9 * Based on the work of Jan 'RedBully' Seiffert 10 - */ 11 - 12 - /* 13 10 */ 14 11 15 12 #include <linux/module.h> ··· 23 26 #define INT51X1_PRODUCT_ID 0x5121 24 27 25 28 #define INT51X1_HEADER_SIZE 2 /* 2 byte header */ 26 - 27 - #define PACKET_TYPE_PROMISCUOUS (1 << 0) 28 - #define PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ 29 - #define PACKET_TYPE_DIRECTED (1 << 2) 30 - #define PACKET_TYPE_BROADCAST (1 << 3) 31 - #define PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ 32 - 33 - #define SET_ETHERNET_PACKET_FILTER 0x43 34 29 35 30 static int int51x1_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 36 31 { ··· 93 104 return skb; 94 105 } 95 106 96 - static void int51x1_set_multicast(struct net_device *netdev) 97 - { 98 - struct usbnet *dev = netdev_priv(netdev); 99 - u16 filter = PACKET_TYPE_DIRECTED | PACKET_TYPE_BROADCAST; 100 - 101 - if (netdev->flags & IFF_PROMISC) { 102 - /* do not expect to see traffic of other PLCs */ 103 - filter |= PACKET_TYPE_PROMISCUOUS; 104 - netdev_info(dev->net, "promiscuous mode enabled\n"); 105 - } else if (!netdev_mc_empty(netdev) || 106 - (netdev->flags & IFF_ALLMULTI)) { 107 - filter |= PACKET_TYPE_ALL_MULTICAST; 108 - netdev_dbg(dev->net, "receive all multicast enabled\n"); 109 - } else { 110 - /* ~PROMISCUOUS, ~MULTICAST */ 111 - netdev_dbg(dev->net, "receive own packets only\n"); 112 - } 113 - 114 - usbnet_write_cmd_async(dev, SET_ETHERNET_PACKET_FILTER, 115 - USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 116 - filter, 0, NULL, 0); 117 - } 118 - 119 107 static const struct net_device_ops int51x1_netdev_ops = { 120 108 .ndo_open = usbnet_open, 121 109 .ndo_stop = usbnet_stop, ··· 102 136 .ndo_get_stats64 = dev_get_tstats64, 103 137 .ndo_set_mac_address = eth_mac_addr, 104 138 .ndo_validate_addr = eth_validate_addr, 105 - .ndo_set_rx_mode = int51x1_set_multicast, 139 + .ndo_set_rx_mode = usbnet_set_rx_mode, 106 140 }; 107 141 108 142 static int int51x1_bind(struct usbnet *dev, struct usb_interface *intf) ··· 124 158 .bind = int51x1_bind, 125 159 .rx_fixup = int51x1_rx_fixup, 126 160 .tx_fixup = int51x1_tx_fixup, 161 + .set_rx_mode = usbnet_cdc_update_filter, 127 162 .in = 1, 128 163 .out = 2, 129 164 .flags = FLAG_ETHER,