From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67506A0579; Thu, 8 Apr 2021 23:36:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29E18141178; Thu, 8 Apr 2021 23:36:38 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id E0D46141177 for ; Thu, 8 Apr 2021 23:36:36 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43DD5106F; Thu, 8 Apr 2021 14:36:36 -0700 (PDT) Received: from n1sdp-2.usa.Arm.com (n1sdp-2.usa.arm.com [10.118.91.151]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 320A13F792; Thu, 8 Apr 2021 14:36:36 -0700 (PDT) From: Kathleen Capella To: dev@dpdk.org Cc: nd@arm.com, honnappa.nagarahalli@arm.com, kathleen.capella@arm.com, thomas@monjalon.net Date: Thu, 8 Apr 2021 21:35:49 +0000 Message-Id: <20210408213549.10511-1-kathleen.capella@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210223182300.29817-1-kathleen.capella@arm.com> References: <20210223182300.29817-1-kathleen.capella@arm.com> Subject: [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain in the first iteration of the packet processing loop. Signed-off-by: Kathleen Capella Reviewed-by: Honnappa Nagarahalli --- examples/l3fwd/l3fwd_em.c | 9 +++++---- examples/l3fwd/l3fwd_lpm.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index 9996bfba3..01f8dff48 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -629,8 +629,6 @@ em_main_loop(__rte_unused void *dummy) const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; - prev_tsc = 0; - lcore_id = rte_lcore_id(); qconf = &lcore_conf[lcore_id]; @@ -650,9 +648,10 @@ em_main_loop(__rte_unused void *dummy) lcore_id, portid, queueid); } - while (!force_quit) { + cur_tsc = rte_rdtsc(); + prev_tsc = cur_tsc; - cur_tsc = rte_rdtsc(); + while (!force_quit) { /* * TX burst queue drain @@ -692,6 +691,8 @@ em_main_loop(__rte_unused void *dummy) portid, qconf); #endif } + + cur_tsc = rte_rdtsc(); } return 0; diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 3dcf1fef1..375746fef 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -185,8 +185,6 @@ lpm_main_loop(__rte_unused void *dummy) const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; - prev_tsc = 0; - lcore_id = rte_lcore_id(); qconf = &lcore_conf[lcore_id]; @@ -206,9 +204,10 @@ lpm_main_loop(__rte_unused void *dummy) lcore_id, portid, queueid); } - while (!force_quit) { + cur_tsc = rte_rdtsc(); + prev_tsc = cur_tsc; - cur_tsc = rte_rdtsc(); + while (!force_quit) { /* * TX burst queue drain @@ -249,6 +248,8 @@ lpm_main_loop(__rte_unused void *dummy) portid, qconf); #endif /* X86 */ } + + cur_tsc = rte_rdtsc(); } return 0; -- 2.17.1