2022-09-23 21:28:30

by Vladimir Oltean

[permalink] [raw]
Subject: [PATCH net-next 0/4] Improve tsn_lib selftests for future distributed tasks

Some of the boards I am working with are limited in the number of ports
that they offer, and as more TSN related selftests are added, it is
important to be able to distribute the work among multiple boards.
A large part of implementing that is ensuring network-wide
synchronization, but also permitting more streams of data to flow
through the network. There is the more important aspect of also
coordinating the timing characteristics of those streams, and that is
also something that is tackled, although not in this modest patch set.
The goal here is not to introduce new selftests yet, but just to lay a
better foundation for them. These patches are a part of the cleanup work
I've done while working on selftests for frame preemption. They are
regression-tested with psfp.sh.

Vladimir Oltean (4):
selftests: net: tsn_lib: don't overwrite isochron receiver extra args
with UDS
selftests: net: tsn_lib: allow running ptp4l on multiple interfaces
selftests: net: tsn_lib: allow multiple isochron receivers
selftests: net: tsn_lib: run phc2sys in automatic mode

.../selftests/drivers/net/ocelot/psfp.sh | 2 +-
.../selftests/net/forwarding/tsn_lib.sh | 52 ++++++++++++-------
2 files changed, 34 insertions(+), 20 deletions(-)

--
2.34.1


2022-09-23 21:32:41

by Vladimir Oltean

[permalink] [raw]
Subject: [PATCH net-next 3/4] selftests: net: tsn_lib: allow multiple isochron receivers

Move the PID variable for the isochron receiver into a separate
namespace per stats port, to allow multiple receivers (and/or
orchestration daemons) to be instantiated by the same script.

Preserve the existing behavior by making isochron_do() use the default
stats TCP port of 5000.

Signed-off-by: Vladimir Oltean <[email protected]>
---
.../testing/selftests/net/forwarding/tsn_lib.sh | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/tsn_lib.sh b/tools/testing/selftests/net/forwarding/tsn_lib.sh
index ace9c4f06805..20c2b411ba36 100644
--- a/tools/testing/selftests/net/forwarding/tsn_lib.sh
+++ b/tools/testing/selftests/net/forwarding/tsn_lib.sh
@@ -147,7 +147,9 @@ isochron_recv_start()
{
local if_name=$1
local uds=$2
- local extra_args=$3
+ local stats_port=$3
+ local extra_args=$4
+ local pid="isochron_pid_${stats_port}"

if ! [ -z "${uds}" ]; then
extra_args="${extra_args} --unix-domain-socket ${uds}"
@@ -158,16 +160,20 @@ isochron_recv_start()
--sched-priority 98 \
--sched-fifo \
--utc-tai-offset ${UTC_TAI_OFFSET} \
+ --stats-port ${stats_port} \
--quiet \
${extra_args} & \
- isochron_pid=$!
+ declare -g "${pid}=$!"

sleep 1
}

isochron_recv_stop()
{
- { kill ${isochron_pid} && wait ${isochron_pid}; } 2> /dev/null
+ local stats_port=$1
+ local pid="isochron_pid_${stats_port}"
+
+ { kill ${!pid} && wait ${!pid}; } 2> /dev/null
}

isochron_do()
@@ -219,7 +225,7 @@ isochron_do()

cpufreq_max ${ISOCHRON_CPU}

- isochron_recv_start "${h2}" "${receiver_uds}" "${receiver_extra_args}"
+ isochron_recv_start "${h2}" "${receiver_uds}" 5000 "${receiver_extra_args}"

isochron send \
--interface ${sender_if_name} \
@@ -240,7 +246,7 @@ isochron_do()
${extra_args} \
--quiet

- isochron_recv_stop
+ isochron_recv_stop 5000

cpufreq_restore ${ISOCHRON_CPU}
}
--
2.34.1

2022-09-23 21:41:31

by Vladimir Oltean

[permalink] [raw]
Subject: [PATCH net-next 4/4] selftests: net: tsn_lib: run phc2sys in automatic mode

We can make the phc2sys helper not only synchronize a PHC to
CLOCK_REALTIME, which is what it currently does, but also CLOCK_REALTIME
to a PHC, which is going to be needed in distributed TSN tests.

Instead of making the complexity of the arguments passed to
phc2sys_start() explode, we can let it figure out the sync direction
automatically, based on ptp4l's port states.

Towards that goal, pass just the path to the desired ptp4l instance's
UNIX domain socket, and remove the $if_name argument (from which it
derives the PHC). Also adapt the one caller from the ocelot psfp.sh
test. In the case of psfp.sh, phc2sys_start is able to properly figure
out that CLOCK_REALTIME is the source clock and swp1's PHC is the
destination, because of the way in which ptp4l_start for the
UDS_ADDRESS_SWP1 was called: with slave_only=false, so it will always
win the BMCA and always become the sync master between itself and $h1.

Signed-off-by: Vladimir Oltean <[email protected]>
---
tools/testing/selftests/drivers/net/ocelot/psfp.sh | 2 +-
tools/testing/selftests/net/forwarding/tsn_lib.sh | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/ocelot/psfp.sh b/tools/testing/selftests/drivers/net/ocelot/psfp.sh
index 5a5cee92c665..bed748dde4b0 100755
--- a/tools/testing/selftests/drivers/net/ocelot/psfp.sh
+++ b/tools/testing/selftests/drivers/net/ocelot/psfp.sh
@@ -181,7 +181,7 @@ setup_prepare()

# Set up swp1 as a master PHC for h1, synchronized to the local
# CLOCK_REALTIME.
- phc2sys_start ${swp1} ${UDS_ADDRESS_SWP1}
+ phc2sys_start ${UDS_ADDRESS_SWP1}

# Assumption true for LS1028A: h1 and h2 use the same PHC. So by
# synchronizing h1 to swp1 via PTP, h2 is also implicitly synchronized
diff --git a/tools/testing/selftests/net/forwarding/tsn_lib.sh b/tools/testing/selftests/net/forwarding/tsn_lib.sh
index 20c2b411ba36..b91bcd8008a9 100644
--- a/tools/testing/selftests/net/forwarding/tsn_lib.sh
+++ b/tools/testing/selftests/net/forwarding/tsn_lib.sh
@@ -22,8 +22,7 @@ fi

phc2sys_start()
{
- local if_name=$1
- local uds_address=$2
+ local uds_address=$1
local extra_args=""

if ! [ -z "${uds_address}" ]; then
@@ -33,9 +32,7 @@ phc2sys_start()
phc2sys_log="$(mktemp)"

chrt -f 10 phc2sys -m \
- -c ${if_name} \
- -s CLOCK_REALTIME \
- -O ${UTC_TAI_OFFSET} \
+ -a -rr \
--step_threshold 0.00002 \
--first_step_threshold 0.00002 \
${extra_args} \
--
2.34.1

2022-09-23 21:55:25

by Vladimir Oltean

[permalink] [raw]
Subject: [PATCH net-next 1/4] selftests: net: tsn_lib: don't overwrite isochron receiver extra args with UDS

The extra_args argument ($3) of isochron_recv_start is overwritten with
uds ($2), if that argument exists.

This is currently not a problem, because the only TSN selftest
(ocelot/psfp.sh) omits remote sync so it does not specify to the
receiver a UNIX domain socket for ptp4l. So $uds is currently an empty
string.

Signed-off-by: Vladimir Oltean <[email protected]>
---
tools/testing/selftests/net/forwarding/tsn_lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/tsn_lib.sh b/tools/testing/selftests/net/forwarding/tsn_lib.sh
index 60a1423e8116..1c8e36c56f32 100644
--- a/tools/testing/selftests/net/forwarding/tsn_lib.sh
+++ b/tools/testing/selftests/net/forwarding/tsn_lib.sh
@@ -139,7 +139,7 @@ isochron_recv_start()
local extra_args=$3

if ! [ -z "${uds}" ]; then
- extra_args="--unix-domain-socket ${uds}"
+ extra_args="${extra_args} --unix-domain-socket ${uds}"
fi

isochron rcv \
--
2.34.1

2022-09-24 10:36:30

by Kurt Kanzenbach

[permalink] [raw]
Subject: Re: [PATCH net-next 0/4] Improve tsn_lib selftests for future distributed tasks

On Sat Sep 24 2022, Vladimir Oltean wrote:
> Some of the boards I am working with are limited in the number of ports
> that they offer, and as more TSN related selftests are added, it is
> important to be able to distribute the work among multiple boards.
> A large part of implementing that is ensuring network-wide
> synchronization, but also permitting more streams of data to flow
> through the network. There is the more important aspect of also
> coordinating the timing characteristics of those streams, and that is
> also something that is tackled, although not in this modest patch set.
> The goal here is not to introduce new selftests yet, but just to lay a
> better foundation for them. These patches are a part of the cleanup work
> I've done while working on selftests for frame preemption. They are
> regression-tested with psfp.sh.

For this series,

Reviewed-by: Kurt Kanzenbach <[email protected]>


Attachments:
signature.asc (877.00 B)

2022-09-26 20:39:07

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next 0/4] Improve tsn_lib selftests for future distributed tasks

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <[email protected]>:

On Sat, 24 Sep 2022 00:00:11 +0300 you wrote:
> Some of the boards I am working with are limited in the number of ports
> that they offer, and as more TSN related selftests are added, it is
> important to be able to distribute the work among multiple boards.
> A large part of implementing that is ensuring network-wide
> synchronization, but also permitting more streams of data to flow
> through the network. There is the more important aspect of also
> coordinating the timing characteristics of those streams, and that is
> also something that is tackled, although not in this modest patch set.
> The goal here is not to introduce new selftests yet, but just to lay a
> better foundation for them. These patches are a part of the cleanup work
> I've done while working on selftests for frame preemption. They are
> regression-tested with psfp.sh.
>
> [...]

Here is the summary with links:
- [net-next,1/4] selftests: net: tsn_lib: don't overwrite isochron receiver extra args with UDS
https://git.kernel.org/netdev/net-next/c/7d45b5fd27b4
- [net-next,2/4] selftests: net: tsn_lib: allow running ptp4l on multiple interfaces
https://git.kernel.org/netdev/net-next/c/7ff9396ee82c
- [net-next,3/4] selftests: net: tsn_lib: allow multiple isochron receivers
https://git.kernel.org/netdev/net-next/c/a7ce95ac837d
- [net-next,4/4] selftests: net: tsn_lib: run phc2sys in automatic mode
https://git.kernel.org/netdev/net-next/c/162d52dfee44

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html