From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 6B38330C36F; Thu, 16 Oct 2025 07:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760600772; cv=none; b=g3RelwLEEy1lLVuKOcAjO6yz92HgBGGCu/y3m9TP3GKFdmw+Ebyr5p6wRRooAfXyztT94r/XRIrm9UEex3NcxM+sqhhfYuh1K2t2hut+yT83OQLvxDpRm+FtXzkOw+6oq/QYA6CIpRYjpi/HIOkSIloI3pfphIZkr4gjxj+laCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760600772; c=relaxed/simple; bh=gF9eLDsdFl0MFtqsAFZWcBEyY4Q/iUjVarktp2n/spA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YgHLTl5wWSflM5lSAV9LoOoDTlrQ4vT99DvFZdg1QMigcAPFhxQaxL6XxrTjkYFPGB9uFMn9p8Ubn0Xei7Ic+abVbeBLZEx1/O1aLtfCW9olviXHTpSsz2sV7hKQZI8x8cBSRQCzH1+UvCirHjyAw099whjwU6Cg46DplIUqGhE= 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=agNNQGin; arc=none smtp.client-ip=185.246.84.56 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="agNNQGin" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D60B31A1403; Thu, 16 Oct 2025 07:46:08 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A53B86062C; Thu, 16 Oct 2025 07:46:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2902E102F22B9; Thu, 16 Oct 2025 09:46:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1760600767; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=UceLpeKVjdxHZmkAym7kcj/ErVu2YZm4GdUaf7zWckE=; b=agNNQGinyNLBD6Lo5xJjsavClXLwxPx7xqh6bqvua+1OVirnoaXH0kIf5ALbMIbzTnZh5W XhBRGRblppDYaUPIvwN+0HFarCF6M4uMvMm13Tt6iIzhTV8LnthBrY4LgSpPkpiXFXB+p7 rrn4elMUwR0FAOKu+IKA7Q1jk1D9i34vN1iw9v4DRpkCY1v54SgfCnsHwBObgMJSZ5OsKD sHbiraAM++6FIn1aipYVz8z0z/ktj7fPsdGn0gTIzQ3opylxR5RucNvmsOeCzqvVZeJxMY SLTgpSyeRcoZEzoO+DleE6cvIAWpNPX6QqO6hYgi/XKAQ4Q/qpRzNd1zaWZlaw== From: "Bastien Curutchet (eBPF Foundation)" Date: Thu, 16 Oct 2025 09:45:37 +0200 Subject: [PATCH bpf-next v5 08/15] selftests/bpf: test_xsk: Add return value to init_iface() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251016-xsk-v5-8-662c95eb8005@bootlin.com> References: <20251016-xsk-v5-0-662c95eb8005@bootlin.com> In-Reply-To: <20251016-xsk-v5-0-662c95eb8005@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. Reviewed-by: Maciej Fijalkowski 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/selftests/bpf/test_xsk.c index 8fe75845d7a6aa5342229fa419fcbaa411ae9e70..7db1d974e31511e93b05bf70be991cee4cd444c6 100644 --- a/tools/testing/selftests/bpf/test_xsk.c +++ b/tools/testing/selftests/bpf/test_xsk.c @@ -2189,7 +2189,7 @@ static bool hugepages_present(void) return true; } -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; @@ -2199,7 +2199,7 @@ void init_iface(struct ifobject *ifobj, thread_func_t func_ptr) err = xsk_load_xdp_programs(ifobj); if (err) { ksft_print_msg("Error loading XDP program\n"); - exit_with_error(err); + return err; } if (hugepages_present()) @@ -2208,7 +2208,7 @@ void init_iface(struct ifobject *ifobj, thread_func_t func_ptr) err = 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 = true; @@ -2220,6 +2220,8 @@ void init_iface(struct ifobject *ifobj, thread_func_t func_ptr) ifobj->xdp_zc_max_segs = 0; } } + + return 0; } int testapp_send_receive(struct test_spec *test) diff --git a/tools/testing/selftests/bpf/test_xsk.h b/tools/testing/selftests/bpf/test_xsk.h index fb546cab39fdfbd22dcb352784a7c5ef383f8ac6..f4e192264b140c21cc861192fd0df991c46afd24 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); 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/selftests/bpf/xskxceiver.c index 8e108e3162695d5d50b3e3805672601024e385e2..a874f27b590d8ba615e16c612728b2f515ac8dff 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -373,8 +373,11 @@ int main(int argc, char **argv) ifobj_tx->set_ring.default_rx = ifobj_tx->ring.rx_pending; } - 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(); + } test_init(&test, ifobj_tx, ifobj_rx, 0, &tests[0]); tx_pkt_stream_default = pkt_stream_generate(DEFAULT_PKT_CNT, MIN_PKT_SIZE); -- 2.51.0