mbuf: use SPDX tags
[dpdk.git] / lib / librte_mbuf / rte_mbuf_ptype.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2016 Intel Corporation.
3  * Copyright 2014-2016 6WIND S.A.
4  */
5
6 #ifndef _RTE_MBUF_PTYPE_H_
7 #define _RTE_MBUF_PTYPE_H_
8
9 /**
10  * @file
11  * RTE Mbuf Packet Types
12  *
13  * This file contains declarations for features related to mbuf packet
14  * types. The packet type gives information about the data carried by the
15  * mbuf, and is stored in the mbuf in a 32 bits field.
16  *
17  * The 32 bits are divided into several fields to mark packet types. Note that
18  * each field is indexical.
19  * - Bit 3:0 is for L2 types.
20  * - Bit 7:4 is for L3 or outer L3 (for tunneling case) types.
21  * - Bit 11:8 is for L4 or outer L4 (for tunneling case) types.
22  * - Bit 15:12 is for tunnel types.
23  * - Bit 19:16 is for inner L2 types.
24  * - Bit 23:20 is for inner L3 types.
25  * - Bit 27:24 is for inner L4 types.
26  * - Bit 31:28 is reserved.
27  *
28  * To be compatible with Vector PMD, RTE_PTYPE_L3_IPV4, RTE_PTYPE_L3_IPV4_EXT,
29  * RTE_PTYPE_L3_IPV6, RTE_PTYPE_L3_IPV6_EXT, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP
30  * and RTE_PTYPE_L4_SCTP should be kept as below in a contiguous 7 bits.
31  *
32  * Note that L3 types values are selected for checking IPV4/IPV6 header from
33  * performance point of view. Reading annotations of RTE_ETH_IS_IPV4_HDR and
34  * RTE_ETH_IS_IPV6_HDR is needed for any future changes of L3 type values.
35  *
36  * Note that the packet types of the same packet recognized by different
37  * hardware may be different, as different hardware may have different
38  * capability of packet type recognition.
39  *
40  * examples:
41  * <'ether type'=0x0800
42  * | 'version'=4, 'protocol'=0x29
43  * | 'version'=6, 'next header'=0x3A
44  * | 'ICMPv6 header'>
45  * will be recognized on i40e hardware as packet type combination of,
46  * RTE_PTYPE_L2_ETHER |
47  * RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
48  * RTE_PTYPE_TUNNEL_IP |
49  * RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
50  * RTE_PTYPE_INNER_L4_ICMP.
51  *
52  * <'ether type'=0x86DD
53  * | 'version'=6, 'next header'=0x2F
54  * | 'GRE header'
55  * | 'version'=6, 'next header'=0x11
56  * | 'UDP header'>
57  * will be recognized on i40e hardware as packet type combination of,
58  * RTE_PTYPE_L2_ETHER |
59  * RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
60  * RTE_PTYPE_TUNNEL_GRENAT |
61  * RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
62  * RTE_PTYPE_INNER_L4_UDP.
63  */
64
65 #include <stddef.h>
66 #include <stdint.h>
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71
72 /**
73  * No packet type information.
74  */
75 #define RTE_PTYPE_UNKNOWN                   0x00000000
76 /**
77  * Ethernet packet type.
78  * It is used for outer packet for tunneling cases.
79  *
80  * Packet format:
81  * <'ether type'=[0x0800|0x86DD]>
82  */
83 #define RTE_PTYPE_L2_ETHER                  0x00000001
84 /**
85  * Ethernet packet type for time sync.
86  *
87  * Packet format:
88  * <'ether type'=0x88F7>
89  */
90 #define RTE_PTYPE_L2_ETHER_TIMESYNC         0x00000002
91 /**
92  * ARP (Address Resolution Protocol) packet type.
93  *
94  * Packet format:
95  * <'ether type'=0x0806>
96  */
97 #define RTE_PTYPE_L2_ETHER_ARP              0x00000003
98 /**
99  * LLDP (Link Layer Discovery Protocol) packet type.
100  *
101  * Packet format:
102  * <'ether type'=0x88CC>
103  */
104 #define RTE_PTYPE_L2_ETHER_LLDP             0x00000004
105 /**
106  * NSH (Network Service Header) packet type.
107  *
108  * Packet format:
109  * <'ether type'=0x894F>
110  */
111 #define RTE_PTYPE_L2_ETHER_NSH              0x00000005
112 /**
113  * VLAN packet type.
114  *
115  * Packet format:
116  * <'ether type'=[0x8100]>
117  */
118 #define RTE_PTYPE_L2_ETHER_VLAN             0x00000006
119 /**
120  * QinQ packet type.
121  *
122  * Packet format:
123  * <'ether type'=[0x88A8]>
124  */
125 #define RTE_PTYPE_L2_ETHER_QINQ             0x00000007
126 /**
127  * PPPOE packet type.
128  *
129  * Packet format:
130  * <'ether type'=[0x8863|0x8864]>
131  */
132 #define RTE_PTYPE_L2_ETHER_PPPOE            0x00000008
133 /**
134  * Mask of layer 2 packet types.
135  * It is used for outer packet for tunneling cases.
136  */
137 #define RTE_PTYPE_L2_MASK                   0x0000000f
138 /**
139  * IP (Internet Protocol) version 4 packet type.
140  * It is used for outer packet for tunneling cases, and does not contain any
141  * header option.
142  *
143  * Packet format:
144  * <'ether type'=0x0800
145  * | 'version'=4, 'ihl'=5>
146  */
147 #define RTE_PTYPE_L3_IPV4                   0x00000010
148 /**
149  * IP (Internet Protocol) version 4 packet type.
150  * It is used for outer packet for tunneling cases, and contains header
151  * options.
152  *
153  * Packet format:
154  * <'ether type'=0x0800
155  * | 'version'=4, 'ihl'=[6-15], 'options'>
156  */
157 #define RTE_PTYPE_L3_IPV4_EXT               0x00000030
158 /**
159  * IP (Internet Protocol) version 6 packet type.
160  * It is used for outer packet for tunneling cases, and does not contain any
161  * extension header.
162  *
163  * Packet format:
164  * <'ether type'=0x86DD
165  * | 'version'=6, 'next header'=0x3B>
166  */
167 #define RTE_PTYPE_L3_IPV6                   0x00000040
168 /**
169  * IP (Internet Protocol) version 4 packet type.
170  * It is used for outer packet for tunneling cases, and may or maynot contain
171  * header options.
172  *
173  * Packet format:
174  * <'ether type'=0x0800
175  * | 'version'=4, 'ihl'=[5-15], <'options'>>
176  */
177 #define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN       0x00000090
178 /**
179  * IP (Internet Protocol) version 6 packet type.
180  * It is used for outer packet for tunneling cases, and contains extension
181  * headers.
182  *
183  * Packet format:
184  * <'ether type'=0x86DD
185  * | 'version'=6, 'next header'=[0x0|0x2B|0x2C|0x32|0x33|0x3C|0x87],
186  *   'extension headers'>
187  */
188 #define RTE_PTYPE_L3_IPV6_EXT               0x000000c0
189 /**
190  * IP (Internet Protocol) version 6 packet type.
191  * It is used for outer packet for tunneling cases, and may or maynot contain
192  * extension headers.
193  *
194  * Packet format:
195  * <'ether type'=0x86DD
196  * | 'version'=6, 'next header'=[0x3B|0x0|0x2B|0x2C|0x32|0x33|0x3C|0x87],
197  *   <'extension headers'>>
198  */
199 #define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN       0x000000e0
200 /**
201  * Mask of layer 3 packet types.
202  * It is used for outer packet for tunneling cases.
203  */
204 #define RTE_PTYPE_L3_MASK                   0x000000f0
205 /**
206  * TCP (Transmission Control Protocol) packet type.
207  * It is used for outer packet for tunneling cases.
208  *
209  * Packet format:
210  * <'ether type'=0x0800
211  * | 'version'=4, 'protocol'=6, 'MF'=0, 'frag_offset'=0>
212  * or,
213  * <'ether type'=0x86DD
214  * | 'version'=6, 'next header'=6>
215  */
216 #define RTE_PTYPE_L4_TCP                    0x00000100
217 /**
218  * UDP (User Datagram Protocol) packet type.
219  * It is used for outer packet for tunneling cases.
220  *
221  * Packet format:
222  * <'ether type'=0x0800
223  * | 'version'=4, 'protocol'=17, 'MF'=0, 'frag_offset'=0>
224  * or,
225  * <'ether type'=0x86DD
226  * | 'version'=6, 'next header'=17>
227  */
228 #define RTE_PTYPE_L4_UDP                    0x00000200
229 /**
230  * Fragmented IP (Internet Protocol) packet type.
231  * It is used for outer packet for tunneling cases.
232  *
233  * It refers to those packets of any IP types, which can be recognized as
234  * fragmented. A fragmented packet cannot be recognized as any other L4 types
235  * (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP,
236  * RTE_PTYPE_L4_NONFRAG).
237  *
238  * Packet format:
239  * <'ether type'=0x0800
240  * | 'version'=4, 'MF'=1>
241  * or,
242  * <'ether type'=0x0800
243  * | 'version'=4, 'frag_offset'!=0>
244  * or,
245  * <'ether type'=0x86DD
246  * | 'version'=6, 'next header'=44>
247  */
248 #define RTE_PTYPE_L4_FRAG                   0x00000300
249 /**
250  * SCTP (Stream Control Transmission Protocol) packet type.
251  * It is used for outer packet for tunneling cases.
252  *
253  * Packet format:
254  * <'ether type'=0x0800
255  * | 'version'=4, 'protocol'=132, 'MF'=0, 'frag_offset'=0>
256  * or,
257  * <'ether type'=0x86DD
258  * | 'version'=6, 'next header'=132>
259  */
260 #define RTE_PTYPE_L4_SCTP                   0x00000400
261 /**
262  * ICMP (Internet Control Message Protocol) packet type.
263  * It is used for outer packet for tunneling cases.
264  *
265  * Packet format:
266  * <'ether type'=0x0800
267  * | 'version'=4, 'protocol'=1, 'MF'=0, 'frag_offset'=0>
268  * or,
269  * <'ether type'=0x86DD
270  * | 'version'=6, 'next header'=1>
271  */
272 #define RTE_PTYPE_L4_ICMP                   0x00000500
273 /**
274  * Non-fragmented IP (Internet Protocol) packet type.
275  * It is used for outer packet for tunneling cases.
276  *
277  * It refers to those packets of any IP types, while cannot be recognized as
278  * any of above L4 types (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP,
279  * RTE_PTYPE_L4_FRAG, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP).
280  *
281  * Packet format:
282  * <'ether type'=0x0800
283  * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
284  * or,
285  * <'ether type'=0x86DD
286  * | 'version'=6, 'next header'!=[6|17|44|132|1]>
287  */
288 #define RTE_PTYPE_L4_NONFRAG                0x00000600
289 /**
290  * Mask of layer 4 packet types.
291  * It is used for outer packet for tunneling cases.
292  */
293 #define RTE_PTYPE_L4_MASK                   0x00000f00
294 /**
295  * IP (Internet Protocol) in IP (Internet Protocol) tunneling packet type.
296  *
297  * Packet format:
298  * <'ether type'=0x0800
299  * | 'version'=4, 'protocol'=[4|41]>
300  * or,
301  * <'ether type'=0x86DD
302  * | 'version'=6, 'next header'=[4|41]>
303  */
304 #define RTE_PTYPE_TUNNEL_IP                 0x00001000
305 /**
306  * GRE (Generic Routing Encapsulation) tunneling packet type.
307  *
308  * Packet format:
309  * <'ether type'=0x0800
310  * | 'version'=4, 'protocol'=47>
311  * or,
312  * <'ether type'=0x86DD
313  * | 'version'=6, 'next header'=47>
314  */
315 #define RTE_PTYPE_TUNNEL_GRE                0x00002000
316 /**
317  * VXLAN (Virtual eXtensible Local Area Network) tunneling packet type.
318  *
319  * Packet format:
320  * <'ether type'=0x0800
321  * | 'version'=4, 'protocol'=17
322  * | 'destination port'=4789>
323  * or,
324  * <'ether type'=0x86DD
325  * | 'version'=6, 'next header'=17
326  * | 'destination port'=4789>
327  */
328 #define RTE_PTYPE_TUNNEL_VXLAN              0x00003000
329 /**
330  * NVGRE (Network Virtualization using Generic Routing Encapsulation) tunneling
331  * packet type.
332  *
333  * Packet format:
334  * <'ether type'=0x0800
335  * | 'version'=4, 'protocol'=47
336  * | 'protocol type'=0x6558>
337  * or,
338  * <'ether type'=0x86DD
339  * | 'version'=6, 'next header'=47
340  * | 'protocol type'=0x6558'>
341  */
342 #define RTE_PTYPE_TUNNEL_NVGRE              0x00004000
343 /**
344  * GENEVE (Generic Network Virtualization Encapsulation) tunneling packet type.
345  *
346  * Packet format:
347  * <'ether type'=0x0800
348  * | 'version'=4, 'protocol'=17
349  * | 'destination port'=6081>
350  * or,
351  * <'ether type'=0x86DD
352  * | 'version'=6, 'next header'=17
353  * | 'destination port'=6081>
354  */
355 #define RTE_PTYPE_TUNNEL_GENEVE             0x00005000
356 /**
357  * Tunneling packet type of Teredo, VXLAN (Virtual eXtensible Local Area
358  * Network) or GRE (Generic Routing Encapsulation) could be recognized as this
359  * packet type, if they can not be recognized independently as of hardware
360  * capability.
361  */
362 #define RTE_PTYPE_TUNNEL_GRENAT             0x00006000
363 /**
364  * GTP-C (GPRS Tunnelling Protocol) control tunneling packet type.
365  * Packet format:
366  * <'ether type'=0x0800
367  * | 'version'=4, 'protocol'=17
368  * | 'destination port'=2123>
369  * or,
370  * <'ether type'=0x86DD
371  * | 'version'=6, 'next header'=17
372  * | 'destination port'=2123>
373  * or,
374  * <'ether type'=0x0800
375  * | 'version'=4, 'protocol'=17
376  * | 'source port'=2123>
377  * or,
378  * <'ether type'=0x86DD
379  * | 'version'=6, 'next header'=17
380  * | 'source port'=2123>
381  */
382 #define RTE_PTYPE_TUNNEL_GTPC               0x00007000
383 /**
384  * GTP-U (GPRS Tunnelling Protocol) user data tunneling packet type.
385  * Packet format:
386  * <'ether type'=0x0800
387  * | 'version'=4, 'protocol'=17
388  * | 'destination port'=2152>
389  * or,
390  * <'ether type'=0x86DD
391  * | 'version'=6, 'next header'=17
392  * | 'destination port'=2152>
393  */
394 #define RTE_PTYPE_TUNNEL_GTPU               0x00008000
395 /**
396  * ESP (IP Encapsulating Security Payload) tunneling packet type.
397  *
398  * Packet format:
399  * <'ether type'=0x0800
400  * | 'version'=4, 'protocol'=51>
401  * or,
402  * <'ether type'=0x86DD
403  * | 'version'=6, 'next header'=51>
404  */
405 #define RTE_PTYPE_TUNNEL_ESP                0x00009000
406 /**
407  * L2TP (Layer 2 Tunneling Protocol) tunnleing packet type.
408  *
409  * Packet format:
410  * <'ether type'=0x0800
411  * | 'version'=4, 'protocol'=17>
412  * | 'destination port'=1701>
413  * or,
414  * <'ether type'=0x86DD
415  * | 'version'=6, 'next header'=17
416  * | 'destination port'=1701>
417  * or,
418  * <'ether type'=0x0800
419  * | 'version'=4, 'protocol'=115>
420  * or,
421  * <'ether type'=0x86DD
422  * | 'version'=6, 'protocol'=115>
423  */
424 #define RTE_PTYPE_TUNNEL_L2TP               0x0000a000
425 /**
426  * Mask of tunneling packet types.
427  */
428 #define RTE_PTYPE_TUNNEL_MASK               0x0000f000
429 /**
430  * Ethernet packet type.
431  * It is used for inner packet type only.
432  *
433  * Packet format (inner only):
434  * <'ether type'=[0x800|0x86DD]>
435  */
436 #define RTE_PTYPE_INNER_L2_ETHER            0x00010000
437 /**
438  * Ethernet packet type with VLAN (Virtual Local Area Network) tag.
439  *
440  * Packet format (inner only):
441  * <'ether type'=[0x800|0x86DD], vlan=[1-4095]>
442  */
443 #define RTE_PTYPE_INNER_L2_ETHER_VLAN       0x00020000
444 /**
445  * QinQ packet type.
446  *
447  * Packet format:
448  * <'ether type'=[0x88A8]>
449  */
450 #define RTE_PTYPE_INNER_L2_ETHER_QINQ       0x00030000
451 /**
452  * Mask of inner layer 2 packet types.
453  */
454 #define RTE_PTYPE_INNER_L2_MASK             0x000f0000
455 /**
456  * IP (Internet Protocol) version 4 packet type.
457  * It is used for inner packet only, and does not contain any header option.
458  *
459  * Packet format (inner only):
460  * <'ether type'=0x0800
461  * | 'version'=4, 'ihl'=5>
462  */
463 #define RTE_PTYPE_INNER_L3_IPV4             0x00100000
464 /**
465  * IP (Internet Protocol) version 4 packet type.
466  * It is used for inner packet only, and contains header options.
467  *
468  * Packet format (inner only):
469  * <'ether type'=0x0800
470  * | 'version'=4, 'ihl'=[6-15], 'options'>
471  */
472 #define RTE_PTYPE_INNER_L3_IPV4_EXT         0x00200000
473 /**
474  * IP (Internet Protocol) version 6 packet type.
475  * It is used for inner packet only, and does not contain any extension header.
476  *
477  * Packet format (inner only):
478  * <'ether type'=0x86DD
479  * | 'version'=6, 'next header'=0x3B>
480  */
481 #define RTE_PTYPE_INNER_L3_IPV6             0x00300000
482 /**
483  * IP (Internet Protocol) version 4 packet type.
484  * It is used for inner packet only, and may or maynot contain header options.
485  *
486  * Packet format (inner only):
487  * <'ether type'=0x0800
488  * | 'version'=4, 'ihl'=[5-15], <'options'>>
489  */
490 #define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
491 /**
492  * IP (Internet Protocol) version 6 packet type.
493  * It is used for inner packet only, and contains extension headers.
494  *
495  * Packet format (inner only):
496  * <'ether type'=0x86DD
497  * | 'version'=6, 'next header'=[0x0|0x2B|0x2C|0x32|0x33|0x3C|0x87],
498  *   'extension headers'>
499  */
500 #define RTE_PTYPE_INNER_L3_IPV6_EXT         0x00500000
501 /**
502  * IP (Internet Protocol) version 6 packet type.
503  * It is used for inner packet only, and may or maynot contain extension
504  * headers.
505  *
506  * Packet format (inner only):
507  * <'ether type'=0x86DD
508  * | 'version'=6, 'next header'=[0x3B|0x0|0x2B|0x2C|0x32|0x33|0x3C|0x87],
509  *   <'extension headers'>>
510  */
511 #define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
512 /**
513  * Mask of inner layer 3 packet types.
514  */
515 #define RTE_PTYPE_INNER_L3_MASK             0x00f00000
516 /**
517  * TCP (Transmission Control Protocol) packet type.
518  * It is used for inner packet only.
519  *
520  * Packet format (inner only):
521  * <'ether type'=0x0800
522  * | 'version'=4, 'protocol'=6, 'MF'=0, 'frag_offset'=0>
523  * or,
524  * <'ether type'=0x86DD
525  * | 'version'=6, 'next header'=6>
526  */
527 #define RTE_PTYPE_INNER_L4_TCP              0x01000000
528 /**
529  * UDP (User Datagram Protocol) packet type.
530  * It is used for inner packet only.
531  *
532  * Packet format (inner only):
533  * <'ether type'=0x0800
534  * | 'version'=4, 'protocol'=17, 'MF'=0, 'frag_offset'=0>
535  * or,
536  * <'ether type'=0x86DD
537  * | 'version'=6, 'next header'=17>
538  */
539 #define RTE_PTYPE_INNER_L4_UDP              0x02000000
540 /**
541  * Fragmented IP (Internet Protocol) packet type.
542  * It is used for inner packet only, and may or maynot have layer 4 packet.
543  *
544  * Packet format (inner only):
545  * <'ether type'=0x0800
546  * | 'version'=4, 'MF'=1>
547  * or,
548  * <'ether type'=0x0800
549  * | 'version'=4, 'frag_offset'!=0>
550  * or,
551  * <'ether type'=0x86DD
552  * | 'version'=6, 'next header'=44>
553  */
554 #define RTE_PTYPE_INNER_L4_FRAG             0x03000000
555 /**
556  * SCTP (Stream Control Transmission Protocol) packet type.
557  * It is used for inner packet only.
558  *
559  * Packet format (inner only):
560  * <'ether type'=0x0800
561  * | 'version'=4, 'protocol'=132, 'MF'=0, 'frag_offset'=0>
562  * or,
563  * <'ether type'=0x86DD
564  * | 'version'=6, 'next header'=132>
565  */
566 #define RTE_PTYPE_INNER_L4_SCTP             0x04000000
567 /**
568  * ICMP (Internet Control Message Protocol) packet type.
569  * It is used for inner packet only.
570  *
571  * Packet format (inner only):
572  * <'ether type'=0x0800
573  * | 'version'=4, 'protocol'=1, 'MF'=0, 'frag_offset'=0>
574  * or,
575  * <'ether type'=0x86DD
576  * | 'version'=6, 'next header'=1>
577  */
578 #define RTE_PTYPE_INNER_L4_ICMP             0x05000000
579 /**
580  * Non-fragmented IP (Internet Protocol) packet type.
581  * It is used for inner packet only, and may or maynot have other unknown layer
582  * 4 packet types.
583  *
584  * Packet format (inner only):
585  * <'ether type'=0x0800
586  * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
587  * or,
588  * <'ether type'=0x86DD
589  * | 'version'=6, 'next header'!=[6|17|44|132|1]>
590  */
591 #define RTE_PTYPE_INNER_L4_NONFRAG          0x06000000
592 /**
593  * Mask of inner layer 4 packet types.
594  */
595 #define RTE_PTYPE_INNER_L4_MASK             0x0f000000
596 /**
597  * All valid layer masks.
598  */
599 #define RTE_PTYPE_ALL_MASK                  0x0fffffff
600
601 /**
602  * Check if the (outer) L3 header is IPv4. To avoid comparing IPv4 types one by
603  * one, bit 4 is selected to be used for IPv4 only. Then checking bit 4 can
604  * determine if it is an IPV4 packet.
605  */
606 #define  RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4)
607
608 /**
609  * Check if the (outer) L3 header is IPv4. To avoid comparing IPv4 types one by
610  * one, bit 6 is selected to be used for IPv4 only. Then checking bit 6 can
611  * determine if it is an IPV4 packet.
612  */
613 #define  RTE_ETH_IS_IPV6_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV6)
614
615 /* Check if it is a tunneling packet */
616 #define RTE_ETH_IS_TUNNEL_PKT(ptype) ((ptype) &                         \
617         (RTE_PTYPE_TUNNEL_MASK |                                        \
618                 RTE_PTYPE_INNER_L2_MASK |                               \
619                 RTE_PTYPE_INNER_L3_MASK |                               \
620                 RTE_PTYPE_INNER_L4_MASK))
621
622 /**
623  * Get the name of the l2 packet type
624  *
625  * @param ptype
626  *   The packet type value.
627  * @return
628  *   A non-null string describing the packet type.
629  */
630 const char *rte_get_ptype_l2_name(uint32_t ptype);
631
632 /**
633  * Get the name of the l3 packet type
634  *
635  * @param ptype
636  *   The packet type value.
637  * @return
638  *   A non-null string describing the packet type.
639  */
640 const char *rte_get_ptype_l3_name(uint32_t ptype);
641
642 /**
643  * Get the name of the l4 packet type
644  *
645  * @param ptype
646  *   The packet type value.
647  * @return
648  *   A non-null string describing the packet type.
649  */
650 const char *rte_get_ptype_l4_name(uint32_t ptype);
651
652 /**
653  * Get the name of the tunnel packet type
654  *
655  * @param ptype
656  *   The packet type value.
657  * @return
658  *   A non-null string describing the packet type.
659  */
660 const char *rte_get_ptype_tunnel_name(uint32_t ptype);
661
662 /**
663  * Get the name of the inner_l2 packet type
664  *
665  * @param ptype
666  *   The packet type value.
667  * @return
668  *   A non-null string describing the packet type.
669  */
670 const char *rte_get_ptype_inner_l2_name(uint32_t ptype);
671
672 /**
673  * Get the name of the inner_l3 packet type
674  *
675  * @param ptype
676  *   The packet type value.
677  * @return
678  *   A non-null string describing the packet type.
679  */
680 const char *rte_get_ptype_inner_l3_name(uint32_t ptype);
681
682 /**
683  * Get the name of the inner_l4 packet type
684  *
685  * @param ptype
686  *   The packet type value.
687  * @return
688  *   A non-null string describing the packet type.
689  */
690 const char *rte_get_ptype_inner_l4_name(uint32_t ptype);
691
692 /**
693  * Write the packet type name into the buffer
694  *
695  * @param ptype
696  *   The packet type value.
697  * @param buf
698  *   The buffer where the string is written.
699  * @param buflen
700  *   The length of the buffer.
701  * @return
702  *   - 0 on success
703  *   - (-1) if the buffer is too small
704  */
705 int rte_get_ptype_name(uint32_t ptype, char *buf, size_t buflen);
706
707 #ifdef __cplusplus
708 }
709 #endif
710
711 #endif /* _RTE_MBUF_PTYPE_H_ */