Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com> --- drivers/net/fm10k/fm10k_ethdev.c | 43 ++++++++++++++++++++++++++++++++++++++ drivers/net/fm10k/fm10k_rxtx.c | 5 +++++ drivers/net/fm10k/fm10k_rxtx_vec.c | 5 +++++ 3 files changed, 53 insertions(+)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index e4aed94..e155cb5 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1335,6 +1335,48 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, }; } +#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE +static int +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == fm10k_recv_pkts || + dev->rx_pkt_burst == fm10k_recv_scattered_pkts) { + /* refers to rx_desc_to_ol_flags() */ + ptypes[num++] = RTE_PTYPE_L2_ETHER; + 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; + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } else if (dev->rx_pkt_burst == fm10k_recv_pkts_vec || + dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec) { + /* refers to fm10k_desc_to_pktype_v() */ + 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; + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + ptypes[num++] = RTE_PTYPE_TUNNEL_GENEVE; + ptypes[num++] = RTE_PTYPE_TUNNEL_NVGRE; + ptypes[num++] = RTE_PTYPE_TUNNEL_VXLAN; + ptypes[num++] = RTE_PTYPE_TUNNEL_GRE; + } + + return num; +} +#else +static int +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev __rte_unused, + uint32_t ptypes[] __rte_unused) +{ + return -ENOTSUP; +} +#endif + static int fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { @@ -2423,6 +2465,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..9b2d6f2 100644 --- a/drivers/net/fm10k/fm10k_rxtx.c +++ b/drivers/net/fm10k/fm10k_rxtx.c @@ -65,6 +65,11 @@ 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..6fc22fc 100644 --- a/drivers/net/fm10k/fm10k_rxtx_vec.c +++ b/drivers/net/fm10k/fm10k_rxtx_vec.c @@ -109,6 +109,11 @@ 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