algo_trunk.h (7468B)
1 /** 2 * \file algo/trunk/algo_trunk.h 3 * 4 * trunk algo APIs 5 */ 6 /* 7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 8 * 9 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 10 */ 11 12 #ifndef _BCMINT_DNX_ALGO_TRUNK_TRUNKALGO_H_INCLUDED 13 #define _BCMINT_DNX_ALGO_TRUNK_TRUNKALGO_H_INCLUDED 14 15 #ifndef BCM_DNX_SUPPORT 16 #error "This file is for use by DNX (JR2) family only!" 17 #endif 18 19 /* 20 * Includes 21 * { 22 */ 23 #include <bcm/types.h> 24 #include <bcm/trunk.h> 25 #include <bcm_int/dnx/trunk/trunk.h> 26 #include <shared/shrextend/shrextend_debug.h> 27 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h> 28 /* 29 * } 30 */ 31 32 /** 33 * Defines 34 * { 35 */ 36 37 #define DNX_ALGO_TRUNK_EGRESSTRUNK_TEMPLATE "Egress Trunk" 38 39 /** 40 * } 41 */ 42 43 /** 44 * struct for egress trunk distribution algo 45 */ 46 typedef struct dnx_algo_trunk_member_lb_key_ranges_s 47 { 48 bcm_gport_t system_port; 49 int first_lb_key; 50 int lb_key_range; 51 } dnx_algo_trunk_member_lb_key_ranges_t; 52 53 /** 54 * \brief - determines the psc profile according to the psc_info 55 * and nof_enabled_members. can be overriden by customer 56 * if he wants to implement lags with unique profiles 57 * that has special weight per member 58 * 59 * \param [in] unit - unit number 60 * \param [in] psc_info - PSC info 61 * \param [in] nof_enabled_members - number of enabled members 62 * \param [in] psc_profile - result PSC profile 63 * 64 * \return 65 * shr_error_e 66 * 67 * \remark 68 * * None 69 * \see 70 * * None 71 */ 72 shr_error_e dnx_algo_trunk_smooth_division_profile_set( 73 int unit, 74 bcm_trunk_psc_profile_info_t * psc_info, 75 int nof_enabled_members, 76 int *psc_profile); 77 78 /** 79 * \brief - gets the psc_info according to the psc_profile when 80 * smooth division is used. currently this is not used 81 * for the profile is determined according to the number 82 * of enabled members, however if a customer chose to 83 * override the set function to support unique weighted 84 * profiles - he needs to override this function as well 85 * for other get APIs to function as expected 86 * 87 * \param [in] unit - unit number 88 * \param [in] psc_profile - PSC profile 89 * \param [in] psc_info - result PSC info 90 * 91 * \return 92 * shr_error_e 93 * 94 * \remark 95 * * None 96 * \see 97 * * None 98 */ 99 shr_error_e dnx_algo_trunk_smooth_division_profile_get( 100 int unit, 101 int psc_profile, 102 bcm_trunk_psc_profile_info_t * psc_info); 103 104 /** 105 * \brief - get values of pre-defined SMD profiles to later set 106 * them through the DBAL or what ever other need you 107 * might have 108 * 109 * \param [in] unit - unit number 110 * \param [in] profile_array - array of SMD profiles - in the 111 * form of a 2D array 112 * \param [in] nof_profiles - number of profiles - part of the 113 * size of the array 114 * \param [in] nof_lb_keys_per_profile - number of lb-keys per 115 * profile - part of the size of the array 116 * 117 * \return 118 * shr_error_e 119 * 120 * \remark 121 * * None 122 * \see 123 * * None 124 */ 125 shr_error_e dnx_algo_trunk_smd_pre_defined_profiles_get( 126 int unit, 127 int *profile_array, 128 int nof_profiles, 129 int nof_lb_keys_per_profile); 130 131 /** 132 * \brief - initialize template manager stuff for egress trunks 133 * 134 * \param [in] unit - unit number 135 * 136 * \return 137 * shr_error_e 138 * 139 * \remark 140 * * None 141 * \see 142 * * None 143 */ 144 shr_error_e dnx_algo_egress_trunk_init( 145 int unit); 146 147 /** 148 * \brief - deinit template manager stuff for egress trunks 149 * 150 * \param [in] unit - unit number 151 * 152 * \return 153 * shr_error_e 154 * 155 * \remark 156 * * None 157 * \see 158 * * None 159 */ 160 shr_error_e dnx_algo_egress_trunk_deinit( 161 int unit); 162 163 /** 164 * \brief - create an Egress Trunk, to be used for resolving 165 * Egress MC groups containing trunks 166 * 167 * \param [in] unit - unit number 168 * \param [in] trunk_id - trunk id for which to create an egress 169 * trunk 170 * \param [in] egress_trunk_id - resulted egress trunk id 171 * \param [in] is_first - return val, indication that this is 172 * the first time this egress trunk id was created. 173 * 174 * \return 175 * shr_error_e 176 * 177 * \remark 178 * * None 179 * \see 180 * * None 181 */ 182 shr_error_e dnx_algo_trunk_egress_create( 183 int unit, 184 bcm_trunk_t trunk_id, 185 int *egress_trunk_id, 186 uint8 *is_first); 187 188 /** 189 * \brief - destroy an egress trunk (only if this is its last 190 * replication) 191 * 192 * \param [in] unit - unit number 193 * \param [in] egress_trunk_id - egress trunk id to destroy 194 * \param [out] is_last - indication that this was the last reference to this profile 195 * 196 * \return 197 * shr_error_e 198 * 199 * \remark 200 * * None 201 * \see 202 * * None 203 */ 204 shr_error_e dnx_algo_trunk_egress_destroy( 205 int unit, 206 int egress_trunk_id, 207 uint8 *is_last); 208 209 /** 210 * \brief - get the matching egress trunk id for a trunk id. 211 * 212 * \param [in] unit - unit nubmber. 213 * \param [in] trunk_id - trunk id - search matching egress 214 * trunk id for this trunk. 215 * \param [in] egress_trunk_id - result egress trunk id. 216 * \param [in] profile_found - indication if profile was found. 217 * 218 * \return 219 * shr_error_e 220 * 221 * \remark 222 * * None 223 * \see 224 * * None 225 */ 226 shr_error_e dnx_algo_trunk_egress_get( 227 int unit, 228 bcm_trunk_t trunk_id, 229 int *egress_trunk_id, 230 int *profile_found); 231 232 /** 233 * \brief - get the matching trunk id for an egress trunk id 234 * 235 * \param [in] unit - unit number 236 * \param [in] egrss_trunk_id - search trunk id matching this 237 * egress trunk id 238 * \param [in] trunk_id - found trunk id 239 * 240 * \return 241 * shr_error_e 242 * 243 * \remark 244 * * None 245 * \see 246 * * None 247 */ 248 shr_error_e dnx_algo_trunk_containing_egress_trunk_get( 249 int unit, 250 int egrss_trunk_id, 251 bcm_trunk_t * trunk_id); 252 253 /** 254 * \brief - cb function for print for the template manager 255 * 256 * \param [in] unit - unit number 257 * \param [in] data - trunk id in this case 258 * \return 259 * \remark 260 * * None 261 * \see 262 * * None 263 */ 264 void dnx_algo_trunk_egresstrunk_profile_print_cb( 265 int unit, 266 const void *data); 267 268 /** 269 * \brief - determine egress trunk LB-Key distribution for 270 * trunk within an egress MC group. 271 * 272 * \param [in] unit - unit number 273 * \param [in] profile_lb_key_range_size - number of LB-Keys 274 * per profile 275 * \param [in] profile_first_lb_key_value - value of the first 276 * LB-Key of this profile - usually determined according 277 * to graceful modification mode. 278 * \param [in] trunk_nof_enabled_members - number of enabled 279 * member in the trunk 280 * \param [in] unique_members_array_size - size of unique 281 * members array 282 * \param [in] unique_members_array - input array of unique 283 * members, uniqueness is determined according to system 284 * port 285 * \param [out] lb_key_ranges_array_size - size of lb_key_ranges 286 * array 287 * \param [out] lb_key_ranges_array - output array of 288 * lb_key_ranges 289 * 290 * \return 291 * shr_error_e 292 * 293 * \remark 294 * * None 295 * \see 296 * * None 297 */ 298 shr_error_e dnx_algo_trunk_egress_trunk_lb_key_destribution_get( 299 int unit, 300 int profile_lb_key_range_size, 301 int profile_first_lb_key_value, 302 int trunk_nof_enabled_members, 303 int unique_members_array_size, 304 dnx_trunk_unique_member_t * unique_members_array, 305 int *lb_key_ranges_array_size, 306 dnx_algo_trunk_member_lb_key_ranges_t * lb_key_ranges_array); 307 308 #endif /* _BCMINT_DNX_ALGO_TRUNK_TRUNKALGO_H_INCLUDED */