From patchwork Fri Sep 20 10:27:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 144344 X-Patchwork-Delegate: thomas@monjalon.net 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 ED29E459D7; Fri, 20 Sep 2024 12:37:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64AEE4342C; Fri, 20 Sep 2024 12:36:46 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2077.outbound.protection.outlook.com [40.107.22.77]) by mails.dpdk.org (Postfix) with ESMTP id 3F5E343357 for ; Fri, 20 Sep 2024 12:36:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f45ADHsYT9Vgi+QkhIINg2+qxSgnsAqVFFhMiI98RHJpFAy/Q0LfjeS2Xq3ZSlFlIwMTrUsUOuAeDummT2qxLEYT9ZWnpuFEp2K/Y/9LJ2stR0NGU3ATJiE/Z4ZxhoTnbQZo7LDSnurH9ZkDBBdgrvSroq98aHL2sek96a00cAYokckfFLzMAMSAtjeRQ9F4E+ynfTs2uJ0IN2omLoswU/xE+ZtLSjDFGLCk4uRXMn+HgK1xHmKy8jCBtBU9LgT1VthsTPbKuWa7yxNrU3m3eqVOydKGuPMx/Lp4+t+JSQ4tAqDOEt/pn1o5wr9grJa+ddbSuqcgief4l+Jera2xew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v9M0wHaa7h94m7Ds8v5HfR3MgPnPAOqjl2EGnkv+qvo=; b=ypRHtbfcmH8yaIq5sRtusiBZ0w74HoPvQtz1XANd9lI9zzSmJbzMoN2Ni7zYiOptzEMNoPw9M5MbqSyQpEJmpv9oRYOMtEyL/GHolFHn5L/B6aW+UnlHup4Rij0Tz+OL+rJAYRTvIL3M6dhZiq0gKGO6viZijvv3yBBxFITCZLEuLgryomOPQEsO7IqDLSr9ApDTTBxL742fF3HD3+9IOAJsNz8C8cKRGn5/Exp68j7T09hxAdOJ7nS4cSHkdqufh+wzRoWql/5RCDGB45NlqSvgP0ALzWlgXnCrbX6zoIy0nlD1yyAdT/9gstJlFaqqwxpnBoxY9j8DIXKWnKez6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v9M0wHaa7h94m7Ds8v5HfR3MgPnPAOqjl2EGnkv+qvo=; b=r8JI8xhQH+7RJfeAY20OJP+xV+72C7mPswdLHRCvJmtFTdKXhFxFNWW7kBQsZXFb1HgLKvKAvSTFBrASthOGGvQc4Q9nGwMhgpIHrGLV0FkycUPGgcRpViAuLHpq82BhgghSLCA3ok/dBLRaA+9S06LFpTrqzVcgVvscbm8QXhewOgFK4eM3CYBRL1NShpVjvN81qWYLjIu4ZYgMZ8decMeR9toUZkPozc9xvAqhBhvlnikmH0h25S+BmnqkRhKX068oqsf8MSY8Pn9U1wIbYRt4c/lwrOid12QP4SNkrcQux+kqSAGxomezN6uoe5oYkXOyFTvCKFc0BL4xeho9LQ== Received: from DU2P250CA0010.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::15) by GV1PR07MB8383.eurprd07.prod.outlook.com (2603:10a6:150:22::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Fri, 20 Sep 2024 10:36:36 +0000 Received: from DB3PEPF00008860.eurprd02.prod.outlook.com (2603:10a6:10:231:cafe::f9) by DU2P250CA0010.outlook.office365.com (2603:10a6:10:231::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Fri, 20 Sep 2024 10:36:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DB3PEPF00008860.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Fri, 20 Sep 2024 10:36:35 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.66) with Microsoft SMTP Server id 15.2.1544.11; Fri, 20 Sep 2024 12:36:32 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id 9CE0A1C006D; Fri, 20 Sep 2024 12:36:32 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: =?utf-8?q?Mattias_R=C3=B6nnblom?= , =?utf-8?q?Mor?= =?utf-8?q?ten_Br=C3=B8rup?= , "Stephen Hemminger" , David Marchand , Pavan Nikhilesh , Bruce Richardson , =?utf-8?q?Mattias_R=C3=B6nnb?= =?utf-8?q?lom?= Subject: [PATCH v6 5/7] eal: provide option to use compiler memcpy instead of RTE Date: Fri, 20 Sep 2024 12:27:14 +0200 Message-ID: <20240920102716.738940-6-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240920102716.738940-1-mattias.ronnblom@ericsson.com> References: <20240724075357.546248-2-mattias.ronnblom@ericsson.com> <20240920102716.738940-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB3PEPF00008860:EE_|GV1PR07MB8383:EE_ X-MS-Office365-Filtering-Correlation-Id: c9e00041-c6db-4e52-f6ae-08dcd9601a11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?jxrlGmy1/QmgNLT8R/tBErNfHTnTo4U?= =?utf-8?q?fE/pebuVx5kxFKLvRN0nGONXgMUpPhHB2yDG3gYJFRpQk+MXIuO2v0+vIlF+pyToj?= =?utf-8?q?bVum9JIHl+f8YVm1VDJmTPGOIbZAT9ZH1mkLSGTFiulxLS4MgwziMmRszKIyDBOmx?= =?utf-8?q?gz3Pdtdru2Pp8V15geLN2NvG62c/E0DCkhdCMVbyERj/grq95wRjb7Dv8yRQlv+sA?= =?utf-8?q?pSduKhoVE2haQ2mHEbNxaUM/KMwz1yGadGKBHxmcNU0fywU+H+v93+6uOFqACyfVJ?= =?utf-8?q?RC41L0N/3Hqvid5WEaZtYhOb0tPy5BhWysJkkjugcF3rdyU32R1yW+pD01kSvLig4?= =?utf-8?q?TNyOJ1ssPKhpqGXwG1jPMhE/6QyqUbzAZw/8sEjrFUnYQKUCr8w618VqcEHKd3Ro6?= =?utf-8?q?f6p0pxDfz5nlFNvt5rExl3OosM9tcoBhFBPM1Li1aD8cPGnlAj6q7Ykk266rOrgwP?= =?utf-8?q?Ckm84iR/trp7GzBDpyWhvbaTORsxzdCeQ8uFhLMjmvmDInjUf6P3y41UdIAd40M0V?= =?utf-8?q?yNHTBPSTLqtDAxaX4M61OYfzenV7d5kCRCfCJHhht8JTD+I2A1iTXJ5XZxr3yeTWv?= =?utf-8?q?DGhK376FYmQc/0S58qlGhSjJ7q4AfsqtgEtanipzNKtUIYnJhB7f7/YB+02k+/EBZ?= =?utf-8?q?unojnXiZR22haLmy8Sg3y7Z3kjzr4vwIClinBob4VsUyoaVYoAPG0ZLgGn4Rp7Aw3?= =?utf-8?q?wO5qxLLBglVhEs7DnBwRLQgQ3IxEpEK5fuuhg8+1IJxFp7iY/Jjku+RZRcrUqY89U?= =?utf-8?q?ZuX8TTkCJBnWMTUcJaqS1jc44KJfAQtB6AwnXrIdDCQ43/q4g8PHBWiwaEOpA2K+C?= =?utf-8?q?LAWpyBfR1lv8YztID3B0giEiKc2WEziFYiGX5S0LtwvvOso/jCpnUWqcf+7fx8D9K?= =?utf-8?q?EVN3vh7Sz4C2MoeL0aTEftiNkv7si4H8xEAXzIe7PiMPa5rwyDyI79oUbjrYRKUvS?= =?utf-8?q?qy9i8Qk05bUTG2dzjjeHWAhcbWu7exbOhDjcg0Xrnjwhv5sO8QYENcuKrHUl36ETm?= =?utf-8?q?PSxLDt1F/LTMxwN3x+OQroPDxEax4+mDYsCoHIBSJbVE28qhmWa6TnJGIGlqXYydq?= =?utf-8?q?+fhY3i1iv0NdmzktYgBM4KCa67e/vbvlBQmxOplRGQ/vJSk2Ikp3qb/TRBBYDdzYI?= =?utf-8?q?axvFbEPqIrA6GRJ7lfhIYcSPwHdtqCF2tnh+gPQQYgPu8QmvLlYw+0ney/58PPeC6?= =?utf-8?q?9dDx6PdkyNnO0osKSjgep+UqoeZ0UJbHpTnYHpwWPD/k0VJCYCO5TY8llXjbQrxU+?= =?utf-8?q?2SUhGYRwgh+DwjbLwjymUuIxfJC3Uir514uW9SlUaDPwM11Ef/4oarlElTZOKuUA4?= =?utf-8?q?3+VI/9tMWrVB?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2024 10:36:35.6459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9e00041-c6db-4e52-f6ae-08dcd9601a11 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DB3PEPF00008860.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR07MB8383 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 Provide build option to have functions in delegate to the standard compiler/libc memcpy(), instead of using the various custom DPDK, handcrafted, per-architecture rte_memcpy() implementations. A new meson build option 'use_cc_memcpy' is added. By default, the traditional, custom DPDK rte_memcpy() implementation is used. The performance benefits of the custom DPDK rte_memcpy() implementations have been diminishing with every compiler release, and with current toolchains the use of a custom memcpy() implementation may even be a liability. An additional benefit of this change is that compilers and static analysis tools have an easier time detecting incorrect usage of rte_memcpy() (e.g., buffer overruns, or overlapping source and destination buffers). Signed-off-by: Mattias Rönnblom Acked-by: Morten Brørup --- PATCH v6: * Rebase for 24.11. PATCH v5: o Take a more cautious approach, setting use_cc_memcpy to disabled by default. o Fix ARM build issue in case RTE_ARCH_ARM64_MEMCPY was set. o Use separate macros to indicate that the rte_memcpy() is implemented by the compiler, and that use_cc_memcpy is set, to avoid accidental #undefs. o Remove redundant rte_config.h includes. PATCH: o Add entry in release notes. o Update meson help text. RFC v3: o Fix missing #endif on loongarch. o PPC and RISCV now implemented, meaning all architectures are supported. o Unnecessary include is removed from . RFC v2: * Fix bug where rte_memcpy.h was not installed on x86. * Made attempt to make Loongarch compile. --- config/meson.build | 1 + doc/guides/rel_notes/release_24_11.rst | 20 +++++++++ lib/eal/arm/include/rte_memcpy.h | 9 ++++ lib/eal/include/generic/rte_memcpy.h | 61 +++++++++++++++++++++++--- lib/eal/loongarch/include/rte_memcpy.h | 54 +---------------------- lib/eal/ppc/include/rte_memcpy.h | 9 ++++ lib/eal/riscv/include/rte_memcpy.h | 54 +---------------------- lib/eal/x86/include/meson.build | 1 + lib/eal/x86/include/rte_memcpy.h | 9 ++++ meson_options.txt | 2 + 10 files changed, 109 insertions(+), 111 deletions(-) diff --git a/config/meson.build b/config/meson.build index 8c8b019c25..456056628e 100644 --- a/config/meson.build +++ b/config/meson.build @@ -353,6 +353,7 @@ endforeach # set other values pulled from the build options dpdk_conf.set('RTE_MAX_ETHPORTS', get_option('max_ethports')) dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet')) +dpdk_conf.set('RTE_USE_CC_MEMCPY', get_option('use_cc_memcpy')) dpdk_conf.set('RTE_ENABLE_STDATOMIC', get_option('enable_stdatomic')) dpdk_conf.set('RTE_ENABLE_TRACE_FP', get_option('enable_trace_fp')) dpdk_conf.set('RTE_PKTMBUF_HEADROOM', get_option('pkt_mbuf_headroom')) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 0ff70d9057..8be000294d 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -55,6 +55,26 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Compiler memcpy replaces custom DPDK implementation.** + + The memory copy functions of ```` now optionally + delegates to the standard memcpy() function, implemented by the + compiler and the C runtime (e.g., libc). + + In this release of DPDK, the handcrafted, per-architecture memory + copy implementations are still the default. Compiler memcpy is + enabled by setting the new ``use_cc_memcpy`` build option to true. + + The performance benefits of the custom DPDK rte_memcpy() + implementations have been diminishing with every new compiler + release, and with current toolchains the use of a custom memcpy() + implementation may even result in worse performance than the + standard memcpy(). + + An additional benefit of using compiler memcpy is that compilers and + static analysis tools have an easier time detecting incorrect usage + of rte_memcpy() (e.g., buffer overruns, or overlapping source and + destination buffers). Removed Items ------------- diff --git a/lib/eal/arm/include/rte_memcpy.h b/lib/eal/arm/include/rte_memcpy.h index 47dea9a8cc..5d2ea7dbfa 100644 --- a/lib/eal/arm/include/rte_memcpy.h +++ b/lib/eal/arm/include/rte_memcpy.h @@ -5,10 +5,19 @@ #ifndef _RTE_MEMCPY_ARM_H_ #define _RTE_MEMCPY_ARM_H_ +#if defined(RTE_USE_CC_MEMCPY) || !defined(RTE_ARCH_ARM64_MEMCPY) + +#define RTE_CC_MEMCPY +#include + +#else + #ifdef RTE_ARCH_64 #include #else #include #endif +#endif /* RTE_USE_CC_MEMCPY */ + #endif /* _RTE_MEMCPY_ARM_H_ */ diff --git a/lib/eal/include/generic/rte_memcpy.h b/lib/eal/include/generic/rte_memcpy.h index e7f0f8eaa9..cfb0175bd2 100644 --- a/lib/eal/include/generic/rte_memcpy.h +++ b/lib/eal/include/generic/rte_memcpy.h @@ -5,12 +5,19 @@ #ifndef _RTE_MEMCPY_H_ #define _RTE_MEMCPY_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * @file * * Functions for vectorised implementation of memcpy(). */ +#include +#include + /** * Copy 16 bytes from one location to another using optimised * instructions. The locations should not overlap. @@ -35,8 +42,6 @@ rte_mov16(uint8_t *dst, const uint8_t *src); static inline void rte_mov32(uint8_t *dst, const uint8_t *src); -#ifdef __DOXYGEN__ - /** * Copy 48 bytes from one location to another using optimised * instructions. The locations should not overlap. @@ -49,8 +54,6 @@ rte_mov32(uint8_t *dst, const uint8_t *src); static inline void rte_mov48(uint8_t *dst, const uint8_t *src); -#endif /* __DOXYGEN__ */ - /** * Copy 64 bytes from one location to another using optimised * instructions. The locations should not overlap. @@ -87,8 +90,6 @@ rte_mov128(uint8_t *dst, const uint8_t *src); static inline void rte_mov256(uint8_t *dst, const uint8_t *src); -#ifdef __DOXYGEN__ - /** * Copy bytes from one location to another. The locations must not overlap. * @@ -111,6 +112,52 @@ rte_mov256(uint8_t *dst, const uint8_t *src); static void * rte_memcpy(void *dst, const void *src, size_t n); -#endif /* __DOXYGEN__ */ +#ifdef RTE_CC_MEMCPY +static inline void +rte_mov16(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 16); +} + +static inline void +rte_mov32(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 32); +} + +static inline void +rte_mov48(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 48); +} + +static inline void +rte_mov64(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 64); +} + +static inline void +rte_mov128(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 128); +} + +static inline void +rte_mov256(uint8_t *dst, const uint8_t *src) +{ + memcpy(dst, src, 256); +} + +static inline void * +rte_memcpy(void *dst, const void *src, size_t n) +{ + return memcpy(dst, src, n); +} +#endif /* RTE_CC_MEMCPY */ + +#ifdef __cplusplus +} +#endif #endif /* _RTE_MEMCPY_H_ */ diff --git a/lib/eal/loongarch/include/rte_memcpy.h b/lib/eal/loongarch/include/rte_memcpy.h index 22578d40f4..4e6027caee 100644 --- a/lib/eal/loongarch/include/rte_memcpy.h +++ b/lib/eal/loongarch/include/rte_memcpy.h @@ -5,57 +5,7 @@ #ifndef RTE_MEMCPY_LOONGARCH_H #define RTE_MEMCPY_LOONGARCH_H -#include -#include - -#include "rte_common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "generic/rte_memcpy.h" - -static inline void -rte_mov16(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 16); -} - -static inline void -rte_mov32(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 32); -} - -static inline void -rte_mov48(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 48); -} - -static inline void -rte_mov64(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 64); -} - -static inline void -rte_mov128(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 128); -} - -static inline void -rte_mov256(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 256); -} - -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) - -#ifdef __cplusplus -} -#endif +#define RTE_CC_MEMCPY +#include #endif /* RTE_MEMCPY_LOONGARCH_H */ diff --git a/lib/eal/ppc/include/rte_memcpy.h b/lib/eal/ppc/include/rte_memcpy.h index 6f388c0234..162c1483f5 100644 --- a/lib/eal/ppc/include/rte_memcpy.h +++ b/lib/eal/ppc/include/rte_memcpy.h @@ -6,6 +6,13 @@ #ifndef _RTE_MEMCPY_PPC_64_H_ #define _RTE_MEMCPY_PPC_64_H_ +#ifdef RTE_USE_CC_MEMCPY + +#define RTE_CC_MEMCPY +#include + +#else + #include #include @@ -215,4 +222,6 @@ rte_memcpy_func(void *dst, const void *src, size_t n) } #endif +#endif /* RTE_USE_CC_MEMCPY */ + #endif /* _RTE_MEMCPY_PPC_64_H_ */ diff --git a/lib/eal/riscv/include/rte_memcpy.h b/lib/eal/riscv/include/rte_memcpy.h index e34f19396e..7f6c07d090 100644 --- a/lib/eal/riscv/include/rte_memcpy.h +++ b/lib/eal/riscv/include/rte_memcpy.h @@ -7,57 +7,7 @@ #ifndef RTE_MEMCPY_RISCV_H #define RTE_MEMCPY_RISCV_H -#include -#include - -#include "rte_common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "generic/rte_memcpy.h" - -static inline void -rte_mov16(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 16); -} - -static inline void -rte_mov32(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 32); -} - -static inline void -rte_mov48(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 48); -} - -static inline void -rte_mov64(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 64); -} - -static inline void -rte_mov128(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 128); -} - -static inline void -rte_mov256(uint8_t *dst, const uint8_t *src) -{ - memcpy(dst, src, 256); -} - -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) - -#ifdef __cplusplus -} -#endif +#define RTE_CC_MEMCPY +#include #endif /* RTE_MEMCPY_RISCV_H */ diff --git a/lib/eal/x86/include/meson.build b/lib/eal/x86/include/meson.build index 52d2f8e969..09c2fe2485 100644 --- a/lib/eal/x86/include/meson.build +++ b/lib/eal/x86/include/meson.build @@ -16,6 +16,7 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) + arch_indirect_headers = files( 'rte_atomic_32.h', 'rte_atomic_64.h', diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h index 42058e4a3f..2d9f5954f1 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -11,6 +11,13 @@ * Functions for SSE/AVX/AVX2/AVX512 implementation of memcpy(). */ +#ifdef RTE_USE_CC_MEMCPY + +#define RTE_CC_MEMCPY +#include + +#else + #include #include #include @@ -767,4 +774,6 @@ rte_memcpy(void *dst, const void *src, size_t n) } #endif +#endif /* RTE_USE_CC_MEMCPY */ + #endif /* _RTE_MEMCPY_X86_64_H_ */ diff --git a/meson_options.txt b/meson_options.txt index e49b2fc089..69a01f6578 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -60,3 +60,5 @@ option('tests', type: 'boolean', value: true, description: 'build unit tests') option('use_hpet', type: 'boolean', value: false, description: 'use HPET timer in EAL') +option('use_cc_memcpy', type: 'boolean', value: false, description: + 'Have the functions of delegate to compiler/libc memcpy() instead of using custom implementation.')