Merge branch 'net_sched-fix-hfsc-qlen-backlog-accounting-bug-and-add-selftest'

Cong Wang says:

====================
net_sched: Fix HFSC qlen/backlog accounting bug and add selftest

This series addresses a long-standing bug in the HFSC qdisc where queue length
and backlog accounting could become inconsistent if a packet is dropped during
a peek-induced dequeue operation, and adds a corresponding selftest to tc-testing.
====================

Link: https://patch.msgid.link/20250518222038.58538-1-xiyou.wangcong@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Paolo Abeni
2025-05-22 11:16:53 +02:00
2 changed files with 30 additions and 3 deletions
+3 -3
View File
@@ -1569,6 +1569,9 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
return err;
}
sch->qstats.backlog += len;
sch->q.qlen++;
if (first && !cl->cl_nactive) {
if (cl->cl_flags & HFSC_RSC)
init_ed(cl, len);
@@ -1584,9 +1587,6 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
}
sch->qstats.backlog += len;
sch->q.qlen++;
return NET_XMIT_SUCCESS;
}
@@ -573,5 +573,32 @@
"teardown": [
"$TC qdisc del dev $DEV1 handle 1: root"
]
},
{
"id": "831d",
"name": "Test HFSC qlen accounting with DRR/NETEM/BLACKHOLE chain",
"category": ["qdisc", "hfsc", "drr", "netem", "blackhole"],
"plugins": { "requires": ["nsPlugin", "scapyPlugin"] },
"setup": [
"$IP link set dev $DEV1 up || true",
"$TC qdisc add dev $DEV1 root handle 1: drr",
"$TC filter add dev $DEV1 parent 1: basic classid 1:1",
"$TC class add dev $DEV1 parent 1: classid 1:1 drr",
"$TC qdisc add dev $DEV1 parent 1:1 handle 2: hfsc def 1",
"$TC class add dev $DEV1 parent 2: classid 2:1 hfsc rt m1 8 d 1 m2 0",
"$TC qdisc add dev $DEV1 parent 2:1 handle 3: netem",
"$TC qdisc add dev $DEV1 parent 3:1 handle 4: blackhole"
],
"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",
"matchPattern": "qdisc hfsc",
"matchCount": "1",
"teardown": ["$TC qdisc del dev $DEV1 root handle 1: drr"]
}
]