mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Yang <mmyangfl@gmail.com>
To: netdev@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: dsa: motorcomm: Add LAG FDB callbacks
Date: Sun,  8 Nov 2026 18:50:09 +0800	[thread overview]
Message-ID: <20261108105012.1326929-1-mmyangfl@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-08 10:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261108105012.1326929-1-mmyangfl@gmail.com \
    --to=mmyangfl@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®