|WARNING| sched: fix queue stats read for mixed subports
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Wed Nov 25 12:26:04 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
**Warnings**
1. **Mempool, port and dequeued mbuf leak in `test_sched_hetero_subports()`.**
The mempool from `mp = create_mempool();` is never freed. The success path only calls `rte_sched_port_free(port);` and never `rte_mempool_free(mp)`. The leaked pool stays allocated for the rest of the test process, which can affect later tests run in the same `dpdk-test` invocation.
The mbuf returned by `err = rte_sched_port_dequeue(port, mbufs, 1);` is also never freed.
In addition, every `TEST_ASSERT_*` after `rte_sched_port_config()` returns early without freeing `port` or `mp`.
Suggested fix: free the mbuf after the stats check, and use a cleanup label so both success and failure paths release resources:
```c
rte_pktmbuf_free(mbufs[0]);
ret = TEST_SUCCESS;
out:
rte_sched_port_free(port);
rte_mempool_free(mp);
return ret;
```
Replace the `TEST_ASSERT_*` macros with explicit checks that set `ret = TEST_FAILED` and `goto out`. Alternatively, move setup and teardown into a `unit_test_suite` with `.setup`/`.teardown` handlers.
**Info**
1. The test hardcodes queue IDs (92, 128, 143, 144). These assume 16 queues per pipe and `n_pipes_per_subport = 8`. Deriving them from `RTE_SCHED_QUEUES_PER_PIPE` and `port_params.n_pipes_per_subport` would make the test self-documenting and robust to constant changes. For example, `128` would be `1 * port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_PIPE`.
Review-Result: WARNING
More information about the test-report
mailing list