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


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        mpls.h
      8  * Purpose:     mpls internal definitions to the BCM library.
      9  */
     10 
     11 #ifndef   _BCM_INT_DPP_MPLS_H_
     12 #define   _BCM_INT_DPP_MPLS_H_
     13 
     14 #include <bcm/mpls.h>
     15 #include <soc/dpp/PPD/ppd_api_frwrd_ilm.h>
     16 #include <bcm_int/dpp/alloc_mngr_local_lif.h>
     17 
     18 
     19 
     20 
     21 
     22 
     23 
     24 
     25 
     26 
     27 #define BCM_MPLS_LABEL_MAX  ((1 << 20) - 1)
     28 
     29 #define _BCM_DPP_MPLS_LABEL_IN_RANGE(_label_)   \
     30         (_label_ <= BCM_MPLS_LABEL_MAX)
     31 
     32 /* Define MPLS supported types */
     33 #define _BCM_DPP_MPLS_EEDB_TYPES(entry_type) \
     34   (entry_type == SOC_PPC_EG_ENCAP_ENTRY_TYPE_MPLS_ENCAP ||  \
     35    entry_type == SOC_PPC_EG_ENCAP_ENTRY_TYPE_POP_CMND || \
     36    entry_type == SOC_PPC_EG_ENCAP_ENTRY_TYPE_SWAP_CMND)
     37 
     38 /* SW state for MPLS */
     39 #define MPLS_INFO(_unit_)   (&_bcm_dpp_mpls_bk_info[_unit_])
     40 
     41 
     42 typedef struct _bcm_dpp_mpls_bookkeeping_s {
     43     int         initialized;        /* Set to TRUE when MPLS module initialized */
     44     int *egress_tunnel_id;
     45     sal_mutex_t mpls_mutex;        /* Protection mutex. */
     46 } _bcm_dpp_mpls_bookkeeping_t;
     47 
     48 extern _bcm_dpp_mpls_bookkeeping_t  _bcm_dpp_mpls_bk_info[BCM_MAX_NUM_UNITS];
     49 extern SOC_PPC_FRWRD_ILM_KEY *_bcm_mpls_traverse_ilm_keys[BCM_MAX_NUM_UNITS];
     50 extern SOC_PPC_FRWRD_DECISION_INFO *_bcm_mpls_traverse_ilm_vals[BCM_MAX_NUM_UNITS];
     51 
     52 
     53 
     54 /* match criteria setting */
     55 int _bcm_dpp_mpls_match_get(int unit, bcm_mpls_port_t *mpls_port, int lif);
     56 
     57 int _bcm_dpp_mpls_match_add(int unit, bcm_mpls_port_t *mpls_port, int lif);
     58 
     59 int _bcm_dpp_mpls_match_delete(int unit, int lif);
     60 
     61 int bcm_petra_mpls_tunnel_initiator_data_set(
     62     int unit,
     63     bcm_if_t intf,
     64     int num_labels,
     65     bcm_mpls_egress_label_t * label_array,
     66     int vsi_param, /* needed only in case intf is of type EEP*/
     67     int ll_eep_param, /* needed only in case intf is of type EEP*/
     68     int is_swap, /* needed only in case intf is of type EEP*/
     69     int *tunnel_eep
     70     ); /* needed only in case intf is of type EEP*/
     71 
     72 int _bcm_mpls_tunnel_push_profile_alloc(
     73     int unit,
     74     uint32 * push_profile,
     75     uint8 cw,
     76     bcm_mpls_egress_label_t * label_entry,
     77     uint8 is_test,
     78     uint8 with_id,
     79     uint8 update_existing_profile,
     80     uint8 set_hw,
     81     uint8 * is_first,
     82     uint8 is_second_mpls_label_in_entry);
     83 
     84 int _bcm_mpls_tunnel_push_profile_alloc_dummy_profiles(
     85     int unit,
     86     uint32 *dummy_profiles_array,
     87     int nof_dummy_profiles);
     88 
     89 int _bcm_mpls_tunnel_initial_additional_push_profiles_alloc(
     90     int unit);
     91 
     92 int _bcm_mpls_tunnel_push_profile_info_get(
     93     int unit,
     94     int push_profile,
     95     uint8 * has_cw,
     96     bcm_mpls_egress_label_t * label_entry);
     97 
     98 /* Inner flags for MPLS termination */
     99 #define _BCM_DPP_MPLS_LIF_TERM_FRR              (0x1)
    100 #define _BCM_DPP_MPLS_LIF_TERM_COUPLING         (0x2)
    101 #define _BCM_DPP_MPLS_LIF_TERM_CONTROL_WORD     (0x4)
    102 #define _BCM_DPP_MPLS_LIF_TERM_ENTROPY          (0x8)
    103 #define _BCM_DPP_MPLS_LIF_TERM_ELI             (0x10)
    104 #define _BCM_DPP_MPLS_LIF_TERM_REJECT_TTL_0    (0x20)
    105 #define _BCM_DPP_MPLS_LIF_TERM_REJECT_TTL_1    (0x40)
    106 #define _BCM_DPP_MPLS_LIF_TERM_SKIP_ETHERNET   (0x80)
    107 #define _BCM_DPP_MPLS_LIF_TERM_CHECK_BOS      (0x100)
    108 /* GAL flag is only relevant for MPLS_PORT */
    109 #define _BCM_DPP_MPLS_LIF_TERM_GAL            (0x200)
    110 #define _BCM_DPP_MPLS_LIF_TERM_EVPN_IML      (0x400)
    111 
    112 /* Pertinent to Mpls range action*/
    113 #define _BCM_MPLS_TERM_LABEL_RANGE_TABLE_FULL   (1)
    114 #define _BCM_MPLS_TERM_LABEL_RANGE_EXIST        (2)
    115 #define _BCM_MPLS_TERM_LABEL_RANGE_INTERSECT    (3)
    116 #define _BCM_MPLS_TERM_LABEL_RANGE_VACANT_ENTRY (4)
    117 #define _BCM_MPLS_TERM_LABEL_RANGE_EXIST_IML    (5)
    118 #define _BCM_MPLS_TERM_LABEL_RANGE_NOF_ENTRIES  (8)
    119 
    120 /* indicate bos in gport in case of evpn iml */
    121 #define _BCM_DPP_MPLS_LIF_TERM_EVPN_IML_BOS_INDICATION (1<<25)
    122 
    123 /* index of outlif profile for first label in EVPN stack*/
    124 #define _BCM_DPP_MPLS_EGRESS_EVPN_OUTLIF_PROFILE_INDEX(unit)  (SOC_IS_JERICHO_PLUS(unit) ? (3) : (1))
    125 #define _BCM_DPP_MPLS_PWE_OUTLIF_PROFILE_INDEX(unit)          (SOC_IS_JERICHO_PLUS(unit) ? (3) : (1))
    126 
    127 #define _BCM_DPP_MPLS_FRR_OUTLIF_PROFILE_INDEX(unit)          (SOC_IS_JERICHO_PLUS(unit) ? (5) : (1))
    128 
    129 int _bcm_mpls_tunnel_lif_term_profile_exchange(
    130       int unit,
    131       SOC_PPC_LIF_ID lif_id,
    132       uint32 inner_flags,
    133       uint8 is_pwe_lif,
    134       uint8 expect_bos, /* Jericho */
    135       uint8* term_profile);
    136 
    137 int _bcm_mpls_tunnel_lif_term_mpls_port_to_flags(
    138       int unit,
    139       bcm_mpls_port_t *   mpls_port,
    140       uint32 *inner_flags
    141     );
    142 
    143 int _bcm_petra_mpls_term_resolve_lif_type_by_index(
    144     int unit,
    145     int port,
    146     bcm_mpls_label_t label,
    147     uint32 *lif_types);
    148 
    149 int _bcm_petra_mpls_term_to_pwe_lif_types(
    150     int unit,
    151     uint32 lif_types,
    152     uint32 *pwe_lif_types);
    153 
    154 int _bcm_petra_mpls_tunnel_initiator_set(
    155     int unit,
    156     bcm_if_t intf,
    157     int num_labels,
    158     bcm_mpls_egress_label_t * label_array);
    159 
    160 int _bcm_petra_mpls_tunnel_switch_add(
    161     int unit,
    162     bcm_mpls_tunnel_switch_t * info);
    163 
    164 int _bcm_petra_mpls_tunnel_free_push_profile(
    165     int unit,
    166     int eep);
    167 
    168 int bcm_petra_mpls_port_free_push_profile(
    169     int unit,
    170     int eep);
    171 
    172 int _bcm_dpp_mpls_range_action_verify(
    173     int unit,
    174     bcm_mpls_label_t label_low,
    175     bcm_mpls_label_t label_high,
    176     uint32 * vacant_entry_index,
    177     int *err_code);
    178 
    179 int
    180 _bcm_dpp_mpls_port_add(
    181     int unit,
    182     bcm_vpn_t   vpn,
    183     bcm_mpls_port_t *   mpls_port);
    184 
    185 #endif /* _BCM_INT_DPP_MPLS_H_ */