From patchwork Mon Jul 30 17:34:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 43451 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC8125F0F; Mon, 30 Jul 2018 19:34:36 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3DE0C5B2C; Mon, 30 Jul 2018 19:34:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2018 10:34:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,422,1526367600"; d="scan'208";a="68686276" Received: from silpixa00399779.ir.intel.com ([10.237.223.187]) by FMSMGA003.fm.intel.com with ESMTP; 30 Jul 2018 10:34:31 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren , bruce.richardson@intel.com, stable@dpdk.org, thomas@monjalon.net, david.coyle@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com Date: Mon, 30 Jul 2018 18:34:19 +0100 Message-Id: <1532972059-191978-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532971818-191870-1-git-send-email-harry.van.haaren@intel.com> References: <1532971818-191870-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix avx2 driver check for rx rearm 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" This commit fixes an infinite loop bug that could occur if the i40e AVX2 driver is used, and high traffic rates cause the mempool from which the rxq pulls mbufs to become empty. The result would be an infinite loop of checking if we should perform an rx rearm, calling the function and an error return due the the mempool being emtpy. The fix is to align the code in the AVX2 driver with the SSE driver, where an if() is used instead of a while(), allowing the thread to return from i40e rx function even if the mempool is empty. Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function") Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Reported-by: David Coyle Signed-off-by: Harry van Haaren Reported-by: David Coyle Signed-off-by: Harry van Haaren Acked-by: Brendan Ryan Tested-by: David Coyle --- v2: - Fix typo, sorry for email flood :) Cc: thomas@monjalon.net @Thomas, please consider this fix for inclusion in 18.08-rc3 assuming it gets verified as a good fix and Acked. Reporter please verify: Cc: david.coyle@intel.com i40e maintainers, please Review/Ack: Cc: beilei.xing@intel.com Cc: qi.z.zhang@intel.com --- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c index dbcb61f..23179b3 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c +++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c @@ -188,7 +188,7 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, /* See if we need to rearm the RX queue - gives the prefetch a bit * of time to act */ - while (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH) + if (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH) i40e_rxq_rearm(rxq); /* Before we start moving massive data around, check to see if