From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7B1B4A0096 for ; Mon, 3 Jun 2019 19:34:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 592961B9AF; Mon, 3 Jun 2019 19:34:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 278791B9A3 for ; Mon, 3 Jun 2019 19:34:11 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53HKaaH000839; Mon, 3 Jun 2019 10:34:10 -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 : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=fvX0hlyafTFdFhmBl1HKk38Cv77FoR8cBi04QGTgHjI=; b=RozMFeyaL2dTjYM1xNxp4havDNiMcVZwa6jT/oBsi/i/2nIVkzSuJTFHvVBF2oAi4BrY herw4ygnYyKlS9DqWdfEfOWz+fxDv9nz1I/2BcUudn1XmL3Vsz0zKHofkXza5bid1BEE kJsctoG1j6trFkQmiYTgEyARXWtkKcVDDIvS/ascsZHLJSVbE68beSN1USCt1HnQzDrM kZU9gdKrAgQhzD86ING7JDvZdjz/sNG7WOPl4BCQ65eZFIWoZQNHt7vVada9mPuI9G9p yFG8Riu+FAsxv6WYJPoYe+Eo/vQkrqbPn1RhfydBDGFopbWAFtEVD77x4rbHvCKfblmo mQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmhdcc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:34:10 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:34:09 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 10:34:07 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id A2A2F3F7040; Mon, 3 Jun 2019 10:34:02 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma Date: Mon, 3 Jun 2019 23:02:08 +0530 Message-ID: <1559583160-13944-9-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com> References: <1559583160-13944-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-03_13:, , signatures=0 Subject: [dpdk-dev] [PATCH 08/39] examples/l2fwd-event: 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replacing the check for lcore_id & mastercore_id with the check for a flag. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- examples/l2fwd-event/l2fwd_worker.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/l2fwd-event/l2fwd_worker.c b/examples/l2fwd-event/l2fwd_worker.c index ebce5c1..86bdd40 100644 --- a/examples/l2fwd-event/l2fwd_worker.c +++ b/examples/l2fwd-event/l2fwd_worker.c @@ -140,6 +140,7 @@ l2fwd_main_loop(void) 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,6 +163,9 @@ l2fwd_main_loop(void) } + /* Set the flag if master core */ + is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0; + while (!force_quit) { cur_tsc = rte_rdtsc(); @@ -185,8 +189,7 @@ l2fwd_main_loop(void) if (unlikely(timer_tsc >= timer_period)) { /* do this only on master core */ - if (lcore_id == - rte_get_master_lcore()) { + if (is_master_core) { print_stats(); /* reset the timer */ timer_tsc = 0; -- 2.7.4