From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DAAD28DB1 for ; Thu, 31 Dec 2015 14:53:40 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 31 Dec 2015 05:53:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,503,1444719600"; d="scan'208";a="21744963" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by fmsmga004.fm.intel.com with ESMTP; 31 Dec 2015 05:53:38 -0800 From: Jianfeng Tan To: dev@dpdk.org Date: Thu, 31 Dec 2015 14:53:13 +0800 Message-Id: <1451544799-70776-7-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1451544799-70776-1-git-send-email-jianfeng.tan@intel.com> References: <1451544799-70776-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [PATCH 06/12] pmd/i40e: add dev_ptype_info_get implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 13:53:41 -0000 Signed-off-by: Jianfeng Tan --- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 69 ++++++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..1f5251b 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -439,6 +439,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .xstats_reset = i40e_dev_stats_reset, .queue_stats_mapping_set = i40e_dev_queue_stats_mapping_set, .dev_infos_get = i40e_dev_info_get, + .dev_ptype_info_get = i40e_dev_ptype_info_get, .vlan_filter_set = i40e_vlan_filter_set, .vlan_tpid_set = i40e_vlan_tpid_set, .vlan_offload_set = i40e_vlan_offload_set, diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 14d2a50..5d924de 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -196,6 +196,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .xstats_reset = i40evf_dev_xstats_reset, .dev_close = i40evf_dev_close, .dev_infos_get = i40evf_dev_info_get, + .dev_ptype_info_get = i40e_dev_ptype_info_get, .vlan_filter_set = i40evf_vlan_filter_set, .vlan_offload_set = i40evf_vlan_offload_set, .vlan_pvid_set = i40evf_vlan_pvid_set, diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 39d94ec..bf4f504 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -194,7 +194,11 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t qword) } #endif -/* For each value it means, datasheet of hardware can tell more details */ +/* + * For each value it means, datasheet of hardware can tell more details + * + * @note: fix i40e_dev_ptype_info_get() if any change here. + */ static inline uint32_t i40e_rxd_pkt_type_mapping(uint8_t ptype) { @@ -2094,6 +2098,69 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) } int +i40e_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == i40e_recv_pkts) + || (dev->rx_pkt_burst == i40e_recv_scattered_pkts) +#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC + || (dev->rx_pkt_burst == i40e_recv_pkts_bulk_alloc) +#endif + ) { + /* refers to i40e_rxd_pkt_type_mapping() */ + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) { + ptypes[num++] = RTE_PTYPE_L2_ETHER; + ptypes[num++] = RTE_PTYPE_L2_ETHER_TIMESYNC; + ptypes[num++] = RTE_PTYPE_L2_ETHER_LLDP; + ptypes[num++] = RTE_PTYPE_L2_ETHER_ARP; + } + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_FRAG; + ptypes[num++] = RTE_PTYPE_L4_ICMP; + ptypes[num++] = RTE_PTYPE_L4_NONFRAG; + ptypes[num++] = RTE_PTYPE_L4_SCTP; + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) { + ptypes[num++] = RTE_PTYPE_TUNNEL_GRENAT; + ptypes[num++] = RTE_PTYPE_TUNNEL_IP; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L2_MASK) == RTE_PTYPE_INNER_L2_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L2_ETHER; + ptypes[num++] = RTE_PTYPE_INNER_L2_ETHER_VLAN; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L4_FRAG; + ptypes[num++] = RTE_PTYPE_INNER_L4_ICMP; + ptypes[num++] = RTE_PTYPE_INNER_L4_NONFRAG; + ptypes[num++] = RTE_PTYPE_INNER_L4_SCTP; + ptypes[num++] = RTE_PTYPE_INNER_L4_TCP; + ptypes[num++] = RTE_PTYPE_INNER_L4_UDP; + } + } else + num = -ENOTSUP; + + return num; +} + +int i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index 5c2f5c2..5350b61 100644 --- a/drivers/net/i40e/i40e_rxtx.h +++ b/drivers/net/i40e/i40e_rxtx.h @@ -200,6 +200,8 @@ int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); int i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); int i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); int i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); +int i40e_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]); int i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, -- 2.1.4