Skip to content

Commit fbb467f

Browse files
kuba-mooPaolo Abeni
authored andcommitted
selftests: drv-net: pp_alloc_fail: lower traffic expectations
Lower the expected level of traffic in the pp_alloc_fail test and calculate failure counter thresholds based on the traffic rather than using a fixed constant. We only have "QEMU HW" in NIPA right now, and the test (due to debug dependencies) only works on debug kernels in the first place. We need some place for it to pass otherwise it seems to be bit rotting. So lower the traffic threshold so that it passes on QEMU and with a debug kernel... Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20251007232653.2099376-9-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 0be740f commit fbb467f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import errno
99
import time
10+
import math
1011
import os
1112
from lib.py import ksft_run, ksft_exit, ksft_pr
1213
from lib.py import KsftSkipEx, KsftFailEx
@@ -62,7 +63,7 @@ def check_traffic_flowing():
6263
stat1 = get_stats()
6364
time.sleep(1)
6465
stat2 = get_stats()
65-
if stat2['rx-packets'] - stat1['rx-packets'] < 15000:
66+
if stat2['rx-packets'] - stat1['rx-packets'] < 4000:
6667
raise KsftFailEx("Traffic seems low:", stat2['rx-packets'] - stat1['rx-packets'])
6768

6869

@@ -89,11 +90,16 @@ def check_traffic_flowing():
8990
time.sleep(3)
9091
s2 = get_stats()
9192

92-
if s2['rx-alloc-fail'] - s1['rx-alloc-fail'] < 1:
93+
seen_fails = s2['rx-alloc-fail'] - s1['rx-alloc-fail']
94+
if seen_fails < 1:
9395
raise KsftSkipEx("Allocation failures not increasing")
94-
if s2['rx-alloc-fail'] - s1['rx-alloc-fail'] < 100:
95-
raise KsftSkipEx("Allocation increasing too slowly", s2['rx-alloc-fail'] - s1['rx-alloc-fail'],
96-
"packets:", s2['rx-packets'] - s1['rx-packets'])
96+
pkts = s2['rx-packets'] - s1['rx-packets']
97+
# Expecting one failure per 512 buffers, 3.1x safety margin
98+
want_fails = math.floor(pkts / 512 / 3.1)
99+
if seen_fails < want_fails:
100+
raise KsftSkipEx("Allocation increasing too slowly", seen_fails,
101+
"packets:", pkts)
102+
ksft_pr(f"Seen: pkts:{pkts} fails:{seen_fails} (pass thrs:{want_fails})")
97103

98104
# Basic failures are fine, try to wobble some settings to catch extra failures
99105
check_traffic_flowing()

0 commit comments

Comments
 (0)