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 81D3C45698; Wed, 24 Jul 2024 10:22:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D779942E96; Wed, 24 Jul 2024 10:22:15 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2048.outbound.protection.outlook.com [40.107.105.48]) by mails.dpdk.org (Postfix) with ESMTP id 3DBE841153 for ; Wed, 24 Jul 2024 10:03:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EbNaT5Q1/G6CDBqsQhd5i/f85pzBmdkXQwigjZcVlzZ2/BSqojIYfV5tXlG0Xs8UceMo4vpnJ/ONxC1AZA+dqBiGKszCsX0Wg6L8bAKGEZMnK6NfBCh5czX3pAJ++sWmRW4e8LmzEaUu6yiObVqAzGwuSXi439vPRoTTKXP80abgShitl1QXwe++c70+idn/+tUnDK0NfCw3uKd10aN8CIrqMVRbCNYwaOdiWKEwq2Cbc5nRUoLSBCQj740NZ1b7FuXPvLNqmy9dM64yDzT7FDOO+RYwF2zR72fH2vwt61h8UfYFYnY5kMDkfbkuJNke67Fg3IVLoTDeC2t70BPb4Q== 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=H6YD9w0ifSYMkuXsaTV08sUvw3R/IPgHABBXhpNYCrQ=; b=pP/mhSBMSl1kTJnypFr9ZGTVUK8WTn+JDOZddZTJalLAyO8t/cDRf8xJilTvgaUewU1iDjm3UEZA9enuOSbOqizGu7V5ddqwvpcYOMJWm6Lu22DqaAWkEhTi80IMGJT0DNtOfteZRwIqBFnJdpDYvSoXKlO+CqOYGhj8+UNdpUpn28ZFc5aWDc9p7pqp387LxmbvboZy7FqhcppXeM/Z355mO8wW1voXhpG3d+bocdOGKW0aKdEXu6G39MQwO7Qfyf528BQy+UVXFxhbE74f5Ld1TFNKjpoFuUurqX11XSVXDqJT4mMDWv/rRMzwcJD7pT7P3FHUZg6iQSFF3wWc8g== 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=H6YD9w0ifSYMkuXsaTV08sUvw3R/IPgHABBXhpNYCrQ=; b=V45LrKl9u2ho0YUgT3u4NfVhbYqnq60kR35uG9TQ7lamWfHGdgLRmFM5br/GloscEckgJLzcM2/DHEh9kmJgvHjgi0nOrZ5raEnjiqADg22BjpVOmpyN28+SWRlqStO7NeNZgB2oXW7iKzlCnSEHbttyOBRBp0TiW140znGfHTjnCEB0Py0kotXNXYi979/2T0O+xBj0Z02iKx2Lvq6aDWYfZ+RUuoGBzBHf0Bfl943S+SWTiBCrrbczMd9yvwXj11Uv42uf3eeZYIrvw59Jm5nxJCVWLfmRfzPAr/logxZs/60585oF5c4TCdBgs3nxoyU7rWHM8k6ELY1kRe39Zg== Received: from DB6PR0301CA0083.eurprd03.prod.outlook.com (2603:10a6:6:30::30) by PR3PR07MB6907.eurprd07.prod.outlook.com (2603:10a6:102:5f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.6; Wed, 24 Jul 2024 08:03:42 +0000 Received: from DU6PEPF00009524.eurprd02.prod.outlook.com (2603:10a6:6:30:cafe::db) by DB6PR0301CA0083.outlook.office365.com (2603:10a6:6:30::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.18 via Frontend Transport; Wed, 24 Jul 2024 08:03:42 +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 DU6PEPF00009524.mail.protection.outlook.com (10.167.8.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.11 via Frontend Transport; Wed, 24 Jul 2024 08:03:42 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.61) with Microsoft SMTP Server id 15.2.1544.11; Wed, 24 Jul 2024 10:03:41 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id B290A380061; Wed, 24 Jul 2024 10:03:41 +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 v5 4/6] eal: provide option to use compiler memcpy instead of RTE Date: Wed, 24 Jul 2024 09:53:55 +0200 Message-ID: <20240724075357.546248-5-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724075357.546248-1-mattias.ronnblom@ericsson.com> References: <20240620175731.420639-2-mattias.ronnblom@ericsson.com> <20240724075357.546248-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: DU6PEPF00009524:EE_|PR3PR07MB6907:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f646f8e-a206-4a82-40f2-08dcabb72266 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WG9ZWUcyS2dDb0NwREtYUGxKb2VEZmtrUjVYbnJxU1JJS0RGWGh5SjdJM1Zp?= =?utf-8?B?VkdCVE1JaUdxZ2RlcWt1VTJSOUxmZE5GK0xXNVF0MW9TTGttOHdBRGJSYWUy?= =?utf-8?B?RDllYllZNlZ3TENiVVY1UkpxWjNzSXc5UGFydStPdmZCWXFkd3NBY2o0SGNp?= =?utf-8?B?TEtuK2Q2RDRkNVovL3EyYkVaTjVmMWcrK0ZvbjE1clNNSUlWU09DcWlNTWFU?= =?utf-8?B?a1hZbW9PcTdkWGxoaW1PbzdpQ3pPazBxbjVLaTFGOFZjWDlpZHQxWW12QTJR?= =?utf-8?B?SGZnUnJjTGhRemloTGpMSk82c01TTm51SkNUa2dzejRVMlBXNGNNK1l1ampZ?= =?utf-8?B?VVBLTzNsblBoT3NRS29MOTAxUE9zQjQyaWpBcStvS25pS3pMSmtGenpEZ0Iy?= =?utf-8?B?RmNvY0xCQzMrNGcrZXpXcldCRHZwQUNwdXo0VWVsMTN5bGVnN1dmWnBSWDNE?= =?utf-8?B?K1N1dks3V0o4Tnp3S3ZyM3pzWTd5UkJ5NVpkMXdGWTUrV056aG9pQ2UwUzhP?= =?utf-8?B?ZFRNYU5jd2VyWTNML1g3RHp2NnVCcFMveExBRU1pY04yNERyb3RyY3lSYnY5?= =?utf-8?B?UmRxVTRFQXFTbC9jS2ZBSGo0b1drNjgxd080c3d3VUhvQzBZMHVRMnJKamZC?= =?utf-8?B?YlpBWlMzTGNZRG5PUzZmZFlKaisyTnl1Qyt2YmtvLytIdjJSQVM0RFJoMWp3?= =?utf-8?B?TERSMTJJS2VmTjVSN0NycGlUS3c3VDdOdGR4aXhDamlrU2VGdGJpZ3h5ZnJt?= =?utf-8?B?MGZPMWFoM1dMc0I2OHF2dUVJNnI3VkhsQVlhSS9QWkJML3BjQ1hxVllLWlJx?= =?utf-8?B?eWNCN3YwemFhbitqQXNnUVZqcjJRWGtPZ3duR3RoTllZQmZVNTdiOFNZcVNZ?= =?utf-8?B?NUNKQW9iQlduREJ0THVQY3hzcWtYSGg1QlNucXFjTjkyRUJBd2Z6ekhHS0NW?= =?utf-8?B?QXNIWmJXbUMwQkdONkdBUys4QnJBekE4NmFOUEFWV3ErUWFYUllEemg4cXF6?= =?utf-8?B?TmR2Uk1TajBQTDE4eE5FMDA3OWtqZkRtUVNid3RHN2doWTExazNGVWRYMENJ?= =?utf-8?B?enBaSElScEdMMVdxNUpGOTFiN0FTZkkrcHdkUTJ4cThuQjN3Ti9vNXM0SzBE?= =?utf-8?B?TGVjRVRQdjFBV0FqT2krdFhMcTZmbGxDSU81Y1NYR0ZvTXVPVkw3dHpUYW9r?= =?utf-8?B?bXYwbTBHcnBuS0kxbksvNlV1NjNaeWFoN1RaNXFUR1gvVElrem10bUlhZGxG?= =?utf-8?B?Tkc0dG44ZlJ1ZEdLWHVmdlB3N2xOYlFsWWhOWldrTW9wOTc5UWlSdEJtNXZn?= =?utf-8?B?VHUxNkY2Qi9XY00vZWpoaURSNFBnRmthSkhvRE92a1lEZkJISVlmc3NqRHJE?= =?utf-8?B?M0wyUkFNMVY5cVh1d3Z0NXNZMW55MHVjVVV2eXFLQ1JCd1dNTis5ay9VRVpz?= =?utf-8?B?RHo3T2RzblZWSXJRZjdyRHlnazM2ZjBnNXhUK2lqR1V2R01saFg2YmptSE5k?= =?utf-8?B?RENETUN4bUZKYjN2RUtZd2ZKZnN0OFdjZHRtbjhRYlp6b3BzYWFvNENBOEE4?= =?utf-8?B?UTY5T0dhNHU5UFRmR3prVmU3ekJWVWw5NkJxZW9UVFZPZHlxV2pSYVpYbFQz?= =?utf-8?B?Qi9pMWdtNFgrbTZoRjliWEFhTkxybFRjSTB6bTZIb0h6Q2VpUmFpbFdnY0JK?= =?utf-8?B?Wkk3aVpMNCs3OVpYeXlTbE5MRHhxbzFMMWtzRElMRUVlQy9tT0tWR3d5bkFu?= =?utf-8?B?WEdDNk9HZ1Q0c1Q1bGZXMlRseTcraUJ3bG54eE5ON0JIdjhKbFNDSVBCcTQ2?= =?utf-8?B?RkVORjhZc2FMY2R4YjYwVzVxZmhqQXhZRXZaVkJUb21NdXRTTmVLNWdTdzFZ?= =?utf-8?B?THErUlVFSnA1SHRCRWpFNytnMVU2OC9aVFMvRzVxZ0w2bnQ5SjNFTlEzbEpt?= =?utf-8?Q?yIXmObnSyUSw2Im2u0ml6OBcuydOUSMJ?= 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)(36860700013)(82310400026)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 08:03:42.3478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f646f8e-a206-4a82-40f2-08dcabb72266 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: DU6PEPF00009524.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6907 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 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_07.rst | 21 +++++++++ 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, 110 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_07.rst b/doc/guides/rel_notes/release_24_07.rst index eb2ed1a55f..31af6303b3 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 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). + .. 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..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.34.1