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 v4 6/8] selftests: drv-net: refactor devmem command builders into lib module
Date: Wed, 13 May 2026 05:12:32 +0000	[thread overview]
Message-ID: <20260513051233.1AFF7C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260511-tcp-dm-netkit-v4-6-841b78b99d74@meta.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] NIC ring and RSS configurations are permanently leaked on the physical host if `configure_nic()` encounters an error midway through execution.
- [Low] The newly created shared helper file `lib/py/devmem.py` is missing from `TEST_FILES` in the subsystem Makefile.
--

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

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

This commit refactors netkit-based devmem test commands into a shared library
module. This allows the command builders to be reused transparently across
both plain and netkit environments while keeping a shared environment across
test runs.

> 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 0000000000000..d3e7a3645cba5
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/lib/py/devmem.py

This isn't a bug, but should this new shared helper file be added to
TEST_FILES in the subsystem Makefile? 

According to the selftests documentation, any file referenced via import in
test scripts must be added to TEST_FILES to ensure it is installed correctly.

[ ... ]

> +def configure_nic(cfg):
> +    """Channels, rings, RSS, queue lease for netkit devmem."""
> +    cfg.require_ipver('6')
> +    ethnl = EthtoolFamily()

[ ... ]

> +    ethnl.rings_set({'header': {'dev-index': cfg.ifindex},
> +                     'tcp-data-split': 'enabled',
> +                     'hds-thresh': 0,
> +                     'rx': min(64, cfg.orig_rx_rings)})
> +
> +    cfg.src_queue = channels - 1
> +    ethtool(f"-X {cfg.ifname} equal {cfg.src_queue}")
> +
> +    with NetNSEnter(str(cfg.netns)):
> +        netdevnl = NetdevFamily()
> +        lease_result = netdevnl.queue_create({
> +            "ifindex": cfg.nk_guest_ifindex,
> +            "type": "rx",
> +            "lease": {
> +                "ifindex": cfg.ifindex,
> +                "queue": {"id": cfg.src_queue, "type": "rx"},
> +                "netns-id": 0,
> +            },
> +        })
> +        cfg.nk_queue = lease_result['id']

If queue_create() or the ethtool command fails and raises an exception, does
this leave the physical NIC rings and RSS configuration permanently modified?

Since the cleanup_nic() function wouldn't be called if this setup fails
midway, would it make sense to handle exceptions here to restore the
original ring and RSS settings?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511-tcp-dm-netkit-v4-0-841b78b99d74@meta.com?part=6

  reply	other threads:[~2026-05-13  5:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  1:17 [PATCH net-next v4 0/8] net: devmem: support devmem with netkit devices Bobby Eshleman
2026-05-12  1:17 ` [PATCH net-next v4 1/8] net: convert netmem_tx flag to enum Bobby Eshleman
2026-05-12  1:17 ` [PATCH net-next v4 2/8] net: netkit: declare NETMEM_TX_NO_DMA mode Bobby Eshleman
2026-05-12  1:17 ` [PATCH net-next v4 3/8] net: devmem: support TX over NETMEM_TX_NO_DMA devices Bobby Eshleman
2026-05-13  4:05   ` sashiko-bot
2026-05-12  1:17 ` [PATCH net-next v4 4/8] selftests: drv-net: ncdevmem: add -n flag to skip NIC configuration Bobby Eshleman
2026-05-12  1:17 ` [PATCH net-next v4 5/8] selftests: drv-net: make attr _nk_guest_ifname public Bobby Eshleman
2026-05-12  1:18 ` [PATCH net-next v4 6/8] selftests: drv-net: refactor devmem command builders into lib module Bobby Eshleman
2026-05-13  5:12   ` sashiko-bot [this message]
2026-05-12  1:18 ` [PATCH net-next v4 7/8] selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv Bobby Eshleman
2026-05-13  5:42   ` sashiko-bot
2026-05-12  1:18 ` [PATCH net-next v4 8/8] selftests: drv-net: add netkit devmem tests 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=20260513051233.1AFF7C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bobbyeshleman@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@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