From: Jakub Kicinski kuba@kernel.org
[ Upstream commit e2cf2d5baa09248d3d50b73522594b778388e3bc ]
rss_ctx.test_rss_key_indir implicitly expects at least 5 queues, as it checks that the traffic on first 2 queues is lower than the remaining queues when we use all queues. Special case fewer queues.
Reviewed-by: Simon Horman horms@kernel.org Link: https://patch.msgid.link/20250901173139.881070-2-kuba@kernel.org Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- What it fixes - The test `test_rss_key_indir` implicitly assumed ≥5 Rx queues and could fail on devices with fewer queues. The patch makes the test robust on systems with 3–4 queues by tailoring the verification to the queue count. This corrects a real test bug that affects users running kselftests on lower-end hardware.
- Specific code changes - Queue count awareness and early skip: - `tools/testing/selftests/drivers/net/hw/rss_ctx.py:119-121` computes `qcnt = len(_get_rx_cnts(cfg))` and skips the test when `qcnt < 3`. This avoids running the distribution checks where they don’t make sense. - Preserve existing check for many queues: - For devices with >4 queues, the original logic remains: verify the first two queues get less traffic than the remainder after restoring default RSS distribution (`tools/testing/selftests/drivers/net/hw/rss_ctx.py:181-184`). - `ksft_lt(sum(cnts[:2]), sum(cnts[2:]), "traffic distributed: " + str(cnts))` - Add a correct check for few queues: - For devices with 3–4 queues, instead of the sum-of-rest comparison (which is ill-suited for small N), ensure the third queue receives a significant packet count (`tools/testing/selftests/drivers/net/hw/rss_ctx.py:185-187`): - `ksft_ge(cnts[2], 3500, "traffic distributed: " + str(cnts))` - This aligns with the generated 20k packets; with uniform distribution across 3–4 queues, a 3.5k threshold is conservative and avoids the previous false-negative behavior. - The earlier part of the test verifying that setting `equal 2` restricts traffic to the first two queues remains unchanged and valid (`tools/testing/selftests/drivers/net/hw/rss_ctx.py:165-173`).
- Scope and risk - Change is confined to kselftests under `tools/testing/selftests/…`; no kernel runtime or ABI impact. - The logic is minimal and targeted; it preserves existing behavior for devices with >4 queues and only adjusts validation for small queue counts. - Regression risk is low. The 3.5k threshold is permissive given the 20k packet generation and normal RSS distribution, while still detecting misconfiguration.
- Stable criteria assessment - Fixes a test reliability issue that affects users running kselftests on stable kernels with fewer queues. - Small, self-contained change with no architectural impact. - No new features introduced; purely a test correctness adjustment. - While there is no explicit “Cc: stable” tag, stable branches commonly accept selftest fixes that improve test reliability and CI signal quality.
Given the above, this is a low-risk, test-only bug fix that improves selftest correctness on a broader set of hardware. It is a good candidate for backporting.
tools/testing/selftests/drivers/net/hw/rss_ctx.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py index 9838b8457e5a6..4206212d03a65 100755 --- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py +++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py @@ -178,8 +178,13 @@ def test_rss_key_indir(cfg): cnts = _get_rx_cnts(cfg) GenerateTraffic(cfg).wait_pkts_and_stop(20000) cnts = _get_rx_cnts(cfg, prev=cnts) - # First two queues get less traffic than all the rest - ksft_lt(sum(cnts[:2]), sum(cnts[2:]), "traffic distributed: " + str(cnts)) + if qcnt > 4: + # First two queues get less traffic than all the rest + ksft_lt(sum(cnts[:2]), sum(cnts[2:]), + "traffic distributed: " + str(cnts)) + else: + # When queue count is low make sure third queue got significant pkts + ksft_ge(cnts[2], 3500, "traffic distributed: " + str(cnts))
def test_rss_queue_reconfigure(cfg, main_ctx=True):