l3_ecmp_vip.h (10382B)
1 /** \file bcm_int/dnx/l3/l3_ecmp.h Internal DNX L3 APIs 2 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 PIs 4 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 7 #ifndef L3_ECMP_VIP_H_INCLUDED 8 /* 9 * { 10 */ 11 #define L3_ECMP_VIP_H_INCLUDED 12 13 #ifndef BCM_DNX_SUPPORT 14 #error "This file is for use by DNX (JR2) family only!" 15 #endif 16 17 /* 18 * Include files. 19 * { 20 */ 21 #include <soc/dnx/dnx_data/auto_generated/dnx_data_internal_l3.h> 22 #include <soc/dnx/dnx_data/auto_generated/dnx_data_l3.h> 23 #include <soc/dnx/dbal/dbal.h> 24 #include <bcm/l3.h> 25 /* 26 * } 27 */ 28 29 /* 30 * DEFINES 31 * { 32 */ 33 /* 34 * } 35 */ 36 /* 37 * Enumeration. 38 * { 39 */ 40 /* 41 * } 42 */ 43 44 /* 45 * MACROs 46 * { 47 */ 48 /* 49 * } 50 */ 51 /* 52 * Globals 53 * { 54 */ 55 56 /* 57 * } 58 */ 59 /* 60 * Structures 61 * { 62 */ 63 /* 64 * } 65 */ 66 /* 67 * Externs 68 * { 69 */ 70 71 /* 72 * } 73 */ 74 /* 75 * Function declaration 76 * { 77 */ 78 79 /** 80 * \brief 81 * Retrieve the minumum FEC-Id in the reserved VIP FEC range. 82 * \param [in] unit - The unit number. 83 * \param [out] fec_id_min - Minimum FEC-Id reserved for VIP FECs. 84 * \return 85 * \retval Zero if no error was detected 86 * \retval Negative if error was detected. See \ref shr_error_e 87 */ 88 shr_error_e 89 dnx_l3_egress_ecmp_vip_fec_id_min_get( 90 int unit, 91 uint32 *fec_id_min); 92 93 /** 94 * \brief 95 * Retrieve the maximum FEC-Id in the reserved VIP FEC range. 96 * \param [in] unit - The unit number. 97 * \param [out] fec_id_max - Maximum FEC-Id reserved for VIP FECs. 98 * \return 99 * \retval Zero if no error was detected 100 * \retval Negative if error was detected. See \ref shr_error_e 101 */ 102 shr_error_e 103 dnx_l3_egress_ecmp_vip_fec_id_max_get( 104 int unit, 105 uint32 *fec_id_max); 106 107 /** 108 * \brief 109 * Initialize the VIP SW DB and PEMLA virtual registers. Bypass for warmboot. 110 * \param [in] unit - The unit number. 111 * \return 112 * \retval Zero if no error was detected 113 * \retval Negative if error was detected. See \ref shr_error_e 114 */ 115 shr_error_e 116 dnx_l3_egress_ecmp_vip_init(int unit); 117 118 /** 119 * \brief 120 * Create or update the VIP ECMP group. 121 * \param [in] unit - The unit number. 122 * \param [in] ecmp - The ECMP group information. 123 * \param [in] intf_count - The number of ECMP members in the group. 124 * For VIP ECMP, it must match the size configure with bcmSwitchVIPEcmpTableSize. 125 * \param [in] intf_array - Array of the ECMP members. 126 * \return 127 * \retval Zero if no error was detected 128 * \retval Negative if error was detected. See \ref shr_error_e 129 */ 130 shr_error_e 131 dnx_l3_egress_ecmp_vip_create( 132 int unit, 133 bcm_l3_egress_ecmp_t * ecmp, 134 int intf_count, 135 bcm_if_t * intf_array); 136 137 /** 138 * \brief 139 * Walk through all configured ECMP VIP groups and run the callback function. 140 * \param [in] unit - The unit number. 141 * \param [in] trav_fn - a pointer to the callback function. 142 * \param [in] user_data - opaque data passed to the callback function. 143 * \return 144 * \retval Zero if no error was detected 145 * \retval Negative if error was detected. See \ref shr_error_e 146 */ 147 shr_error_e 148 dnx_l3_egress_ecmp_vip_traverse( 149 int unit, 150 bcm_l3_egress_ecmp_traverse_cb trav_fn, 151 void *user_data); 152 153 /** 154 * \brief 155 * Delete the VIP ECMP group. 156 * \param [in] unit - The unit number. 157 * \param [in] ecmp - The ECMP group information. 158 * \return 159 * \retval Zero if no error was detected 160 * \retval Negative if error was detected. See \ref shr_error_e 161 */ 162 shr_error_e 163 dnx_l3_egress_ecmp_vip_destroy( 164 int unit, 165 bcm_l3_egress_ecmp_t * ecmp); 166 167 /** 168 * \brief 169 * Retrieve the member array of a VIP ECP group 170 * \param [in] unit - The unit number. 171 * \param [in] ecmp - The ECMP group information. 172 * \param [in] intf_size - The maximum size of the ECMP VIP group. 173 * For VIP ECMP, it must match the size configure with bcmSwitchVIPEcmpTableSize. 174 * \param [out] intf_array - Array of the ECMP members. 175 * \param [out] intf_count - The number of members returned in intf_array. 176 * \return 177 * \retval Zero if no error was detected 178 * \retval Negative if error was detected. See \ref shr_error_e 179 */ 180 shr_error_e 181 dnx_l3_egress_ecmp_vip_get( 182 int unit, 183 bcm_l3_egress_ecmp_t * ecmp, 184 int intf_size, 185 bcm_if_t * intf_array, 186 int *intf_count); 187 188 /** 189 * \brief 190 * Adds and entry to the resilient table 191 * \param [in] unit - 192 * The unit number. 193 * \param [in] flags - 194 * supported flags: 195 * - BCM_L3_ECMP_RESILIENT_PCC: Add and entry to the internal PCC State table in LEM. 196 * - BCM_L3_ECMP_RESILIENT_PCC_EXTERNAL: Add and entry to the external PCC State table in KBP. 197 * \param [in] entry - 198 * The entry data. The relevant fields 199 * - entry.ecmp.ecmp_intf -> VIP ECMP FEC ID 200 * - entry.hash_key -> user flow signature (ECMP-LB-Key[2](16), NWK-LB-Key} 201 * - entry.intf -> destination FEC ID 202 * \return 203 * \retval Zero if no error was detected 204 * \retval Negative if error was detected. See \ref shr_error_e 205 */ 206 shr_error_e 207 dnx_l3_egress_ecmp_pcc_resilient_add( 208 int unit, 209 uint32 flags, 210 bcm_l3_egress_ecmp_resilient_entry_t *entry); 211 212 /** 213 * \brief 214 * Deletes an entry from the resilient table 215 * \param [in] unit - 216 * The unit number. 217 * \param [in] flags - 218 * supported flags: 219 * - BCM_L3_ECMP_RESILIENT_PCC: Add and entry to the internal PCC State table in LEM. 220 * - BCM_L3_ECMP_RESILIENT_PCC_EXTERNAL: Add and entry to the external PCC State table in KBP. 221 * \param [in] entry - 222 * The entry data. The relevant fields 223 * - entry.ecmp.ecmp_intf -> VIP ECMP FEC ID 224 * - entry.hash_key -> user flow signature (ECMP-LB-Key[2](16), NWK-LB-Key} 225 * \return 226 * \retval Zero if no error was detected 227 * \retval Negative if error was detected. See \ref shr_error_e 228 */ 229 shr_error_e 230 dnx_l3_egress_ecmp_pcc_resilient_delete( 231 int unit, 232 uint32 flags, 233 bcm_l3_egress_ecmp_resilient_entry_t *entry); 234 235 /** 236 * \brief 237 * Replaces an entry in the resilient table 238 * \param [in] unit - 239 * The unit number. 240 * \param [in] flags - 241 * supported flags: 242 * - BCM_L3_ECMP_RESILIENT_PCC: Add and entry to the internal PCC State table in LEM. 243 * - BCM_L3_ECMP_RESILIENT_PCC_EXTERNAL: Add and entry to the external PCC State table in KBP. 244 * - BCM_L3_ECMP_RESILIENT_MATCH_HASH_KEY 245 * - BCM_L3_ECMP_RESILIENT_MATCH_ECMP 246 * - BCM_L3_ECMP_RESILIENT_MATCH_INTF 247 * - BCM_L3_ECMP_RESILIENT_REPLACE 248 * - BCM_L3_ECMP_RESILIENT_DELETE 249 * \param [in] match_entry - 250 * The match_entry data. The relevant fields acccording to flags 251 * - entry.ecmp.ecmp_intf -> VIP ECMP FEC ID 252 * - entry.hash_key -> user flow signature (ECMP-LB-Key[2](16), NWK-LB-Key} 253 * - entry.intf -> destination FEC ID 254 * \param [out] num_entries - the number of entries updated or deleted 255 * \param [in] replace_entry 256 * The replace entry data 257 * \return 258 * \retval Zero if no error was detected 259 * \retval Negative if error was detected. See \ref shr_error_e 260 */ 261 shr_error_e 262 dnx_l3_egress_ecmp_pcc_resilient_replace( 263 int unit, 264 uint32 flags, 265 bcm_l3_egress_ecmp_resilient_entry_t *match_entry, 266 int *num_entries, 267 bcm_l3_egress_ecmp_resilient_entry_t *replace_entry); 268 269 /** 270 * \brief 271 * Traverses the resilient table, calling the specified callback function for each matching entry. 272 * \param [in] unit - 273 * The unit number. 274 * \param [in] flags - 275 * supported flags: 276 * - BCM_L3_ECMP_RESILIENT_PCC: Add and entry to the internal PCC State table in LEM. 277 * - BCM_L3_ECMP_RESILIENT_PCC_EXTERNAL: Add and entry to the external PCC State table in KBP. 278 * - BCM_L3_ECMP_RESILIENT_MATCH_HASH_KEY 279 * - BCM_L3_ECMP_RESILIENT_MATCH_INTF 280 * - BCM_L3_ECMP_RESILIENT_MATCH_ECMP 281 * \param [in] match_entry - 282 * The entry data. The relevant fields 283 * - entry.ecmp.ecmp_intf -> VIP ECMP FEC ID 284 * - entry.hash_key -> user flow signature (ECMP-LB-Key[2](16), NWK-LB-Key} 285 * - entry.intf -> destination FEC ID 286 * \param [in] trav_fn - callback function 287 * \param [in] user_data - Opaque user data to be passed back to the callback 288 * \return 289 * \retval Zero if no error was detected 290 * \retval Negative if error was detected. See \ref shr_error_e 291 */ 292 shr_error_e 293 dnx_l3_egress_ecmp_pcc_resilient_traverse( 294 int unit, 295 uint32 flags, 296 bcm_l3_egress_ecmp_resilient_entry_t *match_entry, 297 bcm_l3_egress_ecmp_resilient_traverse_cb trav_fn, 298 void *user_data); 299 300 /** 301 * \brief - Configure the SLLB default destination 302 * 303 * \param [in] unit - Relevant unit. 304 * \param [in] arg - gport of default destination 305 * \retval Zero if no error was detected 306 * \retval Negative if error was detected. See \ref shr_error_e 307 * 308 * \see 309 * * None 310 */ 311 shr_error_e 312 dnx_switch_control_sllb_default_destination_set( 313 int unit, 314 int arg); 315 316 /** 317 * \brief - Get the SLLB default destination 318 * 319 * \param [in] unit - Relevant unit. 320 * \param [out] arg - gport of default destination 321 * \retval Zero if no error was detected 322 * \retval Negative if error was detected. See \ref shr_error_e 323 * 324 * \remark 325 * None 326 * \see 327 * * None 328 */ 329 shr_error_e 330 dnx_switch_control_sllb_default_destination_get( 331 int unit, 332 int * arg); 333 334 /** 335 * \brief - Configure the SLLB VIP ECMP table size 336 * 337 * \param [in] unit - Relevant unit. 338 * \param [in] arg - table size. 339 * \retval Zero if no error was detected 340 * \retval Negative if error was detected. See \ref shr_error_e 341 * 342 * \remark 343 * SLLB Table Size may be set only when no VIP ECMP FECs have been allocated. 344 * \see 345 * * None 346 */ 347 shr_error_e 348 dnx_switch_control_sllb_table_size_set( 349 int unit, 350 int arg); 351 352 /** 353 * \brief - Get the SLLB VIP ECMP table size 354 * 355 * \param [in] unit - Relevant unit. 356 * \param [out] arg - table size. 357 * \retval Zero if no error was detected 358 * \retval Negative if error was detected. See \ref shr_error_e 359 * 360 * \remark 361 * None 362 * \see 363 * * None 364 */ 365 shr_error_e 366 dnx_switch_control_sllb_table_size_get( 367 int unit, 368 int * arg); 369 370 /** 371 * \brief - Configure the VIP ECMP minimum FEC-ID 372 * 373 * \param [in] unit - Relevant unit. 374 * \param [in] arg - minimum FEC-ID in the range reserved for VIP ECPM FECs. 375 * \retval Zero if no error was detected 376 * \retval Negative if error was detected. See \ref shr_error_e 377 * 378 * \see 379 * * None 380 */ 381 shr_error_e 382 dnx_switch_control_vip_l3_egress_id_min_set( 383 int unit, 384 int arg); 385 386 /* 387 * } 388 */ 389 #endif /* L3_ECMP_VIP_H_INCLUDED */