Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
---
 drivers/net/mlx4/mlx4.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ee00151..58f4e1a 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -2835,6 +2835,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.
  */
@@ -4267,6 +4269,24 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *info)
        priv_unlock(priv);
 }

+static const uint32_t *
+mlx4_dev_ptype_info_get(struct rte_eth_dev *dev)
+{
+       static const uint32_t ptypes[] = {
+               /* refers to rxq_cq_to_pkt_type() */
+               RTE_PTYPE_L3_IPV4,
+               RTE_PTYPE_L3_IPV6,
+               RTE_PTYPE_INNER_L3_IPV4,
+               RTE_PTYPE_INNER_L3_IPV6,
+               RTE_PTYPE_UNKNOWN
+       };
+
+       if (dev->rx_pkt_burst == mlx4_rx_burst ||
+           dev->rx_pkt_burst == mlx4_rx_burst_sp)
+               return ptypes;
+       return NULL;
+}
+
 /**
  * DPDK callback to get device statistics.
  *
@@ -4988,6 +5008,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

Reply via email to