From nobody Fri Oct 3 11:22:24 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 EA0BC2D9491; Tue, 2 Sep 2025 12:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756817649; cv=none; b=eYKPTcUjjJya+0Kc8LSeRu3W+iJh6Uz9D46MXViumyTC061t+LNiluujn7Kz0JYe87XcJ3hdomW7PHuQP8frAgSsURbVDFP4KkEgpA9dt0Tw9ToYUMM8sbKLB6JQ+zDH2G1BzNy14Vp9khMEH1VdYxUTcxMbTaLWHQMAWIu9zF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756817649; c=relaxed/simple; bh=ZTbWD0p3LeAad7RzY7cPeQ4DMNg5Ioa+xEYeOfTOblA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jCExm9X1R97iaXZAvtB84gN1oEmvjAHPmG2h3u9vi7KPUi1YDcoCp/wvy+a209T/3vZMTyPNI8N5d3kgoWjlL70gDRGkbKWRoecWKHR6lJC/sYL8lcTrI0uofPy91/754SI0JnFM4ks5ujAeL3iWF4FB+6Rqwp34bGCTXm9STAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=g9OvcK/J; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="g9OvcK/J" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 6B6C74E40C0F; Tue, 2 Sep 2025 12:54:04 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 42A1760695; Tue, 2 Sep 2025 12:54:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0CBD51C22D253; Tue, 2 Sep 2025 14:53:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756817643; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Y6OC0KlKri3ggVyKJQWtc/or6xq8M50Bxw3DLncJ/9o=; b=g9OvcK/J4NdiBl9ffa7nek+8/j3B4umcZuUtsJ3uxb013QjS7K6zoOmEzdZhrns4V0Ppa+ iwZHnCqbRNfP3kmGeOo4yJGMxcwB9s4oACEQmwCToNy+smSN+I0NVVnXsD3w8tUe+Z4UAN Ynu7UlnXf09yrXbbXOzIU5V93zOnzLtaafYoJ0FsR957NcNSQA6BAWYOu4cDub0Nndsmmv SVkIFQrXoUrUjR4UBT1u9Zh2jIVtv2KaPGk7xjZTy+0toRjQEX1AW5KZedOxred6Y6lULT bHddo1UAFdBXRwwCR7eJr29i6Pa1liHIRu1MU7s1318q4LNIPqp59yc1L4gCSw== From: "Bastien Curutchet (eBPF Foundation)" Date: Tue, 02 Sep 2025 14:49:56 +0200 Subject: [PATCH bpf-next v2 06/14] selftests/bpf: test_xsk: Add return value to init_iface() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250902-xsk-v2-6-17c6345d5215@bootlin.com> References: <20250902-xsk-v2-0-17c6345d5215@bootlin.com> In-Reply-To: <20250902-xsk-v2-0-17c6345d5215@bootlin.com> To: =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: Thomas Petazzoni , Alexis Lothore , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (eBPF Foundation)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 init_iface() doesn't have any return value while it can fail. In case of failure it calls exit_on_error() which exits the application immediately. This prevents the following tests from being run and isn't compliant with the CI Add a return value to init_iface() so errors can be handled more smoothly. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/test_xsk.c | 8 +++++--- tools/testing/selftests/bpf/test_xsk.h | 2 +- tools/testing/selftests/bpf/xskxceiver.c | 7 +++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftes= ts/bpf/test_xsk.c index 074cb8f9487e489834b4bd081cb58b51c73c3b75..5019172a5c5eeb32be4e5026b8a= 7f9e56997c10d 100644 --- a/tools/testing/selftests/bpf/test_xsk.c +++ b/tools/testing/selftests/bpf/test_xsk.c @@ -2210,7 +2210,7 @@ static bool hugepages_present(void) return true; } =20 -void init_iface(struct ifobject *ifobj, thread_func_t func_ptr) +int init_iface(struct ifobject *ifobj, thread_func_t func_ptr) { LIBBPF_OPTS(bpf_xdp_query_opts, query_opts); int err; @@ -2220,7 +2220,7 @@ void init_iface(struct ifobject *ifobj, thread_func_t= func_ptr) err =3D xsk_load_xdp_programs(ifobj); if (err) { ksft_print_msg("Error loading XDP program\n"); - exit_with_error(err); + return err; } =20 if (hugepages_present()) @@ -2229,7 +2229,7 @@ void init_iface(struct ifobject *ifobj, thread_func_t= func_ptr) err =3D bpf_xdp_query(ifobj->ifindex, XDP_FLAGS_DRV_MODE, &query_opts); if (err) { ksft_print_msg("Error querying XDP capabilities\n"); - exit_with_error(-err); + return err; } if (query_opts.feature_flags & NETDEV_XDP_ACT_RX_SG) ifobj->multi_buff_supp =3D true; @@ -2241,6 +2241,8 @@ void init_iface(struct ifobject *ifobj, thread_func_t= func_ptr) ifobj->xdp_zc_max_segs =3D 0; } } + + return 0; } =20 int testapp_send_receive(struct test_spec *test) diff --git a/tools/testing/selftests/bpf/test_xsk.h b/tools/testing/selftes= ts/bpf/test_xsk.h index fb546cab39fdfbd22dcb352784a7c5ef383f8ac6..f4e192264b140c21cc861192fd0= df991c46afd24 100644 --- a/tools/testing/selftests/bpf/test_xsk.h +++ b/tools/testing/selftests/bpf/test_xsk.h @@ -137,7 +137,7 @@ struct ifobject { }; struct ifobject *ifobject_create(void); void ifobject_delete(struct ifobject *ifobj); -void init_iface(struct ifobject *ifobj, thread_func_t func_ptr); +int init_iface(struct ifobject *ifobj, thread_func_t func_ptr); =20 int xsk_configure_umem(struct ifobject *ifobj, struct xsk_umem_info *umem,= void *buffer, u64 size); int xsk_configure_socket(struct xsk_socket_info *xsk, struct xsk_umem_info= *umem, diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selft= ests/bpf/xskxceiver.c index f4d0071a8f5c5b168d4ac7ac76dc46cb4cdda3cb..20ae62b7014427929e55e10b274= 757a95897ff1e 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -358,8 +358,11 @@ int main(int argc, char **argv) ifobj_tx->set_ring.default_rx =3D ifobj_tx->ring.rx_pending; } =20 - init_iface(ifobj_rx, worker_testapp_validate_rx); - init_iface(ifobj_tx, worker_testapp_validate_tx); + if (init_iface(ifobj_rx, worker_testapp_validate_rx) || + init_iface(ifobj_tx, worker_testapp_validate_tx)) { + ksft_print_msg("Error : can't initialize interfaces\n"); + ksft_exit_xfail(); + } =20 test_init(&test, ifobj_tx, ifobj_rx, 0, &tests[0]); tx_pkt_stream_default =3D pkt_stream_generate(DEFAULT_PKT_CNT, MIN_PKT_SI= ZE); --=20 2.50.1