Skip to content

Commit efa6eb7

Browse files
vladimirolteankuba-moo
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 426d487 commit efa6eb7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tools/testing/selftests/drivers/net/ocelot/psfp.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,7 @@ run_test()
272272
"" \
273273
"${isochron_dat}"
274274

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}")
281276
if [ "${received}" = "${expected}" ]; then
282277
RET=0
283278
else

tools/testing/selftests/net/forwarding/tsn_lib.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,14 @@ isochron_do()
247247

248248
cpufreq_restore ${ISOCHRON_CPU}
249249
}
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+
}

0 commit comments

Comments
 (0)