Commit a7ce95ac authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7ff9396e
...@@ -147,7 +147,9 @@ isochron_recv_start() ...@@ -147,7 +147,9 @@ isochron_recv_start()
{ {
local if_name=$1 local if_name=$1
local uds=$2 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 if ! [ -z "${uds}" ]; then
extra_args="${extra_args} --unix-domain-socket ${uds}" extra_args="${extra_args} --unix-domain-socket ${uds}"
...@@ -158,16 +160,20 @@ isochron_recv_start() ...@@ -158,16 +160,20 @@ isochron_recv_start()
--sched-priority 98 \ --sched-priority 98 \
--sched-fifo \ --sched-fifo \
--utc-tai-offset ${UTC_TAI_OFFSET} \ --utc-tai-offset ${UTC_TAI_OFFSET} \
--stats-port ${stats_port} \
--quiet \ --quiet \
${extra_args} & \ ${extra_args} & \
isochron_pid=$! declare -g "${pid}=$!"
sleep 1 sleep 1
} }
isochron_recv_stop() 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() isochron_do()
...@@ -219,7 +225,7 @@ isochron_do() ...@@ -219,7 +225,7 @@ isochron_do()
cpufreq_max ${ISOCHRON_CPU} 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 \ isochron send \
--interface ${sender_if_name} \ --interface ${sender_if_name} \
...@@ -240,7 +246,7 @@ isochron_do() ...@@ -240,7 +246,7 @@ isochron_do()
${extra_args} \ ${extra_args} \
--quiet --quiet
isochron_recv_stop isochron_recv_stop 5000
cpufreq_restore ${ISOCHRON_CPU} cpufreq_restore ${ISOCHRON_CPU}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment