From patchwork Thu Apr 6 13:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kal Cutter Conley X-Patchwork-Id: 13203312 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657A7C7618D for ; Thu, 6 Apr 2023 13:19:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238099AbjDFNTe (ORCPT ); Thu, 6 Apr 2023 09:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237895AbjDFNTd (ORCPT ); Thu, 6 Apr 2023 09:19:33 -0400 Received: from mail-ej1-x662.google.com (mail-ej1-x662.google.com [IPv6:2a00:1450:4864:20::662]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DE71BB for ; Thu, 6 Apr 2023 06:19:30 -0700 (PDT) Received: by mail-ej1-x662.google.com with SMTP id g18so1326145ejj.5 for ; Thu, 06 Apr 2023 06:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dectris.com; s=google; t=1680787168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xNbic2k37/uJb//jGocyCjKfzDNnw7vJzB+19fgD/vU=; b=PmB8agJJoKJaEr5tBHeQOZdILV1pcXZy+QW/ctLum/8eFRHAycUl/YdJGL7ZreYdMK 4PykMxodTpRZ4a97qllo7HHkuXHBWriuPw760bZ/Lk0itCFFXGw/Xn4qVW4z2/9K7xVn M6T3ebd8gzRrqh8m+mh9WhittPzXI1w/ge+Es= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680787168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xNbic2k37/uJb//jGocyCjKfzDNnw7vJzB+19fgD/vU=; b=1BYmgRzUpPjMPbREChdwQ/eJ7gP5YnFLNawNSFSvw6iXiLBL/BU52ci3SV2zPGdj0h V/SYDicK9IC8aEBXsRlM2HaVFf3MnTROiBsF3CLSeT2Mui6DNYvD7Fn4GXwgHjcygsAe FLZ/ixuLv1k/L8lUqRzO/tdaxnikJX64VxquKWirO3dAVaTy3+IzrfqVtCON0AiWfjG2 JA77w5D5SZWlB+MPbDpT2xDuYhK2pVJANhUEBrPTd7cPvHCPP2oph1G4KNqFDdtNEvKS xQiucA8oElPJG5+kebArshx3g3RhMM0CeGnzYmFfpxxUTe37C/g7/7Hkr/iULHTUGegX CKqA== X-Gm-Message-State: AAQBX9cduHL1TvnuIVujT5hgd/Zm19Eib9E2XPVXJ8NqmGhaQZsvy7so Af/AutfvPSdHfT4yQuRKmMeHLwJOl6UnABm67NKnO4wJHTc0 X-Google-Smtp-Source: AKy350ZsZ5uE7xfO97H+DmR5/MJweIMwM7CTSiGUyrZsZ91+p/RaG+LqgYUIPT4v8SRoKxHOqwsaUla6mc0o X-Received: by 2002:a17:907:3f16:b0:8a5:8620:575 with SMTP id hq22-20020a1709073f1600b008a586200575mr8009225ejc.3.1680787168473; Thu, 06 Apr 2023 06:19:28 -0700 (PDT) Received: from fedora.dectris.local (dect-ch-bad-pfw.cyberlink.ch. [62.12.151.50]) by smtp-relay.gmail.com with ESMTPS id 7-20020a170906014700b00947de8fa946sm137999ejh.201.2023.04.06.06.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 06:19:28 -0700 (PDT) X-Relaying-Domain: dectris.com From: Kal Conley To: Magnus Karlsson , =?utf-8?b?QmrDtnJuIFTDtnBl?= =?utf-8?b?bA==?= , Maciej Fijalkowski , Jonathan Lemon , Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: Kal Conley , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v4 2/3] selftests: xsk: Use hugepages when umem->frame_size > PAGE_SIZE Date: Thu, 6 Apr 2023 15:18:05 +0200 Message-Id: <20230406131806.51332-3-kal.conley@dectris.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230406131806.51332-1-kal.conley@dectris.com> References: <20230406131806.51332-1-kal.conley@dectris.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org HugeTLB UMEMs now support chunk_size > PAGE_SIZE. Set MAP_HUGETLB when frame_size > PAGE_SIZE for future tests. Signed-off-by: Kal Conley --- tools/testing/selftests/bpf/xskxceiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 5a9691e942de..7eccf57a0ccc 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1289,7 +1289,7 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject) void *bufs; int ret; - if (ifobject->umem->unaligned_mode) + if (ifobject->umem->frame_size > sysconf(_SC_PAGESIZE) || ifobject->umem->unaligned_mode) mmap_flags |= MAP_HUGETLB; if (ifobject->shared_umem) From patchwork Thu Apr 6 13:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kal Cutter Conley X-Patchwork-Id: 13203313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 802D7C76196 for ; Thu, 6 Apr 2023 13:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237756AbjDFNTt (ORCPT ); Thu, 6 Apr 2023 09:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238092AbjDFNTe (ORCPT ); Thu, 6 Apr 2023 09:19:34 -0400 Received: from mail-ej1-x664.google.com (mail-ej1-x664.google.com [IPv6:2a00:1450:4864:20::664]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C4642109 for ; Thu, 6 Apr 2023 06:19:31 -0700 (PDT) Received: by mail-ej1-x664.google.com with SMTP id cw23so1334324ejb.12 for ; Thu, 06 Apr 2023 06:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dectris.com; s=google; t=1680787169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OurEHAluO0z0/iX0xySpGmAc9WM9TpIWEufWnTv6GLE=; b=RtUe4waOH1uRH6GzLLr3ULwobeBTRIvPi9jWYefgAOEk2cjWDQO7BeHHRy0w5lhx0a 2pl+RhTSFHdg5AaiAnN5o1gVK7I375ofrRGojqrx3NcU2kUeHf63vJ3GZ2HDbIhR97BX cPW6nkUcReuAiG/c3lSTnPxbNaqoQqUv/tTVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680787169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OurEHAluO0z0/iX0xySpGmAc9WM9TpIWEufWnTv6GLE=; b=E45lRThpPanDWYWQc+EqCOPFwtNlXqMw4gJP5KC5a3Y2A9LF4jLE2uCABzC/YpZ9Us /eY2Z1Mi09z++1OY5bhEft1DgLILMmQtNZ/ha0PzJLy5d4apJyQGpm7FOJDVp38mDVAC 3APRyC+U4SZdY64rLOK6wpa8vvk8/z0wzySltGAowWgxMP7Ydm5fcICudKMXzgEXQq4e fTrpuJ0bmeAMX8KEy1dwAZ6SoeahNpmPug+75qE5/CjLo1OZnpVw8qhW337iLxDaUe0l Emn6EEhUm3clUNwooI+PwfhT6XjGwhivfwf0VSdNbxRfs9IwXO737sXdckmSKo17o//h AJgw== X-Gm-Message-State: AAQBX9dMyIkdFFtdl5MKowKzGSiD7wvhiy5lMJbT2uMBDrtMkXmbzIU/ A5ijcpzkTtmGoag5BuP81ZJavRubbEYVkFSlivO90VILadrM X-Google-Smtp-Source: AKy350Y3BpqFjLhFsA8Ofyp/tsoaubMqvqG4LLFCCOMAjnpds5X8ALPDuorggWeREk8wrlueBVxKM0qjgzwX X-Received: by 2002:a17:906:46c8:b0:932:c1e2:998b with SMTP id k8-20020a17090646c800b00932c1e2998bmr7247124ejs.15.1680787169403; Thu, 06 Apr 2023 06:19:29 -0700 (PDT) Received: from fedora.dectris.local (dect-ch-bad-pfw.cyberlink.ch. [62.12.151.50]) by smtp-relay.gmail.com with ESMTPS id 7-20020a170906014700b00947de8fa946sm137999ejh.201.2023.04.06.06.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 06:19:29 -0700 (PDT) X-Relaying-Domain: dectris.com From: Kal Conley To: Magnus Karlsson , =?utf-8?b?QmrDtnJuIFTDtnBl?= =?utf-8?b?bA==?= , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan Cc: Kal Conley , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v4 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes Date: Thu, 6 Apr 2023 15:18:06 +0200 Message-Id: <20230406131806.51332-4-kal.conley@dectris.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230406131806.51332-1-kal.conley@dectris.com> References: <20230406131806.51332-1-kal.conley@dectris.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add tests: - RUN_TO_COMPLETION_8K_FRAME_SIZE: frame_size=8192 (aligned) - UNALIGNED_9K_FRAME_SIZE: frame_size=9000 (unaligned) Signed-off-by: Kal Conley --- tools/testing/selftests/bpf/xskxceiver.c | 25 ++++++++++++++++++++++++ tools/testing/selftests/bpf/xskxceiver.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 7eccf57a0ccc..86797de7fc50 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1841,6 +1841,17 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_ pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE); testapp_validate_traffic(test); break; + case TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME: + if (!hugepages_present(test->ifobj_tx)) { + ksft_test_result_skip("No 2M huge pages present.\n"); + return; + } + test_spec_set_name(test, "RUN_TO_COMPLETION_8K_FRAME_SIZE"); + test->ifobj_tx->umem->frame_size = 8192; + test->ifobj_rx->umem->frame_size = 8192; + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE); + testapp_validate_traffic(test); + break; case TEST_TYPE_RX_POLL: test->ifobj_rx->use_poll = true; test_spec_set_name(test, "POLL_RX"); @@ -1904,6 +1915,20 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_ if (!testapp_unaligned(test)) return; break; + case TEST_TYPE_UNALIGNED_9K_FRAME: + if (!hugepages_present(test->ifobj_tx)) { + ksft_test_result_skip("No 2M huge pages present.\n"); + return; + } + test_spec_set_name(test, "UNALIGNED_9K_FRAME_SIZE"); + test->ifobj_tx->umem->frame_size = 9000; + test->ifobj_rx->umem->frame_size = 9000; + test->ifobj_tx->umem->unaligned_mode = true; + test->ifobj_rx->umem->unaligned_mode = true; + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE); + test->ifobj_rx->pkt_stream->use_addr_for_fill = true; + testapp_validate_traffic(test); + break; case TEST_TYPE_HEADROOM: testapp_headroom(test); break; diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h index 919327807a4e..7f52f737f5e9 100644 --- a/tools/testing/selftests/bpf/xskxceiver.h +++ b/tools/testing/selftests/bpf/xskxceiver.h @@ -69,12 +69,14 @@ enum test_mode { enum test_type { TEST_TYPE_RUN_TO_COMPLETION, TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME, + TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME, TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT, TEST_TYPE_RX_POLL, TEST_TYPE_TX_POLL, TEST_TYPE_POLL_RXQ_TMOUT, TEST_TYPE_POLL_TXQ_TMOUT, TEST_TYPE_UNALIGNED, + TEST_TYPE_UNALIGNED_9K_FRAME, TEST_TYPE_ALIGNED_INV_DESC, TEST_TYPE_ALIGNED_INV_DESC_2K_FRAME, TEST_TYPE_UNALIGNED_INV_DESC,