From patchwork Wed Mar 29 18:04:54 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: 13193091 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 8FD4EC761AF for ; Wed, 29 Mar 2023 18:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjC2SII (ORCPT ); Wed, 29 Mar 2023 14:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjC2SIH (ORCPT ); Wed, 29 Mar 2023 14:08:07 -0400 Received: from mail-ed1-x561.google.com (mail-ed1-x561.google.com [IPv6:2a00:1450:4864:20::561]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A72CC4C0D for ; Wed, 29 Mar 2023 11:08:05 -0700 (PDT) Received: by mail-ed1-x561.google.com with SMTP id y4so66864943edo.2 for ; Wed, 29 Mar 2023 11:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dectris.com; s=google; t=1680113284; 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=FndVMXQ48NmaMTKqtO1ulaQVEXkhQgQUYelFrcn8/tk=; b=goalJZEkY8oIQ4XWh8u26N0oAhUsnx/OGzWFHwY+BEKeZXv+4ItDLI08lnxtvpjGNl N2DH4gUPUAW5IKHrvUlf1ArArAj1i99oUvGgt6CN6gtqcwmZEsa9eGeZTs59pGAtkWur 1ihwsZ28FvzyFXPihAj000bu0Rr93mh4ozkE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680113284; 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=FndVMXQ48NmaMTKqtO1ulaQVEXkhQgQUYelFrcn8/tk=; b=GnPY8BCOVqRE+UbJmgiBIZ9W4p6HaBC8LAqOdvn4ZTODh+NNkK+UYt00yKIV7RAQvn 5MGW6xMjtBdTGb9uyUooPSSQf9ZeTCwJlSpCRxFATLuauCquqc02BUWHEHTSj4Z5igLe 6C3vMJRVSGTF5Kzl45InXUf5Wyf8qt74K1ZN5XEMPzxsOymnHPvOawKkuj/+xdcHg63L 5Bfljz/o8KCtvI+J3wncgplLEH+vACFmXnilCbQdgNUHztEb4NGTmw7IPA5jAKqQlaI4 w/COKAvJpX/PprVRszC8pQtcXW4hnu4Mmcahd2VGcr1LO/ndWrQVzUfOHEiRDLE4bjp9 EGQQ== X-Gm-Message-State: AAQBX9ejZ3P+SWA2UtvRmMJCim5F7DQPrKSMn9knYDCqugxgBzq/ElIm 5aMjMEEbid/8Pc4TG7PO8jStRqlbxXFpIkpLtOClRsbPhGX9 X-Google-Smtp-Source: AKy350Y01hX7iRmc2xxzvWLh+7WjQqMOHm0QkSS4Z8BMosMMKVb1bBzQkoWPUxennOdKe9OP6Lqkmeo4eHfC X-Received: by 2002:a17:906:3592:b0:934:8043:ebf8 with SMTP id o18-20020a170906359200b009348043ebf8mr20517198ejb.26.1680113284096; Wed, 29 Mar 2023 11:08:04 -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 m10-20020a1709066d0a00b00920438f59b3sm12072998ejr.154.2023.03.29.11.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 11:08:04 -0700 (PDT) X-Relaying-Domain: dectris.com From: Kal Conley To: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , 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 v2 02/10] selftests: xsk: Use correct UMEM size in testapp_invalid_desc Date: Wed, 29 Mar 2023 20:04:54 +0200 Message-Id: <20230329180502.1884307-3-kal.conley@dectris.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329180502.1884307-1-kal.conley@dectris.com> References: <20230329180502.1884307-1-kal.conley@dectris.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Avoid UMEM_SIZE macro in testapp_invalid_desc which is incorrect when the frame size is not XSK_UMEM__DEFAULT_FRAME_SIZE. Also remove the macro since it's no longer being used. Fixes: 909f0e28207c ("selftests: xsk: Add tests for 2K frame size") Signed-off-by: Kal Conley --- tools/testing/selftests/bpf/xskxceiver.c | 9 +++++---- tools/testing/selftests/bpf/xskxceiver.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index b65e0645b0cd..3956f5db84f3 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1652,6 +1652,7 @@ static void testapp_single_pkt(struct test_spec *test) static void testapp_invalid_desc(struct test_spec *test) { + u64 umem_size = test->ifobj_tx->umem->num_frames * test->ifobj_tx->umem->frame_size; struct pkt pkts[] = { /* Zero packet address allowed */ {0, PKT_SIZE, 0, true}, @@ -1662,9 +1663,9 @@ static void testapp_invalid_desc(struct test_spec *test) /* Packet too large */ {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false}, /* After umem ends */ - {UMEM_SIZE, PKT_SIZE, 0, false}, + {umem_size, PKT_SIZE, 0, false}, /* Straddle the end of umem */ - {UMEM_SIZE - PKT_SIZE / 2, PKT_SIZE, 0, false}, + {umem_size - PKT_SIZE / 2, PKT_SIZE, 0, false}, /* Straddle a page boundrary */ {0x3000 - PKT_SIZE / 2, PKT_SIZE, 0, false}, /* Straddle a 2K boundrary */ @@ -1682,8 +1683,8 @@ static void testapp_invalid_desc(struct test_spec *test) } if (test->ifobj_tx->shared_umem) { - pkts[4].addr += UMEM_SIZE; - pkts[5].addr += UMEM_SIZE; + pkts[4].addr += umem_size; + pkts[5].addr += umem_size; } pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h index bdb4efedf3a9..cc24ab72f3ff 100644 --- a/tools/testing/selftests/bpf/xskxceiver.h +++ b/tools/testing/selftests/bpf/xskxceiver.h @@ -53,7 +53,6 @@ #define THREAD_TMOUT 3 #define DEFAULT_PKT_CNT (4 * 1024) #define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4) -#define UMEM_SIZE (DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE) #define RX_FULL_RXQSIZE 32 #define UMEM_HEADROOM_TEST_SIZE 128 #define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1)