net: add MPLS header structure
[dpdk.git] / lib / librte_net / rte_mpls.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016 6WIND S.A.
3  */
4
5 #ifndef _RTE_MPLS_H_
6 #define _RTE_MPLS_H_
7
8 /**
9  * @file
10  *
11  * MPLS-related defines
12  */
13
14 #include <stdint.h>
15 #include <rte_byteorder.h>
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /**
22  * MPLS header.
23  */
24 struct mpls_hdr {
25         uint16_t tag_msb;   /**< Label(msb). */
26 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
27         uint8_t tag_lsb:4;  /**< Label(lsb). */
28         uint8_t tc:3;       /**< Traffic class. */
29         uint8_t bs:1;       /**< Bottom of stack. */
30 #else
31         uint8_t bs:1;       /**< Bottom of stack. */
32         uint8_t tc:3;       /**< Traffic class. */
33         uint8_t tag_lsb:4;  /**< label(lsb) */
34 #endif
35         uint8_t  ttl;       /**< Time to live. */
36 } __attribute__((__packed__));
37
38 #ifdef __cplusplus
39 }
40 #endif
41
42 #endif /* RTE_MPLS_H_ */