linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks
@ 2025-06-29 11:18 Nimrod Oren
  2025-07-02  0:23 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Nimrod Oren @ 2025-06-29 11:18 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Willem de Bruijn, netdev,
	linux-kselftest
  Cc: Nimrod Oren, Gal Pressman, Carolina Jubran

A few packets may still be sent and received during the termination of
the iperf processes. These late packets cause failures when they arrive
on queues expected to be empty.

Add a one second delay between repeated _send_traffic_check() calls in
rss_ctx tests to ensure such packets are processed before the next
traffic checks are performed.

Example failure observed:

  Check failed 2 != 0 traffic on inactive queues (context 1):
  [0, 0, 1, 1, 386385, 397196, 0, 0, 0, 0, ...]

  Check failed 4 != 0 traffic on inactive queues (context 2):
  [0, 0, 0, 0, 2, 2, 247152, 253013, 0, 0, ...]

  Check failed 2 != 0 traffic on inactive queues (context 3):
  [0, 0, 0, 0, 0, 0, 1, 1, 282434, 283070, ...]

Note: While the `noise` parameter could be used to tolerate these late
packets, it would be inappropriate here. `noise` tolerates far more
traffic than acceptable in this case, risking false positives.
Inactive queues are supposed to see zero traffic.

Fixes: 847aa551fa78 ("selftests: drv-net: rss_ctx: factor out send traffic and check")
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Nimrod Oren <noren@nvidia.com>
---
 tools/testing/selftests/drivers/net/hw/rss_ctx.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 7bb552f8b182..19be69227693 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -4,6 +4,7 @@
 import datetime
 import random
 import re
+import time
 from lib.py import ksft_run, ksft_pr, ksft_exit
 from lib.py import ksft_eq, ksft_ne, ksft_ge, ksft_in, ksft_lt, ksft_true, ksft_raises
 from lib.py import NetDrvEpEnv
@@ -492,6 +493,7 @@ def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
                             { 'target': (2+i*2, 3+i*2),
                               'noise': (0, 1),
                               'empty': list(range(2, 2+i*2)) + list(range(4+i*2, 2+2*ctx_cnt)) })
+        time.sleep(1)
 
     if requested_ctx_cnt != ctx_cnt:
         raise KsftSkipEx(f"Tested only {ctx_cnt} contexts, wanted {requested_ctx_cnt}")
@@ -559,6 +561,7 @@ def test_rss_context_out_of_order(cfg, ctx_cnt=4):
                 }
 
             _send_traffic_check(cfg, ports[i], f"context {i}", expected)
+            time.sleep(1)
 
     # Use queues 0 and 1 for normal traffic
     ethtool(f"-X {cfg.ifname} equal 2")
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks
  2025-06-29 11:18 [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks Nimrod Oren
@ 2025-07-02  0:23 ` Jakub Kicinski
  2025-07-09 17:10   ` Nimrod Oren
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2025-07-02  0:23 UTC (permalink / raw)
  To: Nimrod Oren
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, Willem de Bruijn, netdev, linux-kselftest,
	Gal Pressman, Carolina Jubran

On Sun, 29 Jun 2025 14:18:12 +0300 Nimrod Oren wrote:
> A few packets may still be sent and received during the termination of
> the iperf processes. These late packets cause failures when they arrive
> on queues expected to be empty.
> 
> Add a one second delay between repeated _send_traffic_check() calls in
> rss_ctx tests to ensure such packets are processed before the next
> traffic checks are performed.

Sprinklings sleeps should be last resort. Is there a way to wait for
iperf to shut down cleanly, or wait for the socket to be closed fully?
Like wait_port_listen() ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks
  2025-07-02  0:23 ` Jakub Kicinski
@ 2025-07-09 17:10   ` Nimrod Oren
  2025-07-09 20:18     ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Nimrod Oren @ 2025-07-09 17:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, Willem de Bruijn, netdev, linux-kselftest,
	Gal Pressman, Carolina Jubran

On 02/07/2025 3:23, Jakub Kicinski wrote:
> On Sun, 29 Jun 2025 14:18:12 +0300 Nimrod Oren wrote:
>> A few packets may still be sent and received during the termination of
>> the iperf processes. These late packets cause failures when they arrive
>> on queues expected to be empty.
>>
>> Add a one second delay between repeated _send_traffic_check() calls in
>> rss_ctx tests to ensure such packets are processed before the next
>> traffic checks are performed.
> 
> Sprinklings sleeps should be last resort. Is there a way to wait for
> iperf to shut down cleanly, or wait for the socket to be closed fully?
> Like wait_port_listen() ?

The socket may end up in TIME_WAIT state, so waiting for it to be fully
closed can take ~2 mins. We could opt for a single sleep during
GenerateTraffic.stop(), but that would also affect tests that aren't
impacted by late packets. WDYT?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks
  2025-07-09 17:10   ` Nimrod Oren
@ 2025-07-09 20:18     ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-07-09 20:18 UTC (permalink / raw)
  To: Nimrod Oren
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, Willem de Bruijn, netdev, linux-kselftest,
	Gal Pressman, Carolina Jubran

On Wed, 9 Jul 2025 20:10:14 +0300 Nimrod Oren wrote:
> On 02/07/2025 3:23, Jakub Kicinski wrote:
> > On Sun, 29 Jun 2025 14:18:12 +0300 Nimrod Oren wrote:  
> >> A few packets may still be sent and received during the termination of
> >> the iperf processes. These late packets cause failures when they arrive
> >> on queues expected to be empty.
> >>
> >> Add a one second delay between repeated _send_traffic_check() calls in
> >> rss_ctx tests to ensure such packets are processed before the next
> >> traffic checks are performed.  
> > 
> > Sprinklings sleeps should be last resort. Is there a way to wait for
> > iperf to shut down cleanly, or wait for the socket to be closed fully?
> > Like wait_port_listen() ?  
> 
> The socket may end up in TIME_WAIT state, so waiting for it to be fully
> closed can take ~2 mins.

TIME_WAIT is as good as CLOSED for our purposes. Once we got a FIN
the chances of more traffic should be minuscule.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-09 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-29 11:18 [PATCH net] selftests: drv-net: rss_ctx: Add short delay between per-context traffic checks Nimrod Oren
2025-07-02  0:23 ` Jakub Kicinski
2025-07-09 17:10   ` Nimrod Oren
2025-07-09 20:18     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).