From: netdev-bot+sashiko@kernel.org
To: daniel.machon@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, Steen.Hegelund@microchip.com,
UNGLinuxDriver@microchip.com, casper.casan@gmail.com,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
haoxiang_li2024@163.com
Subject: Re: [PATCH net v2] net: sparx5/lan969x: remove MDB entries on last bridge leave
Date: Wed, 02 Dec 2026 23:40:24 +0000 [thread overview]
Message-ID: <179625482476.3146.10404666530979450675@kernel.org> (raw)
In-Reply-To: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.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] In sparx5_port_bridge_join(), the patch now passes
&sparx5->switchdev_blocking_nb as the blocking_nb argument to…
--
net: sparx5/lan969x: remove MDB entries on last bridge leave
When the last port leaves the bridge, this patch flushes all MDB entries
before hw_bridge_dev is cleared. MDB adds and deletes are ignored while no
bridge is offloaded. To get host groups offloaded again on rejoin, the
bridge is now asked to replay its objects through the blocking switchdev
notifier when a port joins.
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> index dac4dd833127a..e52e6a7fbe64e 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
[ ... ]
> @@ -193,7 +217,8 @@ static int sparx5_port_bridge_join(struct sparx5_port *port,
>
> set_bit(port->portno, sparx5->bridge_mask);
>
> - err = switchdev_bridge_port_offload(ndev, ndev, NULL, NULL, NULL,
> + err = switchdev_bridge_port_offload(ndev, ndev, port, NULL,
> + &sparx5->switchdev_blocking_nb,
> false, extack);
[Severity: Medium]
Can this call through a NULL notifier_call during probe?
The bridge replay helpers do not go through the notifier chain. They call
the nb passed here directly, and they only check that the nb pointer is
non-NULL:
net/bridge/br_switchdev.c:br_switchdev_vlan_replay_one() {
...
err = nb->notifier_call(nb, action, &obj_info);
return notifier_to_errno(err);
}
In sparx5_start(), the port netdevs are registered before the notifier
blocks are set up:
err = sparx5_register_netdevs(sparx5);
...
err = sparx5_register_notifier_blocks(sparx5);
Inside sparx5_register_notifier_blocks(), the netdevice notifier goes live
before switchdev_blocking_nb.notifier_call is assigned:
s5->netdevice_nb.notifier_call = sparx5_netdevice_event;
err = register_netdevice_notifier(&s5->netdevice_nb);
...
s5->switchdev_nb.notifier_call = sparx5_switchdev_event;
err = register_switchdev_notifier(&s5->switchdev_nb);
...
s5->switchdev_blocking_nb.notifier_call = sparx5_switchdev_blocking_event;
The sparx5 struct is zero-allocated, so notifier_call stays NULL until that
last assignment. If something like udev or networkd enslaves a port during
that window, after register_netdevice_notifier() has dropped rtnl, the path
would be:
br_add_if()
sparx5_netdevice_event() (NETDEV_CHANGEUPPER)
sparx5_port_changeupper()
sparx5_port_bridge_join()
switchdev_bridge_port_offload()
nbp_switchdev_sync_objs()
br_switchdev_vlan_replay()
br_switchdev_vlan_replay_one()
nb->notifier_call(...) <-- NULL
With CONFIG_BRIDGE_VLAN_FILTERING, the bridge always has its default VLAN 1
entry, so this call is reached for any bridge. It would happen with rtnl
held.
Before this patch, blocking_nb was NULL and every replay helper returned
early. Would it make sense to assign the notifier_call fields before
register_netdevice_notifier(), or to initialize them statically?
> if (err)
> goto err_switchdev_offload;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d%40microchip.com
prev parent reply other threads:[~2026-12-02 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 11:37 [PATCH net v2] net: sparx5/lan969x: remove MDB entries on last bridge leave Daniel Machon
2026-12-02 23:40 ` 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=179625482476.3146.10404666530979450675@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=casper.casan@gmail.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=haoxiang_li2024@163.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--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