Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'improve-tsn_lib-selftests-for-future-distributed-tasks'

Vladimir Oltean says:

====================
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.
====================

Link: https://lore.kernel.org/r/20220923210016.3406301-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+34 -20
+1 -1
tools/testing/selftests/drivers/net/ocelot/psfp.sh
··· 181 181 182 182 # Set up swp1 as a master PHC for h1, synchronized to the local 183 183 # CLOCK_REALTIME. 184 - phc2sys_start ${swp1} ${UDS_ADDRESS_SWP1} 184 + phc2sys_start ${UDS_ADDRESS_SWP1} 185 185 186 186 # Assumption true for LS1028A: h1 and h2 use the same PHC. So by 187 187 # synchronizing h1 to swp1 via PTP, h2 is also implicitly synchronized
+33 -19
tools/testing/selftests/net/forwarding/tsn_lib.sh
··· 22 22 23 23 phc2sys_start() 24 24 { 25 - local if_name=$1 26 - local uds_address=$2 25 + local uds_address=$1 27 26 local extra_args="" 28 27 29 28 if ! [ -z "${uds_address}" ]; then ··· 32 33 phc2sys_log="$(mktemp)" 33 34 34 35 chrt -f 10 phc2sys -m \ 35 - -c ${if_name} \ 36 - -s CLOCK_REALTIME \ 37 - -O ${UTC_TAI_OFFSET} \ 36 + -a -rr \ 38 37 --step_threshold 0.00002 \ 39 38 --first_step_threshold 0.00002 \ 40 39 ${extra_args} \ ··· 50 53 rm "${phc2sys_log}" 2> /dev/null 51 54 } 52 55 56 + # Replace space separators from interface list with underscores 57 + if_names_to_label() 58 + { 59 + local if_name_list="$1" 60 + 61 + echo "${if_name_list/ /_}" 62 + } 63 + 53 64 ptp4l_start() 54 65 { 55 - local if_name=$1 66 + local if_names="$1" 56 67 local slave_only=$2 57 68 local uds_address=$3 58 - local log="ptp4l_log_${if_name}" 59 - local pid="ptp4l_pid_${if_name}" 69 + local log="ptp4l_log_$(if_names_to_label ${if_names})" 70 + local pid="ptp4l_pid_$(if_names_to_label ${if_names})" 60 71 local extra_args="" 72 + 73 + for if_name in ${if_names}; do 74 + extra_args="${extra_args} -i ${if_name}" 75 + done 61 76 62 77 if [ "${slave_only}" = true ]; then 63 78 extra_args="${extra_args} -s" ··· 80 71 declare -g "${log}=$(mktemp)" 81 72 82 73 chrt -f 10 ptp4l -m -2 -P \ 83 - -i ${if_name} \ 84 74 --step_threshold 0.00002 \ 85 75 --first_step_threshold 0.00002 \ 86 76 --tx_timestamp_timeout 100 \ ··· 88 80 > "${!log}" 2>&1 & 89 81 declare -g "${pid}=$!" 90 82 91 - echo "ptp4l for interface ${if_name} logs to ${!log} and has pid ${!pid}" 83 + echo "ptp4l for interfaces ${if_names} logs to ${!log} and has pid ${!pid}" 92 84 93 85 sleep 1 94 86 } 95 87 96 88 ptp4l_stop() 97 89 { 98 - local if_name=$1 99 - local log="ptp4l_log_${if_name}" 100 - local pid="ptp4l_pid_${if_name}" 90 + local if_names="$1" 91 + local log="ptp4l_log_$(if_names_to_label ${if_names})" 92 + local pid="ptp4l_pid_$(if_names_to_label ${if_names})" 101 93 102 94 { kill ${!pid} && wait ${!pid}; } 2> /dev/null 103 95 rm "${!log}" 2> /dev/null ··· 144 136 { 145 137 local if_name=$1 146 138 local uds=$2 147 - local extra_args=$3 139 + local stats_port=$3 140 + local extra_args=$4 141 + local pid="isochron_pid_${stats_port}" 148 142 149 143 if ! [ -z "${uds}" ]; then 150 - extra_args="--unix-domain-socket ${uds}" 144 + extra_args="${extra_args} --unix-domain-socket ${uds}" 151 145 fi 152 146 153 147 isochron rcv \ ··· 157 147 --sched-priority 98 \ 158 148 --sched-fifo \ 159 149 --utc-tai-offset ${UTC_TAI_OFFSET} \ 150 + --stats-port ${stats_port} \ 160 151 --quiet \ 161 152 ${extra_args} & \ 162 - isochron_pid=$! 153 + declare -g "${pid}=$!" 163 154 164 155 sleep 1 165 156 } 166 157 167 158 isochron_recv_stop() 168 159 { 169 - { kill ${isochron_pid} && wait ${isochron_pid}; } 2> /dev/null 160 + local stats_port=$1 161 + local pid="isochron_pid_${stats_port}" 162 + 163 + { kill ${!pid} && wait ${!pid}; } 2> /dev/null 170 164 } 171 165 172 166 isochron_do() ··· 222 208 223 209 cpufreq_max ${ISOCHRON_CPU} 224 210 225 - isochron_recv_start "${h2}" "${receiver_uds}" "${receiver_extra_args}" 211 + isochron_recv_start "${h2}" "${receiver_uds}" 5000 "${receiver_extra_args}" 226 212 227 213 isochron send \ 228 214 --interface ${sender_if_name} \ ··· 243 229 ${extra_args} \ 244 230 --quiet 245 231 246 - isochron_recv_stop 232 + isochron_recv_stop 5000 247 233 248 234 cpufreq_restore ${ISOCHRON_CPU} 249 235 }