From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0082.outbound.protection.outlook.com [104.47.40.82]) by dpdk.org (Postfix) with ESMTP id 1223B1C852 for ; Wed, 4 Apr 2018 19:52:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=a1/PFwKZTKhLy5iufK/qMMr+FavII9WabVA2buYQJYA=; b=lNMtdZAJ/m9d1VEH895yNCYh5jhgKIP4mWTNh82jaqLhaMkUiDUd7AU+HRdwkjqCxDd8K8DLvlzd41oC0gq/KOMAoBKm/W/s1nnVzUw7kYLsY4KSlWzegftd8f4F8JmcRZys6a67tpGa/npH/a3JY+x6u2CLEhVjW4FfnHKiFUY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn (103.16.71.47) by DM5PR07MB3467.namprd07.prod.outlook.com (2603:10b6:4:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Wed, 4 Apr 2018 17:52:12 +0000 Date: Wed, 4 Apr 2018 23:21:57 +0530 From: Pavan Nikhilesh To: Matan Azrad , "jerin.jacob@caviumnetworks.com" , "keith.wiles@intel.com" , Thomas Monjalon Cc: dev@dpdk.org Message-ID: <20180404175156.GA5416@ltp-pvn> References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> <20180404101606.5156-1-pbhagavatula@caviumnetworks.com> <20180404164207.GA21153@ltp-pvn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [103.16.71.47] X-ClientProxiedBy: HK2PR02CA0188.apcprd02.prod.outlook.com (2603:1096:201:21::24) To DM5PR07MB3467.namprd07.prod.outlook.com (2603:10b6:4:67::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d26ad90-75c2-42cf-1f41-08d59a54cccd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR07MB3467; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3467; 3:D61A7tUQI818EkS0WYGFgSMGUn/c0iUHGq51Iiw/JDOU7gwi6W7Q2zAdraobKMMxTwjegvXMtobV+8aOqtgbx+lGkp0p6zRO0h2I6BeykRgcRVNhD/WEVOTs9GCjtMHt5wODsO/JAcSNNYgn/I5bsLRbqn6ddrVckzQlV1CE5iqxE/4b6zvT0U4iMyaU2A6ErUhWRGB48W1Ca+kOKmuoJWSdw90wGFm1DIn4z33YENKu82LDQADTNYrJ4IWW3/Ti; 25:NBw2eYeUvkQYPyLhSakN82EnBi4heLQZv1V9BgVOxA6dcGSKJ4Y2Wcc8PdrRNhQpuihu1uKGYfgCCkZRJuN+beZFWJK9dc92rzEiAiroqFB4kHbcjYcHMpx7KiudEfi2oePejAAp9TAO8dfSdPMpnlqgcBgdQ3Poe/P9/lqqfQQGWXqvJ23F7ncqY47wbxhe2nkfvj16dOfijlYQZ/RoCoiixH21Fq5QQP0S19bzFFpJxpXRmQsf7xtDWCSsEUcy4movVbyF2w2kyN9AVVcj/TozKJXhsNa1ySrekPx7oCPUgjUJtXHzvKH84gIgdDl8JYvkl28NzdHNx3n5eKAsTg==; 31:aAYAKtfARPFqWJ7kc4T9U872Er1BlBtRQc+/Kok2wl5OZRvN6AkbwdaSsuzJrHS2Q4Wj7+zzsBYL4UW4VsmM5ffButrWTch2GN3NV1tE9ZC9bmBrAFm0nONHnqH/d8si7cqJStxEWTT/M+zGOzK+5iME1p4CIgCT4A0ACh7QBALz2hEXoNH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am-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(244540007438412); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(10201501046)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR07MB3467; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB3467; X-Forefront-PRVS: 0632519F33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(39860400002)(396003)(366004)(346002)(189003)(199004)(16526019)(93886005)(2501003)(2906002)(66066001)(53936002)(72206003)(1076002)(97736004)(33656002)(229853002)(105586002)(6306002)(9686003)(2870700001)(33716001)(25786009)(47776003)(478600001)(6666003)(966005)(8936002)(81156014)(446003)(81166006)(6246003)(8676002)(2201001)(5660300001)(55016002)(52116002)(106356001)(476003)(110136005)(58126008)(2486003)(52146003)(50466002)(33896004)(11346002)(26005)(68736007)(3846002)(186003)(6116002)(956004)(6496006)(386003)(486006)(7736002)(316002)(76176011)(4326008)(23676004)(42882007)(305945005)(18370500001)(107986001)(42262002)(357404004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3467; H:ltp-pvn; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA3TUIzNDY3OzIzOmJFcHY1amNhOWFIMmdQMmxBOGd3SFQxS2h1?= =?utf-8?B?a3pKbHUybmppSU1NaEJLNWRSaExkMW5adG5JQXl2b0p2SE1XTk9NZ2lHbCs1?= =?utf-8?B?TmI0YW1OSUZ6SmxDNzNURStlZzkxTjN3N0VyanFwdkF0SnMzV1JLUlpvWC8v?= =?utf-8?B?K2NxWldLZHZta3hEOXAxU1p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L3xUFEVMTLrSb4etCYMCy/2NvBA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3467; 7:rqlXdZNKlELutGd9G5zFbtoWeaQvmNXN09KNWga8X+6uujv3HELzisx1EGEOauwocKUxOeYGC5lGQ6p8Sn/XUIKcI0iYA9ue3tkULgHTgCFRsU+6BiOmelyf1mpsAIAi9Ru/5mQ2B/V+4fv1Meke94aFWLAaWO/ew0C0OKtQPR3D2Fgi6OjpmnDPUtw4yhA9j0Z0czxqOzPT3Dq9betc8bnOEdlGMcMbpo6Hu1Ibo0/jCpdeDPjlJwd0jsxFEaQc X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2018 17:52:12.4062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d26ad90-75c2-42cf-1f41-08d59a54cccd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3467 Subject: Re: [dpdk-dev] [PATCH v3 1/2] eal: add API to align integer to previous power of 2 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 17:52:16 -0000 On Wed, Apr 04, 2018 at 05:11:22PM +0000, Matan Azrad wrote: > > > From: Pavan Nikhilesh, Wednesday, April 4, 2018 7:42 PM > > Hi Matan, > > > > On Wed, Apr 04, 2018 at 04:10:36PM +0000, Matan Azrad wrote: > > > Hi Pavan > > > > > > Shouldn't the new APIs be tagged with the experimental tag as agreed? > > > > Can't tag it experimental as it causes cyclic dependency (need to include > > rte_compact.h). > > You probably mean rte_compat.h. > > It is ok to add it, what is the issue with that? Change set: --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -23,6 +23,7 @@ extern "C" { #include #include +#include #ifndef typeof #define typeof __typeof__ @@ -233,7 +234,7 @@ extern int RTE_BUILD_BUG_ON_detected_error; * @return * The combined value. */ -static inline uint32_t +static inline uint32_t __rte_experimental rte_combine32ms1b(register uint32_t x) { x |= x >> 1; @@ -245,6 +246,10 @@ rte_combine32ms1b(register uint32_t x) return x; } Causes: In file included from /home/pavan/Work/clean/dpdk/build/include/rte_compat.h:8:0, from /home/pavan/Work/clean/dpdk/lib/librte_eal/linuxapp/eal/eal.c:27: /home/pavan/Work/clean/dpdk/build/include/rte_common.h:238:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rte_combine32ms1b’ rte_combine32ms1b(register uint32_t x) ^~~~~~~~~~~~~~~~~ /home/pavan/Work/clean/dpdk/build/include/rte_common.h: In function ‘rte_align32pow2’: /home/pavan/Work/clean/dpdk/build/include/rte_common.h:303:6: error: implicit declaration of function ‘rte_combine32ms1b’; did you mean ‘rte_combine64ms1b’? [-Werror=implicit-function-declaration] x = rte_combine32ms1b(x); ^~~~~~~~~~~~~~~~~ rte_combine64ms1b /home/pavan/Work/clean/dpdk/build/include/rte_common.h:303:6: error: nested extern declaration of ‘rte_combine32ms1b’ [-Werror=nested-externs] Cause: --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -245,6 +246,10 @@ rte_combine32ms1b(register uint32_t x) return x; } +#ifndef __rte_experimental +#error "__rte_experimental is not defined!" +#endif + /home/pavan/Work/clean/dpdk/build/include/rte_common.h:250:9: error: #error "__rte_experimental is not defined!" > > > Besides it's a simple proven math API I don't think it will change anytime > > soon. > > It has already discussed: > https://dpdk.org/dev/patchwork/patch/35211/ > > I think you need to add it anyway. > > > Thanks, > > Pavan > > > > > > > > Besides that, > > > Acked-by: Matan Azrad > > > > > > From: Pavan Nikhilesh, Wednesday, April 4, 2018 1:16 PM > > > > Add 32b and 64b API's to align the given integer to the previous power of > > 2. > > > > > > > > Signed-off-by: Pavan Nikhilesh > > > > --- > > > > v3 Changes: > > > > - Move commonly used code to rte_combine(32/64)ms1b so that it can > > > > be reused. > > > > > > > > v2 Changes: > > > > - Modified api name to `rte_align(32/64)prevpow2` from > > > > `rte_align(32/64)lowpow2`. > > > > - corrected fuction to return if the integer is already aligned to power of > > 2. > > > > > > > > lib/librte_eal/common/include/rte_common.h | 92 > > > > ++++++++++++++++++++++++++---- > > > > 1 file changed, 81 insertions(+), 11 deletions(-) > > > > > > > > diff --git a/lib/librte_eal/common/include/rte_common.h > > > > b/lib/librte_eal/common/include/rte_common.h > > > > index c7803e41c..7e147dcf2 100644 > > > > --- a/lib/librte_eal/common/include/rte_common.h > > > > +++ b/lib/librte_eal/common/include/rte_common.h > > > > @@ -223,6 +223,51 @@ extern int > > RTE_BUILD_BUG_ON_detected_error; } > > > > while(0) #endif > > > > > > > > +/** > > > > + * Combines 32b inputs most significant set bits into the least > > > > + * significant bits to construct a value with the same MSBs as x > > > > + * but all 1's under it. > > > > + * > > > > + * @param x > > > > + * The integer whose MSBs need to be combined with its LSBs > > > > + * @return > > > > + * The combined value. > > > > + */ > > > > +static inline uint32_t > > > > +rte_combine32ms1b(register uint32_t x) { > > > > + x |= x >> 1; > > > > + x |= x >> 2; > > > > + x |= x >> 4; > > > > + x |= x >> 8; > > > > + x |= x >> 16; > > > > + > > > > + return x; > > > > +} > > > > + > > > > +/** > > > > + * Combines 64b inputs most significant set bits into the least > > > > + * significant bits to construct a value with the same MSBs as x > > > > + * but all 1's under it. > > > > + * > > > > + * @param v > > > > + * The integer whose MSBs need to be combined with its LSBs > > > > + * @return > > > > + * The combined value. > > > > + */ > > > > +static inline uint64_t > > > > +rte_combine64ms1b(register uint64_t v) { > > > > + v |= v >> 1; > > > > + v |= v >> 2; > > > > + v |= v >> 4; > > > > + v |= v >> 8; > > > > + v |= v >> 16; > > > > + v |= v >> 32; > > > > + > > > > + return v; > > > > +} > > > > + > > > > /*********** Macros to work with powers of 2 ********/ > > > > > > > > /** > > > > @@ -250,15 +295,28 @@ static inline uint32_t rte_align32pow2(uint32_t > > x) { > > > > x--; > > > > - x |= x >> 1; > > > > - x |= x >> 2; > > > > - x |= x >> 4; > > > > - x |= x >> 8; > > > > - x |= x >> 16; > > > > + x = rte_combine32ms1b(x); > > > > > > > > return x + 1; > > > > } > > > > > > > > +/** > > > > + * Aligns input parameter to the previous power of 2 > > > > + * > > > > + * @param x > > > > + * The integer value to algin > > > > + * > > > > + * @return > > > > + * Input parameter aligned to the previous power of 2 > > > > + */ > > > > +static inline uint32_t > > > > +rte_align32prevpow2(uint32_t x) > > > > +{ > > > > + x = rte_combine32ms1b(x); > > > > + > > > > + return x - (x >> 1); > > > > +} > > > > + > > > > /** > > > > * Aligns 64b input parameter to the next power of 2 > > > > * > > > > @@ -272,16 +330,28 @@ static inline uint64_t rte_align64pow2(uint64_t > > v) { > > > > v--; > > > > - v |= v >> 1; > > > > - v |= v >> 2; > > > > - v |= v >> 4; > > > > - v |= v >> 8; > > > > - v |= v >> 16; > > > > - v |= v >> 32; > > > > + v = rte_combine64ms1b(v); > > > > > > > > return v + 1; > > > > } > > > > > > > > +/** > > > > + * Aligns 64b input parameter to the previous power of 2 > > > > + * > > > > + * @param v > > > > + * The 64b value to align > > > > + * > > > > + * @return > > > > + * Input parameter aligned to the previous power of 2 > > > > + */ > > > > +static inline uint64_t > > > > +rte_align64prevpow2(uint64_t v) > > > > +{ > > > > + v = rte_combine64ms1b(v); > > > > + > > > > + return v - (v >> 1); > > > > +} > > > > + > > > > /*********** Macros for calculating min and max **********/ > > > > > > > > /** > > > > -- > > > > 2.16.3 > > >