selftests: net: verify fq per-band packet limit
Subsystems (3)
PATCH 1/1 selftests: net: verify fq per-band packet limit
From: Willem de Bruijn <[email protected]>
Commit 29f834aa326e ("net_sched: sch_fq: add 3 bands and WRR scheduling") introduces multiple traffic bands, and per-band maximum packet count.
Per-band limits ensures that packets in one class cannot fill the entire qdisc and so cause DoS to the traffic in the other classes.
Verify this behavior:
1. set the limit to 10 per band
2. send 20 pkts on band A: verify that 10 are queued, 10 dropped
3. send 20 pkts on band A: verify that 0 are queued, 20 dropped
4. send 20 pkts on band B: verify that 10 are queued, 10 dropped
Packets must remain queued for a period to trigger this behavior. Use SO_TXTIME to store packets for 100 msec.
The test reuses existing upstream test infra. The script is a fork of cmsg_time.sh. The scripts call cmsg_sender.
The test extends cmsg_sender with two arguments:
* '-P' SO_PRIORITY
There is a subtle difference between IPv4 and IPv6 stack behavior:
PF_INET/IP_TOS sets IP header bits and sk_priority
PF_INET6/IPV6_TCLASS sets IP header bits BUT NOT sk_priority
* '-n' num pkts
Send multiple packets in quick succession.
I first attempted a for loop in the script, but this is too slow in virtualized environments, causing flakiness as the 100ms timeout is reached and packets are dequeued.
Also do not wait for timestamps to be queued unless timestamps are requested.
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/cmsg_sender.c | 50 ++++++++++------ .../testing/selftests/net/fq_band_pktlimit.sh | 57 +++++++++++++++++++ 3 files changed, 91 insertions(+), 17 deletions(-) create mode 100755 tools/testing/selftests/net/fq_band_pktlimit.sh
tools/testing/selftests/net/Makefile +1 -0
@@ -91,6 +91,7 @@ TEST_PROGS += test_bridge_neigh_suppress.sh TEST_PROGS += test_vxlan_nolocalbypass.sh TEST_PROGS += test_bridge_backup_port.sh TEST_PROGS += fdb_flush.sh +TEST_PROGS += fq_band_pktlimit.sh TEST_FILES := settings
tools/testing/selftests/net/cmsg_sender.c +33 -17
106 lines not on this page · raw message
tools/testing/selftests/net/fq_band_pktlimit.sh new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Quoted 34 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
Commit
29f834aa326e("net_sched:sch_fq: add 3 bands and WRR scheduling") introduces multiple traffic bands, and per-band maximum packet count.Per-band limits ensures that packets in one class cannot fill the entire qdisc and so cause DoS to the traffic in the other classes.
Verify this behavior:
1. set the limit to 10 per band
2. send 20 pkts on band A: verify that 10 are queued, 10 dropped
3. send 20 pkts on band A: verify that 0 are queued, 20 dropped
4. send 20 pkts on band B: verify that 10 are queued, 10 droppedPackets must remain queued for a period to trigger this behavior. Use
SO_TXTIMEto store packets for 100 msec.The test reuses existing upstream test infra. The script is a fork of
cmsg_time.sh. The scripts callcmsg_sender.The test extends
cmsg_senderwith two arguments:* '-P'
SO_PRIORITY
There is a subtle difference between IPv4 and IPv6 stack behavior:
PF_INET/IP_TOS sets IP header bits andsk_priority
PF_INET6/IPV6_TCLASS sets IP header bits BUT NOTsk_priority* '-n' num pkts
Send multiple packets in quick succession.
I first attempted a for loop in the script, but this is too slow in virtualized environments, causing flakiness as the 100ms timeout is reached and packets are dequeued.
Quoted 4 lines
Also do not wait for timestamps to be queued unless timestamps are requested.
Signed-off-by Willem de Bruijn <[email protected]>
Thanks Willem,
this looks nice and clean to me.
Quoted 17 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
Commit
29f834aa326e("net_sched:sch_fq: add 3 bands and WRR scheduling") introduces multiple traffic bands, and per-band maximum packet count.Per-band limits ensures that packets in one class cannot fill the entire qdisc and so cause DoS to the traffic in the other classes.
Verify this behavior:
1. set the limit to 10 per band
2. send 20 pkts on band A: verify that 10 are queued, 10 dropped
3. send 20 pkts on band A: verify that 0 are queued, 20 dropped
4. send 20 pkts on band B: verify that 10 are queued, 10 dropped
...
Quoted 2 lines
Signed-off-by Willem de Bruijn <[email protected]>---
Thanks Willem for upstreaming this test.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 16 Nov 2023 15:34:43 -0500 you wrote:
From: Willem de Bruijn <[email protected]>
Commit
29f834aa326e("net_sched:sch_fq: add 3 bands and WRR scheduling") introduces multiple traffic bands, and per-band maximum packet count.Per-band limits ensures that packets in one class cannot fill the entire qdisc and so cause DoS to the traffic in the other classes.
[...]
Here is the summary with links:
- [net-next] selftests: net: verify fq per-band packet limit
https://git.kernel.org/netdev/net-next/c/a0bc96c0cd6e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html