linux-loongson/tools/testing/selftests/tc-testing/tc-tests/qdiscs/netem.json
William Liu ecdec65ec7 selftests/tc-testing: Add tests for restrictions on netem duplication
Ensure that a duplicating netem cannot exist in a tree with other netems
in both qdisc addition and change. This is meant to prevent the soft
lockup and OOM loop scenario discussed in [1]. Also adjust a HFSC's
re-entrancy test case with netem for this new restriction - KASAN
still triggers upon its failure.

[1] https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/

Signed-off-by: William Liu <will@willsroot.io>
Reviewed-by: Savino Dicanosa <savy@syst3mfailure.io>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20250708164219.875521-1-will@willsroot.io
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-11 15:50:21 -07:00

422 lines
13 KiB
JSON

[
{
"id": "cb28",
"name": "Create NETEM with default setting",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ limit",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "a089",
"name": "Create NETEM with limit flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem limit 200",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ limit 200",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "3449",
"name": "Create NETEM with delay time",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "3782",
"name": "Create NETEM with distribution and corrupt flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal corrupt 1%",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms 10ms corrupt 1%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "2b82",
"name": "Create NETEM with distribution and duplicate flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal duplicate 1%",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms 10ms duplicate 1%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "a932",
"name": "Create NETEM with distribution and loss flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution pareto loss 1%",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms 10ms loss 1%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "e01a",
"name": "Create NETEM with distribution and loss state flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution paretonormal loss state 1",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms 10ms loss state p13 1% p31 99% p32 0% p23 100% p14 0%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "ba29",
"name": "Create NETEM with loss gemodel flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem loss gemodel 1%",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*loss gemodel p 1%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "0492",
"name": "Create NETEM with reorder flag",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms reorder 2% gap 100",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*reorder 2%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "7862",
"name": "Create NETEM with rate limit",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem rate 20000",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*rate 20Kbit",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "7235",
"name": "Create NETEM with multiple slot rate",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem slot 10 200 packets 2000 bytes 9000",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*slot 10ns 200ns packets 2000 bytes 9000",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "5439",
"name": "Create NETEM with multiple slot setting",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem slot distribution pareto 1ms 0.1ms",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*slot distribution 1ms 100us",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "5029",
"name": "Change NETEM with loss state",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal loss 1%"
],
"cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal loss 2%",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*loss 2%",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "3785",
"name": "Replace NETEM with delay time",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal loss 1%"
],
"cmdUnderTest": "$TC qdisc replace dev $DUMMY handle 1: root netem delay 200ms 10ms",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 200ms 10ms",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "4502",
"name": "Delete NETEM with handle",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY handle 1: root netem delay 100ms 10ms distribution normal"
],
"cmdUnderTest": "$TC qdisc del dev $DUMMY handle 1: root",
"expExitCode": "0",
"verifyCmd": "$TC qdisc show dev $DUMMY",
"matchPattern": "qdisc netem 1: root refcnt [0-9]+ .*delay 100ms 10ms",
"matchCount": "0",
"teardown": [
]
},
{
"id": "0785",
"name": "Show NETEM class",
"category": [
"qdisc",
"netem"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root netem",
"expExitCode": "0",
"verifyCmd": "$TC class show dev $DUMMY",
"matchPattern": "class netem 1:",
"matchCount": "0",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1: root"
]
},
{
"id": "d34d",
"name": "NETEM test qdisc duplication restriction in qdisc tree in netem_change root",
"category": ["qdisc", "netem"],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY root handle 1: netem limit 1",
"$TC qdisc add dev $DUMMY parent 1: handle 2: netem limit 1"
],
"cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: netem duplicate 50%",
"expExitCode": "2",
"verifyCmd": "$TC -s qdisc show dev $DUMMY",
"matchPattern": "qdisc netem",
"matchCount": "2",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1:0 root"
]
},
{
"id": "b33f",
"name": "NETEM test qdisc duplication restriction in qdisc tree in netem_change non-root",
"category": ["qdisc", "netem"],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY root handle 1: netem limit 1",
"$TC qdisc add dev $DUMMY parent 1: handle 2: netem limit 1"
],
"cmdUnderTest": "$TC qdisc change dev $DUMMY handle 2: netem duplicate 50%",
"expExitCode": "2",
"verifyCmd": "$TC -s qdisc show dev $DUMMY",
"matchPattern": "qdisc netem",
"matchCount": "2",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1:0 root"
]
},
{
"id": "cafe",
"name": "NETEM test qdisc duplication restriction in qdisc tree",
"category": ["qdisc", "netem"],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY root handle 1: netem limit 1 duplicate 100%"
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent 1: handle 2: netem duplicate 100%",
"expExitCode": "2",
"verifyCmd": "$TC -s qdisc show dev $DUMMY",
"matchPattern": "qdisc netem",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1:0 root"
]
},
{
"id": "1337",
"name": "NETEM test qdisc duplication restriction in qdisc tree across branches",
"category": ["qdisc", "netem"],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DUMMY parent root handle 1:0 hfsc",
"$TC class add dev $DUMMY parent 1:0 classid 1:1 hfsc rt m2 10Mbit",
"$TC qdisc add dev $DUMMY parent 1:1 handle 2:0 netem",
"$TC class add dev $DUMMY parent 1:0 classid 1:2 hfsc rt m2 10Mbit"
],
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent 1:2 handle 3:0 netem duplicate 100%",
"expExitCode": "2",
"verifyCmd": "$TC -s qdisc show dev $DUMMY",
"matchPattern": "qdisc netem",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY handle 1:0 root"
]
}
]