[PATCH net v3] net: dsa: mt7530: trap frames to conduit in MFC on EN7581 and AN7583

Tao Gong gongtao0607 at gmail.com
Thu Oct 22 13:56:48 PDT 2026


On EN7581, STP BPDUs received on switch user ports never reach the CPU.

Like MT7531 and MT7988, EN7581 and AN7583 only set the CPU port bitmap
in MT7531_CFC and are skipped by mt753x_conduit_state_change(). On
EN7581 this is not enough: trapped BPDUs reach the CPU only when
MT7530_CPU_EN and MT7530_CPU_PORT are also set in MT753X_MFC. Add
EN7581 and AN7583 to mt753x_conduit_state_change().

Tested on an AN7581 board (Gemtek W1700K, airoha,en7581-switch), where
only lan3 and lan4 are switch user ports. With RSTP BPDUs arriving on
lan4:
- without this patch, none reached the CPU;
- setting CPU_EN and CPU_PORT by hand delivered them, and clearing them
  stopped them;
- with this patch, they are received from boot.

Only BPDUs were tested. AN7583 is untested and is included because the
driver sets it up like EN7581.

Fixes: 2b0229f67932 ("net: dsa: mt7530: Add EN7581 support")
Fixes: d76556db10bf ("net: dsa: mt7530: Add AN7583 support")
Acked-by: Lorenzo Bianconi <lorenzo.bianconi at oss.qualcomm.com>
Signed-off-by: Tao Gong <gongtao0607 at gmail.com>
---

v2 was withdrawn after 4cb3cd670b2a ("net: dsa: mt7530: untag
VLAN-aware bridge PVID") fixed what patch 1/2 addressed. Patch 2/2 was
dropped with it by mistake: the test that seemed to show it was not
needed received BPDUs on ports that do not go through the switch. On a
switch user port, BPDUs are still lost without it, as described above.

To Paolo's question on v2: the issue is seen on real hardware (AN7581).
The results above are from the OpenWrt 6.18.55 kernel with this patch
applied; the code involved is the same in net.

The board has a single CPU port, so the test does not show which of CFC
and MFC selects the destination CPU port on EN7581. The comment on the
CPU port bitmap in mt753x_cpu_port_enable() is left unchanged.

The MT753X_MIRROR_EN() issue on AN7583 found in the v2 review is
separate and not addressed here.

Changes in v3:
- Drop patch 1/2, fixed by 4cb3cd670b2a.
- Add a Fixes tag for AN7583.
- Update the comment in mt753x_conduit_state_change().
- Add test results to the commit message.
- Keep Lorenzo's Acked-by from v1: the code change is the same, only the
  comment and the commit message changed.

v2: https://lore.kernel.org/netdev/20260923055103.949540-1-gongtao0607@gmail.com/

 drivers/net/dsa/mt7530.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 96832852c65a..5dbcea38209f 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -3335,10 +3335,13 @@ mt753x_conduit_state_change(struct dsa_switch *ds,
 
 	/* Set the CPU port to trap frames to for MT7530. Trapped frames will be
 	 * forwarded to the numerically smallest CPU port whose conduit
-	 * interface is up.
+	 * interface is up. On EN7581, trapped BPDUs do not reach the CPU port
+	 * without this, even with the CPU port bitmap set. AN7583 is set up
+	 * the same way as EN7581.
 	 */
 	if (priv->id != ID_MT7530 && priv->id != ID_MT7621 &&
-	    priv->id != ID_EN7528)
+	    priv->id != ID_EN7528 &&
+	    priv->id != ID_EN7581 && priv->id != ID_AN7583)
 		return;
 
 	mask = BIT(cpu_dp->index);

base-commit: f4377bf85887f57b59abb5479f7660a81ffe4449
-- 
2.56.0




More information about the Linux-mediatek mailing list