Article View: linux.kernel.netdev
Article #26630Re: [PATCH net v2 2/2] net: bridge: switchdev: clear the hwdom of a port that stops the offload
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 00:27
Date: Fri, 04 Dec 2026 00:27
98 lines
11640 bytes
11640 bytes
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
Technical Details
Message-ID:
<179634406290.3146.7449604759040986420@kernel.org>Path:
mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376935-linux-kernel-netdev=dewy.ruReferences:
<20261203002451.517879-3-koralilgun@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376935-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/2] net: bridge: switchdev: clear the hwdom of a port that stops the offload Date: Fri, 04 Dec 2026 00:27:42 +0000 Organization: Usenet Network Message-ID: <179634406290.3146.7449604759040986420@kernel.org> References: <20261203002451.517879-3-koralilgun@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2639102"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:EfAUFGeUWQ3n6AfUCQ68h+dvgUA= sha256:5VcKCXbvknZchxP6bkYsOMF8h/j+NMQdyejOlbZXHg4= sha1:XCjVGU6wq7NQuA+eJwdAnUXOqtQ= sha256:L/apnBKOmubg57mis+JxFJUfYMUUXu139ZCG0Fwlkys= 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 33A9F117A7F; Fri, 4 Dec 2026 03:28:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 Dj3ycCzwZq5g; Fri, 4 Dec 2026 03:28:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376935-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 EF15C1179D5; Fri, 4 Dec 2026 03:27:52 +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 8667A24E6C; Fri, 4 Dec 2026 00:27:50 +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=1796344070; b=HWEVWKX+qGDOyG6fCuvJV3ueFTj7sZTcfXEqfF4evBs2JSSeKdAM29l4NLEeBC+a+lW6 cRTPPlUfMcBB7SMd6R1//XXPPecM7Ts4EB8KOohTG3SUef71XQyIZ6BJubBNnAXBJEh5o t58KCnyVs1irSz4fL1gc1R2PCU28I6nnHpl7dpCLWizusHY+xzF4QFln554rwz22c/NIP gj/0Gp+UnaUhznmOLemu9RXhsvOp1Cj5xY6OqOI5/eFcMO0D1k/eHDt10UhD7Uz1ynQGE /DsHTqzTzFThqfS3Q798v/LxvIM4x7ElAYDWj/OIWAgJoebGs3Hamci84Audzc6FEgQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796344070; 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=LSzhDlxHVOgGfqpg9dwTf8ye4MwjSduG02V6nJXPBGM=; b=GpV3UrSsuP+m9rSaKomAh77vvFGMK0xPTVMOrwnRsjEI0nFUSLsz1jortKZO8Q242r6l COP+25ei7tbYs4jBORo7uHGZ58YudqBSiMd+FJjkISp08I+XiqbAEFk594vRr2a/xL8p4 24mscPcigQXsowSeGGsIjAxUlqRlUwVb1TgeNxC8aNjIHeaplV1m/Nbpxi2TRspltjIih v2MuVTXVdDGTWFi+TSttmHrhLB2B0M0Jb8LLhBDhejGS96ni4PVp68XPUJNnJCzvnrmtx gLekYhoTCnqKoS1B4+0TzUrmNIUlzCcfHjKzrTBNHWHP6AsNZxEpmUVI1TpRjIVOiEQ== 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=gnuMry0K; 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 5E268606A333; Fri, 4 Dec 2026 00:27:50 +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=gnuMry0K 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=1796344064; b=lTaHuKpF70noeu/UXlAPX3iwsZF0iL2VdenICec03TeKWUEFf7vGF4YixeF6AwTapsXJ jekaVVs5c97JpX23ZuP8nb2N9aPqrTY2k9oCzylT3D/wVv4KpTMKOWJsNVlFRyZAeS5e/ oLK/6NJM2JN2taPYiCdTiXKhebXbXpi9OjKCD3ruF9sWTKv4L9sm6nq/dBiX9Lqa0LMcq 9ZCfqmvZqJbQnjCwE3v+eyTrAlU3bD82AMnyMQeWgAHrRHfVM03zGUyxuUenqTTBr8TyN 90k7pjSButg9hXOCetfeGIZT/35QxNUQJDhsmTUYTlxddlO4C4GutFUuCR8CP7uP7fg== X-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== 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=gnuMry0K; 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 7E324606A339; Fri, 4 Dec 2026 00:27:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FFAD1F000CE; Fri, 4 Dec 2026 00:27:43 +0000 (UTC) X-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== X-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 X-In-Reply-To: <20261203002451.517879-3-koralilgun@gmail.com> X-sashiko-severity: Low 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