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 8BA8DA0509; Sat, 7 May 2022 03:30:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2ED9540395; Sat, 7 May 2022 03:30:04 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 609924014F; Sat, 7 May 2022 03:30:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651887002; x=1683423002; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=weEiRIWFPpjpaC1DDZTPR4OwHuh/3STR3sJxeFKFhcY=; b=kIw70It92qqpZGK4GIWjYB6d+p758F6wn68BhmhUUK8QP/TgfxIjtzQV OqY08H0CQ2vDLDrVlnKS3hfrT25qK7j0KrP9bI7e5lil39tbcnvnYyIcW sLasFIZREfqmwbfaiGPhGWM+MyQIwGfOBKmWTAd9Jvu3BXaiuF1nBZ6WP paDds/uQBrA/8C0147NTNgOo/ut0pa4PnV+MGAd2nzX7WVvkbwz3EFLwk 18VDUpgOtzlHHmsUeT/aLOHhIICA/XcqF7RHS9xj+Cp73jcWKSUaXor38 2lZbvXXm+vFLbeB6RlAcD7dapjRtyIvSYcnYhRWfG9XU8wVR88a55OxcH w==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293837763" X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="293837763" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:30:01 -0700 X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="709710099" 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:29:58 -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] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Date: Sat, 7 May 2022 17:36:37 +0800 Message-Id: <20220507093637.127591-1-yidingx.zhou@intel.com> X-Mailer: git-send-email 2.25.1 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 | 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