From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794925169; b=RC4NtPlxUbmaPrxj9cjXhezzH+izex3zfB4lqQCabJIS1LGCj0H7cSkLrNsjSHa0At7e 9ptCwwNnmI26zICYE3joFeTlu/I0Bm7/2gclkH/r6hGanBtIIhVUHThbRAC4eQA+l4Ljq u5Z7T386ngfMiYD53Z3Nutabkcduc+dbLXCPiXEeYqe+8cJbccclOmZp477C205NRta/t XVt77+mHY+gtCC1ktB7WbPeJd/t1UQ6Y5FN6Iuww2gHk1dMDLHoYx5vynf4dILq/p/fxN nu/dnDwZGVXKYv36tdWZWYlW7w7BRi3KLPSEO1/40qWpXd2veF03hy9rDr/0BlV9JzQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794925169; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: 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=vewm0YM3mK/oI43WitLGRasKLJvDnFpqAzBQT6/SwaY=; b=ikpoGgwCZL0JXF5iudgWc2MCGMHil5XkyYg6wdwn2/5ACHS5kKkUn/IXMT9LxAPAd0LJ qRig5DmfN053pC1l2CNbgIF0qoRCVbaUevQDvKWgj+OT7qNzPQE4cbmWZf41ojsx6Id2O YeRXTEWrTMro3xTJbi9b5ft5LWE6ddXSigbGmeTevpPvmlxs4vqlfafYrTcQlTGAv3yPT fOzCqvQGwZ+qvL6M4veFbl3/zlrx7HPYPRledpAtcx/S/abQEvSnd3+hWnHFeBfRwWM40 /hGxQnCY2eh7nYJf6cSaeHuj+tFcZ+wfk8WpFwm6OG1uFnrIg9izIT+oI/t/TbiNy6g== 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=g1mIG94u; arc=none smtp.remote-ip=209.85.218.51 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 B5665606A32C for ; Tue, 17 Nov 2026 14:19:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B5665606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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=g1mIG94u Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c504707acfeso72909866b.1 for ; Tue, 17 Nov 2026 06:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794925166; x=1795529966; 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=vewm0YM3mK/oI43WitLGRasKLJvDnFpqAzBQT6/SwaY=; b=g1mIG94uiwF/vwzgPogrWrr49hBBpuWyaBIfHz0VTF/3ud2fMbXGndfciZGknZ/oso Unrn2lL/ffxpHHfayW1ZDifeh2AT1/y/drksrPb1V7xh51akTN8sGKAlGIkfyizmLKwS emUd4aZ22uR5Ix9O4mBnymnW2NRNZVmi811c/8E4B152pLU20y3aVNnigmmAZCG9WFaD fe8bVTzXtLSzt5KR7E8Gqh6Af7Z6fTrncNsyQlv9sO9KEyjYUT5HoSbs/iSw40u9nHcX 5aBFa4VryAg5TmSOmvsApllXv8XaVk5dHUXdGMiwEZ4CJV0pzYxNkaDv02oaNY4Y0YD3 QqMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794925166; x=1795529966; 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=vewm0YM3mK/oI43WitLGRasKLJvDnFpqAzBQT6/SwaY=; b=xs5Yoj9gu752WE2EsRPMZhYFDOmeqOzGYmyqFLspfZM/zarkQqskUOwjO3hOznPV/0 bbFlhM09Vje5oy4yzokxalsJGmMIhCXxG8eY5Yw+PYuWvd6VcgM3Qwev2hvReznrTwPF qBPsDQl5DSDRxZuZKWzjDkc7dle6+VfOnNop1qaD97sBCsRMLSiycEBElnpm+8I+j3Hm /voLfwSSCdJ6Sn7+5Gy14jIxvByvzPdGjXpfiPNdYQosnDBy7S8cfgPsphQ+D+WC9yJi PAMwtyRPjNmL+CF8clXTIc5j+cxUzScW1VLJG9DKgqnn31mraU5gEpdUyO2hH2pOSWhc zL7g== X-Gm-Message-State: APuU4Z/7mVjrA9N3jfFKOlWmKDnYffNfDwNGYD3TxjFsQEVxtGxBijNl hwZK6yaS7T7IPxGcObdyHDak3sISfrHu5AtU14rLOfDLSKbJZlet/BOT7Rz+MqN4 X-Gm-Gg: AYBFou1lTxkGFf99D/ModNdrRd+vwJd/lKRg8HaR0xiWdz2Ke9qieV7AM/D4RrqW2mE NswKaf2MVfYeXGJRiEFweqPfYHdMXyJiKL46HNbSFE84CL37by9Vhj4IdtKnc1N0ScrWmb0olG5 Xnsg28VZ+g0W9tziubpuy5cHjMgIvS5YUjbaV/IFw9tJUI5ioXacUufHYdsoD8Kk/03J/1VosxS VlvrsXFhq2qgp5Om3xCCIPHo3pWRbr21bk3/UE22HzIvJ7NHa051YeQ3LabuHc1G0ixbVYxRQiP XynZMPHrp2ytjsfVcQPWsW6SjrQoA0L/npMnqvDZEE31Uwbllo9s2WK4jXIzaX74LJ0xPlrNDTw UE/1miDM5XG9qA14Wd80H2Bncy/YomeCx50Um5BorMiC087gR4QBDttYov5c66OxNJy8lkwTA5j QtGN4FJMbf8mn0EcO/W7NZaWQD9NYzDTs05bJZvw1Q6jFPehYdNbhisWjUhjIq85ZRPPZrSNozn FSS3p1eo2x79Ey84IP/en1x+qRLsMCi6KjzOTXESktaVnW3uTfw0DDa/Rn6MV9MCfb9+h6z53Cg 1TIbypz8JzbH7KDrbmQ/osWO6+uSvsGJCvd7VZpvg46/dvgG4JngmH35BZKFKhFTAnUM7E5EJvs PYItZy6KcNgyDYLn7LU5ns6xSl9MTJykdgE/H4xS/rK7eywxqP/SDXB7Q+ztbVhtWxDrIa1ODcQ ZSJiQ+yA== X-Received: by 2002:a17:906:2441:b0:c41:8e21:4d62 with SMTP id a640c23a62f3a-c509614d4d7mr1248867266b.1.1794925165807; Tue, 17 Nov 2026 06:19:25 -0800 (PST) Received: from L-022584.energy.envision.com (dynamic-077-184-154-007.77.184.pool.telefonica.de. [77.184.154.7]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c5095a5abf3sm545215166b.12.2026.11.17.06.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 06:19:25 -0800 (PST) From: Xin Xie To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org, kees@kernel.org, petr.wozniak@gmail.com, qingfang.deng@linux.dev, fmaurer@redhat.com, luka.gejak@linux.dev, bigeasy@linutronix.de, xiaoliang.yang_1@nxp.com, skhawaja@google.com, liuhangbin@gmail.com, stable@vger.kernel.org, sdf.kernel@gmail.com, xiexinet@gmail.com, lukma@denx.de, fmancera@suse.de, danishanwar@ti.com, sunwenbo@cmss.chinamobile.com Subject: [PATCH net v10 0/4] net: hsr: fix super-packet forwarding Date: Tue, 17 Nov 2026 15:19:18 +0100 Message-ID: <20261117141922.20-1-xiexinet@gmail.com> X-Mailer: git-send-email 2.47.3 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 Content-Transfer-Encoding: 8bit HSR and PRP tag, number and de-duplicate each frame on the wire. GRO and GSO can hand them one skb holding several frames, which the lower device then drops or which goes out with a single tag or RCT and sequence number. Patch 1 keeps software GRO off on HSR/PRP ports. GRO_HW that the driver keeps on is left alone. Patch 2 refuses bridge, bond, team and OVS masters as ports, a macvlan or MACsec device on top of a bridge, bond, team or HSR/PRP master, and devices that already have a master or cannot take an RX handler. This fixes the syzbot recursive seqnr_lock report, as Sebastian suggested [1]. A port check cannot catch every path back into an HSR master, such as a tc/BPF redirect or a tunnel; those still nest the lock and can deadlock on the same device. Fixing them without dropping traffic needs seqnr_lock released before the port transmit, which can reorder frames for receivers without aae9d6b616b5 ("hsr: Implement more robust duplicate discard for HSR"). That is left to net-next, where Hangbin's patch [2] fits. He dropped it in favor of this series [3]; as this series no longer narrows seqnr_lock, it can go ahead there. Patch 3 segments GSO skbs before per-frame processing, outside seqnr_lock. GSO reaches an HSR/PRP port even with GRO off, typically from a container attached to a PRP RedBox interlink through veth: container/netns host PRP RedBox prp0-peer ---- veth ---- prp0-int (interlink RX) | split GSO into frames | sequence number + RCT / \ LAN A LAN B Some old Linux PRP senders put one RCT on a whole GSO skb; patch 3 drops such aggregates when it can detect them. With GRO_HW off on virtio-net, the host may segment them first and the RCT arrives as payload; upgrade the sender or disable GSO and TSO on its HSR/PRP master. Patch 4 adds selftests. Tested on a lockdep kernel: the new selftests (also with Python 3.9) and the existing hsr selftests pass, and the syzbot reproducer no longer reports recursive locking. No new W=1 warnings. No stable backport is requested. The remaining HSR dev->stats races are left to a separate series, as Paolo suggested [4]. Based on net aa40afa831eb; also applies to net-next. Patch 3 conflicts with Sebastian's pending net-next series [5]; its notes give the resolution. Changes since v9: - Added Sebastian's Reviewed-by. - Patch 1: the role clear in hsr_del_port() and the hsr_port bit moved, so that the series applies with the pending fix [6] and with the XDP series now in net-next [7]. Comment and message updated after the AI review [8]. - Patch 3: the segment loop uses skb_list_walk_safe(), as Sebastian suggested. - Patch 4: three test checks tightened after the AI review [8]. - AI review [8], not changed: a tunnel routed back through its own HSR master (patch 2) is the existing deadlock described above, and the socket close order in the test helper is harmless. [1] https://lore.kernel.org/netdev/20261014151838.6RyMIRVM@linutronix.de/ [2] https://lore.kernel.org/netdev/20260805-hsr_deadlock-v1-1-d8a6f06fc5a8@kylinos.cn/ [3] https://lore.kernel.org/netdev/anXnxn-PBv8qH6VB@fedora/ [4] https://lore.kernel.org/netdev/4fc3b9f1-4bef-4b34-ae7a-e89037cce829@redhat.com/ [5] https://lore.kernel.org/netdev/20261104-hsr_ptp-v10-0-2c4a38ad973c@linutronix.de/ [6] https://lore.kernel.org/netdev/20261112064716.85381-1-sunwenbo@cmss.chinamobile.com/ [7] https://lore.kernel.org/netdev/20261112235027.4072149-1-kuba@kernel.org/ [8] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112153333.20-1-xiexinet@gmail.com v9: https://lore.kernel.org/netdev/20261112153333.20-1-xiexinet@gmail.com/ v8: https://lore.kernel.org/netdev/20261107220544.20-1-xiexinet@gmail.com/ v7: https://lore.kernel.org/netdev/20261009201324.17-1-xiexinet@gmail.com/ v6: https://lore.kernel.org/netdev/20260809121455.1745-1-xiexinet@gmail.com/ v5: https://lore.kernel.org/netdev/20260807140751.1351-1-xiexinet@gmail.com/ v4: https://lore.kernel.org/netdev/20260803222211.877-1-xiexinet@gmail.com/ v3: https://lore.kernel.org/netdev/20260731090224.18-1-xiexinet@gmail.com/ v2: https://lore.kernel.org/netdev/20260724161253.79-1-xiexinet@gmail.com/ v1: https://lore.kernel.org/netdev/20260722171836.196-1-xiexinet@gmail.com/ Xin Xie (4): net: hsr: keep GRO disabled on HSR/PRP ports net: hsr: refuse forwarding devices as HSR/PRP ports net: hsr: segment GSO before per-frame forwarding selftests: net: hsr: verify GRO policy and ordered forwarding .../networking/net_cachelines/net_device.rst | 1 + include/linux/netdevice.h | 8 + net/core/dev.c | 15 + net/hsr/hsr_device.c | 13 +- net/hsr/hsr_forward.c | 156 ++ net/hsr/hsr_forward.h | 1 + net/hsr/hsr_slave.c | 145 +- net/hsr/hsr_slave.h | 2 + tools/testing/selftests/net/hsr/Makefile | 7 +- tools/testing/selftests/net/hsr/config | 10 + .../selftests/net/hsr/hsr_gro_superpacket.py | 1468 +++++++++++++++++ .../selftests/net/hsr/hsr_gro_superpacket.sh | 9 + .../net/hsr/hsr_ordered_forwarding.sh | 9 + 13 files changed, 1829 insertions(+), 15 deletions(-) create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.py create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.sh create mode 100755 tools/testing/selftests/net/hsr/hsr_ordered_forwarding.sh base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4 -- 2.53.0