Skip to content

Commit

Permalink
selftests: drv-net: rss_ctx: allow more noise on default context
Browse files Browse the repository at this point in the history
As predicted by David running the test on a machine with a single
interface is a bit unreliable. We try to send 20k packets with
iperf and expect fewer than 10k packets on the default context.
The test isn't very quick, iperf will usually send 100k packets
by the time we stop it. So we're off by 5x on the number of iperf
packets but still expect default context to only get the hardcoded
10k. The intent is to make sure we get noticeably less traffic
on the default context. Use half of the resulting iperf traffic
instead of the hard coded 10k.

Link: https://patch.msgid.link/20240702233728.4183387-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jul 4, 2024
1 parent 8c5a9f2 commit 0b87745
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/testing/selftests/drivers/net/hw/rss_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
GenerateTraffic(cfg, port=ports[i]).wait_pkts_and_stop(20000)
cnts = _get_rx_cnts(cfg, prev=cnts)

ksft_lt(sum(cnts[ :2]), 10000, "traffic on main context:" + str(cnts))
ksft_ge(sum(cnts[2+i*2:4+i*2]), 20000, f"traffic on context {i}: " + str(cnts))
directed = sum(cnts[2+i*2:4+i*2])

ksft_lt(sum(cnts[ :2]), directed / 2, "traffic on main context:" + str(cnts))
ksft_ge(directed, 20000, f"traffic on context {i}: " + str(cnts))
ksft_eq(sum(cnts[2:2+i*2] + cnts[4+i*2:]), 0, "traffic on other contexts: " + str(cnts))

if requested_ctx_cnt != ctx_cnt:
Expand Down Expand Up @@ -233,8 +235,9 @@ def check_traffic():
cnts = _get_rx_cnts(cfg, prev=cnts)

if ctx[i]:
ksft_lt(sum(cnts[ :2]), 10000, "traffic on main context:" + str(cnts))
ksft_ge(sum(cnts[2+i*2:4+i*2]), 20000, f"traffic on context {i}: " + str(cnts))
directed = sum(cnts[2+i*2:4+i*2])
ksft_lt(sum(cnts[ :2]), directed / 2, "traffic on main context:" + str(cnts))
ksft_ge(directed, 20000, f"traffic on context {i}: " + str(cnts))
ksft_eq(sum(cnts[2:2+i*2] + cnts[4+i*2:]), 0, "traffic on other contexts: " + str(cnts))
else:
ksft_ge(sum(cnts[ :2]), 20000, "traffic on main context:" + str(cnts))
Expand Down Expand Up @@ -328,8 +331,9 @@ def test_rss_context_overlap(cfg, other_ctx=0):
GenerateTraffic(cfg, port=port).wait_pkts_and_stop(20000)
cnts = _get_rx_cnts(cfg, prev=cnts)

ksft_lt(sum(cnts[ :2]), 7000, "traffic on main context: " + str(cnts))
ksft_ge(sum(cnts[2:4]), 20000, "traffic on extra context: " + str(cnts))
directed = sum(cnts[2:4])
ksft_lt(sum(cnts[ :2]), directed / 2, "traffic on main context: " + str(cnts))
ksft_ge(directed, 20000, "traffic on extra context: " + str(cnts))
if other_ctx == 0:
ksft_eq(sum(cnts[4: ]), 0, "traffic on other queues: " + str(cnts))

Expand Down

0 comments on commit 0b87745

Please sign in to comment.