From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 697E580BDA for ; Thu, 22 Oct 2026 02:49:37 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69M2mN7F032207; Thu, 22 Oct 2026 05:48:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69M2mN7F032207 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WhRatBQQ" Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69M2mJU4032194 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 22 Oct 2026 05:48:19 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69M2mJU4032194 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48dff112136so934904f8f.1 for ; Wed, 21 Oct 2026 19:48:19 -0700 (PDT) X-Gm-Message-State: AFq9FYKwj4pvg2JqineH4NkHemQN/tFICxoF1Odo4BoIzchYb7idm15r uwdxpI2BN24+Py0YFnuQYy8IpujIqdgu2QhKbk5522oS5x0BMYlDQpQm3QnMPOPSen8RbDiaxox M9yGrtmus2+9kLm+e1/dyjpmakfWI/CbJUP7VKTaC4Wn+JcsJCLIIxQ== X-Gm-Gg: AYBFou0H5uMyrvHe6u7WTKOyql73aipNiEu1XfSHOH3HAIMl+tfvyXFTqEhaks2B9CA 04s6XhNbpyEOkkGv62rRpy/RVapwQHQgjpNuO9Naxlc0elMBLPZxFCtjP83ACDYUov+h0SjnVSf IJllkg1PEaZctm12WnqRS4Ld+6ooT4Iwh0gr5L8uu5mz23P0OXB8FP9CgaFArSQAMgkiC5u2N7t ig/rpPYaxLR0CyRwQQb916rgBay+BbMqOpqx0M+H1dlYQ8ouSH6ENZfuICOILnsDmI8JPK7E28I ueDnu+NfkFyNRxIwXbhFo0H7Cjfnc6b5rT0M8W9XX9TzPPRPzd8MAjhJ1Hc1vfc/wJv/nLLDVGD kXriqzdHMi8gWa8COtQlcqAk+ X-Received: by 2002:a05:6000:2c06:b0:48c:4f94:222f with SMTP id ffacd0b85a97d-48e26493580mr8287281f8f.17.1792637298818; Wed, 21 Oct 2026 19:48:18 -0700 (PDT) X-Received: by 2002:a05:6000:2c06:b0:48c:4f94:222f with SMTP id ffacd0b85a97d-48e26493580mr8287265f8f.17.1792637298282; Wed, 21 Oct 2026 19:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792637298; cv=none; d=google.com; s=arc-20260327; b=EL7fDxOewOU1pGotwNy5cFY+O7mt2YJymKXMU8ekwbaj96D7PVT+qUJFIfu0MSKE7Z 2MXV6IdBz+IF8ReB4bRSnSvK0iijcuV4MWzeR6EmNcHn9W/biJyAG3ivjoMYzc81I1yF nrrWK6OOtwBbqKkRmmsT6aUC1piVjRBA9+MoJagJuWifIq7i+SAzAEfiUaUhMDXjtbPx EClIlWV6M87CbWmtiRtEfg0SkY6c4c9jbT4KGdVuYZDDy7h0nqw2bErkwUfE/Rl2xSTv muAZpJ4FQUtszSwby3TWSkCLTEA3Jb1ErWq/8DJTWebtLDBQqUx/YHFoBKTzpMXWFM5y gmcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rFPLgv2w6+485ghPfTItj76tpuVqzy4zHotkWgeyW6A=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=epciJZybFcxBRLkjanCpHq+cuI6mJd3St70X9Q7/gmeOHMXcVfAubMdeK/pVovrARg 1K1O/zv98xHfMBP1Vdwoi/wgzr4MNPHO58prA52ieMT/D1bkL7H5iCGhnNsme1Wxm2KL n4a5VAF8s8bEOCd1JiWacAmyZPvFbZYZdI7IObVE5DuvK8HI2vdfRuKCLLGCD7NXqiz2 sXj8d8+9VRAY/QOFl2sy66M51A8AqDIXLT2ieWxF9v9UCwpMtgFQIVypgTMaL/7XDfd/ JgqslCXPrtOmEb4ftgxelZnoa7RYhlbClkAIXuBwPpXfGK+uW8Vi4hxQS+Zuo7VAUfAd 0mQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=WhRatBQQ; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48e25876e6dsi8823822f8f.320.2026.10.21.19.48.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2026 19:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=WhRatBQQ; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=rFPLgv2w6+485ghPfTItj76tpuVqzy4zHotkWgeyW6A=; b=WhRatBQQspQG S8Z1SRiS8zdhIBYUoEL05USi28bcpwtFHqD8TRA810s9zn0EbwrDoy+QKF1+0MsfhFyMXPi/KQ5hR 4MyukhKQseOYH28IbLiha6i5K672dGlPxWPs67af5cp9aQpT4bVkOJj0ZUQcq2hcI1oZjL0so84Qi BhQr4ofnymf5fvi+4v5hezMSjZdmQ+uay0Y73aCpD51ALQ/nIw9nNm29gP2CPsx5G46Yccn5Z07gj Em8EofBZr4XoQL/yJtBR+ndPFbFBk86fmhDBVlDY48YcQB1r+CgXcy0AAFuXEQ7lIJ6rRjPkb2psb H6nxuC8Ze5jMMQ1QGwZe3w==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xJinB-002gsC-1k; Thu, 22 Oct 2026 04:48:16 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Thu, 22 Oct 2026 05:47:47 +0300 Message-ID: <20261022024816.2435565-2-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261022024816.2435565-1-eva.kurchatova@virtuozzo.com> References: <20261022024816.2435565-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 1/1] selftests/bpf: run the xsk veth tests in a network namespace of their own X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org test_xsk.sh makes its veth pair in the namespace it runs in. Whatever the host does with a new interface, address configuration, neighbour discovery, happens on that pair, and the AF_XDP sockets under test receive the host's packets among their own. The tests count and inspect what they receive, so a preconfigured host fails some of them in every mode, and a bare one passes. Run the veth part in a network namespace of its own. The max_skb_frags sysctl has no file outside the initial namespace, so xskxceiver takes the limit from a new -f option ahead of the file, and the script hands it the host's value, or the one given to its own -f; the option tells the tests what the kernel's limit is and changes nothing in the kernel. An interface given with -i is used where it is. Without network namespaces the tests are skipped, as they are without veth. https://virtuozzo.atlassian.net/browse/VSTOR-150731 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/bpf/test_xsk.sh | 32 ++++++++++++++++++++++-- tools/testing/selftests/bpf/xskxceiver.c | 17 +++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh index 65aafe0003db..f6bff443ef1d 100755 --- a/tools/testing/selftests/bpf/test_xsk.sh +++ b/tools/testing/selftests/bpf/test_xsk.sh @@ -83,6 +83,10 @@ # Run a specific test from the test suite # sudo ./test_xsk.sh -t TEST_NAME # +# Tell the tests the kernel's max_skb_frags where its sysctl file cannot +# be read, in a network namespace other than the initial one say +# sudo ./test_xsk.sh -f FRAGS +# # Display the available command line options # ./test_xsk.sh -h @@ -90,7 +94,7 @@ ETH="" -while getopts "vi:dm:lt:h" flag +while getopts "vi:dm:lt:f:h" flag do case "${flag}" in v) verbose=1;; @@ -99,6 +103,7 @@ do m) MODE=${OPTARG};; l) list=1;; t) TEST=${OPTARG};; + f) FRAGS=${OPTARG};; h) help=1;; esac done @@ -162,8 +167,27 @@ if [ ! -z $ETH ]; then VETH1=${ETH} else validate_root_exec - validate_veth_support ${VETH0} validate_ip_utility + # The host configures and talks on any new interface in its namespace + if [ -z "$XSK_NETNS" ]; then + XSK_NETNS=xsk${VETH0_POSTFIX} + if ! ip netns add ${XSK_NETNS}; then + echo "skip all tests: cannot create a network namespace" >&2 + test_exit $ksft_skip + fi + trap "ip netns del ${XSK_NETNS}" EXIT + # The max_skb_frags sysctl has no file outside the initial namespace + [ -n "$FRAGS" ] || FRAGS=$(cat /proc/sys/net/core/max_skb_frags 2>/dev/null) + XSK_NETNS=${XSK_NETNS} ip netns exec ${XSK_NETNS} \ + bash "$0" "$@" ${FRAGS:+-f "${FRAGS}"} + retval=$? + # The pair stays up for a run by hand + [[ $debug -eq 1 ]] && trap - EXIT && \ + echo "The pair is up in network namespace ${XSK_NETNS}," \ + "use ip netns exec ${XSK_NETNS}" + exit $retval + fi + validate_veth_support ${VETH0} setup_vethPairs retval=$? @@ -187,6 +211,10 @@ if [ -n "$TEST" ]; then ARGS+="-t ${TEST} " fi +if [ -n "$FRAGS" ]; then + ARGS+="-f ${FRAGS} " +fi + retval=$? test_status $retval "${TEST_NAME}" diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 11f047b8af75..37c0f3b6677a 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -113,6 +113,7 @@ static bool opt_verbose; static bool opt_print_tests; static enum test_mode opt_mode = TEST_MODE_ALL; static u32 opt_run_test = RUN_ALL_TESTS; +static u32 opt_max_skb_frags; void test__fail(void) { /* for network_helpers.c */ } @@ -351,6 +352,7 @@ static struct option long_options[] = { {"mode", required_argument, 0, 'm'}, {"list", no_argument, 0, 'l'}, {"test", required_argument, 0, 't'}, + {"frags", required_argument, 0, 'f'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; @@ -366,6 +368,7 @@ static void print_usage(char **argv) " -m, --mode Run only mode skb, drv, or zc\n" " -l, --list List all available tests\n" " -t, --test Run a specific test. Enter number from -l option.\n" + " -f, --frags Take this as the kernel's max_skb_frags, not the sysctl's\n" " -h, --help Display this help and exit\n"; ksft_print_msg(str, basename(argv[0])); @@ -385,11 +388,13 @@ static void parse_command_line(struct ifobject *ifobj_tx, struct ifobject *ifobj struct ifobject *ifobj; u32 interface_nb = 0; int option_index, c; + unsigned long frags; + char *end; opterr = 0; for (;;) { - c = getopt_long(argc, argv, "i:vbm:lt:", long_options, &option_index); + c = getopt_long(argc, argv, "i:vbm:lt:f:", long_options, &option_index); if (c == -1) break; @@ -437,6 +442,14 @@ static void parse_command_line(struct ifobject *ifobj_tx, struct ifobject *ifobj if (errno) print_usage(argv); break; + case 'f': + errno = 0; + frags = strtoul(optarg, &end, 0); + /* The sysctl's own range: 1 to MAX_SKB_FRAGS, which is 45 at most */ + if (errno || *end || !frags || frags > 45) + print_usage(argv); + opt_max_skb_frags = frags; + break; case 'h': default: print_usage(argv); @@ -2271,7 +2284,7 @@ static int testapp_too_many_frags(struct test_spec *test) if (test->mode == TEST_MODE_ZC) { max_frags = test->ifobj_tx->xdp_zc_max_segs; } else { - max_frags = get_max_skb_frags(); + max_frags = opt_max_skb_frags ? : get_max_skb_frags(); if (!max_frags) { ksft_print_msg("Couldn't retrieve MAX_SKB_FRAGS from system, using default (17) value\n"); max_frags = 17; -- 2.56.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel