From d6c75fb80965aa1b68d5333549ada9efc6cf151e Mon Sep 17 00:00:00 2001 From: Julius Bairaktaris Date: Thu, 22 Oct 2026 10:55:52 +0200 Subject: [PATCH] qualcommax: qca_ppe: read an FDB lookup's entry before retiring its result The FDB read results queue up: the data registers show the oldest, and reading the result register retires it. The driver polled the result register and then read the data, which by then was zero, so every lookup missed. A port_mdb_add therefore always started the group from the CPU port alone and added another entry for the same group, and a group with members on two ports was split over entries that each named one of them. Read the data before the result register in each poll, so the data read just before the result that names the operation is its entry. On an AX3600 with IGMP snooping, a group joined from lan1 and lan2 had six hardware entries, naming CPU and lan1 or CPU and lan2, and lan1 received none of the group's traffic; a lookup by hand returns the entry when its data is read first. Fixes: 0f9baab7f64 ("qualcommax: qca_ppe: finish an FDB operation before reading its result") Signed-off-by: Julius Bairaktaris Link: https://github.com/openwrt/openwrt/pull/24806 Signed-off-by: Robert Marko --- .../net/ethernet/qualcomm/qca_ppe_main.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/target/linux/qualcommax/files/drivers/net/ethernet/qualcomm/qca_ppe_main.c b/target/linux/qualcommax/files/drivers/net/ethernet/qualcomm/qca_ppe_main.c index 4ef76cae36d..39a4be43642 100644 --- a/target/linux/qualcommax/files/drivers/net/ethernet/qualcomm/qca_ppe_main.c +++ b/target/linux/qualcommax/files/drivers/net/ethernet/qualcomm/qca_ppe_main.c @@ -382,20 +382,19 @@ static int ppe_fdb_op_wait(struct qca_ppe_priv *priv, u32 rslt_reg, u32 val; int i; + /* The results queue up, the data registers show the oldest, and reading + * the result register retires it, so the data is read first: once the + * result names this operation, the data read before it is its entry. + */ for (i = 0; i < PPE_FDB_OP_RETRIES; i++) { - regmap_read(priv->regmap, rslt_reg, &val); - if (FIELD_GET(PPE_FDB_RSLT_CMD_ID, val) == cmd_id) { - if (data) { - regmap_read(priv->regmap, - PPE_FDB_RD_RSLT_DATA0, &data[0]); - regmap_read(priv->regmap, - PPE_FDB_RD_RSLT_DATA1, &data[1]); - regmap_read(priv->regmap, - PPE_FDB_RD_RSLT_DATA2, &data[2]); - } - - return 0; + if (data) { + regmap_read(priv->regmap, PPE_FDB_RD_RSLT_DATA0, &data[0]); + regmap_read(priv->regmap, PPE_FDB_RD_RSLT_DATA1, &data[1]); + regmap_read(priv->regmap, PPE_FDB_RD_RSLT_DATA2, &data[2]); } + regmap_read(priv->regmap, rslt_reg, &val); + if (FIELD_GET(PPE_FDB_RSLT_CMD_ID, val) == cmd_id) + return 0; udelay(1); }