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 (19627B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * This file contains mpls definitions internal to the BCM library.
      8  */
      9 
     10 #ifndef _BCM_INT_MPLS_H
     11 #define _BCM_INT_MPLS_H
     12 
     13 #include <bcm_int/esw/vpn.h>
     14 #include <bcm/mpls.h>
     15 
     16 #define _BCM_TR_MPLS_EXP_MAP_TABLE_TYPE_MASK    0x300
     17 #define _BCM_TR_MPLS_EXP_MAP_TABLE_TYPE_INGRESS 0x100
     18 #define _BCM_TR_MPLS_EXP_MAP_TABLE_TYPE_EGRESS  0x300
     19 #define _BCM_TR_MPLS_EXP_MAP_TABLE_TYPE_EGRESS_L2  0x200
     20 #define _BCM_TR_MPLS_EXP_MAP_TABLE_NUM_MASK     0x0ff
     21 
     22 #define _BCM_MPLS_NUM_MPLS_ENTRIES_PER_INDEX(unit)  \
     23     (((soc_feature(unit, soc_feature_egr_ip_tnl_mpls_double_wide) \
     24     || soc_feature(unit, soc_feature_th3_style_simple_mpls)))? 8 : 4)
     25 
     26 #define _BCM_MPLS_EGR_L3_INTF_MPLS_INDEX_OFFSET_MASK(unit)  \
     27     (((soc_feature(unit, soc_feature_egr_ip_tnl_mpls_double_wide)  \
     28     || soc_feature(unit, soc_feature_th3_style_simple_mpls)))? 0x7 : 0x3)
     29 
     30 /*
     31  * MPLS port state - need to remember where to find the port.
     32  * Flags indicate the type of the port and hence the tables where the data is.
     33  * The match attributes are the keys for the various hash tables.
     34  */
     35 #define _BCM_MPLS_PORT_MATCH_TYPE_NONE         (1 << 0)
     36 #define _BCM_MPLS_PORT_MATCH_TYPE_VLAN   (1 << 1)
     37 #define _BCM_MPLS_PORT_MATCH_TYPE_INNER_VLAN (1 << 2)
     38 #define _BCM_MPLS_PORT_MATCH_TYPE_VLAN_STACKED        (1 << 3)
     39 #define _BCM_MPLS_PORT_MATCH_TYPE_VLAN_PRI  (1 << 4)
     40 #define _BCM_MPLS_PORT_MATCH_TYPE_PORT         (1 << 5)
     41 #define _BCM_MPLS_PORT_MATCH_TYPE_TRUNK       (1 << 6)
     42 #define _BCM_MPLS_PORT_MATCH_TYPE_LABEL        (1 << 7)
     43 #define _BCM_MPLS_PORT_MATCH_TYPE_LABEL_PORT     (1 << 8)
     44 #define _BCM_MPLS_PORT_MATCH_TYPE_PORT_SUBPORT_PKT_VID (1 << 9)
     45 #define _BCM_MPLS_PORT_MATCH_TYPE_PORT_SUBPORT_PKT_VID_INNER_VLAN (1 << 10)
     46 #define _BCM_MPLS_PORT_MATCH_TYPE_PORT_SUBPORT_PKT_VID_OUTER_VLAN (1 << 11)
     47 #define _BCM_MPLS_PORT_MATCH_TYPE_SHARE (1 << 12)
     48 #define _BCM_MPLS_PORT_MATCH_TYPE_VLAN_TAG   (1 << 13)
     49 #define _BCM_MPLS_PORT_MATCH_TYPE_INNER_VLAN_TAG   (1 << 14)
     50 
     51 /*
     52  * MPLS LABEL ACTION - indicate the ACTION associated with the LABEL 
     53  */
     54 
     55 #define _BCM_MPLS_ACTION_NOOP  0x0
     56 #define _BCM_MPLS_ACTION_PUSH  0x1
     57 #define _BCM_MPLS_ACTION_SWAP  0x2
     58 #define _BCM_MPLS_ACTION_RESERVED  0x3
     59 #define _BCM_MPLS_ACTION_PRESERVED 0x3
     60 #define _BCM_MPLS_ACTION_SEQUENCE 0x4
     61 #define _BCM_MPLS_ACTION_MASK (0xFFFF)
     62 #define _BCM_MPLS_ACTION_LABEL_ALLOC_SHIFT (16)
     63 #define _BCM_MPLS_ACTION_LABEL_ALLOC (1 << _BCM_MPLS_ACTION_LABEL_ALLOC_SHIFT)
     64 #define _BCM_MPLS_ACTION_GET(_f) ((_f) & _BCM_MPLS_ACTION_MASK)
     65 
     66 #define _BCM_MPLS_EGRESS_LABEL_PRESERVE(unit, flags) \
     67             (soc_feature(unit, soc_feature_mpls_swap_label_preserve) && \
     68             (flags & BCM_MPLS_EGRESS_LABEL_PRESERVE))
     69 
     70 /*
     71  * MPLS FORWARDING ACTION - indicate the FORWARDING ACTION associated with the LABEL 
     72  */
     73 #define _BCM_MPLS_FORWARD_NEXT_HOP  0x0
     74 #define _BCM_MPLS_FORWARD_ECMP_GROUP  0x1
     75 #define _BCM_MPLS_FORWARD_MULTICAST_GROUP  0x2
     76 
     77 typedef struct _bcm_tr_mpls_match_port_info_s {
     78     uint32     flags;
     79     uint32     index; /* Index of memory where port info is programmed */
     80     bcm_trunk_t trunk_id; /* Trunk group ID */
     81     bcm_module_t modid; /* Module id */
     82     bcm_port_t port; /* Port */
     83     bcm_vlan_t match_vlan;
     84     bcm_vlan_t match_inner_vlan;
     85     bcm_vlan_t match_subport_pkt_vid;
     86     bcm_mpls_label_t match_label; /* MPLS label */
     87     int match_count; /* Number of matches from VLAN_XLATE configured */
     88     bcm_trunk_t fo_trunk_id; /* vp-less failover port Trunk group ID */
     89     bcm_module_t fo_modid; /* vp-less failover port Module id */
     90     bcm_port_t fo_port; /* vp-less failover port, flags and label same as primary*/
     91 } _bcm_tr_mpls_match_port_info_t;
     92 
     93 typedef struct _bcm_mpls_vpws_vp_map_info_s {
     94     int             vp1; /* Access VP */
     95     int             vp2; /* Network VP */
     96     int             vp3; /* Primary Network VP */
     97     int             vp_b_1;
     98     int             vp_b_2;
     99     int             vp_b_3;
    100 } _bcm_mpls_vpws_vp_map_info_t;
    101 
    102 /*
    103  * Software book keeping for MPLS related information
    104  */
    105 typedef struct _bcm_tr_mpls_bookkeeping_s {
    106     int         initialized;        /* Set to TRUE when MPLS module initialized */
    107     SHR_BITDCL  *vrf_bitmap;        /* VRF bitmap */
    108     SHR_BITDCL  *vpws_bitmap;       /* VPWS vpn usage bitmap  */
    109     SHR_BITDCL  *vc_c_bitmap;       /* VC_AND_LABEL index bitmap (1st 4K)*/
    110     SHR_BITDCL  *vc_nc_bitmap;      /* VC_AND_LABEL index bitmap (2nd 4K)*/
    111     SHR_BITDCL  *pw_term_bitmap;    /* ING_PW_TERM_COUNTERS index bitmap */
    112     SHR_BITDCL  *pw_init_bitmap;    /* ING_PW_TERM_COUNTERS index bitmap */
    113     SHR_BITDCL  *tnl_bitmap;        /* EGR_IP_TUNNEL_MPLS index bitmap */
    114     SHR_BITDCL  *ip_tnl_bitmap;     /* EGR_IP_TUNNEL index bitmap */
    115     SHR_BITDCL  *egr_mpls_bitmap;   /* Egress EXP/PRI maps usage bitmap */
    116     uint32      *egr_mpls_hw_idx;   /* Actual profile number used */
    117     SHR_BITDCL  *ing_exp_map_bitmap;/* Ingress EXP map usage bitmap */
    118     SHR_BITDCL  *egr_l2_exp_map_bitmap; /* Egress_L2 EXP map usage bitmap */
    119 #ifdef BCM_APACHE_SUPPORT
    120     SHR_BITDCL  *ing_exp_to_phb_cng_map_bitmap;/* Ingress EXP to PHB and CNG */
    121                                                /* map usage bitmap */
    122     SHR_BITDCL  *egr_exp_to_phb_cng_map_bitmap;/* Egress EXP to PHB and CNG */
    123                                                /* map usage bitmap */
    124 #endif
    125     sal_mutex_t mpls_mutex;	        /* Protection mutex. */
    126     _bcm_tr_mpls_match_port_info_t *match_key; /* Match Key for Dual Hash */
    127     uint16       *vc_swap_ref_count; /* Reference count for VC_AND_SWAP entries */
    128     uint16       *egr_tunnel_ref_count; /* Reference count for EGR_MPLS_TUNNEL entries */
    129     uint16       *ing_qmap_ref_count; /* Reference count for ING_QUEUE_MAP entries */
    130     _bcm_mpls_vpws_vp_map_info_t       *vpws_vp_map; /* VP map for VPWS */
    131     int          *trunk_vp_map;     /* VP map for trunk binding */
    132     SHR_BITDCL  *svp_profile_set_bitmap; /* SOURCE_VP dscp & dot1p prifile set bitmap */
    133     SHR_BITDCL  *network_vp_bitmap; /* Network side VP bitmap */
    134 #if defined(BCM_TRIDENT3_SUPPORT)
    135     int *egr_vc_swap_lbl_action; /*store label actions in TD3 to make it work like TD2+*/
    136 #endif
    137     uint32       *failover_vp; /* failover vp for primary vp */
    138 } _bcm_tr_mpls_bookkeeping_t;
    139 
    140 extern _bcm_tr_mpls_bookkeeping_t  _bcm_tr_mpls_bk_info[BCM_MAX_NUM_UNITS];
    141 
    142 extern int _bcm_esw_mpls_port_source_vp_lag_set(
    143                                     int unit,
    144                                     bcm_gport_t gport,
    145                                     int vp_lag_vp);
    146 extern int _bcm_esw_mpls_port_source_vp_lag_clear(
    147                                     int unit,
    148                                     bcm_gport_t gport,
    149                                     int vp_lag_vp);
    150 extern int _bcm_esw_mpls_port_source_vp_lag_get(
    151                                     int unit,
    152                                     bcm_gport_t gport,
    153                                     int *vp_lag_vp);
    154 
    155 
    156 #ifdef INCLUDE_L3 
    157 
    158 extern int _bcm_esw_mpls_label_stat_counter_get(int unit, int sync_mode, 
    159                                                 bcm_mpls_label_t label, 
    160                                                 bcm_gport_t port,
    161                                                 bcm_mpls_stat_t stat, 
    162                                                 uint32 num_entries,
    163                                                 uint32 *counter_indexes, 
    164                                               bcm_stat_value_t *counter_values);
    165 #endif /* INCLUDE_L3 */                                              
    166 
    167 /* MPLS VC_AND_SWAP NextHop Indices List.  */
    168 typedef struct _bcm_mpls_vp_nh_list_s {
    169     int  vp_nh_idx;
    170     struct _bcm_mpls_vp_nh_list_s  *link;
    171 }_bcm_mpls_vp_nh_list_t;
    172 
    173 /* MPLS Egress NhopList */
    174 typedef struct _bcm_mpls_egr_nhopList_s {
    175     struct _bcm_mpls_egr_nhopList_s	*link;
    176     bcm_if_t  egr_if;                        /* Egress Object If */
    177     _bcm_mpls_vp_nh_list_t	*vp_head_ptr;
    178 }_bcm_mpls_egr_nhopList_t;
    179 
    180 typedef struct _bcm_mpls_old_nh_info_s {
    181     int old_nh_index;
    182     int old_tpid_idx;
    183     int old_macda_idx;
    184     int old_vc_swap_idx;
    185     bcm_if_t old_tunnel_if;
    186 } _bcm_mpls_old_nh_info_t;
    187 
    188 /*EGR_SEQUENCE_NUMBER_TABLE is shared by IP_TUNNEL,VC_SWAP tables.
    189  *For VC_SWAP table offset is 4096 as per cancun register
    190  *EGR_SEQUENCE_NUMBER_CTRL*/
    191 #define EGR_PW_SEQNUM_VCSWAP_OFFSET 4096
    192 /***************************************************
    193  ***************************************************
    194  ********                                   ********
    195  ******                                       ******
    196  ****    Segment Routing Feature Defines        ****
    197  ******              START                    ******
    198  */
    199 
    200 /*
    201  * The below indexes derive how many free entries
    202  * you want to keep at a give amount of time.
    203  * you may not want to know everything available
    204  * as you may not need all and it is too memmory
    205  * consuming.
    206  * 8 will work well as you need max 8 single entries
    207  * to fill largest entry in current h/w configuration.
    208  */
    209 #define MAX_ENTRY_INDEXES                             8
    210 #define MAX_FREE_ENTRY_INDEXES                        8
    211 
    212 
    213 #define BCMI_EGR_IP_TUNNEL_MPLS_START_OF_ENTRY        (1 << 0)
    214 #define BCMI_EGR_IP_TUNNEL_MPLS_ENTRY_USED            (1 << 1)
    215 #define BCMI_EGR_IP_TUNNEL_MPLS_ENTRY_CHECKED         (1 << 2)
    216 #define BCMI_EGR_IP_TUNNEL_MPLS_ENTRY_ZERO            (1 << 3)
    217 
    218 /* S/w list of all interfaces pointing to mpls tnl */
    219 typedef struct intf_list_s {
    220     bcm_if_t intf_num;
    221     struct intf_list_s *next;
    222 } intf_list_t;
    223 
    224 /* s/w state of each mpls tnl entry */
    225 typedef struct bcmi_egr_tnl_mpls_label_entry_s {
    226     intf_list_t *intf_list; /* associated interface list */
    227     int flags;              /* flags */
    228     int num_elements;       /* Number of elements in this tnl */
    229 } bcmi_egr_ip_tnl_mpls_label_entry_t;
    230 
    231 
    232 typedef struct bcmi_egr_tnl_mpls_tunnel_entry_s {
    233     bcmi_egr_ip_tnl_mpls_label_entry_t **label_entry; /*Label entries in Tunnel */
    234 } bcmi_egr_ip_tnl_mpls_tunnel_entry_t;
    235 
    236 
    237 typedef struct bcmi_egr_ip_tnl_free_indexes_s {
    238     /* free indexes of each entry type */
    239     int free_entry_indexes[MAX_ENTRY_INDEXES][MAX_FREE_ENTRY_INDEXES];
    240     /* count of free indexes of each entry type */
    241     int free_index_count[MAX_ENTRY_INDEXES];
    242 } bcmi_egr_ip_tnl_free_indexes_t;
    243 
    244 /***************************************************
    245  ***************************************************
    246  ********                                   ********
    247  ******                                       ******
    248  ****      Segment Routing Feature Defines      ****
    249  ******               END                     ******
    250  */
    251 
    252 #define _BCM_MPLS_VPN_TYPE_L3           _BCM_VPN_TYPE_L3
    253 #define _BCM_MPLS_VPN_TYPE_VPWS         _BCM_VPN_TYPE_VPWS
    254 #define _BCM_MPLS_VPN_TYPE_VPLS         _BCM_VPN_TYPE_VFI
    255 
    256 #define _BCM_MPLS_VPN_SET(_vpn_, _type_, _id_) \
    257         _BCM_VPN_SET(_vpn_, _type_, _id_)
    258 
    259 #define _BCM_MPLS_VPN_GET(_id_, _type_,  _vpn_) \
    260         _BCM_VPN_GET(_id_, _type_, _vpn_)
    261 
    262 #define _BCM_MPLS_VPN_IS_L3(_vpn_)   _BCM_VPN_IS_L3(_vpn_)
    263 
    264 #define _BCM_MPLS_VPN_IS_VPLS(_vpn_) _BCM_VPN_IS_VPLS(_vpn_)
    265 
    266 #define _BCM_MPLS_VPN_IS_VPWS(_vpn_) _BCM_VPN_IS_VPWS(_vpn_)
    267 
    268 #define _BCM_MPLS_VPN_IS_SET(_vpn_)    \
    269         (_BCM_MPLS_VPN_IS_L3(_vpn_) \
    270         || _BCM_MPLS_VPN_IS_VPLS(_vpn_) \
    271         || _BCM_MPLS_VPN_IS_VPWS(_vpn_))
    272 
    273 #define _BCM_MPLS_GPORT_FAILOVER_VPLESS  (1 << 24)
    274 #define _BCM_MPLS_GPORT_FAILOVER_VPLESS_SET(_gp) ((_gp) | _BCM_MPLS_GPORT_FAILOVER_VPLESS)
    275 #define _BCM_MPLS_GPORT_FAILOVER_VPLESS_GET(_gp) ((_gp) & _BCM_MPLS_GPORT_FAILOVER_VPLESS)
    276 #define _BCM_MPLS_GPORT_FAILOVER_VPLESS_CLEAR(_gp) ((_gp) & (~_BCM_MPLS_GPORT_FAILOVER_VPLESS))
    277 
    278 /* 
    279  * L3_IIF table is used to get the VRF & classid and is 
    280  * carved out as follows:
    281  *      0 - 4095 : 4K entries indexed by VLAN for non-tunnel/non-mpls packets
    282  *   4096 - 4607 : 512 entries directly indexed from L3_TUNNEL
    283  *   4608 - 6655 : 2K entries for MPLS pop & route packet (one for each VRF)
    284  *   6656 - 8191 : unused
    285  */
    286 #define _BCM_TR_MPLS_L3_IIF_BASE        4095
    287 
    288 /*
    289  * Index 63 of the ING_PRI_CNG_MAP table is a special value
    290  * in HW indicating no to trust the packet's 802.1p pri/cfi.
    291  * Here, we use index 62 as an identity mapping
    292  * (pkt_pri => int_pri) and (pkt_cfi => int_color)
    293  */
    294 #define _BCM_TR_MPLS_PRI_CNG_MAP_IDENTITY   62
    295 #define _BCM_TR_MPLS_PRI_CNG_MAP_NONE       63
    296 #define _BCM_TR_MPLS_HASH_ELEMENTS 1024
    297 
    298 #ifndef BCM_SW_STATE_DUMP_DISABLE
    299 extern void _bcm_mpls_sw_dump(int unit);
    300 #endif /* BCM_SW_STATE_DUMP_DISABLE */
    301 
    302 #if defined(BCM_WARM_BOOT_SUPPORT) && defined(INCLUDE_L3)
    303 extern int _bcm_esw_mpls_sync(int unit);
    304 extern int _bcm_esw_mpls_match_key_recover(int unit);
    305 #ifdef INCLUDE_L3
    306 extern int _bcm_esw_mpls_tunnel_switch_traverse_no_lock(int unit,
    307                bcm_mpls_tunnel_switch_traverse_cb cb, void *user_data);
    308 #endif
    309 #endif
    310 
    311 /*
    312  * VRF table usage bitmap operations
    313  */
    314 #define _BCM_MPLS_VRF_USED_GET(_u_, _vrf_) \
    315         SHR_BITGET(MPLS_INFO(_u_)->vrf_bitmap, (_vrf_))
    316 #define _BCM_MPLS_VRF_USED_SET(_u_, _vrf_) \
    317         SHR_BITSET(MPLS_INFO((_u_))->vrf_bitmap, (_vrf_))
    318 #define _BCM_MPLS_VRF_USED_CLR(_u_, _vrf_) \
    319         SHR_BITCLR(MPLS_INFO((_u_))->vrf_bitmap, (_vrf_))
    320 
    321 /*
    322  * VPWS usage bitmap operations (num VPs / 2)
    323  */
    324 #define _BCM_MPLS_VPWS_USED_GET(_u_, _i_) \
    325         SHR_BITGET(MPLS_INFO(_u_)->vpws_bitmap, (_i_))
    326 
    327 #define _BCM_MPLS_VPWS_USED_SET(_u_, _i_) \
    328         SHR_BITSET(MPLS_INFO((_u_))->vpws_bitmap, (_i_))
    329 #define _BCM_MPLS_VPWS_USED_CLR(_u_, _i_) \
    330         SHR_BITCLR(MPLS_INFO((_u_))->vpws_bitmap, (_i_))
    331 
    332 /*
    333  * VC_AND_LABEL (1st 4K - pw_init counters) usage bitmap operations
    334  */
    335 #define _BCM_MPLS_VC_COUNT_USED_GET(_u_, _vc_) \
    336         SHR_BITGET(MPLS_INFO(_u_)->vc_c_bitmap, (_vc_))
    337 #define _BCM_MPLS_VC_COUNT_USED_SET(_u_, _vc_) \
    338         SHR_BITSET(MPLS_INFO((_u_))->vc_c_bitmap, (_vc_))
    339 #define _BCM_MPLS_VC_COUNT_USED_CLR(_u_, _vc_) \
    340         SHR_BITCLR(MPLS_INFO((_u_))->vc_c_bitmap, (_vc_))
    341 
    342 /*
    343  * VC_AND_LABEL (2nd 4K - no counters) usage bitmap operations
    344  */
    345 #define _BCM_MPLS_VC_NON_COUNT_USED_GET(_u_, _vc_) \
    346         SHR_BITGET(MPLS_INFO(_u_)->vc_nc_bitmap, (_vc_))
    347 #define _BCM_MPLS_VC_NON_COUNT_USED_SET(_u_, _vc_) \
    348         SHR_BITSET(MPLS_INFO((_u_))->vc_nc_bitmap, (_vc_))
    349 #define _BCM_MPLS_VC_NON_COUNT_USED_CLR(_u_, _vc_) \
    350         SHR_BITCLR(MPLS_INFO((_u_))->vc_nc_bitmap, (_vc_))
    351 
    352 /*
    353  * "Pseudo-wire termination counters" usage bitmap operations
    354  */
    355 #define _BCM_MPLS_PW_TERM_USED_GET(_u_, _pt_) \
    356         SHR_BITGET(MPLS_INFO(_u_)->pw_term_bitmap, (_pt_))
    357 #define _BCM_MPLS_PW_TERM_USED_SET(_u_, _pt_) \
    358         SHR_BITSET(MPLS_INFO((_u_))->pw_term_bitmap, (_pt_))
    359 #define _BCM_MPLS_PW_TERM_USED_CLR(_u_, _pt_) \
    360         SHR_BITCLR(MPLS_INFO((_u_))->pw_term_bitmap, (_pt_))
    361 
    362 /*
    363  * "Pseudo-wire Initiation counters" usage bitmap operations
    364  */
    365 #define _BCM_MPLS_PW_INIT_USED_GET(_u_, _pt_) \
    366         SHR_BITGET(MPLS_INFO(_u_)->pw_init_bitmap, (_pt_))
    367 #define _BCM_MPLS_PW_INIT_USED_SET(_u_, _pt_) \
    368         SHR_BITSET(MPLS_INFO((_u_))->pw_init_bitmap, (_pt_))
    369 #define _BCM_MPLS_PW_INIT_USED_CLR(_u_, _pt_) \
    370         SHR_BITCLR(MPLS_INFO((_u_))->pw_init_bitmap, (_pt_))
    371 
    372 /*
    373  * EGR_IP_TUNNEL_MPLS table usage bitmap operations
    374  * (there are 4 MPLS entries for each EGR_IP_TUNNEL_MPLS entry)
    375  */
    376 #define _BCM_MPLS_TNL_USED_GET(_u_, _tnl_) \
    377         SHR_BITGET(MPLS_INFO(_u_)->tnl_bitmap, (_tnl_))
    378 #define _BCM_MPLS_TNL_USED_SET(_u_, _tnl_) \
    379         SHR_BITSET(MPLS_INFO((_u_))->tnl_bitmap, (_tnl_))
    380 #define _BCM_MPLS_TNL_USED_CLR(_u_, _tnl_) \
    381         SHR_BITCLR(MPLS_INFO((_u_))->tnl_bitmap, (_tnl_))
    382 #define _BCM_MPLS_TNL_USED_RANGE_GET(_u_, _tnl_, _bit_count_, _result_) \
    383         SHR_BITTEST_RANGE(MPLS_INFO(_u_)->tnl_bitmap, _tnl_, _bit_count_, _result_)
    384 
    385 /*
    386  * EGR_IP_TUNNEL_IP table usage bitmap operations
    387  */
    388 #define _BCM_MPLS_IP_TNL_USED_GET(_u_, _tnl_) \
    389         SHR_BITGET(MPLS_INFO(_u_)->ip_tnl_bitmap, (_tnl_))
    390 #define _BCM_MPLS_IP_TNL_USED_SET(_u_, _tnl_) \
    391         SHR_BITSET(MPLS_INFO((_u_))->ip_tnl_bitmap, (_tnl_))
    392 #define _BCM_MPLS_IP_TNL_USED_CLR(_u_, _tnl_) \
    393         SHR_BITCLR(MPLS_INFO((_u_))->ip_tnl_bitmap, (_tnl_))
    394 /*
    395  * Egress PRI->EXP/DOT1P map usage bitmap operations
    396  */
    397 #define _BCM_EGR_MPLS_MAP_USED_GET(_u_, _map_) \
    398         SHR_BITGET(MPLS_INFO(_u_)->egr_mpls_bitmap, (_map_))
    399 #define _BCM_EGR_MPLS_MAP_USED_SET(_u_, _map_) \
    400         SHR_BITSET(MPLS_INFO((_u_))->egr_mpls_bitmap, (_map_))
    401 #define _BCM_EGR_MPLS_MAP_USED_CLR(_u_, _map_) \
    402         SHR_BITCLR(MPLS_INFO((_u_))->egr_mpls_bitmap, (_map_))
    403 
    404 /*
    405  * Ingress EXP->DOT1P map usage bitmap operations
    406  */
    407 #define _BCM_MPLS_ING_EXP_MAP_USED_GET(_u_, _map_) \
    408         SHR_BITGET(MPLS_INFO(_u_)->ing_exp_map_bitmap, (_map_))
    409 #define _BCM_MPLS_ING_EXP_MAP_USED_SET(_u_, _map_) \
    410         SHR_BITSET(MPLS_INFO((_u_))->ing_exp_map_bitmap, (_map_))
    411 #define _BCM_MPLS_ING_EXP_MAP_USED_CLR(_u_, _map_) \
    412         SHR_BITCLR(MPLS_INFO((_u_))->ing_exp_map_bitmap, (_map_))
    413 /*
    414  * Egress EXP->DOT1P map usage bitmap operations
    415  */
    416 #define _BCM_MPLS_EGR_EXP_MAP_USED_GET(_u_, _map_) \
    417               SHR_BITGET(MPLS_INFO(_u_)->egr_l2_exp_map_bitmap, (_map_))
    418 #define _BCM_MPLS_EGR_EXP_MAP_USED_SET(_u_, _map_) \
    419               SHR_BITSET(MPLS_INFO((_u_))->egr_l2_exp_map_bitmap, (_map_))
    420 #define _BCM_MPLS_EGR_EXP_MAP_USED_CLR(_u_, _map_) \
    421               SHR_BITCLR(MPLS_INFO((_u_))->egr_l2_exp_map_bitmap, (_map_))
    422 #ifdef BCM_APACHE_SUPPORT
    423 /*
    424  *  * Ingress EXP->PBH and CNG map usage bitmap operations
    425  */
    426 #define _BCM_MPLS_ING_EXP_TO_PHB_CNG_MAP_USED_GET(_u_, _map_) \
    427         SHR_BITGET(MPLS_INFO(_u_)->ing_exp_to_phb_cng_map_bitmap, (_map_))
    428 #define _BCM_MPLS_ING_EXP_TO_PHB_CNG_MAP_USED_SET(_u_, _map_) \
    429         SHR_BITSET(MPLS_INFO((_u_))->ing_exp_to_phb_cng_map_bitmap, (_map_))
    430 #define _BCM_MPLS_ING_EXP_TO_PHB_CNG_MAP_USED_CLR(_u_, _map_) \
    431         SHR_BITCLR(MPLS_INFO((_u_))->ing_exp_to_phb_cng_map_bitmap, (_map_))
    432 /*
    433  *  * Egress EXP->PBH and CNG map usage bitmap operations
    434  */
    435 #define _BCM_MPLS_EGR_EXP_TO_PHB_CNG_MAP_USED_GET(_u_, _map_) \
    436               SHR_BITGET(MPLS_INFO(_u_)->egr_exp_to_phb_cng_map_bitmap, (_map_))
    437 #define _BCM_MPLS_EGR_EXP_TO_PHB_CNG_MAP_USED_SET(_u_, _map_) \
    438             SHR_BITSET(MPLS_INFO((_u_))->egr_exp_to_phb_cng_map_bitmap, (_map_))
    439 #define _BCM_MPLS_EGR_EXP_TO_PHB_CNG_MAP_USED_CLR(_u_, _map_) \
    440             SHR_BITCLR(MPLS_INFO((_u_))->egr_exp_to_phb_cng_map_bitmap, (_map_))
    441 #endif
    442 /*
    443  * SVP profile set usage bitmap operations
    444  */
    445 #define _BCM_MPLS_SVP_PROFILE_SET_USED_GET(_u_, _vp_) \
    446         SHR_BITGET(MPLS_INFO(_u_)->svp_profile_set_bitmap, (_vp_))
    447 #define _BCM_MPLS_SVP_PROFILE_SET_USED_SET(_u_, _vp_) \
    448         SHR_BITSET(MPLS_INFO((_u_))->svp_profile_set_bitmap, (_vp_))
    449 #define _BCM_MPLS_SVP_PROFILE_SET_USED_CLR(_u_, _vp_) \
    450         SHR_BITCLR(MPLS_INFO((_u_))->svp_profile_set_bitmap, (_vp_))
    451 
    452 /*
    453  * Network-port VP bitmap operations
    454  */
    455 #define _BCM_MPLS_NETWORK_VP_USED_GET(_u_, _vp_) \
    456         SHR_BITGET(MPLS_INFO(_u_)->network_vp_bitmap, (_vp_))
    457 #define _BCM_MPLS_NETWORK_VP_USED_SET(_u_, _vp_) \
    458         SHR_BITSET(MPLS_INFO((_u_))->network_vp_bitmap, (_vp_))
    459 #define _BCM_MPLS_NETWORK_VP_USED_CLR(_u_, _vp_) \
    460         SHR_BITCLR(MPLS_INFO((_u_))->network_vp_bitmap, (_vp_))
    461 
    462 #define _BCM_MPLS_CLEANUP(_rv_) \
    463        if ( (_rv_) < 0) { \
    464            goto cleanup; \
    465        }
    466 extern int _egr_qos_id2hw_idx (int unit,int qos_id,int *hw_inx);
    467 extern int _egr_qos_hw_idx2id (int unit, int hw_idx, int *map_id);
    468 
    469 #define _BCM_VC_SWAP_TBL_FLEX_DATA_TYPE 5
    470 #endif	/* !_BCM_INT_MPLS_H */