From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0071.outbound.protection.outlook.com [104.47.32.71]) by dpdk.org (Postfix) with ESMTP id B09804CB3 for ; Wed, 14 Mar 2018 10:42:04 +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=ABGnlXCW3se4wq59NCGrOh9plsT9KiyHKN/u2u9l+FY=; b=olZovfa0IPy7SDNFI9lRh5598gnNj/KmCASeNmwG6o7Yl/zz44rErkVIqzZBDeZRIey+lSLtIeNVw69Ehn27VvaQv273m46A+YePPAwGJqP21Beg3s5W8bNXn7I8GJaZmzC1Bii8iPsuNVFHyDbkISarpg8HNV7YiMiIoXNbKCk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Wed, 14 Mar 2018 09:42:01 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, thomas@monjalon.net Cc: dev@dpdk.org, Pavan Nikhilesh Date: Wed, 14 Mar 2018 15:10:59 +0530 Message-Id: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: DM5PR12CA0056.namprd12.prod.outlook.com (2603:10b6:3:103::18) To MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20992bc7-6748-40af-d817-08d5898fd73c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3472; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3472; 3:mycrRJsT3nScp9wK1BrFtcFv2E8fIbaQYEiYg9L08kJn6cLI0tpG42fgdByvYjXpEXf2v2nKZfYp1ILWPK28rzlnIpkT4X+ktoY4qkwcOc96BN8thDYtvExN3hI6dTB4F8ceC1OKT1CstlkjqwMSn+NnCfNkZWMMWQkoq6e4PCNuElFXzI+Uhd3zzd4Cft1zupaIOGXkQL1IzbsN98rZD6JHFRoV2CmKr4vklVxKoeP3fux6XlXMQi/EFOdG7AP2; 25:8QjG5r3yxRDo7QvHjssmUUsAfLgQ3lAjqjLj2pdKP4VCnQ1TrpMZJUByysj7RctU4Gu2B69fLTGruR5BjMt8yoPj5fEstq3YMQrCtw3be0YZ6ejM6g2qlqsQB86Eu/asUWc+9NHtHkmItRiY2xyqRo5TmH7BIT75vkHLGHGQ4Um8zf8cxIGXLn5eqSvEHakQ8VmqhCGGZ50k/rwTj/c/WEWeTpfClgxXRNQY8T+aZRTTMUDyUeXHJEiKxVREeD1B8vXYan2BLyjWBsxX2+BtJGozGnZvOVQW0/dR7jHl/4pIlbPqH11Pcpwfv094MwV4FcOqbPIw2sV7okjIZ3nJgQ==; 31:78p3SUykQ9NlDzAQVMVEk2EJ/IUO2CiPj4frgQrzjRZbk7UKUkoDR8yrEC658MrteCgw9UfwXuZx6Tuvni20U5oUA6bvyhDJnpBgvA3+73xmCu1vB14MOQee5XI23L0PsWlcKVqIt2Gt8g2Qmx8pMVQX/JbUVNcMJWobcaEmztIknaCC86J3vTGBKRGg73x0JHLgEVtpBCPhq/lOia1vK5KeyMQR9qbnHtTQVG5Ayko= X-MS-TrafficTypeDiagnostic: MWHPR07MB3472: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3472; 20:pTfaBLUUVybro+PoPONA6hjQJkvam7hJUyG3t8mBKVQtzQvSJgDinJziYzgrqUN8rOIDxDeuMkTl0EENRxHdEeFfvPv+t5zhTUhfbv7l3yt+XKkc62LOnOP71BaSnPwQ+8FgVaGO+9hAX3bpuTcd70B2Tm2uWzbP7yckAQXntqQkLq99ZdqHUyba0jdjmLXsZ6ezuKfsm8rkyqHp+FTJ53rRDu1KpDTibzVABXJMUlxFkHFC22ashlz3BhOVWm/iDb94uu+l69DZ8LbeV8a/94xHg5L6oDTLOM4RW1SRw4mZ89otXzzfJjZKXEAE2TzfrrBLDO2dTl2sQp6Rndg9zuTX2La7UB8xmDIZ+aWrdnBUndlKSCffqQPwSKvzF4pEYtytpUqxgMq12WgV+EQMi27C9MLIuO10FAxRQdB7h2N7GHyGJc7jcF/1RnyNrs08aCu28LZriKHT2BnFH5UUbfDHlr07ko87cXRsuv8AnosyGXL7n2YcRKqidMUtd7AG6Z0fo2LwfrnDth6ruGfsUtw0jTkozLhWMr/YPm4IRuQy2wSghrliEybl8mRTUlJzMAng5uMZ4IROrVpXHR81RpSG4yJ0wQLf5WXHVMDtPO0=; 4:VHzZe1kEPw54GMhF1K+Kd6b1pgW2NINlG2DKDYlLRm19sIm0cl9n+jNZbObBomH/3r2ZQbCA4URwaVC+abRn4BBibnzhei5esrPRVKAVCj15YmcMVESdpd7LVb5M1UheB8yAOlZ9VKLPgUNW9qPGit925LFdgdloTIXZEHNMITpVBLHNYrRUNc/5Gvf9U3e+uFyhAk9H0FJ4UQkVOnh4ryTfjwE9gxlKiES+3Usbk7sBzwJpUPV8c8NT+IISFSNO1HmebQFA9it4HwfRLHMQHA== 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)(3231221)(944501244)(52105095)(3002001)(93006095)(10201501046)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR07MB3472; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3472; X-Forefront-PRVS: 0611A21987 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(39860400002)(366004)(346002)(396003)(199004)(189003)(53936002)(8936002)(68736007)(66066001)(47776003)(386003)(16526019)(1857600001)(305945005)(7736002)(1076002)(8676002)(81156014)(72206003)(3846002)(6506007)(48376002)(50466002)(26005)(81166006)(16586007)(6116002)(53416004)(105586002)(106356001)(6512007)(42882007)(52116002)(5660300001)(316002)(6486002)(51416003)(107886003)(4326008)(69596002)(36756003)(97736004)(2906002)(478600001)(5009440100003)(50226002)(25786009)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3472; H:ltp-pvn.caveonetworks.com; 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; MWHPR07MB3472; 23:auFhh5JJ3xvIUWtL/cE+H9JGNc8mOrLKsOQH0jLeq?= =?us-ascii?Q?HYjzuV9GXPxVejmk6Dx4Hbc4c7St3l21iEMAvGz1xjtrgk+Pe1dOb0U+ZUHZ?= =?us-ascii?Q?gqelxoF+sFY5YTMtTFdWNQdPvV9G0EB4TvhzoZzDFKODDSHfoPExItmxMZEQ?= =?us-ascii?Q?tNCibdKY4LJRXhSSF8Kvn/9b7c9P50WVRuKBPb2SpwF1nOHIQA/rZ2ae+s0U?= =?us-ascii?Q?bKLeNsymapujyw6oGni4lfuA4sC0wk8550CIRP7w4JIs+yr1wAm01gaONhAZ?= =?us-ascii?Q?WJLy1YjYq4gnJ1CnrUvBMAJzjt1wuzG4UbAvruX9M5PMpMf5pcFpVgD5DghE?= =?us-ascii?Q?T5wZTP7iHjGa+ujCYnkF1BHYcQIZThjRf1/PlgKnrZZXIwSAtwq17CQ1UIn2?= =?us-ascii?Q?7VDpJAsamEeE99Owr64Ada+l4JrHuLLPid906goIU5aaMgweyWuxgPKMqJIT?= =?us-ascii?Q?jzkoJ9SuWcZSXgt17JghfM2VKc1BzK8q0pb3p8XUh7Q3fInRVYsRXmgSeQ3c?= =?us-ascii?Q?dqchoKI7x6ZyOjqhW4RPQW83H/eEUshxjjD9N8pLyAE2lxVoC0vEEnRwzppJ?= =?us-ascii?Q?bUEvY+fMpTocVqYlw8aA+u3BDKpq+dpXnzrNFiZUZ/bOzM6dPMeN0EGBFgHw?= =?us-ascii?Q?A6K2KRu1oJtxm1ihgQwOPVeCZS5ZTlkH+IX1Bue5JPelIsZy40sAj7L0pvqP?= =?us-ascii?Q?TryR3rRCL9gxoBKpini5k+BTkUB813nqXcqantGmZQItpfLcHrxjDi3anz7g?= =?us-ascii?Q?asG0d3UKHM55jEzmu9oO58Ovi2qffjgpRa6/yIA2O55z+rGwRr8aQz5SX7wW?= =?us-ascii?Q?qM0ctOTENdJZheHQfxM/uGOFTnf//uH8EpS25KaYq6fmEufpPPbN4VP/7Nwd?= =?us-ascii?Q?k7c1Pz06Tu8mLf7kLP3pgwRmb7j5MRFxKAWg6P2tmwQPvPOgFpsMiP4b6g8f?= =?us-ascii?Q?6fSrDF2jm+DbHZR1JuRHbvDEtdYVKvd7r4qNQUmvdjAPsITEBktyJSvisDip?= =?us-ascii?Q?8MaqZi29qkw9VTJMR2c11cCaMVR4zSNIo8bJxTTWFWlwDuWmL4QlP6Lf1IJB?= =?us-ascii?Q?fppQA6zxb6NLGHCoq/P4VQL6TIpb1xUHKAAppqupfFifoeGh3MCojuMePD8A?= =?us-ascii?Q?qTAg3PuYCo1Ev/kixC+KSH0kbt5zeYB5XZvLLuXExJNWeV8u3WHuVmYRwVmj?= =?us-ascii?Q?TbiyuDu5FdY814=3D?= X-Microsoft-Antispam-Message-Info: nFi8w6ZSuRCTlyY60WHdwNubXSNhtWhv/nKnNehNkB+3MNmHs1CdGBumeeOQum/knwCQT020GjUq4m5hZ4mDU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pamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2018 09:42:01.0023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20992bc7-6748-40af-d817-08d5898fd73c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3472 Subject: [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: Wed, 14 Mar 2018 09:42:05 -0000 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) + +/** + * 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