From: Jakub Kicinski <kuba@kernel•org>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org, edumazet@google•com, pabeni@redhat•com,
willemdebruijn.kernel@gmail•com, petrm@nvidia•com,
przemyslaw.kitszel@intel•com, Jakub Kicinski <kuba@kernel•org>
Subject: [PATCH net-next v2 4/5] selftests: drv-net: rss_ctx: check behavior of indirection table resizing
Date: Mon, 8 Jul 2024 14:36:26 -0700 [thread overview]
Message-ID: <20240708213627.226025-5-kuba@kernel.org> (raw)
In-Reply-To: <20240708213627.226025-1-kuba@kernel.org>
Some devices dynamically increase and decrease the size of the RSS
indirection table based on the number of enabled queues.
When that happens driver must maintain the balance of entries
(preferably duplicating the smaller table).
Signed-off-by: Jakub Kicinski <kuba@kernel•org>
---
| 37 ++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
--git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 177abfd06412..38a871220bff 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -5,7 +5,7 @@ import datetime
import random
from lib.py import ksft_run, ksft_pr, ksft_exit, ksft_eq, ksft_ge, ksft_lt
from lib.py import NetDrvEpEnv
-from lib.py import NetdevFamily
+from lib.py import EthtoolFamily, NetdevFamily
from lib.py import KsftSkipEx
from lib.py import rand_port
from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
@@ -211,6 +211,39 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})")
+def test_rss_resize(cfg):
+ """Test resizing of the RSS table.
+
+ Some devices dynamically increase and decrease the size of the RSS
+ indirection table based on the number of enabled queues.
+ When that happens driver must maintain the balance of entries
+ (preferably duplicating the smaller table).
+ """
+
+ channels = cfg.ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
+ ch_max = channels['combined-max']
+ qcnt = channels['combined-count']
+
+ if ch_max < 2:
+ raise KsftSkipEx(f"Not enough queues for the test: {ch_max}")
+
+ ethtool(f"-L {cfg.ifname} combined 2")
+ defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
+
+ ethtool(f"-X {cfg.ifname} weight 1 7")
+ defer(ethtool, f"-X {cfg.ifname} default")
+
+ ethtool(f"-L {cfg.ifname} combined {ch_max}")
+ data = get_rss(cfg)
+ ksft_eq(0, min(data['rss-indirection-table']))
+ ksft_eq(1, max(data['rss-indirection-table']))
+
+ ksft_eq(7,
+ data['rss-indirection-table'].count(1) /
+ data['rss-indirection-table'].count(0),
+ f"Table imbalance after resize: {data['rss-indirection-table']}")
+
+
def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
"""
Test separating traffic into RSS contexts.
@@ -442,9 +475,11 @@ from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
def main() -> None:
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+ cfg.ethnl = EthtoolFamily()
cfg.netdevnl = NetdevFamily()
ksft_run([test_rss_key_indir, test_rss_queue_reconfigure,
+ test_rss_resize,
test_rss_context, test_rss_context4, test_rss_context32,
test_rss_context_queue_reconfigure,
test_rss_context_overlap, test_rss_context_overlap2,
--
2.45.2
next prev parent reply other threads:[~2024-07-08 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 21:36 [PATCH net-next v2 0/5] selftests: drv-net: rss_ctx: more tests Jakub Kicinski
2024-07-08 21:36 ` [PATCH net-next v2 1/5] selftests: drv-net: rss_ctx: fix cleanup in the basic test Jakub Kicinski
2024-07-08 21:36 ` [PATCH net-next v2 2/5] selftests: drv-net: rss_ctx: factor out send traffic and check Jakub Kicinski
2024-07-08 21:36 ` [PATCH net-next v2 3/5] selftests: drv-net: rss_ctx: test queue changes vs user RSS config Jakub Kicinski
2024-07-08 21:36 ` Jakub Kicinski [this message]
2024-07-08 21:36 ` [PATCH net-next v2 5/5] selftests: drv-net: rss_ctx: test flow rehashing without impacting traffic Jakub Kicinski
2024-07-08 22:03 ` [PATCH net-next v2 0/5] selftests: drv-net: rss_ctx: more tests Willem de Bruijn
2024-07-09 23:40 ` patchwork-bot+netdevbpf
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=20240708213627.226025-5-kuba@kernel.org \
--to=kuba@kernel$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=petrm@nvidia$(echo .)com \
--cc=przemyslaw.kitszel@intel$(echo .)com \
--cc=willemdebruijn.kernel@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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