kernel: qca8k: fix host FDB on multi-CPU

On qca8k multi-CPU-port setups (e.g. qca8337 with ports 0+6 as CPU),
bridging switch user ports that use different conduits can make the host
reachable only from the ports tied to the last-programmed CPU port.

Add a pending kernel patch which makes qca8k merge CPU/DSA-port FDB
programming, so host FDB entries end up on all relevant CPU ports.

Fixes: openwrt/openwrt#17891
Signed-off-by: Kevin Staley <glaciertablet@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21317
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Kevin Staley 2025-12-29 07:53:20 -06:00 committed by Robert Marko
parent e9531860e6
commit 64ee5874af

View File

@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Staley <glaciertablet@gmail.com>
Date: Mon, 29 Dec 2025 00:00:00 +0000
Subject: [PATCH] net: dsa: qca8k: merge host FDB for multi-CPU setups
In multi-CPU-port setups, DSA may install the same host FDB entry on
multiple upstream-facing ports when bridged user ports use different
conduits. qca8k_port_fdb_add currently overwrites any existing entry for
the same {MAC, VID}, so the last CPU port wins and host reachability can
break for ports serviced by the other CPU port (e.g. Netgear R7800 when
wan is bridged into br-lan).
Use the existing search-and-insert/delete helpers for CPU and DSA ports
so the destination port mask is merged instead of replaced.
Fixes: openwrt/openwrt#17891
Signed-off-by: Kevin Staley <glaciertablet@gmail.com>
---
drivers/net/dsa/qca/qca8k-common.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -836,6 +836,13 @@ int qca8k_port_fdb_add(struct dsa_switch
struct qca8k_priv *priv = ds->priv;
u16 port_mask = BIT(port);
+ if (!vid)
+ vid = QCA8K_PORT_VID_DEF;
+
+ if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+ return qca8k_fdb_search_and_insert(priv, BIT(port), addr, vid,
+ QCA8K_ATU_STATUS_STATIC);
+
return qca8k_port_fdb_insert(priv, addr, port_mask, vid);
}
@@ -849,6 +856,9 @@ int qca8k_port_fdb_del(struct dsa_switch
if (!vid)
vid = QCA8K_PORT_VID_DEF;
+ if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+ return qca8k_fdb_search_and_del(priv, BIT(port), addr, vid);
+
return qca8k_fdb_del(priv, addr, port_mask, vid);
}