Skip to contentSkip to conversation

net: usb: sr9700: remove code to drive nonexistent multicast filter

PATCH Applied Ethan Nelson-Moore 3 participants 7 messages Feb 3 – Feb 4

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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.

---
Changes in v2:
Remove unrelated cleanups; adjust commit message
Use netdev_mc_empty()
Changes in v3:
Rebase on latest net-next
Drop now-unused CRC32 Kconfig dependency

 drivers/net/usb/Kconfig  |  1 -
 drivers/net/usb/sr9700.c | 25 ++++---------------------
 drivers/net/usb/sr9700.h |  7 +------
 3 files changed, 5 insertions(+), 28 deletions(-)
drivers/net/usb/Kconfig +0 -1
index d050adfe860a..52a5c0922c79 100644
@@ -319,7 +319,6 @@ config USB_NET_DM9601
 config USB_NET_SR9700
 	tristate "CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices"
 	depends on USB_USBNET
-	select CRC32
 	help
 	  This option adds support for CoreChip-sz SR9700 based USB 1.1
 	  10/100 Ethernet adapters.
drivers/net/usb/sr9700.c +4 -21
index 49764bcf0912..937e6fef3ac6 100644
@@ -17,7 +17,6 @@
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
 #include <linux/usb.h>
-#include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 
 #include "sr9700.h"
@@ -231,31 +230,15 @@ static const struct ethtool_ops sr9700_ethtool_ops = {
 static void sr9700_set_multicast(struct net_device *netdev)
 {
 	struct usbnet *dev = netdev_priv(netdev);
-	/* We use the 20 byte dev->data for our 8 byte filter buffer
-	 * to avoid allocating memory that is tricky to free later
-	 */
-	u8 *hashes = (u8 *)&dev->data;
 	/* rx_ctl setting : enable, disable_long, disable_crc */
 	u8 rx_ctl = RCR_RXEN | RCR_DIS_CRC | RCR_DIS_LONG;
 
-	memset(hashes, 0x00, SR_MCAST_SIZE);
-	/* broadcast address */
-	hashes[SR_MCAST_SIZE - 1] |= SR_MCAST_ADDR_FLAG;
-	if (netdev->flags & IFF_PROMISC) {
+	if (netdev->flags & IFF_PROMISC)
 		rx_ctl |= RCR_PRMSC;
-	} else if (netdev->flags & IFF_ALLMULTI ||
-		   netdev_mc_count(netdev) > SR_MCAST_MAX) {
-		rx_ctl |= RCR_RUNT;
-	} else if (!netdev_mc_empty(netdev)) {
-		struct netdev_hw_addr *ha;
-
-		netdev_for_each_mc_addr(ha, netdev) {
-			u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
-			hashes[crc >> 3] |= 1 << (crc & 0x7);
-		}
-	}
+	else if (netdev->flags & IFF_ALLMULTI || !netdev_mc_empty(netdev))
+		/* The chip has no multicast filter */
+		rx_ctl |= RCR_ALL;
 
-	sr_write_async(dev, SR_MAR, SR_MCAST_SIZE, hashes);
 	sr_write_reg_async(dev, SR_RCR, rx_ctl);
 }
 
drivers/net/usb/sr9700.h +1 -6
index 5c04ea0306c7..d1663cb1e8cd 100644
@@ -101,9 +101,7 @@
 #define		WCR_LINKEN		(1 << 5)
 /* Physical Address Reg */
 #define	SR_PAR			0x10	/* 0x10 ~ 0x15 6 bytes for PAR */
-/* Multicast Address Reg */
-#define	SR_MAR			0x16	/* 0x16 ~ 0x1D 8 bytes for MAR */
-/* 0x1e unused */
+/* 0x16 --> 0x1E unused */
 /* Phy Reset Reg */
 #define	SR_PRR			0x1F
 #define		PRR_PHY_RST		(1 << 0)
@@ -158,9 +156,6 @@
 /* parameters */
 #define	SR_EEPROM_TIMEOUT	1000
 #define	SR_EEPROM_LEN		256
-#define	SR_MCAST_SIZE		8
-#define	SR_MCAST_ADDR_FLAG	0x80
-#define	SR_MCAST_MAX		64
 #define	SR_TX_OVERHEAD		2	/* 2bytes header */
 #define	SR_RX_OVERHEAD		7	/* 3bytes header + 4crc tail */
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 1 line · On Mon, 2 Feb 2026 17:39:09 -0800 Ethan Nelson-Moore wrote:

Not sure these annotation on the get are useful, maybe add the notes in the change log? Once this is committed the changelog is discarded, it is no longer relevant that v3 was applied. If anyone wants to do more research they have to look at the ML archive.

maintainer
#2 lore raw
Quoted 1 line · On Tue, 3 Feb 2026 19:43:17 -0800 Jakub Kicinski wrote:

Not sure these annotation on the get are useful

* annotations on the review tags

synapses misfiring over here.

#3 lore raw
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Tue, 3 Feb 2026 19:43:17 -0800 Jakub Kicinski wrote:

Not sure these annotation on the get are useful

* annotations on the review tags

synapses misfiring over here.

I will start moving them to the changelog in the future. Do you want me to send a new version with them removed, or are you going to do that when you add your tag? Either is fine with me.

Ethan

#6 lore raw
In reply to Ethan Nelson-Moore
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 2 Feb 2026 17:39:09 -0800 you wrote:

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.

[...]

Here is the summary with links:
- [net-next,v3] net: usb: sr9700: remove code to drive nonexistent multicast filter

    https://git.kernel.org/netdev/net-next/c/9a9424c756fe

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#4 lore raw
In reply to Ethan Nelson-Moore
Quoted 11 lines · On Tue, 3 Feb 2026 19:46:32 -0800 Ethan Nelson-Moore wrote:
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Tue, 3 Feb 2026 19:43:17 -0800 Jakub Kicinski wrote:

Not sure these annotation on the get are useful

* annotations on the review tags

synapses misfiring over here.

I will start moving them to the changelog in the future. Do you want me to send a new version with them removed, or are you going to do that when you add your tag? Either is fine with me.

It's not a big deal, applied thanks!