From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0070.outbound.protection.outlook.com [104.47.38.70]) by dpdk.org (Postfix) with ESMTP id 907051D7 for ; Mon, 26 Feb 2018 20:10:42 +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=xuOIGAjQGFIaFZTCZAxU2rw6thGirGanpmzrzjrSWYg=; b=nzTbtX9QDPii2Hjm0Ne8jqnTtNTzpJyXiqxkI86Cuk9Ypk2MUgiNy/fTOe9ZKb9NYlDSoH4i0DXLHRpK+YruHq/fmxBqF3phQ0q3qlWd4bihyYhZELvlWX376ODjFzC1zOnuE34K9CppnBfJS+k9etxvasfTuUttYOMABaj0l2k= 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 (10.164.153.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.22; Mon, 26 Feb 2018 19:10:39 +0000 Date: Tue, 27 Feb 2018 00:40:18 +0530 From: Pavan Nikhilesh To: Matan Azrad , "jerin.jacob@caviumnetworks.com" , "keith.wiles@intel.com" , Thomas Monjalon Cc: dev@dpdk.org Message-ID: <20180226191017.GA9950@ltp-pvn> References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> <20180219113643.10337-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR0101CA0049.INDPRD01.PROD.OUTLOOK.COM (10.174.220.139) To DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c1e81f2-70bc-46b5-6087-08d57d4ca0dd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR07MB3466; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 3:vtg5Z+b7WjzYPCe+ltEFK/glg3T/jr8Qg7Jd8eToeWPIxiIp0IVyurWIgol7tGjp5WWIDyyGWsx4H4EXAlYNBpAhXJEvWPV3uTHmqfv/LR0dVG3oZt1GKDKMu+Ynl8lmO8hi8Zn9OfA3qlhZTUesIhgnj0AxrYL3dmEE4AwKHZ3vfWMHtJ+NyVCoaMqxaz6AXePcAzJ40iPgEhLx1Ipqiv+3BgSkVwhhmEOwTc9GN/g3ZFQZYH6PhGtvQnMJ+Ytj; 25:A5xvdS61EL59rlA4it2QrloyAC0ic5bIcdV6BPtEaRUq21FB9+V68D/+EorY62ozR7YZC0DGmBFD7fBTTOeveKf7P8QgerLEFQUs6i9weHoBL9HWS2HtD7JplNB94BoSNa5LyD4uu7kcllZxMruRjlyT9e52AQ8KJzGb+jMbR613X3drzC6ylcxW0/PpbGcKlhJxS4UYAEuVqSDij77WxVicEgwxkWTGRaTV9qaOW57VnwkNSH0EQOJCvY7mzvPltMKBhP+qJ4eiZupj+XojcYLKAsO35B6b1WFV9L4f3mhVG4yLeMNt5mN8Yh2m75xRH1EucBbO0Fii1Hlo16m4yA==; 31:nssuhxXPeQFsBj4q4eghaJh9uaOaqkrZ7gHbSwUYVdyAeHSlZ89Fsk2r6mpXJS2EMXg5noP3FmUYbDTz88T0I4sDhkSA0VDfwYLsx9gEXJHbxd3HOHZFhfk2sucwWhmCQIJK/2+2H8GRxygu6Hdp454X4z56DfnpnXvV6R8NKzesK1go08wOc+8d7qg2vA0/ClwyAHx9yGZcQcHknp7Aq3YnTUDHUDjqFKPEEpUR1sI= X-MS-TrafficTypeDiagnostic: DM5PR07MB3466: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 20:NrBADGMy2SLSQqvbbFe+enb8svlQgU+EEif5q8IGS4CMaHP9MesiruperpPlqVRjKlFOC7VUX4X1s1eaWYxnUvnJS4/4oEtB1qW0QhD0AyGcp4MGoLygE4fUaFka73sU9hSrN4cwIdL5SSw5WLRp2zukDKf0Z7tFGvdLGQ/gLhRjPINnX+ggz3MLPerqxs9h++KlKk22lxFbx8d3VLibKBlaveitX79cmCUACPUDZGW5aM5waNNsfk9KHeamMmcZdognngQWpmPLfXSBrT0rWjWQK6/Xq8M4nXZpWVRoWHv4Et12r4RgpFQDpgd3VGOvg58/LI5Lv4JZsNJ5jJ57dIhRNORn3p6gfOicGoB2oj0xEbe1ZTecPJMuZuLTmEGtTWtHZVC/VH0oQg9qnoafpRVcaRcf27HYWbY7o7fL8sBMdxvxG3XF7aKJXSFlIsI5c1IxcxjUtD/14YonWQwf1ZWoVHMtSoymcTemkMlQ/h3Twhq4GVFcFlavmfy0ACDUV+cDCEmBdrLV8eIYuNF3wepYIGQi4WTNNFWf+DUtiCozd6tKp4OqRc2/FiCvjGd1gGwPtyE4rw9J+sQyDyh8kAd/DH+gIsqEAO77KVX/94s=; 4:nVGOA9yNcmMMvuTmBj4NTSv4rXCutFBAJsbH3GIOm79mTbgF9WyqZo/lHvchOhEsB1f8silbQd6vtO31PpjspTqQDSeNc1XbDDGAqHlniTTBwLO9vArE0WQd71O2B7YzKvIXSH1671KcM+mbrUqmQA9uauWfnOoBjAnVql6LjYoRhDVJFvLYuHRGF8nriy1jWzm01EVq2vwxjsnITncua3rgTQeAgwdUrlmvAcK7RbSfJuOu8wE8Mq1Cb8DvyhSFF+1cYQE9NFUB5sr8ZZScwg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3231220)(944501161)(52105095)(3002001)(6041288)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR07MB3466; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB3466; X-Forefront-PRVS: 05954A7C45 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(396003)(366004)(346002)(189003)(199004)(76104003)(58126008)(42882006)(386003)(26005)(2950100002)(105586002)(6496006)(6666003)(72206003)(6246003)(2201001)(478600001)(33896004)(1076002)(47776003)(3846002)(23726003)(186003)(8936002)(53936002)(305945005)(7736002)(50466002)(6116002)(55016002)(33716001)(81156014)(97736004)(8676002)(81166006)(16526019)(5660300001)(316002)(76176011)(5009440100003)(66066001)(16586007)(9686003)(229853002)(25786009)(106356001)(2501003)(52116002)(4326008)(110136005)(68736007)(33656002)(2906002)(18370500001)(107986001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3466; H:ltp-pvn; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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:JkpfXvjw/5WS6xo97BuZRKFJU/aZDj/HKJ7qnrj8y?= =?us-ascii?Q?4j3RN+/bGaNfad774A9h9jukVjg+eTy1DkDkL24RYZZlGc8U7qmx3fbgtZ8A?= =?us-ascii?Q?mJDH/NvDF6GCrCn5zkzkpnqomErnwNGXNyw63mfRfX1O0NRtNtWTlVwvlwTn?= =?us-ascii?Q?dtzElvLlVZ0i/84+/KxGHmUuvze3MWn7mRKVvxVEPwOWmkJiDqroAQcrh1yQ?= =?us-ascii?Q?X9NECxuSD27mSYJyCTq++lNLZd1dFxTrQXIM1PHip4hwfNHrkiamgaOAFTpb?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gVagucxdSl5GMSf0485+95vW1/qyVa33lXYCeP6jAnnoxOHy63QnIyOeEL48I7WmPsrrKL8JmfngDWPpZdiHNBiuWm6WOD2kPe2zLEZBXHXr1FNq6FV6Vg5QDm5DQkqnCe/h/Lr6xY5Ds1PseFd0tKPAC4Tw/4vzDMYmCclelz6f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2018 19:10:39.4517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c1e81f2-70bc-46b5-6087-08d57d4ca0dd 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 v2 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: Mon, 26 Feb 2018 19:10:43 -0000 Hi Matan, On Mon, Feb 19, 2018 at 12:09:46PM +0000, Matan Azrad wrote: > > Hi Pavan > > From: Pavan Nikhilesh, Monday, February 19, 2018 1:37 PM > > Add 32b and 64b API's to align the given integer to the previous power of 2. > > > > Signed-off-by: Pavan Nikhilesh > > --- > > 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 | 43 > > ++++++++++++++++++++++++++++++ > > 1 file changed, 43 insertions(+) > > > > diff --git a/lib/librte_eal/common/include/rte_common.h > > b/lib/librte_eal/common/include/rte_common.h > > index c7803e41c..b2017ee5c 100644 > > --- a/lib/librte_eal/common/include/rte_common.h > > +++ b/lib/librte_eal/common/include/rte_common.h > > @@ -259,6 +259,27 @@ rte_align32pow2(uint32_t 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 |= x >> 1; > > + x |= x >> 2; > > + x |= x >> 4; > > + x |= x >> 8; > > + x |= x >> 16; > > + > > + return x - (x >> 1); > > +} > > Nice. > > Since you are using the same 5 lines from the rte_align32pow2() function, I think this part can be in a separate function to do reuse. > Also the "fill ones 32" function can be used for other purpose. > What do you think? I do agree that it would be cleaner to have a common function for both, but not able to decide on a appropriate function name "fill ones 32" doesn't convey what the function truly does. If you have a cleaner name do suggest, i will roll up a v3 adding the function and experimental tag. Thanks, Pavan > >