From: netdev-bot+sashiko@kernel.org
To: mmyangfl@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com
Subject: Re: [PATCH net] net: dsa: motorcomm: Read the port PVID instead of bridge's
Date: Mon, 23 Nov 2026 22:11:08 +0000 [thread overview]
Message-ID: <179547186823.3135.2900984240867917348@kernel.org> (raw)
In-Reply-To: <20261119220949.1123168-1-mmyangfl@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] yt921x_dsa_port_vlan_del() (drivers/net/dsa/motorcomm/chip.c)
now only touches the hardware PVID when br_vlan_get_pvid(brport)…
--
net: dsa: motorcomm: Read the port PVID instead of bridge's
The yt921x driver used to query br_vlan_get_pvid() on the bridge master.
This commit makes it query the bridge port returned by
dsa_port_to_bridge_port() instead. In yt921x_dsa_port_vlan_del() it now
clears the hardware PVID only when the bridge port has no PVID left. The
commit message says this works because the bridge unpublishes the PVID
before sending the del notification.
> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index c753c746490a1..b12bf32f8896c 100644
> --- a/drivers/net/dsa/motorcomm/chip.c
> +++ b/drivers/net/dsa/motorcomm/chip.c
[ ... ]
> @@ -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);
[Severity: Medium]
Does the claim that "the bridge unpublishes the PVID before the del
notification" hold for every path that reaches this function?
It holds for nbp_vlan_delete(), which calls __vlan_unpublish() before
__vlan_del(). The rollback path in __vlan_add() in net/bridge/br_vlan.c
looks different.
Take a port that already has PVID Y, and a new VLAN X added with
BRIDGE_VLAN_INFO_PVID. __vlan_vid_add() sends the switchdev add first,
so yt921x_dsa_port_vlan_add()->yt921x_pvid_set() writes X into
YT921X_PORTn_VLAN_CTRL and clears CVLAN_DROP_UNTAGGED.
Several later steps in __vlan_add() can still fail:
br_vlan_add() on the master when BRIDGE_VLAN_INFO_MASTER is set,
br_vlan_get_master(), the per-port stats allocation, br_fdb_add_local(),
or rhashtable_lookup_insert_fast(). Any of these failures leads to:
net/bridge/br_vlan.c:__vlan_add() {
...
out_filt:
if (p) {
__vlan_vid_del(dev, br, v);
...
}
On that path __vlan_flags_commit(v, flags) never ran, so vg->pvid still
holds Y when the del notification reaches the driver.
In that case br_vlan_get_pvid(brport, &pvid) returns Y. Y is non-zero,
so yt921x_pvid_clear() is skipped and nothing else rewrites the PVID.
Would the hardware then keep PVID X, a VLAN the port has just been
removed from, while the bridge reports PVID Y? On a VLAN-filtering port,
untagged ingress would be classified into X and dropped by
VLAN_IGR_FILTER until the PVID is reprogrammed, for example by a
vlan_filtering toggle.
The old pvid == vid comparison had the same gap here. The new !pvid check
depends explicitly on the unpublish ordering, though, and this path
breaks that assumption.
Could the del path re-sync the PVID instead, along these lines?
pvid ? yt921x_pvid_set(priv, port, pvid) :
yt921x_pvid_clear(priv, port)
> }
> } while (0);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119220949.1123168-1-mmyangfl%40gmail.com
prev parent reply other threads:[~2026-11-23 22:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 22:09 [PATCH net] net: dsa: motorcomm: Read the port PVID instead of bridge's David Yang
2026-11-19 22:12 ` netdev-bot+sinfo
2026-11-19 22:14 ` David Yang
2026-11-23 22:11 ` netdev-bot+sashiko [this message]
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=179547186823.3135.2900984240867917348@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=mmyangfl@gmail.com \
--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