mpls.h (82380B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_MPLS_H__ 11 #define __BCM_MPLS_H__ 12 13 #include <bcm/types.h> 14 #include <bcm/multicast.h> 15 #include <bcm/policer.h> 16 #include <bcm/qos.h> 17 #include <bcm/vlan.h> 18 #include <bcm/switch.h> 19 20 #if defined(INCLUDE_L3) 21 /* MPLS EXP Map Structure. */ 22 typedef struct bcm_mpls_exp_map_s { 23 int priority; /* Internal priority. */ 24 bcm_color_t color; /* Color. */ 25 uint8 dscp; /* Diff Serv Code Point. */ 26 uint8 exp; /* EXP value. */ 27 uint8 pkt_pri; /* Packet priority value. */ 28 uint8 pkt_cfi; /* Packet CFI value. */ 29 } bcm_mpls_exp_map_t; 30 #endif 31 32 /* MPLS Egress Label flags. */ 33 #define BCM_MPLS_EGRESS_LABEL_TTL_SET 0x00000001 34 #define BCM_MPLS_EGRESS_LABEL_TTL_COPY 0x00000002 35 #define BCM_MPLS_EGRESS_LABEL_TTL_DECREMENT 0x00000004 36 #define BCM_MPLS_EGRESS_LABEL_EXP_SET 0x00000008 37 #define BCM_MPLS_EGRESS_LABEL_EXP_REMARK 0x00000010 38 #define BCM_MPLS_EGRESS_LABEL_EXP_COPY 0x00000020 39 #define BCM_MPLS_EGRESS_LABEL_PRI_SET 0x00000040 40 #define BCM_MPLS_EGRESS_LABEL_PRI_REMARK 0x00000080 41 #define BCM_MPLS_EGRESS_LABEL_DROP 0x00000100 42 #define BCM_MPLS_EGRESS_LABEL_PHP_IPV4 0x00000200 43 #define BCM_MPLS_EGRESS_LABEL_PHP_IPV6 0x00000400 44 #define BCM_MPLS_EGRESS_LABEL_PHP_L2 0x00000800 45 #define BCM_MPLS_EGRESS_LABEL_ENTROPY_ENABLE 0x00001000 /* Enable Entropy for 46 outgoing Tunnel-label 47 and PW-label */ 48 #define BCM_MPLS_EGRESS_LABEL_ACTION_VALID 0x00002000 /* When set action is 49 taken from action 50 field */ 51 #define BCM_MPLS_EGRESS_LABEL_REPLACE 0x00004000 /* Replace existing 52 entry. */ 53 #define BCM_MPLS_EGRESS_LABEL_WITH_ID 0x00008000 /* Add using the 54 specified ID. */ 55 #define BCM_MPLS_EGRESS_LABEL_WIDE 0x00010000 /* Set wide entry in 56 egress. */ 57 #define BCM_MPLS_EGRESS_LABEL_IML 0x00020000 /* Label is EVPN Implicit 58 Multicast. */ 59 #define BCM_MPLS_EGRESS_LABEL_PROTECTION 0x00040000 /* Egress Protection 60 object. */ 61 #define BCM_MPLS_EGRESS_LABEL_PRESERVE 0x00080000 /* Label used for swap is 62 preserved. */ 63 #define BCM_MPLS_EGRESS_LABEL_ENTROPY_INDICATION_ENABLE 0x00100000 /* Add Entropy Indication 64 label for outgoing 65 Tunnel-label */ 66 #define BCM_MPLS_EGRESS_LABEL_EVPN 0x00200000 /* Create an EVPN tunnel */ 67 #define BCM_MPLS_EGRESS_LABEL_ECN_TO_EXP_MAP 0x00400000 /* Use a specified 68 ECN_TO_EXP mapping to 69 derive MPLS EXP. */ 70 #define BCM_MPLS_EGRESS_LABEL_INT_CN_TO_EXP_MAP 0x00800000 /* Use a specified 71 INT_CN_TO_EXP mapping 72 to derive MPLS EXP. */ 73 #define BCM_MPLS_EGRESS_LABEL_ECN_EXP_MAP_TRUST 0x01000000 /* Trust ECN mapping. */ 74 #define BCM_MPLS_EGRESS_LABEL_ROE_BARE_MPLS 0x02000000 /* Encapsulate ROE frame 75 with MPLS labels 76 without inner L2 77 headers. */ 78 #define BCM_MPLS_EGRESS_LABEL_TANDEM 0x04000000 /* Create tandem tunnel 79 entry. */ 80 #define BCM_MPLS_EGRESS_LABEL_STAT_ENABLE 0x08000000 /* Indicates statistics 81 enabled. */ 82 #define BCM_MPLS_EGRESS_LABEL_VIRTUAL_EGRESS_POINTED 0x10000000 /* Indicate MPLS egress 83 tunnel is pointed from 84 EEDB only and not from 85 FWD/ACL Dbs */ 86 #define BCM_MPLS_EGRESS_LABEL_CONTROL_WORD 0x20000000 /* Outgoing EVPN labels 87 use control word */ 88 #define BCM_MPLS_EGRESS_LABEL_ALTERNATE_MARKING 0x40000000 /* Configure RFC8321 89 Alternate Marking 90 entry */ 91 #define BCM_MPLS_EGRESS_LABEL_ALTERNATE_MARKING_LOSS_SET 0x80000000 /* Set loss bit of 92 Alternate Marking Flow 93 Id label */ 94 95 /* MPLS Egress Label second flags group . */ 96 #define BCM_MPLS_EGRESS_LABEL_FLAGS2_SVTAG_ENABLE 0x00000001 /* Enable the SVTAG 97 lookup for the MPLS 98 tunnel. */ 99 100 /* MPLS label egress actions. */ 101 typedef enum bcm_mpls_egress_action_e { 102 BCM_MPLS_EGRESS_ACTION_SWAP = 0, 103 BCM_MPLS_EGRESS_ACTION_PHP = 1, 104 BCM_MPLS_EGRESS_ACTION_PUSH = 2, 105 BCM_MPLS_EGRESS_ACTION_NOP = 3, 106 BCM_MPLS_EGRESS_ACTION_SWAP_OR_PUSH = 4 107 } bcm_mpls_egress_action_t; 108 109 /* Special Label Control Types. */ 110 typedef enum bcm_mpls_special_label_push_type_e { 111 bcmMplsSpecialLabelPushNone = 0, 112 bcmMplsSpecialLabelPushSpecial = 1, 113 bcmMplsSpecialLabelPushEntropy = 2, 114 bcmMplsSpecialLabelPushSpecialPlusEntropy = 3, 115 bcmMplsSpecialLabelPushMeaningful1 = 4, 116 bcmMplsSpecialLabelPushMeaningful2 = 5, 117 bcmMplsSpecialLabelPushMeaningful3 = 6, 118 bcmMplsSpecialLabelPushMeaningful13 = 7, 119 bcmMplsSpecialLabelPushMeaningful12 = 8, 120 bcmMplsSpecialLabelPushMeaningful23 = 9, 121 bcmMplsSpecialLabelPushMeaningful123 = 10 122 } bcm_mpls_special_label_push_type_t; 123 124 /* Special Label Types. */ 125 typedef enum bcm_mpls_special_label_type_e { 126 bcmMplsSpecialLabelTypeNone = 0, 127 bcmMplsSpecialLabelTypeGal = 1, 128 bcmMplsSpecialLabelTypeRal = 2, 129 bcmMplsSpecialLabelTypeSpecial = 3, 130 bcmMplsSpecialLabelTypeEntropy = 4, 131 bcmMplsSpecialLabelTypeFrr = 5 132 } bcm_mpls_special_label_type_t; 133 134 /* bcm_mpls_egress_label_s */ 135 typedef struct bcm_mpls_egress_label_s { 136 uint32 flags; /* BCM_MPLS_EGRESS_LABEL_xxx. */ 137 uint32 flags2; /* BCM_MPLS_EGRESS_LABEL_FLAGS2_xxx. */ 138 bcm_mpls_label_t label; 139 int qos_map_id; /* EXP map ID. */ 140 uint8 exp; 141 uint8 ttl; 142 uint8 pkt_pri; 143 uint8 pkt_cfi; 144 bcm_if_t tunnel_id; /* Tunnel Interface. */ 145 bcm_if_t l3_intf_id; /* l3 Interface ID. */ 146 bcm_mpls_egress_action_t action; /* MPLS label action, relevant when 147 BCM_MPLS_EGRESS_LABEL_ACTION_VALID is 148 set. */ 149 int ecn_map_id; /* Ecn map id for IP ECN to EXP mapping. */ 150 int int_cn_map_id; /* Ecn map id for INT_CN to EXP mapping. */ 151 bcm_failover_t egress_failover_id; /* Failover object index for Egress 152 Protection. */ 153 bcm_if_t egress_failover_if_id; /* Failover MPLS Tunnel identifier for 154 Egress Protection. */ 155 int outlif_counting_profile; /* Out LIF counting profile */ 156 bcm_mpls_special_label_push_type_t spl_label_push_type; /* Special label push type */ 157 bcm_encap_access_t encap_access; /* Encapsulation Access stage */ 158 bcm_qos_egress_model_t egress_qos_model; /* egress qos and ttl model */ 159 } bcm_mpls_egress_label_t; 160 161 #if defined(INCLUDE_L3) 162 /* MPLS port match criteria. */ 163 typedef enum bcm_mpls_port_match_e { 164 BCM_MPLS_PORT_MATCH_INVALID = 0, /* Illegal. */ 165 BCM_MPLS_PORT_MATCH_NONE = 1, /* No source match criteria. */ 166 BCM_MPLS_PORT_MATCH_PORT = 2, /* {Module, Port} or Trunk. */ 167 BCM_MPLS_PORT_MATCH_PORT_VLAN = 3, /* Mod/port/trunk + outer VLAN ID. */ 168 BCM_MPLS_PORT_MATCH_PORT_INNER_VLAN = 4, /* Mod/port/trunk + inner VLAN ID. */ 169 BCM_MPLS_PORT_MATCH_PORT_VLAN_STACKED = 5, /* Mod/port/trunk + outer/inner VLAN ID. */ 170 BCM_MPLS_PORT_MATCH_VLAN_PRI = 6, /* Mod/port/trunk + VLAN-PRI + VLAN-CFI. */ 171 BCM_MPLS_PORT_MATCH_LABEL = 7, /* MPLS label. */ 172 BCM_MPLS_PORT_MATCH_LABEL_PORT = 8, /* MPLS label + Mod/port/trunk. */ 173 BCM_MPLS_PORT_MATCH_LABEL_VLAN = 9, /* MPLS label + VLAN. */ 174 BCM_MPLS_PORT_MATCH_PORT_SUBPORT_PKT_VID = 10, /* Mod/port/trunk + LLTAG VLAN ID. */ 175 BCM_MPLS_PORT_MATCH_PORT_SUBPORT_PKT_VID_OUTER_VLAN = 11, /* Mod/port/trunk + LLTAG VLAN ID + 176 outer VLAN ID. */ 177 BCM_MPLS_PORT_MATCH_PORT_SUBPORT_PKT_VID_INNER_VLAN = 12, /* Mod/port/trunk + LLTAG VLAN ID + 178 inner VLAN ID. */ 179 BCM_MPLS_PORT_MATCH_SHARE = 13, /* Multiple match criteria Share one 180 MPLS logical port. */ 181 BCM_MPLS_PORT_MATCH_PORT_VLAN_TAG = 14, /* Mod/port/trunk + Outer VLAN-PRI + 182 Outer VLAN-CFI + Outer VLAN ID. */ 183 BCM_MPLS_PORT_MATCH_PORT_INNER_VLAN_TAG = 15, /* Mod/port/trunk + Inner VLAN-PRI + 184 Inner VLAN-CFI + Inner VLAN ID. */ 185 BCM_MPLS_PORT_MATCH_VLAN = 16, /* Outer VLAN ID only. */ 186 BCM_MPLS_PORT_MATCH_LABEL_CONTEXT_LABEL = 17, /* Context MPLS label + VC label. */ 187 BCM_MPLS_PORT_MATCH_LABEL_L3_INGRESS_INTF = 18, /* L3 interface ID + VC label. */ 188 BCM_MPLS_PORT_MATCH_LABEL_PORT_GROUP = 19, /* MPLS label + Port group. */ 189 BCM_MPLS_PORT_MATCH_PORT_GROUP_VLAN = 20, /* Port group + outer VLAN ID. */ 190 BCM_MPLS_PORT_MATCH_PORT_GROUP_INNER_VLAN = 21, /* Port group + inner VLAN ID. */ 191 BCM_MPLS_PORT_MATCH_PORT_GROUP_VLAN_STACKED = 22, /* Port group + outer/inner VLAN ID. */ 192 BCM_MPLS_PORT_MATCH_COUNT = 23 /* Must be last. */ 193 } bcm_mpls_port_match_t; 194 #endif 195 196 #if defined(INCLUDE_L3) 197 /* MPLS interface flags. */ 198 #define BCM_MPLS_PORT_REPLACE 0x00000001 /* Replace existing 199 entry. */ 200 #define BCM_MPLS_PORT_WITH_ID 0x00000002 /* Add using the 201 specified ID. */ 202 #define BCM_MPLS_PORT_ENCAP_WITH_ID 0x00000004 /* Use the specified 203 encap id to allocate 204 and setup 205 encapsulation. */ 206 #define BCM_MPLS_PORT_EGRESS_UNTAGGED 0x00000008 /* Indicates tag is 207 stripped on logical 208 port egress. */ 209 #define BCM_MPLS_PORT_DROP 0x00000010 /* Drop matching packets. */ 210 #define BCM_MPLS_PORT_NETWORK 0x00000020 /* Network-facing 211 interface. */ 212 #define BCM_MPLS_PORT_CONTROL_WORD 0x00000040 /* Use control word 213 (VPWS). */ 214 #define BCM_MPLS_PORT_SEQUENCED 0x00000080 /* Use sequence number 215 (VPWS). */ 216 #define BCM_MPLS_PORT_COUNTED 0x00000100 /* Maintain packet/byte 217 counts. */ 218 #define BCM_MPLS_PORT_INT_PRI_SET 0x00000200 /* Use specified int_pri 219 value for internal 220 priority. */ 221 #define BCM_MPLS_PORT_INT_PRI_MAP 0x00000400 /* Use specified exp_map 222 to derive internal 223 priority. */ 224 #define BCM_MPLS_PORT_COLOR_MAP 0x00000800 /* Use specified exp_map 225 to derive internal 226 color. */ 227 #define BCM_MPLS_PORT_EGRESS_TUNNEL 0x00001000 /* Specified egress 228 tunnel interface is 229 valid. */ 230 #define BCM_MPLS_PORT_NO_EGRESS_TUNNEL_ENCAP 0x00002000 /* Specified egress 231 tunnel interface is 232 valid. 233 234 Do not encapsulate 235 outer MAC but update 236 MAC Address on the 237 packet. */ 238 #define BCM_MPLS_PORT_SERVICE_TAGGED 0x00004000 /* Service tag mode. */ 239 #define BCM_MPLS_PORT_SERVICE_VLAN_ADD 0x00008000 /* Add SD-tag. */ 240 #define BCM_MPLS_PORT_SERVICE_VLAN_REPLACE 0x00010000 /* Replace VLAN not TPID. */ 241 #define BCM_MPLS_PORT_SERVICE_VLAN_DELETE 0x00020000 /* Delete VLAN tag. */ 242 #define BCM_MPLS_PORT_SERVICE_VLAN_TPID_REPLACE 0x00040000 /* Replace VLAN and TPID. */ 243 #define BCM_MPLS_PORT_SERVICE_VLAN_PRI_TPID_REPLACE 0x00080000 /* Replace VLAN, VLAN-PRI 244 and TPID. */ 245 #define BCM_MPLS_PORT_SERVICE_VLAN_PRI_REPLACE 0x00100000 /* Replace VLAN and 246 VLAN-PRI. */ 247 #define BCM_MPLS_PORT_SERVICE_PRI_REPLACE 0x00200000 /* Replace VLAN-PRI only. */ 248 #define BCM_MPLS_PORT_SERVICE_TPID_REPLACE 0x00400000 /* Replace TPID only. */ 249 #define BCM_MPLS_PORT_INNER_VLAN_PRESERVE 0x00800000 /* Preserve the inner or 250 customer VLAN tag */ 251 #define BCM_MPLS_PORT_FAILOVER 0x01000000 /* Failover Port */ 252 #define BCM_MPLS_PORT_INNER_VLAN_ADD 0x02000000 /* Insert Native VLAN tag 253 for untagged pcakets */ 254 #define BCM_MPLS_PORT_ENTROPY_ENABLE 0x04000000 /* Enable MPLS Entropy 255 Label for L2-VPN */ 256 #define BCM_MPLS_PORT_PW_FAILOVER 0x08000000 /* Port for PW Redundancy */ 257 #define BCM_MPLS_PORT_EXTENDED 0x10000000 /* Use the extended P2P 258 service */ 259 #define BCM_MPLS_PORT_WITH_GAL 0x20000000 /* indicating OAMoGALoPWE 260 is supported. */ 261 #define BCM_MPLS_PORT_LOCAL_PROTECTION 0x40000000 /* Local protection 262 according to link 263 status. */ 264 #define BCM_MPLS_PORT_FORWARD_GROUP 0x80000000 /* Enable VLAN-Port 265 property FORWARD_GROUP 266 to MPLS-Port */ 267 #endif 268 269 #if defined(INCLUDE_L3) 270 /* More MPLS interface flags. */ 271 #define BCM_MPLS_PORT2_INGRESS_ONLY 0x00000001 /* Indicates ingress 272 settings */ 273 #define BCM_MPLS_PORT2_EGRESS_ONLY 0x00000002 /* Indicates egress 274 settings */ 275 #define BCM_MPLS_PORT2_EGRESS_PROTECTION 0x00000004 /* Egress protection 276 object */ 277 #define BCM_MPLS_PORT2_TUNNEL_PUSH_INFO 0x00000008 /* Allocate MPLS Push 278 profile information */ 279 #define BCM_MPLS_PORT2_LEARN_ENCAP 0x00000010 /* Learning information 280 is a pointer to 281 encapsulation database 282 entry */ 283 #define BCM_MPLS_PORT2_CASCADED 0x00000020 /* Set in case the mpls 284 port is over overlay */ 285 #define BCM_MPLS_PORT2_INGRESS_WIDE 0x00000040 /* use Wide mode 286 (additional data) */ 287 #define BCM_MPLS_PORT2_TUNNEL_HEADER_EGRESS_VLAN_TRANSLATION 0x00000080 /* If set, MPLS tunnel 288 header's VLAN will be 289 translated; else, 290 payload's VLAN will be 291 translated. */ 292 #define BCM_MPLS_PORT2_PROXY_MODE 0x00000100 /* Act as proxy mode, and 293 do packet 294 modifications for HG 295 output port on 296 stacking mode */ 297 #define BCM_MPLS_PORT2_INGRESS_ENTROPY_ENABLE 0x00000200 /* If set, enables 298 termination of entropy 299 label following the 300 ingressing match label */ 301 #define BCM_MPLS_PORT2_ENCAP_OPTIMIZED 0x00000400 /* Indicate that FEC 302 should be set as 303 format C (EEI) */ 304 #define BCM_MPLS_PORT2_QOS_NONE 0x00000800 /* Indicate that no QOS 305 configuration on the 306 MPLS port. */ 307 #define BCM_MPLS_PORT2_INGRESS_ECN_MAP 0x00001000 /* Use specified 308 EXP_TO_ECN map to 309 derive IP ECN. */ 310 #define BCM_MPLS_PORT2_KEEP_TTL 0x00002000 /* Retain incoming TTL by 311 disabling decrement 312 for MPLS flows. */ 313 #define BCM_MPLS_PORT2_LEARN_ENCAP_EEI 0x00004000 /* Learning information 314 is two pointers to 315 encapsulation database 316 entries. FEC should be 317 set as format 318 B(OutLIF). */ 319 #define BCM_MPLS_PORT2_OUTER_TTL 0x00008000 /* TTL flag used to 320 indicate if TTL is 321 taken from PIPE or 322 UNIFORM. */ 323 #define BCM_MPLS_PORT2_OUTER_EXP 0x00010000 /* QOS flag used to 324 indicate if QOS is 325 taken from PIPE or 326 UNIFORM. */ 327 #define BCM_MPLS_PORT2_SERVICE_CFI_REPLACE 0x00020000 /* Replace CFI. */ 328 #define BCM_MPLS_PORT2_WITH_LSP_OAM 0x00040000 /* Add POP action while 329 creating the VC label 330 treat the packet as 331 LSP-OAM */ 332 #define BCM_MPLS_PORT2_STAT_ENABLE 0x00080000 /* Indicates statistics 333 enabled. */ 334 #define BCM_MPLS_PORT2_SERVICE_TAGGED_INDEXED 0x00100000 /* Indicates service tag 335 with indexed (Gliful) 336 Native AC. */ 337 #define BCM_MPLS_PORT2_ALLOC_SYMMETRIC 0x00200000 /* Indicate that MPLS 338 Port ID allocation 339 (ingress or egress) 340 will return a GPORT 341 which is free in both 342 ingress and egress. */ 343 #define BCM_MPLS_PORT2_CROSS_CONNECT 0x00400000 /* P2P L2 service (VPWS). */ 344 #define BCM_MPLS_PORT2_PLATFORM_NAMESPACE 0x00800000 /* If set, MPLS Port is 345 working in network 346 namespace; else in 347 interface namespace. */ 348 #define BCM_MPLS_PORT2_ENCAP_CASCADED 0x01000000 /* Indicate the 349 encapsulation ID is 350 linked to the MPLS 351 port. */ 352 #define BCM_MPLS_PORT2_MULTICAST_GROUP_REMAP 0x02000000 /* Remap the multicast 353 group to a new one. */ 354 #endif 355 356 #if defined(INCLUDE_L3) 357 /* MPLS traverse flags. */ 358 #define BCM_MPLS_TRAVERSE_DELETE 0x00000001 /* Indicates to delete mpls port 359 entries */ 360 #endif 361 362 #if defined(INCLUDE_L3) 363 /* VCCV Control Channel Type */ 364 typedef enum bcm_mpls_port_control_channel_type_e { 365 bcmMplsPortControlChannelNone = 0, 366 bcmMplsPortControlChannelAch = 1, 367 bcmMplsPortControlChannelRouterAlert = 2, 368 bcmMplsPortControlChannelTtl = 3, 369 bcmMplsPortControlChannelGalUnderPw = 4 370 } bcm_mpls_port_control_channel_type_t; 371 #endif 372 373 #if defined(INCLUDE_L3) 374 /* MPLS port type. */ 375 typedef struct bcm_mpls_port_s { 376 bcm_gport_t mpls_port_id; /* GPORT identifier. */ 377 uint32 flags; /* BCM_MPLS_PORT_xxx. */ 378 uint32 flags2; /* BCM_MPLS_PORT2_xxx. */ 379 int if_class; /* Interface class ID. */ 380 int exp_map; /* Incoming EXP map ID. */ 381 int int_pri; /* Internal priority. */ 382 uint8 pkt_pri; /* Packet priority. */ 383 uint8 pkt_cfi; /* Packet CFI. */ 384 uint16 service_tpid; /* Service VLAN TPID value. */ 385 bcm_gport_t port; /* Match port and/or egress port. */ 386 bcm_mpls_port_match_t criteria; /* Match criteria. */ 387 bcm_vlan_t match_vlan; /* Outer VLAN ID to match. */ 388 bcm_vlan_t match_inner_vlan; /* Inner VLAN ID to match. */ 389 bcm_mpls_label_t match_label; /* VC label to match. */ 390 bcm_if_t egress_tunnel_if; /* MPLS tunnel egress object. */ 391 bcm_mpls_egress_label_t egress_label; /* Outgoing VC label. */ 392 int mtu; /* MPLS port MTU. */ 393 bcm_vlan_t egress_service_vlan; /* Service VLAN to Add/Replace. */ 394 uint32 pw_seq_number; /* Initial-value of Pseudo-wire Sequence 395 number */ 396 bcm_if_t encap_id; /* Encap Identifier. */ 397 bcm_failover_t ingress_failover_id; /* Ingress Failover Object Identifier. */ 398 bcm_gport_t ingress_failover_port_id; /* Ingress Failover MPLS Port 399 Identifier. */ 400 bcm_failover_t failover_id; /* Failover Object Identifier. */ 401 bcm_gport_t failover_port_id; /* Failover MPLS Port Identifier. */ 402 bcm_policer_t policer_id; /* Policer ID to be associated with the 403 MPLS gport */ 404 bcm_multicast_t failover_mc_group; /* MC group used for bi-cast. */ 405 bcm_failover_t pw_failover_id; /* Failover Object Identifier for 406 Redundant PW. */ 407 bcm_gport_t pw_failover_port_id; /* Redundant PW port Identifier. */ 408 bcm_mpls_port_control_channel_type_t vccv_type; /* Indicate VCCV Control Channel */ 409 bcm_switch_network_group_t network_group_id; /* Split Horizon network group 410 identifier */ 411 bcm_vlan_t match_subport_pkt_vid; /* LLTAG VLAN ID to match. */ 412 bcm_gport_t tunnel_id; /* Tunnel Id pointing to ingress LSP. */ 413 bcm_gport_t per_flow_queue_base; /* Base queue of the per flow queue set. 414 Actual queue is decided based on 415 internal priority and qos map. */ 416 int qos_map_id; /* QOS map identifier. */ 417 bcm_failover_t egress_failover_id; /* Failover object index for Egress 418 Protection */ 419 bcm_gport_t egress_failover_port_id; /* Failover MPLS Port identifier for 420 Egress Protection */ 421 int ecn_map_id; /* ECN map identifier. */ 422 uint32 class_id; /* Class ID */ 423 uint32 egress_class_id; /* Egress Class ID */ 424 int inlif_counting_profile; /* In LIF counting profile */ 425 bcm_mpls_egress_label_t egress_tunnel_label; /* A mpls tunnel to be binded with the 426 pwe */ 427 int nof_service_tags; /* Number of Service-Tags expected on 428 Native-ETH header */ 429 bcm_qos_ingress_model_t ingress_qos_model; /* ingress qos&ttl model */ 430 bcm_mpls_label_t context_label; /* Ingress match - context label. */ 431 bcm_if_t ingress_if; /* Ingress match - context interface. */ 432 int port_group; /* Port group to match. */ 433 int dscp_map_id; /* DSCP based PHB map ID. */ 434 int vlan_pri_map_id; /* VLAN priority and CFI based PHB map 435 ID. */ 436 } bcm_mpls_port_t; 437 #endif 438 439 #if defined(INCLUDE_L3) 440 /* MPLS label actions. */ 441 typedef enum bcm_mpls_switch_action_e { 442 BCM_MPLS_SWITCH_ACTION_SWAP = 0, 443 BCM_MPLS_SWITCH_ACTION_PHP = 1, 444 BCM_MPLS_SWITCH_ACTION_POP = 2, 445 BCM_MPLS_SWITCH_ACTION_POP_DIRECT = 3, 446 BCM_MPLS_SWITCH_ACTION_NOP = 4, 447 BCM_MPLS_SWITCH_EGRESS_ACTION_PUSH = 5, 448 BCM_MPLS_SWITCH_ACTION_INVALID = 6 449 } bcm_mpls_switch_action_t; 450 #endif 451 452 #if defined(INCLUDE_L3) 453 /* MPLS tunnel switch flags. */ 454 #define BCM_MPLS_SWITCH_LOOKUP_SECOND_LABEL 0x00000001 /* Key contains label and 455 second_label. */ 456 #define BCM_MPLS_SWITCH_COUNTED 0x00000002 /* Maintain packet/byte 457 counts. */ 458 #define BCM_MPLS_SWITCH_INT_PRI_SET 0x00000004 /* Use specified int_pri 459 value for internal 460 priority. */ 461 #define BCM_MPLS_SWITCH_INT_PRI_MAP 0x00000008 /* Use specified exp_map 462 to derive internal 463 priority. */ 464 #define BCM_MPLS_SWITCH_COLOR_MAP 0x00000010 /* Use specified exp_map 465 to derive internal 466 color. */ 467 #define BCM_MPLS_SWITCH_OUTER_EXP 0x00000020 /* Get EXP from 468 popped/swapped label. */ 469 #define BCM_MPLS_SWITCH_OUTER_TTL 0x00000040 /* Get TTL from 470 popped/swapped label. */ 471 #define BCM_MPLS_SWITCH_INNER_EXP 0x00000080 /* (POP/PHP) Get EXP from 472 header following 473 popped label. */ 474 #define BCM_MPLS_SWITCH_INNER_TTL 0x00000100 /* (POP/PHP) Get TTL from 475 header following 476 popped label. */ 477 #define BCM_MPLS_SWITCH_TTL_DECREMENT 0x00000200 /* Decrement the TTL 478 value by 1. */ 479 #define BCM_MPLS_SWITCH_LOOKUP_L3_INGRESS_INTF 0x00000400 /* indicate that ingress 480 interface ingress_if 481 be a part of the 482 lookup key. */ 483 #define BCM_MPLS_SWITCH_DROP 0x00000800 /* Drop all packets. */ 484 #define BCM_MPLS_SWITCH_P2MP 0x00001000 /* Indicate 485 Point-to-Multipoint 486 Label. */ 487 #define BCM_MPLS_SWITCH_SKIP_ETHERNET 0x00002000 /* If set then SKIP 488 following Ethernet and 489 forward packet 490 according to next (L3) 491 header. */ 492 #define BCM_MPLS_SWITCH_EXPECT_BOS 0x00004000 /* if present then 493 terminated tunnel 494 expected to be BOS, 495 otherwise expected to 496 be not BOS. */ 497 #define BCM_MPLS_SWITCH_TRAP_TTL_0 0x00008000 /* Trap packets with 498 terminated label where 499 TTL = 0. relevant when 500 action is POP. */ 501 #define BCM_MPLS_SWITCH_TRAP_TTL_1 0x00010000 /* Trap packets with 502 terminated label where 503 TTL = 1. relevant when 504 action is POP. */ 505 #define BCM_MPLS_SWITCH_LOOKUP_INT_PRI 0x00020000 /* indicate that int_pri 506 is valid and be a part 507 of the key for label 508 (ILM) lookup. */ 509 #define BCM_MPLS_SWITCH_FRR 0x00040000 /* Indicate Fast Reroute 510 Label. */ 511 #define BCM_MPLS_SWITCH_ENCAP_SET 0x00080000 /* Set the TTL/EXP 512 encapsulation info. */ 513 #define BCM_MPLS_SWITCH_NEXT_HEADER_L2 0x00100000 /* next header is 514 Ethernet, relevant for 515 POP and PHP action. */ 516 #define BCM_MPLS_SWITCH_NEXT_HEADER_IPV4 0x00200000 /* next header is IPv4, 517 relevant for POP and 518 PHP action. */ 519 #define BCM_MPLS_SWITCH_NEXT_HEADER_IPV6 0x00400000 /* next header is IPv6, 520 relevant for POP and 521 PHP action. */ 522 #define BCM_MPLS_SWITCH_DIRECT_ATTACHED 0x00800000 /* Indicates that 523 egress_port is valid 524 and should be used 525 when directly attached 526 to egress (without 527 passing through next 528 hop object). Used only 529 for DNX chips. */ 530 #define BCM_MPLS_SWITCH_ENTROPY_ENABLE 0x01000000 /* Enable MPLS Entropy 531 for Incoming 532 Tunnel-Label */ 533 #define BCM_MPLS_SWITCH_REPLACE 0x02000000 /* Replace existing 534 entry. */ 535 #define BCM_MPLS_SWITCH_WITH_ID 0x04000000 /* Add using the 536 specified ID. */ 537 #define BCM_MPLS_SWITCH_WIDE 0x08000000 /* Create with wide mode. */ 538 #define BCM_MPLS_SWITCH_LOOKUP_NONE 0x10000000 /* No source match done */ 539 #define BCM_MPLS_SWITCH_EVPN_IML 0x20000000 /* Differentiate IML 540 labels from ordinary 541 labels */ 542 #define BCM_MPLS_SWITCH_INGRESS_ECN_MAP 0x40000000 /* Use a specified 543 EXP_TO_ECN mapping to 544 derive IP ECN. */ 545 #define BCM_MPLS_SWITCH_TUNNEL_TERM_ECN_MAP 0x80000000 /* Use a specified tunnel 546 termination ecn 547 mapping to derive IP 548 ECN. */ 549 #define BCM_MPLS_SWITCH_KEEP_TTL BCM_MPLS_SWITCH_TRAP_TTL_0 /* Retain incoming TTL by 550 disabling decrement 551 for MPLS flows. */ 552 #endif 553 554 #if defined(INCLUDE_L3) 555 /* MPLS tunnel switch flags for flags2. */ 556 #define BCM_MPLS_SWITCH2_ENABLE_IPV4 0x00000001 /* Enable IPv4 packet 557 lookup in mpls tunnel. 558 To be used only with 559 flags2. */ 560 #define BCM_MPLS_SWITCH2_ENABLE_IPV6 0x00000002 /* Enable IPv6 packet 561 lookup in mpls tunnel. 562 To be used only with 563 flags2. */ 564 #define BCM_MPLS_SWITCH2_ENABLE_ROE 0x00000004 /* Enable ROE frame 565 lookup in mpls tunnel. 566 To be used only with 567 flags2. */ 568 #define BCM_MPLS_SWITCH2_ENABLE_ROE_CUSTOM 0x00000008 /* Enable ROE Custom 569 frame lookup in mpls 570 tunnel. To be used 571 only with flags2. */ 572 #define BCM_MPLS_SWITCH2_TUNNEL_HEADER_EGRESS_VLAN_TRANSLATION 0x00000010 /* Use MPLS tunnel header 573 for egress vlan 574 translate for devices 575 where default behavior 576 is to use the inner 577 header for egress vlan 578 translation. */ 579 #define BCM_MPLS_SWITCH2_STAT_ENABLE 0x00000020 /* Indicates statistics 580 enabled. */ 581 #define BCM_MPLS_SWITCH2_CROSS_CONNECT 0x00000040 /* P2P L2 service (EVPN) */ 582 #define BCM_MPLS_SWITCH2_TERM_BUD 0x00000080 /* MPLS multicast label 583 DB for BUD node */ 584 #define BCM_MPLS_SWITCH2_VLAN_PRI_SET 0x00000100 /* Set outer vlan pri 585 from table entry */ 586 #define BCM_MPLS_SWITCH2_VLAN_PRI_PHB_REMARK 0x00000200 /* Remark outer vlan pri 587 from PHB */ 588 #define BCM_MPLS_SWITCH2_CONTROL_WORD 0x00000400 /* Incoming EVPN labels 589 have control word */ 590 #endif 591 592 #if defined(INCLUDE_L3) 593 /* MPLS tunnel switch structure. */ 594 typedef struct bcm_mpls_tunnel_switch_s { 595 uint32 flags; /* BCM_MPLS_SWITCH_xxx. */ 596 uint32 flags2; /* BCM_MPLS_SWITCH2_xxx. */ 597 bcm_mpls_label_t label; /* Incoming label value. */ 598 bcm_mpls_label_t second_label; /* Incoming second label. */ 599 bcm_gport_t port; /* Incoming port. */ 600 bcm_mpls_switch_action_t action; /* MPLS label action. */ 601 bcm_mpls_switch_action_t action_if_bos; /* MPLS label action if BOS. */ 602 bcm_mpls_switch_action_t action_if_not_bos; /* MPLS label action if not BOS. */ 603 bcm_multicast_t mc_group; /* P2MP Multicast group. */ 604 int exp_map; /* EXP-map ID. */ 605 int int_pri; /* Internal priority. */ 606 bcm_policer_t policer_id; /* Policer ID to be associated with the 607 incoming label. */ 608 bcm_vpn_t vpn; /* L3 VPN used if action is POP. */ 609 bcm_mpls_egress_label_t egress_label; /* Outgoing label information. */ 610 bcm_if_t egress_if; /* Outgoing egress object. */ 611 bcm_if_t ingress_if; /* Ingress Interface object. */ 612 int mtu; /* MTU. */ 613 int qos_map_id; /* QOS map identifier. */ 614 bcm_failover_t failover_id; /* Failover Object Identifier for 615 protected tunnel. Used for 1+1 616 protection also */ 617 bcm_gport_t tunnel_id; /* Tunnel ID. */ 618 bcm_gport_t failover_tunnel_id; /* Failover Tunnel ID. */ 619 bcm_if_t tunnel_if; /* hierarchical interface, relevant for 620 when action is 621 BCM_MPLS_SWITCH_ACTION_POP. */ 622 bcm_gport_t egress_port; /* Outgoing egress port. */ 623 uint16 oam_global_context_id; /* OAM global context id passed from 624 ingress to egress XGS chip. */ 625 uint32 class_id; /* Class ID */ 626 int inlif_counting_profile; /* In LIF counting profile */ 627 int ecn_map_id; /* ECN map identifier */ 628 int tunnel_term_ecn_map_id; /* Tunnel termination ecn map identifier */ 629 uint32 stat_id; /* Object statistics id */ 630 int stat_pp_profile; /* Statistics id and profile */ 631 bcm_qos_ingress_model_t ingress_qos_model; /* ingress qos & ttl model */ 632 uint8 pkt_pri; /* New vlan pri */ 633 uint8 pkt_cfi; /* New vlan cfi */ 634 } bcm_mpls_tunnel_switch_t; 635 #endif 636 637 #if defined(INCLUDE_L3) 638 /* MPLS Entropy identifier Config Structure. */ 639 typedef struct bcm_mpls_entropy_identifier_s { 640 bcm_mpls_label_t label; /* Incoming entropy label value. */ 641 bcm_mpls_label_t mask; /* Entropy label mask. */ 642 int pri; /* Priority value of the entropy label. */ 643 uint32 flags; /* BCM_MPLS_ENTROPY_xxx. */ 644 } bcm_mpls_entropy_identifier_t; 645 #endif 646 647 #if defined(INCLUDE_L3) 648 /* Initialize the MPLS port structure. */ 649 extern void bcm_mpls_port_t_init( 650 bcm_mpls_port_t *mpls_port); 651 #endif 652 653 #if defined(INCLUDE_L3) 654 /* Initialize the MPLS egress label structure. */ 655 extern void bcm_mpls_egress_label_t_init( 656 bcm_mpls_egress_label_t *label); 657 #endif 658 659 #if defined(INCLUDE_L3) 660 /* Initialize the MPLS tunnel switch structure. */ 661 extern void bcm_mpls_tunnel_switch_t_init( 662 bcm_mpls_tunnel_switch_t *info); 663 #endif 664 665 #if defined(INCLUDE_L3) 666 /* Initialize MPLS Entropy label identifier structure. */ 667 extern void bcm_mpls_entropy_identifier_t_init( 668 bcm_mpls_entropy_identifier_t *info); 669 #endif 670 671 #if defined(INCLUDE_L3) 672 /* Initialize the MPLS EXP map structure. */ 673 extern void bcm_mpls_exp_map_t_init( 674 bcm_mpls_exp_map_t *exp_map); 675 #endif 676 677 #ifndef BCM_HIDE_DISPATCHABLE 678 679 #if defined(INCLUDE_L3) 680 /* Initialize the BCM MPLS subsystem. */ 681 extern int bcm_mpls_init( 682 int unit); 683 #endif 684 685 #if defined(INCLUDE_L3) 686 /* Detach the MPLS software module. */ 687 extern int bcm_mpls_cleanup( 688 int unit); 689 #endif 690 691 #endif /* BCM_HIDE_DISPATCHABLE */ 692 693 #if defined(INCLUDE_L3) 694 /* Flags for bcm_mpls_vpn_id_create. */ 695 #define BCM_MPLS_VPN_L3 0x00000001 696 #define BCM_MPLS_VPN_VPWS 0x00000002 697 #define BCM_MPLS_VPN_VPLS 0x00000004 698 #define BCM_MPLS_VPN_REPLACE 0x00000008 699 #define BCM_MPLS_VPN_WITH_ID 0x00000010 700 #endif 701 702 #if defined(INCLUDE_L3) 703 /* MPLS VPN Definitions. */ 704 #define BCM_MPLS_VPWS_VPN_INVALID 0xFFFE /* Invalid VPWS VPN ID */ 705 #define BCM_MPLS_VPLS_VPN_INVALID 0xFFFF /* Invalid VPLS VPN ID */ 706 #endif 707 708 #if defined(INCLUDE_L3) 709 /* Invalid Class ID definition. */ 710 #define BCM_CLASS_ID_INVALID 0xFFFFFFFF /* Invalid Class ID */ 711 #endif 712 713 #if defined(INCLUDE_L3) 714 /* MPLS VPN Config Structure. */ 715 typedef struct bcm_mpls_vpn_config_s { 716 uint32 flags; /* BCM_MPLS_VPN_xxx. */ 717 bcm_vpn_t vpn; 718 int lookup_id; 719 bcm_multicast_t broadcast_group; 720 bcm_multicast_t unknown_unicast_group; 721 bcm_multicast_t unknown_multicast_group; 722 bcm_policer_t policer_id; /* Policer id to be used */ 723 bcm_vlan_protocol_packet_ctrl_t protocol_pkt; /* Protocol packet control */ 724 } bcm_mpls_vpn_config_t; 725 #endif 726 727 #if defined(INCLUDE_L3) 728 /* Initialize the MPLS VPN config structure. */ 729 extern void bcm_mpls_vpn_config_t_init( 730 bcm_mpls_vpn_config_t *info); 731 #endif 732 733 #ifndef BCM_HIDE_DISPATCHABLE 734 735 #if defined(INCLUDE_L3) 736 /* Create an MPLS VPN. */ 737 extern int bcm_mpls_vpn_id_create( 738 int unit, 739 bcm_mpls_vpn_config_t *info); 740 #endif 741 742 #if defined(INCLUDE_L3) 743 /* Destroy an MPLS VPN. */ 744 extern int bcm_mpls_vpn_id_destroy( 745 int unit, 746 bcm_vpn_t vpn); 747 #endif 748 749 #if defined(INCLUDE_L3) 750 /* Destroy an MPLS VPN. */ 751 extern int bcm_mpls_vpn_id_destroy_all( 752 int unit); 753 #endif 754 755 #if defined(INCLUDE_L3) 756 /* Get an MPLS VPN. */ 757 extern int bcm_mpls_vpn_id_get( 758 int unit, 759 bcm_vpn_t vpn, 760 bcm_mpls_vpn_config_t *info); 761 #endif 762 763 #endif /* BCM_HIDE_DISPATCHABLE */ 764 765 /* MPLS vpn callback function prototype */ 766 #if defined(INCLUDE_L3) 767 typedef int(*bcm_mpls_vpn_traverse_cb)( 768 int unit, 769 bcm_mpls_vpn_config_t *info, 770 void *user_data); 771 #endif 772 773 #ifndef BCM_HIDE_DISPATCHABLE 774 775 #if defined(INCLUDE_L3) 776 /* 777 * Traverse all valid MPLS VPN entries and call the supplied callback 778 * routine. 779 */ 780 extern int bcm_mpls_vpn_traverse( 781 int unit, 782 bcm_mpls_vpn_traverse_cb cb, 783 void *user_data); 784 #endif 785 786 #if defined(INCLUDE_L3) 787 /* Add an MPLS port to an L2 VPN. */ 788 extern int bcm_mpls_port_add( 789 int unit, 790 bcm_vpn_t vpn, 791 bcm_mpls_port_t *mpls_port); 792 #endif 793 794 #if defined(INCLUDE_L3) 795 /* Delete an MPLS port from an L2 VPN. */ 796 extern int bcm_mpls_port_delete( 797 int unit, 798 bcm_vpn_t vpn, 799 bcm_gport_t mpls_port_id); 800 #endif 801 802 #if defined(INCLUDE_L3) 803 /* Delete an MPLS port from an L2 VPN. */ 804 extern int bcm_mpls_port_delete_all( 805 int unit, 806 bcm_vpn_t vpn); 807 #endif 808 809 #if defined(INCLUDE_L3) 810 /* Get an MPLS port from an L2 VPN. */ 811 extern int bcm_mpls_port_get( 812 int unit, 813 bcm_vpn_t vpn, 814 bcm_mpls_port_t *mpls_port); 815 #endif 816 817 #if defined(INCLUDE_L3) 818 /* Get all MPLS ports from an L2 VPN. */ 819 extern int bcm_mpls_port_get_all( 820 int unit, 821 bcm_vpn_t vpn, 822 int port_max, 823 bcm_mpls_port_t *port_array, 824 int *port_count); 825 #endif 826 827 #endif /* BCM_HIDE_DISPATCHABLE */ 828 829 #if defined(INCLUDE_L3) 830 /* MPLS statistics counters. */ 831 typedef enum bcm_mpls_stat_e { 832 bcmMplsInBytes = 0, 833 bcmMplsOutBytes = 1, 834 bcmMplsInPkts = 2, 835 bcmMplsOutPkts = 3 836 } bcm_mpls_stat_t; 837 #endif 838 839 #if defined(INCLUDE_L3) 840 /* bcm_mpls_stat_info_s */ 841 typedef struct bcm_mpls_stat_info_s { 842 bcm_mpls_stat_t stat; /* To specify In/Out Bytes/Pkts */ 843 uint32 num_entries; /* Number of Counter Entries */ 844 uint32 *counter_indexes; /* Pointer to Counter indexes */ 845 bcm_stat_value_t *counter_values; /* Pointer to counter values */ 846 } bcm_mpls_stat_info_t; 847 #endif 848 849 #if defined(INCLUDE_L3) 850 /* Initialize the MPLS tunnel Stat info structure. */ 851 extern void bcm_mpls_stat_info_t_init( 852 bcm_mpls_stat_info_t *stat_info); 853 #endif 854 855 #ifndef BCM_HIDE_DISPATCHABLE 856 857 #if defined(INCLUDE_L3) 858 /* 859 * Attach statistics entity to the MPLS tunnel derived from the 860 * given L3 Egress interface 861 */ 862 extern int bcm_mpls_tunnel_stat_attach( 863 int unit, 864 bcm_if_t intf_id, 865 uint32 stat_counter_id); 866 #endif 867 868 #if defined(INCLUDE_L3) 869 /* 870 * Detach statistics entity to the MPLS tunnel derived from the 871 * given L3 Egress interface. 872 */ 873 extern int bcm_mpls_tunnel_stat_detach( 874 int unit, 875 bcm_if_t intf_id); 876 #endif 877 878 #if defined(INCLUDE_L3) 879 /* 880 * Get counter value for the specified MPLS statistic type and Tunnel 881 * interface 882 * derived from the given L3 interface ID 883 */ 884 extern int bcm_mpls_tunnel_stat_counter_get( 885 int unit, 886 bcm_if_t intf_id, 887 bcm_mpls_stat_t stat, 888 uint32 num_entries, 889 uint32 *counter_indexes, 890 bcm_stat_value_t *counter_values); 891 #endif 892 893 #if defined(INCLUDE_L3) 894 /* 895 * Force an immediate counter update and retrieve the specified counter 896 * statistic for a MPLS tunnel 897 */ 898 extern int bcm_mpls_tunnel_stat_counter_sync_get( 899 int unit, 900 bcm_if_t intf_id, 901 bcm_mpls_stat_t stat, 902 uint32 num_entries, 903 uint32 *counter_indexes, 904 bcm_stat_value_t *counter_values); 905 #endif 906 907 #if defined(INCLUDE_L3) 908 /* 909 * Get stat counter ID associated with the MPLS tunnel derived from the 910 * given L3 interface ID. 911 */ 912 extern int bcm_mpls_tunnel_stat_id_get( 913 int unit, 914 bcm_if_t intf_id, 915 bcm_mpls_stat_t stat, 916 uint32 *stat_counter_id); 917 #endif 918 919 #if defined(INCLUDE_L3) 920 /* 921 * Set the counter value for the specified MPLS statistic type and Tunnel 922 * interface derived 923 * derived from the given L3 Interface ID. 924 */ 925 extern int bcm_mpls_tunnel_stat_counter_set( 926 int unit, 927 bcm_if_t intf_id, 928 bcm_mpls_stat_t stat, 929 uint32 num_entries, 930 uint32 *counter_indexes, 931 bcm_stat_value_t *counter_values); 932 #endif 933 934 #if defined(INCLUDE_L3) 935 /* 936 * Detach counter entry of the specific MPLS tunnel label 937 * pointed to by the given stat counter id. 938 */ 939 extern int bcm_mpls_tunnel_label_counter_id_detach( 940 int unit, 941 bcm_if_t intf_id, 942 uint32 stat_counter_id); 943 #endif 944 945 #if defined(INCLUDE_L3) 946 /* 947 * Get the specified counter statistics for the given MPLS Tunnel label 948 * and counter id associated with it. 949 */ 950 extern int bcm_mpls_tunnel_label_counter_id_stat_get( 951 int unit, 952 bcm_if_t intf_id, 953 uint32 stat_counter_id, 954 bcm_mpls_stat_info_t *stat_info); 955 #endif 956 957 #if defined(INCLUDE_L3) 958 /* 959 * Set the specified counter statistics for the given MPLS Tunnel label 960 * and counter id associated with it. 961 */ 962 extern int bcm_mpls_tunnel_label_counter_id_stat_set( 963 int unit, 964 bcm_if_t intf_id, 965 uint32 stat_counter_id, 966 bcm_mpls_stat_info_t *stat_info); 967 #endif 968 969 #if defined(INCLUDE_L3) 970 /* 971 * Get the specified counter statistics for the given MPLS Tunnel label 972 * and counter id associated with it. 973 * SW accumulated counters are made in sync with the hw count. 974 */ 975 extern int bcm_mpls_tunnel_label_counter_id_stat_sync_get( 976 int unit, 977 bcm_if_t intf_id, 978 uint32 stat_counter_id, 979 bcm_mpls_stat_info_t *stat_info); 980 #endif 981 982 #if defined(INCLUDE_L3) 983 /* 984 * Get the array of stat counter ids associated with the given MPLS 985 * tunnel 986 * interface. It can also provide the number of counter indexes 987 * associated 988 * with the MPLS tunnel. 989 */ 990 extern int bcm_mpls_tunnel_label_counter_id_num_get( 991 int unit, 992 bcm_if_t intf_id, 993 int *num_counters, 994 uint32 *stat_counter_id); 995 #endif 996 997 #if defined(INCLUDE_L3) 998 /* Set the MPLS tunnel initiator parameters for an L3 interface. */ 999 extern int bcm_mpls_tunnel_initiator_set( 1000 int unit, 1001 bcm_if_t intf, 1002 int num_labels, 1003 bcm_mpls_egress_label_t *label_array); 1004 #endif 1005 1006 #if defined(INCLUDE_L3) 1007 /* bcm_mpls_tunnel_initiator_create */ 1008 extern int bcm_mpls_tunnel_initiator_create( 1009 int unit, 1010 bcm_if_t intf, 1011 int num_labels, 1012 bcm_mpls_egress_label_t *label_array); 1013 #endif 1014 1015 #if defined(INCLUDE_L3) 1016 /* Clear the MPLS tunnel initiator parameters for an L3 interface. */ 1017 extern int bcm_mpls_tunnel_initiator_clear( 1018 int unit, 1019 bcm_if_t intf); 1020 #endif 1021 1022 #if defined(INCLUDE_L3) 1023 /* Clear all MPLS tunnel initiator information. */ 1024 extern int bcm_mpls_tunnel_initiator_clear_all( 1025 int unit); 1026 #endif 1027 1028 #if defined(INCLUDE_L3) 1029 /* Get the MPLS tunnel initiator parameters from an L3 interface. */ 1030 extern int bcm_mpls_tunnel_initiator_get( 1031 int unit, 1032 bcm_if_t intf, 1033 int label_max, 1034 bcm_mpls_egress_label_t *label_array, 1035 int *label_count); 1036 #endif 1037 1038 #endif /* BCM_HIDE_DISPATCHABLE */ 1039 1040 /* mpls_tunnel_initiator_traverse_info_s */ 1041 typedef struct bcm_mpls_tunnel_initiator_traverse_info_s { 1042 uint32 flags; /* BCM_MPLS_EGRESS_LABEL_xxx. */ 1043 } bcm_mpls_tunnel_initiator_traverse_info_t; 1044 1045 /* MPLS tunnel initiator callback function prototype */ 1046 #if defined(INCLUDE_L3) 1047 typedef int(*bcm_mpls_tunnel_initiator_traverse_cb)( 1048 int unit, 1049 int num_labels, 1050 bcm_mpls_egress_label_t *label_array, 1051 void *user_data); 1052 #endif 1053 1054 #ifndef BCM_HIDE_DISPATCHABLE 1055 1056 #if defined(INCLUDE_L3) 1057 /* 1058 * Traverse valid MPLS label egress entries, as per input flags, and call 1059 * the supplied callback routine. 1060 */ 1061 extern int bcm_mpls_tunnel_initiator_traverse( 1062 int unit, 1063 bcm_mpls_tunnel_initiator_traverse_info_t *additional_info, 1064 bcm_mpls_tunnel_initiator_traverse_cb cb, 1065 void *user_data); 1066 #endif 1067 1068 #endif /* BCM_HIDE_DISPATCHABLE */ 1069 1070 #if defined(INCLUDE_L3) 1071 /* MPLS tunnel encap options. */ 1072 #define BCM_MPLS_TUNNEL_ENCAP_OPTIONS_WITH_ID 0x00000001 /* ID is provided. */ 1073 #define BCM_MPLS_TUNNEL_ENCAP_OPTIONS_REPLACE 0x00000002 /* Replace the existing 1074 entry. */ 1075 #endif 1076 1077 /* MPLS egress label count max. */ 1078 #define BCM_MPLS_EGRESS_LABEL_MAX 8 1079 1080 /* MPLS tunnel encap flags. */ 1081 #define BCM_MPLS_TUNNEL_ENCAP_ENTROPY_ENABLE 0x00000001 /* Enable MPLS entropy. */ 1082 #define BCM_MPLS_TUNNEL_ENCAP_QOS_EXP_REMARK 0x00000002 /* Remark EXP. */ 1083 1084 #if defined(INCLUDE_L3) 1085 /* MPLS tunnel initiator structure. */ 1086 typedef struct bcm_mpls_tunnel_encap_s { 1087 bcm_gport_t tunnel_id; /* Tunnel ID. */ 1088 uint32 flags; /* BCM_MPLS_TUNNEL_ENCAP_xxx. */ 1089 int num_labels; /* Number of labels to be added. */ 1090 bcm_mpls_egress_label_t label_array[BCM_MPLS_EGRESS_LABEL_MAX]; /* Label info. */ 1091 int qos_map_id; /* EXP remarking map ID. */ 1092 } bcm_mpls_tunnel_encap_t; 1093 #endif 1094 1095 #if defined(INCLUDE_L3) 1096 /* Initialize the MPLS tunnel encap structure. */ 1097 extern void bcm_mpls_tunnel_encap_t_init( 1098 bcm_mpls_tunnel_encap_t *tunnel_encap); 1099 #endif 1100 1101 #ifndef BCM_HIDE_DISPATCHABLE 1102 1103 #if defined(INCLUDE_L3) 1104 /* Create the MPLS tunnel initiator. */ 1105 extern int bcm_mpls_tunnel_encap_create( 1106 int unit, 1107 uint32 options, 1108 bcm_mpls_tunnel_encap_t *tunnel_encap); 1109 #endif 1110 1111 #if defined(INCLUDE_L3) 1112 /* Destroy the MPLS tunnel initiator. */ 1113 extern int bcm_mpls_tunnel_encap_destroy( 1114 int unit, 1115 bcm_gport_t tunnel_id); 1116 #endif 1117 1118 #if defined(INCLUDE_L3) 1119 /* Destroy all MPLS tunnel initiators. */ 1120 extern int bcm_mpls_tunnel_encap_destroy_all( 1121 int unit); 1122 #endif 1123 1124 #if defined(INCLUDE_L3) 1125 /* Get the MPLS tunnel initiator. */ 1126 extern int bcm_mpls_tunnel_encap_get( 1127 int unit, 1128 bcm_mpls_tunnel_encap_t *tunnel_encap); 1129 #endif 1130 1131 #if defined(INCLUDE_L3) 1132 /* Add an MPLS label entry. */ 1133 extern int bcm_mpls_tunnel_switch_add( 1134 int unit, 1135 bcm_mpls_tunnel_switch_t *info); 1136 #endif 1137 1138 #if defined(INCLUDE_L3) 1139 /* Add an MPLS label entry. */ 1140 extern int bcm_mpls_tunnel_switch_create( 1141 int unit, 1142 bcm_mpls_tunnel_switch_t *info); 1143 #endif 1144 1145 #if defined(INCLUDE_L3) 1146 /* Delete an MPLS label entry. */ 1147 extern int bcm_mpls_tunnel_switch_delete( 1148 int unit, 1149 bcm_mpls_tunnel_switch_t *info); 1150 #endif 1151 1152 #if defined(INCLUDE_L3) 1153 /* Delete all MPLS label entries. */ 1154 extern int bcm_mpls_tunnel_switch_delete_all( 1155 int unit); 1156 #endif 1157 1158 #if defined(INCLUDE_L3) 1159 /* Get an MPLS label entry. */ 1160 extern int bcm_mpls_tunnel_switch_get( 1161 int unit, 1162 bcm_mpls_tunnel_switch_t *info); 1163 #endif 1164 1165 #endif /* BCM_HIDE_DISPATCHABLE */ 1166 1167 /* MPLS tunnel callback function prototype. */ 1168 #if defined(INCLUDE_L3) 1169 typedef int (*bcm_mpls_tunnel_switch_traverse_cb)( 1170 int unit, 1171 bcm_mpls_tunnel_switch_t *info, 1172 void *user_data); 1173 #endif 1174 1175 #ifndef BCM_HIDE_DISPATCHABLE 1176 1177 #if defined(INCLUDE_L3) 1178 /* 1179 * Traverse all valid MPLS label entries and call the supplied callback 1180 * routine. 1181 */ 1182 extern int bcm_mpls_tunnel_switch_traverse( 1183 int unit, 1184 bcm_mpls_tunnel_switch_traverse_cb cb, 1185 void *user_data); 1186 #endif 1187 1188 #endif /* BCM_HIDE_DISPATCHABLE */ 1189 1190 #if defined(INCLUDE_L3) 1191 /* MPLS entropy label config flags. */ 1192 #define BCM_MPLS_ENTROPY_LABEL_IDENTIFIER_TOS 0x00000001 /* Identifies entropy 1193 label, if present at 1194 the top of the label 1195 stack, based on a 1196 match of the upper 1197 label bits */ 1198 #endif 1199 1200 #ifndef BCM_HIDE_DISPATCHABLE 1201 1202 #if defined(INCLUDE_L3) 1203 /* Add an MPLS Entropy Label Identifier. */ 1204 extern int bcm_mpls_entropy_identifier_add( 1205 int unit, 1206 uint32 options, 1207 bcm_mpls_entropy_identifier_t *info); 1208 #endif 1209 1210 #if defined(INCLUDE_L3) 1211 /* Get information about an MPLS Entropy Label Identifier. */ 1212 extern int bcm_mpls_entropy_identifier_get( 1213 int unit, 1214 bcm_mpls_entropy_identifier_t *info); 1215 #endif 1216 1217 #if defined(INCLUDE_L3) 1218 /* Delete an MPLS Entropy Label Identifier. */ 1219 extern int bcm_mpls_entropy_identifier_delete( 1220 int unit, 1221 bcm_mpls_entropy_identifier_t *info); 1222 #endif 1223 1224 #if defined(INCLUDE_L3) 1225 /* Delete all MPLS Entropy Label Identifiers. */ 1226 extern int bcm_mpls_entropy_identifier_delete_all( 1227 int unit); 1228 #endif 1229 1230 #endif /* BCM_HIDE_DISPATCHABLE */ 1231 1232 /* MPLS entropy label callback function prototype. */ 1233 #if defined(INCLUDE_L3) 1234 typedef int (*bcm_mpls_entropy_identifier_traverse_cb)( 1235 int unit, 1236 bcm_mpls_entropy_identifier_t *info, 1237 void *user_data); 1238 #endif 1239 1240 #ifndef BCM_HIDE_DISPATCHABLE 1241 1242 #if defined(INCLUDE_L3) 1243 /* 1244 * Traverse all valid MPLS entropy label identifier entries and call the 1245 * supplied callback routine. 1246 */ 1247 extern int bcm_mpls_entropy_identifier_traverse( 1248 int unit, 1249 bcm_mpls_entropy_identifier_traverse_cb cb, 1250 void *user_data); 1251 #endif 1252 1253 #endif /* BCM_HIDE_DISPATCHABLE */ 1254 1255 #if defined(INCLUDE_L3) 1256 /* MPLS EXP map modes. */ 1257 #define BCM_MPLS_EXP_MAP_WITH_ID 0x01 1258 #define BCM_MPLS_EXP_MAP_INGRESS 0x02 1259 #define BCM_MPLS_EXP_MAP_EGRESS 0x04 1260 #define BCM_MPLS_EXP_MAP_EGRESS_L2 0x08 1261 #endif 1262 1263 #ifndef BCM_HIDE_DISPATCHABLE 1264 1265 #if defined(INCLUDE_L3) 1266 /* Create an MPLS EXP map instance. */ 1267 extern int bcm_mpls_exp_map_create( 1268 int unit, 1269 uint32 flags, 1270 int *exp_map_id); 1271 #endif 1272 1273 #if defined(INCLUDE_L3) 1274 /* Destroy an MPLS EXP map instance. */ 1275 extern int bcm_mpls_exp_map_destroy( 1276 int unit, 1277 int exp_map_id); 1278 #endif 1279 1280 #if defined(INCLUDE_L3) 1281 /* Set the EXP mapping parameters for the specified EXP map. */ 1282 extern int bcm_mpls_exp_map_set( 1283 int unit, 1284 int exp_map_id, 1285 bcm_mpls_exp_map_t *exp_map); 1286 #endif 1287 1288 #if defined(INCLUDE_L3) 1289 /* Get the EXP mapping parameters for the specified EXP map. */ 1290 extern int bcm_mpls_exp_map_get( 1291 int unit, 1292 int exp_map_id, 1293 bcm_mpls_exp_map_t *exp_map); 1294 #endif 1295 1296 #if defined(INCLUDE_L3) 1297 /* Enable/disable statistics collection for MPLS label or MPLS gport */ 1298 extern int bcm_mpls_label_stat_enable_set( 1299 int unit, 1300 bcm_mpls_label_t label, 1301 bcm_gport_t port, 1302 int enable); 1303 #endif 1304 1305 #if defined(INCLUDE_L3) 1306 /* Get MPLS Stats. */ 1307 extern int bcm_mpls_label_stat_get( 1308 int unit, 1309 bcm_mpls_label_t label, 1310 bcm_gport_t port, 1311 bcm_mpls_stat_t stat, 1312 uint64 *val); 1313 #endif 1314 1315 #if defined(INCLUDE_L3) 1316 /* Force an immediate counter update and retrieve MPLS Stats. */ 1317 extern int bcm_mpls_label_stat_sync_get( 1318 int unit, 1319 bcm_mpls_label_t label, 1320 bcm_gport_t port, 1321 bcm_mpls_stat_t stat, 1322 uint64 *val); 1323 #endif 1324 1325 #if defined(INCLUDE_L3) 1326 /* Get MPLS Stats. */ 1327 extern int bcm_mpls_label_stat_get32( 1328 int unit, 1329 bcm_mpls_label_t label, 1330 bcm_gport_t port, 1331 bcm_mpls_stat_t stat, 1332 uint32 *val); 1333 #endif 1334 1335 #if defined(INCLUDE_L3) 1336 /* Force an immediate counter update and retrieve MPLS Stats. */ 1337 extern int bcm_mpls_label_stat_sync_get32( 1338 int unit, 1339 bcm_mpls_label_t label, 1340 bcm_gport_t port, 1341 bcm_mpls_stat_t stat, 1342 uint32 *val); 1343 #endif 1344 1345 #if defined(INCLUDE_L3) 1346 /* Clear MPLS Stats. */ 1347 extern int bcm_mpls_label_stat_clear( 1348 int unit, 1349 bcm_mpls_label_t label, 1350 bcm_gport_t port, 1351 bcm_mpls_stat_t stat); 1352 #endif 1353 1354 #if defined(INCLUDE_L3) 1355 /* Set flex counter object value for the given MPLS label. */ 1356 extern int bcm_mpls_label_flexctr_object_set( 1357 int unit, 1358 bcm_mpls_label_t label, 1359 bcm_gport_t port, 1360 uint32 value); 1361 #endif 1362 1363 #if defined(INCLUDE_L3) 1364 /* Get flex counter object value for the given MPLS label. */ 1365 extern int bcm_mpls_label_flexctr_object_get( 1366 int unit, 1367 bcm_mpls_label_t label, 1368 bcm_gport_t port, 1369 uint32 *value); 1370 #endif 1371 1372 #if defined(INCLUDE_L3) 1373 /* Enable or disable collection of MPLS port statistics. */ 1374 extern int bcm_mpls_port_stat_enable_set( 1375 int unit, 1376 bcm_gport_t mpls_port, 1377 int enable); 1378 #endif 1379 1380 #endif /* BCM_HIDE_DISPATCHABLE */ 1381 1382 #if defined(INCLUDE_L3) 1383 /* Types of statistics that are maintained per MPLS gport. */ 1384 typedef enum bcm_mpls_port_stat_e { 1385 bcmMplsPortStatUnicastPackets = 0, 1386 bcmMplsPortStatUnicastBytes = 1, 1387 bcmMplsPortStatNonUnicastPackets = 2, 1388 bcmMplsPortStatNonUnicastBytes = 3, 1389 bcmMplsPortStatDropPackets = 4, 1390 bcmMplsPortStatDropBytes = 5, 1391 bcmMplsPortStatFloodPackets = 6, 1392 bcmMplsPortStatFloodBytes = 7, 1393 bcmMplsPortStatFloodDropPackets = 8, 1394 bcmMplsPortStatFloodDropBytes = 9, 1395 bcmMplsPortStatGreenPackets = 10, 1396 bcmMplsPortStatGreenBytes = 11, 1397 bcmMplsPortStatYellowPackets = 12, 1398 bcmMplsPortStatYellowBytes = 13, 1399 bcmMplsPortStatRedPackets = 14, 1400 bcmMplsPortStatRedBytes = 15 1401 } bcm_mpls_port_stat_t; 1402 #endif 1403 1404 #ifndef BCM_HIDE_DISPATCHABLE 1405 1406 #if defined(INCLUDE_L3) 1407 /* Set the specified statistic to the indicated value. */ 1408 extern int bcm_mpls_port_stat_set( 1409 int unit, 1410 bcm_gport_t mpls_port, 1411 bcm_cos_t cos, 1412 bcm_mpls_port_stat_t stat, 1413 uint64 val); 1414 #endif 1415 1416 #if defined(INCLUDE_L3) 1417 /* bcm_mpls_port_stat_set32 */ 1418 extern int bcm_mpls_port_stat_set32( 1419 int unit, 1420 bcm_gport_t mpls_port, 1421 bcm_cos_t cos, 1422 bcm_mpls_port_stat_t stat, 1423 uint32 val); 1424 #endif 1425 1426 #if defined(INCLUDE_L3) 1427 /* Get the specified statistics per MPLS/MEF port. */ 1428 extern int bcm_mpls_port_stat_get( 1429 int unit, 1430 bcm_gport_t mpls_port, 1431 bcm_cos_t cos, 1432 bcm_mpls_port_stat_t stat, 1433 uint64 *val); 1434 #endif 1435 1436 #if defined(INCLUDE_L3) 1437 /* Get the specified statistics per MPLS/MEF port. */ 1438 extern int bcm_mpls_port_stat_get32( 1439 int unit, 1440 bcm_gport_t mpls_port, 1441 bcm_cos_t cos, 1442 bcm_mpls_port_stat_t stat, 1443 uint32 *val); 1444 #endif 1445 1446 #if defined(INCLUDE_L3) 1447 /* Get stat counter ID associated with given MPLS gport and VPN. */ 1448 extern int bcm_mpls_port_stat_id_get( 1449 int unit, 1450 bcm_vpn_t vpn, 1451 bcm_gport_t port, 1452 bcm_mpls_stat_t stat, 1453 uint32 *stat_counter_id); 1454 #endif 1455 1456 #if defined(INCLUDE_L3) 1457 /* Get stat counter ID associated with given MPLS label and gport. */ 1458 extern int bcm_mpls_label_stat_id_get( 1459 int unit, 1460 bcm_mpls_label_t label, 1461 bcm_gport_t port, 1462 bcm_mpls_stat_t stat, 1463 uint32 *stat_counter_id); 1464 #endif 1465 1466 #if defined(INCLUDE_L3) 1467 /* Attach counters entries to the given MPLS gport and vpn */ 1468 extern int bcm_mpls_port_stat_attach( 1469 int unit, 1470 bcm_vpn_t vpn, 1471 bcm_gport_t port, 1472 uint32 stat_counter_id); 1473 #endif 1474 1475 #if defined(INCLUDE_L3) 1476 /* Detach counters entries to the given MPLS port and vpn */ 1477 extern int bcm_mpls_port_stat_detach( 1478 int unit, 1479 bcm_vpn_t vpn, 1480 bcm_gport_t port); 1481 #endif 1482 1483 #if defined(INCLUDE_L3) 1484 /* Get counter statistic values for specific vpn and gport */ 1485 extern int bcm_mpls_port_stat_counter_get( 1486 int unit, 1487 bcm_vpn_t vpn, 1488 bcm_gport_t port, 1489 bcm_mpls_stat_t stat, 1490 uint32 num_entries, 1491 uint32 *counter_indexes, 1492 bcm_stat_value_t *counter_values); 1493 #endif 1494 1495 #if defined(INCLUDE_L3) 1496 /* 1497 * Force an immediate counter update and retrieve get counter statistic 1498 * values for specific vpn and gport 1499 */ 1500 extern int bcm_mpls_port_stat_counter_sync_get( 1501 int unit, 1502 bcm_vpn_t vpn, 1503 bcm_gport_t port, 1504 bcm_mpls_stat_t stat, 1505 uint32 num_entries, 1506 uint32 *counter_indexes, 1507 bcm_stat_value_t *counter_values); 1508 #endif 1509 1510 #if defined(INCLUDE_L3) 1511 /* Set counter statistic values for specific vpn and gport */ 1512 extern int bcm_mpls_port_stat_counter_set( 1513 int unit, 1514 bcm_vpn_t vpn, 1515 bcm_gport_t port, 1516 bcm_mpls_stat_t stat, 1517 uint32 num_entries, 1518 uint32 *counter_indexes, 1519 bcm_stat_value_t *counter_values); 1520 #endif 1521 1522 #if defined(INCLUDE_L3) 1523 /* Attach counters entries to the given MPLS label and gport */ 1524 extern int bcm_mpls_label_stat_attach( 1525 int unit, 1526 bcm_mpls_label_t label, 1527 bcm_gport_t port, 1528 uint32 stat_counter_id); 1529 #endif 1530 1531 #if defined(INCLUDE_L3) 1532 /* Detach counters entries to the given MPLS label and gport */ 1533 extern int bcm_mpls_label_stat_detach( 1534 int unit, 1535 bcm_mpls_label_t label, 1536 bcm_gport_t port); 1537 #endif 1538 1539 #if defined(INCLUDE_L3) 1540 /* 1541 * Force an immediate counter update and retrieve counter statistic 1542 * values for 1543 * specific MPLS label and gport 1544 */ 1545 extern int bcm_mpls_label_stat_counter_sync_get( 1546 int unit, 1547 bcm_mpls_label_t label, 1548 bcm_gport_t port, 1549 bcm_mpls_stat_t stat, 1550 uint32 num_entries, 1551 uint32 *counter_indexes, 1552 bcm_stat_value_t *counter_values); 1553 #endif 1554 1555 #if defined(INCLUDE_L3) 1556 /* Get counter statistic values for specific MPLS label and gport */ 1557 extern int bcm_mpls_label_stat_counter_get( 1558 int unit, 1559 bcm_mpls_label_t label, 1560 bcm_gport_t port, 1561 bcm_mpls_stat_t stat, 1562 uint32 num_entries, 1563 uint32 *counter_indexes, 1564 bcm_stat_value_t *counter_values); 1565 #endif 1566 1567 #if defined(INCLUDE_L3) 1568 /* Set counter statistic values for specific MPLS label and gport */ 1569 extern int bcm_mpls_label_stat_counter_set( 1570 int unit, 1571 bcm_mpls_label_t label, 1572 bcm_gport_t port, 1573 bcm_mpls_stat_t stat, 1574 uint32 num_entries, 1575 uint32 *counter_indexes, 1576 bcm_stat_value_t *counter_values); 1577 #endif 1578 1579 #endif /* BCM_HIDE_DISPATCHABLE */ 1580 1581 #if defined(INCLUDE_L3) 1582 #define BCM_MPLS_INDEXED_LABEL_SET(_label, _label_value, _index) _SHR_MPLS_INDEXED_LABEL_SET(_label, _label_value,_index) 1583 #define BCM_MPLS_INDEXED_LABEL_VALUE_GET(_label) _SHR_MPLS_INDEXED_LABEL_VALUE_GET(_label) 1584 #define BCM_MPLS_INDEXED_LABEL_INDEX_GET(_label) _SHR_MPLS_INDEXED_LABEL_INDEX_GET(_label) 1585 #endif 1586 1587 #if defined(INCLUDE_L3) 1588 /* MPLS range action */ 1589 typedef struct bcm_mpls_range_action_s { 1590 uint32 flags; /* BCM_MPLS_RANGE_ACTION_xxx */ 1591 bcm_mpls_label_t compressed_label; /* lowest label in the range */ 1592 } bcm_mpls_range_action_t; 1593 #endif 1594 1595 /* MPLS range action flags. */ 1596 #define BCM_MPLS_RANGE_ACTION_COMPRESSED 0x00000001 /* Given label range will 1597 be represented by the 1598 lowest label */ 1599 #define BCM_MPLS_RANGE_ACTION_EVPN_IML 0x00000002 /* Specify a range for 1600 EVPN IML labels */ 1601 #define BCM_MPLS_RANGE_ACTION_VID 0x00000004 /* Mpls range profile: 1602 ptagged, outer tag 1603 valid */ 1604 #define BCM_MPLS_RANGE_ACTION_INNER_VID 0x00000008 /* Mpls range profile: 1605 ptagged, inner tag 1606 valid */ 1607 #define BCM_MPLS_RANGE_ACTION_CONTROL_WORD 0x00000010 /* Indicate that all the 1608 labels in the range 1609 have CW */ 1610 1611 #ifndef BCM_HIDE_DISPATCHABLE 1612 1613 #if defined(INCLUDE_L3) 1614 /* Set range of labels per in lif. */ 1615 extern int bcm_mpls_range_action_add( 1616 int unit, 1617 bcm_mpls_label_t label_low, 1618 bcm_mpls_label_t label_high, 1619 bcm_mpls_range_action_t *action); 1620 #endif 1621 1622 #if defined(INCLUDE_L3) 1623 /* Remove range of labels per in lif. */ 1624 extern int bcm_mpls_range_action_remove( 1625 int unit, 1626 bcm_mpls_label_t label_low, 1627 bcm_mpls_label_t label_high); 1628 #endif 1629 1630 #if defined(INCLUDE_L3) 1631 /* Get range of labels per in lif. */ 1632 extern int bcm_mpls_range_action_get( 1633 int unit, 1634 bcm_mpls_label_t label_low, 1635 bcm_mpls_label_t label_high, 1636 bcm_mpls_range_action_t *action); 1637 #endif 1638 1639 #endif /* BCM_HIDE_DISPATCHABLE */ 1640 1641 #if defined(INCLUDE_L3) 1642 /* Initialize the MPLS range action structure. */ 1643 extern void bcm_mpls_range_action_t_init( 1644 bcm_mpls_range_action_t *label); 1645 #endif 1646 1647 #if defined(INCLUDE_L3) 1648 /* Mpls Special push type element structure. */ 1649 typedef struct bcm_mpls_special_label_push_element_s { 1650 bcm_gport_t gport; /* GPORT identifier. */ 1651 bcm_if_t egr_obj_id; /* Egress Objec Index. */ 1652 } bcm_mpls_special_label_push_element_t; 1653 #endif 1654 1655 #if defined(INCLUDE_L3) 1656 /* Initialize the MPLS special label push element structure. */ 1657 extern void bcm_mpls_special_label_push_element_t_init( 1658 bcm_mpls_special_label_push_element_t *element); 1659 #endif 1660 1661 #ifndef BCM_HIDE_DISPATCHABLE 1662 1663 #if defined(INCLUDE_L3) 1664 /* Set push action from the element provided by user. */ 1665 extern int bcm_mpls_special_label_push_action_set( 1666 int unit, 1667 bcm_mpls_special_label_push_element_t *element, 1668 int push_action); 1669 #endif 1670 1671 #if defined(INCLUDE_L3) 1672 /* Get push action from the element provided by user. */ 1673 extern int bcm_mpls_special_label_push_action_get( 1674 int unit, 1675 bcm_mpls_special_label_push_element_t *element, 1676 int *push_action); 1677 #endif 1678 1679 #endif /* BCM_HIDE_DISPATCHABLE */ 1680 1681 #if defined(INCLUDE_L3) 1682 /* structure of MPLS special label. */ 1683 typedef struct bcm_mpls_special_label_s { 1684 uint32 flags; /* BCM_MPLS_SPECIAL_LABEL_XXX. */ 1685 bcm_mpls_label_t label_value; /* Label value. */ 1686 bcm_mpls_label_t label_mask; /* Label mask. */ 1687 uint32 exp; /* exp value. */ 1688 uint32 exp_mask; /* exp value. */ 1689 uint32 ttl; /* exp value. */ 1690 uint32 ttl_mask; /* exp value. */ 1691 } bcm_mpls_special_label_t; 1692 #endif 1693 1694 #if defined(INCLUDE_L3) 1695 /* Initialize MPLS Special label structure. */ 1696 extern void bcm_mpls_special_label_t_init( 1697 bcm_mpls_special_label_t *label_info); 1698 #endif 1699 1700 /* Special Label flags Values. */ 1701 #define BCM_MPLS_SPECIAL_LABEL_USE_TABLE_EXP 0x00000001 /* Use exp value from 1702 this table */ 1703 #define BCM_MPLS_SPECIAL_LABEL_USE_TABLE_TTL 0x00000002 /* Use ttl value from 1704 this table */ 1705 #define BCM_MPLS_SPECIAL_LABEL_CURR_LABEL_EXCLUDE_HASH 0x00000004 /* Exclude this label 1706 from hash computation */ 1707 #define BCM_MPLS_SPECIAL_LABEL_NEXT_LABEL_EXCLUDE_HASH 0x00000008 /* Exclude next label 1708 from hash computation */ 1709 #define BCM_MPLS_SPECIAL_LABEL_CURR_LABEL_EXCLUDE_LKUP 0x00000010 /* Exclude current label 1710 from lookup */ 1711 #define BCM_MPLS_SPECIAL_LABEL_NEXT_LABEL_EXCLUDE_LKUP 0x00000020 /* Exclude next label 1712 from lookup */ 1713 #define BCM_MPLS_SPECIAL_LABEL_INHERITANCE_ENABLE 0x00000040 /* Enable inherit logic 1714 on this label */ 1715 #define BCM_MPLS_SPECIAL_LABEL_BOS_PRESENT 0x00000080 /* Incoming label is 1716 matched if BOS */ 1717 #define BCM_MPLS_SPECIAL_LABEL_BOS_MASKED 0x00000100 /* Mask BOS matching for 1718 incoming label */ 1719 #define BCM_MPLS_SPECIAL_LABEL_CURR_LABEL_RESERVE 0x00000200 /* Specify this label as 1720 a reserved label */ 1721 #define BCM_MPLS_SPECIAL_LABEL_NEXT_LABEL_ACTION_CANCEL 0x00000400 /* Cancel the action of 1722 the next label */ 1723 1724 #ifndef BCM_HIDE_DISPATCHABLE 1725 1726 #if defined(INCLUDE_L3) 1727 /* Add Egress special labels. */ 1728 extern int bcm_mpls_special_label_egress_add( 1729 int unit, 1730 bcm_mpls_special_label_type_t label_type, 1731 bcm_mpls_special_label_t label_info); 1732 #endif 1733 1734 #if defined(INCLUDE_L3) 1735 /* Get Egress spceial labels. */ 1736 extern int bcm_mpls_special_label_egress_get( 1737 int unit, 1738 bcm_mpls_special_label_type_t label_type, 1739 bcm_mpls_special_label_t *label_info); 1740 #endif 1741 1742 #if defined(INCLUDE_L3) 1743 /* Delete Egress Special Labels. */ 1744 extern int bcm_mpls_special_label_egress_delete( 1745 int unit, 1746 bcm_mpls_special_label_type_t label_type, 1747 bcm_mpls_special_label_t label_info); 1748 #endif 1749 1750 #if defined(INCLUDE_L3) 1751 /* Delete all Egress Special Labels. */ 1752 extern int bcm_mpls_special_label_egress_delete_all( 1753 int unit); 1754 #endif 1755 1756 #endif /* BCM_HIDE_DISPATCHABLE */ 1757 1758 /* MPLS Special Label callback function prototype. */ 1759 #if defined(INCLUDE_L3) 1760 typedef int (*bcm_mpls_special_label_egress_traverse_cb)( 1761 int unit, 1762 bcm_mpls_special_label_type_t *label_type, 1763 bcm_mpls_special_label_t *label_info, 1764 void *user_data); 1765 #endif 1766 1767 #ifndef BCM_HIDE_DISPATCHABLE 1768 1769 #if defined(INCLUDE_L3) 1770 /* 1771 * Traverse all egress special labels and callback user provided 1772 * callback. 1773 */ 1774 extern int bcm_mpls_special_label_egress_traverse( 1775 int unit, 1776 bcm_mpls_special_label_egress_traverse_cb cb, 1777 void *user_data); 1778 #endif 1779 1780 #if defined(INCLUDE_L3) 1781 /* Add Egress special labels. */ 1782 extern int bcm_mpls_special_label_identifier_add( 1783 int unit, 1784 bcm_mpls_special_label_type_t label_type, 1785 bcm_mpls_special_label_t label_info); 1786 #endif 1787 1788 #if defined(INCLUDE_L3) 1789 /* Get Egress spceial labels. */ 1790 extern int bcm_mpls_special_label_identifier_get( 1791 int unit, 1792 bcm_mpls_special_label_type_t label_type, 1793 bcm_mpls_special_label_t *label_info); 1794 #endif 1795 1796 #if defined(INCLUDE_L3) 1797 /* Delete Egress Special Labels. */ 1798 extern int bcm_mpls_special_label_identifier_delete( 1799 int unit, 1800 bcm_mpls_special_label_type_t label_type, 1801 bcm_mpls_special_label_t label_info); 1802 #endif 1803 1804 #if defined(INCLUDE_L3) 1805 /* Delete all Egress Special Labels. */ 1806 extern int bcm_mpls_special_label_identifier_delete_all( 1807 int unit); 1808 #endif 1809 1810 #endif /* BCM_HIDE_DISPATCHABLE */ 1811 1812 /* MPLS Special Label identifier callback function prototype. */ 1813 #if defined(INCLUDE_L3) 1814 typedef int (*bcm_mpls_special_label_identifier_traverse_cb)( 1815 int unit, 1816 bcm_mpls_special_label_type_t *label_type, 1817 bcm_mpls_special_label_t *label_info, 1818 void *user_data); 1819 #endif 1820 1821 #ifndef BCM_HIDE_DISPATCHABLE 1822 1823 #if defined(INCLUDE_L3) 1824 /* 1825 * Traverse all ingress special labels and callback user provided 1826 * callback. 1827 */ 1828 extern int bcm_mpls_special_label_identifier_traverse( 1829 int unit, 1830 bcm_mpls_special_label_identifier_traverse_cb cb, 1831 void *user_data); 1832 #endif 1833 1834 #endif /* BCM_HIDE_DISPATCHABLE */ 1835 1836 #if defined(INCLUDE_L3) 1837 /* structure of MPLS esi object. */ 1838 typedef struct bcm_mpls_esi_info_s { 1839 uint32 flags; /* BCM_MPLS_ESI_xxx. */ 1840 bcm_gport_t src_port; /* GPORT of incoming eth segment's port. */ 1841 uint32 out_class_id; /* Multi-homing peer class. */ 1842 bcm_mpls_label_t esi_label; /* Will be set on the ESI label. */ 1843 } bcm_mpls_esi_info_t; 1844 #endif 1845 1846 #ifndef BCM_HIDE_DISPATCHABLE 1847 1848 #if defined(INCLUDE_L3) 1849 /* Add Egress special labels. */ 1850 extern int bcm_mpls_esi_encap_add( 1851 int unit, 1852 bcm_mpls_esi_info_t *esi_info); 1853 #endif 1854 1855 #if defined(INCLUDE_L3) 1856 /* Get esi encap id. */ 1857 extern int bcm_mpls_esi_encap_get( 1858 int unit, 1859 bcm_mpls_esi_info_t *esi_info); 1860 #endif 1861 1862 #if defined(INCLUDE_L3) 1863 /* Delete esi encap id values. */ 1864 extern int bcm_mpls_esi_encap_delete( 1865 int unit, 1866 bcm_mpls_esi_info_t *esi_info); 1867 #endif 1868 1869 #endif /* BCM_HIDE_DISPATCHABLE */ 1870 1871 /* MPLS esi encap callback function prototype. */ 1872 #if defined(INCLUDE_L3) 1873 typedef int (*bcm_mpls_esi_encap_traverse_cb)( 1874 int unit, 1875 bcm_mpls_esi_info_t *info, 1876 void *user_data); 1877 #endif 1878 1879 #ifndef BCM_HIDE_DISPATCHABLE 1880 1881 #if defined(INCLUDE_L3) 1882 /* Traverse routine for esi encap id. */ 1883 extern int bcm_mpls_esi_encap_traverse( 1884 int unit, 1885 bcm_mpls_esi_encap_traverse_cb cb, 1886 void *user_data); 1887 #endif 1888 1889 #endif /* BCM_HIDE_DISPATCHABLE */ 1890 1891 #if defined(INCLUDE_L3) 1892 /* Initialize an Esi info structure. */ 1893 extern void bcm_mpls_esi_info_t_init( 1894 bcm_mpls_esi_info_t *esi_info); 1895 #endif 1896 1897 /* MPLS port callback function prototype. */ 1898 #if defined(INCLUDE_L3) 1899 typedef int (*bcm_mpls_port_traverse_cb)( 1900 int unit, 1901 bcm_mpls_port_t *mpls_port, 1902 void *user_data); 1903 #endif 1904 1905 #if defined(INCLUDE_L3) 1906 /* structure of MPLS port object. */ 1907 typedef struct bcm_mpls_port_traverse_info_s { 1908 uint32 flags; /* BCM_MPLS_PORT_xxx. */ 1909 uint32 flags2; /* BCM_MPLS_PORT2_xxx. */ 1910 uint32 traverse_flags; /* BCM_MPLS_TRAVERSE_xxx. */ 1911 int vpn; /* Vpn to traverse over. */ 1912 } bcm_mpls_port_traverse_info_t; 1913 #endif 1914 1915 #ifndef BCM_HIDE_DISPATCHABLE 1916 1917 #if defined(INCLUDE_L3) 1918 /* Traverse routine for port info. */ 1919 extern int bcm_mpls_port_traverse( 1920 int unit, 1921 bcm_mpls_port_traverse_info_t additional_info, 1922 bcm_mpls_port_traverse_cb trav_fn, 1923 void *user_data); 1924 #endif 1925 1926 #endif /* BCM_HIDE_DISPATCHABLE */ 1927 1928 #if defined(INCLUDE_L3) 1929 /* Flags for bcm_mpls_control_pkt_add. */ 1930 #define BCM_MPLS_CONTROL_PKT_OPTIONS_REPLACE 0x00000001 /* Replace the control 1931 action. */ 1932 #endif 1933 1934 #if defined(INCLUDE_L3) 1935 /* MPLS flow type. */ 1936 typedef enum bcm_mpls_flow_e { 1937 bcmMplsFlowNone = 0, /* Not MPLS flow type. */ 1938 bcmMplsFlowL2Term = 1, /* L2 MPLS termination flow. */ 1939 bcmMplsFlowL3Term = 2, /* L3 MPLS termination flow. */ 1940 bcmMplsFlowTransit = 3, /* Transit MPLS flow. */ 1941 bcmMplsFlowPhp = 4, /* Penultimate hop popping MPLS flow. */ 1942 bcmMplsFlowCount = 5 /* Must be the last one. */ 1943 } bcm_mpls_flow_t; 1944 #endif 1945 1946 #if defined(INCLUDE_L3) 1947 /* MPLS control word check mode. */ 1948 typedef enum bcm_mpls_control_word_check_e { 1949 bcmMplsControlWordCheckDisable = 0, /* Disable MPLS control word check. */ 1950 bcmMplsControlWordCheckLoose = 1, /* Loose mode for MPLS control word 1951 check. */ 1952 bcmMplsControlWordCheckStrict = 2, /* Strict mode for MPLS control word 1953 check. */ 1954 bcmMplsControlWordCheckCount = 3 /* Must be the last one. */ 1955 } bcm_mpls_control_word_check_t; 1956 #endif 1957 1958 #if defined(INCLUDE_L3) 1959 /* Structure of MPLS control packet match. */ 1960 typedef struct bcm_mpls_control_pkt_match_s { 1961 uint32 priority; /* Entry priority. */ 1962 uint8 bos_after_lookup_labels; /* BOS next to lookup labels. */ 1963 uint8 bos_after_lookup_labels_mask; /* Mask of bos_after_lookup_labels. */ 1964 uint8 gal_after_lookup_labels; /* GAL next to lookup labels. */ 1965 uint8 gal_after_lookup_labels_mask; /* Mask of gal_after_lookup_labels. */ 1966 uint8 eli_after_lookup_labels; /* ELI next to lookup labels. */ 1967 uint8 eli_after_lookup_labels_mask; /* Mask of eli_after_lookup_labels. */ 1968 uint8 el_bos_after_lookup_labels; /* Entropy label BOS next to lookup 1969 labels. */ 1970 uint8 el_bos_after_lookup_labels_mask; /* Mask of el_bos_after_lookup_labels. */ 1971 uint8 gal_valid; /* Valid GAL. */ 1972 uint8 gal_valid_mask; /* Mask of gal_valid. */ 1973 uint8 el_valid; /* Valid entropy label. */ 1974 uint8 el_valid_mask; /* Mask of el_valid. */ 1975 uint8 stat_enable; /* Packet stats enable status. Triggered 1976 by BCM_MPLS_PORT_SEQUENCED, 1977 BCM_MPLS_PORT_CONTROL_WORD or 1978 BCM_MPLS_SWITCH_COUNTED. */ 1979 uint8 stat_enable_mask; /* Mask of stat_enable. */ 1980 uint8 control_word_ach_indicator; /* Control word or ACH indicator. */ 1981 uint8 control_word_ach_indicator_mask; /* Mask of control_word_ach_indicator. */ 1982 bcm_mpls_flow_t flow; /* MPLS flow type. */ 1983 uint8 flow_mask; /* Mask of flow. */ 1984 bcm_mpls_control_word_check_t control_word_check; /* Control word check mode. */ 1985 uint8 control_word_check_mask; /* Mask of control_word_check. */ 1986 bcm_mpls_port_control_channel_type_t vccv_type; /* Control channel type. */ 1987 uint8 vccv_type_mask; /* Mask of vccv_type. */ 1988 } bcm_mpls_control_pkt_match_t; 1989 #endif 1990 1991 #if defined(INCLUDE_L3) 1992 /* Structure of MPLS control packet action. */ 1993 typedef struct bcm_mpls_control_pkt_action_s { 1994 uint8 drop; /* Enable to drop the packet. */ 1995 uint8 control_packet; /* Indicate control packet. */ 1996 uint8 control_packet_type; /* Indicate control packet type. Applicable only 1997 when control_packet is set. */ 1998 uint8 copy_to_cpu; /* Enable to copy the packet to CPU. */ 1999 uint8 seq_num_check; /* Enable to check the packet sequence number. */ 2000 } bcm_mpls_control_pkt_action_t; 2001 #endif 2002 2003 /* MPLS control packet callback function prototype. */ 2004 #if defined(INCLUDE_L3) 2005 typedef int (*bcm_mpls_control_pkt_traverse_cb)( 2006 int unit, 2007 bcm_mpls_control_pkt_match_t *match, 2008 bcm_mpls_control_pkt_action_t *action, 2009 void *user_data); 2010 #endif 2011 2012 #if defined(INCLUDE_L3) 2013 /* Initialize the MPLS control packet match structure. */ 2014 extern void bcm_mpls_control_pkt_match_t_init( 2015 bcm_mpls_control_pkt_match_t *match); 2016 #endif 2017 2018 #if defined(INCLUDE_L3) 2019 /* Initialize the MPLS control packet action structure. */ 2020 extern void bcm_mpls_control_pkt_action_t_init( 2021 bcm_mpls_control_pkt_action_t *action); 2022 #endif 2023 2024 #ifndef BCM_HIDE_DISPATCHABLE 2025 2026 #if defined(INCLUDE_L3) 2027 /* Add an MPLS control packet entry. */ 2028 extern int bcm_mpls_control_pkt_add( 2029 int unit, 2030 uint32 options, 2031 bcm_mpls_control_pkt_match_t *match, 2032 bcm_mpls_control_pkt_action_t *action); 2033 #endif 2034 2035 #if defined(INCLUDE_L3) 2036 /* Get an MPLS control packet entry. */ 2037 extern int bcm_mpls_control_pkt_get( 2038 int unit, 2039 bcm_mpls_control_pkt_match_t *match, 2040 bcm_mpls_control_pkt_action_t *action); 2041 #endif 2042 2043 #if defined(INCLUDE_L3) 2044 /* Delete an MPLS control packet entry. */ 2045 extern int bcm_mpls_control_pkt_delete( 2046 int unit, 2047 bcm_mpls_control_pkt_match_t *match); 2048 #endif 2049 2050 #if defined(INCLUDE_L3) 2051 /* Delete all MPLS control packet entries. */ 2052 extern int bcm_mpls_control_pkt_delete_all( 2053 int unit); 2054 #endif 2055 2056 #if defined(INCLUDE_L3) 2057 /* 2058 * Traverse all MPLS control packet entries and call user provided 2059 * callback. 2060 */ 2061 extern int bcm_mpls_control_pkt_traverse( 2062 int unit, 2063 bcm_mpls_control_pkt_traverse_cb cb, 2064 void *user_data); 2065 #endif 2066 2067 #endif /* BCM_HIDE_DISPATCHABLE */ 2068 2069 #endif /* __BCM_MPLS_H__ */