selftests/net: SO_TXTIME with ETF and FQ
Subsystems (3)
PATCH 1/1 selftests/net: SO_TXTIME with ETF and FQ
The SO_TXTIME API enables packet tranmission with delayed delivery. This is currently supported by the ETF and FQ packet schedulers.
Evaluate the interface with both schedulers. Install the scheduler and send a variety of packets streams: without delay, with one delayed packet, with multiple ordered delays and with reordering. Verify that packets are released by the scheduler in expected order.
The ETF qdisc requires a timestamp in the future on every packet. It needs a delay on the qdisc else the packet is dropped on dequeue for having a delivery time in the past. The test value is experimentally derived. ETF requires clock_id CLOCK_TAI. It checks this base and drops for non-conformance.
The FQ qdisc expects clock_id CLOCK_MONOTONIC, the base used by TCP as of commit fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC"). Within a flow there is an expecation of ordered delivery, as shown by delivery times of test 4. The FQ qdisc does not require all packets to have timestamps and does not drop for non-conformance.
The large (msec) delays are chosen to avoid flakiness.
Output:
SO_TXTIME ipv6 clock monolithic
payload:a delay:33 expected:0 (us)
SO_TXTIME ipv4 clock monolithic
payload:a delay:44 expected:0 (us)
SO_TXTIME ipv6 clock monolithic
payload:a delay:10049 expected:10000 (us)
SO_TXTIME ipv4 clock monolithic
payload:a delay:10105 expected:10000 (us)
[.. etc ..]
OK. All tests passed
--- tools/testing/selftests/net/.gitignore | 1 + tools/testing/selftests/net/Makefile | 3 +- tools/testing/selftests/net/config | 2 + tools/testing/selftests/net/so_txtime.c | 297 +++++++++++++++++++++++ tools/testing/selftests/net/so_txtime.sh | 31 +++ 5 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/net/so_txtime.c create mode 100755 tools/testing/selftests/net/so_txtime.sh
tools/testing/selftests/net/.gitignore +1 -0
@@ -17,3 +17,4 @@ tcp_inq tls txring_overwrite ip_defrag +so_txtime
tools/testing/selftests/net/Makefile +2 -1
@@ -9,12 +9,13 @@ TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \ TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh TEST_PROGS += udpgro_bench.sh udpgro.sh test_vxlan_under_vrf.sh reuseport_addr_any.sh -TEST_PROGS += test_vxlan_fdb_changelink.sh +TEST_PROGS += test_vxlan_fdb_changelink.sh so_txtime.sh TEST_PROGS_EXTENDED := in_netns.sh TEST_GEN_FILES = socket TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx ip_defrag +TEST_GEN_FILES += so_txtime TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
tools/testing/selftests/net/config +2 -0
@@ -25,3 +25,5 @@ CONFIG_NF_TABLES_IPV6=y CONFIG_NF_TABLES_IPV4=y CONFIG_NFT_CHAIN_NAT_IPV6=m CONFIG_NFT_CHAIN_NAT_IPV4=m +CONFIG_NET_SCH_FQ=m +CONFIG_NET_SCH_ETF=m
tools/testing/selftests/net/so_txtime.c new file +297 -0
297 lines not on this page · raw message
tools/testing/selftests/net/so_txtime.sh new file +31 -0
@@ -0,0 +1,31 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Regression tests for the SO_TXTIME interface + +# Run in network namespace +if [[ $# -eq 0 ]]; then + ./in_netns.sh $0 __subprocess + exit $? +fi + +set -e + +tc qdisc add dev lo root fq +./so_txtime -4 -6 -c mono a,-1 a,-1 +./so_txtime -4 -6 -c mono a,0 a,0 +./so_txtime -4 -6 -c mono a,10 a,10 +./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20 +./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20 + +if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 200000; then + ! ./so_txtime -4 -6 -c tai a,-1 a,-1 + ! ./so_txtime -4 -6 -c tai a,0 a,0 + ./so_txtime -4 -6 -c tai a,10 a,10 + ./so_txtime -4 -6 -c tai a,10,b,20 a,10,b,20 + ./so_txtime -4 -6 -c tai a,20,b,10 b,10,a,20 +else + echo "tc ($(tc -V)) does not support qdisc etf. skipping" +fi + +echo OK. All tests passed
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
Quoted 20 lines · Willem de Bruijn
The
SO_TXTIMEAPI enables packet tranmission with delayed delivery. This is currently supported by the ETF and FQ packet schedulers.Evaluate the interface with both schedulers. Install the scheduler and send a variety of packets streams: without delay, with one delayed packet, with multiple ordered delays and with reordering. Verify that packets are released by the scheduler in expected order.
The ETF qdisc requires a timestamp in the future on every packet. It needs a delay on the qdisc else the packet is dropped on dequeue for having a delivery time in the past. The test value is experimentally derived. ETF requires
clock_idCLOCK_TAI. It checks this base and drops for non-conformance.The FQ qdisc expects
clock_idCLOCK_MONOTONIC, the base used by TCP as of commitfb420d5d91c1("tcp/fq: move back toCLOCK_MONOTONIC"). Within a flow there is an expecation of ordered delivery, as shown by delivery times of test 4. The FQ qdisc does not require all packets to have timestamps and does not drop for non-conformance.
Quoted 5 lines
The large (msec) delays are chosen to avoid flakiness.
Output:
SO_TXTIMEipv6 clock monolithic
s/monolithic/monotonic/
Quoted 10 lines
payload:a delay:33 expected:0 (us)
SO_TXTIMEipv4 clock monolithic
payload:a delay:44 expected:0 (us)
SO_TXTIMEipv6 clock monolithic
payload:a delay:10049 expected:10000 (us)
SO_TXTIMEipv4 clock monolithic
payload:a delay:10105 expected:10000 (us)
Thanks for the test Willem.
Quoted 24 lines · Eric Dumazet
Quoted 20 lines · Willem de Bruijn
The
SO_TXTIMEAPI enables packet tranmission with delayed delivery. This is currently supported by the ETF and FQ packet schedulers.Evaluate the interface with both schedulers. Install the scheduler and send a variety of packets streams: without delay, with one delayed packet, with multiple ordered delays and with reordering. Verify that packets are released by the scheduler in expected order.
The ETF qdisc requires a timestamp in the future on every packet. It needs a delay on the qdisc else the packet is dropped on dequeue for having a delivery time in the past. The test value is experimentally derived. ETF requires
clock_idCLOCK_TAI. It checks this base and drops for non-conformance.The FQ qdisc expects
clock_idCLOCK_MONOTONIC, the base used by TCP as of commitfb420d5d91c1("tcp/fq: move back toCLOCK_MONOTONIC"). Within a flow there is an expecation of ordered delivery, as shown by delivery times of test 4. The FQ qdisc does not require all packets to have timestamps and does not drop for non-conformance.
Quoted 7 lines
Quoted 5 lines
The large (msec) delays are chosen to avoid flakiness.
Output:
SO_TXTIMEipv6 clock monolithics/monolithic/monotonic/
Oops. That's actually fixed in the latest version, just not in the commit message. I'll send a v2 just to update that. Thanks Eric.
Having some trouble with git send-email and gmail today, hence the email from my google.com account, too.
Quoted 17 lines
Quoted 11 lines
payload:a delay:33 expected:0 (us)
SO_TXTIMEipv4 clock monolithic
payload:a delay:44 expected:0 (us)
SO_TXTIMEipv6 clock monolithic
payload:a delay:10049 expected:10000 (us)
SO_TXTIMEipv4 clock monolithic
payload:a delay:10105 expected:10000 (us)Thanks for the test Willem.
Acked-by Eric Dumazet <[email protected]>