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: sr9700: remove code to drive nonexistent multicast filter

Several registers referenced in this driver's source code do not
actually exist (they are not writable and read as zero in my testing).
They exist in this driver because it originated as a copy of the dm9601
driver. Notably, these include the multicast filter registers - this
causes the driver to not support multicast packets correctly. Remove
the multicast filter code and register definitions. Instead, set the
chip to receive all multicast filter packets when any multicast
addresses are in the list.

Reviewed-by: Simon Horman <horms@kernel.org> (from v1)
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Link: https://patch.msgid.link/20260203013924.28582-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ethan Nelson-Moore and committed by
Jakub Kicinski
9a9424c7 61e94cbd

+5 -28
-1
drivers/net/usb/Kconfig
··· 319 319 config USB_NET_SR9700 320 320 tristate "CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices" 321 321 depends on USB_USBNET 322 - select CRC32 323 322 help 324 323 This option adds support for CoreChip-sz SR9700 based USB 1.1 325 324 10/100 Ethernet adapters.
+4 -21
drivers/net/usb/sr9700.c
··· 17 17 #include <linux/etherdevice.h> 18 18 #include <linux/ethtool.h> 19 19 #include <linux/usb.h> 20 - #include <linux/crc32.h> 21 20 #include <linux/usb/usbnet.h> 22 21 23 22 #include "sr9700.h" ··· 230 231 static void sr9700_set_multicast(struct net_device *netdev) 231 232 { 232 233 struct usbnet *dev = netdev_priv(netdev); 233 - /* We use the 20 byte dev->data for our 8 byte filter buffer 234 - * to avoid allocating memory that is tricky to free later 235 - */ 236 - u8 *hashes = (u8 *)&dev->data; 237 234 /* rx_ctl setting : enable, disable_long, disable_crc */ 238 235 u8 rx_ctl = RCR_RXEN | RCR_DIS_CRC | RCR_DIS_LONG; 239 236 240 - memset(hashes, 0x00, SR_MCAST_SIZE); 241 - /* broadcast address */ 242 - hashes[SR_MCAST_SIZE - 1] |= SR_MCAST_ADDR_FLAG; 243 - if (netdev->flags & IFF_PROMISC) { 237 + if (netdev->flags & IFF_PROMISC) 244 238 rx_ctl |= RCR_PRMSC; 245 - } else if (netdev->flags & IFF_ALLMULTI || 246 - netdev_mc_count(netdev) > SR_MCAST_MAX) { 247 - rx_ctl |= RCR_RUNT; 248 - } else if (!netdev_mc_empty(netdev)) { 249 - struct netdev_hw_addr *ha; 239 + else if (netdev->flags & IFF_ALLMULTI || !netdev_mc_empty(netdev)) 240 + /* The chip has no multicast filter */ 241 + rx_ctl |= RCR_ALL; 250 242 251 - netdev_for_each_mc_addr(ha, netdev) { 252 - u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26; 253 - hashes[crc >> 3] |= 1 << (crc & 0x7); 254 - } 255 - } 256 - 257 - sr_write_async(dev, SR_MAR, SR_MCAST_SIZE, hashes); 258 243 sr_write_reg_async(dev, SR_RCR, rx_ctl); 259 244 } 260 245
+1 -6
drivers/net/usb/sr9700.h
··· 101 101 #define WCR_LINKEN (1 << 5) 102 102 /* Physical Address Reg */ 103 103 #define SR_PAR 0x10 /* 0x10 ~ 0x15 6 bytes for PAR */ 104 - /* Multicast Address Reg */ 105 - #define SR_MAR 0x16 /* 0x16 ~ 0x1D 8 bytes for MAR */ 106 - /* 0x1e unused */ 104 + /* 0x16 --> 0x1E unused */ 107 105 /* Phy Reset Reg */ 108 106 #define SR_PRR 0x1F 109 107 #define PRR_PHY_RST (1 << 0) ··· 156 158 /* parameters */ 157 159 #define SR_EEPROM_TIMEOUT 1000 158 160 #define SR_EEPROM_LEN 256 159 - #define SR_MCAST_SIZE 8 160 - #define SR_MCAST_ADDR_FLAG 0x80 161 - #define SR_MCAST_MAX 64 162 161 #define SR_TX_OVERHEAD 2 /* 2bytes header */ 163 162 #define SR_RX_OVERHEAD 7 /* 3bytes header + 4crc tail */ 164 163