mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: motorcomm: Add LAG FDB callbacks
@ 2026-11-08 10:50 David Yang
  0 siblings, 0 replies; only message in thread
From: David Yang @ 2026-11-08 10:50 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

Fill the driver-side DSA gaps for LAG FDB offload.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/dsa/motorcomm/chip.c | 48 ++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index 33e5fc127244..f73eed06437b 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -883,6 +883,52 @@ yt921x_dsa_port_fdb_add(struct dsa_switch *ds, int port,
 	return res;
 }
 
+static int
+yt921x_dsa_lag_fdb_del(struct dsa_switch *ds, struct dsa_lag lag,
+		       const unsigned char *addr, u16 vid, struct dsa_db db)
+{
+	struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
+	struct dsa_port *dp;
+	u16 ports_mask;
+	int res;
+
+	if (!lag.id)
+		return -EINVAL;
+
+	ports_mask = 0;
+	dsa_lag_foreach_port(dp, ds->dst, &lag)
+		ports_mask |= BIT(dp->index);
+
+	mutex_lock(&priv->reg_lock);
+	res = yt921x_fdb_leave(priv, addr, vid, ports_mask);
+	mutex_unlock(&priv->reg_lock);
+
+	return res;
+}
+
+static int
+yt921x_dsa_lag_fdb_add(struct dsa_switch *ds, struct dsa_lag lag,
+		       const unsigned char *addr, u16 vid, struct dsa_db db)
+{
+	struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
+	struct dsa_port *dp;
+	u16 ports_mask;
+	int res;
+
+	if (!lag.id)
+		return -EINVAL;
+
+	ports_mask = 0;
+	dsa_lag_foreach_port(dp, ds->dst, &lag)
+		ports_mask |= BIT(dp->index);
+
+	mutex_lock(&priv->reg_lock);
+	res = yt921x_fdb_join(priv, addr, vid, ports_mask);
+	mutex_unlock(&priv->reg_lock);
+
+	return res;
+}
+
 static int
 yt921x_dsa_port_mdb_del(struct dsa_switch *ds, int port,
 			const struct switchdev_obj_port_mdb *mdb,
@@ -2536,6 +2582,8 @@ static const struct dsa_switch_ops yt921x_dsa_switch_ops = {
 	.set_ageing_time	= yt921x_dsa_set_ageing_time,
 	.port_fdb_del		= yt921x_dsa_port_fdb_del,
 	.port_fdb_add		= yt921x_dsa_port_fdb_add,
+	.lag_fdb_del		= yt921x_dsa_lag_fdb_del,
+	.lag_fdb_add		= yt921x_dsa_lag_fdb_add,
 	.port_mdb_del		= yt921x_dsa_port_mdb_del,
 	.port_mdb_add		= yt921x_dsa_port_mdb_add,
 	/* vlan */
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-08 10:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 10:50 [PATCH net-next] net: dsa: motorcomm: Add LAG FDB callbacks David Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®