Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
openapi_mpls.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2018 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_mpls.h
28 *
29 * @purpose MPLS Configuration and Status
30 *
31 * @component OpEN
32 *
33 * @create 01/16/2014
34 *
35 * @end
36 *
37 **********************************************************************/
38 #ifndef OPENAPI_MPLS_H_INCLUDED
39 #define OPENAPI_MPLS_H_INCLUDED
40 
41 #include <stdio.h>
42 #include <stddef.h>
43 #include <sys/un.h>
44 
45 #include "openapi_common.h"
46 
47 #define OPEN_MAX_MPLS_IMPOSE_LABELS 3
48 
50 typedef enum
51 {
57 
59 typedef enum
60 {
66 
68 typedef enum
69 {
74 
76 typedef enum
77 {
82 
84 typedef enum
85 {
94 
95 /* MPLS label stack */
96 typedef struct
97 {
98  uint32_t label[OPEN_MAX_MPLS_IMPOSE_LABELS];
100 
103 {
104  uint32_t ingressLabel;
109  /* LFDB entry status */
113  /* The following fields are applicable only for IPv4 label types */
114  uint32_t ipv4Addr;
115  uint32_t ipv4PrefixLen;
117  /* The following fields are applicable only for IPv6 label types */
119  uint32_t ipv6PrefixLen;
121  /* The following fields are applicable only for Layer-2 label types */
122  unsigned char egressMac[OPEN_MAC_ADDR_LEN];
123  uint32_t egressVlan;
124  uint32_t egressLabel;
125  uint32_t egressInterface;
127  /* LFDB entry statistics */
130  uint64_t inBytes;
131  uint64_t inPackets;
132 } OPEN_MPLS_LFDB_ENTRY_t;
133 
136 {
137  unsigned char mplsMac[OPEN_MAC_ADDR_LEN];
138  uint32_t lfdbSize;
139  uint32_t minLfdbLabel;
140  uint32_t maxLfdbLabel;
141  uint32_t numLfdbEntries;
142  uint32_t numLfdbInHardware;
147  /* Statistics.
148  ** These parameters are reset to 0 when the stats are cleared. */
150  uint32_t lfdbHighWaterMark;
153  /* ECMP Group Statistics. */
154  uint32_t ecmpInUse;
156  uint32_t ecmpHighInUse;
158  uint32_t ecmpMax;
166 } OPEN_MPLS_GLOBAL_STATS_t;
167 
169 typedef struct
170 {
173  uint32_t label[OPEN_MAX_MPLS_IMPOSE_LABELS];
175  uint32_t egressIfNum;
176  uint16_t egressVlan;
177  unsigned char egressMac [OPEN_MAC_ADDR_LEN];
179  uint32_t numRoutes;
180  uint32_t age;
182 
183 /*************************************************************************/
207  uint32_t intIfNum, OPEN_AFX_t type, uint32_t label);
208 
209 /*************************************************************************/
229  uint32_t intIfNum, OPEN_AFX_t type, uint32_t *label);
230 
231 /*************************************************************************/
244 
245 /*************************************************************************/
260  OPEN_MPLS_GLOBAL_STATS_t *global_status);
261 
262 /*************************************************************************/
280  OPEN_CONTROL_t *mode);
281 
282 /*************************************************************************/
301  OPEN_CONTROL_t mode);
302 
303 /*************************************************************************/
323  uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
324 
325 /*************************************************************************/
346  uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
347 
348 /*************************************************************************/
374  OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
375 
376 /*************************************************************************/
395  uint32_t label);
396 
397 /*************************************************************************/
413  OPEN_MPLS_TUNNEL_INITIATOR_t *tunnel_entry);
414 
415 /*************************************************************************/
432  OPEN_MPLS_TUNNEL_INITIATOR_t *tunnel_entry,
433  OPEN_MPLS_TUNNEL_INITIATOR_t *next_tunnel_entry);
434 #endif /* OPENAPI_MPLS_H_INCLUDED */
435 
uint32_t numLfdbPerType[OPEN_MPLS_TYPE_LAST]
Number of LFDB entries per type.
Definition: openapi_mpls.h:145
open_in6_addr_t ipv6Subnet
IPv6 address.
Definition: openapi_mpls.h:118
OPEN_MPLS_LFDB_PROTOCOL_t protocol
Protocol by which the label is created.
Definition: openapi_mpls.h:105
OPEN_MPLS_LFDB_NOT_INSERTED_REASON_t notInsertedReason
Reason why a MPLS label is not applied in HW.
Definition: openapi_mpls.h:111
OPEN_AFX_t
OPEN uses these enumerators to indicate BGP address family index of routes or policy for IPV4 or IPV6...
uint32_t numLfdbPerProto[OPEN_MPLS_PROTO_LAST]
Number of LFDB entries per protocol.
Definition: openapi_mpls.h:144
uint32_t age
Seconds since last update.
Definition: openapi_mpls.h:180
uint32_t ipv4PrefixLen
IPv4 prefix len.
Definition: openapi_mpls.h:115
uint32_t numLfdbNotInHardware
Number of LFDB entries that have not been applied into HW.
Definition: openapi_mpls.h:143
L2 label is not installed because reference VLAN is not created.
Definition: openapi_mpls.h:90
OPEN_MPLS_LFDB_ENTRY_TYPE_t
MPLS LFDB label type.
Definition: openapi_mpls.h:59
uint32_t maxTunnelInitiators
Maximum number of MPLS tunnels available in the hardware.
Definition: openapi_mpls.h:160
open_error_t openapiMplsLfdbNextGet(openapiClientHandle_t *client_handle, uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry)
Gets the LFDB entry for the next numerically higher label after the specified label.
uint32_t numTunnelsTwoLabel
Number of MPLS tunnels created with two labels.
Definition: openapi_mpls.h:163
open_error_t
OPEN uses these enumerators to indicate the error codes.
uint32_t ipv4Addr
IPv4 address.
Definition: openapi_mpls.h:114
This entry must be last in the list.
Definition: openapi_mpls.h:55
uint32_t egressLabel
Egress label ID.
Definition: openapi_mpls.h:124
OPEN_MPLS_LFDB_NOT_INSERTED_REASON_t
Reason for which the MPLS LFDB label is not applied to HW.
Definition: openapi_mpls.h:84
open_error_t openapiMplsBgpLabelModeSet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t mode)
Sets the BGP label distribution mode.
A label was not applied into HW.
Definition: openapi_mpls.h:79
This entry must be last in the list.
Definition: openapi_mpls.h:64
L2 label type.
Definition: openapi_mpls.h:61
OPEN_MPLS_LFDB_PROTOCOL_t
MPLS LFDB protocol type.
Definition: openapi_mpls.h:50
Out of resources error.
Definition: openapi_mpls.h:89
uint32_t egressInterface
Egress interface.
Definition: openapi_mpls.h:125
OPEN_MPLS_LFDB_IN_HARDWARE_STATUS_t inHardware
Label status.
Definition: openapi_mpls.h:110
uint64_t inBytes
Statistics in bytes.
Definition: openapi_mpls.h:130
uint32_t numLfdbEntries
Number of LFDB entries that have been already created.
Definition: openapi_mpls.h:141
open_inet_addr_t nextHop
The IPv4 or IPv6 address of the next hop with which this tunnel is associated.
Definition: openapi_mpls.h:171
uint64_t inPackets
Statistics in packets.
Definition: openapi_mpls.h:131
OPEN_MPLS_LFDB_LABEL_ACTION_t labelAction
Label action.
Definition: openapi_mpls.h:107
MPLS tunnel initiator informaton.
Definition: openapi_mpls.h:169
uint32_t numTunnelsThreeLabel
Number of MPLS tunnels created with three labels.
Definition: openapi_mpls.h:164
Dynamic label.
Definition: openapi_mpls.h:53
uint32_t dynamicLfdbInsertFailures
LFDB dynamic insert failure count.
Definition: openapi_mpls.h:149
uint32_t lfdbSize
Maximum number of LFDB entries available in the hardware.
Definition: openapi_mpls.h:138
uint32_t numTunnelsOneLabel
Number of MPLS tunnels created with one label.
Definition: openapi_mpls.h:162
uint32_t numLfdbInHardware
Number of LFDB entries that have been applied into HW.
Definition: openapi_mpls.h:142
uint32_t maxLfdbLabel
Maximum number that can be used as a label ID.
Definition: openapi_mpls.h:140
uint32_t minLfdbLabel
Minimal number that can be used as a label ID.
Definition: openapi_mpls.h:139
open_error_t openapiMplsBgpLabelModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *mode)
Gets the BGP label distribution mode.
L3 label matches a locally attached subnet.
Definition: openapi_mpls.h:88
open_error_t openapiMplsTunnelInitiatorGetNext(openapiClientHandle_t *client_handle, OPEN_MPLS_TUNNEL_INITIATOR_t *tunnel_entry, OPEN_MPLS_TUNNEL_INITIATOR_t *next_tunnel_entry)
Get the next MPLS tunnel initiator information.
open_error_t openapiMplsLfdbCreate(openapiClientHandle_t *client_handle, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry)
Inserts a LFDB entry into the database.
OPEN_CONTROL_t
OPEN uses these enumerators to indicate enable or disable for a given config or status parameter...
open_error_t openapiMplsTunnelInitiatorGet(openapiClientHandle_t *client_handle, OPEN_MPLS_TUNNEL_INITIATOR_t *tunnel_entry)
Get the specified MPLS tunnel initiator information.
open_error_t openapiMplsLfdbDelete(openapiClientHandle_t *client_handle, uint32_t label)
Deletes an LFDB entry from the database.
unsigned char egressMac[OPEN_MAC_ADDR_LEN]
Egress MAC.
Definition: openapi_mpls.h:122
uint32_t ecmpHighInUse
The highest number of ECMP entries used since the switch was last powered up.
Definition: openapi_mpls.h:156
Pop action.
Definition: openapi_mpls.h:71
open_error_t openapiMplsCountersClear(openapiClientHandle_t *client_handle)
Clears MPLS statistics.
L3 label does not match any subnet.
Definition: openapi_mpls.h:87
uint32_t egressIfNum
The interface number to which this tunnel is pointing.
Definition: openapi_mpls.h:175
OPEN_MPLS_LFDB_IN_HARDWARE_STATUS_t
MPLS LFDB label status.
Definition: openapi_mpls.h:76
Last pop action.
Definition: openapi_mpls.h:72
OPEN_MPLS_LFDB_ENTRY_TYPE_t entryType
Type of label.
Definition: openapi_mpls.h:106
uint32_t numRoutes
Number of routes pointing to this MPLS tunnel initiator.
Definition: openapi_mpls.h:179
OPEN_PACKED_STRUCT
MPLS LFDB entry information.
Definition: openapi_mpls.h:103
uint32_t ecmpInUse
Current number of ECMP groups in use.
Definition: openapi_mpls.h:154
L2 label is not installed because egress port is not attached.
Definition: openapi_mpls.h:91
OPEN_MPLS_LFDB_LABEL_ACTION_t
MPLS LFDB label action.
Definition: openapi_mpls.h:68
open_error_t openapiMplsBgpIntfLabelGet(openapiClientHandle_t *client_handle, uint32_t intIfNum, OPEN_AFX_t type, uint32_t *label)
Get the label configured for the specified interface.
uint32_t lfdbHighWaterMark
LFDB high water mark.
Definition: openapi_mpls.h:150
Label is inserted in hardware.
Definition: openapi_mpls.h:86
open_error_t openapiMplsLfdbGet(openapiClientHandle_t *client_handle, uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry)
Gets the LFDB entry for the specified label.
L3 label type that works with IPv6 address.
Definition: openapi_mpls.h:63
uint32_t ecmpMax
The maximum number of ECMP entries available in the hardware.
Definition: openapi_mpls.h:158
A label was applied to HW.
Definition: openapi_mpls.h:78
Static label.
Definition: openapi_mpls.h:52
uint16_t egressVlan
VLAN on which MPLS tunneled packets exit the switch.
Definition: openapi_mpls.h:176
open_error_t openapiMplsGlobalStatusGet(openapiClientHandle_t *client_handle, OPEN_MPLS_GLOBAL_STATS_t *global_status)
Gets the global MPLS status and statistics.
uint32_t numTunnelInitiators
Number of MPLS tunnels that have been already created.
Definition: openapi_mpls.h:161
uint64_t lfdbLookupFailurePackets
LFDB lookup failure packets.
Definition: openapi_mpls.h:151
uint32_t duplicateInsertions
The counter shows how many duplicate insertion attempts happened for the LFDB entry.
Definition: openapi_mpls.h:128
L3 label type that works with IPv4 address.
Definition: openapi_mpls.h:62
open_error_t openapiMplsBgpIntfLabelSet(openapiClientHandle_t *client_handle, uint32_t intIfNum, OPEN_AFX_t type, uint32_t label)
Set an interface label.
uint32_t egressVlan
Egress VLAN.
Definition: openapi_mpls.h:123
uint32_t ipv6PrefixLen
IPv6 prefix len.
Definition: openapi_mpls.h:119
Hash Mode names.
Label created with BGP.
Definition: openapi_mpls.h:54
Swap action.
Definition: openapi_mpls.h:70