From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 6/7] selftests: drv-net: rss_ctx: skip tests which need multiple contexts cleanly
Date: Thu, 6 Feb 2025 15:53:33 -0800 [thread overview]
Message-ID: <20250206235334.1425329-7-kuba@kernel.org> (raw)
In-Reply-To: <20250206235334.1425329-1-kuba@kernel.org>
There's no good API to check how many contexts device supports.
But initial tests sense the context count already, so just store
that number and skip tests which we know need more.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
| 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 7e5f4602e6b3..d6e69d7d5e43 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -59,6 +59,14 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
raise KsftSkipEx("Ntuple filters not enabled on the device: " + str(features["ntuple-filters"]))
+def require_context_cnt(cfg, need_cnt):
+ # There's no good API to get the context count, so the tests
+ # which try to add a lot opportunisitically set the count they
+ # discovered. Careful with test ordering!
+ if need_cnt and cfg.context_cnt and cfg.context_cnt < need_cnt:
+ raise KsftSkipEx(f"Test requires at least {need_cnt} contexts, but device only has {cfg.context_cnt}")
+
+
# Get Rx packet counts for all queues, as a simple list of integers
# if @prev is specified the prev counts will be subtracted
def _get_rx_cnts(cfg, prev=None):
@@ -457,6 +465,8 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
raise
ksft_pr(f"Failed to create context {i + 1}, trying to test what we got")
ctx_cnt = i
+ if cfg.context_cnt is None:
+ cfg.context_cnt = ctx_cnt
break
_rss_key_check(cfg, context=ctx_id)
@@ -512,8 +522,7 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
"""
require_ntuple(cfg)
-
- requested_ctx_cnt = ctx_cnt
+ require_context_cnt(cfg, 4)
# Try to allocate more queues when necessary
qcnt = len(_get_rx_cnts(cfg))
@@ -578,9 +587,6 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
remove_ctx(-1)
check_traffic()
- if requested_ctx_cnt != ctx_cnt:
- raise KsftSkipEx(f"Tested only {ctx_cnt} contexts, wanted {requested_ctx_cnt}")
-
def test_rss_context_overlap(cfg, other_ctx=0):
"""
@@ -589,6 +595,8 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
"""
require_ntuple(cfg)
+ if other_ctx:
+ require_context_cnt(cfg, 2)
queue_cnt = len(_get_rx_cnts(cfg))
if queue_cnt < 4:
@@ -741,6 +749,7 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
def main() -> None:
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+ cfg.context_cnt = None
cfg.ethnl = EthtoolFamily()
cfg.netdevnl = NetdevFamily()
--
2.48.1
next prev parent reply other threads:[~2025-02-06 23:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 23:53 [PATCH net-next 0/7] eth: fbnic: support RSS contexts and ntuple filters Jakub Kicinski
2025-02-06 23:53 ` [PATCH net-next 1/7] net: ethtool: prevent flow steering to RSS contexts which don't exist Jakub Kicinski
2025-02-07 19:27 ` Joe Damato
2025-02-09 8:17 ` Gal Pressman
2025-02-12 18:39 ` Jakub Kicinski
2025-02-06 23:53 ` [PATCH net-next 2/7] selftests: net-drv: test adding flow rule to invalid RSS context Jakub Kicinski
2025-02-07 18:14 ` Willem de Bruijn
2025-02-07 19:29 ` Joe Damato
2025-02-06 23:53 ` [PATCH net-next 3/7] eth: fbnic: support an additional " Jakub Kicinski
2025-02-07 19:41 ` Joe Damato
2025-02-06 23:53 ` [PATCH net-next 4/7] eth: fbnic: add IP TCAM programming Jakub Kicinski
2025-02-06 23:53 ` [PATCH net-next 5/7] eth: fbnic: support n-tuple filters Jakub Kicinski
2025-02-06 23:53 ` Jakub Kicinski [this message]
2025-02-06 23:53 ` [PATCH net-next 7/7] eth: fbnic: support listing tcam content via debugfs Jakub Kicinski
2025-02-07 2:46 ` Kalesh Anakkur Purayil
2025-02-07 3:15 ` Jakub Kicinski
2025-02-10 16:30 ` [PATCH net-next 0/7] eth: fbnic: support RSS contexts and ntuple filters patchwork-bot+netdevbpf
2025-02-12 6:05 ` Gal Pressman
2025-02-12 18:32 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250206235334.1425329-7-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).