Commit 8c06cbdc authored by William Liu's avatar William Liu Committed by Jakub Kicinski
Browse files

selftests/tc-testing: Check backlog stats in gso_skb case



Add tests to ensure proper backlog accounting in hhf, codel, pie, fq,
fq_pie, and fq_codel qdiscs. We check for the bug pattern originally
found in fq, fq_pie, and fq_codel, which was an underflow in the tbf
parent backlog stats upon child qdisc removal.

Signed-off-by: default avatarWilliam Liu <will@willsroot.io>
Reviewed-by: default avatarSavino Dicanosa <savy@syst3mfailure.io>
Link: https://patch.msgid.link/20250812235808.45281-1-will@willsroot.io


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 52bf2726
Loading
Loading
Loading
Loading
+198 −0
Original line number Diff line number Diff line
@@ -185,6 +185,204 @@
            "$IP addr del 10.10.10.10/24 dev $DUMMY || true"
        ]
    },
    {
        "id": "34c0",
        "name": "Test TBF with HHF Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "hhf"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 hhf limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 hhf limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "fd68",
        "name": "Test TBF with CODEL Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "codel"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 codel limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 codel limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "514e",
        "name": "Test TBF with PIE Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "pie"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 pie limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 pie limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "6c97",
        "name": "Test TBF with FQ Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "fq"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "5d0b",
        "name": "Test TBF with FQ_CODEL Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "fq_codel"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_codel limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_codel limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "21c3",
        "name": "Test TBF with FQ_PIE Backlog Accounting in gso_skb case against underflow",
        "category": [
            "qdisc",
            "tbf",
            "fq_pie"
        ],
        "plugins": {
            "requires": [
                "nsPlugin"
            ]
        },
        "setup": [
            "$IP link set dev $DUMMY up || true",
            "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
            "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
            "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_pie limit 1000",
            [
                "ping -I $DUMMY -c2 10.10.11.11",
                1
            ],
            "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_pie limit 1"
        ],
        "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
        "expExitCode": "0",
        "verifyCmd": "$TC -s qdisc show dev $DUMMY",
        "matchPattern": "backlog 0b 0p",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY handle 1: root"
        ]
    },
    {
        "id": "a4bb",
        "name": "Test FQ_CODEL with HTB parent - force packet drop with empty queue",