|WARNING| sched: fix queue stats read for mixed subports
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Wed Nov 25 12:58:15 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173144
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-25
**lib/sched/rte_sched.c / app/test/test_sched.c**
**Warning: the fix leaves most queues of the larger subport unreadable, and the commit message overstates it.**
The new test fixes the queue ID layout:
- `n_pipes_per_subport = 8`, so the subport shift is 7 bits (128 queue slots per subport).
- Subport 1 queues therefore occupy IDs 128..255.
The test also asserts that the existing total-count check is kept:
```
/* Queue ID at or above the total queue count is rejected */
err = rte_sched_queue_read_stats(port, 144, &queue_stats, &qlen);
TEST_ASSERT_FAIL(err, "Queue ID 144 accepted, err=%d\n", err);
```
As a result, every queue of subport 1 pipes 1..7 (IDs 144..255) is still rejected. Yet `rte_sched_port_pkt_write(port, m, 1, 7, tc, q, ...)` produces exactly those IDs.
So the commit message claim "Queue IDs produced by rte_sched_port_pkt_write() are valid before and after the change" is not true for this layout. Stats for 7 of the 8 configured pipes on subport 1 cannot be read.
Suggested fix: now that the decoded index is validated per subport, replace the summed-total check with two checks:
- `subport_id >= port->n_subports_per_port` returns -EINVAL.
- The new `subport_qindex >= rte_sched_subport_pipe_queues(s)` check stays as added.
Then extend the test to read a queue on subport 1 pipe 7 (for example ID 255).
**Warning: the test comment is wrong.**
```
/* First and last queue of the large subport 1 read cleanly */
...
err = rte_sched_queue_read_stats(port, 143, &queue_stats, &qlen);
```
ID 143 is the last queue of pipe 0 on subport 1, not the last queue of the subport (that would be 255). Fix the comment, or test the real last queue once the check above is fixed.
**Warning: the test leaks the mempool and the dequeued mbuf.**
`mp = create_mempool();` is never freed, and `mbufs[0]` returned by `rte_sched_port_dequeue()` is never freed before return. On any `TEST_ASSERT_*` failure after `rte_sched_port_config()`, `port` is also leaked. Since this runs alongside other tests in the same `dpdk-test` process, free the mbuf after the stats check. Use a cleanup label to free `port` and `mp` on both the success and failure paths.
**Info:** The new test is registered as a separate autotest rather than as a case in a `unit_test_suite_runner` suite. Consider converting `test_sched.c` to a suite with `TEST_CASE(test_sched)` and `TEST_CASE(test_sched_hetero_subports)`. That would also remove the duplicated Windows stub.
Review-Result: WARNING
More information about the test-report
mailing list