From patchwork Sun Oct 18 10:10:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerin Jacob X-Patchwork-Id: 55175 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 0009222F11 for ; Sun, 18 Oct 2015 10:11:13 +0000 (UTC) Received: by lbbor1 with SMTP id or1sf17445567lbb.2 for ; Sun, 18 Oct 2015 03:11:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :content-language:spamdiagnosticoutput:spamdiagnosticmetadata :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:content-type :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=ViSRg9sBfP82eIaCgj5Ij4E2I5LJ52mSTNOQ7Fam9Ac=; b=iqjZCPemMvN7Tetusc4cKS5oYmU66mi4q6lpGgVkVxd8lqsXeCt9+Xsj55utYYYrfg moe2RDMHTrGmXLXG+/sS6+iVfO19IZCAwVlijRWopHDDVgU9EBKfNYaizmRuvpvgLvZP 3pCZBbx0b6x5iOMDHrEo8qp9XqR/d5PpcVESNGRn+1GSMv1ArR0y8mFhs8VTdxOsC01O PokWyMav2bblfn7RaJsOHXRzc1y7sSivC/Lmi82TqomnqXb1oJpZ2pBKFCe3SzBjzNVF zeZ4JJV1VvP39l9OP8gPWCTKtkQ+TecWXqgia45cNJcZhZb+6Sle2lqcGUedqFW8V99E rDrw== X-Gm-Message-State: ALoCoQnOkesMybGotH/GD1B6o21JUt9w1z8VT9kBEQzQsflXFs/jJnTUj9zpkJBhmr0FFdO0BmZX X-Received: by 10.112.159.4 with SMTP id wy4mr5774918lbb.15.1445163072966; Sun, 18 Oct 2015 03:11:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.169.198 with SMTP id s189ls413985lfe.87.gmail; Sun, 18 Oct 2015 03:11:12 -0700 (PDT) X-Received: by 10.25.19.216 with SMTP id 85mr8067065lft.68.1445163072780; Sun, 18 Oct 2015 03:11:12 -0700 (PDT) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id jd9si18921756lbc.140.2015.10.18.03.11.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 03:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lffv3 with SMTP id v3so95632881lff.0 for ; Sun, 18 Oct 2015 03:11:12 -0700 (PDT) X-Received: by 10.25.19.97 with SMTP id j94mr8090964lfi.106.1445163072303; Sun, 18 Oct 2015 03:11:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp894680lbq; Sun, 18 Oct 2015 03:11:10 -0700 (PDT) X-Received: by 10.140.148.210 with SMTP id 201mr22214917qhu.6.1445163070800; Sun, 18 Oct 2015 03:11:10 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 5si25708333qhh.43.2015.10.18.03.11.10; Sun, 18 Oct 2015 03:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 263C2619F7; Sun, 18 Oct 2015 10:11:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7C8A3619E4; Sun, 18 Oct 2015 10:11:01 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1E802619EA; Sun, 18 Oct 2015 10:10:58 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0083.outbound.protection.outlook.com [65.55.169.83]) by lists.linaro.org (Postfix) with ESMTPS id 4320C619E1 for ; Sun, 18 Oct 2015 10:10:56 +0000 (UTC) Received: from SN1PR0701MB1983.namprd07.prod.outlook.com (10.163.131.22) by SN1PR0701MB1982.namprd07.prod.outlook.com (10.163.131.21) with Microsoft SMTP Server (TLS) id 15.1.300.14; Sun, 18 Oct 2015 10:10:54 +0000 Received: from SN1PR0701MB1983.namprd07.prod.outlook.com ([10.163.131.22]) by SN1PR0701MB1983.namprd07.prod.outlook.com ([10.163.131.22]) with mapi id 15.01.0300.010; Sun, 18 Oct 2015 10:10:54 +0000 From: "Jacob, Jerin" To: "Savolainen, Petri (Nokia - FI/Espoo)" , "EXT Bill Fischofer" Thread-Topic: [lng-odp] [API-NEXT PATCH] api: clib: added standard c library api Thread-Index: AQHRCA2qPWFJr4yi3U6/R/LEN8kbg55xB8E0 Date: Sun, 18 Oct 2015 10:10:54 +0000 Message-ID: References: <1444997628-18104-1-git-send-email-petri.savolainen@nokia.com> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [132.245.22.149] x-microsoft-exchange-diagnostics: 1; SN1PR0701MB1982; 5:AuyyZU+EtIy2v7HNKEWIFEVjwbPTGrke+xbsOjQ9cttO02LfNXI9zYMdGyXmGSq+QQ4xNSmjG/Vky2boNdf5z2WuBA4+J2eTWmtUtjs6Gclo4aQsMlkhAJoTmesDYqNBgXZcrmlkEVulxvvmellnhg==; 24:hGArIJs8D2wM0fyupDzk1fF9nw9mxfTBIgZp8THItaT0kOPbOz7r0fHy9AJVYV/KwpEZ6m5ZFaB7xxd3bin7O/boKGZV7cTYw+h5Yk1thxU=; 20:BeCBzls4kzs5okIl2r1ZpxzRjUPlYhP4aLFiS+58t3QpcccUm7QLSP+d/sxOWna0yQ7fxy6uR9766mmHjYlAbw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0701MB1982; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(82608151540597); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001); SRVR:SN1PR0701MB1982; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0701MB1982; x-forefront-prvs: 07334CBCCD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(24454002)(189002)(199003)(377454003)(19627405001)(99286002)(50986999)(16236675004)(102836002)(46102003)(101416001)(5002640100001)(76176999)(92566002)(77096005)(64706001)(15975445007)(66066001)(54356999)(19580395003)(10400500002)(87936001)(19580405001)(106356001)(105586002)(106116001)(5004730100002)(5003600100002)(5001960100002)(19617315012)(81156007)(19625215002)(189998001)(97736004)(74316001)(5001920100001)(33656002)(86362001)(40100003)(2950100001)(5001770100001)(76576001)(11100500001)(5007970100001)(122556002)(2900100001)(5008740100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0701MB1982; H:SN1PR0701MB1983.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2015 10:10:54.0757 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1982 X-Topics: patch Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] api: clib: added standard c library api X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jerin.jacob@caviumnetworks.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 +1 Unlike embedded platform, Sometimes Enterprise platforms may not have luxury to run the apps built on its own toolchain. For instance, A armv8 Linaro tool chain can build the app and run on any armv8 compatible SoC's but it may not high optimized for specific platform as armv8 specification there lot of IMPLEMENTATION defined feature like prefetch etc. ​ Jerin ________________________________ From: lng-odp on behalf of Savolainen, Petri (Nokia - FI/Espoo) Sent: Friday, October 16, 2015 5:52 PM To: EXT Bill Fischofer Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] api: clib: added standard c library api If that’s the case an platform can implement these without extra effort. But when that’s not the case, an implementation can use whatever special instructions, vector engines or DMA HW it has to speed up these calls. See e.g. rte_memcpy in DPDK - it’s not just plain memcpy wrapper (they must have had a reason for optimizing it). -Petri From: EXT Bill Fischofer [mailto:bill.fischofer@linaro.org] Sent: Friday, October 16, 2015 3:17 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] api: clib: added standard c library api Why would you not expect a platform to provide an optimized implementation of these stdlib functions itself? GCC, in particular, seems to do a good job of this for most platforms. On Fri, Oct 16, 2015 at 7:13 AM, Petri Savolainen > wrote: Some C library calls are often used in data plane code. This API enables possibility to HW optimized implementation of those. Added first memcpy and memset. Signed-off-by: Petri Savolainen > --- include/odp.h | 1 + include/odp/api/std_clib.h | 64 +++++++++++++++++++++++++++ platform/linux-generic/Makefile.am | 2 + platform/linux-generic/include/odp/std_clib.h | 30 +++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 include/odp/api/std_clib.h create mode 100644 platform/linux-generic/include/odp/std_clib.h -- 2.6.0 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp diff --git a/include/odp.h b/include/odp.h index 825c7e1..f2cd2d3 100644 --- a/include/odp.h +++ b/include/odp.h @@ -56,6 +56,7 @@ extern "C" { #include #include #include +#include #ifdef __cplusplus } diff --git a/include/odp/api/std_clib.h b/include/odp/api/std_clib.h new file mode 100644 index 0000000..2119ec4 --- /dev/null +++ b/include/odp/api/std_clib.h @@ -0,0 +1,64 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP version of often used C library calls + */ + +#ifndef ODP_API_STD_CLIB_H_ +#define ODP_API_STD_CLIB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup odp_std_clib ODP STD CLIB + * @details + * ODP version of often used C library calls + * @{ + */ + +/** + * Memcpy + * + * ODP version of C library memcpy function. It copies 'num' bytes from source + * to destination address. Source and destination memory blocks must not + * overlap. + * + * @param dst Pointer to destination memory block + * @param src Pointer to source memory block + * @param num Number of bytes to copy + * + * @return 'dst' address + */ +void *odp_memcpy(void *dst, const void *src, size_t num); + +/** + * Memset + * + * ODP version of C library memset function. It sets 'value' to first 'num' + * bytes of memory block pointed by 'ptr'. + * + * @param ptr Pointer to the memory block + * @param value Value to be set + * @param num Number of bytes to set + * + * @return 'ptr' address + */ +void *odp_memset(void *ptr, int value, size_t num); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 85c976d..fc202cc 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -41,6 +41,7 @@ odpinclude_HEADERS = \ $(srcdir)/include/odp/shared_memory.h \ $(srcdir)/include/odp/spinlock.h \ $(srcdir)/include/odp/spinlock_recursive.h \ + $(srcdir)/include/odp/std_clib.h \ $(srcdir)/include/odp/std_types.h \ $(srcdir)/include/odp/sync.h \ $(srcdir)/include/odp/system_info.h \ @@ -108,6 +109,7 @@ odpapiinclude_HEADERS = \ $(top_srcdir)/include/odp/api/shared_memory.h \ $(top_srcdir)/include/odp/api/spinlock.h \ $(top_srcdir)/include/odp/api/spinlock_recursive.h \ + $(top_srcdir)/include/odp/api/std_clib.h \ $(top_srcdir)/include/odp/api/std_types.h \ $(top_srcdir)/include/odp/api/sync.h \ $(top_srcdir)/include/odp/api/system_info.h \ diff --git a/platform/linux-generic/include/odp/std_clib.h b/platform/linux-generic/include/odp/std_clib.h new file mode 100644 index 0000000..c939c48 --- /dev/null +++ b/platform/linux-generic/include/odp/std_clib.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_PLAT_STD_CLIB_H_ +#define ODP_PLAT_STD_CLIB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +static inline void *odp_memcpy(void *dst, const void *src, size_t num) +{ + return memcpy(dst, src, num); +} + +static inline void *odp_memset(void *ptr, int value, size_t num) +{ + return memset(ptr, value, num); +} + +#ifdef __cplusplus +} +#endif + +#endif