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

selftests: net: tsn_lib: create common helper for counting received packets

This snippet will be necessary for a future isochron-based test, so
provide a simpler high-level interface for counting the received
packets.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20250426144859.3128352-3-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
efa6eb7d 426d487b

+12 -6
+1 -6
tools/testing/selftests/drivers/net/ocelot/psfp.sh
··· 272 272 "" \ 273 273 "${isochron_dat}" 274 274 275 - # Count all received packets by looking at the non-zero RX timestamps 276 - received=$(isochron report \ 277 - --input-file "${isochron_dat}" \ 278 - --printf-format "%u\n" --printf-args "R" | \ 279 - grep -w -v '0' | wc -l) 280 - 275 + received=$(isochron_report_num_received "${isochron_dat}") 281 276 if [ "${received}" = "${expected}" ]; then 282 277 RET=0 283 278 else
+11
tools/testing/selftests/net/forwarding/tsn_lib.sh
··· 247 247 248 248 cpufreq_restore ${ISOCHRON_CPU} 249 249 } 250 + 251 + isochron_report_num_received() 252 + { 253 + local isochron_dat=$1; shift 254 + 255 + # Count all received packets by looking at the non-zero RX timestamps 256 + isochron report \ 257 + --input-file "${isochron_dat}" \ 258 + --printf-format "%u\n" --printf-args "R" | \ 259 + grep -w -v '0' | wc -l 260 + }