X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fmpls%2Fpacket.h;h=8573bc3bef5feed3360474945e92c2e7fa36adb4;hb=038e1dfbd;hp=bc67445be8987aa004ee4c4028a88b4f868c3c54;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/mpls/packet.h b/src/vnet/mpls/packet.h index bc67445be89..8573bc3bef5 100644 --- a/src/vnet/mpls/packet.h +++ b/src/vnet/mpls/packet.h @@ -1,6 +1,3 @@ -#ifndef included_vnet_mpls_packet_h -#define included_vnet_mpls_packet_h - /* * MPLS packet format * @@ -18,6 +15,11 @@ * limitations under the License. */ +#ifndef included_vnet_mpls_packet_h +#define included_vnet_mpls_packet_h + +#include + /** * A label value only, i.e. 20bits. */ @@ -42,6 +44,32 @@ typedef enum mpls_eos_bit_t_ [MPLS_EOS] = "eos", \ } +/** + * The Default TTL added to MPLS label headers when no other value is available + */ +#define MPLS_LABEL_DEFAULT_TTL 64 + +/** + * The Default EXP added to MPLS label headers when no other value is available + */ +#define MPLS_LABEL_DEFAULT_EXP 0 + +/** + * When in uniform mode convert an IPv[46] DSCP value to an MPLS EXP value + */ +static inline u8 ip_dscp_to_mpls_exp (ip_dscp_t tos) +{ + return (tos >> 5); +} + +/** + * When in uniform mode convert an MPLS EXP value to an IPv[46] DSCP value + */ +static inline u8 mpls_exp_to_ip_dscp (u8 exp) +{ + return (exp << 5); +} + #define FOR_EACH_MPLS_EOS_BIT(_eos) \ for (_eos = MPLS_NON_EOS; _eos <= MPLS_EOS; _eos++)