To achieve this, a new function pointer, dev_ptype_info_get, is added into struct eth_dev_ops. For those devices who do not implement it, it means it will not provide any ptype info.
v4: - Change how to use this API: to previously agreement reached in mail. v3: - Change how to use this API: api to allocate mem for storing ptype array; and caller to free the mem. - Change how to return back ptypes from PMDs: return a pointer to corresponding static const array of supported ptypes, terminated by RTE_PTYPE_UNKNOWN. - Fix l3fwd parse_packet_type() when EXACT_MATCH is enabled. - Fix l3fwd memory leak when calling the API. v2: - Move ptype_mask filter function from each PMDs into ether layer. - Add ixgbe vPMD's ptype info. - Fix code style issues. Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com> Jianfeng Tan (12): ethdev: add API to query packet type filling info pmd/cxgbe: add dev_ptype_info_get implementation pmd/e1000: add dev_ptype_info_get implementation pmd/enic: add dev_ptype_info_get implementation pmd/fm10k: add dev_ptype_info_get implementation pmd/i40e: add dev_ptype_info_get implementation pmd/ixgbe: add dev_ptype_info_get implementation pmd/mlx4: add dev_ptype_info_get implementation pmd/mlx5: add dev_ptype_info_get implementation pmd/nfp: add dev_ptype_info_get implementation pmd/vmxnet3: add dev_ptype_info_get implementation examples/l3fwd: add option to parse ptype doc/guides/sample_app_ug/l3_forward.rst | 6 +- drivers/net/cxgbe/cxgbe_ethdev.c | 14 ++++ drivers/net/e1000/igb_ethdev.c | 30 ++++++++ drivers/net/enic/enic_ethdev.c | 17 +++++ drivers/net/fm10k/fm10k_ethdev.c | 50 +++++++++++++ drivers/net/fm10k/fm10k_rxtx.c | 3 + drivers/net/fm10k/fm10k_rxtx_vec.c | 3 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 46 +++++++++++- drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 38 ++++++++++ drivers/net/ixgbe/ixgbe_ethdev.h | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 4 +- drivers/net/mlx4/mlx4.c | 21 ++++++ drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 20 +++++ drivers/net/mlx5/mlx5_rxtx.c | 2 + drivers/net/nfp/nfp_net.c | 19 +++++ drivers/net/vmxnet3/vmxnet3_ethdev.c | 16 ++++ examples/l3fwd/main.c | 128 ++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.c | 26 +++++++ lib/librte_ether/rte_ethdev.h | 26 +++++++ 24 files changed, 473 insertions(+), 3 deletions(-) -- 2.1.4