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] net: dsa: motorcomm: Read the port PVID instead of bridge's
Date: Fri, 20 Nov 2026 06:09:46 +0800 [thread overview]
Message-ID: <20261119220949.1123168-1-mmyangfl@gmail.com> (raw)
The driver passed the bridge master to br_vlan_get_pvid(), returning
the bridge's own PVID (VID 1 by default) instead of the configured
port's: deleting a vid that equalled the bridge's PVID wiped the port's
real hardware PVID, and a vlan_filtering toggle programmed that PVID
into every port.
Query the PVID from dsa_port_to_bridge_port() instead. Clear it when the
port has no PVID left, instead of comparing the deleted vid against the
bridge master's PVID, as the bridge unpublishes the PVID before the del
notification.
Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x")
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/net/dsa/motorcomm/chip.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index c753c746490a..b12bf32f8896 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -948,18 +948,18 @@ static int
yt921x_vlan_filtering(struct yt921x_priv *priv, int port, bool vlan_filtering)
{
struct dsa_port *dp = dsa_to_port(&priv->ds, port);
- struct net_device *bdev;
+ struct net_device *brport;
u16 pvid;
u32 mask;
u32 ctrl;
int res;
- bdev = dsa_port_bridge_dev_get(dp);
+ brport = dsa_port_to_bridge_port(dp);
- if (!bdev || !vlan_filtering)
+ if (!brport || !vlan_filtering)
pvid = YT921X_VID_UNWARE;
else
- br_vlan_get_pvid(bdev, &pvid);
+ br_vlan_get_pvid(brport, &pvid);
res = yt921x_port_set_pvid(priv, port, pvid);
if (res)
return res;
@@ -1098,16 +1098,16 @@ yt921x_dsa_port_vlan_del(struct dsa_switch *ds, int port,
mutex_lock(&priv->reg_lock);
do {
struct dsa_port *dp = dsa_to_port(ds, port);
- struct net_device *bdev;
+ struct net_device *brport;
res = yt921x_vlan_del(priv, port, vid);
if (res)
break;
- bdev = dsa_port_bridge_dev_get(dp);
- if (bdev) {
- br_vlan_get_pvid(bdev, &pvid);
- if (pvid == vid)
+ brport = dsa_port_to_bridge_port(dp);
+ if (brport) {
+ br_vlan_get_pvid(brport, &pvid);
+ if (!pvid)
res = yt921x_pvid_clear(priv, port);
}
} while (0);
@@ -1135,19 +1135,19 @@ yt921x_dsa_port_vlan_add(struct dsa_switch *ds, int port,
mutex_lock(&priv->reg_lock);
do {
struct dsa_port *dp = dsa_to_port(ds, port);
- struct net_device *bdev;
+ struct net_device *brport;
res = yt921x_vlan_add(priv, port, vid,
vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED);
if (res)
break;
- bdev = dsa_port_bridge_dev_get(dp);
- if (bdev) {
+ brport = dsa_port_to_bridge_port(dp);
+ if (brport) {
if (vlan->flags & BRIDGE_VLAN_INFO_PVID) {
res = yt921x_pvid_set(priv, port, vid);
} else {
- br_vlan_get_pvid(bdev, &pvid);
+ br_vlan_get_pvid(brport, &pvid);
if (pvid == vid)
res = yt921x_pvid_clear(priv, port);
}
--
2.53.0
next reply other threads:[~2026-11-19 22:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 22:09 David Yang [this message]
2026-11-19 22:12 ` [PATCH net] net: dsa: motorcomm: Read the port PVID instead of bridge's netdev-bot+sinfo
2026-11-19 22:14 ` 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=20261119220949.1123168-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=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