From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0043.outbound.protection.outlook.com [104.47.33.43]) by dpdk.org (Postfix) with ESMTP id 8D9D92BE5 for ; Fri, 16 Mar 2018 09:41:43 +0100 (CET) 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=5p6zamonFFSwOq+xWmjvODYxlbdwgi6aAMVopw2f1O4=; b=C5TSQ6lC46eAetcpnZPtKxGETclGwGWmcItRFscdQBJ7AojJiH7Av4fitm8BdmU3GRSufm3s6+FV7CtaNqYETPQp3FVGmyKTpwih9yC/vhJY+TCWbDlbW/QMSicQxX5tauMUx2rsXsw4OHzzwvHj5BE3FRGh4Q944ETokGtzpsU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn (111.93.218.67) by DM5PR07MB3466.namprd07.prod.outlook.com (2603:10b6:4:67::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Fri, 16 Mar 2018 08:41:40 +0000 Date: Fri, 16 Mar 2018 14:11:19 +0530 From: Pavan Nikhilesh To: "Ananyev, Konstantin" , "jerin.jacob@caviumnetworks.com" , "thomas@monjalon.net" Cc: dev@dpdk.org Message-ID: <20180316084118.GA5350@ltp-pvn> References: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> <2601191342CEEE43887BDE71AB9772589E28F9A5@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2601191342CEEE43887BDE71AB9772589E28F9A5@irsmsx105.ger.corp.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::29) To DM5PR07MB3466.namprd07.prod.outlook.com (2603:10b6:4:67::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 085dbd99-6e7f-4e03-dd54-08d58b19be34 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR07MB3466; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 3:nf+NwQLMZFqoiTwgy2hOgQCZq5L1M1HzS/QZg38aUarnzu9Oue7ZXVAgeXI5DyAweibKgcMVj/Mo7DVepQtx1QO0j98IvU3r8qAjBiJDaIsdRIBPku38Z/deUSpwS3xMIQFEI+CLuc/wN5t2STeC8HgNiO1UnvnDRwOYFtd96nhxGuVGYTibEP49O0cWofChhqdeRtSdqnvZVNYAcbFeF6eiRDM2KXex7SSqWse8EUIMMIJbSqXGhJhh1fPejnk1; 25:Id6ek7GApTkF66jPQJmxtseT68C0Bq5JifandN1l6L/Vg9KrV5ZRtYY+j+XH2RfxL347JGQJkAuV3jqE5v90La5PdDt9MiKwMRD67LdGZYlYJxl1GmUZeMG7fizb0syGFbpQ4JsThTI9vrVVHUVXjESZxlNyOZyx58fm8Uv3wt/YGhiTZ4pS9bCigv32vDjsOkCYu66CTr5HVD7tr8byfO1ayEmjVTtyQ/eOzX9AkoZVSkFwa24c2+eTzl9b7VT/EJxh+agX1gKIBmVWlffVk9TXbr+VI8SCA7B3d26FW6AXUUF0pORAxSV+aTpUmYklX/HPub2GlZ92Io+nLoV7eA==; 31:TsKc7m8lRUFg9vMQ8KouAQsbKOBE2Vvrec5IeuOiDhUiGsHYoZQWF/hvmqqwcJL90pnyC8mWmJtXFIbuxRgoVGYFm5W5kq5rQoQrR0Jic49edW1gmRkyT20O3qTBJPapLoi6hC1l72d7VLo1pek75zmSjoLXmjz1NU+g1/HC/8q1X+NtjokcArsJiBheVwguPidyEbOpkuU52FLCVdiUY2XQ1kEWsjEhxPUav3CKyJ8= X-MS-TrafficTypeDiagnostic: DM5PR07MB3466: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 20:jG+pMUniTNpzFc5nNiKdT9ovD2kmfa8tUh9HSm6itXso9QDviHEpOG8AI8ixLzW4H/Z2eGzM/7y4nMlsJ4/0MiEPEVrW0JJukKskN0x/hKJyireVEA7oBMbLHX2bsmGZZiwm7m54c5P70/HSSUy6jQ2FMtsBhQsuJTF6drj7J3HfjzUcyoilMiMPVNKUZBHXdlIVMYnjx3iSx6+U/k790jPieqvDLaFiCvOr370SsIIDprj3YW0E4eIta9YjPPjPeXd6b0qvK7okytYtxDzFEGmmsnbayuHNxpRsfd3jrWSB78jEGbsWpHUQyI5BF3jvcRQjqWXamxvSnv2QeNaOWfdfGqv8gwL2isLEVNqWCWKZYMAk/PL6OaqH2OQAnZ3y40Iez5egCJJOgiQvoYHa52lTNhMhc65hDKHIPGMw+Pbwa97vktpwWxzwHOXS9wpB1Hcb+bQbUQ5Zn7FzISVRVNr6wpL8FT8N6xHrB3RA3OkDHWH4gVasAc8ES5n5HVUXawdiMAP7//r3zYf4wck+CYjeAC/DjgZm4CoDFgTJTuisGAmohzDX33RSjqx665ujORu/tLOTWR3ZbvZ+OrUk41uR34H/HlDGpvAQXeWaOEs=; 4:Shieu4w34nqKvbOMd4tm5CFzY3EhqntY7uItPyg3DxPlxSaQTJErqW7p4cAdjIOUZoWw/zEAnn8S54ePmI6XorVCZpyoZ+DATcIisgWyJKe0WDePpTJGZ2ATUnVL8rhbMjCnn5Jjm0qY6YiKzkLoxw+CwpzMoP+X5u2OFeTAE7sQH5/UVjIBejxCoaYMIhUVUtISPmxmYvEi2pE+f5PRwApBowGWCugTiouAjpgMHJ9ztPLq3BEgJlEGBhbshjvB0gem6RsVPaf4ebUl31RbzA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231221)(944501244)(52105095)(3002001)(10201501046)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR07MB3466; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB3466; X-Forefront-PRVS: 0613912E23 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39380400002)(39860400002)(376002)(346002)(199004)(189003)(478600001)(305945005)(72206003)(7736002)(6246003)(33656002)(229853002)(2906002)(105586002)(2501003)(23726003)(1076002)(6116002)(3846002)(9686003)(4326008)(55016002)(6666003)(2950100002)(25786009)(53936002)(5660300001)(106356001)(97736004)(6496006)(316002)(5009440100003)(76176011)(52116002)(8676002)(81156014)(81166006)(33716001)(8936002)(110136005)(16586007)(58126008)(50466002)(16526019)(186003)(47776003)(26005)(386003)(42882007)(2201001)(68736007)(33896004)(66066001)(18370500001)(107986001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3466; H:ltp-pvn; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3466; 23:de1cF//kfcNye1DeMApgsljhFJKxerCfCyYd06BXT?= =?us-ascii?Q?Xl9kgvdVWR8ekcqnQkcPo4g14VHzfTRbY8klONBaWL3cDNx61blppH3feMbI?= =?us-ascii?Q?HKD88CMbLeRVA/z+KmJGQqS4yv5kg3Ww0WuoaPHn+H4szQq5b6HRTPu+3V1l?= =?us-ascii?Q?oEqim2UTlKhj6U5lWrV0ojAvkYOYuqjCMNHGbO7qLSrcvdVSfadoBzEG3Lh7?= =?us-ascii?Q?uXmcmLPmXiwH42EwyLgec9zV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RpzIBFiignjn8gd1RlNKAPHhQEkfiFqwMIo=; 24:IzUm6jBiXNbap9N31qXco9snmS+ZwcpsWbeGpkIWBZvRJHhAZ6o+FqsoCZEYrAw4WUtm1/l9sXfWpv/2OtcQIWIXCKlYOxD9vNGOepbiqqs=; 7:8DzpHN+I9UY6kgcOg9Yt3M3HGreMZXXTl3mXwGZdrtF9Fmu8EVcrBbTfX1tdgXjgxgulnAdAUe94ewy4Jr52Yfnay4MqfRkmEqjjJq9Jeie8GJ1W1RaQvUkpw267nOjAJKctHtgUyl0QpOCYsZ1ahVQDx+2JhcEZIDWY4nCGr/LfpZ88gCl83J5b44FXZRdUas7Ao+ymcvkzqCcKaEtKDaQfyw+J0u4svuncknbk4y9eW2fei79wOSBSqyZ8kSd7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2018 08:41:40.8434 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 085dbd99-6e7f-4e03-dd54-08d58b19be34 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3466 Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple 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: Fri, 16 Mar 2018 08:41:45 -0000 Hi Konstantin, On Wed, Mar 14, 2018 at 10:42:54AM +0000, Ananyev, Konstantin wrote: > Hi Pavan, > > > > > Add macros to align given value to the multiple of the supplied > > integer. > > > > Signed-off-by: Pavan Nikhilesh > > --- > > > > Common code needed for OcteonTx event timer device. > > > > lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h > > index c7803e41c..2052b5300 100644 > > --- a/lib/librte_eal/common/include/rte_common.h > > +++ b/lib/librte_eal/common/include/rte_common.h > > @@ -190,6 +190,22 @@ static void __attribute__((constructor(prio), used)) func(void) > > */ > > #define RTE_ALIGN(val, align) RTE_ALIGN_CEIL(val, align) > > > > +/** > > + * Macro to align a value to the multiple of given value. The resultant > > + * value will be of the same type as the first parameter and will be no lower > > + * than the first parameter. > > + */ > > +#define RTE_ALIGN_MUL_CEIL(v, mul) \ > > + (((v + (typeof(v)) mul - 1) / ((typeof(v)) mul)) * (typeof(v))mul) > > I think you need to add braces around mul: > (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > Same above. Agreed, will roll up a v2. > Konstantin Thanks for reviewing, Pavan. > > > + > > +/** > > + * Macro to align a value to the multiple of given value. The resultant > > + * value will be of the same type as the first parameter and will be no higher > > + * than the first parameter. > > + */ > > +#define RTE_ALIGN_MUL_FLOOR(v, mul) \ > > + ((v / ((typeof(v)) mul)) * (typeof(v))mul) > > + > > /** > > * Checks if a pointer is aligned to a given power-of-two value > > * > > -- > > 2.16.2 >