DPDK  17.11.10
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 
404 #define RTE_PTYPE_TUNNEL_GTPC 0x00007000
405 
416 #define RTE_PTYPE_TUNNEL_GTPU 0x00008000
417 
427 #define RTE_PTYPE_TUNNEL_ESP 0x00009000
428 
431 #define RTE_PTYPE_TUNNEL_MASK 0x0000f000
432 
439 #define RTE_PTYPE_INNER_L2_ETHER 0x00010000
440 
446 #define RTE_PTYPE_INNER_L2_ETHER_VLAN 0x00020000
447 
453 #define RTE_PTYPE_INNER_L2_ETHER_QINQ 0x00030000
454 
457 #define RTE_PTYPE_INNER_L2_MASK 0x000f0000
458 
466 #define RTE_PTYPE_INNER_L3_IPV4 0x00100000
467 
475 #define RTE_PTYPE_INNER_L3_IPV4_EXT 0x00200000
476 
484 #define RTE_PTYPE_INNER_L3_IPV6 0x00300000
485 
493 #define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
494 
503 #define RTE_PTYPE_INNER_L3_IPV6_EXT 0x00500000
504 
514 #define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
515 
518 #define RTE_PTYPE_INNER_L3_MASK 0x00f00000
519 
530 #define RTE_PTYPE_INNER_L4_TCP 0x01000000
531 
542 #define RTE_PTYPE_INNER_L4_UDP 0x02000000
543 
557 #define RTE_PTYPE_INNER_L4_FRAG 0x03000000
558 
569 #define RTE_PTYPE_INNER_L4_SCTP 0x04000000
570 
581 #define RTE_PTYPE_INNER_L4_ICMP 0x05000000
582 
594 #define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000
595 
598 #define RTE_PTYPE_INNER_L4_MASK 0x0f000000
599 
602 #define RTE_PTYPE_ALL_MASK 0x0fffffff
603 
609 #define RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4)
610 
616 #define RTE_ETH_IS_IPV6_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV6)
617 
618 /* Check if it is a tunneling packet */
619 #define RTE_ETH_IS_TUNNEL_PKT(ptype) ((ptype) & \
620  (RTE_PTYPE_TUNNEL_MASK | \
621  RTE_PTYPE_INNER_L2_MASK | \
622  RTE_PTYPE_INNER_L3_MASK | \
623  RTE_PTYPE_INNER_L4_MASK))
624 
633 const char *rte_get_ptype_l2_name(uint32_t ptype);
634 
643 const char *rte_get_ptype_l3_name(uint32_t ptype);
644 
653 const char *rte_get_ptype_l4_name(uint32_t ptype);
654 
663 const char *rte_get_ptype_tunnel_name(uint32_t ptype);
664 
673 const char *rte_get_ptype_inner_l2_name(uint32_t ptype);
674 
683 const char *rte_get_ptype_inner_l3_name(uint32_t ptype);
684 
693 const char *rte_get_ptype_inner_l4_name(uint32_t ptype);
694 
708 int rte_get_ptype_name(uint32_t ptype, char *buf, size_t buflen);
709 
710 #ifdef __cplusplus
711 }
712 #endif
713 
714 #endif /* _RTE_MBUF_PTYPE_H_ */
const char * rte_get_ptype_inner_l4_name(uint32_t ptype)
const char * rte_get_ptype_tunnel_name(uint32_t ptype)
const char * rte_get_ptype_l2_name(uint32_t ptype)
const char * rte_get_ptype_inner_l2_name(uint32_t ptype)
const char * rte_get_ptype_l4_name(uint32_t ptype)
int rte_get_ptype_name(uint32_t ptype, char *buf, size_t buflen)
const char * rte_get_ptype_l3_name(uint32_t ptype)
const char * rte_get_ptype_inner_l3_name(uint32_t ptype)