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 615688E58 for ; Thu, 31 Dec 2015 14:53:42 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 31 Dec 2015 05:53:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,503,1444719600"; d="scan'208";a="21744984" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by fmsmga004.fm.intel.com with ESMTP; 31 Dec 2015 05:53:40 -0800 From: Jianfeng Tan To: dev@dpdk.org Date: Thu, 31 Dec 2015 14:53:15 +0800 Message-Id: <1451544799-70776-9-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 08/12] pmd/mlx4: 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:43 -0000 Signed-off-by: Jianfeng Tan --- drivers/net/mlx4/mlx4.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 207bfe2..85afa32 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2836,6 +2836,8 @@ rxq_cleanup(struct rxq *rxq) * @param flags * RX completion flags returned by poll_length_flags(). * + * @note: fix mlx4_dev_ptype_info_get() if any change here. + * * @return * Packet type for struct rte_mbuf. */ @@ -4268,6 +4270,30 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) priv_unlock(priv); } +static int +mlx4_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == mlx4_rx_burst) + || (dev->rx_pkt_burst == mlx4_rx_burst_sp)) { + /* refers to rxq_cq_to_pkt_type() */ + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + } + } else + num = -ENOTSUP; + + return num; +} + /** * DPDK callback to get device statistics. * @@ -4989,6 +5015,7 @@ static const struct eth_dev_ops mlx4_dev_ops = { .stats_reset = mlx4_stats_reset, .queue_stats_mapping_set = NULL, .dev_infos_get = mlx4_dev_infos_get, + .dev_ptypes_info_get = mlx4_dev_ptype_info_get, .vlan_filter_set = mlx4_vlan_filter_set, .vlan_tpid_set = NULL, .vlan_strip_queue_set = NULL, -- 2.1.4