From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1B00C3978 for ; Thu, 14 Jul 2016 17:48:49 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 14 Jul 2016 08:48:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,363,1464678000"; d="scan'208";a="846328108" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 14 Jul 2016 08:48:48 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u6EFmldg016641; Thu, 14 Jul 2016 16:48:47 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u6EFmlN3015155; Thu, 14 Jul 2016 16:48:47 +0100 Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u6EFmlrb015151; Thu, 14 Jul 2016 16:48:47 +0100 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Thu, 14 Jul 2016 16:48:45 +0100 Message-Id: <1468511325-15117-1-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for zero packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 15:48:50 -0000 From: Reshma Pattan Zero packets can be returned by rte_eth_rx_burst() and rte_distributor_returned_pkts() inside lcore_rx(), so for zero packet scenario instead of proceeding to next operations we should continue to the next iteration of the loop to avoid unnecessary processing overhead which is causing rx packets to be dropped and hence distributor failing to forward the packets. Fixes: 07db4a97 ("examples/distributor: new sample app") Signed-off-by: Reshma Pattan --- examples/distributor/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 24857f2..537cee1 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -221,14 +221,22 @@ lcore_rx(struct lcore_params *p) struct rte_mbuf *bufs[BURST_SIZE*2]; const uint16_t nb_rx = rte_eth_rx_burst(port, 0, bufs, BURST_SIZE); + if (unlikely(nb_rx == 0)) { + if (++port == nb_ports) + port = 0; + continue; + } app_stats.rx.rx_pkts += nb_rx; rte_distributor_process(d, bufs, nb_rx); const uint16_t nb_ret = rte_distributor_returned_pkts(d, bufs, BURST_SIZE*2); app_stats.rx.returned_pkts += nb_ret; - if (unlikely(nb_ret == 0)) + if (unlikely(nb_ret == 0)) { + if (++port == nb_ports) + port = 0; continue; + } uint16_t sent = rte_ring_enqueue_burst(r, (void *)bufs, nb_ret); app_stats.rx.enqueued_pkts += sent; -- 2.5.0