Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
---
 drivers/net/fm10k/fm10k_ethdev.c   | 50 ++++++++++++++++++++++++++++++++++++++
 drivers/net/fm10k/fm10k_rxtx.c     |  3 +++
 drivers/net/fm10k/fm10k_rxtx_vec.c |  3 +++
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 421266b..429cbdd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1335,6 +1335,55 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
        };
 }

+#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE
+static const uint32_t *
+fm10k_dev_ptype_info_get(struct rte_eth_dev *dev)
+{
+       if (dev->rx_pkt_burst == fm10k_recv_pkts ||
+           dev->rx_pkt_burst == fm10k_recv_scattered_pkts) {
+               static uint32_t ptypes[] = {
+                       /* refers to rx_desc_to_ol_flags() */
+                       RTE_PTYPE_L2_ETHER,
+                       RTE_PTYPE_L3_IPV4,
+                       RTE_PTYPE_L3_IPV4_EXT,
+                       RTE_PTYPE_L3_IPV6,
+                       RTE_PTYPE_L3_IPV6_EXT,
+                       RTE_PTYPE_L4_TCP,
+                       RTE_PTYPE_L4_UDP,
+                       RTE_PTYPE_UNKNOWN
+               };
+
+               return ptypes;
+       } else if (dev->rx_pkt_burst == fm10k_recv_pkts_vec ||
+                  dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec) {
+               static uint32_t ptypes_vec[] = {
+                       /* refers to fm10k_desc_to_pktype_v() */
+                       RTE_PTYPE_L3_IPV4,
+                       RTE_PTYPE_L3_IPV4_EXT,
+                       RTE_PTYPE_L3_IPV6,
+                       RTE_PTYPE_L3_IPV6_EXT,
+                       RTE_PTYPE_L4_TCP,
+                       RTE_PTYPE_L4_UDP,
+                       RTE_PTYPE_TUNNEL_GENEVE,
+                       RTE_PTYPE_TUNNEL_NVGRE,
+                       RTE_PTYPE_TUNNEL_VXLAN,
+                       RTE_PTYPE_TUNNEL_GRE,
+                       RTE_PTYPE_UNKNOWN
+               };
+
+               return ptypes_vec;
+       }
+
+       return NULL;
+}
+#else
+static const uint32_t *
+fm10k_dev_ptype_info_get(struct rte_eth_dev *dev __rte_unused)
+{
+       return NULL;
+}
+#endif
+
 static int
 fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
@@ -2423,6 +2472,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
        .xstats_reset           = fm10k_stats_reset,
        .link_update            = fm10k_link_update,
        .dev_infos_get          = fm10k_dev_infos_get,
+       .dev_ptype_info_get     = fm10k_dev_ptype_info_get,
        .vlan_filter_set        = fm10k_vlan_filter_set,
        .vlan_offload_set       = fm10k_vlan_offload_set,
        .mac_addr_add           = fm10k_macaddr_add,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index e958865..cbe0111 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -65,6 +65,9 @@ static inline void dump_rxd(union fm10k_rx_desc *rxd)
 }
 #endif

+/* @note: When this function is changed, make corresponding change to
+ * fm10k_dev_ptype_info_get()
+ */
 static inline void
 rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
 {
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c 
b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 2a57eef..f347641 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -109,6 +109,9 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf 
**rx_pkts)
        rx_pkts[3]->ol_flags = vol.e[3];
 }

+/* @note: When this function is changed, make corresponding change to
+ * fm10k_dev_ptype_info_get().
+ */
 static inline void
 fm10k_desc_to_pktype_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
-- 
2.1.4

Reply via email to