Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.9.0.2
Welcome
ADK Documentation
API Reference
Files
File List
Globals
api
include
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
{
52
OPEN_MPLS_PROTO_STATIC
= 1,
53
OPEN_MPLS_PROTO_DYNAMIC
= 2,
54
OPEN_MPLS_PROTO_BGP
= 3,
55
OPEN_MPLS_PROTO_LAST
= 4
56
}
OPEN_MPLS_LFDB_PROTOCOL_t
;
57
59
typedef
enum
60
{
61
OPEN_MPLS_TYPE_LAYER_2
= 1,
62
OPEN_MPLS_TYPE_IPV4
= 2,
63
OPEN_MPLS_TYPE_IPV6
= 3,
64
OPEN_MPLS_TYPE_LAST
= 4
65
}
OPEN_MPLS_LFDB_ENTRY_TYPE_t
;
66
68
typedef
enum
69
{
70
OPEN_MPLS_LABEL_SWAP
= 1,
71
OPEN_MPLS_LABEL_POP
= 2,
72
OPEN_MPLS_LABEL_LAST_POP
= 3
73
}
OPEN_MPLS_LFDB_LABEL_ACTION_t
;
74
76
typedef
enum
77
{
78
OPEN_MPLS_LABEL_IN_HARDWARE
= 0,
79
OPEN_MPLS_LABEL_NOT_IN_HARDWARE
= 1
81
}
OPEN_MPLS_LFDB_IN_HARDWARE_STATUS_t
;
82
84
typedef
enum
85
{
86
OPEN_MPLS_NONE
= 0,
87
OPEN_MPLS_UNKNOWN_SUBNET
= 1,
88
OPEN_MPLS_LOCAL_SUBNET
= 3,
89
OPEN_MPLS_NO_RESOURCES
= 4,
90
OPEN_MPLS_NO_VLAN
= 5,
91
OPEN_MPLS_NO_PORT
= 6
93
}
OPEN_MPLS_LFDB_NOT_INSERTED_REASON_t
;
94
95
/* MPLS label stack */
96
typedef
struct
97
{
98
uint32_t label[OPEN_MAX_MPLS_IMPOSE_LABELS];
99
}
OPEN_MPLS_LABELS_t
;
100
102
OPEN_PACKED_STRUCT
103
{
104
uint32_t ingressLabel;
105
OPEN_MPLS_LFDB_PROTOCOL_t
protocol
;
106
OPEN_MPLS_LFDB_ENTRY_TYPE_t
entryType
;
107
OPEN_MPLS_LFDB_LABEL_ACTION_t
labelAction
;
109
/* LFDB entry status */
110
OPEN_MPLS_LFDB_IN_HARDWARE_STATUS_t
inHardware
;
111
OPEN_MPLS_LFDB_NOT_INSERTED_REASON_t
notInsertedReason
;
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 */
118
open_in6_addr_t
ipv6Subnet
;
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 */
128
uint32_t
duplicateInsertions
;
130
uint64_t
inBytes
;
131
uint64_t
inPackets
;
132
} OPEN_MPLS_LFDB_ENTRY_t;
133
135
OPEN_PACKED_STRUCT
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
;
143
uint32_t
numLfdbNotInHardware
;
144
uint32_t
numLfdbPerProto
[
OPEN_MPLS_PROTO_LAST
];
145
uint32_t
numLfdbPerType
[
OPEN_MPLS_TYPE_LAST
];
147
/* Statistics.
148
** These parameters are reset to 0 when the stats are cleared. */
149
uint32_t
dynamicLfdbInsertFailures
;
150
uint32_t
lfdbHighWaterMark
;
151
uint64_t
lfdbLookupFailurePackets
;
153
/* ECMP Group Statistics. */
154
uint32_t
ecmpInUse
;
156
uint32_t
ecmpHighInUse
;
158
uint32_t
ecmpMax
;
160
uint32_t
maxTunnelInitiators
;
161
uint32_t
numTunnelInitiators
;
162
uint32_t
numTunnelsOneLabel
;
163
uint32_t
numTunnelsTwoLabel
;
164
uint32_t
numTunnelsThreeLabel
;
166
} OPEN_MPLS_GLOBAL_STATS_t;
167
169
typedef
struct
170
{
171
open_inet_addr_t
nextHop;
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
;
181
}
OPEN_MPLS_TUNNEL_INITIATOR_t
;
182
183
/*************************************************************************/
206
open_error_t
openapiMplsBgpIntfLabelSet
(
openapiClientHandle_t
*client_handle,
207
uint32_t intIfNum,
OPEN_AFX_t
type, uint32_t label);
208
209
/*************************************************************************/
228
open_error_t
openapiMplsBgpIntfLabelGet
(
openapiClientHandle_t
*client_handle,
229
uint32_t intIfNum,
OPEN_AFX_t
type, uint32_t *label);
230
231
/*************************************************************************/
243
open_error_t
openapiMplsCountersClear
(
openapiClientHandle_t
*client_handle);
244
245
/*************************************************************************/
259
open_error_t
openapiMplsGlobalStatusGet
(
openapiClientHandle_t
*client_handle,
260
OPEN_MPLS_GLOBAL_STATS_t *global_status);
261
262
/*************************************************************************/
279
open_error_t
openapiMplsBgpLabelModeGet
(
openapiClientHandle_t
*client_handle,
280
OPEN_CONTROL_t
*mode);
281
282
/*************************************************************************/
300
open_error_t
openapiMplsBgpLabelModeSet
(
openapiClientHandle_t
*client_handle,
301
OPEN_CONTROL_t
mode);
302
303
/*************************************************************************/
322
open_error_t
openapiMplsLfdbGet
(
openapiClientHandle_t
*client_handle,
323
uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
324
325
/*************************************************************************/
345
open_error_t
openapiMplsLfdbNextGet
(
openapiClientHandle_t
*client_handle,
346
uint32_t label, OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
347
348
/*************************************************************************/
373
open_error_t
openapiMplsLfdbCreate
(
openapiClientHandle_t
*client_handle,
374
OPEN_MPLS_LFDB_ENTRY_t *lfdb_entry);
375
376
/*************************************************************************/
394
open_error_t
openapiMplsLfdbDelete
(
openapiClientHandle_t
*client_handle,
395
uint32_t label);
396
397
/*************************************************************************/
412
open_error_t
openapiMplsTunnelInitiatorGet
(
openapiClientHandle_t
*client_handle,
413
OPEN_MPLS_TUNNEL_INITIATOR_t
*tunnel_entry);
414
415
/*************************************************************************/
431
open_error_t
openapiMplsTunnelInitiatorGetNext
(
openapiClientHandle_t
*client_handle,
432
OPEN_MPLS_TUNNEL_INITIATOR_t
*tunnel_entry,
433
OPEN_MPLS_TUNNEL_INITIATOR_t
*next_tunnel_entry);
434
#endif
/* OPENAPI_MPLS_H_INCLUDED */
435
© 2022 by Broadcom. All rights reserved.