BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bobby Eshleman" <bobbyeshleman@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 09/11] selftests: drv-net: refactor devmem command builders into lib module
Date: Wed, 29 Apr 2026 22:43:31 +0000	[thread overview]
Message-ID: <20260429224332.3C8A9C2BCB4@smtp.kernel.org> (raw)
In-Reply-To: <20260428-tcp-dm-netkit-v1-9-719280eba4d2@meta.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Missing TEST_FILES entry for new python library file.
- [Medium] Uncaught KsftSkipEx exception causes test script crashes instead of graceful skips.
- [Medium] Silent test coverage loss: payload validation and hardware flow steering are disabled for the plain environment.
--

commit 5feef3ad6211668eb3cfa3fef7cca6cbdcb65a36
Author: Bobby Eshleman <bobbyeshleman@meta.com>

selftests: drv-net: refactor devmem command builders into lib module

Adding netkit-based devmem tests is a straight-forward copy of devmem
test commands plus some args for the nk cases, so this patch breaks out
these command builders into helpers used by both.

> diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
> index ee863e90d1e0..33648e39577a 100755
> --- a/tools/testing/selftests/drivers/net/hw/devmem.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem.py

[ ... ]

> @@ -76,14 +42,9 @@ def check_rx_hds(cfg) -> None:
>  
>  def main() -> None:
>      with NetDrvEpEnv(__file__) as cfg:
> -        cfg.bin_local = path.abspath(path.dirname(__file__) + "/ncdevmem")
> -        cfg.bin_remote = cfg.remote.deploy(cfg.bin_local)
> -
> +        setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem"))
>          ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds],
> -                 args=(cfg, ))
>      ksft_exit()

By calling setup_test() directly in main() before ksft_run(), does this
prevent ksft_run() from catching the KsftSkipEx exception that is now
raised inside setup_test()?

Previously, the require_devmem() check was inside individual test cases,
where ksft_run() could safely intercept the exception and emit a standard TAP
SKIP message. It seems this might now abort the script with a Python
traceback on systems where devmem is unsupported.

> diff --git a/tools/testing/selftests/drivers/net/hw/lib/py/devmem.py b/tools/testing/selftests/drivers/net/hw/lib/py/devmem.py
> new file mode 100644
> index 000000000000..e95fc38337fa
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/lib/py/devmem.py
> @@ -0,0 +1,215 @@
> +# SPDX-License-Identifier: GPL-2.0
> +"""Shared helpers for devmem TCP selftests."""

Since this patch creates a new shared Python utility file that is imported
by test scripts, does it need to be added to TEST_FILES in the subsystem
Makefile?

Without a Makefile update, tests may fail with a "No such file or directory"
error when executed from an installed location after running make install.

[ ... ]

> +def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False):
> +    if hasattr(cfg, 'netns'):
> +        flow_rule_id = set_flow_rule(cfg, port)
> +        defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}")
> +
> +        ifname = cfg._nk_guest_ifname
> +        addr = cfg.nk_guest_ipv6
> +        extras = f" -t {cfg.nk_queue} -q 1 -n"
> +        if verify:
> +            extras += " -v 7"
> +    else:
> +        ifname = cfg.ifname
> +        addr = cfg.addr
> +        extras = ""

The commit message notes there are no functional changes to the existing tests,
but in this else branch for the non-netns environment, extras is
unconditionally set to an empty string.

Does this ignore the verify=True argument and silently disable the "-v 7"
validation flag, skipping payload validation?

[ ... ]

> +def run_rx(cfg):
> +    if hasattr(cfg, 'netns'):
> +        configure_nic(cfg)
> +    port = rand_port()
> +    socat = socat_send(cfg, port)
> +    data_pipe = (f"yes $(echo -e \x01\x02\x03\x04\x05\x06) | head -c 1K"
> +                 f" | {socat}")
> +    ns = getattr(cfg, "netns", None)
> +
> +    listen_cmd = ncdevmem_rx(cfg, port)
> +    with bkg(listen_cmd, exit_wait=True, ns=ns) as ncdevmem:

In the original check_rx() test, the listen command included
"-c {cfg.remote_addr}" and socat used the "bind" argument.

Are those arguments intentionally omitted here? It looks like dropping them
removes the 5-tuple hardware flow steering setup present in the original test.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260428-tcp-dm-netkit-v1-0-719280eba4d2@meta.com?part=9

  reply	other threads:[~2026-04-29 22:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 22:41 [PATCH net-next 00/11] net: devmem: support devmem with netkit devices Bobby Eshleman
2026-04-28 22:41 ` [PATCH net-next 01/11] net: add netmem_tx modes that indicate dma capability Bobby Eshleman
2026-04-28 22:41 ` [PATCH net-next 02/11] net: bnxt: convert netmem_tx from bool to NETMEM_TX_DMA enum Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 03/11] gve: " Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 04/11] net/mlx5e: " Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 05/11] eth: fbnic: " Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 06/11] netkit: set NETMEM_TX_NO_DMA for unreadable skb passthrough Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 07/11] net: devmem: support TX over NETMEM_TX_NO_DMA devices Bobby Eshleman
2026-04-29 22:43   ` sashiko-bot
2026-05-01  0:57   ` Jakub Kicinski
2026-05-01  1:07     ` Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 08/11] selftests: drv-net: ncdevmem: add -n flag to skip NIC configuration Bobby Eshleman
2026-04-28 22:42 ` [PATCH net-next 09/11] selftests: drv-net: refactor devmem command builders into lib module Bobby Eshleman
2026-04-29 22:43   ` sashiko-bot [this message]
2026-04-28 22:42 ` [PATCH net-next 10/11] selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv Bobby Eshleman
2026-04-29 22:43   ` sashiko-bot
2026-04-28 22:42 ` [PATCH net-next 11/11] selftests: drv-net: add netkit devmem tests Bobby Eshleman
2026-04-29 22:43   ` sashiko-bot
2026-04-29 12:08 ` [PATCH net-next 00/11] net: devmem: support devmem with netkit devices Daniel Borkmann
2026-04-29 15:18   ` Bobby Eshleman
2026-04-29 15:33     ` Daniel Borkmann
2026-05-01  0:59 ` Jakub Kicinski
2026-05-01  1:04   ` Bobby Eshleman

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=20260429224332.3C8A9C2BCB4@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bobbyeshleman@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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