MPLS Unifom mode
[vpp.git] / src / vnet / mpls / mpls_types.h
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __MPLS_TYPES_H__
16 #define __MPLS_TYPES_H__
17
18 #define MPLS_IETF_MIN_LABEL                  0x00000
19 #define MPLS_IETF_MAX_LABEL                  0xfffff
20
21 #define MPLS_IETF_MIN_RESERVED_LABEL         0x00000
22 #define MPLS_IETF_MAX_RESERVED_LABEL         0x0000f
23
24 #define MPLS_IETF_MIN_UNRES_LABEL            0x00010
25 #define MPLS_IETF_MAX_UNRES_LABEL            0xfffff
26
27 #define MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL   0x00000
28 #define MPLS_IETF_ROUTER_ALERT_LABEL         0x00001
29 #define MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL   0x00002
30 #define MPLS_IETF_IMPLICIT_NULL_LABEL        0x00003
31 #define MPLS_IETF_ELI_LABEL                  0x00007
32 #define MPLS_IETF_GAL_LABEL                  0x0000D
33 #define MPLS_IETF_ENTROPY_LABEL              0x0000E
34
35 #define MPLS_IETF_IPV4_EXPLICIT_NULL_STRING          "ip4-explicit-null"
36 #define MPLS_IETF_IPV4_EXPLICIT_NULL_BRIEF_STRING    "e-nul"
37 #define MPLS_IETF_IMPLICIT_NULL_STRING               "implicit-null"
38 #define MPLS_IETF_IMPLICIT_NULL_BRIEF_STRING         "i-nul"
39 #define MPLS_IETF_ROUTER_ALERT_STRING                "router-alert"
40 #define MPLS_IETF_ROUTER_ALERT_BRIEF_STRING          "r-alt"
41 #define MPLS_IETF_IPV6_EXPLICIT_NULL_STRING          "ipv6-explicit-null"
42 #define MPLS_IETF_IPV6_EXPLICIT_NULL_BRIEF_STRING    "v6enl"
43 #define MPLS_IETF_ELI_STRING                         "entropy-label-indicator"
44 #define MPLS_IETF_ELI_BRIEF_STRING                   "eli"
45 #define MPLS_IETF_GAL_STRING                         "gal"
46 #define MPLS_IETF_GAL_BRIEF_STRING                   "gal"
47
48 #define MPLS_LABEL_INVALID (MPLS_IETF_MAX_LABEL+1)
49
50 /**
51  * A value that is explicit about the end of the LSP. Specifying
52  * a label value is needed when the mode configuration (pipe/uniform)
53  * is also requested.
54  * imp-null implies a label swap. pop can be used for a deag.
55  */
56 #define MPLS_LABEL_POP (MPLS_IETF_MAX_LABEL+2)
57
58 #define MPLS_LABEL_IS_REAL(_lbl) \
59     (((_lbl) > MPLS_IETF_MIN_UNRES_LABEL) &&    \
60      ((_lbl) <= MPLS_IETF_MAX_UNRES_LABEL))
61
62 /**
63  * The top bit of the index, which is the result of the MPLS lookup
64  * is used to determine if the DPO is a load-balance or a replicate
65  */
66 #define MPLS_IS_REPLICATE 0x80000000
67
68 #endif