Message ID | 1462869064-9423-1-git-send-email-jianbo.liu@linaro.org (mailing list archive) |
---|---|
State | Changes Requested, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id BF18295CF; Tue, 10 May 2016 10:31:49 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id E44D995CC for <dev@dpdk.org>; Tue, 10 May 2016 10:31:48 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2AF3F3C; Tue, 10 May 2016 01:31:59 -0700 (PDT) Received: from Overdrive.asiapac.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 652C73F21A; Tue, 10 May 2016 01:31:47 -0700 (PDT) From: Jianbo Liu <jianbo.liu@linaro.org> To: dev@dpdk.org, jerin.jacob@caviumnetworks.com Cc: Jianbo Liu <jianbo.liu@linaro.org> Date: Tue, 10 May 2016 14:01:04 +0530 Message-Id: <1462869064-9423-1-git-send-email-jianbo.liu@linaro.org> X-Mailer: git-send-email 2.4.11 Subject: [dpdk-dev] [PATCH] arm64: change rte_memcpy to inline function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Jianbo Liu
May 10, 2016, 8:31 a.m. UTC
Other APP may call rte_memcpy by function pointer,
so change it to an inline function.
Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
---
lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Tue, May 10, 2016 at 02:01:04PM +0530, Jianbo Liu wrote: > Other APP may call rte_memcpy by function pointer, Instead of "Other APP" may be better to use DPDK application > so change it to an inline function. > > Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > index 917cdc1..3abe7cd 100644 > --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > @@ -78,7 +78,11 @@ rte_mov256(uint8_t *dst, const uint8_t *src) > memcpy(dst, src, 256); > } > > -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) > +static inline void * > +rte_memcpy(void *dst, const void *src, size_t n) > +{ > + return memcpy(dst, src, n); > +} > > static inline void * > rte_memcpy_func(void *dst, const void *src, size_t n) > -- > 2.4.11 >
2016-05-10 14:01, Jianbo Liu: > Other APP may call rte_memcpy by function pointer, > so change it to an inline function. Any example in mind? > --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) > +static inline void * > +rte_memcpy(void *dst, const void *src, size_t n) > +{ > + return memcpy(dst, src, n); > +} It has no sense if other archs (arm32, ppc64, tile) are not updated.
On 13 May 2016 at 23:49, Thomas Monjalon <thomas.monjalon@6wind.com> wrote: > 2016-05-10 14:01, Jianbo Liu: >> Other APP may call rte_memcpy by function pointer, >> so change it to an inline function. > > Any example in mind? > It's for ODP-DPDK. >> --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h >> +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h >> -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) >> +static inline void * >> +rte_memcpy(void *dst, const void *src, size_t n) >> +{ >> + return memcpy(dst, src, n); >> +} > > It has no sense if other archs (arm32, ppc64, tile) are not updated. > But it also an inline function on x86. Sorry for my late reply...
2016-05-19 21:48, Jianbo Liu: > On 13 May 2016 at 23:49, Thomas Monjalon <thomas.monjalon@6wind.com> wrote: > > 2016-05-10 14:01, Jianbo Liu: > >> Other APP may call rte_memcpy by function pointer, > >> so change it to an inline function. > > > > Any example in mind? > > > It's for ODP-DPDK. Given that ODP is open (dataplane), you should also consider ppc64 and tile. > >> --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > >> +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > >> -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) > >> +static inline void * > >> +rte_memcpy(void *dst, const void *src, size_t n) > >> +{ > >> + return memcpy(dst, src, n); > >> +} > > > > It has no sense if other archs (arm32, ppc64, tile) are not updated. > > > But it also an inline function on x86. In x86, it was implemented as a function because there is some code. If you want to make sure it is always a function, even in the case of just calling memcpy from libc, you should put a doxygen comment in the generic part and adapt every archs.
2016-05-19 17:56, Thomas Monjalon: > 2016-05-19 21:48, Jianbo Liu: > > On 13 May 2016 at 23:49, Thomas Monjalon <thomas.monjalon@6wind.com> wrote: > > > 2016-05-10 14:01, Jianbo Liu: > > >> Other APP may call rte_memcpy by function pointer, > > >> so change it to an inline function. > > > > > > Any example in mind? > > > > > It's for ODP-DPDK. > > Given that ODP is open (dataplane), you should also consider ppc64 and tile. > > > >> --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > > >> +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h > > >> -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) > > >> +static inline void * > > >> +rte_memcpy(void *dst, const void *src, size_t n) > > >> +{ > > >> + return memcpy(dst, src, n); > > >> +} > > > > > > It has no sense if other archs (arm32, ppc64, tile) are not updated. > > > > > But it also an inline function on x86. > > In x86, it was implemented as a function because there is some code. > If you want to make sure it is always a function, even in the case > of just calling memcpy from libc, you should put a doxygen comment in > the generic part and adapt every archs. no news? a v2 would be welcome
On 17 June 2016 at 18:30, Thomas Monjalon <thomas.monjalon@6wind.com> wrote: > 2016-05-19 17:56, Thomas Monjalon: >> 2016-05-19 21:48, Jianbo Liu: >> > On 13 May 2016 at 23:49, Thomas Monjalon <thomas.monjalon@6wind.com> wrote: >> > > 2016-05-10 14:01, Jianbo Liu: >> > >> Other APP may call rte_memcpy by function pointer, >> > >> so change it to an inline function. >> > > >> > > Any example in mind? >> > > >> > It's for ODP-DPDK. >> >> Given that ODP is open (dataplane), you should also consider ppc64 and tile. >> >> > >> --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h >> > >> +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h >> > >> -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) >> > >> +static inline void * >> > >> +rte_memcpy(void *dst, const void *src, size_t n) >> > >> +{ >> > >> + return memcpy(dst, src, n); >> > >> +} >> > > >> > > It has no sense if other archs (arm32, ppc64, tile) are not updated. >> > > >> > But it also an inline function on x86. >> >> In x86, it was implemented as a function because there is some code. >> If you want to make sure it is always a function, even in the case >> of just calling memcpy from libc, you should put a doxygen comment in >> the generic part and adapt every archs. > > no news? > a v2 would be welcome Hi Thomas, Please close it, since there is already a solution to this issue in odp-dpdk. Thanks! Jianbo
diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h index 917cdc1..3abe7cd 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h +++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h @@ -78,7 +78,11 @@ rte_mov256(uint8_t *dst, const uint8_t *src) memcpy(dst, src, 256); } -#define rte_memcpy(d, s, n) memcpy((d), (s), (n)) +static inline void * +rte_memcpy(void *dst, const void *src, size_t n) +{ + return memcpy(dst, src, n); +} static inline void * rte_memcpy_func(void *dst, const void *src, size_t n)