From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id B0C8F37B1 for ; Mon, 19 Dec 2016 07:09:39 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8DA8D1500; Sun, 18 Dec 2016 22:09:38 -0800 (PST) Received: from Overdrive.shanghai.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B323A3F220; Sun, 18 Dec 2016 22:09:37 -0800 (PST) From: Jianbo Liu To: dev@dpdk.org, helin.zhang@intel.com, konstantin.ananyev@intel.com, jerin.jacob@caviumnetworks.com Cc: Jianbo Liu Date: Mon, 19 Dec 2016 11:39:17 +0530 Message-Id: <1482127758-4904-1-git-send-email-jianbo.liu@linaro.org> X-Mailer: git-send-email 2.4.11 Subject: [dpdk-dev] [PATCH 1/2] net/ixgbe: calculate the correct number of received packets in bulk alloc function 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: Mon, 19 Dec 2016 06:09:40 -0000 To get better performance, Rx bulk alloc recv function will scan 8 descriptors in one time, but the statuses are not consistent on ARM platform because the memory allocated for Rx descriptors is cacheable hugepages. This patch is to calculate the number of received packets by scanning DD bit sequentially, and stops when meeting the first packet with DD bit unset. Signed-off-by: Jianbo Liu --- drivers/net/ixgbe/ixgbe_rxtx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index b2d9f45..2866bdb 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1402,17 +1402,21 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) for (i = 0; i < RTE_PMD_IXGBE_RX_MAX_BURST; i += LOOK_AHEAD, rxdp += LOOK_AHEAD, rxep += LOOK_AHEAD) { /* Read desc statuses backwards to avoid race condition */ - for (j = LOOK_AHEAD-1; j >= 0; --j) + for (j = LOOK_AHEAD - 1; j >= 0; --j) { s[j] = rte_le_to_cpu_32(rxdp[j].wb.upper.status_error); - - for (j = LOOK_AHEAD - 1; j >= 0; --j) pkt_info[j] = rte_le_to_cpu_32(rxdp[j].wb.lower. lo_dword.data); + } + + rte_smp_rmb(); /* Compute how many status bits were set */ nb_dd = 0; for (j = 0; j < LOOK_AHEAD; ++j) - nb_dd += s[j] & IXGBE_RXDADV_STAT_DD; + if (s[j] & IXGBE_RXDADV_STAT_DD) + ++nb_dd; + else + break; nb_rx += nb_dd; -- 2.4.11