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=1796115335; b=x7ifmoq12xloW/EWXKh9HG7YnB164xNy7FsfNcu5k/u3naNzNYn4tO0wLbUFuZ4t7/jF aX33TMnySAyOWgEUxShEzVqBs30GKL3qncTHI4VchVSeGN0dpg/EzZF+Y9yRjnrf+fMfV BWrcz00T4B4jh2425Ez3fZEZ6/Sp/Gh2vy66JbKuZt2noHrBGx7TIgzkf2kP7zuO0dinQ Nk0qpNvShE3AKQHBKw/LuvJbyta+hc3bgT455TPwlHLSZFv7DZu5jv7pXueYYEZ6bEsJ3 2X+kiAd1ObNFKGZvnI+WeyyiVBEUkO5448YXoj2xA3GuWg44pDZE1NVhb/6KTW02LSw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115335; 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=iPH2W7pYI02zxcB37CGpQB2myFfJn9E4Frdj8oBITos=; b=rrMbwb0e/Jxc8hlMcSSUW3bCNNbcr5p0urSxJOl8qvLUA0Cq3hedboJrxouKgxf2rzsF PctRrO6D0ot6FdnvW4FPmD2akiRSuYAXXE/CZKpgWGIQMlX8qRPV01FBG622BAI5clULD e6vo/9fjHE38wUZvQVcO3qX+6V3xu7j9sc0QWHSNmFYuLyn13hXtbnp/oAIgL8p3kp5NH Li3EAJ9Pj9fHT5cXrNVWgsnp4PyK7lzJcKTD8+KlIysxvdchJawb1oFlmON+tGibN7sdS xJJXPUORCkg38YEPDlI5CG5PtnHk5rHfiihazVmiwUAv+eQTqR8xTYy+A6ZTcZ0zLGw== 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=m5dASfN9; 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 19CE9606A32F for ; Tue, 1 Dec 2026 08:55:35 +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=m5dASfN9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDF031F000C1; Tue, 1 Dec 2026 08:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796115335; bh=iPH2W7pYI02zxcB37CGpQB2myFfJn9E4Frdj8oBITos=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=m5dASfN90LJhvN51g6RKX0szHUc0xG2z++dxLdkK24lg9BuZFT2obtM6PVjRTFy4+ s9y1P35RoD440bLZbhxiLvYaw18c74CNkzk9zjdqomPDwwmeaoQl7gDBRMjqjCai2x ED3tCCReioGpyEHVIdvvdZ9p0Pk3ohlKjPvgrnSiR/ycXCmQ6IFTSWrS8kMycmkjPe V56+w9CRtwuKcG7WHR6xXZ8CKdROhuuUYhkCi85KLD4Umm1mQ8reb+DdUJe5lxoq+0 8a5oKh6N1VV9IakDOVx7a07giUggIQubHx2PqbD3rBPTKAnMtsRO1iq7K88JIpeU4w irKoqqogmoP1Q== Subject: Re: [PATCH net-next v13 8/8] selftests: hsr: Add test for the inline PTP header on HSR From: netdev-bot+sashiko@kernel.org To: bigeasy@linutronix.de Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com, andrew+netdev@lunn.ch, danishanwar@ti.com, d-qiu@ti.com, davem@davemloft.net, fmaurer@redhat.com, kuba@kernel.org, neelima@ti.com, pabeni@redhat.com, praneeth@ti.com, pratheesh@ti.com, richardcochran@gmail.com, horms@kernel.org, vigneshr@ti.com, willemdebruijn.kernel@gmail.com, daniel.machon@microchip.com, edumazet@kernel.org Date: Tue, 01 Dec 2026 08:55:33 +0000 Message-ID: <179611533353.3146.6294208363158546982@kernel.org> In-Reply-To: <20261130-hsr_ptp-v13-8-598326208fc5@linutronix.de> References: <20261130-hsr_ptp-v13-8-598326208fc5@linutronix.de> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] hsr_ptp.sh starts `ip netns exec $ns1 ./hsr_ptp_test` (line 90) right after setup_hsr_interfaces() runs its last `ip link set ...… - [Low] The file header comment of tools/testing/selftests/net/hsr/hsr_ptp_test.c (lines 5-7) says the… - [Low] hsr_ptp_test only works on HSRv1 devices, but neither the commit message ("This test needs a HSR device and the two slave devices… -- selftests: hsr: Add test for the inline PTP header on HSR This commit adds a selftest for the inline header that the HSR stack accepts with ether type ETH_P_1588. The hsr_ptp_test binary sends four PTP frames through the HSR master, with and without a caller-supplied HSR header, and checks that each one only appears on the requested slave port. The hsr_ptp.sh wrapper sets up three HSRv1 nodes and runs the binary in each namespace. > diff --git a/tools/testing/selftests/net/hsr/hsr_ptp.sh b/tools/testing/selftests/net/hsr/hsr_ptp.sh > new file mode 100755 > index 0000000000000..5fd3c5cd7a1cf > --- /dev/null > +++ b/tools/testing/selftests/net/hsr/hsr_ptp.sh > @@ -0,0 +1,110 @@ [ ... ] > + ip -net "$ns3" link set ns3eth1 up > + ip -net "$ns3" link set ns3eth2 up > + ip -net "$ns3" link set hsr3 up > +} > + > +run_ptp_hdr_tests() > +{ > + echo "INFO: Running PTP-header tests." > + > + ip netns exec "$ns1" ./hsr_ptp_test -H hsr1 -A ns1eth1 -B ns1eth2 > + ret=$? > + stop_if_error "PTP header test failed (ns1)." [ ... ] > +check_prerequisites > +trap cleanup_all_ns EXIT > + > +setup_ns ns1 ns2 ns3 > +setup_hsr_interfaces 1 > +run_ptp_hdr_tests [Severity: Medium] Can the first hsr_ptp_test run send its frame before the links are fully active? run_ptp_hdr_tests() starts right after the last "ip link set ... up" in setup_hsr_interfaces(), and nothing waits in between. hsr_ping.sh, hsr_redbox.sh, hsr_prp_redbox.sh and link_faults.sh all sleep or wait after setup. When a veth peer comes up, the other side gets carrier through the asynchronous linkwatch work. Until linkwatch calls dev_activate(), that device's TX queue is still on noop_qdisc: net/sched/sch_generic.c:dev_activate() { ... if (!netif_carrier_ok(dev)) /* Delay activation until next carrier-on event */ return; ... } The hsr master's carrier also only follows the slave operstate, which linkwatch sets. If pkt_send() runs inside that window, noop_enqueue drops the frame on either hsrN or the slave. send() still succeeds, because NET_XMIT_CN maps to 0 and hsr_dev_xmit() returns NETDEV_TX_OK. raw_recv() then times out after 100ms, and recv_verify() reports "Missing packet on portA" or "Missing packet on portB". Would it make sense to wait for carrier/operstate on the hsr and slave devices before running the test, as the other scripts here do? > diff --git a/tools/testing/selftests/net/hsr/hsr_ptp_test.c b/tools/testing/selftests/net/hsr/hsr_ptp_test.c > new file mode 100644 > index 0000000000000..e2c2da56138ae > --- /dev/null > +++ b/tools/testing/selftests/net/hsr/hsr_ptp_test.c > @@ -0,0 +1,496 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Simple test to verify the usage of the inline header used for HSR with > + * ether type ETH_P_1588. > + * The inline header has to be stripped, the sent packet must only appear on the > + * specified port and the interface needs to accept a foreign HSR header and > + * prepend its own header. [Severity: Low] Is "prepend its own header" accurate? hsr_forward_do() clones a frame that has has_hsr_header set and sends it out unchanged: net/hsr/hsr_forward.c:hsr_forward_do() { ... /* If this TX frame already has a HSR header then forward the * frame with it and don't add one. */ if (frame->has_hsr_header && frame->skb_std) { skb = skb_clone(frame->skb_std, GFP_ATOMIC); ... goto inject_into_stack; } ... } This path skips create_tagged_frame(), and hsr_xmit() also skips address substitution when has_hsr_header is set. The fwd_hsr checks in raw_recv() agree with the kernel, not with this comment. They expect the caller's sequence number, the caller's flipped source MAC and encap_type == ETH_P_1588 to come through unchanged. Could the comment say that a supplied HSR header is forwarded as-is? [ ... ] > + /* Assuming it is *our* network and nobody but the test here sends > + * packets to p2p_dst_mac. Therefore any received packet needs to be > + * ours and every mismatch is considered as error. > + */ > + if (memcmp(hsr_hdr->dst, p2p_dst_mac, MAC_LEN)) > + goto again; > + > + if (hsr_hdr->type != htons(ETH_P_HSR)) { > + printf("Error: Unexpected ether type: 0x%x\n", ntohs(hsr_hdr->type)); > + return -1; > + } [Severity: Low] Would this check fail on an HSRv0 device that is working correctly? For version 0, hsr_fill_tag() tags frames with ETH_P_PRP: net/hsr/hsr_forward.c:hsr_fill_tag() { ... hsr_ethhdr->ethhdr.h_proto = htons(proto_version ? ETH_P_HSR : ETH_P_PRP); ... } On v0, the no-hsr-header subtests would then print "Unexpected ether type: 0x88fb" and fail. hsr_dev_xmit() and hsr_ptp_parse_header() don't check the protocol version, so the inline header path is reachable on HSRv0 too. The commit message ("This test needs a HSR device and the two slave devices passed") and the usage text don't say that only HSRv1 is supported. hsr_ptp.sh keeps the "# HSRv0/1" comment and the HSRv parameter of setup_hsr_interfaces(), but it only calls: setup_hsr_interfaces 1 so the v0 inline header path is never tested. Should the test accept ETH_P_PRP on v0 and loop over both versions like hsr_ping.sh does? Otherwise, could the HSRv1-only assumption be documented? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-hsr_ptp-v13-0-598326208fc5%40linutronix.de