mpls_l2vpn.h (5621B)
1 /** \file mpls_l2vpn.h 2 * Used by mpls_l2vpn, mpls_port and EVPN(mpls) files 3 */ 4 /* 5 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 * 7 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 8 */ 9 #ifndef __MPLS_L2VPN_INCLUDED__ 10 #define __MPLS_L2VPN_INCLUDED__ 11 12 #ifndef BCM_DNX_SUPPORT 13 #error "This file is for use by DNX (JR2) family only!" 14 #endif /* BCM_DNX_SUPPORT */ 15 16 #include <bcm_int/dnx/algo/lif_mngr/lif_mngr_api.h> 17 #include <bcm/mpls.h> 18 19 /* 20 * ********************************************************* 21 * DEFINES 22 * { 23 */ 24 /** 25 * \brief Minimal allowed service tags for in PWE port 26 */ 27 #define DNX_MPLS_L2VPN_INGRESS_SERVICE_TAGS_MIN 1 28 /** 29 * \brief Maximal allowed service tags for in PWE port 30 */ 31 #define DNX_MPLS_L2VPN_INGRESS_SERVICE_TAGS_MAX 2 32 /* 33 * 34 * MPLS_L2VPN_FLAG_xxx defined to set information that can't be conveyed 35 * through the MPLS-Port structure flags. 36 */ 37 /** 38 * \brief Egress EVPN Label is for Inclusive Multicast (IML) 39 */ 40 #define DNX_MPLS_L2VPN_FLAG_EGRESS_IML (SAL_BIT(0)) 41 /** 42 * \brief Ingress EVPN Label is for Inclusive Multicast (IML) expected as BOS. 43 */ 44 #define DNX_MPLS_L2VPN_FLAG_INGRESS_IML_WITHOUT_ESI (SAL_BIT(1)) 45 /** 46 * \brief Ingress EVPN Label is for Inclusive Multicast (IML) with ESI expected as BOS. 47 */ 48 #define DNX_MPLS_L2VPN_FLAG_INGRESS_IML_WITH_ESI (SAL_BIT(2)) 49 /** 50 * \brief Ingress EVPN Label is for Inclusive Multicast (IML) with ESI or not. 51 * Flag is available only when dnx_data_mpls.general.mpls_term_1_or_2_labels is set. 52 */ 53 #define DNX_MPLS_L2VPN_FLAG_INGRESS_IML (SAL_BIT(3)) 54 55 /* 56 * } 57 * DEFINES 58 */ 59 /* 60 * MACROS 61 * { 62 */ 63 /* 64 * Check if the #service-tags for in PWE is in range 65 */ 66 #define DNX_MPLS_L2VPN_INGRESS_SERVICE_TAGS_NOF_IN_RANGE(_nof_service_tags_) \ 67 (((_nof_service_tags_) >= DNX_MPLS_L2VPN_INGRESS_SERVICE_TAGS_MIN) && \ 68 ((_nof_service_tags_) <= DNX_MPLS_L2VPN_INGRESS_SERVICE_TAGS_MAX)) 69 /* 70 * } 71 * MACROS 72 */ 73 /* 74 * ********************************************************* 75 * TYPES 76 * { 77 */ 78 /** 79 * \brief MPLS L2 VPN type 80 */ 81 typedef enum 82 { 83 MPLS_L2VPN_TYPE_NOT_DEFINED = 0, 84 MPLS_L2VPN_TYPE_MPLS_PORT, 85 MPLS_L2VPN_TYPE_EVPN, 86 /* 87 * Must be last 88 */ 89 MPLS_L2VPN_TYPE_NOF 90 } dnx_mpls_l2vpn_type_e; 91 /** 92 * \brief MPLS based L2 vpn object 93 */ 94 typedef struct 95 { 96 /** 97 * \brief BCM MPLS Port module object pointer 98 */ 99 bcm_mpls_port_t *mpls_port; 100 /** 101 * \brief DNX_MPLS_L2VPN_xxx 102 */ 103 uint32 flags; 104 /** 105 * \brief MPLS L2 VPN type (VPLS, EVPN) 106 */ 107 dnx_mpls_l2vpn_type_e type; 108 /** 109 * \brief VPN Identifier 110 */ 111 bcm_vpn_t vpn; 112 } dnx_mpls_l2vpn_info_t; 113 /* 114 * } 115 * TYPES 116 */ 117 /* 118 * ********************************************************* 119 * PROTOTYPES 120 * { 121 */ 122 123 /** 124 * \brief Initialize dnx_mpls_l2vpn_info_t object with the mandatory 125 * fields. Assumes mpls_port is not NULL and initialized separately. 126 */ 127 void dnx_mpls_l2vpn_info_t_init( 128 int unit, 129 dnx_mpls_l2vpn_info_t * l2vpn_info, 130 dnx_mpls_l2vpn_type_e type, 131 bcm_mpls_port_t * mpls_port); 132 133 /** 134 * \brief Creates an MPLS L2VPN egress or ingress object (can't be both). 135 * \param [in] unit 136 * \param [in,out] l2vpn_info - Main structure for this API. 137 * [in] l2vpn_info->vpn - VPN (VSI) value. 138 * [in] l2vpn_info->type - Specify the flavor of the MPLS L2VPN to be created. 139 * [in,out] l2vpn_info->mpls_port - Hold most of the information. Non-VPLS objects need to be translated to this object 140 * before being supplied to mpls_l2vpn module. This is for historical reasons, optimizing 141 * the mpls_port module and because mpls_port is the best BCM-API struct available for 142 * MPLS L2VPN, at the time of the writing of this module. 143 */ 144 shr_error_e dnx_mpls_l2vpn_add( 145 int unit, 146 dnx_mpls_l2vpn_info_t * l2vpn_info); 147 148 /** 149 * \brief Retrieves the MPLS L2VPN information pointed to by l2vpn_info->mpls_port->mpls_port_id. 150 * \param [in] unit 151 * \param [in,out] l2vpn_info - Main structure of this API. 152 * [in] l2vpn_info->vpn - VPN that should contain the MPLS L2VPN object 153 * [in] l2vpn_info->type - Specify the flavor of the MPLS L2VPN to be retrieved. 154 * [in,out] l2vpn_info->mpls_port - Mostly will be populated by the retrieval. This object is originally meant 155 * for VPLS. Other flavors need to translate the information back to their own 156 * API's structures. 157 * [in] l2vpn_info->mpls_port->mpls_port_id - the identifier of the MPLS L2VPN object to retrieve 158 */ 159 shr_error_e dnx_mpls_l2vpn_get( 160 int unit, 161 dnx_mpls_l2vpn_info_t * l2vpn_info); 162 163 /** 164 * \brief Delete the mpls l2vpn object. 165 * \param [in] unit - Relevant unit. 166 * \param [in] l2vpn_type - The flavor expected for the object. 167 * \param [in] is_ingress - Ingress indication. 168 * \param [in] mpls_l2vpn_id - The port to be deleted. 169 */ 170 shr_error_e dnx_mpls_l2vpn_delete( 171 int unit, 172 dnx_mpls_l2vpn_type_e l2vpn_type, 173 int is_ingress, 174 bcm_gport_t mpls_l2vpn_id); 175 176 /** 177 * \brief 178 * Map VPLS EEDB access stage to lif_mngr app type. 179 */ 180 shr_error_e dnx_mpls_l2vpn_encap_access_to_outlif_phase( 181 int unit, 182 uint32 encap_access, 183 lif_mngr_outlif_phase_e * outlif_phase); 184 185 /* 186 * } 187 * PROTOTYPES 188 */ 189 190 #endif /*__MPLS_L2VPN_INCLUDED__*/