diff mbox series

[v1,1/2] realtek: remove RTL839x path in RTL838x multicast

Message ID 20220912200652.54877-1-sander@svanheule.net
State Accepted
Delegated to: Sander Vanheule
Headers show
Series [v1,1/2] realtek: remove RTL839x path in RTL838x multicast | expand

Commit Message

Sander Vanheule Sept. 12, 2022, 8:06 p.m. UTC
The multicast setup function rtl838x_eth_set_multicast_list() checks if
the current SoC is a RTL839x family device. However, the function is
only included in the RTL838x ops table, so this path should never be
taken, making this dead code. rtl839x_eth_set_multicast_list() is
already present in the RTL839x ops table, so it should be safe to remove
this branch.

While touching the code, also re-sort the functions to match sorting
elsewhere, with rtl838x coming before rtl839x.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
 .../drivers/net/ethernet/rtl838x_eth.c        | 33 ++++++++-----------
 1 file changed, 14 insertions(+), 19 deletions(-)

Comments

Sander Vanheule Oct. 6, 2022, 9:13 p.m. UTC | #1
On Mon, 2022-09-12 at 22:06 +0200, Sander Vanheule wrote:
> The multicast setup function rtl838x_eth_set_multicast_list() checks if
> the current SoC is a RTL839x family device. However, the function is
> only included in the RTL838x ops table, so this path should never be
> taken, making this dead code. rtl839x_eth_set_multicast_list() is
> already present in the RTL839x ops table, so it should be safe to remove
> this branch.
> 
> While touching the code, also re-sort the functions to match sorting
> elsewhere, with rtl838x coming before rtl839x.
> 
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
> ---

Would anybody still like to comment on this patch or the RMA flooding patch? If
you would like to test them, you can also consult some well-known address tables
[1, 2] to check if it affects any of your applications.

If not, I'll probably just merge them after the weekend.

[1] https://en.wikipedia.org/wiki/Multicast_address#Ethernet
[2]
http://www.thaemlitz.com/john/ieee-company_id-mac-address-table.html?mac=01-80-C2-00-00


Best,
Sander
diff mbox series

Patch

diff --git a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
index e96c5a7216f8..fcb6a6d10e6d 100644
--- a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
@@ -1030,6 +1030,20 @@  static int rtl838x_eth_stop(struct net_device *ndev)
 	return 0;
 }
 
+static void rtl838x_eth_set_multicast_list(struct net_device *ndev)
+{
+	if (!(ndev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
+		sw_w32(0x0, RTL838X_RMA_CTRL_0);
+		sw_w32(0x0, RTL838X_RMA_CTRL_1);
+	}
+	if (ndev->flags & IFF_ALLMULTI)
+		sw_w32(0x1fffff, RTL838X_RMA_CTRL_0);
+	if (ndev->flags & IFF_PROMISC) {
+		sw_w32(0x1fffff, RTL838X_RMA_CTRL_0);
+		sw_w32(0x7fff, RTL838X_RMA_CTRL_1);
+	}
+}
+
 static void rtl839x_eth_set_multicast_list(struct net_device *ndev)
 {
 	if (!(ndev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
@@ -1051,25 +1065,6 @@  static void rtl839x_eth_set_multicast_list(struct net_device *ndev)
 	}
 }
 
-static void rtl838x_eth_set_multicast_list(struct net_device *ndev)
-{
-	struct rtl838x_eth_priv *priv = netdev_priv(ndev);
-
-	if (priv->family_id == RTL8390_FAMILY_ID)
-		return rtl839x_eth_set_multicast_list(ndev);
-
-	if (!(ndev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
-		sw_w32(0x0, RTL838X_RMA_CTRL_0);
-		sw_w32(0x0, RTL838X_RMA_CTRL_1);
-	}
-	if (ndev->flags & IFF_ALLMULTI)
-		sw_w32(0x1fffff, RTL838X_RMA_CTRL_0);
-	if (ndev->flags & IFF_PROMISC) {
-		sw_w32(0x1fffff, RTL838X_RMA_CTRL_0);
-		sw_w32(0x7fff, RTL838X_RMA_CTRL_1);
-	}
-}
-
 static void rtl930x_eth_set_multicast_list(struct net_device *ndev)
 {
 	if (!(ndev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {