mbox series

[net-next,v3,0/4] selftests: drv-net: rss_ctx: add tests for RSS contexts

Message ID 20240626012456.2326192-1-kuba@kernel.org (mailing list archive)
Headers show
Series selftests: drv-net: rss_ctx: add tests for RSS contexts | expand

Message

Jakub Kicinski June 26, 2024, 1:24 a.m. UTC
Add a few tests exercising RSS context API.
In addition to basic sanity checks, tests add RSS contexts,
n-tuple rule to direct traffic to them (based on dst port),
and qstats to make sure traffic landed where we expected.

v2 adds a test for removing contexts out of order. When testing
bnxt - either the new test or running more tests after the overlap
test makes the device act strangely. To the point where it may start
giving out ntuple IDs of 0 for all rules..

Ed, could you try the tests with your device?

  $ export NETIF=eth0 REMOTE_...
  $ ./drivers/net/hw/rss_ctx.py
  KTAP version 1
  1..8
  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
  # .. sprays traffic like a headless chicken ..
  not ok 7 rss_ctx.test_rss_context_out_of_order
  ok 8 rss_ctx.test_rss_context4_create_with_cfg
  # Totals: pass:6 fail:1 xfail:0 xpass:0 skip:1 error:0

v2: https://lore.kernel.org/all/20240625010210.2002310-1-kuba@kernel.org
v1: https://lore.kernel.org/all/20240620232902.1343834-1-kuba@kernel.org

Jakub Kicinski (4):
  selftests: drv-net: try to check if port is in use
  selftests: drv-net: add helper to wait for HW stats to sync
  selftests: drv-net: add ability to wait for at least N packets to load
    gen
  selftests: drv-net: rss_ctx: add tests for RSS configuration and
    contexts

 .../testing/selftests/drivers/net/hw/Makefile |   1 +
 .../selftests/drivers/net/hw/rss_ctx.py       | 383 ++++++++++++++++++
 .../selftests/drivers/net/lib/py/env.py       |  19 +-
 .../selftests/drivers/net/lib/py/load.py      |  37 +-
 tools/testing/selftests/net/lib/py/ksft.py    |   5 +
 tools/testing/selftests/net/lib/py/utils.py   |  27 +-
 6 files changed, 457 insertions(+), 15 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/hw/rss_ctx.py

Comments

Edward Cree June 26, 2024, 4:50 p.m. UTC | #1
On 26/06/2024 02:24, Jakub Kicinski wrote:
> Ed, could you try the tests with your device?

Don't seem to be able to get them to run:

# Exception| Traceback (most recent call last):
# Exception|   File "/home/ecree/kern/linux/tools/testing/selftests/net/lib/py/ksft.py", line 134, in ksft_run
# Exception|     case(*args)
# Exception|   File "./drivers/net/hw/rss_ctx.py", line 70, in test_rss_key_indir
# Exception|     if len(_get_rx_cnts(cfg)) < 2:
# Exception|   File "./drivers/net/hw/rss_ctx.py", line 55, in _get_rx_cnts
# Exception|     data = cfg.netdevnl.qstats_get({"ifindex": cfg.ifindex, "scope": ["queue"]}, dump=True)
# Exception|   File "/home/ecree/kern/linux/tools/net/ynl/lib/ynl.py", line 1029, in _op
# Exception|     return self._ops(ops)[0]
# Exception|   File "/home/ecree/kern/linux/tools/net/ynl/lib/ynl.py", line 985, in _ops
# Exception|     raise NlError(nl_msg)
# Exception| net.ynl.lib.ynl.NlError: Netlink error: Operation not supported
# Exception| nl_len = 28 (12) nl_flags = 0x202 nl_type = 3
# Exception| 	error: -95
# Exception| 	extack: {'bad-attr': '.ifindex'}
not ok 1 rss_ctx.test_rss_key_indir

Cursory investigation suggests this is because sfc doesn't
 support netdev_stat_ops, we're still living in the bad old
 days of ethtool -S for our per-queue stats :(
Much as I'd like to fix that, I don't see a prospect of the
 folks upstairs carving out time for it any time soon...

-ed
Jakub Kicinski June 26, 2024, 5 p.m. UTC | #2
On Wed, 26 Jun 2024 17:50:20 +0100 Edward Cree wrote:
> On 26/06/2024 02:24, Jakub Kicinski wrote:
> > Ed, could you try the tests with your device?  
> 
> Don't seem to be able to get them to run:
> 
> # Exception| Traceback (most recent call last):
> # Exception|   File "/home/ecree/kern/linux/tools/testing/selftests/net/lib/py/ksft.py", line 134, in ksft_run
> # Exception|     case(*args)
> # Exception|   File "./drivers/net/hw/rss_ctx.py", line 70, in test_rss_key_indir
> # Exception|     if len(_get_rx_cnts(cfg)) < 2:
> # Exception|   File "./drivers/net/hw/rss_ctx.py", line 55, in _get_rx_cnts
> # Exception|     data = cfg.netdevnl.qstats_get({"ifindex": cfg.ifindex, "scope": ["queue"]}, dump=True)
> # Exception|   File "/home/ecree/kern/linux/tools/net/ynl/lib/ynl.py", line 1029, in _op
> # Exception|     return self._ops(ops)[0]
> # Exception|   File "/home/ecree/kern/linux/tools/net/ynl/lib/ynl.py", line 985, in _ops
> # Exception|     raise NlError(nl_msg)
> # Exception| net.ynl.lib.ynl.NlError: Netlink error: Operation not supported
> # Exception| nl_len = 28 (12) nl_flags = 0x202 nl_type = 3
> # Exception| 	error: -95
> # Exception| 	extack: {'bad-attr': '.ifindex'}
> not ok 1 rss_ctx.test_rss_key_indir
> 
> Cursory investigation suggests this is because sfc doesn't
>  support netdev_stat_ops, we're still living in the bad old
>  days of ethtool -S for our per-queue stats :(

Ugh, right, the standard stats turn out to be key in a large number 
of the tests we end up writing. Perhaps unsurprisingly :(

Fetching stats is done only in _get_rx_cnts(), so you could possibly
do a quick hack there to parse ethtool -S, just to test the test.
But maybe that'd just lead you to another gap..

> Much as I'd like to fix that, I don't see a prospect of the
>  folks upstairs carving out time for it any time soon...

Sadness. Makes me worried that they won't care about maintaining
the Supported status of the driver either :( (Which is not to say
that implementing qstats is a requirement there.)

Anyway, thanks for giving it a go. I'm fairly confident now that
the failures I see are a device / driver bug. So we can merge
the test and let the various drivers address the gaps.

BTW, while I have you, there are two more bits of work:
 - get + dump API via netlink
 - set API via netlink
are you planning to work on those?
patchwork-bot+netdevbpf@kernel.org June 27, 2024, 2:10 a.m. UTC | #3
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 25 Jun 2024 18:24:52 -0700 you wrote:
> Add a few tests exercising RSS context API.
> In addition to basic sanity checks, tests add RSS contexts,
> n-tuple rule to direct traffic to them (based on dst port),
> and qstats to make sure traffic landed where we expected.
> 
> v2 adds a test for removing contexts out of order. When testing
> bnxt - either the new test or running more tests after the overlap
> test makes the device act strangely. To the point where it may start
> giving out ntuple IDs of 0 for all rules..
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/4] selftests: drv-net: try to check if port is in use
    https://git.kernel.org/netdev/net-next/c/8b8fe280155d
  - [net-next,v3,2/4] selftests: drv-net: add helper to wait for HW stats to sync
    https://git.kernel.org/netdev/net-next/c/af8e51644a70
  - [net-next,v3,3/4] selftests: drv-net: add ability to wait for at least N packets to load gen
    https://git.kernel.org/netdev/net-next/c/94fecaa6dcd0
  - [net-next,v3,4/4] selftests: drv-net: rss_ctx: add tests for RSS configuration and contexts
    (no matching commit)

You are awesome, thank you!