Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: maciej.fijalkowski@intel.com
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org,
	pabeni@redhat.com, tushar.vyavahare@intel.com,
	kerneljasonxing@gmail.com, bjorn@kernel.org
Subject: Re: [PATCH v2 net-next 07/14] selftests: xsk: split xskxceiver main() into setup, run and cleanup
Date: Mon, 12 Oct 2026 08:50:23 +0000	[thread overview]
Message-ID: <179179502350.434549.10707133560104619595@kernel.org> (raw)
In-Reply-To: <20261008114909.734364-8-maciej.fijalkowski@intel.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Concern: this patch moves get_hw_ring_size() into
  detect_ifobj_caps(), which init_iface() runs for both interfaces.
- [Low] In main() (tools/testing/selftests/net/lib/xsk/xskxceiver.c:439),
  the new ksft_print_header() call comes after setup code that can…

--

selftests: xsk: split xskxceiver main() into setup, run and cleanup

This commit splits xskxceiver main() into separate steps for interface
binding, capability detection, test execution and a single cleanup path.
HW ring detection moves into detect_ifobj_caps(), and run_pkt_test() now
returns its result. ksft_print_header() is now called before
ksft_set_plan() so that stdout is line buffered.

> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> index 22a81723d5dea..70a61fb511c8b 100644
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c

[ ... ]

> @@ -2332,6 +2335,13 @@ static int detect_ifobj_caps(struct ifobject *ifobj)
>  		}
>  	}
>  
> +	if (!get_hw_ring_size(ifobj->ifname, &ifobj->ring)) {
> +		ifobj_set_cap(ifobj, XSK_CAP_HW_RING);
> +		ifobj->caps.tx_max_pending = ifobj->ring.tx_max_pending;
> +		ifobj->set_ring.default_tx = ifobj->ring.tx_pending;
> +		ifobj->set_ring.default_rx = ifobj->ring.rx_pending;
> +	}
> +
>  	return 0;
>  }

[Severity: Low]
init_iface() runs detect_ifobj_caps() for both interfaces. Does the RX
ifobject now get XSK_CAP_HW_RING as well?

Before this change, main() only called get_hw_ring_size() for ifobj_tx.
Now cleanup_iface(ifobj_rx) also reaches hw_ring_size_reset() at every
exit:

    static void cleanup_iface(struct ifobject *ifobj)
    {
        if (ifobj_has_cap(ifobj, XSK_CAP_HW_RING))
            hw_ring_size_reset(ifobj);
        ...

That sends ETHTOOL_SRINGPARAM to the RX netdev even though the tests never
changed its rings. A driver that does not short-circuit an unchanged
request could reset its queues here.

The commit message doesn't say that ring handling now covers RX. Was this
intended?

The later patch "selftests: xsk: add a hardware mode to xskxceiver" makes
hw_ring_size_reset() return early when the rings are already at their
defaults. That would make this a no-op for RX by the end of the series.

> diff --git a/tools/testing/selftests/net/lib/xsk/xskxceiver.c b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> index 8b3e4d18e982b..afd6b242aa0df 100644
> --- a/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> +++ b/tools/testing/selftests/net/lib/xsk/xskxceiver.c

[ ... ]

> @@ -373,93 +408,64 @@ int main(int argc, char **argv)
>  
>  	parse_command_line(ifobj_tx, ifobj_rx, argc, argv);
>  

[ ... ]

> +	/* Line-buffer stdout so verdicts reach a capturing launcher live. */
> +	ksft_print_header();
> +	ksft_set_plan(modes * nb_tests);

[Severity: Low]
Should ksft_print_header() be called earlier in main()?

kselftest.h says ksft_print_header() should be the first call. It does
this:

    setvbuf(stdout, NULL, _IOLBF, 0);

    if (!(getenv("KSFT_TAP_LEVEL")))
        printf("TAP version 13\n");

By the time it runs here, main() may already have written to stdout. One
example is when read_procfs_val() fails:

    cache_line_size = read_procfs_val(SMP_CACHE_BYTES_PATH);
    if (!cache_line_size) {
        ksft_print_msg("Can't get SMP_CACHE_BYTES from system, using default (64)\n");
        cache_line_size = 64;
    }

The MAX_SKB_FRAGS fallback is the same. Anything printed from
parse_command_line(), bind_iface() or detect_mode_caps() also comes
before the header.

In those cases the '#' lines appear before the "TAP version 13" line.
setvbuf() is also called after the stream has been used, and ISO C only
defines setvbuf() before any other operation on the stream.

The placement stays the same through the rest of the series. There,
ksft_print_header() runs after setup_peer(), which blocks until the TCP
peer connects, so any earlier output stays buffered until then.

Would it help to move ksft_print_header() to the start of main(),
possibly after the -l handling?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261008114909.734364-1-maciej.fijalkowski%40intel.com

  reply	other threads:[~2026-10-12  8:50 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 11:48 [PATCH v2 net-next 00/14] selftests: net: migrate AF_XDP test suite over to net Maciej Fijalkowski
2026-10-08 11:48 ` [PATCH v2 net-next 01/14] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-10-08 11:48 ` [PATCH v2 net-next 02/14] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-10-09  9:46   ` Björn Töpel
2026-10-09 12:43     ` Maciej Fijalkowski
2026-10-08 11:48 ` [PATCH v2 net-next 03/14] selftests/bpf: drop the test_progs AF_XDP wrapper Maciej Fijalkowski
2026-10-08 11:48 ` [PATCH v2 net-next 04/14] selftests: net: add a generic rule for BPF skeletons Maciej Fijalkowski
2026-10-08 11:49 ` [PATCH v2 net-next 05/14] selftests: xsk: move the AF_XDP test suite to selftests/net Maciej Fijalkowski
2026-10-09 11:18   ` Björn Töpel
2026-10-09 12:46     ` Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 06/14] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-10-08 11:49 ` [PATCH v2 net-next 07/14] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko [this message]
2026-10-08 11:49 ` [PATCH v2 net-next 08/14] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-10-09 11:25   ` Björn Töpel
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 09/14] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 10/14] selftests: xsk: add a hardware mode to xskxceiver Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 11/14] selftests: xsk: pass non-test traffic to the stack in hardware mode Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 12/14] selftests: xsk: share test case definitions with hardware runner Maciej Fijalkowski
2026-10-09 12:12   ` Björn Töpel
2026-10-09 12:52     ` Maciej Fijalkowski
2026-10-08 11:49 ` [PATCH v2 net-next 13/14] selftests: drv-net: test AF_XDP zero-copy with an SKB peer Maciej Fijalkowski
2026-10-08 21:37   ` Jakub Kicinski
2026-10-09 13:13     ` Maciej Fijalkowski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 11:49 ` [PATCH v2 net-next 14/14] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
2026-10-08 21:41   ` Jakub Kicinski
2026-10-12  8:50   ` netdev-bot+sashiko
2026-10-08 21:30 ` [PATCH v2 net-next 00/14] selftests: net: migrate AF_XDP test suite over to net Jakub Kicinski
2026-10-09 12:02   ` Björn Töpel
2026-10-09 13:15     ` Maciej Fijalkowski

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=179179502350.434549.10707133560104619595@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stfomichev@gmail.com \
    --cc=tushar.vyavahare@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox