From patchwork Tue Feb 22 18:11:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Krawczyk X-Patchwork-Id: 108017 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B6FB3A034E; Tue, 22 Feb 2022 19:13:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 334334117A; Tue, 22 Feb 2022 19:12:25 +0100 (CET) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by mails.dpdk.org (Postfix) with ESMTP id 243F640DF4 for ; Tue, 22 Feb 2022 19:12:22 +0100 (CET) Received: by mail-ej1-f41.google.com with SMTP id d10so45434059eje.10 for ; Tue, 22 Feb 2022 10:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z5O689j1ezCEDVukRr7AfqRyaoZFEZhxJBB2GWCige4=; b=B8oI/cdU62r92opm1dtebocaN9Zav8lhZXftRiMiuJYefP6x2iHjvtyBynQWQeQ+0l S7bgbu7V05kAZPAcY3uK08gc4NtXpm870UDEBQDXh++6bJ8kLoSjBUCh8PpYqFFhqkG5 oEhEkBMYbJdkE8ESzQMuITReFK362kUn7xayjyUAQvh2mhty7gvm9qjq9H8dx+15bgtR Ceh+H4N4UzE0FJGlCdDXrO4NG3v3HB3VtIfXYVJ9SB2KnbUoxcuyxSFkdu8zQf8N85tI BS+ywbwZWBysoYK1hSbATIhrRf095O7T+/t+NSSiA/zydLSByaj1QbpeMPTYqaOZzDHI hHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z5O689j1ezCEDVukRr7AfqRyaoZFEZhxJBB2GWCige4=; b=beODPrHvC1+68ewG771lG8fR6i9HZXHXlYoTzbSjAIY/Ho7hHzc36gP+O8G2qqbv4b E2qlI0LgLoAnlsCTrtnp6VZTy+7jwpq5KuAlu/Dqfw3nwVL0RYeWEVPoSqKVTf3+/HUz epUGeFQUP8KWg5R0ePnQhyp3CBWHNsNPAtOEgAeG56xr55AM1hdAdKIcrpfIONl1hua9 8PZ8N9qwxZbhhCyJRbWrJN8pZcVov0NpYpSXmDScE1zZCbN7oQVrou9Hdf45yPyp7T1g 3qbFtCkbSqhhgoYcPSM5QycJYLRaUlvKcy2mPbsAulgqYJLY2nGQbLCSr+Z9JMQAoB0w 3gCw== X-Gm-Message-State: AOAM532EuA50HKZFIs1VI67FD9ngIK6Sxm7WGY4xcSWkkZRpypzT97Yu 9uED4fnyxs5VqubtL3dfX/EOxhjcQh17pg== X-Google-Smtp-Source: ABdhPJyyIKOYrVxIzHVByKc5KZqbElQvk7SPejPxLN/5nTD6gqP4v+F76potJnDTg/ufY0QbN5Kxhg== X-Received: by 2002:a17:906:d41:b0:6ce:78b0:8113 with SMTP id r1-20020a1709060d4100b006ce78b08113mr20637238ejh.357.1645553541469; Tue, 22 Feb 2022 10:12:21 -0800 (PST) Received: from DESKTOP-U5LNN3J.localdomain (89-79-181-52.dynamic.chello.pl. [89.79.181.52]) by smtp.gmail.com with ESMTPSA id y21sm10610153eda.38.2022.02.22.10.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:12:20 -0800 (PST) From: Michal Krawczyk To: dev@dpdk.org Cc: shaibran@amazon.com, upstream@semihalf.com, Michal Krawczyk , Dawid Gorecki Subject: [PATCH v2 09/21] net/ena/base: use optimized memcpy version also on Arm Date: Tue, 22 Feb 2022 19:11:34 +0100 Message-Id: <20220222181146.28882-10-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222181146.28882-1-mk@semihalf.com> References: <20220222160634.24489-1-mk@semihalf.com> <20220222181146.28882-1-mk@semihalf.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org As the default behavior for arm64 is to alias rte_memcpy as memcpy, ENA cannot redefine memcpy as rte_memcpy as it would cause nested declaration. To make it possible to use optimized memcpy in the ena_com layer on Arm, the driver now redefines memcpy when it is beneficial: * For arm64 only when the flag RTE_ARCH_ARM64_MEMCPY was defined * For arm only when the flag RTE_ARCH_ARM_NEON_MEMCPY was defined Signed-off-by: Michal Krawczyk Reviewed-by: Dawid Gorecki Reviewed-by: Shai Brandes --- doc/guides/rel_notes/release_22_03.rst | 1 + drivers/net/ena/base/ena_plat_dpdk.h | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst index f803402138..9c7e246348 100644 --- a/doc/guides/rel_notes/release_22_03.rst +++ b/doc/guides/rel_notes/release_22_03.rst @@ -112,6 +112,7 @@ New Features * Added new checksum related xstats: ``l3_csum_bad``, ``l4_csum_bad`` and ``l4_csum_good``. * Added support for the link status configuration. + * Added optimized memcpy support for the ARM platforms. * **Updated Cisco enic driver.** diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 4e7f52881a..41db883c63 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -66,8 +66,11 @@ typedef uint64_t dma_addr_t; #define ENA_UDELAY(x) rte_delay_us_block(x) #define ENA_TOUCH(x) ((void)(x)) -/* Avoid nested declaration on arm64, as it may define rte_memcpy as memcpy. */ -#if defined(RTE_ARCH_X86) +/* Redefine memcpy with caution: rte_memcpy can be simply aliased to memcpy, so + * make the redefinition only if it's safe (and beneficial) to do so. + */ +#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64_MEMCPY) || \ + defined(RTE_ARCH_ARM_NEON_MEMCPY) #undef memcpy #define memcpy rte_memcpy #endif