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 8B56BA0518 for ; Tue, 9 Jun 2020 21:17:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 719301F28; Tue, 9 Jun 2020 21:17:41 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 3188E1AFF; Tue, 9 Jun 2020 21:17:39 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 059JFTsD017811; Tue, 9 Jun 2020 12:17:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=pfpt0818; bh=BheKMUWcruirr0VQn23KBUxSzGwnjZ3wlvJBuRbTFC0=; b=evql1dG8iMPHHnHiCDBzR3qt1QFDFZAOq5Em7DOECum/gV2nHPV4hBfrRS1Drp1+urHx Div8f7KbABJyYsIQ5SXLWB2737TmdiWJLwMc8LVTJVgAA+aPxhEEnZCE/UZ9w7vnBKPX KXCuSu4GvMTU5vbebQT4/hQ8oW7AYlhtOc8+b4ox/dLKlq3uMgt7TzkWtYCopN3JPX00 mxRJ1uOXksfD3MwnlJPlMNSQursQ5Ekm1hb8t6Ob+fnL2LWuhHKbNa+eCy2PmtW11DW1 e0Xftw1n6x7BBO4dJAP80Ik3GJS2+9NMT/RSYmCSFajR8Md0GbKohtmJUP70RBvPJcHc VQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 31j77dj2u7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2020 12:17:37 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 9 Jun 2020 12:17:36 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 9 Jun 2020 12:17:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WqghpnFoGZ+42XbeE8egRLTFQ0hoTyORFYXW4p1fhPVDAmbZYON0pJtCxQrt2sAQpYXvYOtLOx9pmX8UZBHJzg9bcqV6pzhEJ93JTm0PX573WlA7pbjP62vjcagglbAU2z8mRnnwkyYcYbOubv0VOvGLWgYx1PO87k3WmiHfp6aCRpOHl3tefIey5bgtfIEX+XqhMMNTI14DqZEFfbgPJgTp3VNy5HZBgwR0cn3dBtXd5VhNwpX5liaLPWNxvWXp3fwmbefOOAO+BXi7bgm3/HvR7a1YI1AUQGrpI6dA4qzYaxJGl07oKt7f+f2/c3pYfA891qBvCUDtWMV6WCvKDg== 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=BheKMUWcruirr0VQn23KBUxSzGwnjZ3wlvJBuRbTFC0=; b=H+cxx6XxZyaNbUHy+y2HekVwRUe8tNMEMW9IOcfh0MbM4PGZOt25HUIjLB0KuBbhWkDNFP7sv/pgNqk/XTYYYMxdAQsuM6G+bfatwIBqwIHRIAUSdWSlsl+AjvSJn+AUAuszwecHodQNb8ofeWQ7BwMsbg97VPAWOW4jz84UXeJ8QNpp4AmpOEtbBH9h9wJUCEq7cW/vF+2H8o25jdksQCvDTqUJezcMEd7Tl336d13kooXd3vnJqdPPrCijgokxxFXwdKMIrX1CjXSs63WDCl+7y4S7e5hcc5dbs8ErlzTirfqrGzO8ZIftb/SKwuz2DNmAmsyWXLLY+GmOI96mlw== 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=BheKMUWcruirr0VQn23KBUxSzGwnjZ3wlvJBuRbTFC0=; b=hN0MizPuf3u/ddIzsFr5giwA1yEtibRtSBIQaMAIVJU3uOx04pZF4PzdUNqP85KY7iwDL+L9H/qpBJxmCZ/a+P+p5o5zJXKECMM8RbVQAit41THe8Nx7zk+J6dQ3vSja/lu93O6I7qpd1Cp6p00J/ujRhQT33QyoGEoL+fhSmsM= Authentication-Results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=marvell.com; Received: from MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:38::19) by MN2PR18MB2912.namprd18.prod.outlook.com (2603:10b6:208:a0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Tue, 9 Jun 2020 19:17:35 +0000 Received: from MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::f4fb:5e32:18dc:fb93]) by MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::f4fb:5e32:18dc:fb93%7]) with mapi id 15.20.3066.023; Tue, 9 Jun 2020 19:17:35 +0000 From: Harman Kalra To: , , CC: , Harman Kalra , Date: Wed, 10 Jun 2020 00:47:05 +0530 Message-ID: <1591730225-15300-1-git-send-email-hkalra@marvell.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) To MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:38::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hkarlara-OptiPlex-3046.marvell.com (115.113.156.2) by BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3088.18 via Frontend Transport; Tue, 9 Jun 2020 19:17:33 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ae1fac2-3476-4156-45b1-08d80ca9c3fa X-MS-TrafficTypeDiagnostic: MN2PR18MB2912: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 042957ACD7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YQAdrZRjK54ymyrnA4tIsGKnt/u4JMoQGs+oiwfrQ4Ib/MgIuB9+Johc8iv/3/1pzBHRFlfWtEXJLSuRO7t9UfBSjtdP1JKz3GTjKxTmaLGV85hW20dHwJTJTpbVLUWN0IJgSsqvmOVrlZCOXYRXUm/A0bjopAlIkPf0vGlfcTgyDSC0ZjZm8KP1YA77s5xxtSmO+WdwUkJBY1LtFoeFUFFSc/orxwB0xg5lF8Ge9WKcTLciGpgWQ7VSBd6Sl3MAucM5ka/fQ0fvzlox6mDrr5B954q/I9We3e8NlXzJUxkaxnUcjblafHFPXUtFcAoo7DGvxZ4hwUSA1Bv/H+xUag== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR18MB2848.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(39860400002)(136003)(396003)(366004)(346002)(52116002)(55236004)(7696005)(26005)(5660300002)(6636002)(86362001)(478600001)(4326008)(2616005)(83380400001)(66946007)(66556008)(66476007)(956004)(36756003)(8936002)(6666004)(8676002)(6486002)(2906002)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BE9/KLDVzbINBc4rHSF+iHYZ+jooPEOTYXQZxIxeS0Ovn5TmxCZ9VqDxHXHyF/nHvffsa1Rj1QY4VMN/uBHYTMnK+Hcb4/MhK+OSYO195O3bSn3GON1I11bFA07FmyVedKUKK4fnkPq31MfoHsRYrav43x3Cw8srZVYwQzGj7R8jTTUnQcqQ3hTrVjE9YpqX4Bhfd7/7c1DrreGYfK/Tm+BqOgTfOs14BwoURFUBFKNsCcKF/zTVWyblCxLt3LBfPru22MPbRizVz3opwi1xcbkEevWANgoVzpH5JXEKWlimfnUHXhDi0WswmD8n82uh3Xs8U8IkEx/BTeAU0tNKxxB093X8mfEgbY9bUjqtutukJq1JSy58lWlqdNkOTBtHDmhsiccPgfkcUNcny9uJQz50U3loDE7DLnHk1BEEVjNrt0Cf+3jduJn8P7wGXva2uQKYZJdznUoVZrAijI4Z63ttOl/E8NEe3QsXcbdEIzc= X-MS-Exchange-CrossTenant-Network-Message-Id: 5ae1fac2-3476-4156-45b1-08d80ca9c3fa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2020 19:17:35.2129 (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: us6SZi9250G5s7ShUs9Kj6zGoFrrHXJGia5aOnib8sdQUki+C9ao4F3WpsdZw1x+cFkF/4fFGbL2kRYBFsTRmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2912 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-09_13:2020-06-09, 2020-06-09 signatures=0 Subject: [dpdk-stable] [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" 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. Fixes: 5120203d753f ("eal: add macros to align value to multiple") Cc: stable@dpdk.org Signed-off-by: Harman Kalra --- lib/librte_eal/include/rte_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h index 0843ce69e..0d834001c 100644 --- a/lib/librte_eal/include/rte_common.h +++ b/lib/librte_eal/include/rte_common.h @@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * than the first parameter. */ #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)) /** * Macro to align a value to the multiple of given value. The resultant @@ -303,7 +303,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * than the first parameter. */ #define RTE_ALIGN_MUL_FLOOR(v, mul) \ - ((v / ((typeof(v))(mul))) * (typeof(v))(mul)) + (((v) / ((typeof(v))(mul))) * (typeof(v))(mul)) /** * Macro to align value to the nearest multiple of the given value. @@ -314,7 +314,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) ({ \ 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; \ }) /** -- 2.18.0