diff mbox

[dpdk-dev,3/4] i40e:translate i40e packet types

Message ID 1416296251-7534-4-git-send-email-jijiang.liu@intel.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Jijiang Liu Nov. 18, 2014, 7:37 a.m. UTC
Translate i40e packet types to abstract packet types, and keep the usage of the PKT_RX_IPV4_HDR and the PKT_RX_IPV4_HDR as before in i40e driver.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_i40e/i40e_rxtx.c |  604 +++++++++++++++++++++------------------
 1 files changed, 332 insertions(+), 272 deletions(-)
diff mbox

Patch

diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 487591d..80f1bc0 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -142,272 +142,320 @@  i40e_rxd_error_to_pkt_flags(uint64_t qword)
 	return flags;
 }
 
-/* Translate pkt types to pkt flags */
-static inline uint64_t
-i40e_rxd_ptype_to_pkt_flags(uint64_t qword)
+static inline enum rte_eth_packet_type
+i40e_rxd_ptype_mapping(uint64_t qword)
 {
 	uint8_t ptype = (uint8_t)((qword & I40E_RXD_QW1_PTYPE_MASK) >>
 					I40E_RXD_QW1_PTYPE_SHIFT);
-	static const uint64_t ip_ptype_map[I40E_MAX_PKT_TYPE] = {
-		0, /* PTYPE 0 */
-		0, /* PTYPE 1 */
-		0, /* PTYPE 2 */
-		0, /* PTYPE 3 */
-		0, /* PTYPE 4 */
-		0, /* PTYPE 5 */
-		0, /* PTYPE 6 */
-		0, /* PTYPE 7 */
-		0, /* PTYPE 8 */
-		0, /* PTYPE 9 */
-		0, /* PTYPE 10 */
-		0, /* PTYPE 11 */
-		0, /* PTYPE 12 */
-		0, /* PTYPE 13 */
-		0, /* PTYPE 14 */
-		0, /* PTYPE 15 */
-		0, /* PTYPE 16 */
-		0, /* PTYPE 17 */
-		0, /* PTYPE 18 */
-		0, /* PTYPE 19 */
-		0, /* PTYPE 20 */
-		0, /* PTYPE 21 */
-		PKT_RX_IPV4_HDR, /* PTYPE 22 */
-		PKT_RX_IPV4_HDR, /* PTYPE 23 */
-		PKT_RX_IPV4_HDR, /* PTYPE 24 */
-		0, /* PTYPE 25 */
-		PKT_RX_IPV4_HDR, /* PTYPE 26 */
-		PKT_RX_IPV4_HDR, /* PTYPE 27 */
-		PKT_RX_IPV4_HDR, /* PTYPE 28 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 29 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 30 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 31 */
-		0, /* PTYPE 32 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 33 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 34 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 35 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 36 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 37 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 38 */
-		0, /* PTYPE 39 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 40 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 41 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 42 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 43 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 44 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 45 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 46 */
-		0, /* PTYPE 47 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 48 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 49 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 50 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 51 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 52 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 53 */
-		0, /* PTYPE 54 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 55 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 56 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 57 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 58 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 59 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 60 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 61 */
-		0, /* PTYPE 62 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 63 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 64 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 65 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 66 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 67 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 68 */
-		0, /* PTYPE 69 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 70 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 71 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 72 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 73 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 74 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 75 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 76 */
-		0, /* PTYPE 77 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 78 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 79 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 80 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 81 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 82 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 83 */
-		0, /* PTYPE 84 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 85 */
-		PKT_RX_TUNNEL_IPV4_HDR, /* PTYPE 86 */
-		PKT_RX_IPV4_HDR_EXT, /* PTYPE 87 */
-		PKT_RX_IPV6_HDR, /* PTYPE 88 */
-		PKT_RX_IPV6_HDR, /* PTYPE 89 */
-		PKT_RX_IPV6_HDR, /* PTYPE 90 */
-		0, /* PTYPE 91 */
-		PKT_RX_IPV6_HDR, /* PTYPE 92 */
-		PKT_RX_IPV6_HDR, /* PTYPE 93 */
-		PKT_RX_IPV6_HDR, /* PTYPE 94 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 95 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 96 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 97 */
-		0, /* PTYPE 98 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 99 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 100 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 101 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 102 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 103 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 104 */
-		0, /* PTYPE 105 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 106 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 107 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 108 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 109 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 110 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 111 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 112 */
-		0, /* PTYPE 113 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 114 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 115 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 116 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 117 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 118 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 119 */
-		0, /* PTYPE 120 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 121 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 122 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 123 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 124 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 125 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 126 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 127 */
-		0, /* PTYPE 128 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 129 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 130 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 131 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 132 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 133 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 134 */
-		0, /* PTYPE 135 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 136 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 137 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 138 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 139 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 140 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 141 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 142 */
-		0, /* PTYPE 143 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 144 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 145 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 146 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 147 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 148 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 149 */
-		0, /* PTYPE 150 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 151 */
-		PKT_RX_TUNNEL_IPV6_HDR, /* PTYPE 152 */
-		PKT_RX_IPV6_HDR_EXT, /* PTYPE 153 */
-		0, /* PTYPE 154 */
-		0, /* PTYPE 155 */
-		0, /* PTYPE 156 */
-		0, /* PTYPE 157 */
-		0, /* PTYPE 158 */
-		0, /* PTYPE 159 */
-		0, /* PTYPE 160 */
-		0, /* PTYPE 161 */
-		0, /* PTYPE 162 */
-		0, /* PTYPE 163 */
-		0, /* PTYPE 164 */
-		0, /* PTYPE 165 */
-		0, /* PTYPE 166 */
-		0, /* PTYPE 167 */
-		0, /* PTYPE 168 */
-		0, /* PTYPE 169 */
-		0, /* PTYPE 170 */
-		0, /* PTYPE 171 */
-		0, /* PTYPE 172 */
-		0, /* PTYPE 173 */
-		0, /* PTYPE 174 */
-		0, /* PTYPE 175 */
-		0, /* PTYPE 176 */
-		0, /* PTYPE 177 */
-		0, /* PTYPE 178 */
-		0, /* PTYPE 179 */
-		0, /* PTYPE 180 */
-		0, /* PTYPE 181 */
-		0, /* PTYPE 182 */
-		0, /* PTYPE 183 */
-		0, /* PTYPE 184 */
-		0, /* PTYPE 185 */
-		0, /* PTYPE 186 */
-		0, /* PTYPE 187 */
-		0, /* PTYPE 188 */
-		0, /* PTYPE 189 */
-		0, /* PTYPE 190 */
-		0, /* PTYPE 191 */
-		0, /* PTYPE 192 */
-		0, /* PTYPE 193 */
-		0, /* PTYPE 194 */
-		0, /* PTYPE 195 */
-		0, /* PTYPE 196 */
-		0, /* PTYPE 197 */
-		0, /* PTYPE 198 */
-		0, /* PTYPE 199 */
-		0, /* PTYPE 200 */
-		0, /* PTYPE 201 */
-		0, /* PTYPE 202 */
-		0, /* PTYPE 203 */
-		0, /* PTYPE 204 */
-		0, /* PTYPE 205 */
-		0, /* PTYPE 206 */
-		0, /* PTYPE 207 */
-		0, /* PTYPE 208 */
-		0, /* PTYPE 209 */
-		0, /* PTYPE 210 */
-		0, /* PTYPE 211 */
-		0, /* PTYPE 212 */
-		0, /* PTYPE 213 */
-		0, /* PTYPE 214 */
-		0, /* PTYPE 215 */
-		0, /* PTYPE 216 */
-		0, /* PTYPE 217 */
-		0, /* PTYPE 218 */
-		0, /* PTYPE 219 */
-		0, /* PTYPE 220 */
-		0, /* PTYPE 221 */
-		0, /* PTYPE 222 */
-		0, /* PTYPE 223 */
-		0, /* PTYPE 224 */
-		0, /* PTYPE 225 */
-		0, /* PTYPE 226 */
-		0, /* PTYPE 227 */
-		0, /* PTYPE 228 */
-		0, /* PTYPE 229 */
-		0, /* PTYPE 230 */
-		0, /* PTYPE 231 */
-		0, /* PTYPE 232 */
-		0, /* PTYPE 233 */
-		0, /* PTYPE 234 */
-		0, /* PTYPE 235 */
-		0, /* PTYPE 236 */
-		0, /* PTYPE 237 */
-		0, /* PTYPE 238 */
-		0, /* PTYPE 239 */
-		0, /* PTYPE 240 */
-		0, /* PTYPE 241 */
-		0, /* PTYPE 242 */
-		0, /* PTYPE 243 */
-		0, /* PTYPE 244 */
-		0, /* PTYPE 245 */
-		0, /* PTYPE 246 */
-		0, /* PTYPE 247 */
-		0, /* PTYPE 248 */
-		0, /* PTYPE 249 */
-		0, /* PTYPE 250 */
-		0, /* PTYPE 251 */
-		0, /* PTYPE 252 */
-		0, /* PTYPE 253 */
-		0, /* PTYPE 254 */
-		0, /* PTYPE 255 */
+	static const enum rte_eth_packet_type ptype_map[I40E_MAX_PKT_TYPE] = {
+		RTE_PTYPE_UNDEF, /* PTYPE 0 */
+		RTE_PTYPE_PAY2,
+		RTE_PTYPE_TimeSync_PAY2,
+		RTE_PTYPE_FIP_PAY2,
+		RTE_PTYPE_UNDEF, /* PTYPE 4 */
+		RTE_PTYPE_UNDEF, /* PTYPE 5 */
+		RTE_PTYPE_LLD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PE_IPv4_GRENAT_PAY3,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> IPv4 */
+		RTE_PTYPE_IPv4_GRENAT_IPv4FRAG,
+		RTE_PTYPE_IPv4_GRENAT_IPv4,
+		RTE_PTYPE_IPv4_GRENAT_IPv4_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 47 */
+		RTE_PTYPE_IPv4_GRENAT_IPv4_TCP,
+		RTE_PTYPE_IPv4_GRENAT_IPv4_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_IPv4_ICMP,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> IPv6 */
+		RTE_PTYPE_IPv4_GRENAT_IPv6FRAG,
+		RTE_PTYPE_IPv4_GRENAT_IPv6,
+		RTE_PTYPE_IPv4_GRENAT_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 54 */
+		RTE_PTYPE_IPv4_GRENAT_IPv6_TCP,
+		RTE_PTYPE_IPv4_GRENAT_IPv6_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_IPv6_ICMP,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC */
+		RTE_PTYPE_IPv4_GRENAT_MAC_PAY3,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4FRAG,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 62 */
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4_TCP,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv4_ICMP,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6FRAG,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 69 */
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6_TCP,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_MAC_IPv6_ICMP,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC/VLAN */
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_PAY3,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC/VLAN --> IPv4 */
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4FRAG,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 77 */
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4_TCP,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv4_ICMP,
+
+		/* IPv4 --> GRE/Teredo/VXLAN --> MAC/VLAN --> IPv6 */
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6FRAG,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 84 */
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6_TCP,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6_SCTP,
+		RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6_ICMP,
+
+		/* Non Tunneled IPv6 */
+		RTE_PTYPE_IPv6FRAG,
+		RTE_PTYPE_IPv6,
+		RTE_PTYPE_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 91 */
+		RTE_PTYPE_IPv6_TCP,
+		RTE_PTYPE_IPv6_S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ICMP,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC */
+		RTE_PTYPE_IPv6_GRENAT_MAC_PAY3,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4FRAG,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 128 */
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4_TCP,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4_SCTP,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv4_ICMP,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6FRAG,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 135 */
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6_TCP,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6_SCTP,
+		RTE_PTYPE_IPv6_GRENAT_MAC_IPv6_ICMP,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC/VLAN */
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_PAY3,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC/VLAN --> IPv4 */
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4FRAG,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 143 */
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4_TCP,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4_SCTP,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv4_ICMP,
+
+		/* IPv6 --> GRE/Teredo/VXLAN --> MAC/VLAN --> IPv6 */
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6FRAG,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6_UDP,
+		RTE_PTYPE_UNDEF, /* PTYPE 150 */
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6_TCP,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6_SCTP,
+		RTE_PTYPE_IPv6_GRENAT_MACVLAN_IPv6_ICMP,
+
+		RTE_PTYPE_UNDEF, /* PTYPE 154 */
+		RTE_PTYPE_UNDEF, /* PTYPE 155 */
+		RTE_PTYPE_UNDEF, /* PTYPE 156 */
+		RTE_PTYPE_UNDEF, /* PTYPE 157 */
+		RTE_PTYPE_UNDEF, /* PTYPE 158 */
+		RTE_PTYPE_UNDEF, /* PTYPE 159 */
+		RTE_PTYPE_UNDEF, /* PTYPE 160 */
+		RTE_PTYPE_UNDEF, /* PTYPE 161 */
+		RTE_PTYPE_UNDEF, /* PTYPE 162 */
+		RTE_PTYPE_UNDEF, /* PTYPE 163 */
+		RTE_PTYPE_UNDEF, /* PTYPE 164 */
+		RTE_PTYPE_UNDEF, /* PTYPE 165 */
+		RTE_PTYPE_UNDEF, /* PTYPE 166 */
+		RTE_PTYPE_UNDEF, /* PTYPE 167 */
+		RTE_PTYPE_UNDEF, /* PTYPE 168 */
+		RTE_PTYPE_UNDEF, /* PTYPE 169 */
+		RTE_PTYPE_UNDEF, /* PTYPE 170 */
+		RTE_PTYPE_UNDEF, /* PTYPE 171 */
+		RTE_PTYPE_UNDEF, /* PTYPE 172 */
+		RTE_PTYPE_UNDEF, /* PTYPE 173 */
+		RTE_PTYPE_UNDEF, /* PTYPE 174 */
+		RTE_PTYPE_UNDEF, /* PTYPE 175 */
+		RTE_PTYPE_UNDEF, /* PTYPE 176 */
+		RTE_PTYPE_UNDEF, /* PTYPE 177 */
+		RTE_PTYPE_UNDEF, /* PTYPE 178 */
+		RTE_PTYPE_UNDEF, /* PTYPE 179 */
+		RTE_PTYPE_UNDEF, /* PTYPE 180 */
+		RTE_PTYPE_UNDEF, /* PTYPE 181 */
+		RTE_PTYPE_UNDEF, /* PTYPE 182 */
+		RTE_PTYPE_UNDEF, /* PTYPE 183 */
+		RTE_PTYPE_UNDEF, /* PTYPE 184 */
+		RTE_PTYPE_UNDEF, /* PTYPE 185 */
+		RTE_PTYPE_UNDEF, /* PTYPE 186 */
+		RTE_PTYPE_UNDEF, /* PTYPE 187 */
+		RTE_PTYPE_UNDEF, /* PTYPE 188 */
+		RTE_PTYPE_UNDEF, /* PTYPE 189 */
+		RTE_PTYPE_UNDEF, /* PTYPE 190 */
+		RTE_PTYPE_UNDEF, /* PTYPE 191 */
+		RTE_PTYPE_UNDEF, /* PTYPE 192 */
+		RTE_PTYPE_UNDEF, /* PTYPE 193 */
+		RTE_PTYPE_UNDEF, /* PTYPE 194 */
+		RTE_PTYPE_UNDEF, /* PTYPE 195 */
+		RTE_PTYPE_UNDEF, /* PTYPE 196 */
+		RTE_PTYPE_UNDEF, /* PTYPE 197 */
+		RTE_PTYPE_UNDEF, /* PTYPE 198 */
+		RTE_PTYPE_UNDEF, /* PTYPE 199 */
+		RTE_PTYPE_UNDEF, /* PTYPE 200 */
+		RTE_PTYPE_UNDEF, /* PTYPE 201 */
+		RTE_PTYPE_UNDEF, /* PTYPE 202 */
+		RTE_PTYPE_UNDEF, /* PTYPE 203 */
+		RTE_PTYPE_UNDEF, /* PTYPE 204 */
+		RTE_PTYPE_UNDEF, /* PTYPE 205 */
+		RTE_PTYPE_UNDEF, /* PTYPE 206 */
+		RTE_PTYPE_UNDEF, /* PTYPE 207 */
+		RTE_PTYPE_UNDEF, /* PTYPE 208 */
+		RTE_PTYPE_UNDEF, /* PTYPE 209 */
+		RTE_PTYPE_UNDEF, /* PTYPE 210 */
+		RTE_PTYPE_UNDEF, /* PTYPE 211 */
+		RTE_PTYPE_UNDEF, /* PTYPE 212 */
+		RTE_PTYPE_UNDEF, /* PTYPE 213 */
+		RTE_PTYPE_UNDEF, /* PTYPE 214 */
+		RTE_PTYPE_UNDEF, /* PTYPE 215 */
+		RTE_PTYPE_UNDEF, /* PTYPE 216 */
+		RTE_PTYPE_UNDEF, /* PTYPE 217 */
+		RTE_PTYPE_UNDEF, /* PTYPE 218 */
+		RTE_PTYPE_UNDEF, /* PTYPE 219 */
+		RTE_PTYPE_UNDEF, /* PTYPE 220 */
+		RTE_PTYPE_UNDEF, /* PTYPE 221 */
+		RTE_PTYPE_UNDEF, /* PTYPE 222 */
+		RTE_PTYPE_UNDEF, /* PTYPE 223 */
+		RTE_PTYPE_UNDEF, /* PTYPE 224 */
+		RTE_PTYPE_UNDEF, /* PTYPE 225 */
+		RTE_PTYPE_UNDEF, /* PTYPE 226 */
+		RTE_PTYPE_UNDEF, /* PTYPE 227 */
+		RTE_PTYPE_UNDEF, /* PTYPE 228 */
+		RTE_PTYPE_UNDEF, /* PTYPE 229 */
+		RTE_PTYPE_UNDEF, /* PTYPE 230 */
+		RTE_PTYPE_UNDEF, /* PTYPE 231 */
+		RTE_PTYPE_UNDEF, /* PTYPE 232 */
+		RTE_PTYPE_UNDEF, /* PTYPE 233 */
+		RTE_PTYPE_UNDEF, /* PTYPE 234 */
+		RTE_PTYPE_UNDEF, /* PTYPE 235 */
+		RTE_PTYPE_UNDEF, /* PTYPE 236 */
+		RTE_PTYPE_UNDEF, /* PTYPE 237 */
+		RTE_PTYPE_UNDEF, /* PTYPE 238 */
+		RTE_PTYPE_UNDEF, /* PTYPE 239 */
+		RTE_PTYPE_UNDEF, /* PTYPE 240 */
+		RTE_PTYPE_UNDEF, /* PTYPE 241 */
+		RTE_PTYPE_UNDEF, /* PTYPE 242 */
+		RTE_PTYPE_UNDEF, /* PTYPE 243 */
+		RTE_PTYPE_UNDEF, /* PTYPE 244 */
+		RTE_PTYPE_UNDEF, /* PTYPE 245 */
+		RTE_PTYPE_UNDEF, /* PTYPE 246 */
+		RTE_PTYPE_UNDEF, /* PTYPE 247 */
+		RTE_PTYPE_UNDEF, /* PTYPE 248 */
+		RTE_PTYPE_UNDEF, /* PTYPE 249 */
+		RTE_PTYPE_UNDEF, /* PTYPE 250 */
+		RTE_PTYPE_UNDEF, /* PTYPE 251 */
+		RTE_PTYPE_UNDEF, /* PTYPE 252 */
+		RTE_PTYPE_UNDEF, /* PTYPE 253 */
+		RTE_PTYPE_UNDEF, /* PTYPE 254 */
+		RTE_PTYPE_UNDEF, /* PTYPE 255 */
 	};
 
-	return ip_ptype_map[ptype];
+	return ptype_map[ptype];
 }
 
 static inline void
@@ -605,6 +653,7 @@  i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
 	volatile union i40e_rx_desc *rxdp;
 	struct i40e_rx_entry *rxep;
 	struct rte_mbuf *mb;
+	enum rte_eth_packet_type packet_type;
 	uint16_t pkt_len;
 	uint64_t qword1;
 	uint32_t rx_status;
@@ -660,12 +709,15 @@  i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
 				rxdp[j].wb.qword0.lo_dword.l2tag1) : 0;
 			pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
 			pkt_flags |= i40e_rxd_error_to_pkt_flags(qword1);
-			pkt_flags |= i40e_rxd_ptype_to_pkt_flags(qword1);
+			packet_type = i40e_rxd_ptype_mapping(qword1);
+			mb->packet_type = (uint16_t) packet_type;
+			if (RTE_ETH_IS_IPV4_HDR(packet_type))
+				pkt_flags |= PKT_RX_IPV4_HDR;
+			else if (RTE_ETH_IS_IPV6_HDR(packet_type))
+				pkt_flags |= PKT_RX_IPV6_HDR;
+
 			mb->ol_flags = pkt_flags;
 
-			mb->packet_type = (uint16_t)((qword1 &
-					I40E_RXD_QW1_PTYPE_MASK) >>
-					I40E_RXD_QW1_PTYPE_SHIFT);
 			if (pkt_flags & PKT_RX_RSS_HASH)
 				mb->hash.rss = rte_le_to_cpu_32(\
 					rxdp->wb.qword0.hi_dword.rss);
@@ -830,6 +882,7 @@  i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	struct i40e_rx_entry *rxe;
 	struct rte_mbuf *rxm;
 	struct rte_mbuf *nmb;
+	enum rte_eth_packet_type packet_type;
 	uint16_t nb_rx;
 	uint32_t rx_status;
 	uint64_t qword1;
@@ -900,9 +953,13 @@  i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
 		pkt_flags |= i40e_rxd_error_to_pkt_flags(qword1);
-		pkt_flags |= i40e_rxd_ptype_to_pkt_flags(qword1);
-		rxm->packet_type = (uint16_t)((qword1 & I40E_RXD_QW1_PTYPE_MASK) >>
-				I40E_RXD_QW1_PTYPE_SHIFT);
+		packet_type = i40e_rxd_ptype_mapping(qword1);
+		rxm->packet_type = (uint16_t)packet_type;
+		if (RTE_ETH_IS_IPV4_HDR(packet_type))
+			pkt_flags |= PKT_RX_IPV4_HDR;
+		else if (RTE_ETH_IS_IPV6_HDR(packet_type))
+			pkt_flags |= PKT_RX_IPV6_HDR;
+
 		rxm->ol_flags = pkt_flags;
 		if (pkt_flags & PKT_RX_RSS_HASH)
 			rxm->hash.rss =
@@ -938,6 +995,7 @@  i40e_recv_scattered_pkts(void *rx_queue,
 	struct i40e_rx_queue *rxq = rx_queue;
 	volatile union i40e_rx_desc *rx_ring = rxq->rx_ring;
 	volatile union i40e_rx_desc *rxdp;
+	enum rte_eth_packet_type packet_type;
 	union i40e_rx_desc rxd;
 	struct i40e_rx_entry *sw_ring = rxq->sw_ring;
 	struct i40e_rx_entry *rxe;
@@ -1056,10 +1114,12 @@  i40e_recv_scattered_pkts(void *rx_queue,
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
 		pkt_flags |= i40e_rxd_error_to_pkt_flags(qword1);
-		pkt_flags |= i40e_rxd_ptype_to_pkt_flags(qword1);
-		first_seg->packet_type = (uint16_t)((qword1 &
-					I40E_RXD_QW1_PTYPE_MASK) >>
-					I40E_RXD_QW1_PTYPE_SHIFT);
+		packet_type = i40e_rxd_ptype_mapping(qword1);
+		first_seg->packet_type = (uint16_t) packet_type;
+		if (RTE_ETH_IS_IPV4_HDR(packet_type))
+			pkt_flags |= PKT_RX_IPV4_HDR;
+		else if (RTE_ETH_IS_IPV6_HDR(packet_type))
+			pkt_flags |= PKT_RX_IPV6_HDR;
 		first_seg->ol_flags = pkt_flags;
 		if (pkt_flags & PKT_RX_RSS_HASH)
 			rxm->hash.rss =