Skip to content

Commit e9a5073

Browse files
mdegePaolo Abeni
authored andcommitted
net: renesas: rswitch: fix forwarding offload statemachine
A change of the port state of one port, caused the state of another port to change. This behvior was unintended. Fixes: b7502b1 ("net: renesas: rswitch: add offloading for L2 switching") Signed-off-by: Michael Dege <michael.dege@renesas.com> Link: https://patch.msgid.link/20260206-fix-offloading-statemachine-v3-1-07bfba07d03e@renesas.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent cdb1634 commit e9a5073

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

drivers/net/ethernet/renesas/rswitch_l2.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Renesas Ethernet Switch device driver
33
*
4-
* Copyright (C) 2025 Renesas Electronics Corporation
4+
* Copyright (C) 2025 - 2026 Renesas Electronics Corporation
55
*/
66

77
#include <linux/err.h>
@@ -60,6 +60,7 @@ static void rswitch_update_l2_hw_learning(struct rswitch_private *priv)
6060
static void rswitch_update_l2_hw_forwarding(struct rswitch_private *priv)
6161
{
6262
struct rswitch_device *rdev;
63+
bool new_forwarding_offload;
6364
unsigned int fwd_mask;
6465

6566
/* calculate fwd_mask with zeroes in bits corresponding to ports that
@@ -73,8 +74,9 @@ static void rswitch_update_l2_hw_forwarding(struct rswitch_private *priv)
7374
}
7475

7576
rswitch_for_all_ports(priv, rdev) {
76-
if ((rdev_for_l2_offload(rdev) && rdev->forwarding_requested) ||
77-
rdev->forwarding_offloaded) {
77+
new_forwarding_offload = (rdev_for_l2_offload(rdev) && rdev->forwarding_requested);
78+
79+
if (new_forwarding_offload || rdev->forwarding_offloaded) {
7880
/* Update allowed offload destinations even for ports
7981
* with L2 offload enabled earlier.
8082
*
@@ -84,13 +86,10 @@ static void rswitch_update_l2_hw_forwarding(struct rswitch_private *priv)
8486
priv->addr + FWPC2(rdev->port));
8587
}
8688

87-
if (rdev_for_l2_offload(rdev) &&
88-
rdev->forwarding_requested &&
89-
!rdev->forwarding_offloaded) {
89+
if (new_forwarding_offload && !rdev->forwarding_offloaded)
9090
rswitch_change_l2_hw_offloading(rdev, true, false);
91-
} else if (rdev->forwarding_offloaded) {
91+
else if (!new_forwarding_offload && rdev->forwarding_offloaded)
9292
rswitch_change_l2_hw_offloading(rdev, false, false);
93-
}
9493
}
9594
}
9695

0 commit comments

Comments
 (0)