🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26030

Re: [PATCH net v2] net: sparx5/lan969x: remove MDB entries on last bridge leave

#26030
From: netdev-bot+sashiko
Date: Wed, 02 Dec 2026 23:40
102 lines
11810 bytes
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
Technical Details
Message-ID: <179625482476.3146.10404666530979450675@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376129-linux-kernel-netdev=dewy.ru
References: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376129-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] net: sparx5/lan969x: remove MDB entries on last
 bridge leave
Date: Wed, 02 Dec 2026 23:40:24 +0000
Organization: Usenet Network
Message-ID: <179625482476.3146.10404666530979450675@kernel.org>
References: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2089494"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:EYe+SzLCjH32Ey19tVhoCTtMLs4= sha256:WHWJjR0337Cf1kpCi/NO2l8HYAyACxsT1Fw/woomfTE=
	sha1:wk9goiJaBtTfpA+CvvWgtOn/pbo= sha256:LhVxP5D12tNmu5zj9v/HzkVxPXBIrs6DpHvTAe7GI9o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id ACD17117797; Thu,  3 Dec 2026 02:40:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id SJanuHpUgOD1;
	Thu,  3 Dec 2026 02:40:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376129-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 8970111773F; Thu,  3 Dec 2026 02:40:29 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B66CD2713C; Wed,  2 Dec 2026 23:40:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796254827;
	b=b4coGvfTH7BUyolUzmM8kNXpJ60iopsm8BfhbcUGLYnJLbY3FugPd77j7UbObM3f70B2
	 sTNViDSfNn1Cc22DZFHh7BZyZXVA6Ck0mKzERPegRjLmsNkzAqqiug4V8ATXjnjDRP5Sm
	 220qgzM2Y008FTgzisQp+iQsPTC62kbD6919xX7AGY8oACTkk2j7NJlyPvboliFmwjiz4
	 TvPR+0r57Yc5EwJS7KOOZhXIgnKd7E+zzr3xFmM7Dm7tXe+QaAuz0UTIm40vlkYoUTM3+
	 4PtyvE7ULiLC7hD4y477TXbJ8iuNSQ2SJ9f7lDvbZAJ7usNtmvVX9zSkAVenawOSWZQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796254827;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=pBOxxnYbXipW7OZZUwaiFqEmpbSA/MtOdsGDBGa4NUY=;
	b=PryIiyLbIPk6Lv4FtDXk09bEcCGQ4gukIqYOnnn/hMkFg076RxwMdw34GWll0I4NUm5+
	 huH4Qpz0Tl3oH6Hx7eevhIMiJvcK2k377bL2jNh8dCJFyZSWsU/8aL8URZJSONvUGPwa/
	 Rb9Hf9PUWlJuIO2mUcYUOnfD6gK6HId4vg46fVPaz526HJuNrhXbP1F76ApeSkQq7vC4A
	 YJtG4CKRbhXeJJOYxTSFU6jZfRb6Df2w2XXtLW0R++uAwGvEjmDTyL/f8UQ/+4ccjLkB9
	 DRTfWooobVFXm0DCpDXYpSCg3IMQSXG/FHsLOqeWjgMgQzjgSWTl6CJypO3sI+y8ShA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dvJFuAjR;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 85202606A333;
	Wed,  2 Dec 2026 23:40:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dvJFuAjR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796254826;
	b=PtRc5+MqfrWY68Ii56+buXkhfEjbQv/FTHsTwj2k3b00774lEetU+ATrPmmRRjxPzzqj
	 cBfSkqN+LbctjFxIa1hJsiQqP8qljJpjk7gxo7bTlUMVPCWkEA8cj3F28g6awJN9gkAzf
	 l4cae0zV7tL4MY1q71M8q6Gd46tdoEM1yr7wds5AkjJP6tMRhl6hs/ylCjoEB6OSIsJeR
	 1AhlnmgTSHe36O5M9/rxtB7Yg5jYqqumGTQz+TkGqOmIb4cYr7c375OZkpoDXpTPZyQHD
	 wpkX8xi59rEEJuOT9k/lnr8FAIYiK+n2GwwUUGANjQCPRrlNko9fCUxGtT5Dm6wUGiA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796254826;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=pBOxxnYbXipW7OZZUwaiFqEmpbSA/MtOdsGDBGa4NUY=;
	b=dj8xWLNzJ4QJwlZup4EfI+ZpJlJScT1iqnythl+9f7b+ykfoyUmFOv2zTRvZzs29q2yI
	 ebtUdUMuoJiX/qr4vENoS6ZknmKtvh4BFLPebl20ixuzcCtfrhx/DKx1bpY2WJ65KORXG
	 lucJm/vlj0QoiKNgArTNoK85ZrXEdRau4BMzWV83IuX9Z3qjcC+aetIOe+p4nLQygzAzg
	 t5DmnZ1k+clKUV6+xKbv4hL4jawKDbJZD40aHliBM/CHjpYV/5vzRZx5TK5MjPWN2EcUW
	 BFZVabgvdeYL5UmsR+2ROc15u5+2Skmue0ST10cN2aQFzhnfCmKhNeKTKFb+k4r1WXw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dvJFuAjR;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3551606A322
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 23:40:26 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42EB31F000C1;
	Wed,  2 Dec 2026 23:40:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796254825;
	bh=pBOxxnYbXipW7OZZUwaiFqEmpbSA/MtOdsGDBGa4NUY=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=dvJFuAjRbQwTlN221iIErU3S9NYnCE9F5V6a14Lm/Tsuh+Vkf9bEkh6O5aG8WMRhX
	 /iNDREBqfPOTWhMleF94RKHcEzzhPSyQYJszArenoONPu/zgzNpYCtD2/MYMEChZe2
	 //8ETQh0EEmhHfpgpyZXXVHH1H4ihPv96EmgL82VyeSi7iuj/PB38YlfyCleecbINL
	 bSAiM1B6x2pJCoVnKEY9Oba/3pmKTy8zkXnUCVt5Dw5z8Ww+cfL2c1dpnwHzZ8Nh7g
	 2wztRINEghAd/HVMVraUXuPBr1gNMiIPL6PDSYmF0f3htKMqdHB3wo5SOTWbynJmDW
	 hF6eiO3IMSkQQ==
X-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
X-In-Reply-To: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list