🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27213

[PATCH net v3 0/3] net: bridge: switchdev: fix the hwdom state of a port that stops the offload

#27213
From: Koral Ilgun
Date: Sat, 05 Dec 2026 02:49
93 lines
15433 bytes
From: Koral Ilgun <koral.ilgun@adtran.com>

When the last offload of a bridge port stops while the port stays in
the bridge, the bridge keeps the hwdom of the port. Patch 3 clears it,
as v1 and v2 did. Patch 2 keeps offload_count at 0 after -EBUSY, a case
that patch 3 makes reachable for a port that stays in the bridge.
Patch 1 makes rocker fail a bridge join whose offload fails, so the
count patch does not make the WARN_ON() in nbp_switchdev_del()
reachable on rocker. The other callers of
switchdev_bridge_port_offload() pass the error on (read of the
source).

For rocker, a flag in struct ofdpa_port that skips the unoffload after
a failed offload would be smaller. But the port would then stay in the
bridge without a hwdom, as on net/main. A failed join matches DSA and
mlxsw. Only a bridge master gets the error back, because
ofdpa_port_ovs_changed() sets bridge_dev before the calls that can fail
and has no clean undo.

Daniel Machon reported that the fault reproduces on lan969x and that
v1 clears it, while he prepares a LAG series for sparx5/lan969x:
https://lore.kernel.org/netdev/20261202123828.3dcba7xv7hah56yz@DEN-DL-M70577.microsemi.net/

Test: net/main e9d78fc6741a plus a local change with empty LAG ops in
dsa_loop, x86_64 in QEMU (TCG), dsa_loop with tag protocol none, and a
QEMU rocker device with one port, cabled to a virtio NIC. A local knob
made nbp_switchdev_hwdom_set() return -EBUSY as with all hwdoms busy,
and a local trace printed offload_count and the hwdom. The tests ran on
net/main, on v2, on patch 2 alone, on patch 3 alone, and after each
patch of the series; each commit message gives its results. W=1 builds
of net/bridge/ and drivers/net/ethernet/rocker/ with allmodconfig,
allyesconfig and an x86_64_defconfig-based config show no warnings on
net/main and after each patch, and neither does sparse (C=2) on the
three changed files with the x86_64_defconfig-based config.

Not tested: a frame that a switch marked with offload_fwd_mark, so also
the LAG leave window and the dsa_port_change_conduit() window; a port
with TX forwarding offload (mv88e6xxx, tag_8021q); a real -EBUSY (the
knob replaces a full busy_hwdoms); a failure of the first
ofdpa_port_vlan_del() or of ofdpa_port_vlan_add() in the rocker join;
rocker with OVS; an offload from a second switch;
dsa_port_change_conduit(); mlxsw and the other drivers that call
switchdev_bridge_port_unoffload(); team; bridge VLAN filtering; the
error path of br_switchdev_port_offload(); an unoffload while frames go
through the bridge; the kernel selftests; lockdep, KASAN and KCSAN.

Stable: patch 1 applies to v5.15 and later (git apply --check).
Patches 2 and 3 do not apply before v7.2. Both have context from
f76ae12b6ba3 ("net: bridge: use atomic ops to read/change p->flags
(III)"), so older trees need a backport that adapts that context.

Claude Code (Anthropic) drafted this cover letter under my direction,
and I reviewed it.

v3:
- new patch 1: rocker fails the bridge join when the offload fails,
  undoes its join state, and ignores an STP state while the port is not
  bridged (Sashiko, Medium, on v2 1/2)
- patch 2: the rocker paragraph names patch 1
- not taken: Sashiko's Low point on v2 2/2, not to match a src_hwdom of
  0 in nbp_switchdev_allowed_egress(). adin1110, icssm, qtnfmac and
  icssg mark frames from ports without a hwdom, and the match of hwdom 0
  stops their duplicates.
- new test: the rocker join with the knob
- rebased on net/main e9d78fc6741a
v2: https://lore.kernel.org/netdev/20261203002451.517879-1-koralilgun@gmail.com/

v2:
- new patch 1: count an offload only after its hwdom is set
- patch 2: describe the receive side of the LAG leave window and the
  window in dsa_port_change_conduit(); read the hwdom once with
  READ_ONCE() in nbp_switchdev_frame_mark() and
  nbp_switchdev_allowed_egress(); name the mlxsw cases; add the tests
  of the self match and of frames through the bridge
- rebased on net/main c1c39137dcc3
v1: https://lore.kernel.org/netdev/20261124011639.990261-1-koralilgun@gmail.com/

Koral Ilgun (3):
  rocker: fail the bridge join when the offload fails
  net: bridge: switchdev: count an offload only after its hwdom is set
  net: bridge: switchdev: clear the hwdom of a port that stops the
    offload

 drivers/net/ethernet/rocker/rocker_main.c  |  8 ++-
 drivers/net/ethernet/rocker/rocker_ofdpa.c | 24 +++++++-
 net/bridge/br_switchdev.c                  | 70 +++++++++++++++-------
 3 files changed, 77 insertions(+), 25 deletions(-)


base-commit: e9d78fc6741ac06d438cf64e314c28e57014432a
-- 
2.43.0
Technical Details
Message-ID: <20261205024943.3657727-1-koralilgun@gmail.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377796-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377796-linux-kernel-netdev=dewy.ru
From: koralilgun@gmail.com (Koral Ilgun)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 0/3] net: bridge: switchdev: fix the hwdom state of a port that stops the offload
Date: Fri,  4 Dec 2026 18:49:39 -0800
Organization: Usenet Network
Message-ID: <20261205024943.3657727-1-koralilgun@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2938511"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ncSAjIY5ue9GcQOXaFlP3H3iojY= sha256:UskomHvDfJnHk9//gxqXbIeEh7AhfUvf2vJlJlvwa/w=
	sha1:rSASGHUD+vnsaDPzw3RP8xQRo6U= sha256:UwaLXjjHCuJdmlMc6IwZDzzvqxpp+2Ek0K6QV9RQBJ8=
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 57661117D32; Sat,  5 Dec 2026 05:50:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.397
X-Spam-Status: No, score=-3.397 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 Y513btNuBY8Z;
	Sat,  5 Dec 2026 05:50:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377796-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 1557A117D48; Sat,  5 Dec 2026 05:49:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id C942B2559B; Sat,  5 Dec 2026 02:49:53 +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=1796438990;
	b=yT0cXXTa9vvnh0+lmZUGhnJbTszGvyDgpxu3K9usKE+wdgqBOGpqBRoBoNtk6HyQMU4C
	 UvUwlwemInOUCfmG5qUwJBc1taDj31BJtXE4EcYO4QthXmMRqviNTdAX2VU17Biuvki0V
	 dInrSl60yNrH4StEEjWJ1BTB+nwoNZzE0KvEmyxnlmVGQNnb3NjAMtVoqis6+4DBZ8DNb
	 sV1pMtp2jqjBoX0ff+0FBwG28seQut5yunK7VVYC2Afj9HoCw/Iq6Ag3gIA8+JrZoFfxl
	 M0x2DiUZmwP4dcYWeU99zk5vUgaraBfXpm6w7CjdUjHrUNzC9ic7DsgSTUS1oRKlPlQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796438990;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=6sOcPN+6xhNFPko9EeAru5bUeKALxAB5+1M0JvaziCQ=;
	b=NGpKfJ2OEV/8U8JbMbuKDSteZ6qLtB3wqN8W1eWlJpDo9a3fN7/+3k+Se8lG5NooCHIc
	 FzT6RptRWxffG+aIko5AhQ8uGrxJiX/NzcitVslLnlJyBvieCPaeRfp8Td2A1uBZ2x/x9
	 CoRCez4OzcAFxrVrXEsBXGY5meibEhWYLt8vzNjNGQASaBCK2IiBeJmGZoCYltHDfP2Gj
	 4zw9xSRhvCon382GFnwB5Ds8ABCMeHLkMdq1+0LQfPTH2kY8CYIuoW2L79jBt2DdfZ/09
	 Lqngqmz4VI8H1KlfwjmeDqjmPipzuONHo7d1Vy0CMm91+nrhwSOooWZxLQhFHVyYc5A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Fz0+Ix9M;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 90BFA606A337;
	Sat,  5 Dec 2026 02:49:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Fz0+Ix9M
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796438989;
	b=BzYLc/zsUuKUYL6j5ZqWJOAhkOKrIDVQiOmxN3kRzHRGekk4outO8QHJWBMdNLfENdgE
	 MCZHZH98ykzsZVqZ34vfV6hKFEqibpp0qFckhUdGMDiiXK7a8dzG8Uxz0U3PZP/85hn/J
	 BcUlm4uew8cmiHa1rt1Jibhx1YJl+rmaCXjqMiyptowhIfJV85kHVkNLFeMyUwhVAv5Z2
	 g8hxn8PJGiL1Lz6fY9PRE+jvJ+kfuxAlUqLL1nC2KFaybPln4VLyQDUdU+DC2fSpS/auB
	 jAAy/asvRSNKTgF32V72EedmREQzLpHTUqe89VYX4K0WvEkpfdc9jhlOBtA8iLe9CNw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796438989;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=6sOcPN+6xhNFPko9EeAru5bUeKALxAB5+1M0JvaziCQ=;
	b=bBsPCbg5lWALA5A8lfaY+Ot2yXscww4ppteeGgVTXOGehHvR0cJzjgW3+/cs+ofgbgwe
	 TEmQ1W25T5deJp7v7z0y0rEBiT/36ZemFAe51qQM7po9hLCKgzt54FiG8M5zAkF5d4R+l
	 uadhCC1OU1/IIsmVRt5UOPr29NCmQg+2+tdeG8Wf8KzPfcdiMK9imdN3h27Sv2NOJw30h
	 wZVP7uA3faevSZCy2Id722VeTOM5Bup4+TRQ/pdjFIF27K9CI4TEIZtdgyVXTsc8ISvv8
	 LK1TSXYCTn1xRsWag36PSIdhbYW1th30ZIknflg7vuU7rm1MuL/W6wvX871j0tNmt+w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Fz0+Ix9M;
	arc=none smtp.remote-ip=74.125.82.172
X-Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 588D4606A322
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 02:49:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 588D4606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-3874cf36e63so2184840eec.0
        for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 18:49:49 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796438988; x=1797043788; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=6sOcPN+6xhNFPko9EeAru5bUeKALxAB5+1M0JvaziCQ=;
        b=Fz0+Ix9MEk7o/eo7GKtYQA4cxY5edNRAKx/q4wBWfKq98/jIDCz5k3vWtV3WeFZSCB
         2tICzp72XDcVZsdrFxgRWRElIGwMMoM+Cm0BbgG7KfK3toiItKCFlsm/f2tVgBuoi291
         4r8BdYorzismUE+azpo7zWNyqxN77vRfyHzgr4LsHsbkNPgWleBH8+p7hKW1hNcr7FTj
         jp92pHM+ccUa3qEz/N9AqYVohIdQ+kjNl1Zf+Sj/Gsd24CJioPA1caHAUauNzQOw3Xk/
         rtdFvQjTXGnEVTE+DS5V/eI+ChxD3DRvk3z7ZqLBs9blEX4sqL4jvGLkvbq3QsZt37Js
         lXEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796438988; x=1797043788;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=6sOcPN+6xhNFPko9EeAru5bUeKALxAB5+1M0JvaziCQ=;
        b=uvXjLNXaDAlgaA3+pyG0a9njBIssZgDe63Df/tFY/vs9EtUP2FZbOj+kUMRQ1u74bP
         vCWGHfx06enkZ9+o/SyR9pWjM6OALxmsCXMwNQdBJbWOcKqt+/zw8Hx08pIzNrJ9GERn
         7SrK1aLCq/laYOd6JDoyc0sEbwYY0G5SjoqvDfPRpJyxCIHS3mfwaaYaIsD8hTsY0YzO
         kC8vpJa6Nj44Tr3g+7oJLqc5iW671INk0dqKcVhf6FM6fmf3sNunBlPMYmc8nUnXfGUd
         dMceNy4aPSJ737SdbNAYJXLowXxXzt4fu846j/zw1OHDy5HPixYr2WOoRGPB1MyyB8h5
         ZaJA==
X-Forwarded-Encrypted: i=1; AL+hErE8cBGsGC0HldpYtuAc2Gwm0U2iJoYpzsBaZDREDlNxJsfL6fDwiwCpK5DX0PaB3mKvmUeHT/w=@vger.kernel.org
X-Gm-Message-State: APuU4Z85XjWG8c+Hw0LBRSUhMAqWfTYwEFVC2w3ObXb57TNHr9Y/Sdqk
	OM0tUdEQqNKOpc0ZyQHFOpS1TLAuYirFDgpiNgSipqYEJx2tHDGGiCeH
X-Gm-Gg: AZFdTZetTFHHlO3skNrAdIfiUlbkGHt2GjrbwIhp2YpUGtIx5x6ddvepMWiQ+KP24rg
	FMIBnv0yOyP7dDkpaS7ogdHv+CN6Qu1uISQvG0PKg4av/epTkqgIicuKqHi704a3Q67yIUQmzEv
	DRYD7e0DDiOZnK4MRApuYL3jLNiRMYk2FtEo90szvTAxM2KCM6nVIxYuIuigB91qcACtClYG7DN
	ujfMd6Uz4/hz61QM7ajdIpgZYBGMM+mvB4GXOLXc43kFUh7R8TuFnqIpAbmm3eSQdMoGNelgasS
	kYynAAoYRjexO+wkcIa1geQqu7xssito+f3G6ui9UQqOAh+o7Dv4kjlU3uu9hq3489ovAV/skBH
	xR9Uf0DNYNz0a5h2dccXV3iLqHl0gzUk8G1p2ayTL8P/XOLlFOUs34fdlYHvpYjvzhOMxc6VxfQ
	6NWGMiV/FnL567PahkTKrzPm9WiJ4l6ScJGaVor59egb2qXnwpBhSO56yr0DpA37zsZCQnfD/J9
	F89TmoZcEyhqnqPvWDtvShtW8kl6FCcNBc6zzAoXrwBQo0BzF5vJsEf0PTVXCGEdQMT8SMF+or5
	0CTFrspuB8EGI9gTKpM9Uhp3SfVpmxSOf0ypTRJBdKhqU+xNJSeMMJY48Gq19H4uqKLoPeziEUi
	jJSczv3oi7JhyqOCGI/46N5g=
X-Received: by 2002:a05:693c:63c4:b0:386:bc19:6a30 with SMTP id 5a478bee46e88-38752141f35mr3539955eec.20.1796438988255;
        Fri, 04 Dec 2026 18:49:48 -0800 (PST)
X-Received: from samniyama.tailbcd61.ts.net ([76.20.4.3])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521bb368sm17797155eec.10.2026.12.04.18.49.47
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 04 Dec 2026 18:49:47 -0800 (PST)
X-Cc: Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Daniel Machon <daniel.machon@microchip.com>,
	bridge@lists.linux.dev,
	netdev@vger.kernel.org,
	Koral Ilgun <koral.ilgun@adtran.com>
X-Mailer: git-send-email 2.43.0
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