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 9982C423FA; Tue, 17 Jan 2023 08:52:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35D0B42D63; Tue, 17 Jan 2023 08:51:11 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 5396842D36 for ; Tue, 17 Jan 2023 08:51:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673941869; x=1705477869; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kr6VkxCLfmzyVm68vs/2q64VE3cweGA8PtEVd6NLQ3E=; b=J0WE2qMb70E4iURT49bTkxgVe0gf9QQUhfaSsKuNSvr4tEZzJdzXJSNu 8AsmuWFpH00NI6956CTHMvx2RBTKAGFsb5GV48PM0x290SvhI6ftVQSIT zoyaBjwv3jUk3gJjCpqUIz8Y9uPdWhiKZN3VSW1LJUdAQewmSfPLYeQHg 36j/ZhN7ABdr9QiYY5E9wCzOw10nCN6dNP8uj7fyX9NpyqAgmqXfu5WR8 Mq9aY93dNZOhRfXd/HX5nxWPwDQX5eLWMFyyBUhlyUo3FGq1acufXUOzk sWLPwO7GeBjyuP/IibCVurMDfrl6kVqIWsPOLwx+OP1mgXAU9yY40HJQK Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="312497051" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="312497051" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2023 23:51:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="767174528" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="767174528" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by fmsmga002.fm.intel.com with ESMTP; 16 Jan 2023 23:51:06 -0800 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, qi.z.zhang@intel.com, Beilei Xing Subject: [PATCH v3 08/15] common/idpf: support get packet type Date: Tue, 17 Jan 2023 07:26:17 +0000 Message-Id: <20230117072626.93796-11-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230117072626.93796-1-beilei.xing@intel.com> References: <20230117072626.93796-1-beilei.xing@intel.com> 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 From: Beilei Xing Move ptype_tbl field to idpf_adapter structure. Move get_pkt_type to common module. Signed-off-by: Beilei Xing --- drivers/common/idpf/idpf_common_device.c | 216 +++++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 7 + drivers/common/idpf/idpf_common_virtchnl.h | 10 +- drivers/common/idpf/meson.build | 2 + drivers/net/idpf/idpf_ethdev.c | 6 - drivers/net/idpf/idpf_ethdev.h | 4 - drivers/net/idpf/idpf_rxtx.c | 4 +- drivers/net/idpf/idpf_rxtx.h | 4 - drivers/net/idpf/idpf_rxtx_vec_avx512.c | 3 +- drivers/net/idpf/idpf_vchnl.c | 213 -------------------- 10 files changed, 233 insertions(+), 236 deletions(-) diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c index 422b0b0304..9647d4a62a 100644 --- a/drivers/common/idpf/idpf_common_device.c +++ b/drivers/common/idpf/idpf_common_device.c @@ -96,6 +96,216 @@ idpf_init_mbx(struct idpf_hw *hw) return ret; } +static int +idpf_get_pkt_type(struct idpf_adapter *adapter) +{ + struct virtchnl2_get_ptype_info *ptype_info; + uint16_t ptype_offset, i, j; + uint16_t ptype_recvd = 0; + int ret; + + ret = idpf_vc_query_ptype_info(adapter); + if (ret != 0) { + DRV_LOG(ERR, "Fail to query packet type information"); + return ret; + } + + ptype_info = rte_zmalloc("ptype_info", IDPF_DFLT_MBX_BUF_SIZE, 0); + if (ptype_info == NULL) + return -ENOMEM; + + while (ptype_recvd < IDPF_MAX_PKT_TYPE) { + ret = idpf_read_one_msg(adapter, VIRTCHNL2_OP_GET_PTYPE_INFO, + IDPF_DFLT_MBX_BUF_SIZE, (uint8_t *)ptype_info); + if (ret != 0) { + DRV_LOG(ERR, "Fail to get packet type information"); + goto free_ptype_info; + } + + ptype_recvd += ptype_info->num_ptypes; + ptype_offset = sizeof(struct virtchnl2_get_ptype_info) - + sizeof(struct virtchnl2_ptype); + + for (i = 0; i < rte_cpu_to_le_16(ptype_info->num_ptypes); i++) { + bool is_inner = false, is_ip = false; + struct virtchnl2_ptype *ptype; + uint32_t proto_hdr = 0; + + ptype = (struct virtchnl2_ptype *) + ((uint8_t *)ptype_info + ptype_offset); + ptype_offset += IDPF_GET_PTYPE_SIZE(ptype); + if (ptype_offset > IDPF_DFLT_MBX_BUF_SIZE) { + ret = -EINVAL; + goto free_ptype_info; + } + + if (rte_cpu_to_le_16(ptype->ptype_id_10) == 0xFFFF) + goto free_ptype_info; + + for (j = 0; j < ptype->proto_id_count; j++) { + switch (rte_cpu_to_le_16(ptype->proto_id[j])) { + case VIRTCHNL2_PROTO_HDR_GRE: + case VIRTCHNL2_PROTO_HDR_VXLAN: + proto_hdr &= ~RTE_PTYPE_L4_MASK; + proto_hdr |= RTE_PTYPE_TUNNEL_GRENAT; + is_inner = true; + break; + case VIRTCHNL2_PROTO_HDR_MAC: + if (is_inner) { + proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK; + proto_hdr |= RTE_PTYPE_INNER_L2_ETHER; + } else { + proto_hdr &= ~RTE_PTYPE_L2_MASK; + proto_hdr |= RTE_PTYPE_L2_ETHER; + } + break; + case VIRTCHNL2_PROTO_HDR_VLAN: + if (is_inner) { + proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK; + proto_hdr |= RTE_PTYPE_INNER_L2_ETHER_VLAN; + } + break; + case VIRTCHNL2_PROTO_HDR_PTP: + proto_hdr &= ~RTE_PTYPE_L2_MASK; + proto_hdr |= RTE_PTYPE_L2_ETHER_TIMESYNC; + break; + case VIRTCHNL2_PROTO_HDR_LLDP: + proto_hdr &= ~RTE_PTYPE_L2_MASK; + proto_hdr |= RTE_PTYPE_L2_ETHER_LLDP; + break; + case VIRTCHNL2_PROTO_HDR_ARP: + proto_hdr &= ~RTE_PTYPE_L2_MASK; + proto_hdr |= RTE_PTYPE_L2_ETHER_ARP; + break; + case VIRTCHNL2_PROTO_HDR_PPPOE: + proto_hdr &= ~RTE_PTYPE_L2_MASK; + proto_hdr |= RTE_PTYPE_L2_ETHER_PPPOE; + break; + case VIRTCHNL2_PROTO_HDR_IPV4: + if (!is_ip) { + proto_hdr |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + is_ip = true; + } else { + proto_hdr |= RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_TUNNEL_IP; + is_inner = true; + } + break; + case VIRTCHNL2_PROTO_HDR_IPV6: + if (!is_ip) { + proto_hdr |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + is_ip = true; + } else { + proto_hdr |= RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_TUNNEL_IP; + is_inner = true; + } + break; + case VIRTCHNL2_PROTO_HDR_IPV4_FRAG: + case VIRTCHNL2_PROTO_HDR_IPV6_FRAG: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_FRAG; + else + proto_hdr |= RTE_PTYPE_L4_FRAG; + break; + case VIRTCHNL2_PROTO_HDR_UDP: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_UDP; + else + proto_hdr |= RTE_PTYPE_L4_UDP; + break; + case VIRTCHNL2_PROTO_HDR_TCP: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_TCP; + else + proto_hdr |= RTE_PTYPE_L4_TCP; + break; + case VIRTCHNL2_PROTO_HDR_SCTP: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_SCTP; + else + proto_hdr |= RTE_PTYPE_L4_SCTP; + break; + case VIRTCHNL2_PROTO_HDR_ICMP: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_ICMP; + else + proto_hdr |= RTE_PTYPE_L4_ICMP; + break; + case VIRTCHNL2_PROTO_HDR_ICMPV6: + if (is_inner) + proto_hdr |= RTE_PTYPE_INNER_L4_ICMP; + else + proto_hdr |= RTE_PTYPE_L4_ICMP; + break; + case VIRTCHNL2_PROTO_HDR_L2TPV2: + case VIRTCHNL2_PROTO_HDR_L2TPV2_CONTROL: + case VIRTCHNL2_PROTO_HDR_L2TPV3: + is_inner = true; + proto_hdr |= RTE_PTYPE_TUNNEL_L2TP; + break; + case VIRTCHNL2_PROTO_HDR_NVGRE: + is_inner = true; + proto_hdr |= RTE_PTYPE_TUNNEL_NVGRE; + break; + case VIRTCHNL2_PROTO_HDR_GTPC_TEID: + is_inner = true; + proto_hdr |= RTE_PTYPE_TUNNEL_GTPC; + break; + case VIRTCHNL2_PROTO_HDR_GTPU: + case VIRTCHNL2_PROTO_HDR_GTPU_UL: + case VIRTCHNL2_PROTO_HDR_GTPU_DL: + is_inner = true; + proto_hdr |= RTE_PTYPE_TUNNEL_GTPU; + break; + case VIRTCHNL2_PROTO_HDR_PAY: + case VIRTCHNL2_PROTO_HDR_IPV6_EH: + case VIRTCHNL2_PROTO_HDR_PRE_MAC: + case VIRTCHNL2_PROTO_HDR_POST_MAC: + case VIRTCHNL2_PROTO_HDR_ETHERTYPE: + case VIRTCHNL2_PROTO_HDR_SVLAN: + case VIRTCHNL2_PROTO_HDR_CVLAN: + case VIRTCHNL2_PROTO_HDR_MPLS: + case VIRTCHNL2_PROTO_HDR_MMPLS: + case VIRTCHNL2_PROTO_HDR_CTRL: + case VIRTCHNL2_PROTO_HDR_ECP: + case VIRTCHNL2_PROTO_HDR_EAPOL: + case VIRTCHNL2_PROTO_HDR_PPPOD: + case VIRTCHNL2_PROTO_HDR_IGMP: + case VIRTCHNL2_PROTO_HDR_AH: + case VIRTCHNL2_PROTO_HDR_ESP: + case VIRTCHNL2_PROTO_HDR_IKE: + case VIRTCHNL2_PROTO_HDR_NATT_KEEP: + case VIRTCHNL2_PROTO_HDR_GTP: + case VIRTCHNL2_PROTO_HDR_GTP_EH: + case VIRTCHNL2_PROTO_HDR_GTPCV2: + case VIRTCHNL2_PROTO_HDR_ECPRI: + case VIRTCHNL2_PROTO_HDR_VRRP: + case VIRTCHNL2_PROTO_HDR_OSPF: + case VIRTCHNL2_PROTO_HDR_TUN: + case VIRTCHNL2_PROTO_HDR_VXLAN_GPE: + case VIRTCHNL2_PROTO_HDR_GENEVE: + case VIRTCHNL2_PROTO_HDR_NSH: + case VIRTCHNL2_PROTO_HDR_QUIC: + case VIRTCHNL2_PROTO_HDR_PFCP: + case VIRTCHNL2_PROTO_HDR_PFCP_NODE: + case VIRTCHNL2_PROTO_HDR_PFCP_SESSION: + case VIRTCHNL2_PROTO_HDR_RTP: + case VIRTCHNL2_PROTO_HDR_NO_PROTO: + default: + continue; + } + adapter->ptype_tbl[ptype->ptype_id_10] = proto_hdr; + } + } + } + +free_ptype_info: + rte_free(ptype_info); + clear_cmd(adapter); + return ret; +} + int idpf_adapter_init(struct idpf_adapter *adapter) { @@ -135,6 +345,12 @@ idpf_adapter_init(struct idpf_adapter *adapter) goto err_check_api; } + ret = idpf_get_pkt_type(adapter); + if (ret != 0) { + DRV_LOG(ERR, "Failed to set ptype table"); + goto err_check_api; + } + return 0; err_check_api: diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h index d45c2b8777..997f01f3aa 100644 --- a/drivers/common/idpf/idpf_common_device.h +++ b/drivers/common/idpf/idpf_common_device.h @@ -5,6 +5,7 @@ #ifndef _IDPF_COMMON_DEVICE_H_ #define _IDPF_COMMON_DEVICE_H_ +#include #include #include #include @@ -19,6 +20,10 @@ #define IDPF_DFLT_INTERVAL 16 +#define IDPF_GET_PTYPE_SIZE(p) \ + (sizeof(struct virtchnl2_ptype) + \ + (((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0]))) + struct idpf_adapter { struct idpf_hw hw; struct virtchnl2_version_info virtchnl_version; @@ -26,6 +31,8 @@ struct idpf_adapter { volatile uint32_t pend_cmd; /* pending command not finished */ uint32_t cmd_retval; /* return value of the cmd response from cp */ uint8_t *mbx_resp; /* buffer to store the mailbox response from cp */ + + uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned; }; struct idpf_chunks_info { diff --git a/drivers/common/idpf/idpf_common_virtchnl.h b/drivers/common/idpf/idpf_common_virtchnl.h index 3c9f51e4cf..11dbc089cb 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.h +++ b/drivers/common/idpf/idpf_common_virtchnl.h @@ -26,6 +26,11 @@ __rte_internal int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, uint16_t nb_rxq, bool map); __rte_internal +int idpf_vc_query_ptype_info(struct idpf_adapter *adapter); +__rte_internal +int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops, + uint16_t buf_len, uint8_t *buf); +__rte_internal int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid, bool rx, bool on); __rte_internal @@ -37,11 +42,6 @@ int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors); __rte_internal int idpf_vc_dealloc_vectors(struct idpf_vport *vport); __rte_internal -int idpf_vc_query_ptype_info(struct idpf_adapter *adapter); -__rte_internal -int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops, - uint16_t buf_len, uint8_t *buf); -__rte_internal int idpf_execute_vc_cmd(struct idpf_adapter *adapter, struct idpf_cmd_info *args); diff --git a/drivers/common/idpf/meson.build b/drivers/common/idpf/meson.build index d1578641ba..c6cc7a196b 100644 --- a/drivers/common/idpf/meson.build +++ b/drivers/common/idpf/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Intel Corporation +deps += ['mbuf'] + sources = files( 'idpf_common_device.c', 'idpf_common_virtchnl.c', diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index d0799087a5..84046f955a 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -602,12 +602,6 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a goto err_adapter_init; } - ret = idpf_get_pkt_type(adapter); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Failed to set ptype table"); - goto err_get_ptype; - } - adapter->max_vport_nb = adapter->base.caps.max_vports; adapter->vports = rte_zmalloc("vports", diff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h index 55be98a8ed..d30807ca41 100644 --- a/drivers/net/idpf/idpf_ethdev.h +++ b/drivers/net/idpf/idpf_ethdev.h @@ -89,8 +89,6 @@ struct idpf_adapter_ext { uint16_t used_vecs_num; - uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned; - bool rx_vec_allowed; bool tx_vec_allowed; bool rx_use_avx512; @@ -107,6 +105,4 @@ TAILQ_HEAD(idpf_adapter_list, idpf_adapter_ext); #define IDPF_ADAPTER_TO_EXT(p) \ container_of((p), struct idpf_adapter_ext, base) -int idpf_get_pkt_type(struct idpf_adapter_ext *adapter); - #endif /* _IDPF_ETHDEV_H_ */ diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c index 918d156e03..0c9c7fee29 100644 --- a/drivers/net/idpf/idpf_rxtx.c +++ b/drivers/net/idpf/idpf_rxtx.c @@ -1407,7 +1407,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rx_id_bufq1 = rxq->bufq1->rx_next_avail; rx_id_bufq2 = rxq->bufq2->rx_next_avail; rx_desc_ring = rxq->rx_ring; - ptype_tbl = ad->ptype_tbl; + ptype_tbl = rxq->adapter->ptype_tbl; if ((rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) != 0) rxq->hw_register_set = 1; @@ -1812,7 +1812,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; - ptype_tbl = ad->ptype_tbl; + ptype_tbl = rxq->adapter->ptype_tbl; if ((rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) != 0) rxq->hw_register_set = 1; diff --git a/drivers/net/idpf/idpf_rxtx.h b/drivers/net/idpf/idpf_rxtx.h index 9417651b3f..cac6040943 100644 --- a/drivers/net/idpf/idpf_rxtx.h +++ b/drivers/net/idpf/idpf_rxtx.h @@ -82,10 +82,6 @@ #define IDPF_TX_OFFLOAD_NOTSUP_MASK \ (RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK) -#define IDPF_GET_PTYPE_SIZE(p) \ - (sizeof(struct virtchnl2_ptype) + \ - (((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0]))) - extern uint64_t idpf_timestamp_dynflag; struct idpf_rx_queue { diff --git a/drivers/net/idpf/idpf_rxtx_vec_avx512.c b/drivers/net/idpf/idpf_rxtx_vec_avx512.c index efa7cd2187..fb2b6bb53c 100644 --- a/drivers/net/idpf/idpf_rxtx_vec_avx512.c +++ b/drivers/net/idpf/idpf_rxtx_vec_avx512.c @@ -245,8 +245,7 @@ _idpf_singleq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct idpf_adapter_ext *adapter = IDPF_ADAPTER_TO_EXT(rxq->adapter); - const uint32_t *type_table = adapter->ptype_tbl; + const uint32_t *type_table = rxq->adapter->ptype_tbl; const __m256i mbuf_init = _mm256_set_epi64x(0, 0, 0, rxq->mbuf_initializer); diff --git a/drivers/net/idpf/idpf_vchnl.c b/drivers/net/idpf/idpf_vchnl.c index 576b797973..45d05ed108 100644 --- a/drivers/net/idpf/idpf_vchnl.c +++ b/drivers/net/idpf/idpf_vchnl.c @@ -23,219 +23,6 @@ #include "idpf_ethdev.h" #include "idpf_rxtx.h" -int __rte_cold -idpf_get_pkt_type(struct idpf_adapter_ext *adapter) -{ - struct virtchnl2_get_ptype_info *ptype_info; - struct idpf_adapter *base; - uint16_t ptype_offset, i, j; - uint16_t ptype_recvd = 0; - int ret; - - base = &adapter->base; - - ret = idpf_vc_query_ptype_info(base); - if (ret != 0) { - PMD_DRV_LOG(ERR, "Fail to query packet type information"); - return ret; - } - - ptype_info = rte_zmalloc("ptype_info", IDPF_DFLT_MBX_BUF_SIZE, 0); - if (ptype_info == NULL) - return -ENOMEM; - - while (ptype_recvd < IDPF_MAX_PKT_TYPE) { - ret = idpf_read_one_msg(base, VIRTCHNL2_OP_GET_PTYPE_INFO, - IDPF_DFLT_MBX_BUF_SIZE, (uint8_t *)ptype_info); - if (ret != 0) { - PMD_DRV_LOG(ERR, "Fail to get packet type information"); - goto free_ptype_info; - } - - ptype_recvd += ptype_info->num_ptypes; - ptype_offset = sizeof(struct virtchnl2_get_ptype_info) - - sizeof(struct virtchnl2_ptype); - - for (i = 0; i < rte_cpu_to_le_16(ptype_info->num_ptypes); i++) { - bool is_inner = false, is_ip = false; - struct virtchnl2_ptype *ptype; - uint32_t proto_hdr = 0; - - ptype = (struct virtchnl2_ptype *) - ((uint8_t *)ptype_info + ptype_offset); - ptype_offset += IDPF_GET_PTYPE_SIZE(ptype); - if (ptype_offset > IDPF_DFLT_MBX_BUF_SIZE) { - ret = -EINVAL; - goto free_ptype_info; - } - - if (rte_cpu_to_le_16(ptype->ptype_id_10) == 0xFFFF) - goto free_ptype_info; - - for (j = 0; j < ptype->proto_id_count; j++) { - switch (rte_cpu_to_le_16(ptype->proto_id[j])) { - case VIRTCHNL2_PROTO_HDR_GRE: - case VIRTCHNL2_PROTO_HDR_VXLAN: - proto_hdr &= ~RTE_PTYPE_L4_MASK; - proto_hdr |= RTE_PTYPE_TUNNEL_GRENAT; - is_inner = true; - break; - case VIRTCHNL2_PROTO_HDR_MAC: - if (is_inner) { - proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK; - proto_hdr |= RTE_PTYPE_INNER_L2_ETHER; - } else { - proto_hdr &= ~RTE_PTYPE_L2_MASK; - proto_hdr |= RTE_PTYPE_L2_ETHER; - } - break; - case VIRTCHNL2_PROTO_HDR_VLAN: - if (is_inner) { - proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK; - proto_hdr |= RTE_PTYPE_INNER_L2_ETHER_VLAN; - } - break; - case VIRTCHNL2_PROTO_HDR_PTP: - proto_hdr &= ~RTE_PTYPE_L2_MASK; - proto_hdr |= RTE_PTYPE_L2_ETHER_TIMESYNC; - break; - case VIRTCHNL2_PROTO_HDR_LLDP: - proto_hdr &= ~RTE_PTYPE_L2_MASK; - proto_hdr |= RTE_PTYPE_L2_ETHER_LLDP; - break; - case VIRTCHNL2_PROTO_HDR_ARP: - proto_hdr &= ~RTE_PTYPE_L2_MASK; - proto_hdr |= RTE_PTYPE_L2_ETHER_ARP; - break; - case VIRTCHNL2_PROTO_HDR_PPPOE: - proto_hdr &= ~RTE_PTYPE_L2_MASK; - proto_hdr |= RTE_PTYPE_L2_ETHER_PPPOE; - break; - case VIRTCHNL2_PROTO_HDR_IPV4: - if (!is_ip) { - proto_hdr |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - is_ip = true; - } else { - proto_hdr |= RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | - RTE_PTYPE_TUNNEL_IP; - is_inner = true; - } - break; - case VIRTCHNL2_PROTO_HDR_IPV6: - if (!is_ip) { - proto_hdr |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; - is_ip = true; - } else { - proto_hdr |= RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | - RTE_PTYPE_TUNNEL_IP; - is_inner = true; - } - break; - case VIRTCHNL2_PROTO_HDR_IPV4_FRAG: - case VIRTCHNL2_PROTO_HDR_IPV6_FRAG: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_FRAG; - else - proto_hdr |= RTE_PTYPE_L4_FRAG; - break; - case VIRTCHNL2_PROTO_HDR_UDP: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_UDP; - else - proto_hdr |= RTE_PTYPE_L4_UDP; - break; - case VIRTCHNL2_PROTO_HDR_TCP: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_TCP; - else - proto_hdr |= RTE_PTYPE_L4_TCP; - break; - case VIRTCHNL2_PROTO_HDR_SCTP: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_SCTP; - else - proto_hdr |= RTE_PTYPE_L4_SCTP; - break; - case VIRTCHNL2_PROTO_HDR_ICMP: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_ICMP; - else - proto_hdr |= RTE_PTYPE_L4_ICMP; - break; - case VIRTCHNL2_PROTO_HDR_ICMPV6: - if (is_inner) - proto_hdr |= RTE_PTYPE_INNER_L4_ICMP; - else - proto_hdr |= RTE_PTYPE_L4_ICMP; - break; - case VIRTCHNL2_PROTO_HDR_L2TPV2: - case VIRTCHNL2_PROTO_HDR_L2TPV2_CONTROL: - case VIRTCHNL2_PROTO_HDR_L2TPV3: - is_inner = true; - proto_hdr |= RTE_PTYPE_TUNNEL_L2TP; - break; - case VIRTCHNL2_PROTO_HDR_NVGRE: - is_inner = true; - proto_hdr |= RTE_PTYPE_TUNNEL_NVGRE; - break; - case VIRTCHNL2_PROTO_HDR_GTPC_TEID: - is_inner = true; - proto_hdr |= RTE_PTYPE_TUNNEL_GTPC; - break; - case VIRTCHNL2_PROTO_HDR_GTPU: - case VIRTCHNL2_PROTO_HDR_GTPU_UL: - case VIRTCHNL2_PROTO_HDR_GTPU_DL: - is_inner = true; - proto_hdr |= RTE_PTYPE_TUNNEL_GTPU; - break; - case VIRTCHNL2_PROTO_HDR_PAY: - case VIRTCHNL2_PROTO_HDR_IPV6_EH: - case VIRTCHNL2_PROTO_HDR_PRE_MAC: - case VIRTCHNL2_PROTO_HDR_POST_MAC: - case VIRTCHNL2_PROTO_HDR_ETHERTYPE: - case VIRTCHNL2_PROTO_HDR_SVLAN: - case VIRTCHNL2_PROTO_HDR_CVLAN: - case VIRTCHNL2_PROTO_HDR_MPLS: - case VIRTCHNL2_PROTO_HDR_MMPLS: - case VIRTCHNL2_PROTO_HDR_CTRL: - case VIRTCHNL2_PROTO_HDR_ECP: - case VIRTCHNL2_PROTO_HDR_EAPOL: - case VIRTCHNL2_PROTO_HDR_PPPOD: - case VIRTCHNL2_PROTO_HDR_IGMP: - case VIRTCHNL2_PROTO_HDR_AH: - case VIRTCHNL2_PROTO_HDR_ESP: - case VIRTCHNL2_PROTO_HDR_IKE: - case VIRTCHNL2_PROTO_HDR_NATT_KEEP: - case VIRTCHNL2_PROTO_HDR_GTP: - case VIRTCHNL2_PROTO_HDR_GTP_EH: - case VIRTCHNL2_PROTO_HDR_GTPCV2: - case VIRTCHNL2_PROTO_HDR_ECPRI: - case VIRTCHNL2_PROTO_HDR_VRRP: - case VIRTCHNL2_PROTO_HDR_OSPF: - case VIRTCHNL2_PROTO_HDR_TUN: - case VIRTCHNL2_PROTO_HDR_VXLAN_GPE: - case VIRTCHNL2_PROTO_HDR_GENEVE: - case VIRTCHNL2_PROTO_HDR_NSH: - case VIRTCHNL2_PROTO_HDR_QUIC: - case VIRTCHNL2_PROTO_HDR_PFCP: - case VIRTCHNL2_PROTO_HDR_PFCP_NODE: - case VIRTCHNL2_PROTO_HDR_PFCP_SESSION: - case VIRTCHNL2_PROTO_HDR_RTP: - case VIRTCHNL2_PROTO_HDR_NO_PROTO: - default: - continue; - } - adapter->ptype_tbl[ptype->ptype_id_10] = proto_hdr; - } - } - } - -free_ptype_info: - rte_free(ptype_info); - clear_cmd(base); - return ret; -} - #define IDPF_RX_BUF_STRIDE 64 int idpf_vc_config_rxq(struct idpf_vport *vport, struct idpf_rx_queue *rxq) -- 2.26.2