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: 0f9baab7f6 ("qualcommax: qca_ppe: finish an FDB operation before reading its result")
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/24806
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Julius Bairaktaris authored and Robert Marko committed 2026-10-26 09:44:47 +01:00
1 parent 00ad5b5384
commit d6c75fb809
1 file changed
+11 -12
@@ -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);
}