From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0085.outbound.protection.outlook.com [104.47.36.85]) by dpdk.org (Postfix) with ESMTP id EB5791B4ED for ; Wed, 11 Jul 2018 08:08:16 +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=xgahZgU0yDb3Q91i+NBHoUiIbzYG6M8DWrBi1JohPfg=; b=Ah196d5pG2kaCT7EWRQzN8PBFrEhctYy1Kpb4GmQfPxluAtWQbly6tXhOmNRiFZr8foZ0pTstXvKT2A3FeUVWIE1H/lx16tINB0ujvjSmLT8lJDOOqnkGwiZlHijbnMKTcSJums7Xm4zHbTPo7UdLlgz4YlcgaOLCrd1DC8TMW8= 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.930.21; Wed, 11 Jul 2018 06:08:13 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Wed, 11 Jul 2018 11:37:23 +0530 Message-Id: <1531289248-20025-8-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531289248-20025-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> <1531289248-20025-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: BMXPR01CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::13) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af62a0e2-ef17-4bbb-e83b-08d5e6f4b0c4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:rPC00sSBRrp7BashK5xAPAfKr7pvFK1wPOBkanRUTrFjn9I4uMp5dd4pov6uwxEAJMuhJyJUR5uQl4VTOj80XJEm/Kz7AiHnXLPMauL2GZs1HiK8kNOfKQ7Qy5MNaRszYByduHLdIRpmt9XgerAh1ZeBry9+Hq4CU3y1zwLLdVB+wffxSNzivxpcFtgKjHdZQ6JiUGJ2BnZKlOZUjsupVhzNCgBkXMixHYT0CMXoK2/RgUvt760qWTcSLJMT88KR; 25:sAOHiAuTGmJ+TjYiHLs002e0+QEXs3m61jn+4Q3OYhgUOb18G7bUOwS0eymH2G2o2LF8hu0e2ynItmZGeUTR5ItNFz7rblekN9ud60eIOPFv88EjxrAbGTlPZQmpXS0CghZZAW/B+4jHZH6xphxBzzMDFnlbJPl6pAATZEPU3mAqUBAJ/IFsPSv0I+2sabDL3sCJOcR6A2l7a1991On5jrPcE6WmrKPsNp1fDI8tTFD1xXiyLI7iXAvsitjXm9mcveweinxzlCaO5x9Z1vlM8J6jB0SR1T+94plYYcvu9n3ncZT53UHJ/NDtt104iEFBLCZJZNOzKcoayDEDsqVuiw==; 31:2mtj2zjXDga4mF4e3FEX0gX9gF2FXjuygTdUxjdmlEalddztvyPGiLiwWRlirufA6W3LQ6dHzjVVgzUQBND+vXo+2G+skq0ydU0M0IsSFuO5/OdVd2OPJq6pD86BCKSOHJbTfy3j2fr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am-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)(3231311)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0730093765 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(189003)(199004)(68736007)(81166006)(8676002)(81156014)(44832011)(50466002)(6666003)(25786009)(6512007)(7736002)(4326008)(6486002)(48376002)(8936002)(2906002)(3846002)(478600001)(72206003)(305945005)(6116002)(486006)(16586007)(2616005)(54906003)(110136005)(316002)(36756003)(476003)(956004)(446003)(11346002)(47776003)(26005)(42882007)(52116002)(105586002)(186003)(76176011)(16526019)(66066001)(106356001)(51416003)(97736004)(6506007)(55236004)(50226002)(53936002)(5660300001)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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:uxdWqEoylUyRfYbfUcTxUZf5pyjpyd3QwUGIQQKMJ?= =?us-ascii?Q?75A6WobRxVYq4T9hi4iXoy2GCgMSa1pX4JeAJDj7q27LWbqesxILFkZWfhut?= =?us-ascii?Q?E1Y5u0mOA74fnuWAXolH0XmOeVtR6WCj7IZm3novO4ZEpExrglZMnj+0cwEQ?= =?us-ascii?Q?sYh6QNBXLQRZH/+D4u8cxiHfUtmuX1hV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y3YY4Q6lKPlyBl8QnjGBns6z4OL8myahOZk46x4jrEBpapP+gYkg==; 5:/Ri2IE3wOkjlcSmgZf0oWv2dFZ+u6zyUvCvnnPk5u9YfHUO8dypyOZciBPS6VY76mSTlZTwTfkria+PLpXVfV07h8FNb8u1J6u+5hNB/BPqIPMeMS/HkEHXuJJvQksGPWy+QJknd52zz9f7G04Uz0HQz8F76auuks23cN1rZfsQ=; 24:aacTxgm9j/8M5N8SVaPlsJEYWWMTMO2aSkCOMicYc5BDpjyVzfVhL4hmvWGUY55JCsJVgBShkagNFBP3wYew3EtNW8aFXxnfIkiPstbd/Pw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:naTjDimBju7F/wXXMymSVv+JgDNeTHch1txpo0mCh0eqGMKIIbIFAlneDDapUpaGLOIEjOuv+g187pC8g31Um5POvXyieE5NTyIRxOF38E4qHsGIknDAVZKZM1Cly44wPOyGw9aWr2D5EGyHd3GTNOuDbDPRxcKYTR1OnJQz/nPFtJe5c+kvxlB+PSSd1LgiYEfAmlK9VhPfcLaf4AfXajBu/C4mym5Aj54VQ2V5gpZ6K1WTkWC/JOVvPnb81RRG X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2018 06:08:13.6553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af62a0e2-ef17-4bbb-e83b-08d5e6f4b0c4 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 v2 07/12] 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: Wed, 11 Jul 2018 06:08:17 -0000 Replacing the check for lcore_id & mastercore_id with the check for a flag. Signed-off-by: Anoob Joseph --- v2: * No change 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