Given that multi-queue NICs are prevalent and the global spinlock issue with single netem instances is a known performance limitation, the setup using mq as a parent for netem is an excellent and highly reasonable pattern for applying netem effects like 100% duplication efficiently on modern Linux systems. Signed-off-by: Cong Wang --- .../tc-testing/tc-tests/infra/qdiscs.json | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json b/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json index 605a478032d8..b4a507bc48a3 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json +++ b/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json @@ -793,5 +793,36 @@ "teardown": [ "$TC qdisc del dev $DUMMY root handle 1: prio" ] + }, + { + "id": "94a8", + "name": "Test MQ with NETEM duplication", + "category": [ + "qdisc", + "mq", + "netem" + ], + "plugins": { + "requires": ["nsPlugin", "scapyPlugin"] + }, + "setup": [ + "$IP link set dev $DEV1 up", + "$TC qdisc add dev $DEV1 root handle 1: mq", + "$TC qdisc add dev $DEV1 parent 1:1 handle 10: netem duplicate 100%", + "$TC qdisc add dev $DEV1 parent 1:2 handle 20: netem duplicate 100%" + ], + "scapy": { + "iface": "$DEV0", + "count": 5, + "packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()" + }, + "cmdUnderTest": "$TC -s qdisc show dev $DEV1", + "expExitCode": "0", + "verifyCmd": "$TC -s qdisc show dev $DEV1 | grep -A 5 'qdisc netem' | grep -E 'Sent [0-9]+ bytes [0-9]+ pkt'", + "matchPattern": "Sent \\d+ bytes (\\d+) pkt", + "matchCount": "2", + "teardown": [ + "$TC qdisc del dev $DEV1 root handle 1: mq" + ] } ] -- 2.34.1