Skip to content

Commit

Permalink
selftests/net: calibrate txtimestamp
Browse files Browse the repository at this point in the history
The test sends packets and compares enqueue, transmit and Ack
timestamps with expected values. It installs netem delays to increase
latency between these points.

The test proves flaky in virtual environment (vng). Increase the
delays to reduce variance. Scale measurement tolerance accordingly.

Time sensitive tests are difficult to calibrate. Increasing delays 10x
also increases runtime 10x, for one. And it may still prove flaky at
some rate.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240127023212.3746239-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Willem de Bruijn authored and Jakub Kicinski committed Jan 31, 2024
1 parent 84fc240 commit 5264ab6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tools/testing/selftests/net/txtimestamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ set -e

setup() {
# set 1ms delay on lo egress
tc qdisc add dev lo root netem delay 1ms
tc qdisc add dev lo root netem delay 10ms

# set 2ms delay on ifb0 egress
modprobe ifb
ip link add ifb_netem0 type ifb
ip link set dev ifb_netem0 up
tc qdisc add dev ifb_netem0 root netem delay 2ms
tc qdisc add dev ifb_netem0 root netem delay 20ms

# redirect lo ingress through ifb0 egress
tc qdisc add dev lo handle ffff: ingress
Expand All @@ -24,9 +24,11 @@ setup() {
}

run_test_v4v6() {
# SND will be delayed 1000us
# ACK will be delayed 6000us: 1 + 2 ms round-trip
local -r args="$@ -v 1000 -V 6000"
# SND will be delayed 10ms
# ACK will be delayed 60ms: 10 + 20 ms round-trip
# allow +/- tolerance of 8ms
# wait for ACK to be queued
local -r args="$@ -v 10000 -V 60000 -t 8000 -S 80000"

./txtimestamp ${args} -4 -L 127.0.0.1
./txtimestamp ${args} -6 -L ::1
Expand Down

0 comments on commit 5264ab6

Please sign in to comment.