openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

mpls.h (70624B)


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