[PATCH net-next] net: dsa: motorcomm: Add LAG FDB callbacks

From: David Yang

Date: Sun Nov 08 2026 - 05:50:56 EST


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

Signed-off-by: David Yang <mmyangfl@xxxxxxxxx>
---
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