DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Jiawen Wu <jiawenwu@trustnetic.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 18/24] net/ngbe: add packet type
Date: Mon, 14 Jun 2021 22:06:01 +0300	[thread overview]
Message-ID: <22473a4d-9eef-d695-d8e5-ae2aab1ed122@oktetlabs.ru> (raw)
In-Reply-To: <20210602094108.1575640-19-jiawenwu@trustnetic.com>

On 6/2/21 12:41 PM, Jiawen Wu wrote:
> Add packet type marco definition and convert ptype to ptid.

What about eth_dev_ptypes_set_t callback?

> 
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>   doc/guides/nics/features/ngbe.ini |   1 +
>   doc/guides/nics/ngbe.rst          |   1 +
>   drivers/net/ngbe/meson.build      |   1 +
>   drivers/net/ngbe/ngbe_ethdev.c    |   8 +
>   drivers/net/ngbe/ngbe_ethdev.h    |   4 +
>   drivers/net/ngbe/ngbe_ptypes.c    | 640 ++++++++++++++++++++++++++++++
>   drivers/net/ngbe/ngbe_ptypes.h    | 351 ++++++++++++++++
>   drivers/net/ngbe/ngbe_rxtx.h      |   1 -
>   8 files changed, 1006 insertions(+), 1 deletion(-)
>   create mode 100644 drivers/net/ngbe/ngbe_ptypes.c
>   create mode 100644 drivers/net/ngbe/ngbe_ptypes.h
> 
> diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
> index abde1e2a67..e24d8d0b55 100644
> --- a/doc/guides/nics/features/ngbe.ini
> +++ b/doc/guides/nics/features/ngbe.ini
> @@ -13,6 +13,7 @@ CRC offload          = P
>   VLAN offload         = P
>   L3 checksum offload  = P
>   L4 checksum offload  = P
> +Packet type parsing  = Y
>   Multiprocess aware   = Y
>   Linux                = Y
>   ARMv8                = Y
> diff --git a/doc/guides/nics/ngbe.rst b/doc/guides/nics/ngbe.rst
> index e56baf26b4..04fa3e90a8 100644
> --- a/doc/guides/nics/ngbe.rst
> +++ b/doc/guides/nics/ngbe.rst
> @@ -10,6 +10,7 @@ for Wangxun 1 Gigabit Ethernet NICs.
>   Features
>   --------
>   
> +- Packet type information
>   - Checksum offload
>   - Jumbo frames
>   - Link state information
> diff --git a/drivers/net/ngbe/meson.build b/drivers/net/ngbe/meson.build
> index 9e75b82f1c..fd571399b3 100644
> --- a/drivers/net/ngbe/meson.build
> +++ b/drivers/net/ngbe/meson.build
> @@ -12,6 +12,7 @@ objs = [base_objs]
>   
>   sources = files(
>   	'ngbe_ethdev.c',
> +	'ngbe_ptypes.c',
>   	'ngbe_rxtx.c',
>   )
>   
> diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
> index 2f8ac48f33..672db88133 100644
> --- a/drivers/net/ngbe/ngbe_ethdev.c
> +++ b/drivers/net/ngbe/ngbe_ethdev.c
> @@ -354,6 +354,13 @@ ngbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>   	return 0;
>   }
>   
> +const uint32_t *
> +ngbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
> +{
> +	RTE_SET_USED(dev);
> +	return ngbe_get_supported_ptypes();
> +}
> +
>   /* return 0 means link status changed, -1 means not changed */
>   int
>   ngbe_dev_link_update_share(struct rte_eth_dev *dev,
> @@ -661,6 +668,7 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = {
>   	.dev_configure              = ngbe_dev_configure,
>   	.dev_infos_get              = ngbe_dev_info_get,
>   	.link_update                = ngbe_dev_link_update,
> +	.dev_supported_ptypes_get   = ngbe_dev_supported_ptypes_get,
>   	.rx_queue_setup             = ngbe_dev_rx_queue_setup,
>   	.rx_queue_release           = ngbe_dev_rx_queue_release,
>   	.tx_queue_setup             = ngbe_dev_tx_queue_setup,
> diff --git a/drivers/net/ngbe/ngbe_ethdev.h b/drivers/net/ngbe/ngbe_ethdev.h
> index a9482f3001..6881351252 100644
> --- a/drivers/net/ngbe/ngbe_ethdev.h
> +++ b/drivers/net/ngbe/ngbe_ethdev.h
> @@ -6,6 +6,8 @@
>   #ifndef _NGBE_ETHDEV_H_
>   #define _NGBE_ETHDEV_H_
>   
> +#include "ngbe_ptypes.h"
> +
>   /* need update link, bit flag */
>   #define NGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
>   #define NGBE_FLAG_MAILBOX          (uint32_t)(1 << 1)
> @@ -94,4 +96,6 @@ ngbe_dev_link_update_share(struct rte_eth_dev *dev,
>   #define NGBE_DEFAULT_TX_HTHRESH      0
>   #define NGBE_DEFAULT_TX_WTHRESH      0
>   
> +const uint32_t *ngbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
> +
>   #endif /* _NGBE_ETHDEV_H_ */
> diff --git a/drivers/net/ngbe/ngbe_ptypes.c b/drivers/net/ngbe/ngbe_ptypes.c
> new file mode 100644
> index 0000000000..4b6cd374f6
> --- /dev/null
> +++ b/drivers/net/ngbe/ngbe_ptypes.c
> @@ -0,0 +1,640 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018-2020 Beijing WangXun Technology Co., Ltd.
> + */
> +
> +#include <rte_mbuf.h>
> +#include <rte_memory.h>
> +
> +#include "base/ngbe_type.h"
> +#include "ngbe_ptypes.h"
> +
> +/* The ngbe_ptype_lookup is used to convert from the 8-bit ptid in the
> + * hardware to a bit-field that can be used by SW to more easily determine the
> + * packet type.
> + *
> + * Macros are used to shorten the table lines and make this table human
> + * readable.
> + *
> + * We store the PTYPE in the top byte of the bit field - this is just so that
> + * we can check that the table doesn't have a row missing, as the index into
> + * the table should be the PTYPE.
> + */
> +#define TPTE(ptid, l2, l3, l4, tun, el2, el3, el4) \
> +	[ptid] = (RTE_PTYPE_L2_##l2 | \
> +		RTE_PTYPE_L3_##l3 | \
> +		RTE_PTYPE_L4_##l4 | \
> +		RTE_PTYPE_TUNNEL_##tun | \
> +		RTE_PTYPE_INNER_L2_##el2 | \
> +		RTE_PTYPE_INNER_L3_##el3 | \
> +		RTE_PTYPE_INNER_L4_##el4)
> +
> +#define RTE_PTYPE_L2_NONE               0
> +#define RTE_PTYPE_L3_NONE               0
> +#define RTE_PTYPE_L4_NONE               0
> +#define RTE_PTYPE_TUNNEL_NONE           0
> +#define RTE_PTYPE_INNER_L2_NONE         0
> +#define RTE_PTYPE_INNER_L3_NONE         0
> +#define RTE_PTYPE_INNER_L4_NONE         0
> +
> +static u32 ngbe_ptype_lookup[NGBE_PTID_MAX] __rte_cache_aligned = {
> +	/* L2:0-3 L3:4-7 L4:8-11 TUN:12-15 EL2:16-19 EL3:20-23 EL2:24-27 */
> +	/* L2: ETH */
> +	TPTE(0x10, ETHER,          NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x11, ETHER,          NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x12, ETHER_TIMESYNC, NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x13, ETHER_FIP,      NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x14, ETHER_LLDP,     NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x15, ETHER_CNM,      NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x16, ETHER_EAPOL,    NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x17, ETHER_ARP,      NONE, NONE, NONE, NONE, NONE, NONE),
> +	/* L2: Ethertype Filter */
> +	TPTE(0x18, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x19, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1A, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1B, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1C, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1D, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1E, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	TPTE(0x1F, ETHER_FILTER,   NONE, NONE, NONE, NONE, NONE, NONE),
> +	/* L3: IP */
> +	TPTE(0x20, ETHER, IPV4, NONFRAG, NONE, NONE, NONE, NONE),
> +	TPTE(0x21, ETHER, IPV4, FRAG,    NONE, NONE, NONE, NONE),
> +	TPTE(0x22, ETHER, IPV4, NONFRAG, NONE, NONE, NONE, NONE),
> +	TPTE(0x23, ETHER, IPV4, UDP,     NONE, NONE, NONE, NONE),
> +	TPTE(0x24, ETHER, IPV4, TCP,     NONE, NONE, NONE, NONE),
> +	TPTE(0x25, ETHER, IPV4, SCTP,    NONE, NONE, NONE, NONE),
> +	TPTE(0x29, ETHER, IPV6, FRAG,    NONE, NONE, NONE, NONE),
> +	TPTE(0x2A, ETHER, IPV6, NONFRAG, NONE, NONE, NONE, NONE),
> +	TPTE(0x2B, ETHER, IPV6, UDP,     NONE, NONE, NONE, NONE),
> +	TPTE(0x2C, ETHER, IPV6, TCP,     NONE, NONE, NONE, NONE),
> +	TPTE(0x2D, ETHER, IPV6, SCTP,    NONE, NONE, NONE, NONE),
> +	/* IPv4 -> IPv4/IPv6 */
> +	TPTE(0x81, ETHER, IPV4, NONE, IP, NONE, IPV4, FRAG),
> +	TPTE(0x82, ETHER, IPV4, NONE, IP, NONE, IPV4, NONFRAG),
> +	TPTE(0x83, ETHER, IPV4, NONE, IP, NONE, IPV4, UDP),
> +	TPTE(0x84, ETHER, IPV4, NONE, IP, NONE, IPV4, TCP),
> +	TPTE(0x85, ETHER, IPV4, NONE, IP, NONE, IPV4, SCTP),
> +	TPTE(0x89, ETHER, IPV4, NONE, IP, NONE, IPV6, FRAG),
> +	TPTE(0x8A, ETHER, IPV4, NONE, IP, NONE, IPV6, NONFRAG),
> +	TPTE(0x8B, ETHER, IPV4, NONE, IP, NONE, IPV6, UDP),
> +	TPTE(0x8C, ETHER, IPV4, NONE, IP, NONE, IPV6, TCP),
> +	TPTE(0x8D, ETHER, IPV4, NONE, IP, NONE, IPV6, SCTP),
> +	/* IPv4 -> GRE/Teredo/VXLAN -> NONE/IPv4/IPv6 */
> +	TPTE(0x90, ETHER, IPV4, NONE, VXLAN_GPE, NONE, NONE, NONE),
> +	TPTE(0x91, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, FRAG),
> +	TPTE(0x92, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, NONFRAG),
> +	TPTE(0x93, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, UDP),
> +	TPTE(0x94, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, TCP),
> +	TPTE(0x95, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, SCTP),
> +	TPTE(0x99, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, FRAG),
> +	TPTE(0x9A, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, NONFRAG),
> +	TPTE(0x9B, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, UDP),
> +	TPTE(0x9C, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, TCP),
> +	TPTE(0x9D, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, SCTP),
> +	/* IPv4 -> GRE/Teredo/VXLAN -> MAC -> NONE/IPv4/IPv6 */
> +	TPTE(0xA0, ETHER, IPV4, NONE, GRENAT, ETHER, NONE,  NONE),
> +	TPTE(0xA1, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, FRAG),
> +	TPTE(0xA2, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, NONFRAG),
> +	TPTE(0xA3, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, UDP),
> +	TPTE(0xA4, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, TCP),
> +	TPTE(0xA5, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, SCTP),
> +	TPTE(0xA9, ETHER, IPV4, NONE, GRENAT, ETHER, IPV6, FRAG),
> +	TPTE(0xAA, ETHER, IPV4, NONE, GRENAT, ETHER, IPV6, NONFRAG),
> +	TPTE(0xAB, ETHER, IPV4, NONE, GRENAT, ETHER, IPV6, UDP),
> +	TPTE(0xAC, ETHER, IPV4, NONE, GRENAT, ETHER, IPV6, TCP),
> +	TPTE(0xAD, ETHER, IPV4, NONE, GRENAT, ETHER, IPV6, SCTP),
> +	/* IPv4 -> GRE/Teredo/VXLAN -> MAC+VLAN -> NONE/IPv4/IPv6 */
> +	TPTE(0xB0, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, NONE,  NONE),
> +	TPTE(0xB1, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV4, FRAG),
> +	TPTE(0xB2, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV4, NONFRAG),
> +	TPTE(0xB3, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV4, UDP),
> +	TPTE(0xB4, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV4, TCP),
> +	TPTE(0xB5, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV4, SCTP),
> +	TPTE(0xB9, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV6, FRAG),
> +	TPTE(0xBA, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV6, NONFRAG),
> +	TPTE(0xBB, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV6, UDP),
> +	TPTE(0xBC, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV6, TCP),
> +	TPTE(0xBD, ETHER, IPV4, NONE, GRENAT, ETHER_VLAN, IPV6, SCTP),
> +	/* IPv6 -> IPv4/IPv6 */
> +	TPTE(0xC1, ETHER, IPV6, NONE, IP, NONE, IPV4, FRAG),
> +	TPTE(0xC2, ETHER, IPV6, NONE, IP, NONE, IPV4, NONFRAG),
> +	TPTE(0xC3, ETHER, IPV6, NONE, IP, NONE, IPV4, UDP),
> +	TPTE(0xC4, ETHER, IPV6, NONE, IP, NONE, IPV4, TCP),
> +	TPTE(0xC5, ETHER, IPV6, NONE, IP, NONE, IPV4, SCTP),
> +	TPTE(0xC9, ETHER, IPV6, NONE, IP, NONE, IPV6, FRAG),
> +	TPTE(0xCA, ETHER, IPV6, NONE, IP, NONE, IPV6, NONFRAG),
> +	TPTE(0xCB, ETHER, IPV6, NONE, IP, NONE, IPV6, UDP),
> +	TPTE(0xCC, ETHER, IPV6, NONE, IP, NONE, IPV6, TCP),
> +	TPTE(0xCD, ETHER, IPV6, NONE, IP, NONE, IPV6, SCTP),
> +	/* IPv6 -> GRE/Teredo/VXLAN -> NONE/IPv4/IPv6 */
> +	TPTE(0xD0, ETHER, IPV6, NONE, GRENAT, NONE, NONE,  NONE),
> +	TPTE(0xD1, ETHER, IPV6, NONE, GRENAT, NONE, IPV4, FRAG),
> +	TPTE(0xD2, ETHER, IPV6, NONE, GRENAT, NONE, IPV4, NONFRAG),
> +	TPTE(0xD3, ETHER, IPV6, NONE, GRENAT, NONE, IPV4, UDP),
> +	TPTE(0xD4, ETHER, IPV6, NONE, GRENAT, NONE, IPV4, TCP),
> +	TPTE(0xD5, ETHER, IPV6, NONE, GRENAT, NONE, IPV4, SCTP),
> +	TPTE(0xD9, ETHER, IPV6, NONE, GRENAT, NONE, IPV6, FRAG),
> +	TPTE(0xDA, ETHER, IPV6, NONE, GRENAT, NONE, IPV6, NONFRAG),
> +	TPTE(0xDB, ETHER, IPV6, NONE, GRENAT, NONE, IPV6, UDP),
> +	TPTE(0xDC, ETHER, IPV6, NONE, GRENAT, NONE, IPV6, TCP),
> +	TPTE(0xDD, ETHER, IPV6, NONE, GRENAT, NONE, IPV6, SCTP),
> +	/* IPv6 -> GRE/Teredo/VXLAN -> MAC -> NONE/IPv4/IPv6 */
> +	TPTE(0xE0, ETHER, IPV6, NONE, GRENAT, ETHER, NONE,  NONE),
> +	TPTE(0xE1, ETHER, IPV6, NONE, GRENAT, ETHER, IPV4, FRAG),
> +	TPTE(0xE2, ETHER, IPV6, NONE, GRENAT, ETHER, IPV4, NONFRAG),
> +	TPTE(0xE3, ETHER, IPV6, NONE, GRENAT, ETHER, IPV4, UDP),
> +	TPTE(0xE4, ETHER, IPV6, NONE, GRENAT, ETHER, IPV4, TCP),
> +	TPTE(0xE5, ETHER, IPV6, NONE, GRENAT, ETHER, IPV4, SCTP),
> +	TPTE(0xE9, ETHER, IPV6, NONE, GRENAT, ETHER, IPV6, FRAG),
> +	TPTE(0xEA, ETHER, IPV6, NONE, GRENAT, ETHER, IPV6, NONFRAG),
> +	TPTE(0xEB, ETHER, IPV6, NONE, GRENAT, ETHER, IPV6, UDP),
> +	TPTE(0xEC, ETHER, IPV6, NONE, GRENAT, ETHER, IPV6, TCP),
> +	TPTE(0xED, ETHER, IPV6, NONE, GRENAT, ETHER, IPV6, SCTP),
> +	/* IPv6 -> GRE/Teredo/VXLAN -> MAC+VLAN -> NONE/IPv4/IPv6 */
> +	TPTE(0xF0, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, NONE,  NONE),
> +	TPTE(0xF1, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV4, FRAG),
> +	TPTE(0xF2, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV4, NONFRAG),
> +	TPTE(0xF3, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV4, UDP),
> +	TPTE(0xF4, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV4, TCP),
> +	TPTE(0xF5, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV4, SCTP),
> +	TPTE(0xF9, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV6, FRAG),
> +	TPTE(0xFA, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV6, NONFRAG),
> +	TPTE(0xFB, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV6, UDP),
> +	TPTE(0xFC, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV6, TCP),
> +	TPTE(0xFD, ETHER, IPV6, NONE, GRENAT, ETHER_VLAN, IPV6, SCTP),
> +};
> +
> +u32 *ngbe_get_supported_ptypes(void)
> +{
> +	static u32 ptypes[] = {
> +		/* For non-vec functions,
> +		 * refers to ngbe_rxd_pkt_info_to_pkt_type();
> +		 */
> +		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_SCTP,
> +		RTE_PTYPE_L4_TCP,
> +		RTE_PTYPE_L4_UDP,
> +		RTE_PTYPE_TUNNEL_IP,
> +		RTE_PTYPE_INNER_L3_IPV6,
> +		RTE_PTYPE_INNER_L3_IPV6_EXT,
> +		RTE_PTYPE_INNER_L4_TCP,
> +		RTE_PTYPE_INNER_L4_UDP,
> +		RTE_PTYPE_UNKNOWN
> +	};
> +
> +	return ptypes;
> +}
> +
> +static inline u8
> +ngbe_encode_ptype_mac(u32 ptype)
> +{
> +	u8 ptid;
> +
> +	ptid = NGBE_PTID_PKT_MAC;
> +
> +	switch (ptype & RTE_PTYPE_L2_MASK) {
> +	case RTE_PTYPE_UNKNOWN:
> +		break;
> +	case RTE_PTYPE_L2_ETHER_TIMESYNC:
> +		ptid |= NGBE_PTID_TYP_TS;
> +		break;
> +	case RTE_PTYPE_L2_ETHER_ARP:
> +		ptid |= NGBE_PTID_TYP_ARP;
> +		break;
> +	case RTE_PTYPE_L2_ETHER_LLDP:
> +		ptid |= NGBE_PTID_TYP_LLDP;
> +		break;
> +	default:
> +		ptid |= NGBE_PTID_TYP_MAC;
> +		break;
> +	}
> +
> +	return ptid;
> +}
> +
> +static inline u8
> +ngbe_encode_ptype_ip(u32 ptype)
> +{
> +	u8 ptid;
> +
> +	ptid = NGBE_PTID_PKT_IP;
> +
> +	switch (ptype & RTE_PTYPE_L3_MASK) {
> +	case RTE_PTYPE_L3_IPV4:
> +	case RTE_PTYPE_L3_IPV4_EXT:
> +	case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN:
> +		break;
> +	case RTE_PTYPE_L3_IPV6:
> +	case RTE_PTYPE_L3_IPV6_EXT:
> +	case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN:
> +		ptid |= NGBE_PTID_PKT_IPV6;
> +		break;
> +	default:
> +		return ngbe_encode_ptype_mac(ptype);
> +	}
> +
> +	switch (ptype & RTE_PTYPE_L4_MASK) {
> +	case RTE_PTYPE_L4_TCP:
> +		ptid |= NGBE_PTID_TYP_TCP;
> +		break;
> +	case RTE_PTYPE_L4_UDP:
> +		ptid |= NGBE_PTID_TYP_UDP;
> +		break;
> +	case RTE_PTYPE_L4_SCTP:
> +		ptid |= NGBE_PTID_TYP_SCTP;
> +		break;
> +	case RTE_PTYPE_L4_FRAG:
> +		ptid |= NGBE_PTID_TYP_IPFRAG;
> +		break;
> +	default:
> +		ptid |= NGBE_PTID_TYP_IPDATA;
> +		break;
> +	}
> +
> +	return ptid;
> +}
> +
> +static inline u8
> +ngbe_encode_ptype_tunnel(u32 ptype)
> +{
> +	u8 ptid;
> +
> +	ptid = NGBE_PTID_PKT_TUN;
> +
> +	switch (ptype & RTE_PTYPE_L3_MASK) {
> +	case RTE_PTYPE_L3_IPV4:
> +	case RTE_PTYPE_L3_IPV4_EXT:
> +	case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN:
> +		break;
> +	case RTE_PTYPE_L3_IPV6:
> +	case RTE_PTYPE_L3_IPV6_EXT:
> +	case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN:
> +		ptid |= NGBE_PTID_TUN_IPV6;
> +		break;
> +	default:
> +		return ngbe_encode_ptype_ip(ptype);
> +	}
> +
> +	/* VXLAN/GRE/Teredo/VXLAN-GPE are not supported in EM */
> +	switch (ptype & RTE_PTYPE_TUNNEL_MASK) {
> +	case RTE_PTYPE_TUNNEL_IP:
> +		ptid |= NGBE_PTID_TUN_EI;
> +		break;
> +	case RTE_PTYPE_TUNNEL_GRE:
> +	case RTE_PTYPE_TUNNEL_VXLAN_GPE:
> +		ptid |= NGBE_PTID_TUN_EIG;
> +		break;
> +	case RTE_PTYPE_TUNNEL_VXLAN:
> +	case RTE_PTYPE_TUNNEL_NVGRE:
> +	case RTE_PTYPE_TUNNEL_GENEVE:
> +	case RTE_PTYPE_TUNNEL_GRENAT:
> +		break;
> +	default:
> +		return ptid;
> +	}
> +
> +	switch (ptype & RTE_PTYPE_INNER_L2_MASK) {
> +	case RTE_PTYPE_INNER_L2_ETHER:
> +		ptid |= NGBE_PTID_TUN_EIGM;
> +		break;
> +	case RTE_PTYPE_INNER_L2_ETHER_VLAN:
> +		ptid |= NGBE_PTID_TUN_EIGMV;
> +		break;
> +	case RTE_PTYPE_INNER_L2_ETHER_QINQ:
> +		ptid |= NGBE_PTID_TUN_EIGMV;
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	switch (ptype & RTE_PTYPE_INNER_L3_MASK) {
> +	case RTE_PTYPE_INNER_L3_IPV4:
> +	case RTE_PTYPE_INNER_L3_IPV4_EXT:
> +	case RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN:
> +		break;
> +	case RTE_PTYPE_INNER_L3_IPV6:
> +	case RTE_PTYPE_INNER_L3_IPV6_EXT:
> +	case RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN:
> +		ptid |= NGBE_PTID_PKT_IPV6;
> +		break;
> +	default:
> +		return ptid;
> +	}
> +
> +	switch (ptype & RTE_PTYPE_INNER_L4_MASK) {
> +	case RTE_PTYPE_INNER_L4_TCP:
> +		ptid |= NGBE_PTID_TYP_TCP;
> +		break;
> +	case RTE_PTYPE_INNER_L4_UDP:
> +		ptid |= NGBE_PTID_TYP_UDP;
> +		break;
> +	case RTE_PTYPE_INNER_L4_SCTP:
> +		ptid |= NGBE_PTID_TYP_SCTP;
> +		break;
> +	case RTE_PTYPE_INNER_L4_FRAG:
> +		ptid |= NGBE_PTID_TYP_IPFRAG;
> +		break;
> +	default:
> +		ptid |= NGBE_PTID_TYP_IPDATA;
> +		break;
> +	}
> +
> +	return ptid;
> +}
> +
> +u32 ngbe_decode_ptype(u8 ptid)
> +{
> +	if (-1 != ngbe_etflt_id(ptid))
> +		return RTE_PTYPE_UNKNOWN;
> +
> +	return ngbe_ptype_lookup[ptid];
> +}
> +
> +u8 ngbe_encode_ptype(u32 ptype)
> +{
> +	u8 ptid = 0;
> +
> +	if (ptype & RTE_PTYPE_TUNNEL_MASK)
> +		ptid = ngbe_encode_ptype_tunnel(ptype);
> +	else if (ptype & RTE_PTYPE_L3_MASK)
> +		ptid = ngbe_encode_ptype_ip(ptype);
> +	else if (ptype & RTE_PTYPE_L2_MASK)
> +		ptid = ngbe_encode_ptype_mac(ptype);
> +	else
> +		ptid = NGBE_PTID_NULL;
> +
> +	return ptid;
> +}
> +
> +/**
> + * Use 2 different table for normal packet and tunnel packet
> + * to save the space.
> + */
> +const u32
> +ngbe_ptype_table[NGBE_PTID_MAX] __rte_cache_aligned = {
> +	[NGBE_PT_ETHER] = RTE_PTYPE_L2_ETHER,
> +	[NGBE_PT_IPV4] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4,
> +	[NGBE_PT_IPV4_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
> +	[NGBE_PT_IPV4_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
> +	[NGBE_PT_IPV4_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_SCTP,
> +	[NGBE_PT_IPV4_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT,
> +	[NGBE_PT_IPV4_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_TCP,
> +	[NGBE_PT_IPV4_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP,
> +	[NGBE_PT_IPV4_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_SCTP,
> +	[NGBE_PT_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6,
> +	[NGBE_PT_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP,
> +	[NGBE_PT_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
> +	[NGBE_PT_IPV6_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_SCTP,
> +	[NGBE_PT_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6_EXT,
> +	[NGBE_PT_IPV6_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_TCP,
> +	[NGBE_PT_IPV6_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_UDP,
> +	[NGBE_PT_IPV6_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV6_EXT | RTE_PTYPE_L4_SCTP,
> +	[NGBE_PT_IPV4_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6,
> +	[NGBE_PT_IPV4_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_IPV4_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_IPV4_IPV6_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_IPV4_EXT_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6,
> +	[NGBE_PT_IPV4_EXT_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_IPV4_EXT_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_IPV4_EXT_IPV6_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_IPV4_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT,
> +	[NGBE_PT_IPV4_IPV6_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_IPV4_IPV6_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_IPV4_IPV6_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_IPV4_EXT_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT,
> +	[NGBE_PT_IPV4_EXT_IPV6_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_IPV4_EXT_IPV6_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_IPV4_EXT_IPV6_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_TUNNEL_IP |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_SCTP,
> +};
> +
> +const u32
> +ngbe_ptype_table_tn[NGBE_PTID_MAX] __rte_cache_aligned = {
> +	[NGBE_PT_NVGRE] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER,
> +	[NGBE_PT_NVGRE_IPV4] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV4_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4_EXT,
> +	[NGBE_PT_NVGRE_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6,
> +	[NGBE_PT_NVGRE_IPV4_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6_EXT,
> +	[NGBE_PT_NVGRE_IPV4_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV4_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4 |
> +		RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_NVGRE_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6 |
> +		RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_NVGRE_IPV4_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV6_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6_EXT |
> +		RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_NVGRE_IPV4_IPV6_EXT_TCP] =
> +		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
> +		RTE_PTYPE_TUNNEL_GRE | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV4_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4 |
> +		RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_NVGRE_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6 |
> +		RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_NVGRE_IPV6_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6 |
> +		RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_NVGRE_IPV4_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV6_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6_EXT |
> +		RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_NVGRE_IPV6_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV6_EXT |
> +		RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_NVGRE_IPV4_IPV6_EXT_UDP] =
> +		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
> +		RTE_PTYPE_TUNNEL_GRE | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_NVGRE_IPV4_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4 |
> +		RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_NVGRE_IPV4_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4_EXT |
> +		RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_NVGRE_IPV4_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4_EXT |
> +		RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_NVGRE_IPV4_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_TUNNEL_GRE |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4_EXT |
> +		RTE_PTYPE_INNER_L4_UDP,
> +
> +	[NGBE_PT_VXLAN] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER,
> +	[NGBE_PT_VXLAN_IPV4] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV4_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4_EXT,
> +	[NGBE_PT_VXLAN_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6,
> +	[NGBE_PT_VXLAN_IPV4_IPV6] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT,
> +	[NGBE_PT_VXLAN_IPV4_IPV6_EXT] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV4_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4 | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_VXLAN_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_VXLAN_IPV4_IPV6_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV6_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_VXLAN_IPV4_IPV6_EXT_TCP] =
> +		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
> +		RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV4_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4 | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_VXLAN_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_VXLAN_IPV6_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6 | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_VXLAN_IPV4_IPV6_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV6_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_UDP,
> +	[NGBE_PT_VXLAN_IPV6_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV6_EXT | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_VXLAN_IPV4_IPV6_EXT_UDP] =
> +		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
> +		RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN |
> +		RTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L3_IPV4,
> +	[NGBE_PT_VXLAN_IPV4_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4 | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_VXLAN_IPV4_EXT_SCTP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4_EXT | RTE_PTYPE_INNER_L4_SCTP,
> +	[NGBE_PT_VXLAN_IPV4_EXT_TCP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4_EXT | RTE_PTYPE_INNER_L4_TCP,
> +	[NGBE_PT_VXLAN_IPV4_EXT_UDP] = RTE_PTYPE_L2_ETHER |
> +		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP |
> +		RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_INNER_L2_ETHER |
> +		RTE_PTYPE_INNER_L3_IPV4_EXT | RTE_PTYPE_INNER_L4_UDP,
> +};
> +
> diff --git a/drivers/net/ngbe/ngbe_ptypes.h b/drivers/net/ngbe/ngbe_ptypes.h
> new file mode 100644
> index 0000000000..1b965c02d8
> --- /dev/null
> +++ b/drivers/net/ngbe/ngbe_ptypes.h
> @@ -0,0 +1,351 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018-2020 Beijing WangXun Technology Co., Ltd.
> + */
> +
> +#ifndef _NGBE_PTYPE_H_
> +#define _NGBE_PTYPE_H_
> +
> +/**
> + * PTID(Packet Type Identifier, 8bits)
> + * - Bit 3:0 detailed types.
> + * - Bit 5:4 basic types.
> + * - Bit 7:6 tunnel types.
> + **/
> +#define NGBE_PTID_NULL                 0
> +#define NGBE_PTID_MAX                  256
> +#define NGBE_PTID_MASK                 0xFF
> +#define NGBE_PTID_MASK_TUNNEL          0x7F
> +
> +/* TUN */
> +#define NGBE_PTID_TUN_IPV6             0x40
> +#define NGBE_PTID_TUN_EI               0x00 /* IP */
> +#define NGBE_PTID_TUN_EIG              0x10 /* IP+GRE */
> +#define NGBE_PTID_TUN_EIGM             0x20 /* IP+GRE+MAC */
> +#define NGBE_PTID_TUN_EIGMV            0x30 /* IP+GRE+MAC+VLAN */
> +
> +/* PKT for !TUN */
> +#define NGBE_PTID_PKT_TUN             (0x80)
> +#define NGBE_PTID_PKT_MAC             (0x10)
> +#define NGBE_PTID_PKT_IP              (0x20)
> +#define NGBE_PTID_PKT_FCOE            (0x30)
> +
> +/* TYP for PKT=mac */
> +#define NGBE_PTID_TYP_MAC             (0x01)
> +#define NGBE_PTID_TYP_TS              (0x02) /* time sync */
> +#define NGBE_PTID_TYP_FIP             (0x03)
> +#define NGBE_PTID_TYP_LLDP            (0x04)
> +#define NGBE_PTID_TYP_CNM             (0x05)
> +#define NGBE_PTID_TYP_EAPOL           (0x06)
> +#define NGBE_PTID_TYP_ARP             (0x07)
> +#define NGBE_PTID_TYP_ETF             (0x08)
> +
> +/* TYP for PKT=ip */
> +#define NGBE_PTID_PKT_IPV6            (0x08)
> +#define NGBE_PTID_TYP_IPFRAG          (0x01)
> +#define NGBE_PTID_TYP_IPDATA          (0x02)
> +#define NGBE_PTID_TYP_UDP             (0x03)
> +#define NGBE_PTID_TYP_TCP             (0x04)
> +#define NGBE_PTID_TYP_SCTP            (0x05)
> +
> +/* TYP for PKT=fcoe */
> +#define NGBE_PTID_PKT_VFT             (0x08)
> +#define NGBE_PTID_TYP_FCOE            (0x00)
> +#define NGBE_PTID_TYP_FCDATA          (0x01)
> +#define NGBE_PTID_TYP_FCRDY           (0x02)
> +#define NGBE_PTID_TYP_FCRSP           (0x03)
> +#define NGBE_PTID_TYP_FCOTHER         (0x04)
> +
> +/* packet type non-ip values */
> +enum ngbe_l2_ptids {
> +	NGBE_PTID_L2_ABORTED = (NGBE_PTID_PKT_MAC),
> +	NGBE_PTID_L2_MAC = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_MAC),
> +	NGBE_PTID_L2_TMST = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_TS),
> +	NGBE_PTID_L2_FIP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_FIP),
> +	NGBE_PTID_L2_LLDP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_LLDP),
> +	NGBE_PTID_L2_CNM = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_CNM),
> +	NGBE_PTID_L2_EAPOL = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_EAPOL),
> +	NGBE_PTID_L2_ARP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_ARP),
> +
> +	NGBE_PTID_L2_IPV4_FRAG = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_IPFRAG),
> +	NGBE_PTID_L2_IPV4 = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_IPDATA),
> +	NGBE_PTID_L2_IPV4_UDP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_UDP),
> +	NGBE_PTID_L2_IPV4_TCP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_TCP),
> +	NGBE_PTID_L2_IPV4_SCTP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_SCTP),
> +	NGBE_PTID_L2_IPV6_FRAG = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
> +			NGBE_PTID_TYP_IPFRAG),
> +	NGBE_PTID_L2_IPV6 = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
> +			NGBE_PTID_TYP_IPDATA),
> +	NGBE_PTID_L2_IPV6_UDP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
> +			NGBE_PTID_TYP_UDP),
> +	NGBE_PTID_L2_IPV6_TCP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
> +			NGBE_PTID_TYP_TCP),
> +	NGBE_PTID_L2_IPV6_SCTP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
> +			NGBE_PTID_TYP_SCTP),
> +
> +	NGBE_PTID_L2_FCOE = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_TYP_FCOE),
> +	NGBE_PTID_L2_FCOE_FCDATA = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_TYP_FCDATA),
> +	NGBE_PTID_L2_FCOE_FCRDY = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_TYP_FCRDY),
> +	NGBE_PTID_L2_FCOE_FCRSP = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_TYP_FCRSP),
> +	NGBE_PTID_L2_FCOE_FCOTHER = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_TYP_FCOTHER),
> +	NGBE_PTID_L2_FCOE_VFT = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_PKT_VFT),
> +	NGBE_PTID_L2_FCOE_VFT_FCDATA = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_PKT_VFT | NGBE_PTID_TYP_FCDATA),
> +	NGBE_PTID_L2_FCOE_VFT_FCRDY = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_PKT_VFT | NGBE_PTID_TYP_FCRDY),
> +	NGBE_PTID_L2_FCOE_VFT_FCRSP = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_PKT_VFT | NGBE_PTID_TYP_FCRSP),
> +	NGBE_PTID_L2_FCOE_VFT_FCOTHER = (NGBE_PTID_PKT_FCOE |
> +			NGBE_PTID_PKT_VFT | NGBE_PTID_TYP_FCOTHER),
> +
> +	NGBE_PTID_L2_TUN4_MAC = (NGBE_PTID_PKT_TUN |
> +			NGBE_PTID_TUN_EIGM),
> +	NGBE_PTID_L2_TUN6_MAC = (NGBE_PTID_PKT_TUN |
> +			NGBE_PTID_TUN_IPV6 | NGBE_PTID_TUN_EIGM),
> +};
> +
> +
> +/*
> + * PTYPE(Packet Type, 32bits)
> + * - Bit 3:0 is for L2 types.
> + * - Bit 7:4 is for L3 or outer L3 (for tunneling case) types.
> + * - Bit 11:8 is for L4 or outer L4 (for tunneling case) types.
> + * - Bit 15:12 is for tunnel types.
> + * - Bit 19:16 is for inner L2 types.
> + * - Bit 23:20 is for inner L3 types.
> + * - Bit 27:24 is for inner L4 types.
> + * - Bit 31:28 is reserved.
> + * please ref to rte_mbuf.h: rte_mbuf.packet_type
> + */
> +struct rte_ngbe_ptype {
> +	u32 l2:4;  /* outer mac */
> +	u32 l3:4;  /* outer internet protocol */
> +	u32 l4:4;  /* outer transport protocol */
> +	u32 tun:4; /* tunnel protocol */
> +
> +	u32 el2:4; /* inner mac */
> +	u32 el3:4; /* inner internet protocol */
> +	u32 el4:4; /* inner transport protocol */
> +	u32 rsv:3;
> +	u32 known:1;
> +};
> +
> +#ifndef RTE_PTYPE_UNKNOWN
> +#define RTE_PTYPE_UNKNOWN                   0x00000000
> +#define RTE_PTYPE_L2_ETHER                  0x00000001
> +#define RTE_PTYPE_L2_ETHER_TIMESYNC         0x00000002
> +#define RTE_PTYPE_L2_ETHER_ARP              0x00000003
> +#define RTE_PTYPE_L2_ETHER_LLDP             0x00000004
> +#define RTE_PTYPE_L2_ETHER_NSH              0x00000005
> +#define RTE_PTYPE_L2_ETHER_FCOE             0x00000009
> +#define RTE_PTYPE_L3_IPV4                   0x00000010
> +#define RTE_PTYPE_L3_IPV4_EXT               0x00000030
> +#define RTE_PTYPE_L3_IPV6                   0x00000040
> +#define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN       0x00000090
> +#define RTE_PTYPE_L3_IPV6_EXT               0x000000c0
> +#define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN       0x000000e0
> +#define RTE_PTYPE_L4_TCP                    0x00000100
> +#define RTE_PTYPE_L4_UDP                    0x00000200
> +#define RTE_PTYPE_L4_FRAG                   0x00000300
> +#define RTE_PTYPE_L4_SCTP                   0x00000400
> +#define RTE_PTYPE_L4_ICMP                   0x00000500
> +#define RTE_PTYPE_L4_NONFRAG                0x00000600
> +#define RTE_PTYPE_TUNNEL_IP                 0x00001000
> +#define RTE_PTYPE_TUNNEL_GRE                0x00002000
> +#define RTE_PTYPE_TUNNEL_VXLAN              0x00003000
> +#define RTE_PTYPE_TUNNEL_NVGRE              0x00004000
> +#define RTE_PTYPE_TUNNEL_GENEVE             0x00005000
> +#define RTE_PTYPE_TUNNEL_GRENAT             0x00006000
> +#define RTE_PTYPE_INNER_L2_ETHER            0x00010000
> +#define RTE_PTYPE_INNER_L2_ETHER_VLAN       0x00020000
> +#define RTE_PTYPE_INNER_L3_IPV4             0x00100000
> +#define RTE_PTYPE_INNER_L3_IPV4_EXT         0x00200000
> +#define RTE_PTYPE_INNER_L3_IPV6             0x00300000
> +#define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
> +#define RTE_PTYPE_INNER_L3_IPV6_EXT         0x00500000
> +#define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
> +#define RTE_PTYPE_INNER_L4_TCP              0x01000000
> +#define RTE_PTYPE_INNER_L4_UDP              0x02000000
> +#define RTE_PTYPE_INNER_L4_FRAG             0x03000000
> +#define RTE_PTYPE_INNER_L4_SCTP             0x04000000
> +#define RTE_PTYPE_INNER_L4_ICMP             0x05000000
> +#define RTE_PTYPE_INNER_L4_NONFRAG          0x06000000
> +#endif /* !RTE_PTYPE_UNKNOWN */
> +#define RTE_PTYPE_L3_IPV4u                  RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
> +#define RTE_PTYPE_L3_IPV6u                  RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
> +#define RTE_PTYPE_INNER_L3_IPV4u            RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN
> +#define RTE_PTYPE_INNER_L3_IPV6u            RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN
> +#define RTE_PTYPE_L2_ETHER_FIP              RTE_PTYPE_L2_ETHER
> +#define RTE_PTYPE_L2_ETHER_CNM              RTE_PTYPE_L2_ETHER
> +#define RTE_PTYPE_L2_ETHER_EAPOL            RTE_PTYPE_L2_ETHER
> +#define RTE_PTYPE_L2_ETHER_FILTER           RTE_PTYPE_L2_ETHER
> +
> +u32 *ngbe_get_supported_ptypes(void);
> +u32 ngbe_decode_ptype(u8 ptid);
> +u8 ngbe_encode_ptype(u32 ptype);
> +
> +/**
> + * PT(Packet Type, 32bits)
> + * - Bit 3:0 is for L2 types.
> + * - Bit 7:4 is for L3 or outer L3 (for tunneling case) types.
> + * - Bit 11:8 is for L4 or outer L4 (for tunneling case) types.
> + * - Bit 15:12 is for tunnel types.
> + * - Bit 19:16 is for inner L2 types.
> + * - Bit 23:20 is for inner L3 types.
> + * - Bit 27:24 is for inner L4 types.
> + * - Bit 31:28 is reserved.
> + * PT is a more accurate version of PTYPE
> + **/
> +#define NGBE_PT_ETHER                   0x00
> +#define NGBE_PT_IPV4                    0x01
> +#define NGBE_PT_IPV4_TCP                0x11
> +#define NGBE_PT_IPV4_UDP                0x21
> +#define NGBE_PT_IPV4_SCTP               0x41
> +#define NGBE_PT_IPV4_EXT                0x03
> +#define NGBE_PT_IPV4_EXT_TCP            0x13
> +#define NGBE_PT_IPV4_EXT_UDP            0x23
> +#define NGBE_PT_IPV4_EXT_SCTP           0x43
> +#define NGBE_PT_IPV6                    0x04
> +#define NGBE_PT_IPV6_TCP                0x14
> +#define NGBE_PT_IPV6_UDP                0x24
> +#define NGBE_PT_IPV6_SCTP               0x44
> +#define NGBE_PT_IPV6_EXT                0x0C
> +#define NGBE_PT_IPV6_EXT_TCP            0x1C
> +#define NGBE_PT_IPV6_EXT_UDP            0x2C
> +#define NGBE_PT_IPV6_EXT_SCTP           0x4C
> +#define NGBE_PT_IPV4_IPV6               0x05
> +#define NGBE_PT_IPV4_IPV6_TCP           0x15
> +#define NGBE_PT_IPV4_IPV6_UDP           0x25
> +#define NGBE_PT_IPV4_IPV6_SCTP          0x45
> +#define NGBE_PT_IPV4_EXT_IPV6           0x07
> +#define NGBE_PT_IPV4_EXT_IPV6_TCP       0x17
> +#define NGBE_PT_IPV4_EXT_IPV6_UDP       0x27
> +#define NGBE_PT_IPV4_EXT_IPV6_SCTP      0x47
> +#define NGBE_PT_IPV4_IPV6_EXT           0x0D
> +#define NGBE_PT_IPV4_IPV6_EXT_TCP       0x1D
> +#define NGBE_PT_IPV4_IPV6_EXT_UDP       0x2D
> +#define NGBE_PT_IPV4_IPV6_EXT_SCTP      0x4D
> +#define NGBE_PT_IPV4_EXT_IPV6_EXT       0x0F
> +#define NGBE_PT_IPV4_EXT_IPV6_EXT_TCP   0x1F
> +#define NGBE_PT_IPV4_EXT_IPV6_EXT_UDP   0x2F
> +#define NGBE_PT_IPV4_EXT_IPV6_EXT_SCTP  0x4F
> +
> +#define NGBE_PT_NVGRE                   0x00
> +#define NGBE_PT_NVGRE_IPV4              0x01
> +#define NGBE_PT_NVGRE_IPV4_TCP          0x11
> +#define NGBE_PT_NVGRE_IPV4_UDP          0x21
> +#define NGBE_PT_NVGRE_IPV4_SCTP         0x41
> +#define NGBE_PT_NVGRE_IPV4_EXT          0x03
> +#define NGBE_PT_NVGRE_IPV4_EXT_TCP      0x13
> +#define NGBE_PT_NVGRE_IPV4_EXT_UDP      0x23
> +#define NGBE_PT_NVGRE_IPV4_EXT_SCTP     0x43
> +#define NGBE_PT_NVGRE_IPV6              0x04
> +#define NGBE_PT_NVGRE_IPV6_TCP          0x14
> +#define NGBE_PT_NVGRE_IPV6_UDP          0x24
> +#define NGBE_PT_NVGRE_IPV6_SCTP         0x44
> +#define NGBE_PT_NVGRE_IPV6_EXT          0x0C
> +#define NGBE_PT_NVGRE_IPV6_EXT_TCP      0x1C
> +#define NGBE_PT_NVGRE_IPV6_EXT_UDP      0x2C
> +#define NGBE_PT_NVGRE_IPV6_EXT_SCTP     0x4C
> +#define NGBE_PT_NVGRE_IPV4_IPV6         0x05
> +#define NGBE_PT_NVGRE_IPV4_IPV6_TCP     0x15
> +#define NGBE_PT_NVGRE_IPV4_IPV6_UDP     0x25
> +#define NGBE_PT_NVGRE_IPV4_IPV6_EXT     0x0D
> +#define NGBE_PT_NVGRE_IPV4_IPV6_EXT_TCP 0x1D
> +#define NGBE_PT_NVGRE_IPV4_IPV6_EXT_UDP 0x2D
> +
> +#define NGBE_PT_VXLAN                   0x80
> +#define NGBE_PT_VXLAN_IPV4              0x81
> +#define NGBE_PT_VXLAN_IPV4_TCP          0x91
> +#define NGBE_PT_VXLAN_IPV4_UDP          0xA1
> +#define NGBE_PT_VXLAN_IPV4_SCTP         0xC1
> +#define NGBE_PT_VXLAN_IPV4_EXT          0x83
> +#define NGBE_PT_VXLAN_IPV4_EXT_TCP      0x93
> +#define NGBE_PT_VXLAN_IPV4_EXT_UDP      0xA3
> +#define NGBE_PT_VXLAN_IPV4_EXT_SCTP     0xC3
> +#define NGBE_PT_VXLAN_IPV6              0x84
> +#define NGBE_PT_VXLAN_IPV6_TCP          0x94
> +#define NGBE_PT_VXLAN_IPV6_UDP          0xA4
> +#define NGBE_PT_VXLAN_IPV6_SCTP         0xC4
> +#define NGBE_PT_VXLAN_IPV6_EXT          0x8C
> +#define NGBE_PT_VXLAN_IPV6_EXT_TCP      0x9C
> +#define NGBE_PT_VXLAN_IPV6_EXT_UDP      0xAC
> +#define NGBE_PT_VXLAN_IPV6_EXT_SCTP     0xCC
> +#define NGBE_PT_VXLAN_IPV4_IPV6         0x85
> +#define NGBE_PT_VXLAN_IPV4_IPV6_TCP     0x95
> +#define NGBE_PT_VXLAN_IPV4_IPV6_UDP     0xA5
> +#define NGBE_PT_VXLAN_IPV4_IPV6_EXT     0x8D
> +#define NGBE_PT_VXLAN_IPV4_IPV6_EXT_TCP 0x9D
> +#define NGBE_PT_VXLAN_IPV4_IPV6_EXT_UDP 0xAD
> +
> +#define NGBE_PT_MAX    256
> +extern const u32 ngbe_ptype_table[NGBE_PT_MAX];
> +extern const u32 ngbe_ptype_table_tn[NGBE_PT_MAX];
> +
> +
> +/* ether type filter list: one static filter per filter consumer. This is
> + *                 to avoid filter collisions later. Add new filters
> + *                 here!!
> + *      EAPOL 802.1x (0x888e): Filter 0
> + *      FCoE (0x8906):   Filter 2
> + *      1588 (0x88f7):   Filter 3
> + *      FIP  (0x8914):   Filter 4
> + *      LLDP (0x88CC):   Filter 5
> + *      LACP (0x8809):   Filter 6
> + *      FC   (0x8808):   Filter 7
> + */
> +#define NGBE_ETF_ID_EAPOL        0
> +#define NGBE_ETF_ID_FCOE         2
> +#define NGBE_ETF_ID_1588         3
> +#define NGBE_ETF_ID_FIP          4
> +#define NGBE_ETF_ID_LLDP         5
> +#define NGBE_ETF_ID_LACP         6
> +#define NGBE_ETF_ID_FC           7
> +#define NGBE_ETF_ID_MAX          8
> +
> +#define NGBE_PTID_ETF_MIN  0x18
> +#define NGBE_PTID_ETF_MAX  0x1F
> +static inline int ngbe_etflt_id(u8 ptid)
> +{
> +	if (ptid >= NGBE_PTID_ETF_MIN && ptid <= NGBE_PTID_ETF_MAX)
> +		return ptid - NGBE_PTID_ETF_MIN;
> +	else
> +		return -1;
> +}
> +
> +struct ngbe_udphdr {
> +	__be16	source;

rte_be* types should be used

> +	__be16	dest;
> +	__be16	len;
> +	__be16	check;
> +};
> +
> +struct ngbe_vxlanhdr {
> +	__be32 vx_flags;

rte_be* types should be used

> +	__be32 vx_vni;
> +};
> +
> +struct ngbe_genevehdr {
> +	u8 opt_len:6;
> +	u8 ver:2;
> +	u8 rsvd1:6;
> +	u8 critical:1;
> +	u8 oam:1;
> +	__be16 proto_type;

rte_be* types should be used

> +
> +	u8 vni[3];
> +	u8 rsvd2;
> +};
> +
> +struct ngbe_nvgrehdr {
> +	__be16 flags;

rte_be* types should be used

> +	__be16 proto;
> +	__be32 tni;
> +};
> +
> +#endif /* _NGBE_PTYPE_H_ */
> diff --git a/drivers/net/ngbe/ngbe_rxtx.h b/drivers/net/ngbe/ngbe_rxtx.h
> index 2db5cc3f2a..f30da10ae3 100644
> --- a/drivers/net/ngbe/ngbe_rxtx.h
> +++ b/drivers/net/ngbe/ngbe_rxtx.h
> @@ -74,7 +74,6 @@ struct ngbe_tx_desc {
>   		    sizeof(struct ngbe_rx_desc))
>   
>   #define NGBE_TX_MAX_SEG                    40
> -#define NGBE_PTID_MASK                     0xFF
>   
>   /**
>    * Structure associated with each descriptor of the RX ring of a RX queue.
> 


  reply	other threads:[~2021-06-14 19:06 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  9:40 [dpdk-dev] [PATCH v5 00/24] net: ngbe PMD Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 01/24] net/ngbe: add build and doc infrastructure Jiawen Wu
2021-06-14 17:05   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 02/24] net/ngbe: add device IDs Jiawen Wu
2021-06-14 17:08   ` Andrew Rybchenko
2021-06-15  2:52     ` Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 03/24] net/ngbe: support probe and remove Jiawen Wu
2021-06-14 17:27   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 04/24] net/ngbe: add device init and uninit Jiawen Wu
2021-06-14 17:36   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 05/24] net/ngbe: add log type and error type Jiawen Wu
2021-06-14 17:54   ` Andrew Rybchenko
2021-06-15  7:13     ` Jiawen Wu
2021-07-01 13:57   ` David Marchand
2021-07-02  2:08     ` Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 06/24] net/ngbe: define registers Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 07/24] net/ngbe: set MAC type and LAN id Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 08/24] net/ngbe: init and validate EEPROM Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 09/24] net/ngbe: add HW initialization Jiawen Wu
2021-06-14 18:01   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 10/24] net/ngbe: identify PHY and reset PHY Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 11/24] net/ngbe: store MAC address Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 12/24] net/ngbe: add info get operation Jiawen Wu
2021-06-14 18:13   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 13/24] net/ngbe: support link update Jiawen Wu
2021-06-14 18:45   ` Andrew Rybchenko
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 14/24] net/ngbe: setup the check PHY link Jiawen Wu
2021-06-02  9:40 ` [dpdk-dev] [PATCH v5 15/24] net/ngbe: add Rx queue setup and release Jiawen Wu
2021-06-14 18:53   ` Andrew Rybchenko
2021-06-15  7:50     ` Jiawen Wu
2021-06-15  8:06       ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 16/24] net/ngbe: add Tx " Jiawen Wu
2021-06-14 18:59   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 17/24] net/ngbe: add Rx and Tx init Jiawen Wu
2021-06-14 19:01   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 18/24] net/ngbe: add packet type Jiawen Wu
2021-06-14 19:06   ` Andrew Rybchenko [this message]
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 19/24] net/ngbe: add simple Rx and Tx flow Jiawen Wu
2021-06-14 19:10   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 20/24] net/ngbe: support bulk and scatter Rx Jiawen Wu
2021-06-14 19:17   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 21/24] net/ngbe: support full-featured Tx path Jiawen Wu
2021-06-14 19:22   ` Andrew Rybchenko
2021-06-14 19:23     ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 22/24] net/ngbe: add device start operation Jiawen Wu
2021-06-14 19:33   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 23/24] net/ngbe: start and stop RxTx Jiawen Wu
2021-06-14 20:44   ` Andrew Rybchenko
2021-06-02  9:41 ` [dpdk-dev] [PATCH v5 24/24] net/ngbe: add device stop operation Jiawen Wu
2021-06-11  1:38 ` [dpdk-dev] [PATCH v5 00/24] net: ngbe PMD Jiawen Wu
2021-06-14 20:56 ` Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22473a4d-9eef-d695-d8e5-ae2aab1ed122@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).