From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=20R=C3=B6nnblom?= To: CC: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , =?UTF-8?q?Morten=20Br=C3=B8rup?= , "Stephen Hemminger" , David Marchand , Pavan Nikhilesh , Bruce Richardson , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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?B?anhybEdteTEvUW1nTkxUOFIvdEJFck5mSFRuVG80VWZFL3BlYnVWeDVreEZL?= =?utf-8?B?THZSTjBuR09OWGdNVXBQaEhCMnlERzNnWUpGUnBRaytNWEl1TzJ2MCt2SWxG?= =?utf-8?B?K3B5VG9qYlZ1bTlKSUhsK2Y4WVZtMVZESm1UUEdPSWJaQVQ5WkgxbWtMU0dU?= =?utf-8?B?Rml1bHhMUzRNZ3d6aU1tUnN6S0l5REJPbXhnejNQZHRkcnUyUHA4VjE1Z2VM?= =?utf-8?B?TjJOdkc2MmMvRTBEQ2toZENNVmJ5RVJqL2dycTk1d1JqYjdEdjh5UlFsditz?= =?utf-8?B?QXBTZHVLaG9WRTJoYVEybUhFYk54YVVNL0tNd3oxeUdhZEdLQkh4bWNOVTBm?= =?utf-8?B?eXdVK0grdjkzKzZ1T0ZxQUN5ZlZKUkM0MUwwTi8zSHF2aWQ1V0VhWnRZaE9i?= =?utf-8?B?MHRQeTVCaFd5c0pra2p1Z2NGM3JkeVUzMlIxeVcrcEQwMWtTdkxpZzRUTnlP?= =?utf-8?B?SjFzc1BLaHBxR1h3RzFqUE1oRS82UXlxVWJ6QVp3LzhzRWpyRlVuWVFLVUNy?= =?utf-8?B?OHc2MThWcWNFSEtkM1JvNmY2cDBweERmejVubEZOdnQ1ckV4bDNPb3NNOXRj?= =?utf-8?B?b0JoRkJQTTFMaTFhRDhjUEdubEFqNnE3WWtrMjY2ck9yZ3dQQ2ttODRpUi90?= =?utf-8?B?cnA3R3pCRHB5V2h2YmFUT1JzeHpkQ2VROHVGaExNam12bURJbmpVZjZQM3k0?= =?utf-8?B?MVVkSUFkNDBNMFZ5TkhUQlBTVExxdERBeGFYNE02MU9ZZnplblY3ZDVrQ1JD?= =?utf-8?B?ZkNKSGhodDhKVEQrSTJBMWlUWEo1WFp4cjN5ZVRXdkRHaEszNzZGWW1RYy8w?= =?utf-8?B?UzU4cWxHaFNqSjdxNEFmc3F0Z0V0YW5pcHpOS3RVSVluSmhCN2Y3L1lCKzAy?= =?utf-8?B?aysvRUJadW5vam5YaVpSMjJoYUxteThTZzN5N1oza2p6cjR2d0lDbGluQm9i?= =?utf-8?B?NFZzVXlvYVZZb0FQRzBaTGdHbjRScDdBdzN3TzVxeExMQmdsVmhFczdEbkJ3?= =?utf-8?B?UkxRZ1EzSXhFcEVLNWZ1dWhnOCsxSUp4RnA3aVkvSmprdStSWlJjclVxWTg5?= =?utf-8?B?VVp1WDhUVGtDSkJuV01UVWNKYXFTMWpjNDRLSmZBUXRCNkF3blhySWREQ1E0?= =?utf-8?B?My9xNGc4UEhCV2l3YUVPcEEySytDTEFXcHlCZlIxbHY4WXp0SUQzQjBnaUVp?= =?utf-8?B?S2MyV0V6aUZZaUdYNVMwTHR3dnZPc28vakNwblVXcWNmKzdmeDhEOUtFVk4z?= =?utf-8?B?dmg3U3o0QzJNb2VMMGFURWZ0aU5rdjdzaTRIOHhFQVh6SWU3UGlNUGE1cnd5?= =?utf-8?B?RHlJNzlvVWJqcllSS1V2U3F5OWk4UWswNWJVVEcyZHpqamVIV0FoY2JXdTdl?= =?utf-8?B?eGJPaERqY2cwWHJuandodjVzTzhRWUVOY3VLckhVbDM2RVRtUFN4TER0MUYv?= =?utf-8?B?TFRNeHdOM3grT1Fyb1BEeEVheDQrbURZc0NvSElCU0piVkUyOHFobVdhNlRu?= =?utf-8?B?SkdJR2xxWFl5ZHErZmhZM2kxaXYwTmRtemt0WWdCTTRLQ2E2N2UvdmJ2bEJR?= =?utf-8?B?bXhPcGxSR1EvdkpTazJJa3AzcWIvVFJCQllEZHpZSWF4dkZiRVBxSXJBNkdS?= =?utf-8?B?SjdsZmhJWWNTUHdIZHRxQ0YydG5oK2dQUVFZZ1B1OFFtdkxsWXcrMG5leS81?= =?utf-8?B?OFBQZUM2OWREeDZQZGt5Tm5PMG9zS1NqZ2VwK1Vxb2VaMFVKYkhwVG5ZSHB3?= =?utf-8?B?V1BEL2swVkpDWUNPNVRZOGxsWGpiUXJ4VSsyU1VoR1lSd2doK0R3amJMd2p5?= =?utf-8?B?bVV1SXhmSkMzVWlyNTE0dVc5U2xVYURQd00xMUVmLzRvYXJsRWxUWk9LdVVB?= =?utf-8?Q?43+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.') -- 2.43.0