[PATCH net-next v2 1/2] net: dsa: motorcomm: Report error when FDB fails to add

From
David Yang <mmyangfl@gmail.com>
Date
2026-11-08 09:46:07
Also in
lkml
Reply to
David Yang, 2026-11-08
fdb_add() ignored any errors returned by the hardware. Return error for
that case.

In practice the 4096-entry table is hardly ever filled, and since
fdb_add() will automatically expel dynamic entries, something bad will
definitively happen before you fill it up with static entries. This,
however, is in preparation for the upcoming static entry counters.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/dsa/motorcomm/chip.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index 33e5fc127244..a7a9a7439304 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -725,7 +725,13 @@ yt921x_fdb_add(struct yt921x_priv *priv, const unsigned char *addr, u16 vid,
 	if (res)
 		return res;
 
-	return yt921x_fdb_wait(priv, &val);
+	res = yt921x_fdb_wait(priv, &val);
+	if (res)
+		return res;
+	if (val & YT921X_FDB_RESULT_NOTFOUND)
+		return -ENOSPC;
+
+	return 0;
 }
 
 static int
-- 
2.53.0
Thread (3 messages) 3 messages, 1 author, last reply 4h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help