From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Wed, 2 Dec 2026 23:40:26 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42EB31F000C1; Wed, 2 Dec 2026 23:40:25 +0000 (UTC) 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== Subject: Re: [PATCH net v2] net: sparx5/lan969x: remove MDB entries on last bridge leave 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 Date: Wed, 02 Dec 2026 23:40:24 +0000 Message-ID: <179625482476.3146.10404666530979450675@kernel.org> In-Reply-To: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.com> References: <20261201-sparx5-mdb-bridge-leave-v2-1-127cacfcba6d@microchip.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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