All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, ecree.xilinx@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 07:50:35 -0700	[thread overview]
Message-ID: <20240624075035.037041e3@kernel.org> (raw)
In-Reply-To: <6677d6e5e646e_33363c2944d@willemb.c.googlers.com.notmuch>

On Sun, 23 Jun 2024 04:03:49 -0400 Willem de Bruijn wrote:
> > +def test_rss_key_indir(cfg):
> > +    """
> > +    Test basics like updating the main RSS key and indirection table.
> > +    """
> > +    data = get_rss(cfg)
> > +    want_keys = ['rss-hash-key', 'rss-hash-function', 'rss-indirection-table']
> > +    for k in want_keys:
> > +        if k not in data:
> > +            raise KsftFailEx("ethtool results missing key: " + k)
> > +        if not data[k]:
> > +            raise KsftFailEx(f"ethtool results empty for '{k}': {data[k]}")  
> 
> No point in printing data[k]?

It can be one of many things which evaluate to False: None, False, [],
""..

> > +
> > +    key_len = len(data['rss-hash-key'])
> > +
> > +    # Set the key
> > +    key = _rss_key_rand(key_len)
> > +    ethtool(f"-X {cfg.ifname} hkey " + _rss_key_str(key))  
> 
> Probably too paranoid, but in case failure is only for some randomized
> input, is the key logged on error?

Will add!

> > +    data = get_rss(cfg)
> > +    ksft_eq(key, data['rss-hash-key'])
> > +
> > +    # Set the indirection table
> > +    ethtool(f"-X {cfg.ifname} equal 2")
> > +    data = get_rss(cfg)
> > +    ksft_eq(0, min(data['rss-indirection-table']))
> > +    ksft_eq(1, max(data['rss-indirection-table']))
> > +
> > +    # Check we only get traffic on the first 2 queues
> > +    cnts = _get_rx_cnts(cfg)
> > +    GenerateTraffic(cfg).wait_pkts_and_stop(20000)
> > +    cnts = _get_rx_cnts(cfg, prev=cnts)
> > +    # 2 queues, 20k packets, must be at least 5k per queue
> > +    ksft_ge(cnts[0], 5000, "traffic on main context (1/2): " + str(cnts))
> > +    ksft_ge(cnts[1], 5000, "traffic on main context (2/2): " + str(cnts))
> > +    # The other queues should be unused
> > +    ksft_eq(sum(cnts[2:]), 0, "traffic on unused queues: " + str(cnts))
> > +
> > +    # Restore, and check traffic gets spread again
> > +    ethtool(f"-X {cfg.ifname} default")  
> 
> Consider save and restore state at the start of the test, in case
> default is overridden at boot.
> 
> Not important, but this also repeats some of toeplitz.sh. That has not
> been integrated into net-drv, and the .c and .sh code is more verbose
> than this python code. Perhaps can be replaced entirely eventually.

Agreed, I went with "default" because there seems to be no ethtool
support for setting exact indir table :(  I deferred exact restore
until we have YNL support for setting, which should be soon.

> > +            ethtool(f"-X {cfg.ifname} context {ctx_id[i]} start {2 + i * 2} equal 2")
> > +
> > +            ports.append(rand_port())
> > +            flow = f"flow-type tcp{cfg.addr_ipver} dst-port {ports[i]} context {ctx_id[i]}"
> > +            ntuple.append(ethtool_create(cfg, "-N", flow))  
> 
> Need to test feature ('-k') ntuple and skip test otherwise or set?

Will do!

  reply	other threads:[~2024-06-24 14:50 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 [this message]
2024-06-24 16:02       ` Jakub Kicinski
2024-06-24 12:55   ` Edward Cree
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=20240624075035.037041e3@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.