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=1796344064; b=lTaHuKpF70noeu/UXlAPX3iwsZF0iL2VdenICec03TeKWUEFf7vGF4YixeF6AwTapsXJ jekaVVs5c97JpX23ZuP8nb2N9aPqrTY2k9oCzylT3D/wVv4KpTMKOWJsNVlFRyZAeS5e/ oLK/6NJM2JN2taPYiCdTiXKhebXbXpi9OjKCD3ruF9sWTKv4L9sm6nq/dBiX9Lqa0LMcq 9ZCfqmvZqJbQnjCwE3v+eyTrAlU3bD82AMnyMQeWgAHrRHfVM03zGUyxuUenqTTBr8TyN 90k7pjSButg9hXOCetfeGIZT/35QxNUQJDhsmTUYTlxddlO4C4GutFUuCR8CP7uP7fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796344064; 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=LSzhDlxHVOgGfqpg9dwTf8ye4MwjSduG02V6nJXPBGM=; b=xQfaeO9TzVMaYIMzTKE6dnUyK8LSmFdjZ4ntbJaUlxH/xB6OnPGofxg/MGF5tbgSY1bt jwApYL83gAuM+3KPIsr7Gia5mchj3ySdY0x3ObqORRBz18QgZuMu3utiZ+piXl5IpBWkL HwtxL92FdhI+MTJSBg9sq3xij54Hq30sr13pZWD91Y3ikol2rBRgwUl8ivOlPVp4e/MMe ne1CtaAQjSJ94qK0uEkBAIv+ONtgVuY+DnBo/V8iY9FCMVD5iS5ycWvNyd3esSKrr3qLS 7hDW7CO7r/dOz4qtX1d6b/qyWcHhYL5oPzP0YCaRsEPdoLksp0Y4uAouHZxXUhI10zA== 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=gnuMry0K; 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 7E324606A339; Fri, 4 Dec 2026 00:27:44 +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=gnuMry0K Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FFAD1F000CE; Fri, 4 Dec 2026 00:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796344064; bh=LSzhDlxHVOgGfqpg9dwTf8ye4MwjSduG02V6nJXPBGM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=gnuMry0Kf8r6uEukx6rTr0uqfVO9N6/Ybd6J4q7KtLDAMnmh2Bh/BsTc7I2b30ix0 rLcSCHWcw/r+gs+SPR5fVbZxpknEjgd1s0RpjOJQ6hV8ggtY1Dnp/5xSvPk0PcEkNR 1a7F9TH+ggrYCqk21SLpi3xOIjQT96EyKGy1FxxUgjn1TabFrH3Bhck74EH5W5KWDL 5U96SKGysAgvxdFfXrS0ERp0Znw6W27owfJCQSzna9Kt10V2tF49gMwoLmXpkGRn5z p2MdWjOefNBiTdHgEBNTbWdZDomB/bml9UOEbtFH0RQ62XK74fYR8WMHVw2H257+PJ wkNkkdqwGyAVg== Subject: Re: [PATCH net v2 2/2] net: bridge: switchdev: clear the hwdom of a port that stops the offload From: netdev-bot+sashiko@kernel.org To: koralilgun@gmail.com Cc: razor@blackwall.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, vladimir.oltean@nxp.com, ioana.ciornei@nxp.com, andrew@lunn.ch, jiri@resnulli.us, daniel.machon@microchip.com, bridge@lists.linux.dev, netdev@vger.kernel.org, koral.ilgun@adtran.com Date: Fri, 04 Dec 2026 00:27:42 +0000 Message-ID: <179634406290.3146.7449604759040986420@kernel.org> In-Reply-To: <20261203002451.517879-3-koralilgun@gmail.com> References: <20261203002451.517879-3-koralilgun@gmail.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: bridge@lists.linux.dev 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 more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In the LAG-leave window and the dsa_port_change_conduit() window, this patch makes a bridge port that the switch still forwards for act… -- net: bridge: switchdev: clear the hwdom of a port that stops the offload When the last offload of a bridge port stops, nbp_switchdev_del() now clears the port's hwdom. Before, the hwdom leaked when the port stayed in the bridge. nbp_switchdev_hwdom_set() now skips ports without a hwdom, and the forwarding path helpers read the hwdom once with READ_ONCE(). > diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c > index 8de12d56452dc..52b51b8753f43 100644 > --- a/net/bridge/br_switchdev.c > +++ b/net/bridge/br_switchdev.c [ ... ] > @@ -305,8 +330,10 @@ static void nbp_switchdev_del(struct net_bridge_port *p) > if (p->offload_count) > return; > > - if (p->hwdom) > + if (p->hwdom) { > nbp_switchdev_hwdom_put(p); > + WRITE_ONCE(p->hwdom, 0); > + } > > if (test_bit(BR_TX_FWD_OFFLOAD_BIT, &p->flags)) { > clear_bit(BR_TX_FWD_OFFLOAD_BIT, &p->flags); [Severity: Low] During a LAG leave, can clearing the hwdom here drop frames toward bridge ports that are software only? The last DSA port can leave a LAG that stays a bridge port. In that case this code runs at NETDEV_PRECHANGEUPPER: dsa_user_prechangeupper() dsa_port_pre_lag_leave() dsa_port_pre_bridge_leave() switchdev_bridge_port_unoffload() nbp_switchdev_del() WRITE_ONCE(p->hwdom, 0) The hardware bridge and the trunk are torn down later, at NETDEV_CHANGEUPPER, by dsa_port_lag_leave()->dsa_port_bridge_leave(). Until then, tag_dsa still marks every trunk frame: net/dsa/tag_dsa.c:dsa_rcv_ll() { ... if (trunk) skb->offload_fwd_mark = true; ... } nbp_switchdev_frame_mark() then leaves src_hwdom at 0 for the LAG port. Take a software-only egress port such as a veth or tap, which has hwdom 0. For that port, nbp_switchdev_allowed_egress() checks: return !test_bit(hwdom, &cb->fwd_hwdoms) && (!skb->offload_fwd_mark || cb->src_hwdom != hwdom); Here offload_fwd_mark is set and cb->src_hwdom == hwdom == 0. The port is refused, but the hardware never delivered the frame to it. The other switch ports have hwdom X and pass the check, because 0 != X. They get a software copy of a frame that the hardware already flooded. In the other direction, a marked frame from another switch port passes the check for the LAG, which now has hwdom 0. It then goes out through the trunk a second time. Documentation/networking/switchdev.rst says the bridge stops a frame from being forwarded "through any bridge port with the same mark". Here hwdom 0 means that the port has no hardware domain, not that it shares a mark. dsa_port_change_conduit() opens the same window between dsa_port_pre_bridge_leave() and dsa_port_bridge_leave(). The commit message describes this window, and it lasts one RTNL operation. Before this patch, though, the LAG kept its hwdom during the window and these checks gave the right result. Could the drops toward software-only ports be avoided by not counting src_hwdom 0 as a match in nbp_switchdev_allowed_egress()? For example, the check could require cb->src_hwdom != 0 before it refuses the port. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203002451.517879-1-koralilgun%40gmail.com