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 53CFE454AE; Thu, 20 Jun 2024 20:08:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02D4F42EBF; Thu, 20 Jun 2024 20:07:56 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2049.outbound.protection.outlook.com [40.107.14.49]) by mails.dpdk.org (Postfix) with ESMTP id EAE4B42E8B for ; Thu, 20 Jun 2024 20:07:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CZ9ENFksCq1gZ6C1tSPfCZlA8tQRlb/vi6IUN4hg3KlMx/ynbF+nAPacjUks9cmYa4N1CeQi2e9EApcAVik4ChrMWAt38iv/DQ45IeYkfU5sue7WY+5lnVOgcX+XaKnOYK3JDqUDrNEA1kcVLE73B8QdQF05Y34rHkDQ8a7bom6XH2P2F116UGjO1VOF3dtxjfY3S2kamkpRVkTZS0V9s8SNXoKxbhLc26f60BIpQV1k9wny49VWVD98ZzAWKdyUwI/SarJCicGspWbTgnR/L9yK6WfPzEkBDjwoFUYmu12yRNuFnE19M4zIz+W+KXe+u6j0w8pbi8LmvBvgCa2LZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ysk/ZTVZMtT3HLZJRfy5SLtflvmdk/1h/hZdabTrFNM=; b=T4B+Y5RkC97NqY38tHiWeSM5pvdG45SkR/6FlFHvY8/K8gWF+TIYxqqBPQvEQJ013mkLChSj+LiXd7khMnkzIKp3+QT81gZnzeFRmz9fKC7w1pRItIEtn3ZGV0AzKFZqD5ww5NwvXGe63bw3NjpX0Q6RbMV3Uq/xq7/ROsNvicqEsQd5NAVct2x7KROmsxksLqkVb8cdEcRffI3wGhVmhKCVlteoe7cIv37T69qHepIditayPFUMBinNpMa/3/H1Ax1SmH282bMW0NAsDP/sKvBluoie8vl/SYl6Re+hF1jrBrEx/BWRyuZTGPEClYKKdA5gpz2P1A8bmg2aUW6cAQ== 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=ysk/ZTVZMtT3HLZJRfy5SLtflvmdk/1h/hZdabTrFNM=; b=a26PFDt8IcSWMm2HxKOQhpw5bYx3P7VdZAz3k/8h3Dcoz62YyAeP4QmyCDxUncfVO1ZM6P96lQjuS1PFRfXm9HK3OGiycozvLTOvYiMIGb6wNITFxGEs13MmAtKP7miiiqWt77HEfIYwtFzKBKsJz9aUlxfbZRtQmJJGG0zUg6LTxVhFv1MDt9tAJYjPitZZNDHaeyiai+NBSKESszasSkC7Jk9d77UnNwN1DGEHLz7ekhCwoKuMAXGAp7x8uf5sA+AHFs6EugHPRzQXPCWZ1z1mvuiRoBDCeN4jJ9sXblzS8FOtsJojDb1cMgFMZmyQvqiYOuUuWeHv2IoKvQ5zFQ== Received: from DB3PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:8:1::49) by AS5PR07MB9818.eurprd07.prod.outlook.com (2603:10a6:20b:653::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.21; Thu, 20 Jun 2024 18:07:38 +0000 Received: from DU6PEPF0000A7E4.eurprd02.prod.outlook.com (2603:10a6:8:1:cafe::fb) by DB3PR06CA0036.outlook.office365.com (2603:10a6:8:1::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.34 via Frontend Transport; Thu, 20 Jun 2024 18:07:38 +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 DU6PEPF0000A7E4.mail.protection.outlook.com (10.167.8.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Thu, 20 Jun 2024 18:07:38 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.68) with Microsoft SMTP Server id 15.2.1544.11; Thu, 20 Jun 2024 20:07:38 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id E62DA380061; Thu, 20 Jun 2024 20:07:37 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Stephen Hemminger , Abdullah Sevincer , Pavan Nikhilesh , David Hunt , "Vladimir Medvedkin" , Bruce Richardson , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH v4 13/13] eal: provide option to use compiler memcpy instead of RTE Date: Thu, 20 Jun 2024 19:57:31 +0200 Message-ID: <20240620175731.420639-14-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240620175731.420639-1-mattias.ronnblom@ericsson.com> References: <20240620115027.420304-2-mattias.ronnblom@ericsson.com> <20240620175731.420639-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: DU6PEPF0000A7E4:EE_|AS5PR07MB9818:EE_ X-MS-Office365-Filtering-Correlation-Id: eeb2b283-e769-4ed2-6fd9-08dc9153ded5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|36860700010|376011|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MzdXWHJXWDhIOGJCdjROOE91T0dqWktBUlRvRE4xK2d3cjI3RUtHQ3BLcC9H?= =?utf-8?B?aElHK2lsR1pFbm1ORjJVbkU1ekVSMHFIMEh1U3R2WHZqNHN3QUt2MzdTN0d6?= =?utf-8?B?U3l5SU1TdkpleHN1eFNyWHNSRVZySTFPajJ6NTRBOXdyMFZZUFVpZ1BXOGJt?= =?utf-8?B?MGM3NjNoRGd3cnp5emQzbEtvQW5WUkhDeWdHMDRCR2psQy8xRmZiZE5mUnpL?= =?utf-8?B?WmFjcFpJZGY5WXRCUmJsTzdNSE8xVXEvelRIbDYyTlBxWlNJVDY5RzZQSWh0?= =?utf-8?B?NmlDVVBIUG5VeEdNMm5MVjB3NXlOcmlxSGdIeVF4TVNzbjltSXJTd3FlVHBZ?= =?utf-8?B?Z0xicytUa0g5eDZBMnRaeVpRUW9ONW4zcUxhRlcvZGg5SW15MXUwMjZmNXFv?= =?utf-8?B?TEF5dGl6SFJ5MzVmdDRsWjdyaXFzak9IVVY2dFNPWnJVU2szbXZmWXROb2hO?= =?utf-8?B?NjBnWDRLcENLNXp3RkpSRmNQME44Sm1IWGNha01qSEkrczU0QW1rK2YyMHJI?= =?utf-8?B?eTZKalpmaGwxTkUzTXZxOHB1Zkhrd1plcVpTYUl1NEVPWkJEZ1V5OUhiVGRF?= =?utf-8?B?dmV2UDVPZXBwZWgvSUlPS3ZJUU02MG5YQlRVeEpsWDF1THFvZDVPSFZDZGRJ?= =?utf-8?B?REtsTG5VZE9ENGVMN3F6V2hIMkRraTBDNGJlSHFydXFKMk1RSFdIeElNZHlo?= =?utf-8?B?RlUvaXAxOVVJbnRoU3ZMSUhGcHNtTmYyUTVuNmY3Q0hzQWM3a0p6T0UwZllT?= =?utf-8?B?WkxsNWEyaW96Skg2ZGJGQXdLSG9JdzBMSTFQTXlOR051b0ZDMkpPNVpJUmZD?= =?utf-8?B?RTBDL3dzcVJJWHBuQmhYV0I2MTdNMXN6Z0hSZVpsUWhCdmQwalRQeFdMSGJk?= =?utf-8?B?L0Fuc2lSVEh2OW9DUWVocWZkeFgxdFV6TWNubVgyVm10blFDa0xYeEtUU3Bq?= =?utf-8?B?RnltUThlQjIrWUNFNjRQRmZLaVF4YXh2eGI5UDV2NjgyMk5GSVpteGd6MTV6?= =?utf-8?B?a2c3RGl3V2YzMlllWndzaUM0QktKeGhObVFVb2FwTStQWkt5REF1N044NGVz?= =?utf-8?B?ZW4wNkR1ZjhlMk90YUcrc2hYb0NZOGlnWjJPZnNMVzdLRlQ5NUEwK1cwZVht?= =?utf-8?B?SnlQajZPRUFJaTREZ0w3ZndBQzlJd25zUUptaytqZjRSaXR6VDNjSVRITk43?= =?utf-8?B?YWh0ODZDZjA2OTFLUzJIaUlIeTRGYnFqMHRvUjhOM3paZ2haZGgzTHNZK0R2?= =?utf-8?B?VGxaU2dTaXk1UDMwSTZmNm9rNk4zVzNhTVU2ZndDMTlRTkt4N2psU3ppYWx4?= =?utf-8?B?UUdGOVUzamFjYlVnL3pUZVZuRWZLOG1Vam9MZFhkaHVnR1RnTG13aTlUNG5Z?= =?utf-8?B?TGRrdyt6dC9wZ3JRaHN5bExhd0hjdnMxVWdwTmwxVytqVEZvMEdabmNKaDRr?= =?utf-8?B?bVNqSXRzdm9vUmFFbitsdDNaTm5FbTkzSFZpdGxxVWR1VnlZa2F6L1QvTnpP?= =?utf-8?B?SFRnZmkwQUsvblBqOG8xVDB3MnRhY2JPREZIWEgzY2F5UXlEdk9jN0dVVEpk?= =?utf-8?B?bDRjTjNxdDgwd29xV1RnNFVhMldaYzRES05FZndTTHd2aUZ6V0sybXprVVpU?= =?utf-8?B?c0ZaRnNMNkxxNVRlU2RpZ2hpZTdLeFBVd3lFQUJsZXdRMGl6QlBmUGV6eC9P?= =?utf-8?B?K21uRitkbFZRN2NkejkrVEZWL3VyRW5PWE1WSlFMZ3VtNnduaDRaa09GQnc4?= =?utf-8?B?Zng2ZHlZTGsxOEFIVUYyT3VZQmg4b2J5MW1UaWQvU3ppeU9DTGpjS1Y2T0JL?= =?utf-8?B?WVNCOVdoU1hBYzRCWGlrWk5TNDZQNVhIZzFQN1ptT2h4UHBDbUpqdFdjNEVM?= =?utf-8?B?cVB0R1E4UGEwY21CYThxVmxHQU1JYmdMOWIwMVdMSkVBS1E9PQ==?= 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:(13230037)(82310400023)(36860700010)(376011)(1800799021); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2024 18:07:38.5829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeb2b283-e769-4ed2-6fd9-08dc9153ded5 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: DU6PEPF0000A7E4.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR07MB9818 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 compiler/libc memcpy() 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. This patch leaves an option to stay on the custom DPDK implementations, would that prove beneficial for certain applications or architectures. 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: 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_07.rst | 21 +++++++++ lib/eal/arm/include/rte_memcpy.h | 10 +++++ lib/eal/include/generic/rte_memcpy.h | 61 +++++++++++++++++++++++--- lib/eal/loongarch/include/rte_memcpy.h | 53 ++-------------------- lib/eal/ppc/include/rte_memcpy.h | 10 +++++ lib/eal/riscv/include/rte_memcpy.h | 53 ++-------------------- lib/eal/x86/include/meson.build | 1 + lib/eal/x86/include/rte_memcpy.h | 11 ++++- meson_options.txt | 2 + 10 files changed, 117 insertions(+), 106 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_07.rst b/doc/guides/rel_notes/release_24_07.rst index 7c88de381b..ebe0085d8b 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -24,6 +24,27 @@ DPDK Release 24.07 New Features ------------ +* **Compiler memcpy replaces custom DPDK implementation.** + + The memory copy functions of ```` now 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 available, and may be reactivated by + setting the new ``use_cc_memcpy`` build option to false. + + 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 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). + .. This section should contain new features added in this release. Sample format: diff --git a/lib/eal/arm/include/rte_memcpy.h b/lib/eal/arm/include/rte_memcpy.h index 47dea9a8cc..e8aff722df 100644 --- a/lib/eal/arm/include/rte_memcpy.h +++ b/lib/eal/arm/include/rte_memcpy.h @@ -5,10 +5,20 @@ #ifndef _RTE_MEMCPY_ARM_H_ #define _RTE_MEMCPY_ARM_H_ +#include + +#ifdef RTE_USE_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..cae06117fb 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_USE_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_USE_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..344b4416b5 100644 --- a/lib/eal/loongarch/include/rte_memcpy.h +++ b/lib/eal/loongarch/include/rte_memcpy.h @@ -5,57 +5,12 @@ #ifndef RTE_MEMCPY_LOONGARCH_H #define RTE_MEMCPY_LOONGARCH_H -#include -#include +#include -#include "rte_common.h" - -#ifdef __cplusplus -extern "C" { +#ifndef RTE_USE_CC_MEMCPY +#define RTE_USE_CC_MEMCPY #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 +#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..645fd83986 100644 --- a/lib/eal/ppc/include/rte_memcpy.h +++ b/lib/eal/ppc/include/rte_memcpy.h @@ -6,6 +6,14 @@ #ifndef _RTE_MEMCPY_PPC_64_H_ #define _RTE_MEMCPY_PPC_64_H_ +#include + +#ifdef RTE_USE_CC_MEMCPY + +#include + +#else + #include #include @@ -215,4 +223,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..4acdc4af5f 100644 --- a/lib/eal/riscv/include/rte_memcpy.h +++ b/lib/eal/riscv/include/rte_memcpy.h @@ -7,57 +7,12 @@ #ifndef RTE_MEMCPY_RISCV_H #define RTE_MEMCPY_RISCV_H -#include -#include +#include -#include "rte_common.h" - -#ifdef __cplusplus -extern "C" { +#ifndef RTE_USE_CC_MEMCPY +#define RTE_USE_CC_MEMCPY #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 +#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 72a92290e0..c5ba74d2ed 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -11,12 +11,19 @@ * Functions for SSE/AVX/AVX2/AVX512 implementation of memcpy(). */ +#include + +#ifdef RTE_USE_CC_MEMCPY + +#include + +#else + #include #include #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -878,4 +885,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..06f544b631 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: true, description: + 'Have the functions of delegate to compiler/libc memcpy() instead of using custom implementation.') -- 2.34.1