Extend the rss_ctx test suite to test that an ntuple action that
redirects to an RSS context contains that information in `ethtool -n`.
Otherwise the output from ethtool is highly deceiving. This test helps
ensure drivers are compliant with the API.
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
tools/testing/selftests/drivers/net/hw/rss_ctx.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 29995586993c..4fa158f37155 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -3,7 +3,8 @@
import datetime
import random
-from lib.py import ksft_run, ksft_pr, ksft_exit, ksft_eq, ksft_ne, ksft_ge, ksft_lt
+import re
+from lib.py import ksft_run, ksft_pr, ksft_exit, ksft_eq, ksft_ne, ksft_ge, ksft_lt, ksft_true
from lib.py import NetDrvEpEnv
from lib.py import EthtoolFamily, NetdevFamily
from lib.py import KsftSkipEx, KsftFailEx
@@ -96,6 +97,14 @@ def _send_traffic_check(cfg, port, name, params):
f"traffic on inactive queues ({name}): " + str(cnts))
+def _ntuple_rule_check(cfg, rule_id, ctx_id):
+ """Check that ntuple rule references RSS context ID"""
+ text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
+ pattern = f"RSS Context ID: {ctx_id}"
+ ksft_true(re.search(pattern, text, re.IGNORECASE),
+ "RSS context not referenced in ntuple rule")
+
+
def test_rss_key_indir(cfg):
"""Test basics like updating the main RSS key and indirection table."""
@@ -433,6 +442,8 @@ def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
ntuple = ethtool_create(cfg, "-N", flow)
defer(ethtool, f"-N {cfg.ifname} delete {ntuple}")
+ _ntuple_rule_check(cfg, ntuple, ctx_id)
+
for i in range(ctx_cnt):
_send_traffic_check(cfg, ports[i], f"context {i}",
{ 'target': (2+i*2, 3+i*2),
--
2.46.0
On Mon, 11 Nov 2024 19:23:31 -0700 Daniel Xu wrote: > Extend the rss_ctx test suite to test that an ntuple action that > redirects to an RSS context contains that information in `ethtool -n`. > Otherwise the output from ethtool is highly deceiving. This test helps > ensure drivers are compliant with the API. Looks like it doesn't apply, please base the v3 on net rather than net-next, I'll deal with the merge.
Hi Jakub, On Tue, Nov 12, 2024, at 5:44 PM, Jakub Kicinski wrote: > On Mon, 11 Nov 2024 19:23:31 -0700 Daniel Xu wrote: >> Extend the rss_ctx test suite to test that an ntuple action that >> redirects to an RSS context contains that information in `ethtool -n`. >> Otherwise the output from ethtool is highly deceiving. This test helps >> ensure drivers are compliant with the API. > > Looks like it doesn't apply, please base the v3 on net rather than > net-next, I'll deal with the merge. Sorry about that. Will think on how to make my workflow not involve manually retyping patches between different machines...
On 12/11/2024 02:23, Daniel Xu wrote:
> Extend the rss_ctx test suite to test that an ntuple action that
> redirects to an RSS context contains that information in `ethtool -n`.
> Otherwise the output from ethtool is highly deceiving. This test helps
> ensure drivers are compliant with the API.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
...
> +def _ntuple_rule_check(cfg, rule_id, ctx_id):
> + """Check that ntuple rule references RSS context ID"""
> + text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
> + pattern = f"RSS Context ID: {ctx_id}"
> + ksft_true(re.search(pattern, text, re.IGNORECASE),
This won't match the output from your ethtool patch, because that
removes the colon. Probably want to wait until the patch is
finalised and then write a regex that matches both versions.
Hi Ed,
On Tue, Nov 12, 2024, at 3:10 AM, Edward Cree wrote:
> On 12/11/2024 02:23, Daniel Xu wrote:
>> Extend the rss_ctx test suite to test that an ntuple action that
>> redirects to an RSS context contains that information in `ethtool -n`.
>> Otherwise the output from ethtool is highly deceiving. This test helps
>> ensure drivers are compliant with the API.
>>
>> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ...
>> +def _ntuple_rule_check(cfg, rule_id, ctx_id):
>> + """Check that ntuple rule references RSS context ID"""
>> + text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
>> + pattern = f"RSS Context ID: {ctx_id}"
>> + ksft_true(re.search(pattern, text, re.IGNORECASE),
>
> This won't match the output from your ethtool patch, because that
> removes the colon. Probably want to wait until the patch is
> finalised and then write a regex that matches both versions.
Argh, I meant to have wildcards here. But yeah, makes sense, will wait
until the other patch is finalized.
Thanks,
Daniel
On Tue, 12 Nov 2024 17:51:50 -0800 Daniel Xu wrote: > > This won't match the output from your ethtool patch, because that > > removes the colon. Probably want to wait until the patch is > > finalised and then write a regex that matches both versions. > > Argh, I meant to have wildcards here. But yeah, makes sense, will wait > until the other patch is finalized. Keep in mind Michal scans ethtool patches once every week or two, so there may be a bit of a delay there.
© 2016 - 2026 Red Hat, Inc.