Article View: linux.kernel.netdev
Article #26053[PATCH net v2 0/2] net: bridge: switchdev: fix the hwdom state of a port that stops the offload
From: Koral Ilgun
Date: Thu, 03 Dec 2026 00:24
Date: Thu, 03 Dec 2026 00:24
79 lines
14756 bytes
14756 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 2 clears it,
as v1 did. The LLM review of v1 found that the skip in
nbp_switchdev_hwdom_set() lets a port that stays in the bridge get
-EBUSY, and that nbp_switchdev_add() then keeps offload_count. Patch 1
fixes the count first, so that no commit of the series has that fault.
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 c1c39137dcc3 plus a local change with empty LAG ops in
dsa_loop, x86_64 in QEMU (TCG), dsa_loop with tag protocol none. A
local trace printed offload_count and the hwdom; a local knob made
nbp_switchdev_hwdom_set() return -EBUSY as with all hwdoms busy.
- Leak, 70 rounds: base and patch 1 alone fail in round 64; patch 2
alone and the series pass 70 of 70.
- A LAG that is a bridge port before its first switch port joins: base
gives it hwdom 0 and a later port copies hwdom 0; with patch 2 both
get hwdom 1.
- The same LAG with the knob on: patch 2 alone keeps offload_count 1
after the EBUSY, accepts the retry with hwdom 0 and keeps hwdom 0
after the knob is off. The series refuses both tries with count 0 and
then gives hwdom 1.
- A ping between two veth ports of the bridge, with an offloaded
dsa_loop port in it: 20 of 20 on each kernel.
W=1 builds of net/bridge/ with allmodconfig, allyesconfig and an
x86_64_defconfig-based config, and sparse (C=2), show no warnings on
base, patch 1 and patch 2. No WARNING or BUG in the logs.
Not tested: a frame with offload_fwd_mark, so also the egress refusal
and the LAG leave window; a port with TX forwarding offload (mv88e6xxx,
tag_8021q); a real -EBUSY (the knob replaces a full busy_hwdoms); 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.
Patch 1 changes one case on rocker. rocker_netdevice_event() only
warns when switchdev_bridge_port_offload() fails, so the port stays in
the bridge after -EBUSY, and ofdpa_port_bridge_leave() calls
switchdev_bridge_port_unoffload() without a check. Before patch 1 the
stale offload_count balanced that call. With patch 1,
nbp_switchdev_del() hits WARN_ON(!p->offload_count) and returns. It
needs all hwdoms busy, and it comes from a read of the source. Rocker
can fail the join on that error in a separate patch.
Stable: neither patch applies 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.
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 (2):
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
net/bridge/br_switchdev.c | 70 +++++++++++++++++++++++++++------------
1 file changed, 49 insertions(+), 21 deletions(-)
base-commit: c1c39137dcc3134010566ff29a81c93124efa539
--
2.43.0
Technical Details
Message-ID:
<20261203002451.517879-1-koralilgun@gmail.com>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-376154-linux-kernel-netdev=dewy.ruShow 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-376154-linux-kernel-netdev=dewy.ru
From: koralilgun@gmail.com (Koral Ilgun)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/2] net: bridge: switchdev: fix the hwdom state of a port that stops the offload
Date: Wed, 2 Dec 2026 16:24:49 -0800
Organization: Usenet Network
Message-ID: <20261203002451.517879-1-koralilgun@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2095989"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xsMoLjeNlOYyipVQWExstq6Nn8Q= sha256:uA14eS/4c/lMn5S1wYplO/5pQt45cTdv43qvU52kzJY=
sha1:HDsrYJt3p3dQ/ZmixqJ2SiNkC1w= sha256:FX0TNaF3L5yg23rvpRzwQaO969wpAV5QttyHR8UBFxw=
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 ED3291177B7; Thu, 3 Dec 2026 03:25:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, 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.249,
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 Ky7LHSjCxR2J;
Thu, 3 Dec 2026 03:25:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376154-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 181071177A3; Thu, 3 Dec 2026 03:25:00 +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 DB15829142; Thu, 3 Dec 2026 00:24:55 +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=1796257495;
b=1pNjsccmg40SK6lTaVIybovBdIFqwKV8brChc3sB5pEhH5jsi5pq6TAsQ0uzVPrRv+fD
avB82pp9aURNLYLSbESnM3ebgRgB3AXMnn+jZuw64fnSiGj1AP6S8OFcEdvNlm9dIlpSx
xwQK4NOxuv+GnYSog8R0UR2u0q/0r9yDELbMjKdjI5Gvj7xlOxyUJmnn2Qr1rY2javOpR
Vv+7tPglKwryoURWez9Lsvkr1rGlUHnHv3wU1ZgTAgA1jL4epZuIhZG/x2bR8KIVohh0b
527+ofsQ0Mpn2eqbgz6a8Niw5aWaHULiBxN5rYkEpL0xU8hlO+LljfRDGCBoewu1OQQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796257495;
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=Y3dVUBPzaWJeD6xU/RCm9wCkkRWNgli0LPao3iAG53w=;
b=Ej3ygQA+4eehQIhXOTvioAh8hPf58ZzJap0nGExl729SIAD1Ol2qCK1q8SGctz90WMfw
clWTXpL1LPvK8LGeppdaNmo7jsKzgMAd+iAyNHlTD/mrRt23W73tJYy5jM/Jr41oAUXfw
ROYA3HQL5Y3n9Ls7RaCdomb+U4505fbRh0rLzCULw4wLx7G6xRuaAuCgwbsW8tckURlJH
dilLdFHl+R4BDKO9cvcREewJAK2Pz6s9DGMJNrlSPvwP7qQ6+7OBFdUhlna3V/sMxWfe+
C2v4/cOhSwZ9cpKkHGyk1ye00fdvCmDj7D0XaKz/Eb7aY9z9DCDqwYoEYN+c/T1VeSA==
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="gAQxz7/V";
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 946C5606A335;
Thu, 3 Dec 2026 00:24:55 +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=gAQxz7/V
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796257494;
b=x+u4TosxkMwOjpJydU2zd+cHLQr6UjIogdYGntQGd9u5JP0J+ylw/sawYS2C23BLfjta
eCXjIwkBlATMJ54gD9nRq1Gkh8RMk8TFv0QAHfjPuqID2d0PRaSR6DE0vZ1H72jSUdiuX
DSI6Wdy4Iv6H5EQTMmexlYqPwt62yDKVkHmQIkZI6FzoxsroEOvw4/0iL1hXRgxvXhJqA
v+saYkyX+HQ4/AG/vDTRLHEDSlJ1AvxMmT9CvHu6fLwXhHSvgpkG0e5cB1ftaX5YPF2mg
9fYa7XLiah3S/YofLEmUERGob52119GV5v4Y6ttEasdyZ3gYZj4zU3lwgmUpNiHAnVQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796257494;
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=Y3dVUBPzaWJeD6xU/RCm9wCkkRWNgli0LPao3iAG53w=;
b=N8nD4wDVXKjhFGx3Dd9DFDi7kBQ2aC0M0ThJFiSs/CfQz2jzrhXmkZgxV7VuFrKdcBRW
axMRZ0j6rFqFfmpvTp7l3wRJQgeVCXOfYhVkniaFTp7u3t7y602Ah0l4zbbBPS1xW9ngf
5We9wVOAfFIsnh108rQetGqSbumb/3MYAjcNOOmf64tCqDbI26BrgV0tPpL+t6f9br7YU
8c0C0Z5AyQJrkDf6X7vULAYhrpKZO/Jj6lAijoSKbJ/jTIfihxdWtQxIVQ4iMPxb0heV/
SRAD7g+5UoUnkmhUImpTxlzAcO38uStdtnINwVU9UU8KrzKRZ/8EDpbHKogrDyL1Zhw==
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="gAQxz7/V";
arc=none smtp.remote-ip=74.125.82.46
X-Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46])
(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 514DB606A322
for <netdev@vger.kernel.org>; Thu, 3 Dec 2026 00:24:54 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 514DB606A322
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-dl1-f46.google.com with SMTP id a92af1059eb24-1b546061d58so7333167c88.1
for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 16:24:54 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796257493; x=1796862293; 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=Y3dVUBPzaWJeD6xU/RCm9wCkkRWNgli0LPao3iAG53w=;
b=gAQxz7/VsGWAK7b8LXfuM/UT51joC5ifHrM2PgG6CMH3nV/yMjz5d7BCgGEXwwWxqh
AewFK6IHBo6ZWpE/fFSeV2d7NCHEBf1I5mI4W875dWlJ/E+iDCMFx9doNaKn9OmMh24z
K6Ol4aqTrw5l3VY9edN8Q8twANS/ay0rkZkVQZIZyq+699sIaCCYUOCarBzfOmFth6zn
c5057yZQ3+7IwnT6X7CwxvMj7tEhQCdQF04cSx+jTVvQs/glmsx1ZHMjOkmn1GXMIr08
6SsBTnF1dy4UUxJO2Zr1Cpd/lb/zF7oBBzVqSCgZp+UxORQDrDejqkXj8LIFTenoNVFZ
Q+Gg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796257493; x=1796862293;
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=Y3dVUBPzaWJeD6xU/RCm9wCkkRWNgli0LPao3iAG53w=;
b=zeYo0y+tBhN/aRSfeHOAUllj2KJ9HpRPFlkCPbkpW7WZefEqSTXzcRe1H57mMlmjmV
ZCpixWQ8ybdAokGAKpUZn2gXzy02IcQeVvlvFLzzGWm9mn/jsLSy4E4lDXPmyctMmpO9
ZjaFvYaRFl5oOCYavZHEXFaex5T277PYHjtXH3ummGk0+cZxaZQMW02xcOl/qbGmR0EU
fKPOxEH54d7ZEUU7G2dqoR6FO64tswndjdLK+UlKtApSvkv9cQyqfyT0I4/PO/TqgBz+
sUF7mtmzXSEYkzfERuM8Bsp6mBwm50kUpUvdf/1Qfnse8akmkDf/x/eczta3tpcexRaU
V6Xw==
X-Forwarded-Encrypted: i=1; AL+hErEULtZLBOCu6HFt3n7J7f0AWbzmOlWyAJIKO4ZEmHWiSURaeq97DmsDt/XN+Y90yagaMERyFNk=@vger.kernel.org
X-Gm-Message-State: APuU4Z8Gpwl8+Ag+9838dwB23l6ZahFfyf+sBxvhhMASlyAIpuY5tcJn
q6kHTwnL7YQJKzdn0/eeLDHK6cae1X2fEhCOFLJjf7R8DxJt9xqORdmP
X-Gm-Gg: AZFdTZeMbVRs09+YKLCRNYg9adcXKXbafiZk9NFIhcyxskx5EbdSDSGXnE69WvPtS1o
MjhKX+0wBl2Wd1mGnkt/BBICiYMkYaqznFJB14qawQcALtbPX4qRCZLCTA6Xerq7+4r3/a8lbIr
I6HF9s8SBfeKex405Ay16TZr0RZOKzRRxf4oQs37Pau4bJVHZuBGFOU0tWNbttV1Lx4yBLh3Dfh
tKWZtKS+Fxyi6Ly9dlMkM/JRfWXuFH+CaKuLKn+bT09Pxl/c21YO9U9K53Q3iHHeWLynFY+CRGz
m6K907SCbRNiGUgAXCqZgriQf555jaZykV2XGx5TgyiFQHF/yMg2/yT9hIU/2xxS+PbYdyfb0qe
pNLGLhLIpsrqsMiKQBLFyQFBrbA4RcTsidwuqpGpuPRHpKXjQGcIxikDs/FXgxJXoY76pIHbgSW
uiGdBF3vL/Uq3uEkr++bl3gNMyN0btGPkFu19/y/ynkdk5aw+1XaYmF932pCjtu3prlvNAuBdXm
rgNsz7kp+PuLamWmSLbdSPw4kgjKoBIyrxRtR5A+X1BLGQhD9+QYA8tVk2X04Sk68kdeLypHgsv
g9SU5Xy7M2mFRBWeZ1ssMxAmW6xt8e9USziseE8BovG0oh2QcM34IXmQFmSheot6MiWHYQHQFvy
x
X-Received: by 2002:a05:701b:4502:10b0:1b2:539b:496c with SMTP id a92af1059eb24-1b5569050c8mr44442020c88.35.1796257493312;
Wed, 02 Dec 2026 16:24:53 -0800 (PST)
X-Received: from samniyama.tailbcd61.ts.net ([76.20.4.3])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b55684c85fsm152631634c88.14.2026.12.02.16.24.52
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 02 Dec 2026 16:24:52 -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@lunn.ch>,
Jiri Pirko <jiri@resnulli.us>,
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