xref: /dpdk/lib/net/rte_mpls.h (revision fba9875559906e04eaeb74532f4cfd51194259a2)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2016 6WIND S.A.
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson 
599a2dd95SBruce Richardson #ifndef _RTE_MPLS_H_
699a2dd95SBruce Richardson #define _RTE_MPLS_H_
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson /**
999a2dd95SBruce Richardson  * @file
1099a2dd95SBruce Richardson  *
1199a2dd95SBruce Richardson  * MPLS-related defines
1299a2dd95SBruce Richardson  */
1399a2dd95SBruce Richardson 
1499a2dd95SBruce Richardson #include <stdint.h>
1599a2dd95SBruce Richardson #include <rte_byteorder.h>
1699a2dd95SBruce Richardson 
1799a2dd95SBruce Richardson /**
1899a2dd95SBruce Richardson  * MPLS header.
1999a2dd95SBruce Richardson  */
2099a2dd95SBruce Richardson __extension__
21*fba98755SAndre Muezerie struct __rte_packed_begin rte_mpls_hdr {
227f9cf804SThomas Monjalon 	rte_be16_t tag_msb; /**< Label(msb). */
2399a2dd95SBruce Richardson #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
2499a2dd95SBruce Richardson 	uint8_t tag_lsb:4;  /**< Label(lsb). */
2599a2dd95SBruce Richardson 	uint8_t tc:3;       /**< Traffic class. */
2699a2dd95SBruce Richardson 	uint8_t bs:1;       /**< Bottom of stack. */
2799a2dd95SBruce Richardson #else
2899a2dd95SBruce Richardson 	uint8_t bs:1;       /**< Bottom of stack. */
2999a2dd95SBruce Richardson 	uint8_t tc:3;       /**< Traffic class. */
3099a2dd95SBruce Richardson 	uint8_t tag_lsb:4;  /**< label(lsb) */
3199a2dd95SBruce Richardson #endif
3299a2dd95SBruce Richardson 	uint8_t  ttl;       /**< Time to live. */
33*fba98755SAndre Muezerie } __rte_packed_end;
3499a2dd95SBruce Richardson 
3599a2dd95SBruce Richardson #endif /* RTE_MPLS_H_ */
36