From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id A9D0A8017D for ; Tue, 20 Oct 2026 04:13:43 +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 69K4CORe030317; Tue, 20 Oct 2026 07:12:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69K4CORe030317 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="wehauUIE" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69K4CLdF030313 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 20 Oct 2026 07:12:22 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69K4CLdF030313 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48af4a0bd0fso1464320f8f.2 for ; Mon, 19 Oct 2026 21:12:22 -0700 (PDT) X-Gm-Message-State: AFq9FYIB2azwApAls/HeA+1dmfV6Yp5JqKT2EWkBDWSiOTu16nQ0dTh1 Jabs3C+IojRnoLMi6J22wfLxXgwJoqMKdGUW/klfpJmrKo89aAEiudnM/loFUce1tfRfkwrZYLm 4AnrJc76nGtq0TSjRr/UAc0OWII0m80687wmeocHjFiTaHL4+BjPGtg== X-Gm-Gg: AYBFou3Oqmkw4T8e35nLlfYRwfcZGI4eFU7UbMK1pPLdfMKA5Bj9JknKEM3zzrkKADu gTykkP7GHqD01hQoBjSCzzN2q6lBjOSsMhjBpllLaYw9Mu7vhBEWad+HZlbAe3xISauz+iADyNI ZTbA9H83BBsP8igT+0MPa/hr0W8K/LBKDyYaCSh1DD+xFsGdFr/FO2e39iuHsYq8WoUiCdmuP2f XZW6I66TZ8xPtzey/m9VUwXxtDirXhepfTG0jRSmw6u5IsmH5AqxmhXZvL0WmVNjX9SaGBgOKfv 9OvOsKTUjwfZkQaRYNboZkyTreyZV41p/DCfpsRpV+EYWW9jvmyTwjA34YTwrB52Bavo4MDriVI rzcoFyl9pesz6HtVinJ8ayCrk9g== X-Received: by 2002:a05:6000:4814:b0:48e:8d0:78c0 with SMTP id ffacd0b85a97d-48e08d0790cmr17036351f8f.10.1792469541652; Mon, 19 Oct 2026 21:12:21 -0700 (PDT) X-Received: by 2002:a05:6000:4814:b0:48e:8d0:78c0 with SMTP id ffacd0b85a97d-48e08d0790cmr17036306f8f.10.1792469541110; Mon, 19 Oct 2026 21:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792469541; cv=none; d=google.com; s=arc-20260327; b=XciUTiA1cLmPteWy8O3wIIgb5lFtv48ZYoLFdMxDEU2+Qim974ybYAaHisWA52h64h twNnB/xEkNJTypsIu7icEIts/JPyWtKoijiPBkrpQ79bexlYTkbBQpIzNKOu14LN/RBq 5Avfq+1LERJ0YjlXOZkbRihCRDRaanYxOMuQdQFAPHw8w59r5rucafnqrLYCnFFE8g64 eLNXdpIRXGxMAQ+5ui1b2hdAkLY4LGoBkjtijjnqfYfiLFnvVzrp2DLIozM9Q6Vojmdf wLydmhssPMgrbf/wXp8SlOpzWKo5GUO8jL8KITm5oySCOi19yJtPXiWIAm5hfFa+ZWid CjoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=7s10EMECnpdl7ClEkiw0pjAtz/R+KhbjhLAjhAbQZ2Q=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=c9Otr+S69qLKXtSUPXF/UuVrMvTFCuX/HP/FinGRddC1NzImMdvIhQAsmm2FjOuZo7 Q+oS/WX/oMyHeHv+5gEKDgCg8IVpMy9NvU1NGUO1WuT3FU6QkkqRJtJsueSLaH861hRR ZbtUf15/6oRmjDrqhC/scxM6LUjvp249c37mp2wpH3IsPkT4Fcw94jX/UkITy8RzFLRM S+zCZKCk/68ij0ZAW0XJBnMHwHXRKpJGtzqjtIKBbkmTBJZJdx5To6Av0CfR3k3SuJwb 4qE53f5Um/SZeC2X1XXfMD8YTqWqvffVy1J0f/2ox7e95cxTJqSTPQ9ohKZUgwqewQFG QHFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=wehauUIE; 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-48e20ed348asi676288f8f.458.2026.10.19.21.12.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 21:12:21 -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=wehauUIE; 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=7s10EMECnpdl7ClEkiw0pjAtz/R+KhbjhLAjhAbQZ2Q=; b=wehauUIEd7YZ VpBk6Pt9jKmi87pfcRxQx3fdlLrOOoGFOt42WcVv928WOSFymdOURb1uKsIcuIh8nEJRxaeEqLD1M bvMCwQrnV36wNqUbxQbmN98VocTUEN5LXM80PcOExBU6QGetog2alHmkm/kDThjEPBfQqIYCxfqTi bhy3Pk2NWwJpD8aeKLPuCDGsR1Pc2k8jAJkIMMEtNNStDc5X1SDgvPUgeObUGaGBk6nof8fiM62Ym PCfLEYy2SlJCTVukcxrHNBUWdZz7uggJEyd/lI75PCKtivO1uD2reeN9ibcm4nm+JKrWlBQSm9R02 uolOPMaeN9+uFFhjVcJvoA==; 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 1xJ19T-001mdE-0N; Tue, 20 Oct 2026 06:12:11 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Tue, 20 Oct 2026 07:12:17 +0300 Message-ID: <20261020041218.1659392-1-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.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. An interface given with -i is used where it is. https://virtuozzo.atlassian.net/browse/VSTOR-150731 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/bpf/test_xsk.sh | 25 ++++++++++++++++++++++-- tools/testing/selftests/bpf/xskxceiver.c | 13 ++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh index 65aafe0003db..7859c1d31195 100755 --- a/tools/testing/selftests/bpf/test_xsk.sh +++ b/tools/testing/selftests/bpf/test_xsk.sh @@ -83,6 +83,9 @@ # Run a specific test from the test suite # sudo ./test_xsk.sh -t TEST_NAME # +# Run with a max_skb_frags limit other than the host's +# sudo ./test_xsk.sh -f FRAGS +# # Display the available command line options # ./test_xsk.sh -h @@ -90,7 +93,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 +102,7 @@ do m) MODE=${OPTARG};; l) list=1;; t) TEST=${OPTARG};; + f) FRAGS=${OPTARG};; h) help=1;; esac done @@ -162,8 +166,21 @@ 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} + ip netns add ${XSK_NETNS} || test_exit $ksft_fail + 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) + XSK_NETNS=${XSK_NETNS} ip netns exec ${XSK_NETNS} bash "$0" "$@" -f ${FRAGS} + retval=$? + # The pair stays up for a run by hand + [[ $debug -eq 1 ]] && trap - EXIT && echo "ip netns exec ${XSK_NETNS}" + exit $retval + fi + validate_veth_support ${VETH0} setup_vethPairs retval=$? @@ -187,6 +204,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..c26cc31d21fe 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 Use this max_skb_frags instead of the sysctl\n" " -h, --help Display this help and exit\n"; ksft_print_msg(str, basename(argv[0])); @@ -389,7 +392,7 @@ static void parse_command_line(struct ifobject *ifobj_tx, struct ifobject *ifobj 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 +440,12 @@ static void parse_command_line(struct ifobject *ifobj_tx, struct ifobject *ifobj if (errno) print_usage(argv); break; + case 'f': + errno = 0; + opt_max_skb_frags = strtoul(optarg, NULL, 0); + if (errno || !opt_max_skb_frags) + print_usage(argv); + break; case 'h': default: print_usage(argv); @@ -2271,7 +2280,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