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 23D5545497; Thu, 20 Jun 2024 09:35:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5650242E57; Thu, 20 Jun 2024 09:35:08 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2050.outbound.protection.outlook.com [40.107.22.50]) by mails.dpdk.org (Postfix) with ESMTP id 1829442D6A for ; Thu, 20 Jun 2024 09:34:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bTttURmeho0uHU/2YUN9TgE9Tho8iBk63l5GU6eQhEaNW7nQ/AWP3tY30cDTi4PgfkAdqwOZjiijIgXimyVfshCBdU7//JnRsOUxpLnPEFGe48eOsMDHfTy+8TwEm3MF/5KftOlwwrlR5RGUSnLv+w74f+tiJ4r6hl593K4SbeTYCymJs1iAaDFKe5qfp8lodlrWHPPhi2LfvAg3Ch4JOeNWxkb6ZhjICAh7znevepasKerh+Nf5IPd2KhaNENplK7p98Odl3DGdXnsPwSPzGhktOmK2uUmcjddH6Em1XBgBsaVRypI53X7pdSGc0N4pSPFZgiNYJq0Yxp/gFugTbA== 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=aek4T2jrwcx4FOGDoG8XWJZhFXjchuJ6i8AhmvZuNIg=; b=YntVbNRrgnfwYELJBmJLZDgC/9gVG0BxsCOD2WpNuX4ciZAB3NQTl+C98Awdjc/Z1QSrFfCJ5XuyXm2EzE9aR0Zg63REUQu1UJRTNGpf6+CJol9IO5eUXPs40K7dzzljPYxQ5lutCtFCrEBPC0SKllbev/IrB+4yvidEXKiK4edeAZ2LLcpDV7ekD7ugF4ahvlQuCdrmWwQyJq7iq+9b/P9XFRA+yTiVhHWJeAFRQOC8JjpuRyHALMngqdBjeThUoxzvZQhekeqg0uSlL3xkhJYmIG2fr5Qj9H4FBxaS2lfPG8PjWWM2YNgh0Z0/LOjN4sZpvEBkbkxE4nTZaUapNg== 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=aek4T2jrwcx4FOGDoG8XWJZhFXjchuJ6i8AhmvZuNIg=; b=x3UjWqZNP9QIsD2a8t2jbD82F7UelDS+qo+O9YYuJccXLZBmUxT7TeEuJCP3tTeFFuAo9S8ZQNNJBx7F9bv4UZOuhV4aD0nsRx49/buioSwMyGnn+0aYzJGS5JkZTkT1rVScfDJep07227qIgHeJoj6sbni6fDrLi10/o2SdNx9hfDYUeu1N9Ni3lk6yBJQqBdiofVxSk3Gi9ZJ0lS/vw4oB5upLT/B7/EQ7BtAQfoQEFYCYThNc8LatYnkZbGe+1wQH8SRU3Rbb19Fwt6qZAnJ/VVqbCuWVmoJDUVvU9hCN6I8szF2eK3Ydp1Ha+gj+A73cvetFO0BIC7ySBDpYsQ== Received: from DB9PR06CA0027.eurprd06.prod.outlook.com (2603:10a6:10:1db::32) by VI1PR07MB6669.eurprd07.prod.outlook.com (2603:10a6:800:185::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.18; Thu, 20 Jun 2024 07:34:54 +0000 Received: from DU2PEPF00028D00.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::26) by DB9PR06CA0027.outlook.office365.com (2603:10a6:10:1db::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33 via Frontend Transport; Thu, 20 Jun 2024 07:34:53 +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 DU2PEPF00028D00.mail.protection.outlook.com (10.167.242.184) 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 07:34:53 +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; Thu, 20 Jun 2024 09:34:52 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id C75911C006A; Thu, 20 Jun 2024 09:34:52 +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" , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH v2 6/6] eal: provide option to use compiler memcpy instead of RTE Date: Thu, 20 Jun 2024 09:24:52 +0200 Message-ID: <20240620072452.420029-7-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240620072452.420029-1-mattias.ronnblom@ericsson.com> References: <20240605064945.369310-1-mattias.ronnblom@ericsson.com> <20240620072452.420029-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: DU2PEPF00028D00:EE_|VI1PR07MB6669:EE_ X-MS-Office365-Filtering-Correlation-Id: 72d4e8c7-305b-450a-4c99-08dc90fb79dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: =?utf-8?B?Q05KRW5tVTlMUXZTYmVlQVlwL3Y2WnczTS9SazBuQjdEYlhjQnM5KzNPT214?= =?utf-8?B?TTJxVExLdG50SUFLZVBGOHBFMEpjamkzQ3lydVhsdXN0YUZhRUdFc016RDVr?= =?utf-8?B?cnQzNW0wWStCajV2cFEwS1YycmVaeU5NNHdIellncjRkL01EWkduWUMxdFor?= =?utf-8?B?bUZGWEE3MUJYWXpLZkpVTVBuc0ZDRjBwT2JNOEI2SDh6MGFTbkJBK2dPSWV6?= =?utf-8?B?OXBaRXJIdmFwZmdaNjJ3SjBIdFpjVVJZaUZna0ZyV2hDaXMremJTZ3dSeEFV?= =?utf-8?B?dGhaOTZTM3lINm9GQTR3Rk9HVW1wclRVS0JIdHVaVzJGdkhTT25PcDhya1dx?= =?utf-8?B?NGZMcjVjZHZIR1hEUHRPeVJNZ1ZWV01uVnpxaGg3RFBGaXhYakR4OFdNNWZW?= =?utf-8?B?RUxiTXNONnJWcUlsdllLOGZraVp4ajh6OSsyS1dJVDY0Z0tVaCtHQVlNS1lQ?= =?utf-8?B?MWs2STlMSTA2bDI2cXpSSXNXQ3A4TGMwblZQVjEvaW9nOFIrU25sakdkVTMv?= =?utf-8?B?MmdUUmRYUGMyL1RXUjRERm5mMHJaZzVEOEZQZllVSjlxZFliMFEzWFNmU1RB?= =?utf-8?B?cE03bnJBaWw1M29ka0hkSGluZXJRbTlmYm02d25uZVVMUVNUNFA2QzJpQWd1?= =?utf-8?B?Z1FUcG02UEJOb0YzOVVmcnhYRkFHR2Z5Kytva29SSlRESm9mZ2Q0eTZiTjBx?= =?utf-8?B?dVZlL2xCWTdlNHdEcDAzS2s5cVovUk5WekRqQ3pjNHgrSllMM0lGMnl1ands?= =?utf-8?B?RWdUVG9xUDdqbjRQVjlPS1hCVE5uNHYxSTJmNW8xY0lYNGRBMDB4TEJiSGtq?= =?utf-8?B?VHlDVm9sR2VncVlhYXdWMG1HcjkvTzFEMEoweUZrcUQ0SlZlVHJ3OEZEelln?= =?utf-8?B?elhkTFpFRXVGYjBaY2kzVmxpanp5aVFiVWxJaWhUWEUwM1MxOGt5bG5SR2RG?= =?utf-8?B?dGE1ZnBhaG44NXc1eTRPWUFSRlZtMWxZcy9XM2F5TWsvNGpMQjVUeXo5SHlq?= =?utf-8?B?WUpmRloxSmZUZjlpcFl1WjB1OHhJdDc4MDBDUUFoYnl2UmhPbTJaUWRRNnFR?= =?utf-8?B?VUdtaFIzaFBDQkdqK3RnWVR0MEJGZ01iNWpwREtMbGN1RzhtTENlakRHbXlQ?= =?utf-8?B?cVprbzZOVnhiSE9qSlJQMG1FOUdMcjNqK1ZCWTBVL2x2S0JrUmZkdHdzcHQz?= =?utf-8?B?RUdkejRWQmF3SWFKczVvN0NWbGprTU5tZGMrSXk3Vkc5Z3daU2ZPaXdwQ3dq?= =?utf-8?B?by9WeUFPL3d5UEZXcENRekw2RmdiU0tsV3NMWmwwT2luQjYwQm4zbmx2d2pt?= =?utf-8?B?RVJxQ2dUSG5EL0N6cmFFRFZEdFp5REo4ZWlMNnVJYmMwTmxXdjhwaExmQU9v?= =?utf-8?B?L1E3akNmOW0xR3dJS2hBY1NHN2piQklRSktjMEJiWk1rSWdYR0VoTmEwSktX?= =?utf-8?B?MEhnUDdrZG0xMnpFNkc1T3VJeG8rakNoUXFTc3RkR3JuR0UwTklHT01SOGpS?= =?utf-8?B?QTlRRGpCVXBxM2UrN1A4aGdGNGlOSGpjK1lCV0lhWmJ6UWdGYXh3ZTBnK0ll?= =?utf-8?B?QjJiWkZDUWdjT2dDSlMyQWZtdXBjK2lhM0ZPZjJLZ09rOFN0SjRoMUc1cFQ2?= =?utf-8?B?K1hyQkVMT1Y4cHpHaGZ4MXRxS1VqbFRITjQ0RTh0Q1pFNXlpQXNSRW11SkxE?= =?utf-8?B?SEdUam1CbU5DcWxJaHYxeWkxWlQxa0EzSEtOV1RkYjF6MHluYUFFbEJVVGFL?= =?utf-8?B?Vm84dURLWEhUL2UycXloby82MUdSaklEbmplRFJzaHlHdnNhSlIzL3V2dEJJ?= =?utf-8?B?TTlKa1RRc3Rnckc5M0IyZTFmSlpmOXRIMVpSbVBKQ2tjd0pCWGtSUWxuZWp2?= =?utf-8?B?L055T2xjcTFYK210UmhzdEhRemZybzRCaUpUV2N0SDV5NVE9PQ==?= 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)(1800799021)(36860700010)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2024 07:34:53.4658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72d4e8c7-305b-450a-4c99-08dc90fb79dc 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: DU2PEPF00028D00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6669 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 a69f24cf99..4b6eafa86e 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