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