From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0067.outbound.protection.outlook.com [104.47.36.67]) by dpdk.org (Postfix) with ESMTP id 3DEFC1DDF8 for ; Thu, 14 Jun 2018 13:50:21 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=oeOHmf7Kd5X6r3in8p1DnH51CPTG81j+gRn1WdG/uqs=; b=QP5sjbHjrhr5SEltznySm+57WnDtJbD3yYg3SABwp20kmoISQ7QNd7DN6a4u+aMvO3eRb3MCEF2DCfn0W9mlND/DSbAKrBZUw/n52s1tQZn72+P6wdnSu1nXrgiZu9Xsj74C4Fae08GOkebIdUps/wdbJORgLCFwuaJ3aKD1yH8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 14 Jun 2018 11:50:18 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Thu, 14 Jun 2018 17:19:01 +0530 Message-Id: <1528976946-14396-11-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: PN1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::11) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4460ec7e-e7de-4978-0bd8-08d5d1ed015c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:eUI1YxHhKdo/ecxmYExJEO57RoLF0HHBl4aVkuloR6H7JgeNcmjT+FZ/ypgNv7C3HLQ8AncgbYy42Mw3Cvz4Qh4E2N720JKASMy6PXNP+94IbQ1B2wW5p5sSs7l1m9hZGRyTUbh7lA+dUPEPf4Vx7wGqfaM7QrBh96UxkR7/xWxwHCevKi9H3j8GSW+LyXaMJ70sTXfqkVOPgwZ687JHOzByVhXt2OWHEfL3t/JxkEouA4ijBCAmJSUjjcUe3yu7; 25:Cw4Cey1lRbxzWGIJT41JtWLd1n10t9K15sR9j/xJJNRQmIZJuusxMbJqteWuakkhz/yz6R4QKYY7g+fxe1JDDXHwpO87njj7kOwEcyTodCqFXEdYWV9cQpMcyl6T1Ey35I4furAPGj+bJ3FOFIqlLorsFkGlRRHCk5wCGursjvmoBAd0J/uBhvvJhCwlYb+k1k0xWyCQpO8WUU/fNElJ6hjBGaXYkhcuf1zqoYAambJ1fqyDTtjbRFtTX6Vm0YBw13Z9fzEdqdFDo+XJIuDSaQmQnZ8OB/DkMs05ixgqu8b72pzDxqGjM0L67fbkRULl66GJHzGkffhAQ5OgTbPWVQ==; 31:I6jgeMoXqIQtmiSirfD37bN3el5o/ONjNucroY/51m7+BaARp5YQ5+X6oaassSXWRJl5EUOznLq1z7cYQVuXwRP49KgzPeC2jGW0CLPLlHH2MnDD5RTI/6A3EN65mNszwIsUNKUUY3Em0+wL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== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(39380400002)(396003)(376002)(346002)(366004)(199004)(189003)(446003)(956004)(2616005)(305945005)(6666003)(47776003)(476003)(54906003)(44832011)(53936002)(68736007)(486006)(110136005)(8936002)(8676002)(81156014)(16586007)(316002)(81166006)(25786009)(4326008)(7736002)(6116002)(3846002)(11346002)(97736004)(36756003)(106356001)(478600001)(105586002)(42882007)(52116002)(51416003)(26005)(16526019)(186003)(50226002)(66066001)(72206003)(6486002)(2906002)(55236004)(50466002)(6512007)(386003)(6506007)(5660300001)(76176011)(48376002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN7PR07MB4898; 23:NZZtFpPwn+rOfGqoz9sCUApZCra3SlZLzHLB08HVE?= =?us-ascii?Q?XbxaUJFLrPwaT/4VSWuAnlX6XKy33ycvQHMlvY6MbhQRsWKd6nn8pFSOBWbe?= =?us-ascii?Q?jgxsfGD7r4NMCGzrz9r/k/VwDxIV4Hx/b5kHTg2fCXi7dqPR949URHHRhzWT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tMk+qVfMzjwzIusAxIYInu9zYb?= =?us-ascii?Q?h7GyrullONX+3ddWisexT91Zwe1nbetXPvIwrQMxsKeRnkwT8pN8Sz6KPnRc?= =?us-ascii?Q?yXFsm7fhr2ZqPTCjaC8LIgx6RodfxEFVWTgxCyDRUTX9CpF5CzxD/bUPWdPL?= =?us-ascii?Q?TyMXc6zoqt1L/+iIVwe/44c8imME3tAfaSicaCYTeEyp+55bHZs5xtbACIeq?= =?us-ascii?Q?Hh1g9lQwxA5E1gCSAkuNZFMY9YR09GksYvBNV8YaT9f+TMSrQZz9ZMJ963lq?= =?us-ascii?Q?AcCiululEpA+V1CEbfesfbhblkJm3wV/n2LKHaHScWVYTP3v2pRVPIFMOnCW?= =?us-ascii?Q?IZ5iQ=3D=3D?= X-Microsoft-Antispam-Message-Info: XUxddCKF5JKGRLkG+uaZsdFp4/B6Ds0fmiZKkQZu9szWLqxed8sqQDT222w/7ByJDNuqy5ktYlwsf/wi8HwappLC0lmRyZZXoz5usNpShXeWPJq1kTb0jdEL63BUDsr98M2RXp8iD1/IRLM7BYsLG10wcGF8RIAvmzAn+xZUGdSS+ouZQR3KwgXIyROaxob5 X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 6:ceYHtK5x88zWUHINiaGsUJEvXFaTOUwkEGc69GhD8kbRV+hY3jEqdwc5KMPxtNruoPxaWy5BB8yQDGu9utqKk+LcLlQQonUeRklBO1b9ouiKAJU0l8+OvjevooWKUwaSWEZaDLlJ+mSMoXtc0/qbLYqAQgYNBbmFYxrmVezGzGyxVg6LaNPI3Ew1BXcVJjXwl6owbxzYqLhKjMyS7F/Xhlz2EQaAcZxWWlc7xislER5EHdQldRwe+i7G/mz/NnO06ZjoJds7Zq990m4reeFrpyWmSinV+zxtz90rabCCPZOSE41R9KTGLrx85R3pfdt76mp0wYUmBzLwWPp3p74Pzlw19yLK+p8eHlrQjykqf6XvKkVxcx5Qt8mMU8PGbZJogjvGKEA4oisfgUeXJc9zF8inCaVuMgUvnq09t1rCImZqFMgQXXCXrc983DClTLaAOh5vOXyg6jEUEai6CRj9Gw==; 5:yxyWtqgf4s9/c5f76no0PbU3n+0vfqISD+LECQ8iOJGNxu3mRvcvHCcyElz/nZmI1CDSv4wh6V0efGgdS1knAS7CfssMHwcgHBG4LbVBCWJ+vjtrmSdc0a37W21IigvJEkhsiY2yWAx/JH1+loWFiM2BWTu6kwdQ9Db+vxaQ5N0=; 24:L5S/ltTpccuagwNBwJFHsgzMVoDngVGEcgCEnwQ2HqoaODzk4P28IsTwxRyP2DmdJ70XMn+H67pOxtkd6zMEy3gIL8ZsR+d1qSlr17oq8AI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:wYhtKFfM/Wfs51Q6YTCyxcFVIEvv4/tQ3KcrYORcFf8E1rSxfIEY4moGPc3qnkzjEnX2ITX6BBUdbJu6Dub/P9509AH3DwER6YXwfx+YZRxqJqoID+SZ7BDJic4LfjrcvBXIs4iC/HqP5fovPstSRXjEnPVRw7Qg3qHg6YoSesRDEMraENMU4rNnP1dzW3MdYBgnGdjt7jRUNHFoOpZb43nIZxXynZeA2FEIHhiLEHJ1EVTQXb4m3AN9g3wtE/JW X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 11:50:18.5624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4460ec7e-e7de-4978-0bd8-08d5d1ed015c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4898 Subject: [dpdk-dev] [PATCH v1 10/15] examples/l2fwd: optimize check for master core 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: Thu, 14 Jun 2018 11:50:22 -0000 Replacing the check for lcore_id & mastercore_id with the check for a flag. Signed-off-by: Anoob Joseph --- v1: * Replaced 'unsigned' with 'unsigned int' examples/l2fwd/l2fwd_worker.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c index dfa78ed..f847832 100644 --- a/examples/l2fwd/l2fwd_worker.c +++ b/examples/l2fwd/l2fwd_worker.c @@ -135,12 +135,12 @@ l2fwd_main_loop(void) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *m; unsigned int lcore_id; - unsigned int master_core_id; uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc; unsigned int i, j, portid, nb_rx; struct lcore_queue_conf *qconf; const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; + int is_master_core; prev_tsc = 0; timer_tsc = 0; @@ -162,8 +162,8 @@ l2fwd_main_loop(void) portid); } - - master_core_id = rte_get_master_lcore(); + /* Set the flag if master core */ + is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0; while (!force_quit) { @@ -188,7 +188,7 @@ l2fwd_main_loop(void) if (unlikely(timer_tsc >= timer_period)) { /* do this only on master core */ - if (lcore_id == master_core_id) { + if (is_master_core) { print_stats(); /* reset the timer */ timer_tsc = 0; -- 2.7.4