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 0B137A0350; Wed, 24 Jun 2020 12:21:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E253D1D91B; Wed, 24 Jun 2020 12:21:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 44EF31D441; Wed, 24 Jun 2020 12:21: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 05OALY5M028850; Wed, 24 Jun 2020 03:21:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=pfpt0818; bh=DNYNji5LZqgWCspqDkCxYvzNqDVLmLBfapZ3Lcl2Q8Q=; b=V6hBjSQExdPdjnGP17fdyRp6bCIoMq1fiYoP8DUDcQrAd8Iez5L8HIFi1rHUnA2zc7hY tXJT0lsN6I+SNQMLmnbWy2HeMZa0lXsljCcme2czcAVwr+su4wlAO+OLVqwETcW7WXTj s/urW9MLncBuMqmWjcyPujDybm9rSrwSQPgI8vD7c3eBbyK2E2CUaFI7vPvSTVyOmpiz EfYCsRonJcb6EiD5c/P052xTfjYV2loa0DclpHebYnoRz76DB7KPM4j5YchxZTzh1XDk gDqpsui50FbAh7nqMwRND0o43JmBlTlclyfjf5PfnQlFTmRXbMu3c9tB1P82v/6+QoLR pw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 31uuqgtbnq-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jun 2020 03:21:37 -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 03:21:18 -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 03:21:18 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) 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 03:21:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iQyhKwLHr3nrZCOGGQUFSmp5wbGoXnBrm0QYXhqYJL+GhCCqV/nR3YMIjV9Cz7lWRsqt3SbcSwDv5sVflXciUUeCmjZ3hsjSMjZwCAGxv+ro7Bg5HohrlV1P+jnqQYlgkznKruS5Ptthqw26gRUo++MWezbI7jctB2bCk0tJWg70kH+D13XNt1+UA8lqybdgDbOwG+orFAobmWg4JK70qGO/B4kXTpceQG4rS3sqghDvQ6NYh0OO+bR1YzvpgOz1IbHL/nx89PdQubc46CBTVZHc8lyCbjzBtD2eJKc/Qk4RK85+VYSGr1QmEV5gBg60xxy8jJmVBGgpvQqgmQJqeg== 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=DNYNji5LZqgWCspqDkCxYvzNqDVLmLBfapZ3Lcl2Q8Q=; b=EB2PF6T0sXJRsnPwKnkvnVtvbUcEEZk6A98TDt2+B1d7NTEeyCPdE/Q62x32xsK8BydTLyuZoBH/mDQDtpjJIvGDoapmWNjDfJx+m0k6bzlPPo2pW3a4hblqhsqpCvPW0zJij7ZgbnNPVCHwl1XWih6eCoc6ityWYP5b19tkMN0U2z4xatLOGRaegxJ6vHP59600ZfeIRzTmWyF0bCCPJPy7ZvJW6faH6Rk/PuebwwYCcPB/zJHHW5GZeZPqZSmnp7Cd84w9aNuHF+7raB3cGseQzat2B94yn+dxbYNPvkDgURbYWWnShBOwRLuPt7/Uip+QTqZtija/vz40xUGQfA== 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=DNYNji5LZqgWCspqDkCxYvzNqDVLmLBfapZ3Lcl2Q8Q=; b=B2e+ggjsJ4sMbE80GbSkv6ndcZ5h+ZivGHUbK8MUYTqyNnkneKVLCdmQyT1BvOOlo9vkkSir7DI4MfiVAMUSz3V6QNknPEGtq9sMzTtSkQLfcye9YAZw3kYPVku+T0CiCfof3o+xHN5GkFL7LiIQnAjhmNn1SIkNPgjrE4Ap7hU= Authentication-Results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=marvell.com; Received: from MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) by MW3PR18MB3612.namprd18.prod.outlook.com (2603:10b6:303:2f::22) 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 10:21:16 +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 10:21:16 +0000 From: Harman Kalra To: , , CC: , Harman Kalra , Date: Wed, 24 Jun 2020 15:50:47 +0530 Message-ID: <1592994047-22665-1-git-send-email-hkalra@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <2473627.Zvk6BpfnDP@thomas> References: <2473627.Zvk6BpfnDP@thomas> Content-Type: text/plain X-ClientProxiedBy: PN1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::32) To MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hkarlara-OptiPlex-3046.marvell.com (115.113.156.2) by PN1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3131.20 via Frontend Transport; Wed, 24 Jun 2020 10:21:14 +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: d53261fc-119d-4a0b-c49b-08d81828542b X-MS-TrafficTypeDiagnostic: MW3PR18MB3612: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:765; X-Forefront-PRVS: 0444EB1997 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m/AhUJdwOompxRfxarQ8olQZL9dwWiNJq9jdj227G6NFNZe/W+npN+Gxjx/gPyZ080c5bQFMcVv8/RPYEF/UZkZbDv2TI6D/2o3ZDU/TDX5n+4Y901hjWFZ400eU1ux+pumULtEtpA8q0P1KNFjly835cAqVSIe6iv/OHuXWeTZRKTlcEFQZxMsZTS3qKZhafWclr828XrZ9L+wcBetTLe4Qd4HNlcJmk/T8WSM1b+GPWYZKiI+aN20XdV5mFM8nnRNDeZfVOlwPZPlcH+Ke0S4oUgRBkv84BFCatS1ZHnM/hFCojWLeSP3fY7ez2HXR92S7bzMQaNpf1EsOAvyRqg== 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)(396003)(366004)(376002)(346002)(136003)(39850400004)(316002)(6636002)(2616005)(956004)(478600001)(8936002)(8676002)(6486002)(36756003)(66476007)(66946007)(66556008)(16526019)(2906002)(55236004)(186003)(4326008)(86362001)(7696005)(5660300002)(26005)(52116002)(83380400001)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YuaZNJNyq+8pvzdAIEXnmjxBheGFYgfGAbJ2Dj6Z8igA0N/T1irTwiycwnJcI2x3wLX8rOKVV48Z4l6MN47FEwcakEesmauMZQepuk12fOvQhSWeY64K5JICMfITNJRAbBKl9BjWpLDIT+Npk7i8VtavG7lKa571QXS4TC2tLChMHWziWO5QpIMzJQUxRmW6EKTnxjpfVBt+rHFkvoW+xR/sEr3MdGe4nlruZNTR9hJDxC0Jc1vfIYfpsYIykGa20E15EIzGywTpR7/Hmtg81DUVyCZ+mfVYnWfBh63jFHgy0ao3l5Ac91RFn4zTTwT39vPaPaxp2YxPLaVyDLFHqt4bUBkeZJLQl2tNqS6vNf9BBLQYSX4Tv8yD6Sff3JGIpiMkFljY9GNFSp5uw8xhQaaCCrsRggyqG9K5Ecv25hMNvzcQNi03Csq/NFeqgYq9IVPROZ7YISfEz/khgIcxzxdSYIaSqab9zMuDDlNz7Uc= X-MS-Exchange-CrossTenant-Network-Message-Id: d53261fc-119d-4a0b-c49b-08d81828542b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2020 10:21:16.5077 (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: OKeTf8BMHe51nxsARBHz7V55tHDR/6Tgf6yuxzIwx7u2KBcW4RK1DM3GQyk9LbNz2LecKrqNtwBCutUslA+W8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR18MB3612 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-24_05:2020-06-24, 2020-06-24 signatures=0 Subject: [dpdk-dev] [PATCH v2] eal: fix macros to align value 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 as parathesis are required to evaluate an expression. Fixes: 5120203d753f ("eal: add macros to align value to multiple") Cc: stable@dpdk.org Signed-off-by: Harman Kalra --- *V2: improved commit message. 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