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 692E3A050A; Sat, 7 May 2022 10:09:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10E524068A; Sat, 7 May 2022 10:09:19 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A9B3740395; Sat, 7 May 2022 10:09:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651910957; x=1683446957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JXKxQJ16PJV+jFL7uktKCE/bSeiipFz69eKKxBbdbtg=; b=GbhUmAymh3ATLLCwWmvevAaRk+nY7RRLfbHjzecoSVpc4rxzs/dO+tVy 1A2NwBlTge27A+dxk904uTAVD5bwOWvhrddH72hQWVp6m4HLwadexs75+ KBZ5ZFDmL/Few3GwZ90kn6zTXAjOFTd5fgK2XnQ9RTJyzjI8IG8FSsLwx MIfNmSbBcu43cM22/LFbLbEKdLZR4sgrNZ+bmvOkOblGb83C+vHhFM/h+ MxV8s2QLK6s+HgPq6oqRlZicKpBGfuSwY6es69Kj/4c+zox+3WlOR15j9 krtm2VfQ5ukPe3RHYnw1Kliwwbk+0fuUPlp/sGYnw0r9HD4F05XY5sJH/ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="355109635" X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="355109635" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 01:09:14 -0700 X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="709804690" Received: from unknown (HELO localhost.localdomain) ([10.239.251.174]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 01:09:12 -0700 From: Yiding Zhou To: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stable@dpdk.org, ramamani.yeleswarapu@intel.com Subject: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Date: Sun, 8 May 2022 00:15:50 +0800 Message-Id: <20220507161550.244798-1-yidingx.zhou@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220507093637.127591-1-yidingx.zhou@intel.com> References: <20220507093637.127591-1-yidingx.zhou@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use rx_pkt_burst that handles the Flex Receive Descriptor format, but actually configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf Will be filled with wrong values in rx_pkt_burst, which will eventually lead to coredump. This patch fixes mismatch between rx_pkt_burst and rx descriptor. Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction") Cc: stable@dpdk.org Signed-off-by: Yiding Zhou --- drivers/net/iavf/iavf_rxtx.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 345f6aeebc..ed8d51dbb2 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2899,14 +2899,23 @@ iavf_set_rx_function(struct rte_eth_dev *dev) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); + int i; + struct iavf_rx_queue *rxq; + bool use_flex = true; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 || + !(vf->supported_rxdid & BIT(rxq->rxdid))) { + use_flex = false; + break; + } + } #ifdef RTE_ARCH_X86 - struct iavf_rx_queue *rxq; - int i; int check_ret; bool use_avx2 = false; bool use_avx512 = false; - bool use_flex = false; check_ret = iavf_rx_vec_dev_check(dev); if (check_ret >= 0 && @@ -2923,10 +2932,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev) use_avx512 = true; #endif - if (vf->vf_res->vf_cap_flags & - VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) - use_flex = true; - for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; (void)iavf_rxq_vec_setup(rxq); @@ -3030,7 +3035,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev) if (dev->data->scattered_rx) { PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).", dev->data->port_id); - if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) + if (use_flex) dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd; else dev->rx_pkt_burst = iavf_recv_scattered_pkts; @@ -3041,7 +3046,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev) } else { PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).", dev->data->port_id); - if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) + if (use_flex) dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd; else dev->rx_pkt_burst = iavf_recv_pkts; -- 2.25.1