DPDK  17.05.2
rte_mbuf_ptype.h
Go to the documentation of this file.
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 
94 #include <stddef.h>
95 #include <stdint.h>
96 
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100 
104 #define RTE_PTYPE_UNKNOWN 0x00000000
105 
112 #define RTE_PTYPE_L2_ETHER 0x00000001
113 
119 #define RTE_PTYPE_L2_ETHER_TIMESYNC 0x00000002
120 
126 #define RTE_PTYPE_L2_ETHER_ARP 0x00000003
127 
133 #define RTE_PTYPE_L2_ETHER_LLDP 0x00000004
134 
140 #define RTE_PTYPE_L2_ETHER_NSH 0x00000005
141 
147 #define RTE_PTYPE_L2_ETHER_VLAN 0x00000006
148 
154 #define RTE_PTYPE_L2_ETHER_QINQ 0x00000007
155 
159 #define RTE_PTYPE_L2_MASK 0x0000000f
160 
169 #define RTE_PTYPE_L3_IPV4 0x00000010
170 
179 #define RTE_PTYPE_L3_IPV4_EXT 0x00000030
180 
189 #define RTE_PTYPE_L3_IPV6 0x00000040
190 
199 #define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN 0x00000090
200 
210 #define RTE_PTYPE_L3_IPV6_EXT 0x000000c0
211 
221 #define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN 0x000000e0
222 
226 #define RTE_PTYPE_L3_MASK 0x000000f0
227 
238 #define RTE_PTYPE_L4_TCP 0x00000100
239 
250 #define RTE_PTYPE_L4_UDP 0x00000200
251 
270 #define RTE_PTYPE_L4_FRAG 0x00000300
271 
282 #define RTE_PTYPE_L4_SCTP 0x00000400
283 
294 #define RTE_PTYPE_L4_ICMP 0x00000500
295 
310 #define RTE_PTYPE_L4_NONFRAG 0x00000600
311 
315 #define RTE_PTYPE_L4_MASK 0x00000f00
316 
326 #define RTE_PTYPE_TUNNEL_IP 0x00001000
327 
337 #define RTE_PTYPE_TUNNEL_GRE 0x00002000
338 
350 #define RTE_PTYPE_TUNNEL_VXLAN 0x00003000
351 
364 #define RTE_PTYPE_TUNNEL_NVGRE 0x00004000
365 
377 #define RTE_PTYPE_TUNNEL_GENEVE 0x00005000
378 
384 #define RTE_PTYPE_TUNNEL_GRENAT 0x00006000
385 
388 #define RTE_PTYPE_TUNNEL_MASK 0x0000f000
389 
396 #define RTE_PTYPE_INNER_L2_ETHER 0x00010000
397 
403 #define RTE_PTYPE_INNER_L2_ETHER_VLAN 0x00020000
404 
410 #define RTE_PTYPE_INNER_L2_ETHER_QINQ 0x00030000
411 
414 #define RTE_PTYPE_INNER_L2_MASK 0x000f0000
415 
423 #define RTE_PTYPE_INNER_L3_IPV4 0x00100000
424 
432 #define RTE_PTYPE_INNER_L3_IPV4_EXT 0x00200000
433 
441 #define RTE_PTYPE_INNER_L3_IPV6 0x00300000
442 
450 #define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
451 
460 #define RTE_PTYPE_INNER_L3_IPV6_EXT 0x00500000
461 
471 #define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
472 
475 #define RTE_PTYPE_INNER_L3_MASK 0x00f00000
476 
487 #define RTE_PTYPE_INNER_L4_TCP 0x01000000
488 
499 #define RTE_PTYPE_INNER_L4_UDP 0x02000000
500 
514 #define RTE_PTYPE_INNER_L4_FRAG 0x03000000
515 
526 #define RTE_PTYPE_INNER_L4_SCTP 0x04000000
527 
538 #define RTE_PTYPE_INNER_L4_ICMP 0x05000000
539 
551 #define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000
552 
555 #define RTE_PTYPE_INNER_L4_MASK 0x0f000000
556 
559 #define RTE_PTYPE_ALL_MASK 0x0fffffff
560 
566 #define RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4)
567 
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 
590 const char *rte_get_ptype_l2_name(uint32_t ptype);
591 
600 const char *rte_get_ptype_l3_name(uint32_t ptype);
601 
610 const char *rte_get_ptype_l4_name(uint32_t ptype);
611 
620 const char *rte_get_ptype_tunnel_name(uint32_t ptype);
621 
630 const char *rte_get_ptype_inner_l2_name(uint32_t ptype);
631 
640 const char *rte_get_ptype_inner_l3_name(uint32_t ptype);
641 
650 const char *rte_get_ptype_inner_l4_name(uint32_t ptype);
651 
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_ */