πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2195

Re: [PATCH v2 net-next 07/14] selftests: xsk: split xskxceiver main() into setup, run and cleanup

#2195
From: netdev-bot+sashiko
Date: Mon, 12 Oct 2026 08:50
123 lines
9996 bytes
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
Technical Details
Message-ID: <179179502350.434549.10707133560104619595@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344816-linux-kernel-netdev=dewy.ru
References: <20261008114909.734364-8-maciej.fijalkowski@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344816-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179179502350.434549.10707133560104619595@kernel.org>
References: <20261008114909.734364-8-maciej.fijalkowski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1723641"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:X1FRyguI0VQWlBqW8IcT5IL8nIU= sha256:THTondAVBTQwh1KWndy+0mwCoFPp6uQ5/LjEyGYM6hY=
	sha1:KhGoHMV7z5WOo1xFZVXsylEUw0M= sha256:Wj7rfihSIWkT+jW/TxVD1v3k9J4XcxzYqfX4DO6tP18=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 1C09910FB44; Mon, 12 Oct 2026 11:56:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.34
X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id wG8eENwGJ1R4;
	Mon, 12 Oct 2026 11:56:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-344816-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B1F0310FB3E; Mon, 12 Oct 2026 11:56:03 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 4227F3EEBB; Mon, 12 Oct 2026 08:50:28 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D6B746D2D2;
	Mon, 12 Oct 2026 08:50:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FAQ1Qmb9"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBD7E45FFC2;
	Mon, 12 Oct 2026 08:50:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791795026; cv=none; b=Hnck/pQ55eFXuz/RubOmOY+BerrV/o0IqaF8TpxTr/1aCg5x4Bx7aLsFw1Evh0lTqLavDC85C4vbPwI9IzLifXvrVnC90JxNrYjhgcxffF0zo46ppaZ7g550x0EyRjm49u+rE+dJOWZbOHoT0AzOqg7ZV+UWV31FBr3Q4B6oWXU=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791795026; c=relaxed/simple;
	bh=7uGwet5vv8QvJLY3RhxVw9iHYoaAWz300rmlo6r+ZbM=;
	h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References:
	 Content-Type:MIME-Version; b=gN/daDrNvmOs0+wIv0oXO3wjIuoC4ukj38Fum3+HMfktMsekhTgRt1CCAm7dMir8oQZhzm+0Pc8+5v2WL5/msvj5WLE5w6VIiobR+B5EDYD/6DAyUnsejukow0++JODVDoaeS3Qv+5YViYa+I9HhUPPVkcrzPk1Ue6BAexjxWt4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FAQ1Qmb9; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF8941F0089C;
	Mon, 12 Oct 2026 08:50:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791795024;
	bh=Ghncp4WAeQBGRLfL+k1KqZhm0oT4aXsC3khHbNyh9IU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=FAQ1Qmb9hTIuOcZUfxzjlk7OMPg4QbiisURsYpSnamnSOetw9Hr5hMhmZxYv78bKi
	 MqZ9LZLOuLZsb4TfxNuFNaIiLug25XIpweW1kUAZLeqSSaza/368QXZedIrfM244eE
	 zzhFya3IWsk6rpsky+DyJCOzYCjPzBnxa/g6DKdB6ghqTv1dBDZpMrB5owcV2ahdUO
	 g3oWlYikc4RT8n5un2EJFZXhg8GGTsNVv1JDK0xTC0YFQ/61HLiNWBNhjRy/dX22Bf
	 nRmAVQ6Kga5qn2Eko7RpF7WVhYjAmm9hGzdF3TkDwnvPwE47Du7dhX+f09oIvT/yP+
	 ZoTEq4sFWlujA==
X-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
X-In-Reply-To: <20261008114909.734364-8-maciej.fijalkowski@intel.com>
X-sashiko-severity: Low
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>