Commit efa6eb7d authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski
Browse files

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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20250426144859.3128352-3-vladimir.oltean@nxp.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 426d487b
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -272,12 +272,7 @@ run_test()
		"" \
		"${isochron_dat}"

	# Count all received packets by looking at the non-zero RX timestamps
	received=$(isochron report \
		--input-file "${isochron_dat}" \
		--printf-format "%u\n" --printf-args "R" | \
		grep -w -v '0' | wc -l)

	received=$(isochron_report_num_received "${isochron_dat}")
	if [ "${received}" = "${expected}" ]; then
		RET=0
	else
+11 −0
Original line number Diff line number Diff line
@@ -247,3 +247,14 @@ isochron_do()

	cpufreq_restore ${ISOCHRON_CPU}
}

isochron_report_num_received()
{
	local isochron_dat=$1; shift

	# Count all received packets by looking at the non-zero RX timestamps
	isochron report \
		--input-file "${isochron_dat}" \
		--printf-format "%u\n" --printf-args "R" | \
		grep -w -v '0' | wc -l
}