net_sched: skbprio: Remove overly strict queue assertions
Subsystems (4)
cover net_sched: skbprio: Remove overly strict queue assertions
This patchset contains a bug fix and its test case. Please see each patch description for more details.
---
Cong Wang (2):
net_sched: skbprio: Remove overly strict queue assertions
selftests: tc-testing: Add TBF with SKBPRIO queue length corner case
test
net/sched/sch_skbprio.c | 3 -- .../tc-testing/tc-tests/infra/qdiscs.json | 34 ++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 net_sched: skbprio: Remove overly strict queue assertions
In the current implementation, skbprio enqueue/dequeue contains an assertion that fails under certain conditions when SKBPRIO is used as a child qdisc under TBF with specific parameters. The failure occurs because TBF sometimes peeks at packets in the child qdisc without actually dequeuing them when tokens are unavailable.
This peek operation creates a discrepancy between the parent and child qdisc queue length counters. When TBF later receives a high-priority packet, SKBPRIO's queue length may show a different value than what's reflected in its internal priority queue tracking, triggering the assertion.
The fix removes this overly strict assertions in SKBPRIO, they are not necessary at all.
--- net/sched/sch_skbprio.c | 3 --- 1 file changed, 3 deletions(-)
net/sched/sch_skbprio.c +0 -3
@@ -123,8 +123,6 @@ static int skbprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,/* Check to update highest and lowest priorities. */ if (skb_queue_empty (lp_qdisc)) {if (q->lowest_prio == q->highest_prio) { -/* The incoming packet is the only packet in queue. */ -BUG_ON (sch->q.qlen !=1 ); q->lowest_prio = prio; q->highest_prio = prio; }else {
@@ -156,7 +154,6 @@ static struct sk_buff *skbprio_dequeue(struct Qdisc *sch)/* Update highest priority field. */ if (skb_queue_empty (hpq)) {if (q->lowest_prio == q->highest_prio) { -BUG_ON (sch->q.qlen); q->highest_prio =0 ; q->lowest_prio =SKBPRIO_MAX_PRIORITY -1 ; }else {
Signature · 1 line
2.34.1
PATCH 2/2 selftests: tc-testing: Add TBF with SKBPRIO queue length corner case test
In reply to Cong WangAdd a test case to validate the interaction between TBF and SKBPRIO queueing disciplines, specifically targeting queue length accounting corner cases.
This test complements the fix for the queue length accounting issue in the SKBPRIO qdisc. This is still best-effort, as timing and manipulating enqueue and dequeue from user-space is very hard.
--- .../tc-testing/tc-tests/infra/qdiscs.json | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json +33 -1
@@ -126,5 +126,37 @@ "$TC qdisc del dev $DUMMY root handle 1: drr", "$IP addr del 10.10.10.10/24 dev $DUMMY" ] - } + }, + { + "id": "c024", + "name": "Test TBF with SKBPRIO - catch qlen corner cases", + "category": [ + "qdisc", + "tbf", + "skbprio" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link set dev $DUMMY up || true", + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", + "$TC qdisc add dev $DUMMY handle 1: root tbf rate 100bit burst 2000 limit 1000", + "$TC qdisc add dev $DUMMY parent 1: handle 10: skbprio limit 1", + "ping -c 1 -W 0.1 -Q 0x00 -s 1400 -I $DUMMY 10.10.10.1 > /dev/null || true", + "ping -c 1 -W 0.1 -Q 0x1c -s 1400 -I $DUMMY 10.10.10.1 > /dev/null || true", + "ping -c 1 -W 0.1 -Q 0x00 -s 1400 -I $DUMMY 10.10.10.1 > /dev/null || true", + "ping -c 1 -W 0.1 -Q 0x1c -s 1400 -I $DUMMY 10.10.10.1 > /dev/null || true", + "sleep 0.5" + ], + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", + "expExitCode": "0", + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc skbprio'", + "matchPattern": "dropped [1-9][0-9]*", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" + ] + } ]
Signature · 1 line
2.34.1
Quoted 9 lines · Cong Wang
This patchset contains a bug fix and its test case. Please see each patch description for more details.
---
Cong Wang (2):
net_sched: skbprio: Remove overly strict queue assertions
selftests: tc-testing: Add TBF with SKBPRIO queue length corner case
test
Quoted 4 lines
net/sched/sch_skbprio.c | 3 -- .../tc-testing/tc-tests/infra/qdiscs.json | 34 ++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-)
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sat, 29 Mar 2025 15:25:34 -0700 you wrote:
This patchset contains a bug fix and its test case. Please see each patch description for more details.
---
Cong Wang (2):
net_sched: skbprio: Remove overly strict queue assertions
selftests: tc-testing: Add TBF with SKBPRIO queue length corner case
test[...]
Here is the summary with links:
- [net,1/2] net_sched: skbprio: Remove overly strict queue assertions
https://git.kernel.org/netdev/net/c/ce8fe975fd99 - [net,2/2] selftests: tc-testing: Add TBF with SKBPRIO queue length corner case test https://git.kernel.org/netdev/net/c/076c70098893
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html