From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 43FB98E58 for ; Thu, 31 Dec 2015 14:53:41 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 31 Dec 2015 05:53:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,503,1444719600"; d="scan'208";a="21744908" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by fmsmga004.fm.intel.com with ESMTP; 31 Dec 2015 05:53:35 -0800 From: Jianfeng Tan To: dev@dpdk.org Date: Thu, 31 Dec 2015 14:53:10 +0800 Message-Id: <1451544799-70776-4-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 03/12] pmd/e1000: 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/e1000/igb_ethdev.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d1bbcda..0a9abd6 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -103,6 +103,8 @@ static void eth_igb_stats_reset(struct rte_eth_dev *dev); static void eth_igb_xstats_reset(struct rte_eth_dev *dev); static void eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int eth_igb_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]); static void eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_igb_flow_ctrl_get(struct rte_eth_dev *dev, @@ -319,6 +321,7 @@ static const struct eth_dev_ops eth_igb_ops = { .stats_reset = eth_igb_stats_reset, .xstats_reset = eth_igb_xstats_reset, .dev_infos_get = eth_igb_infos_get, + .dev_ptype_info_get = eth_igb_ptype_info_get, .mtu_set = eth_igb_mtu_set, .vlan_filter_set = eth_igb_vlan_filter_set, .vlan_tpid_set = eth_igb_vlan_tpid_set, @@ -376,6 +379,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .xstats_reset = eth_igbvf_stats_reset, .vlan_filter_set = igbvf_vlan_filter_set, .dev_infos_get = eth_igbvf_infos_get, + .dev_ptype_info_get = eth_igb_ptype_info_get, .rx_queue_setup = eth_igb_rx_queue_setup, .rx_queue_release = eth_igb_rx_queue_release, .tx_queue_setup = eth_igb_tx_queue_setup, @@ -1910,6 +1914,50 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_desc_lim = tx_desc_lim; } +static int +eth_igb_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == eth_igb_recv_pkts || + dev->rx_pkt_burst == eth_igb_recv_scattered_pkts) { + /* refers to igb_rxd_pkt_info_to_pkt_type() */ + + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) + ptypes[num++] = RTE_PTYPE_L2_ETHER; + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + ptypes[num++] = RTE_PTYPE_L4_SCTP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) + ptypes[num++] = RTE_PTYPE_TUNNEL_IP; + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L4_TCP; + ptypes[num++] = RTE_PTYPE_INNER_L4_UDP; + } + } else + num = -ENOTSUP; + + return num; +} + static void eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { -- 2.1.4