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 0C013A050C for ; Sat, 7 May 2022 10:04:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01BAF4113C; Sat, 7 May 2022 10:04:34 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4F2B840395; Sat, 7 May 2022 10:04:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651910671; x=1683446671; h=from:to:cc:subject:date:message-id:reply-to:mime-version: content-transfer-encoding; bh=JXKxQJ16PJV+jFL7uktKCE/bSeiipFz69eKKxBbdbtg=; b=DrVgCb5ma8tEgZOlvKgWOI80g47P+h0sHUiooaPfqu8es7FS4GUabGZC xx0vNGI9EMKkXE4LBZE9Bza74fz6q0zKqRWsCarsKY7A6lIhghs5gAoPc FYhmPAgd/X/JyEC+T8zI3CkEhD3y1d62NViUgkFTn684Bsxl4fDQkAVfO hV5t3Yw9lwVkY9EwLzqyjisSbiaA79hDMJHUwPHCyfHLI0ZKTyIMh8fAf r7DuyE8yY+D1//jT4a5+QzeiDcuxX9wTDEBSBgmfCoH6utK9VsfVMtUQF PESL6FS2g0Eg9GniXSWeCTL8kbZ9O1qzPd/9egt1nfXDmvhW1OxirOlD/ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="355109290" X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="355109290" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 01:04:30 -0700 X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="586414469" 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 01:04:26 -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:11:03 +0800 Message-Id: <20220507161103.244667-1-yidingx.zhou@intel.com> X-Mailer: git-send-email 2.25.1 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: , Reply-To: 20220507093637.127591-1-yidingx.zhou@intel.com 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 | 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