From: Edward Cree <ecree.xilinx@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
willemdebruijn.kernel@gmail.com
Subject: Re: [PATCH net-next 4/4] selftests: drv-net: rss_ctx: add tests for RSS configuration and contexts
Date: Mon, 24 Jun 2024 13:55:34 +0100 [thread overview]
Message-ID: <c085b55f-3b42-1655-ea88-3f6a1e03cf8e@gmail.com> (raw)
In-Reply-To: <20240620232902.1343834-5-kuba@kernel.org>
On 21/06/2024 00:29, Jakub Kicinski wrote:
> Add tests focusing on indirection table configuration and
> creating extra RSS contexts in drivers which support it.
>
> $ ./drivers/net/hw/rss_ctx.py
> KTAP version 1
> 1..6
> ok 1 rss_ctx.test_rss_key_indir
> ok 2 rss_ctx.test_rss_context
> ok 3 rss_ctx.test_rss_context4
> # Increasing queue count 44 -> 66
> # Failed to create context 32, trying to test what we got
> ok 4 rss_ctx.test_rss_context32 # SKIP Tested only 31 contexts, wanted 32
> ok 5 rss_ctx.test_rss_context_overlap
> ok 6 rss_ctx.test_rss_context_overlap2
> # Totals: pass:5 fail:0 xfail:0 xpass:0 skip:1 error:0
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
...
> +def test_rss_context(cfg, ctx_cnt=1):
> + """
> + Test separating traffic into RSS contexts.
> + The queues will be allocated 2 for each context:
> + ctx0 ctx1 ctx2 ctx3
> + [0 1] [2 3] [4 5] [6 7] ...
> + """
> +
> + requested_ctx_cnt = ctx_cnt
> +
> + # Try to allocate more queues when necessary
> + qcnt = len(_get_rx_cnts(cfg))
> + if qcnt >= 2 + 2 * ctx_cnt:
> + qcnt = None
> + else:
> + try:
> + ksft_pr(f"Increasing queue count {qcnt} -> {2 + 2 * ctx_cnt}")
> + ethtool(f"-L {cfg.ifname} combined {2 + 2 * ctx_cnt}")
> + except:
> + raise KsftSkipEx("Not enough queues for the test")
> +
> + ntuple = []
> + ctx_id = []
> + ports = []
> + try:
> + # Use queues 0 and 1 for normal traffic
> + ethtool(f"-X {cfg.ifname} equal 2")
> +
> + for i in range(ctx_cnt):
> + try:
> + ctx_id.append(ethtool_create(cfg, "-X", "context new"))
> + except CmdExitFailure:
> + # try to carry on and skip at the end
> + if i == 0:
> + raise
> + ksft_pr(f"Failed to create context {i + 1}, trying to test what we got")
> + ctx_cnt = i
> + break
> +
> + ethtool(f"-X {cfg.ifname} context {ctx_id[i]} start {2 + i * 2} equal 2")
Is it worth also testing the single command
f"ethtool -X {cfg.ifname} context new start {2 + i * 2} equal 2"
as that will exercise the kernel & driver slightly differently to
first creating a context and then configuring it?
...
> diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
> index 4769b4eb1ea1..91648c5baf40 100644
> --- a/tools/testing/selftests/net/lib/py/ksft.py
> +++ b/tools/testing/selftests/net/lib/py/ksft.py
> @@ -57,6 +57,11 @@ KSFT_RESULT_ALL = True
> _fail("Check failed", a, "<", b, comment)
>
>
> +def ksft_lt(a, b, comment=""):
> + if a > b:
> + _fail("Check failed", a, ">", b, comment)
AFAICT this implements 'le' (less-or-equal), not 'lt' (less than) as
the name implies.
Apart from that these tests LGTM as far as they go. One thing that I
notice *isn't* tested here, that I generally make a point of testing,
is: add a bunch of contexts (and ntuple filters), remove some of
them, then run your traffic and make sure that the ones you left
intact still work (and that the deleted ones are actually gone).
Also wonder if it's worth adding tests for 'ethtool -x ... context N'?
You have it for context 0 in test_rss_key_indir(), but on custom
contexts it can exercise different code in the kernel.
-ed
next prev parent reply other threads:[~2024-06-24 12:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 23:28 [PATCH net-next 0/4] selftests: drv-net: rss_ctx: add tests for RSS contexts Jakub Kicinski
2024-06-20 23:28 ` [PATCH net-next 1/4] selftests: drv-net: try to check if port is in use Jakub Kicinski
2024-06-21 1:52 ` David Wei
2024-06-23 7:34 ` Willem de Bruijn
2024-06-24 13:59 ` Przemek Kitszel
2024-06-20 23:28 ` [PATCH net-next 2/4] selftests: drv-net: add helper to wait for HW stats to sync Jakub Kicinski
2024-06-23 7:37 ` Willem de Bruijn
2024-06-24 14:43 ` Jakub Kicinski
2024-06-20 23:29 ` [PATCH net-next 3/4] selftests: drv-net: add ability to wait for at least N packets to load gen Jakub Kicinski
2024-06-21 1:14 ` David Wei
2024-06-20 23:29 ` [PATCH net-next 4/4] selftests: drv-net: rss_ctx: add tests for RSS configuration and contexts Jakub Kicinski
2024-06-21 1:52 ` David Wei
2024-06-21 2:26 ` Jakub Kicinski
2024-06-23 8:03 ` Willem de Bruijn
2024-06-24 14:50 ` Jakub Kicinski
2024-06-24 16:02 ` Jakub Kicinski
2024-06-24 12:55 ` Edward Cree [this message]
2024-06-24 14:54 ` 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=c085b55f-3b42-1655-ea88-3f6a1e03cf8e@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.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).