Netdev List
 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>
Subject: [PATCH net-next v2 2/5] net: dsa: motorcomm: Cache port isolation masks
Date: Sun, 29 Nov 2026 19:55:49 +0800	[thread overview]
Message-ID: <20261129115556.1669188-3-mmyangfl@gmail.com> (raw)
In-Reply-To: <20261129115556.1669188-1-mmyangfl@gmail.com>

Keep a software copy of PORTn_ISOLATION values for future use.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/dsa/motorcomm/chip.c | 6 ++++++
 drivers/net/dsa/motorcomm/chip.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index 49c9055c7512..bd89823aac55 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -1256,6 +1256,7 @@ yt921x_dsa_port_vlan_add(struct dsa_switch *ds, int port,
 
 static int yt921x_userport_standalone(struct yt921x_priv *priv, int port)
 {
+	struct yt921x_port *pp = &priv->ports[port];
 	struct dsa_switch *ds = &priv->ds;
 	u32 mask;
 	u32 ctrl;
@@ -1265,6 +1266,7 @@ static int yt921x_userport_standalone(struct yt921x_priv *priv, int port)
 	res = yt921x_reg_write(priv, YT921X_PORTn_ISOLATION(port), ctrl);
 	if (res)
 		return res;
+	pp->isolation_mask = ctrl;
 
 	/* Turn off FDB learning to prevent FDB pollution */
 	mask = YT921X_PORT_LEARN_DIS;
@@ -1314,6 +1316,7 @@ static int yt921x_isolate(struct yt921x_priv *priv, int port)
 					  mask);
 		if (res)
 			return res;
+		priv->ports[i].isolation_mask |= mask;
 	}
 
 	return 0;
@@ -1357,6 +1360,7 @@ static int yt921x_bridge(struct yt921x_priv *priv, u16 ports_mask)
 				       ctrl);
 		if (res)
 			return res;
+		pp->isolation_mask = ctrl;
 	}
 
 	return 0;
@@ -2046,6 +2050,7 @@ yt921x_dsa_phylink_get_caps(struct dsa_switch *ds, int port,
 
 static int yt921x_port_setup(struct yt921x_priv *priv, int port)
 {
+	struct yt921x_port *pp = &priv->ports[port];
 	struct dsa_switch *ds = &priv->ds;
 	u32 ctrl;
 	int res;
@@ -2071,6 +2076,7 @@ static int yt921x_port_setup(struct yt921x_priv *priv, int port)
 				       ctrl);
 		if (res)
 			return res;
+		pp->isolation_mask = ctrl;
 
 		/* To simplify FDB "isolation" simulation, we also disable
 		 * learning on the CPU port, and let software identify packets
diff --git a/drivers/net/dsa/motorcomm/chip.h b/drivers/net/dsa/motorcomm/chip.h
index d5ed580f8a78..39b7721cff40 100644
--- a/drivers/net/dsa/motorcomm/chip.h
+++ b/drivers/net/dsa/motorcomm/chip.h
@@ -464,6 +464,8 @@ struct yt921x_port {
 
 	unsigned short acl_cnt;
 
+	u16 isolation_mask;
+
 #if IS_ENABLED(CONFIG_NET_DSA_YT921X_LEDS)
 	unsigned char led_duty;
 	unsigned short led_cycle;
-- 
2.53.0


  parent reply	other threads:[~2026-11-29 11:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 11:55 [PATCH net-next v2 0/5] net: dsa: motorcomm: Reject isolated redirect targets David Yang
2026-11-29 11:55 ` [PATCH net-next v2 1/5] net: dsa: motorcomm: Remove local cpu_ports_mask David Yang
2026-11-29 11:55 ` David Yang [this message]
2026-11-29 11:55 ` [PATCH net-next v2 3/5] net: dsa: motorcomm: Reject isolated redirect targets David Yang
2026-11-29 11:55 ` [PATCH net-next v2 4/5] net: dsa: motorcomm: Recompute redirect rules on bridge changes David Yang
2026-11-29 11:55 ` [PATCH net-next v2 5/5] net: dsa: motorcomm: Reject bridge flags that break redirect rules David Yang

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=20261129115556.1669188-3-mmyangfl@gmail.com \
    --to=mmyangfl@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@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