From: Pascal Mazon Date: Wed, 15 Mar 2017 14:48:18 +0000 (+0100) Subject: net/tap: add packet type management X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0849ac3b61226b8e7040115a26c63cec5ca106f3;p=dpdk.git net/tap: add packet type management Advertise packet types supported by the librte_net. Signed-off-by: Pascal Mazon Reviewed-by: Ferruh Yigit --- diff --git a/doc/guides/nics/features/tap.ini b/doc/guides/nics/features/tap.ini index 6aa11874e2..7f3f4d661d 100644 --- a/doc/guides/nics/features/tap.ini +++ b/doc/guides/nics/features/tap.ini @@ -13,6 +13,7 @@ MTU update = Y Multicast MAC filter = Y Speed capabilities = Y Unicast MAC filter = Y +Packet type parsing = Y Other kdrv = Y ARMv7 = Y ARMv8 = Y diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile index bedd1b738e..ddf87232d3 100644 --- a/drivers/net/tap/Makefile +++ b/drivers/net/tap/Makefile @@ -47,4 +47,12 @@ CFLAGS += $(WERROR_FLAGS) # SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_net + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 0a684813ed..7b70d62d55 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -285,6 +286,8 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) mbuf->data_len = len; mbuf->pkt_len = len; mbuf->port = rxq->in_port; + mbuf->packet_type = rte_net_get_ptype(mbuf, NULL, + RTE_PTYPE_ALL_MASK); /* account for the receive frame */ bufs[num_rx++] = mbuf; @@ -762,6 +765,37 @@ tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused, return 0; } +static const uint32_t* +tap_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ + static const uint32_t ptypes[] = { + RTE_PTYPE_INNER_L2_ETHER, + RTE_PTYPE_INNER_L2_ETHER_VLAN, + RTE_PTYPE_INNER_L2_ETHER_QINQ, + RTE_PTYPE_INNER_L3_IPV4, + RTE_PTYPE_INNER_L3_IPV4_EXT, + RTE_PTYPE_INNER_L3_IPV6, + RTE_PTYPE_INNER_L3_IPV6_EXT, + RTE_PTYPE_INNER_L4_FRAG, + RTE_PTYPE_INNER_L4_UDP, + RTE_PTYPE_INNER_L4_TCP, + RTE_PTYPE_INNER_L4_SCTP, + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L2_ETHER_VLAN, + RTE_PTYPE_L2_ETHER_QINQ, + RTE_PTYPE_L3_IPV4, + RTE_PTYPE_L3_IPV4_EXT, + RTE_PTYPE_L3_IPV6_EXT, + RTE_PTYPE_L3_IPV6, + RTE_PTYPE_L4_FRAG, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_SCTP, + }; + + return ptypes; +} + static const struct eth_dev_ops ops = { .dev_start = tap_dev_start, .dev_stop = tap_dev_stop, @@ -784,6 +818,7 @@ static const struct eth_dev_ops ops = { .set_mc_addr_list = tap_set_mc_addr_list, .stats_get = tap_stats_get, .stats_reset = tap_stats_reset, + .dev_supported_ptypes_get = tap_dev_supported_ptypes_get, }; static int