From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92A54A04B5; Thu, 29 Oct 2020 02:26:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7ABE466DA; Thu, 29 Oct 2020 02:26:06 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 2BDFA5AA4 for ; Thu, 29 Oct 2020 02:26:04 +0100 (CET) IronPort-SDR: LHd+vJ/jwqf80kp5FlwImsiK1zyvOLSaFz3DACpeLR0HmU9El+y1dXic87emXLe9FMgmktn5DD V4PjH0GhyY8w== X-IronPort-AV: E=McAfee;i="6000,8403,9788"; a="165773491" X-IronPort-AV: E=Sophos;i="5.77,428,1596524400"; d="scan'208";a="165773491" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2020 18:26:02 -0700 IronPort-SDR: iluYlDdYJKPQt9H1g3zpt5PftrxLQRIeVBOb+x3ggW23qaCFzYv7kTCvFfsOyR5GVrURdu80pi fs4wwe9bvseg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,428,1596524400"; d="scan'208";a="351234457" Received: from npg-dpdk-haiyue-3.sh.intel.com ([10.67.118.151]) by fmsmga004.fm.intel.com with ESMTP; 28 Oct 2020 18:25:59 -0700 From: Haiyue Wang To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Haiyue Wang , Alvin Zhang , Qiming Yang , Jeff Guo Date: Thu, 29 Oct 2020 09:13:22 +0800 Message-Id: <20201029011322.39392-1-haiyue.wang@intel.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201028165545.20665-1-haiyue.wang@intel.com> References: <20201028165545.20665-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] net/ice: fix DCF Rx segmentation fault X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The initialization of selecting the handler for scalar Rx path FlexiMD fields extraction into mbuf is missed, it will cause segmentation fault (core dumped). Also add the missed support to handle RXDID 16, which has RSS hash value on Qword 1. Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling") Reported-by: Alvin Zhang Signed-off-by: Haiyue Wang --- v2: The RSS hash is wrong, fix it. --- drivers/net/ice/ice_dcf.c | 1 + drivers/net/ice/ice_rxtx.c | 28 +++++++++++++++++++++++++++- drivers/net/ice/ice_rxtx.h | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index d20e2b3f48..44dbd3bb84 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -899,6 +899,7 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw) return -EINVAL; } #endif + ice_select_rxd_to_pkt_fields_handler(rxq[i], vc_qp->rxq.rxdid); } memset(&args, 0, sizeof(args)); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f6291894cd..1bac643125 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -43,6 +43,28 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_generic(__rte_unused struct ice_rx_queue *rxq, + struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) +{ + volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; + uint16_t stat_err = rte_le_to_cpu_16(desc->status_error0); + + if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) { + mb->ol_flags |= PKT_RX_RSS_HASH; + mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + if (desc->flow_id != 0xFFFFFFFF) { + mb->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; + mb->hash.fdir.hi = rte_le_to_cpu_32(desc->flow_id); + } +#endif +} + static inline void ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, struct rte_mbuf *mb, @@ -148,7 +170,7 @@ ice_rxd_to_pkt_fields_by_comms_aux_v2(struct ice_rx_queue *rxq, #endif } -static void +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid) { switch (rxdid) { @@ -182,6 +204,10 @@ ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid) rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; break; + case ICE_RXDID_COMMS_GENERIC: + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_generic; + break; + case ICE_RXDID_COMMS_OVS: rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; break; diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 23409d479a..6b16716063 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -234,6 +234,8 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset); int ice_tx_descriptor_status(void *tx_queue, uint16_t offset); void ice_set_default_ptype_table(struct rte_eth_dev *dev); const uint32_t *ice_dev_supported_ptypes_get(struct rte_eth_dev *dev); +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, + uint32_t rxdid); int ice_rx_vec_dev_check(struct rte_eth_dev *dev); int ice_tx_vec_dev_check(struct rte_eth_dev *dev); -- 2.29.0