From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 694E9A0350 for ; Wed, 24 Jun 2020 10:24:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2ACAC1D918; Wed, 24 Jun 2020 10:24:56 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 9A7881D8F5; Wed, 24 Jun 2020 10:24:53 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05O8LGBT021111; Wed, 24 Jun 2020 01:24:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pfpt0818; bh=5+5eiy6h80nEeXH1W91n6clvvfsc2rwY21hANTP5OFo=; b=SfalafJg2ElTQT8v6GX+H7pU8ErgL1BUJdCXb3ek+AiCL7vpfViCjTpP1AZLgef04GAQ tXVRep42lWMLzbm1WEqiTI5XPfCh9OIeKrwsTARI/8iV53+JOj9hKLo+P8WlHdxGDNAZ wXuGWaYuj1gLKN8/TmFRWuIF01om2lrpxiORntg4K8zOU+rj8oVMJTQ/DOFwNv78t3hJ mY8HhceYVov5e0HsJRC7aRjSf1lOhhOO9J+r81DGUxyxXxxpoNF6ZXqj0A67k9dtTgxs kn+HWmadTYN59/FBGqjL+BZb+2I8O5st6bj4x2Nth4p9qo4wJC825wyj7w128/5g3PE9 bw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 31uur19x29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jun 2020 01:24:52 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 01:24:50 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 01:24:50 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 24 Jun 2020 01:24:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sp/SWU8rr/Wa15wdjnBe58P7pCjawX34dm4Am490hTRT7dHBQGwUf6SE/7SIr9JkyeY6ugMzINd8+yq4WOSZCMpg5/vWLTUbib/oTLT1IyjRemWWSMEIfL5n3gOaWIQWOUwvYnRRGN6YAS2CLC0IcJIw5FuRtpzDY2DBnKYGedGdc3snJ/38z+0pUCBeXM69aqZF/B6FX1AlpA3bVNkYG0YWFcPzzihbisqmSaDVHzaO/hzlw4G+t20TeaayEkvMs4NoYDhbyOotthGt9tzDD/46Ff+qohK5Fh7YqMwQ4wWVTlAZQ0ctUcmaJKDXrbnaKNNGDbiTSq9dU2tpm41e1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5+5eiy6h80nEeXH1W91n6clvvfsc2rwY21hANTP5OFo=; b=XEaLttRQpgrxUPAqrf/mDseT5KzbfnCbhoeqZ84QgldOZs7WwOxGTHbATcKicE/zJQJ/5XNUlvlCk2hWtkXmwBfmb6/qVd35ZVJLHUkTOhJ6cXeNzNpOwVJAsAJF4vE/RwKtzqABEkmh14gu/7MJFldSxcQoerDj0YYP7/vCaPMMJe6fxSDjNSmFQdI7/oGzi2sy48qVBnD+Hjxq8zca2pNiyKoe+wGoxJkZlKpvtCkflXbzmyiGlVGJ6gklOPzdHV1PgR9wN0wrZwNA3kOHkZInqBjO1Eb0fiMh6mZMPGiTzH9Aj1RIocg8IgboX7nPtvrTR90O8f85TIbtkc0AEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5+5eiy6h80nEeXH1W91n6clvvfsc2rwY21hANTP5OFo=; b=otK/AMTRfchVq84Vcq1j89EA5gxdequb9V4/bVeSubTy/ClwOlNNCdfaEaxvks3fxvLVn3pW/ytvC51snJVllq+5dzqIxtViI2y/S5mQnW7mO5CapPuT5tvre6J/m+G8vaAbsg/N2pA+8NqfKu6SRfWMvLwMEAty+bm2HUCf6gs= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=marvell.com; Received: from MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) by MWHPR18MB1021.namprd18.prod.outlook.com (2603:10b6:300:98::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.23; Wed, 24 Jun 2020 08:24:48 +0000 Received: from MWHPR18MB1070.namprd18.prod.outlook.com ([fe80::e895:bdac:e157:2ed2]) by MWHPR18MB1070.namprd18.prod.outlook.com ([fe80::e895:bdac:e157:2ed2%11]) with mapi id 15.20.3131.020; Wed, 24 Jun 2020 08:24:48 +0000 Date: Wed, 24 Jun 2020 13:54:30 +0530 From: Harman Kalra To: Thomas Monjalon CC: , , , , Message-ID: <20200624082429.GA73382@outlook.office365.com> References: <1591730225-15300-1-git-send-email-hkalra@marvell.com> <2094499.cageA7459N@thomas> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2094499.cageA7459N@thomas> User-Agent: Mutt/1.10.0 (2018-05-17) X-ClientProxiedBy: PN1PR0101CA0051.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::13) To MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from outlook.office365.com (115.113.156.2) by PN1PR0101CA0051.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 24 Jun 2020 08:24:45 +0000 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db3ef1ac-b3bf-4b2e-98ec-08d818180e94 X-MS-TrafficTypeDiagnostic: MWHPR18MB1021: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 0444EB1997 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DOXqCAyVWijeyUX0s1BO9+WkjzPbdjcI53mmTbj6SpBLtoesT1bSSJ2hOhfyub4pM712M03QmSyua7ODVUMJL6rAqL8VHpnoMvTGj+ez4YjUvn/U/5og2qi0Ocr79wNddgy3ZMJicPshhp5T43+Xq2v4zwN8yUmCuzwdLrcq8yA1TENdJ83dRcMPlLs8BmzWhjP7rzFSfQcfEQgrSLDTM5kC0VqdTRALez2cMPrNCioXkRUxReipHRMzYsIE3YnANKF4HZVPpWlbQgrgMZjl11+vIbu1KR/H6mOpuFFQASzc9QAqLSaAmLOdOAuQoSWVLwbgE9xxF6O5XpYdnHDZeA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR18MB1070.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(366004)(346002)(39850400004)(136003)(396003)(66556008)(6916009)(66476007)(4326008)(6506007)(5660300002)(66946007)(33656002)(26005)(186003)(55236004)(16526019)(316002)(86362001)(9686003)(1076003)(478600001)(7696005)(956004)(2906002)(8936002)(52116002)(55016002)(6666004)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: T1APV63M2ee/fdtYLS9UTBFBdJKaakx3w8ZoRyrK1awZsoqIxH3h/r7XvRoLfElHrkP8PF7skdQIRv+BEHE8+TdSU1CZ9o07tLVCKDrNNvCKG4tg0AhNJMoIddSpxIaC7lZ9ICDcljZrOQPgnOo+/LcJ/tJ4KlpwJv0JwrzQQ3sRwEwHHOn4r2K+NAynTm5UXwfnnCBBwYfulDnx9UBichEofrlZkR4AOZP+s7rSnxaBz/wnt53BNVDoqSbNJmmc8i0qQWfXbE6kmAhykpv0XI1X823wWswHpABytG3KMTYvJoIokaPtYdg3/HuSBHcb0AcJ6usVXkixES3/UgSyuWyt/hfblRuYvJUPllYcFlVQ9w5rm9qqmMO0BI9yHgH47OcOPZ7nTyYZn3wyIlBKpb8tsIkF5dgRKTvXkyMKFfDkSIwSIw1N6CQ9MwFNImWHdmXVx6xqgOtpu8vmtAFy+M3hd9531xZAnXl5uDmkQYI= X-MS-Exchange-CrossTenant-Network-Message-Id: db3ef1ac-b3bf-4b2e-98ec-08d818180e94 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2020 08:24:47.8825 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rIEV13NvH2MQ2Q1lwxXzbrTC5rP+Y9+dWc9ZtVhW9onxaXBp+UpKoH6c2PA8W+ynviKGp7jgmydnWwhoLB/JVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1021 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-24_04:2020-06-24, 2020-06-24 signatures=0 Subject: Re: [dpdk-stable] [EXT] Re: [PATCH] eal: fix macros to align value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Wed, Jun 24, 2020 at 10:13:18AM +0200, Thomas Monjalon wrote: > External Email > > ---------------------------------------------------------------------- > 09/06/2020 21:17, Harman Kalra: > > Found an issue while using RTE_ALIGN_MUL_NEAR with an > > expression, like as passed in estimate_tsc_freq(). > > RTE_ALIGN_MUL_FLOOR resulted in unexpected value in the > > above function as division has more precedence over > > substraction. > > The only change I see is adding parenthesis around v. > Am I right? Yes, parathesis are required if an expression is passed. > > > #define RTE_ALIGN_MUL_CEIL(v, mul) \ > > - (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > + ((((v) + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > [...] > > #define RTE_ALIGN_MUL_FLOOR(v, mul) \ > > - ((v / ((typeof(v))(mul))) * (typeof(v))(mul)) > > + (((v) / ((typeof(v))(mul))) * (typeof(v))(mul)) > [...] > > ({ \ > > typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul); \ > > typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul); \ > > - (ceil - v) > (v - floor) ? floor : ceil; \ > > + (ceil - (v)) > ((v) - floor) ? floor : ceil; \ > > }) > > > >