From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 1830C28F3 for ; Mon, 4 Jul 2016 09:51:15 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 04 Jul 2016 00:51:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,573,1459839600"; d="scan'208";a="133347401" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 04 Jul 2016 00:51:14 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u647pCqO032207; Mon, 4 Jul 2016 15:51:12 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u647p9sY028645; Mon, 4 Jul 2016 15:51:11 +0800 Received: (from xiaowan1@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u647p9Ia028641; Mon, 4 Jul 2016 15:51:09 +0800 From: Wang Xiao W To: jing.d.chen@intel.com Cc: dev@dpdk.org, Wang Xiao W Date: Mon, 4 Jul 2016 15:51:08 +0800 Message-Id: <1467618668-28611-1-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] net/fm10k: fix Rx descriptor read timing 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: Mon, 04 Jul 2016 07:51:16 -0000 We find that when traffic is light, a few amount of packets will be wrongly parsed (e.g. packet type), however this issue will not happen when traffic is heavy. The root cause is some fields in fm10k_rx_desc are read at wrong timing. When the input speed is slower than software's capability, fm10k scalar Rx function accesses descriptors closely to HW, so there's potential sequence: some fields like pkt_info in fm10k_rx_desc are read before HW writeback but some fields like DD bit are read after HW writeback, this will lead to the later packet parsing function using incorrect value. This patch fixes this issue by reading and parsing Rx descriptor after DD bit is set. Fixes: 4b61d3bfa941 ("fm10k: add receive and tranmit") Fixes: c82dd0a7bfa5 ("fm10k: add scatter receive") Signed-off-by: Wang Xiao W --- drivers/net/fm10k/fm10k_rxtx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c index dd92a91..5b2d04b 100644 --- a/drivers/net/fm10k/fm10k_rxtx.c +++ b/drivers/net/fm10k/fm10k_rxtx.c @@ -114,10 +114,10 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nb_pkts = RTE_MIN(nb_pkts, q->alloc_thresh); for (count = 0; count < nb_pkts; ++count) { + if (!(q->hw_ring[next_dd].d.staterr & FM10K_RXD_STATUS_DD)) + break; mbuf = q->sw_ring[next_dd]; desc = q->hw_ring[next_dd]; - if (!(desc.d.staterr & FM10K_RXD_STATUS_DD)) - break; #ifdef RTE_LIBRTE_FM10K_DEBUG_RX dump_rxd(&desc); #endif @@ -228,10 +228,10 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nb_seg = RTE_MIN(nb_pkts, q->alloc_thresh); for (count = 0; count < nb_seg; count++) { + if (!(q->hw_ring[next_dd].d.staterr & FM10K_RXD_STATUS_DD)) + break; mbuf = q->sw_ring[next_dd]; desc = q->hw_ring[next_dd]; - if (!(desc.d.staterr & FM10K_RXD_STATUS_DD)) - break; #ifdef RTE_LIBRTE_FM10K_DEBUG_RX dump_rxd(&desc); #endif -- 1.9.3