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 E90CAA0509 for ; Sat, 7 May 2022 03:28:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB9B94014F; Sat, 7 May 2022 03:28:04 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3AD004014F for ; Sat, 7 May 2022 03:28:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651886883; x=1683422883; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=weEiRIWFPpjpaC1DDZTPR4OwHuh/3STR3sJxeFKFhcY=; b=iacq+BI8+tapF78FYNfYS73antIFFRLAfT665ZOqIgIrONLBUSB2GCnn 8zSlYIVf69wB04zDd86BG4BBtPITbhQJ3DauS77EiZhbfSZuTGKg48yma LD1uTieu8sqXiueMaERnplvvf+3EjkWd3AmztFeAvdxRDlnEgT6O/T6Vu JrQyBgR76yeEuoPnZLMYQDmHvF8dNVW+Ru5kROZmlsuL3Ylux3UfBcRBb pPrty912sje1CtsHBMITwNWUc95nu+Ame1Pm+SFspUhyqWLe2uUcmWVVT 05MH9E5nCT5Ro8rWGRZzSNeG2g6M5aZPNJ6iSU5QGs5azow+QtY4qeRyJ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="329169350" X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="329169350" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:28:01 -0700 X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="709709847" Received: from unknown (HELO localhost.localdomain) ([10.239.251.174]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:27:59 -0700 From: Yiding Zhou To: 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] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Date: Sat, 7 May 2022 17:34:29 +0800 Message-Id: <20220507093429.127530-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: , 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 345f6aeebc..69584264de 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2908,6 +2908,18 @@ iavf_set_rx_function(struct rte_eth_dev *dev) bool use_avx512 = false; bool use_flex = false; + 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]; + if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 || + !(vf->supported_rxdid & BIT(rxq->rxdid))) { + use_flex = false; + break; + } + } + check_ret = iavf_rx_vec_dev_check(dev); if (check_ret >= 0 && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) { @@ -2923,10 +2935,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 +3038,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 +3049,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