Re: [PATCH net-next v6 8/8] selftests: hsr: Add test for the inline PTP header on HSR
From: Hangbin Liu <hidden>
Date: 2026-09-24 02:08:43
Hi Sebastian, On Wed, Sep 23, 2026 at 02:14:09PM +0200, Sebastian Andrzej Siewior wrote:
quoted hunk ↗ jump to hunk
This test verifies the inline header which is used by HSR stack with the ether type ETH_P_1588. The HSR stack needs to recognize this header, strip it and send the requested packet only on the requested port. This test needs a HSR device and the two slave devices passed. It will will send a sample PTP packet with this inline header, requesting one of the ports combining with and without the HSR header. A total of four packets is sent. The test checks both ports devices for packets and complains if the packet was not observed on the expected port and/ or observed on the other port. The received content of the data is compared against the send data sample. Test suggested by Felix Maurer. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- tools/testing/selftests/net/hsr/.gitignore | 1 + tools/testing/selftests/net/hsr/Makefile | 5 + tools/testing/selftests/net/hsr/hsr_ptp.sh | 109 ++++++ tools/testing/selftests/net/hsr/hsr_ptp_test.c | 495 +++++++++++++++++++++++++ 4 files changed, 610 insertions(+)diff --git a/tools/testing/selftests/net/hsr/.gitignore b/tools/testing/selftests/net/hsr/.gitignore new file mode 100644 index 0000000000000..849eecb84c974 --- /dev/null +++ b/tools/testing/selftests/net/hsr/.gitignore@@ -0,0 +1 @@ +hsr_ptp_testdiff --git a/tools/testing/selftests/net/hsr/Makefile b/tools/testing/selftests/net/hsr/Makefile index 2150e487ac7d7..5d0134ead65d7 100644 --- a/tools/testing/selftests/net/hsr/Makefile +++ b/tools/testing/selftests/net/hsr/Makefile@@ -2,14 +2,19 @@ top_srcdir = ../../../../.. +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g + TEST_PROGS := \ hsr_ping.sh \ hsr_prp_redbox.sh \ hsr_redbox.sh \ link_faults.sh \ prp_ping.sh \ + hsr_ptp.sh \ # end of TEST_PROGS
If there is a new version. Please sort the test with alphabet order.
quoted hunk ↗ jump to hunk
TEST_FILES += hsr_common.sh +TEST_GEN_FILES := hsr_ptp_test + include ../../lib.mkdiff --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..034c635916f81 --- /dev/null +++ b/tools/testing/selftests/net/hsr/hsr_ptp.sh@@ -0,0 +1,109 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +ipv6=false + +source ./hsr_common.sh + +optstring="h4" +usage() { + echo "Usage: $0" +} + +while getopts "$optstring" option;do + case "$option" in + "h") + usage $0
usage "$0"
+ exit 0 + ;; + "?") + usage $0 + exit 1 + ;;
Thanks Hangbin