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: 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: b7502b1043de ("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>

authored by

Michael Dege and committed by
Paolo Abeni
e9a5073a cdb1634d

+7 -8
+7 -8
drivers/net/ethernet/renesas/rswitch_l2.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Renesas Ethernet Switch device driver 3 3 * 4 - * Copyright (C) 2025 Renesas Electronics Corporation 4 + * Copyright (C) 2025 - 2026 Renesas Electronics Corporation 5 5 */ 6 6 7 7 #include <linux/err.h> ··· 60 60 static void rswitch_update_l2_hw_forwarding(struct rswitch_private *priv) 61 61 { 62 62 struct rswitch_device *rdev; 63 + bool new_forwarding_offload; 63 64 unsigned int fwd_mask; 64 65 65 66 /* calculate fwd_mask with zeroes in bits corresponding to ports that ··· 74 73 } 75 74 76 75 rswitch_for_all_ports(priv, rdev) { 77 - if ((rdev_for_l2_offload(rdev) && rdev->forwarding_requested) || 78 - rdev->forwarding_offloaded) { 76 + new_forwarding_offload = (rdev_for_l2_offload(rdev) && rdev->forwarding_requested); 77 + 78 + if (new_forwarding_offload || rdev->forwarding_offloaded) { 79 79 /* Update allowed offload destinations even for ports 80 80 * with L2 offload enabled earlier. 81 81 * ··· 86 84 priv->addr + FWPC2(rdev->port)); 87 85 } 88 86 89 - if (rdev_for_l2_offload(rdev) && 90 - rdev->forwarding_requested && 91 - !rdev->forwarding_offloaded) { 87 + if (new_forwarding_offload && !rdev->forwarding_offloaded) 92 88 rswitch_change_l2_hw_offloading(rdev, true, false); 93 - } else if (rdev->forwarding_offloaded) { 89 + else if (!new_forwarding_offload && rdev->forwarding_offloaded) 94 90 rswitch_change_l2_hw_offloading(rdev, false, false); 95 - } 96 91 } 97 92 } 98 93