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 03A5AA050C for ; Sat, 7 May 2022 13:46:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC0B84113C; Sat, 7 May 2022 13:46:07 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id A17E140395; Sat, 7 May 2022 13:46:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651923965; x=1683459965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1fuxJitroKLBDph3QNEb2/XcBSCVR6xMYKda+vd64mM=; b=MqyG84HHvgqfYKd9ofzPkJGPe4uelzIltwOGVRgLAYHlz2Uc+0CkBY/+ Jvm7RWv5Ax1UVdlgL/fjQ7v49fma9ftmhwqe9aeJjAEPdBC9f+pnaLwR+ wrG09WR2tguXdvy1i7fZTOzt/NX694Hx7CB6l2uVo01Xr9/bq0rtLK0LF 83Tz4rxihY2bhZmA0Q/qyoBtQOkVLgUZAbK9emfZQZ9nUZLmUJoilsbTq M4/rnsH5Es5hzPYzeJl2fiHwsto9YA6IQOZNL8lfr8CkcMpo+FTkQhoWt /IzZIEeIc4Ql1q6rZ5mDrqHqalWpwmDietECws/w30TuhCbYEaLzpmCZe g==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="250712195" X-IronPort-AV: E=Sophos;i="5.91,207,1647327600"; d="scan'208";a="250712195" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 04:46:04 -0700 X-IronPort-AV: E=Sophos;i="5.91,207,1647327600"; d="scan'208";a="586475955" Received: from unknown (HELO localhost.localdomain) ([10.239.251.174]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 04:46:01 -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 03:52:39 +0800 Message-Id: <20220507195239.250067-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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 345f6aeebc..d3b1a58b27 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2899,14 +2899,27 @@ 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) { + PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is legacy, " + "set rx_pkt_burst as legacy for all queues", rxq->rxdid, i); + use_flex = false; + } else if (!(vf->supported_rxdid & BIT(rxq->rxdid))) { + PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is not supported, " + "set rx_pkt_burst as legacy for all queues", rxq->rxdid, i); + use_flex = false; + } + } #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 +2936,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 +3039,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 +3050,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