From patchwork Wed Feb 19 23:49:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983118 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5A5F31D90DD for ; Wed, 19 Feb 2025 23:50:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009007; cv=none; b=VGhX8OPUbUhUpt4bmRas2TjzDJVSmrK5rEfJElR1tY9dMH2YppAXljbikA5loKAgkDCT0qXuCoTbbZPBwn9VofqoIzaooDjZxP8UNHCDJHfHsgKpmyx7rEuTphtt5x9QB/9KUGdWHbD2qoGVdtxn9m/SG/P3IOy2NH7mQCnUJ4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009007; c=relaxed/simple; bh=xRodrAo4PZVNtXrremI9YzEr1LLiubNcdKDAjvpmDPU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b94RmSEgTBufYh6qFhL4GRFy51fGyEvFPMs44N0EnBiSfFnJuLLytamxnU6qds3VxE//QBqD6ex2CgpSpCyP4T1B5Grg3vsCNj+EullkZyV75XaBuJrvyZrTzM9+6aNLjIkTJsOCoOFrO3tiUj/WEKO2Fd0+9Emd9sfu48JFNMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q0tk7XUw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q0tk7XUw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87812C4CEE8; Wed, 19 Feb 2025 23:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009006; bh=xRodrAo4PZVNtXrremI9YzEr1LLiubNcdKDAjvpmDPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0tk7XUwaMbOGWl8iQLfwej3L7qFUT37SEOhdj6qv2HiDeOv68fKZl7/GooS2rKpe hYNryBdMw2iFA+/FsG6kxfcygK7sf3IJiXg86uegcPZMzrgBnd9/dk8UrTX1ihhTcq 6Oea2aArzkgR08jY0clFcla1UgPWyS1yFjNmhy8CGd1Ia2B4gL4je9qb+OQFdY06us LboheZ9ZY+6hC5ij+0wnGViX0wYYyrYw6F/utr8k86FV6aXtyl1JnKi8LhP8LKHrJu F1ClZVidS09d+x5uUPP6yywJ1SRno+j+5se/yAy8vSTb3BCKyMfvZa+mSGX62iLEmE epnKhO7S5tfxQ== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski Subject: [PATCH net-next v2 1/7] selftests: drv-net: add a warning for bkg + shell + terminate Date: Wed, 19 Feb 2025 15:49:50 -0800 Message-ID: <20250219234956.520599-2-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Joe Damato reports that some shells will fork before running the command when python does "sh -c $cmd", while bash does an exec of $cmd directly. This will have implications for our ability to terminate the child process on bash vs other shells. Warn about using bkg(... shell=True, termininate=True) most background commands can hopefully exit cleanly (exit_wait). Link: https://lore.kernel.org/Z7Yld21sv_Ip3gQx@LQ3V64L9R2 Signed-off-by: Jakub Kicinski Acked-by: Stanislav Fomichev Acked-by: Joe Damato --- v2: new --- tools/testing/selftests/net/lib/py/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py index 9e3bcddcf3e8..33b153767d89 100644 --- a/tools/testing/selftests/net/lib/py/utils.py +++ b/tools/testing/selftests/net/lib/py/utils.py @@ -61,6 +61,10 @@ import time self.terminate = not exit_wait self.check_fail = fail + if shell and self.terminate: + print("# Warning: combining shell and terminate is risky!") + print("# SIGTERM may not reach the child on zsh/ksh!") + def __enter__(self): return self From patchwork Wed Feb 19 23:49:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983120 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BE90625E479 for ; Wed, 19 Feb 2025 23:50:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009007; cv=none; b=fRAzo2kdD15sUKrbJK0fq8C198iJ8YOmc+ewp9gsioH+ygAc8x4S9vAwoWw1Xj6gmMdOvcVQzysJvQ2x2yyQWeVy3SZXC/tJ3zpPqKJlTiN2pOdD2M3xA3nVWK73Vy3K2MoG1p71sy392uAjwLGlVosjGdZoeW9H/PKZEqoZDic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009007; c=relaxed/simple; bh=xEF9eVoNLJJNZj4PWeSjK79kfLFLXYFafxa5opxCOYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mSvQvDRJkbBczaYaTDA/MKxzMkKK/3JtB9YtszehRT6dlK9NVXk9o03RbbJ/Nj6ju/5yQX8DZvAsqsAHBP1jKkRoeOTuGeBmhiGEnjhQKOHvd4cSOyfXEzOMI3FQFuZkJ8kHvHu5hXhOqp1Rho1AbwX8xuRsxPzziDHWAkEO0uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mn7FhBCv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mn7FhBCv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 030A7C4CED6; Wed, 19 Feb 2025 23:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009007; bh=xEF9eVoNLJJNZj4PWeSjK79kfLFLXYFafxa5opxCOYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mn7FhBCvzHK448m7QSPiEVQW8vqeLLDoBCUhkpQ1DFZFC68VpUmba1smK2PHkVNya bisnxHa20J0EWbSyTtaYPi1oWkDfpcGNlQbWjoxCwkc10pIA9WrhQkWD7sFtmP1J6C bPNoBvVDyIjTUczyZCKzi5btB6a5HFSEbo1c/PgBOJi1v50TERip/knOl2SseQn/Ts nK5g5eZJ1oZAuW1sLvbqAg+o4sGeWteKi61HuTf2a6aa9/wyUgxIFDIIGumgyG0VuH THg8v3ydPvva4ZC4ER4HXG3eeKv5EeBPNIL03oI+9hIGBdrXxlsDBx/XW8KHw9zpFX Y1fKampqQd4DQ== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski , Stanislav Fomichev Subject: [PATCH net-next v2 2/7] selftests: drv-net: use cfg.rpath() in netlink xsk attr test Date: Wed, 19 Feb 2025 15:49:51 -0800 Message-ID: <20250219234956.520599-3-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The cfg.rpath() helper was been recently added to make formatting paths for helper binaries easier. Acked-by: Stanislav Fomichev Reviewed-by: Joe Damato Signed-off-by: Jakub Kicinski --- tools/testing/selftests/drivers/net/queues.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index 5fdfebc6415f..b6896a57a5fd 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -25,8 +25,7 @@ import subprocess return None def check_xdp(cfg, nl, xdp_queue_id=0) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - xdp = subprocess.Popen([f"{test_dir}/xdp_helper", f"{cfg.ifindex}", f"{xdp_queue_id}"], + xdp = subprocess.Popen([cfg.rpath("xdp_helper"), f"{cfg.ifindex}", f"{xdp_queue_id}"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, text=True) defer(xdp.kill) From patchwork Wed Feb 19 23:49:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983121 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E1D5A25EF9E for ; Wed, 19 Feb 2025 23:50:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009008; cv=none; b=bGSmv4Le7mIayBqWwJTtI6KVpCYcDtTdGzIVMnG39Ambrb8gMzUTPGtDPifAMMenJ8HDba24oIdMpR3G+Jg+MSq68BNIZ/3bK8EF12TuRk9P/hRvWE96wgXTZdRcVpyBVub56AeSh7mITGsryfCjJHyKboyV/FTLTYlfuTQmdj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009008; c=relaxed/simple; bh=1hyPeEUQJOrUxdLW7+wOWF2R4EzxRYyTXbSZDA98AfY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bGhPjLGTCpzhA3HfGBdSrcsTk8IditxTmgLd86Cc9VAkGJfPkF/z4Chjz3qPkwtubKgumOkUb8/zw29vqhgRpNveQJN0vatuhyklhZLdFPltWs2ic2KIVwZegGEj3iHQWHDmDRrBFjqZ885cdWwvy2xc/cBQ4Cju3Ev3zt7fcHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L9uuL6pC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L9uuL6pC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7629DC4CEE0; Wed, 19 Feb 2025 23:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009007; bh=1hyPeEUQJOrUxdLW7+wOWF2R4EzxRYyTXbSZDA98AfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9uuL6pC/pKvRZl6uqnUKrEMD+XgZncWpO4Gux34/0hMzG8lKbFSEjtkkQSpX0kkL UnYRghxG1dLmrEvRYaHCF5jxsVcwTCPl52u9+mo3UAkO5a+LhZxfrEaXVBWHxGJbzl hzvhIcP0iXB0uz9O9fChRFe1sHofaAMTkYjT+Qbzo9VJD0lrEgB9Xj7rmqJOo6U2IV o5m1o3HiRAPj+BHJLm9WqGXEGjfd8IUnb0G3cnO9tWXA7w0a5k9E5U+S+5GLwBQtzC K5jg1dm8TN3JkyzToL0EUCToFkKclhvuJatj+rHEQQ0+hLW8smC2Tmpo/MuOVaCQsn Z3NSkMv2isO9Q== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski Subject: [PATCH net-next v2 3/7] selftests: drv-net: add missing new line in xdp_helper Date: Wed, 19 Feb 2025 15:49:52 -0800 Message-ID: <20250219234956.520599-4-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Kurt and Joe report missing new line at the end of Usage. Signed-off-by: Jakub Kicinski Reviewed-by: Kurt Kanzenbach Reviewed-by: Joe Damato --- v2: new --- tools/testing/selftests/drivers/net/xdp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/net/xdp_helper.c b/tools/testing/selftests/drivers/net/xdp_helper.c index cf06a88b830b..80f86c2fe1a5 100644 --- a/tools/testing/selftests/drivers/net/xdp_helper.c +++ b/tools/testing/selftests/drivers/net/xdp_helper.c @@ -35,7 +35,7 @@ int main(int argc, char **argv) char byte; if (argc != 3) { - fprintf(stderr, "Usage: %s ifindex queue_id", argv[0]); + fprintf(stderr, "Usage: %s ifindex queue_id\n", argv[0]); return 1; } From patchwork Wed Feb 19 23:49:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983122 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B6287261374 for ; Wed, 19 Feb 2025 23:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009008; cv=none; b=nCMTONyq0tr3lpDAW48Jdo6Sc749smH2ShwZivUoyLA2B9dxvA5V4Hs7Q3h06QW0WhYreQB9kv800bj0vwXo65hyxiEZ3SmgabOrS3kKlJIPTtIc+bXC4Nzqd6LftJKT2oJjF6NiueVXJX5Uaug35uzS9rVeyquCHi8n8zc8o00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009008; c=relaxed/simple; bh=v32lsHci1PVLTqi40mkM0/19cem5qNbUt9NgLOzCZPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JG5qHlm9LMt4NMohfioY8cShEOX/8WFADcUXn/nNnGDzEM7qXdFXU5YpXa0cI9ZqFhrZOMtMajiAn9V2YFsdz9x3uf1J4ZI/c9sR5++XSUbwPROsW9HBJmH22NiouxFZTB8IqzCNpxL2+PYs16Ev1WSlL44uU9+Va5ke3QgKPz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Nyd0+8UH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Nyd0+8UH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5C17C4CED6; Wed, 19 Feb 2025 23:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009008; bh=v32lsHci1PVLTqi40mkM0/19cem5qNbUt9NgLOzCZPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nyd0+8UHcTPpII1B/TbLu2hWC03NAG9dqGkFYkG7fFBIoyNqSfRl3BRB4MB3xjm/U jkAfi0HzBtVSeBtIM/fWiKWTFRq456c8Qt1zf9ErjmEk5PTc/yIo+453ZQ0vs+Ql7z WpF1peom0lQLt9bJ5vdShG1AAwGK9MwOE18ZvHFJ8kasTCPFwPC0DYcLgVQUfNZ7jD 8NeNJubOEdelxbWCRLN7Xzi3+609WAsTF27ouCOs8TGjjUVq42Tc3jwL/R79FbH+v5 2CuEuRBPTYofSq1pT9sEfpuZbikp1Q5dPLuImiNOoqQhu3xoOaeeHZAshKcHODcXwm 4SprVxVf70Z/Q== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski Subject: [PATCH net-next v2 4/7] selftests: drv-net: probe for AF_XDP sockets more explicitly Date: Wed, 19 Feb 2025 15:49:53 -0800 Message-ID: <20250219234956.520599-5-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Separate the support check from socket binding for easier refactoring. Use: ./helper - - just to probe if we can open the socket. Signed-off-by: Jakub Kicinski Acked-by: Stanislav Fomichev Reviewed-by: Joe Damato --- v2: new --- tools/testing/selftests/drivers/net/xdp_helper.c | 7 +++++++ tools/testing/selftests/drivers/net/queues.py | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/drivers/net/xdp_helper.c b/tools/testing/selftests/drivers/net/xdp_helper.c index 80f86c2fe1a5..2bad3b4d616c 100644 --- a/tools/testing/selftests/drivers/net/xdp_helper.c +++ b/tools/testing/selftests/drivers/net/xdp_helper.c @@ -50,6 +50,13 @@ int main(int argc, char **argv) return 1; } + /* "Probing mode", just checking if AF_XDP sockets are supported */ + if (!strcmp(argv[1], "-") && !strcmp(argv[2], "-")) { + printf("AF_XDP support detected\n"); + close(sock_fd); + return 0; + } + ifindex = atoi(argv[1]); queue = atoi(argv[2]); diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index b6896a57a5fd..0c959b2eb618 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -25,6 +25,13 @@ import subprocess return None def check_xdp(cfg, nl, xdp_queue_id=0) -> None: + # Probe for support + xdp = cmd(cfg.rpath("xdp_helper") + ' - -', fail=False) + if xdp.ret == 255: + raise KsftSkipEx('AF_XDP unsupported') + elif xdp.ret > 0: + raise KsftFailEx('unable to create AF_XDP socket') + xdp = subprocess.Popen([cfg.rpath("xdp_helper"), f"{cfg.ifindex}", f"{xdp_queue_id}"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, text=True) @@ -33,11 +40,6 @@ import subprocess stdout, stderr = xdp.communicate(timeout=10) rx = tx = False - if xdp.returncode == 255: - raise KsftSkipEx('AF_XDP unsupported') - elif xdp.returncode > 0: - raise KsftFailEx('unable to create AF_XDP socket') - queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True) if not queues: raise KsftSkipEx("Netlink reports no queues") From patchwork Wed Feb 19 23:49:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983123 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 44452262D03 for ; Wed, 19 Feb 2025 23:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009009; cv=none; b=lPLYa34zLz4P6rpZkaRDg/8FmQaIUffGaL94JiQtVKp5h2MlVJOhb5UpouuDV0JDNtEFsOyyehv4Komn6fZoLoVaAYA1A3CKYRM8EgUMMqobEhrZopFA/kY7uui8G36jEwKTrxAlWUgkdPKrgNS+qCeUzZc9eNd9L7aF660ennA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009009; c=relaxed/simple; bh=Tidh1f5P7ToYJXFwCAZTxT4/rDuyIXFFaVMp6l1vTT8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lin4mgRwmUO9HrKFuKoM8D003bOtHBg5Qgy2K0wIVJ5YXXEsjLuLnzk63owp0ArEJItI6f5GDNgjwjuFz8Xi26vhfES0j72DiTxhUrQLsrzEhNxD2tRoSYThowCysEUQqYeFfN/JNCj3TLxCazvg8GLGsegkPOlGH0KXGgxl9sk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ShR5ZXgw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ShR5ZXgw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE3AC4CEEB; Wed, 19 Feb 2025 23:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009008; bh=Tidh1f5P7ToYJXFwCAZTxT4/rDuyIXFFaVMp6l1vTT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ShR5ZXgwLHZzx/2FsMyx3FscxtXLMjboYW+mZOtcg9Nn/LC1zGPg3LIBwwYoKFnZj sZck8veatL9FiECp0gEzjVKarPkUATwDgnzqsPj4LanLD4iMyOFR/QjrI9QXuLd4YY mUWUjDdi/qzuee2j8HAuumjb53EbcG5BuLDrwRaatRg1F+pEiISEpifAFsOsORqpl6 uRyVAZzxpJX4A8UPk206SbElgNPo7x+6w4Eh0GMHhmn1eO00l9HB7uw6O1hu2L/Ll7 COcgBBj5LqVTzbYNmzGeBrZFywocMcOM6J9oMZxmGjBYGwdAE4xADE0Q19LvD6siGA Nnhko69RXzOWg== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski Subject: [PATCH net-next v2 5/7] selftests: drv-net: add a way to wait for a local process Date: Wed, 19 Feb 2025 15:49:54 -0800 Message-ID: <20250219234956.520599-6-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org We use wait_port_listen() extensively to wait for a process we spawned to be ready. Not all processes will open listening sockets. Add a method of explicitly waiting for a child to be ready. Pass a FD to the spawned process and wait for it to write a message to us. FD number is passed via KSFT_READY_FD env variable. Similarly use KSFT_WAIT_FD to let the child process for a sign that we are done and child should exit. Sending a signal to a child with shell=True can get tricky. Make use of this method in the queues test to make it less flaky. Signed-off-by: Jakub Kicinski Acked-by: Stanislav Fomichev Acked-by: Joe Damato --- v2: - use fd for exit, too - warn if env variables are bad v1: https://lore.kernel.org/20250218195048.74692-3-kuba@kernel.org --- .../selftests/drivers/net/xdp_helper.c | 54 +++++++++++++-- tools/testing/selftests/drivers/net/queues.py | 43 ++++++------ tools/testing/selftests/net/lib/py/utils.py | 68 +++++++++++++++++-- 3 files changed, 133 insertions(+), 32 deletions(-) diff --git a/tools/testing/selftests/drivers/net/xdp_helper.c b/tools/testing/selftests/drivers/net/xdp_helper.c index 2bad3b4d616c..aeed25914104 100644 --- a/tools/testing/selftests/drivers/net/xdp_helper.c +++ b/tools/testing/selftests/drivers/net/xdp_helper.c @@ -14,6 +14,54 @@ #define UMEM_SZ (1U << 16) #define NUM_DESC (UMEM_SZ / 2048) +/* Move this to a common header when reused! */ +static void ksft_ready(void) +{ + const char msg[7] = "ready\n"; + char *env_str; + int fd; + + env_str = getenv("KSFT_READY_FD"); + if (env_str) { + fd = atoi(env_str); + if (!fd) { + fprintf(stderr, "invalid KSFT_READY_FD = '%s'\n", + env_str); + return; + } + } else { + fd = STDOUT_FILENO; + } + + write(fd, msg, sizeof(msg)); + if (fd != STDOUT_FILENO) + close(fd); +} + +static void ksft_wait(void) +{ + char *env_str; + char byte; + int fd; + + env_str = getenv("KSFT_WAIT_FD"); + if (env_str) { + fd = atoi(env_str); + if (!fd) { + fprintf(stderr, "invalid KSFT_WAIT_FD = '%s'\n", + env_str); + return; + } + } else { + /* Not running in KSFT env, wait for input from STDIN instead */ + fd = STDIN_FILENO; + } + + read(fd, &byte, sizeof(byte)); + if (fd != STDIN_FILENO) + close(fd); +} + /* this is a simple helper program that creates an XDP socket and does the * minimum necessary to get bind() to succeed. * @@ -32,7 +80,6 @@ int main(int argc, char **argv) int ifindex; int sock_fd; int queue; - char byte; if (argc != 3) { fprintf(stderr, "Usage: %s ifindex queue_id\n", argv[0]); @@ -92,13 +139,12 @@ int main(int argc, char **argv) return 1; } - /* give the parent program some data when the socket is ready*/ - fprintf(stdout, "%d\n", sock_fd); + ksft_ready(); + ksft_wait(); /* parent program will write a byte to stdin when its ready for this * helper to exit */ - read(STDIN_FILENO, &byte, 1); close(sock_fd); return 0; diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index 0c959b2eb618..7af2adb61c25 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -5,13 +5,12 @@ from lib.py import ksft_disruptive, ksft_exit, ksft_run from lib.py import ksft_eq, ksft_raises, KsftSkipEx, KsftFailEx from lib.py import EthtoolFamily, NetdevFamily, NlError from lib.py import NetDrvEnv -from lib.py import cmd, defer, ip +from lib.py import bkg, cmd, defer, ip import errno import glob import os import socket import struct -import subprocess def sys_get_queues(ifname, qtype='rx') -> int: folders = glob.glob(f'/sys/class/net/{ifname}/queues/{qtype}-*') @@ -32,32 +31,30 @@ import subprocess elif xdp.ret > 0: raise KsftFailEx('unable to create AF_XDP socket') - xdp = subprocess.Popen([cfg.rpath("xdp_helper"), f"{cfg.ifindex}", f"{xdp_queue_id}"], - stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, - text=True) - defer(xdp.kill) + with bkg(f'{cfg.rpath("xdp_helper")} {cfg.ifindex} {xdp_queue_id}', + ksft_wait=3): - stdout, stderr = xdp.communicate(timeout=10) - rx = tx = False + rx = tx = False - queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True) - if not queues: - raise KsftSkipEx("Netlink reports no queues") + queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True) + if not queues: + raise KsftSkipEx("Netlink reports no queues") - for q in queues: - if q['id'] == 0: - if q['type'] == 'rx': - rx = True - if q['type'] == 'tx': - tx = True + for q in queues: + if q['id'] == 0: + if q['type'] == 'rx': + rx = True + if q['type'] == 'tx': + tx = True - ksft_eq(q['xsk'], {}) - else: - if 'xsk' in q: - _fail("Check failed: xsk attribute set.") + ksft_eq(q['xsk'], {}) + else: + if 'xsk' in q: + _fail("Check failed: xsk attribute set.") + + ksft_eq(rx, True) + ksft_eq(tx, True) - ksft_eq(rx, True) - ksft_eq(tx, True) def get_queues(cfg, nl) -> None: snl = NetdevFamily(recv_size=4096) diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py index 33b153767d89..d879700ef2b9 100644 --- a/tools/testing/selftests/net/lib/py/utils.py +++ b/tools/testing/selftests/net/lib/py/utils.py @@ -2,8 +2,10 @@ import errno import json as _json +import os import random import re +import select import socket import subprocess import time @@ -15,21 +17,56 @@ import time self.cmd = cmd_obj +def fd_read_timeout(fd, timeout): + rlist, _, _ = select.select([fd], [], [], timeout) + if rlist: + return os.read(fd, 1024) + else: + raise TimeoutError("Timeout waiting for fd read") + + class cmd: - def __init__(self, comm, shell=True, fail=True, ns=None, background=False, host=None, timeout=5): + """ + Execute a command on local or remote host. + + Use bkg() instead to run a command in the background. + """ + def __init__(self, comm, shell=True, fail=True, ns=None, background=False, + host=None, timeout=5, ksft_wait=None): if ns: comm = f'ip netns exec {ns} ' + comm self.stdout = None self.stderr = None self.ret = None + self.ksft_term_fd = None self.comm = comm if host: self.proc = host.cmd(comm) else: + # ksft_wait lets us wait for the background process to fully start, + # we pass an FD to the child process, and wait for it to write back. + # Similarly term_fd tells child it's time to exit. + pass_fds = () + env = os.environ.copy() + if ksft_wait is not None: + rfd, ready_fd = os.pipe() + wait_fd, self.ksft_term_fd = os.pipe() + pass_fds = (ready_fd, wait_fd, ) + env["KSFT_READY_FD"] = str(ready_fd) + env["KSFT_WAIT_FD"] = str(wait_fd) + self.proc = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, pass_fds=pass_fds, + env=env) + if ksft_wait is not None: + os.close(ready_fd) + os.close(wait_fd) + msg = fd_read_timeout(rfd, ksft_wait) + os.close(rfd) + if not msg: + raise Exception("Did not receive ready message") if not background: self.process(terminate=False, fail=fail, timeout=timeout) @@ -37,6 +74,8 @@ import time if fail is None: fail = not terminate + if self.ksft_term_fd: + os.write(self.ksft_term_fd, b"1") if terminate: self.proc.terminate() stdout, stderr = self.proc.communicate(timeout) @@ -54,11 +93,30 @@ import time class bkg(cmd): + """ + Run a command in the background. + + Examples usage: + + Run a command on remote host, and wait for it to finish. + This is usually paired with wait_port_listen() to make sure + the command has initialized: + + with bkg("socat ...", exit_wait=True, host=cfg.remote) as nc: + ... + + Run a command and expect it to let us know that it's ready + by writing to a special file descriptor passed via KSFT_READY_FD. + Command will be terminated when we exit the context manager: + + with bkg("my_binary", ksft_wait=5): + """ def __init__(self, comm, shell=True, fail=None, ns=None, host=None, - exit_wait=False): + exit_wait=False, ksft_wait=None): super().__init__(comm, background=True, - shell=shell, fail=fail, ns=ns, host=host) - self.terminate = not exit_wait + shell=shell, fail=fail, ns=ns, host=host, + ksft_wait=ksft_wait) + self.terminate = not exit_wait and not ksft_wait self.check_fail = fail if shell and self.terminate: From patchwork Wed Feb 19 23:49:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983124 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4EA7625E479 for ; Wed, 19 Feb 2025 23:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009009; cv=none; b=kYDeAo/yiUvyCiZwQ3J4Mp1KjLu4IYYjVh618TNq47kFKrLLtKcmUhyvg7+9yI6A6GaEzrbjNDD6/ujA+VgkTdRMIZKXVI08mZw3jL/xdpSamKKJASPFkrt5xaCrZDAkQDBxYy17jhySQS0ZzhB/ALP8fxhxrEPO86vHz206YO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009009; c=relaxed/simple; bh=K92hjK5SPjER4n4Havay7VhRL//p46mV6wd8UCB7zOE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rhz+MazErtJWucO6fApQYjT9uw/gJgmeQmezS/pCyEku8uJBA0lAJ13XIuGQjxCmUWIi5lWqNHPHeiXMlyyjHK0TZUoEfA3lklOP1z4yHq2myhAkFN49Wp17FI5zEv3I0BDqxXAO8IwDYUCrOPvQ+I6ntUj5L3sCe1K4W52jAGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MzG/R12I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MzG/R12I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC7A6C4CEE8; Wed, 19 Feb 2025 23:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009009; bh=K92hjK5SPjER4n4Havay7VhRL//p46mV6wd8UCB7zOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MzG/R12Ia4lk7X9hQl/FcBQygZ9id5Sb/lvfJQ7uC9zRDzf4lJiRu8ZNpGdyaeCVk LrEAUEEVD/N2e15pAlN/wVGBshyDKwyP833kM89LgyfKKaypAWrX2khOJDKGFwYB/W P7X5PdujcokFt9l5laYXpX6oS40+rMvpKxaT42E3FuYWT7Chb926qqG1QHO+mtNpgN f1Uu//2pIKlpvyKIpKJ05W44ufxICs61/noRbRwOsdqhdhipKWzcHh+zZgAmSxiz7n iSKYf2EVo1z9zH7PgblamFBx5KFhuUgDkxXrD/Sf3FeoBaK47qIDvxBg4wK+NSmqdw rJa+gspc6hfJg== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski , Stanislav Fomichev Subject: [PATCH net-next v2 6/7] selftests: drv-net: improve the use of ksft helpers in XSK queue test Date: Wed, 19 Feb 2025 15:49:55 -0800 Message-ID: <20250219234956.520599-7-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Avoid exceptions when xsk attr is not present, and add a proper ksft helper for "not in" condition. Acked-by: Stanislav Fomichev Reviewed-by: Joe Damato Signed-off-by: Jakub Kicinski Tested-by: Kurt Kanzenbach --- tools/testing/selftests/drivers/net/queues.py | 9 +++++---- tools/testing/selftests/net/lib/py/ksft.py | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index 7af2adb61c25..a49f1a146e28 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 from lib.py import ksft_disruptive, ksft_exit, ksft_run -from lib.py import ksft_eq, ksft_raises, KsftSkipEx, KsftFailEx +from lib.py import ksft_eq, ksft_not_in, ksft_raises, KsftSkipEx, KsftFailEx from lib.py import EthtoolFamily, NetdevFamily, NlError from lib.py import NetDrvEnv from lib.py import bkg, cmd, defer, ip @@ -47,10 +47,11 @@ import struct if q['type'] == 'tx': tx = True - ksft_eq(q['xsk'], {}) + ksft_eq(q.get('xsk', None), {}, + comment="xsk attr on queue we configured") else: - if 'xsk' in q: - _fail("Check failed: xsk attribute set.") + ksft_not_in('xsk', q, + comment="xsk attr on queue we didn't configure") ksft_eq(rx, True) ksft_eq(tx, True) diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py index 3efe005436cd..fd23349fa8ca 100644 --- a/tools/testing/selftests/net/lib/py/ksft.py +++ b/tools/testing/selftests/net/lib/py/ksft.py @@ -71,6 +71,11 @@ KSFT_DISRUPTIVE = True _fail("Check failed", a, "not in", b, comment) +def ksft_not_in(a, b, comment=""): + if a in b: + _fail("Check failed", a, "in", b, comment) + + def ksft_is(a, b, comment=""): if a is not b: _fail("Check failed", a, "is not", b, comment) From patchwork Wed Feb 19 23:49:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13983125 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1EACE264601 for ; Wed, 19 Feb 2025 23:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009010; cv=none; b=D8dAGVvGYLegdst0+Pt0hGflU4weij2Ib+3PNG5WJMZBh/AybhA/4R/fGIie6Io6G5iLrFBYxdujQ4HGaiO32CcY2dHKn7Rw7bu/YN41hJ+kukP7MSk/dYzH5mIU4G12YyinovYClUQW2MZ6iUFGV/lHy648uS2pub/zzEqvuIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740009010; c=relaxed/simple; bh=PUWCN/zDo+dSpf3wfrOCdFXZvEgrKymfubjaDAw6GQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YrzNtwtdRgIWkqam5A9nNrziiydJuILJnWHmFWqL8MunZduUr/DuNvdWf8JEqqk2S4EeKkO0fyyJbEeL55MZlDM3dZ/daJIRB2tWP4npOx1xZOELytiwUVi0R6IVo2zLjhuAt27h9jf7v2KyoGd3pwSe6R9pLS1wbpw7O2Gmpbc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RBfqJJnK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RBfqJJnK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51863C4CED1; Wed, 19 Feb 2025 23:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740009009; bh=PUWCN/zDo+dSpf3wfrOCdFXZvEgrKymfubjaDAw6GQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBfqJJnKbZy/CwvlmFdKlqzX3jdIWlJpu0NrzwigJSqI8tJov+WCcmJPSIX6J2TE9 H94FU+Ew5kiDOb3PM9ZoQzpPmOl8yTWZ0jFQCJnd0AVmQnS8tDvb8glANho2F2Xrx9 8e6x/T4ku9vpF79ZLoCfpjumZDxWMCeUzCtqE8JVghJxUjQsM/H+7Fqrf7TgJAOB+R UoLMYvGpNj0zXgNX8lXNk8DUz4ska50XAKHAWHa88S+H3qcJjTWWS+OIdvEFcnZ51n 9/CsOpNqPFoS3St8daHd/hCy5L2tB/EkL2WzwlX+G4wjWZB26tE9yq1cx92KEaT+3/ lKWj0+RdOGPaA== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, jdamato@fastly.com, stfomichev@gmail.com, petrm@nvidia.com, Jakub Kicinski , Stanislav Fomichev Subject: [PATCH net-next v2 7/7] selftests: drv-net: rename queues check_xdp to check_xsk Date: Wed, 19 Feb 2025 15:49:56 -0800 Message-ID: <20250219234956.520599-8-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219234956.520599-1-kuba@kernel.org> References: <20250219234956.520599-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The test is for AF_XDP, we refer to AF_XDP as XSK. Acked-by: Stanislav Fomichev Reviewed-by: Joe Damato Signed-off-by: Jakub Kicinski --- tools/testing/selftests/drivers/net/queues.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index a49f1a146e28..9040baf7b726 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -23,7 +23,8 @@ import struct return len([q for q in queues if q['type'] == qtype]) return None -def check_xdp(cfg, nl, xdp_queue_id=0) -> None: + +def check_xsk(cfg, nl, xdp_queue_id=0) -> None: # Probe for support xdp = cmd(cfg.rpath("xdp_helper") + ' - -', fail=False) if xdp.ret == 255: @@ -116,7 +117,8 @@ import struct def main() -> None: with NetDrvEnv(__file__, queue_count=100) as cfg: - ksft_run([get_queues, addremove_queues, check_down, check_xdp], args=(cfg, NetdevFamily())) + ksft_run([get_queues, addremove_queues, check_down, check_xsk], + args=(cfg, NetdevFamily())) ksft_exit()