field_entry.h (28942B)
1 /** 2 * \file bcm_int/dnx/field/field_entry.h 3 * 4 * 5 * Field entry procedures for DNX. 6 * 7 * Management for pushing entries into TCAM/ MDB / State Table / Action payload of TCAM (DT) 8 */ 9 /* 10 * 11 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 12 * 13 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 14 */ 15 16 #ifndef FIELD_FIELD_ENTRY_H_INCLUDED 17 /* { */ 18 #define FIELD_FIELD_ENTRY_H_INCLUDED 19 20 #ifndef BCM_DNX_SUPPORT 21 #error "This file is for use by DNX (JR2) family only!" 22 #endif 23 /* 24 * Include files 25 * { 26 */ 27 #include <include/bcm_int/dnx/field/field.h> 28 #include <soc/dnx/dnx_data/auto_generated/dnx_data_device.h> 29 #include <soc/dnx/dnx_data/auto_generated/dnx_data_field.h> 30 #include <soc/dnx/dnx_data/auto_generated/dnx_data_max_field.h> 31 #include <soc/dnx/swstate/auto_generated/access/dnx_field_tcam_access_access.h> 32 33 /* 34 * } 35 */ 36 /* 37 * The same as DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_BITS_IN_FES_ACTION but expressed in 38 * units of 'uint32'. Rounded up. 39 */ 40 #define DNX_DATA_MAX_FIELD_PMF_NOF_UINT32S_MAX_IN_FES_ACTION \ 41 ((DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_BITS_IN_FES_ACTION + SAL_UINT32_NOF_BITS - 1) / SAL_UINT32_NOF_BITS) 42 43 /* INTERNAL */ 44 #define DNX_DATA_FIELD_ENTRY_ACCESS_ID_MASK 0xFFFFF 45 46 /* EXTERNAL */ 47 #define DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_ACCESS_ID_SIZE 26 48 #define DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_ACCESS_ID_MASK 0x3FFFFFF 49 #define DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_FG_ID_SHIFT 26 50 #define DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_FG_ID_MASK 0x1F 51 52 /* DT */ 53 #define DNX_DATA_FIELD_ENTRY_DT_ACCESS_ID_MASK 0xFFF 54 #define DNX_DATA_FIELD_ENTRY_DT_FG_ID_SHIFT 12 55 #define DNX_DATA_FIELD_ENTRY_DT_FG_ID_MASK 0xFF 56 57 /* COMMON */ 58 #define DNX_DATA_FIELD_ENTRY_CORE_ID_SHIFT 20 59 #define DNX_DATA_FIELD_ENTRY_CORE_ID_MASK 0xF 60 61 typedef enum 62 { 63 DNX_FIELD_TCAM_INTERNAL = 0, 64 DNX_FIELD_TCAM_DT = 1, 65 DNX_FIELD_TCAM_EXTERNAL = 2, 66 } dnx_field_entry_tcam_type_e; 67 68 #define DNX_DATA_FIELD_TCAM_TYPE_SHIFT 30 69 #define DNX_DATA_FIELD_TCAM_TYPE_MASK 0x3 70 71 #define DNX_FIELD_ENTRY_IS_EXTERNAL_TCAM(entry_handle) \ 72 (((((entry_handle) >> DNX_DATA_FIELD_TCAM_TYPE_SHIFT) & DNX_DATA_FIELD_TCAM_TYPE_MASK)) == DNX_FIELD_TCAM_EXTERNAL) 73 74 #define DNX_FIELD_ENTRY_IS_DT_TCAM(entry_handle) \ 75 (((((entry_handle) >> DNX_DATA_FIELD_TCAM_TYPE_SHIFT) & DNX_DATA_FIELD_TCAM_TYPE_MASK)) == DNX_FIELD_TCAM_DT) 76 77 #define DNX_FIELD_TCAM_ENTRY_CORE_ID(entry_handle) \ 78 (((entry_handle) >> DNX_DATA_FIELD_ENTRY_CORE_ID_SHIFT) & DNX_DATA_FIELD_ENTRY_CORE_ID_MASK) 79 80 #define DNX_FIELD_ENTRY_ACCESS_ID(entry_handle) \ 81 ((DNX_FIELD_ENTRY_IS_EXTERNAL_TCAM(entry_handle)) ? \ 82 ((entry_handle) & DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_ACCESS_ID_MASK) : \ 83 (DNX_FIELD_ENTRY_IS_DT_TCAM((entry_handle))? ((entry_handle) & DNX_DATA_FIELD_ENTRY_DT_ACCESS_ID_MASK) : \ 84 ((entry_handle) & DNX_DATA_FIELD_ENTRY_ACCESS_ID_MASK))) 85 86 #define DNX_FIELD_TCAM_EXTERNAL_ENTRY_FG_ID(entry_handle) \ 87 (((entry_handle) >> DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_FG_ID_SHIFT) & DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_FG_ID_MASK) 88 89 /** This macro encodes the access id that is passed to TCAM handler. 90 * Note that the MSB bit #32 is used for encoding of the is_exteranl_tcam bit (0 for DNX_FIELD_TCAM_INTERNAL entries.) 91 * 92 * TCAM Entry Id is encoded in the following way (from MSB to LSB): 93 * FG_TYPE (2 bit, value=0b00) 94 * NOT USED (6 bits) 95 * CORE ID (4 bits) 96 * ACCESS_ID (20 bits) 97 */ 98 #define DNX_FIELD_TCAM_ENTRY(access_id, core_id) \ 99 (DNX_FIELD_ENTRY(DNX_FIELD_TCAM_INTERNAL, (access_id), 0, (core_id))) 100 101 /** This macro encodes the access id that is passed to External TCAM handler. 102 * Note that the MSB bit #32 is used for encoding of the is_exteranl_tcam bit (1 for EXTERNAL TCAM entries.) 103 * 104 * EXTERNAL TCAM Entry Id is encoded in the following way (from MSB to LSB): 105 * FG TYPE (1 bit, value=0b1) 106 * FG_ID (5 bits) 107 * ACCESS_ID (26 bits) 108 */ 109 #define DNX_FIELD_EXTERNAL_TCAM_ENTRY(access_id, fg_id) \ 110 (DNX_FIELD_ENTRY(DNX_FIELD_TCAM_EXTERNAL, (access_id), (fg_id), 0)) 111 112 /** This macro encodes the access id that is passed to External TCAM handler. 113 * Note that the MSB bit #32 is used for encoding of the is_exteranl_tcam bit (1 for EXTERNAL TCAM entries.) 114 * 115 * EXTERNAL TCAM Entry Id is encoded in the following way (from MSB to LSB): 116 * FG TYPE (2 bit, value=0b01) 117 * NOT USED (6 bits) 118 * CORE ID (4 bits) 119 * FG ID (8 bits) 120 * ACCESS_ID (12 bits) 121 */ 122 #define DNX_FIELD_TCAM_DT_ENTRY(access_id, fg_id, core_id) \ 123 (DNX_FIELD_ENTRY(DNX_FIELD_TCAM_DT, (access_id), (fg_id), (core_id))) 124 125 /** This macro encode the entry handle id for TCAM/External_TCAM/TCAM_DT entries. */ 126 #define DNX_FIELD_ENTRY(fg_type, access_id, fg_id, core_id) \ 127 (((fg_type) << DNX_DATA_FIELD_TCAM_TYPE_SHIFT) | \ 128 ((((fg_type) != DNX_FIELD_TCAM_EXTERNAL)? (core_id) : 0) << DNX_DATA_FIELD_ENTRY_CORE_ID_SHIFT) | \ 129 ((((fg_type) != DNX_FIELD_TCAM_INTERNAL)? (fg_id) : 0) << \ 130 ((fg_type == DNX_FIELD_TCAM_DT)? DNX_DATA_FIELD_ENTRY_DT_FG_ID_SHIFT : DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_FG_ID_SHIFT)) | \ 131 (access_id)) 132 133 /** This macro extracts the access id from an entry handle id of an external TCAM 134 * 135 * EXTERNAL TCAM Entry Id is encoded in the following way (from MSB to LSB): 136 * FG TYPE (1 bit, value=0b1) 137 * FG_ID (5 bits) 138 * ACCESS_ID (26 bits) 139 */ 140 #define DNX_FIELD_EXTERNAL_TCAM_ACCESS_ID(entry_handle_id) \ 141 ((entry_handle_id) & (DNX_DATA_FIELD_ENTRY_EXTERNAL_TCAM_ACCESS_ID_MASK)) 142 143 /* 144 * enum 145 * { 146 */ 147 148 /** 149 * Holds possible flags for entry creation/updating. 150 * Used in dnx_field_ace_entry_add()/dnx_field_entry_tcam_add() 151 */ 152 typedef enum 153 { 154 /** 155 * Creates entry with a user-specified ID. 156 */ 157 DNX_FIELD_ENTRY_ADD_FLAG_WITH_ID = 0x1, 158 /** 159 * Entry is not added, but rather updated. 160 * - For ACE entries, only payload can be updated 161 * - For TCAM entries, key/payload/valid_bit can be updated. 162 */ 163 DNX_FIELD_ENTRY_ADD_FLAG_UPDATE = 0x2, 164 } dnx_field_entry_add_flags_e; 165 166 /* 167 * } 168 */ 169 170 /* 171 * Struct 172 * { 173 */ 174 175 /** 176 * Actions data, as specified by the user. To be used to load action values to HW. 177 * See dnx_field_entry_payload_t. 178 */ 179 typedef struct 180 { 181 182 /* 183 * DNX Action applied, For iPMF1-2-3/EPMF. Selects the action for which the action value is to be applies. 184 * See field_map_data for details 185 */ 186 dnx_field_action_t dnx_action; 187 188 /* 189 * The value to be filled inside the FES action result, for the corresponding dnx_action. 190 * The number of bits to take from the uint32 (starting with the lsb) 191 * will be determined by the field group (and ultimately, from the action type). 192 */ 193 uint32 action_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_ACTION_PARAMS_PER_ENTRY]; 194 195 } dnx_field_entry_action_t; 196 197 /** 198 * The content of the payload of an entry. 199 * See dnx_field_entry_t. 200 * See dnx_field_entry_tcam_add. 201 * See dnx_field_entry_exem_add. 202 */ 203 typedef struct 204 { 205 206 /* 207 * The array of actions from which the entry payload is composed. 208 */ 209 dnx_field_entry_action_t action_info[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP]; 210 211 } dnx_field_entry_payload_t; 212 213 /** 214 * Qualifier data that is being used to build the key to be inserted into HW, 215 * including masks (for databases such as TCAM). 216 * EXEM DB will not use it 217 * 218 * See dnx_field_entry_key_t 219 */ 220 typedef struct 221 { 222 223 /** Dnx qualifier */ 224 dnx_field_qual_t dnx_qual; 225 226 /* 227 * The value to be filled for the part of the key that would be compared against the bits obtained by 228 * each qualifier type. For ranged input, serves as minimum value. 229 */ 230 uint32 qual_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_QUAL_PARAMS_PER_ENTRY]; 231 /* 232 * The maximum value, for ranged input only. 233 */ 234 uint32 qual_max_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_QUAL_PARAMS_PER_ENTRY]; 235 /* 236 * The mask to be filled for the part of the key that would be compared against the bits obtained by 237 * each qualifier type. 238 */ 239 uint32 qual_mask[DNX_DATA_MAX_FIELD_ENTRY_NOF_QUAL_PARAMS_PER_ENTRY]; 240 241 } dnx_field_entry_qual_t; 242 243 /** 244 * Structure of the key for an entry that require a mask (like TCAM). 245 * Contains the qualifiers data that is used to be inserted into HW. 246 * See dnx_field_entry_t. 247 * See dnx_field_entry_tcam_add. 248 */ 249 typedef struct 250 { 251 /* 252 * The array of qualifiers from which the entry key is composed. 253 */ 254 dnx_field_entry_qual_t qual_info[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]; 255 256 } dnx_field_entry_key_t; 257 258 /**Hold the in params for dnx_field_entry_tcam_add API*/ 259 typedef struct 260 { 261 /** 262 * Each entry has its priority, meaning where the entry should be located in the Field Group 263 * TCAM. Lower priority value means higher precedence, which means the TCAM hit with that entry should occur first. 264 */ 265 uint32 priority; 266 267 /** Hold the qualifier values to be filled in TCAM key*/ 268 dnx_field_entry_key_t key_info; 269 270 /** Hold the actions values to be filled in TCAM payload*/ 271 dnx_field_entry_payload_t payload_info; 272 273 /** Core to add the entry on */ 274 int core; 275 276 /** Valid bit, if set to false, entry will exist but won't be active */ 277 uint8 valid_bit; 278 279 } dnx_field_entry_t; 280 281 /* 282 * } 283 */ 284 285 /** 286 * \brief 287 * Init structure type of dnx_field_entry_t to Invalid values 288 * \param [in] unit - Device ID 289 * \param [in] entry_add_in_p - Pointer to structure type of dnx_field_entry_t 290 * \return 291 * shr_error_e - Error Type 292 * \remark 293 * * None 294 * \see 295 * * None 296 */ 297 shr_error_e dnx_field_entry_t_init( 298 int unit, 299 dnx_field_entry_t * entry_add_in_p); 300 301 /** 302 * \brief 303 * Init Structure dnx_field_entry_payload_t to invalid params 304 * \param [in] unit - Device Id 305 * \param [in] payload_info_p - Structure pointer to init 306 * \return 307 * shr_error_e - Error Type 308 * \remark 309 * * None 310 * \see 311 * * None 312 */ 313 shr_error_e dnx_field_entry_payload_t_init( 314 int unit, 315 dnx_field_entry_payload_t * payload_info_p); 316 317 /** 318 * \brief 319 * Add a new entry to indicated TCAM database. 320 * On input, specify all actions and qualifiers to go into that entry in hardware: 321 * Actions will go into 'actions payload' and 322 * qualifiers will go into 'entry key'. See 'remarks' below 323 * 324 * \param [in] unit - Device ID 325 * \param [in] flags - TCAM entry addition flags, currently supported flags can be (WITH_ID | UPDATE) 326 * \param [in] fg_id - The ID of the field group to which we add the entry. 327 * \param [in] entry_info_p - Entry info to configure into TCAM 328 * \param [out] entry_handle_p - Entry id handler to return to user 329 * 330 * \return 331 * shr_error_e - Error Type 332 * \remark 333 * * The action payload construction and key construction is done in dnx_field_group_context_attach() 334 * * Field group Id can be found in dnx_field_entry_t->fg_id. 335 * It is used to extract the relevant data regarding the TCAM key and payload and which TCAM needs to be accessed. 336 * User can fill a subset of qualifier and actions, the DBAL will complete the qualifier to dont_cares and actions to 0 (invalid) 337 * \see 338 * * None 339 */ 340 shr_error_e dnx_field_entry_tcam_add( 341 int unit, 342 uint32 flags, 343 dnx_field_group_t fg_id, 344 dnx_field_entry_t * entry_info_p, 345 uint32 *entry_handle_p); 346 347 /** 348 * \brief 349 * Add a new entry to indicated TCAM DT database. 350 * On input, specify all actions and qualifiers to go into that entry in hardware: 351 * Actions will go into 'actions payload' and 352 * qualifiers will go into 'entry key'. See 'remarks' below 353 * 354 * \param [in] unit - Device ID 355 * \param [in] flags - TBD 356 * \param [in] fg_id - The ID of the TCAM DT field group to which we add the entry. 357 * \param [in] entry_info_p - Entry info to configure into TCAM 358 * \param [out] entry_handle_p - Entry id handler to return to user 359 * 360 * \return 361 * shr_error_e - Error Type 362 * \remark 363 * * The action payload construction and key construction is done in dnx_field_group_context_attach() 364 * * Field group Id can be found in dnx_field_entry_t->fg_id. 365 * It is used to extract the relevant data regarding the TCAM key and payload and which TCAM needs to be accessed. 366 * User can fill a subset of qualifier and actions, the DBAL will complete the qualifier to dont_cares and actions to 0 (invalid) 367 * \see 368 * * None 369 */ 370 shr_error_e dnx_field_entry_tcam_dt_add( 371 int unit, 372 uint32 flags, 373 dnx_field_group_t fg_id, 374 dnx_field_entry_t * entry_info_p, 375 uint32 *entry_handle_p); 376 377 /** 378 * \brief 379 * Add a new entry to indicated EXEM data base. 380 * On input, specify all actions and qualifiers to go into that entry in hardware: 381 * Actions will go into 'actions payload' and 382 * qualifiers will go into 'entry key'. See 'remarks' below 383 * \param [in] unit - Device ID 384 * \param [in] flags - entry addition flags, currently only supported flag is 385 * DNX_FIELD_ENTRY_ADD_FLAG_UPDATE 386 * \param [in] fg_id - The ID of the field group to which we add the entry. 387 * \param [in] entry_info_p - Entry info to configure into the database. 388 * \return 389 * shr_error_e - Error Type 390 * \remark 391 * * The action payload construction and key construction is done in dnx_field_group_context_attach() 392 * * Field group Id is used to extract the relevant data regarding the EXEM key and payload with which EXEM needs to 393 * be accessed. User can fill a subset of and actions, the DBAL will complete the actions to 0 (Including setting 394 * the valid bit to zero, thus invalidating the actions). 395 * However, unlike TCAM, all qualifiers must be given, since we don't have a mask in exact match and the value of 396 * every qualifier is compared in the lookup. 397 * \see 398 * * None 399 */ 400 shr_error_e dnx_field_entry_exem_add( 401 int unit, 402 uint32 flags, 403 dnx_field_group_t fg_id, 404 dnx_field_entry_t * entry_info_p); 405 406 /** 407 * \brief 408 * Add a new entry to indicated MDB DT data base. 409 * On input, specify all actions and qualifiers to go into that entry in hardware: 410 * Actions will go into 'actions payload' and 411 * qualifiers will go into 'entry key'. See 'remarks' below 412 * \param [in] unit - Device ID 413 * \param [in] flags - TBD 414 * \param [in] fg_id - The ID of the field group to which we add the entry. 415 * \param [in] entry_info_p - Entry info to configure into the database. 416 * \return 417 * shr_error_e - Error Type 418 * \remark 419 * * The action payload construction and key construction is done in dnx_field_group_context_attach() 420 * * Field group Id is used to extract the relevant data regarding the MDB DT key and payload with which MDB DT needs to 421 * be accessed. User can fill a subset of and actions, the DBAL will complete the actions to 0 (Including setting 422 * the valid bit to zero, thus invalidating the actions). 423 * However, unlike TCAM, all qualifiers must be given, since we don't have a mask in exact match and the value of 424 * every qualifier is compared in the lookup. 425 * \see 426 * * None 427 */ 428 shr_error_e dnx_field_entry_mdb_dt_add( 429 int unit, 430 uint32 flags, 431 dnx_field_group_t fg_id, 432 dnx_field_entry_t * entry_info_p); 433 434 /** 435 * \brief 436 * Add a new entry to indicated External TCAM (KBP) data base. 437 * On input, specify all actions and qualifiers to go into that entry in hardware: 438 * Actions will go into 'actions payload' and 439 * qualifiers will go into 'entry key'. 440 * \param [in] unit - Device ID 441 * \param [in] flags - TCAM entry addition flags, currently supported flags can be (WITH_ID | UPDATE) 442 * \param [in] fg_id - The ID of the field group to which we add the entry. 443 * \param [in] entry_info_p - Entry info to configure into TCAM 444 * \param [out] entry_handle_p - Entry id handler to return to user 445 * \return 446 * shr_error_e - Error Type 447 * \remark 448 * \see 449 * * None 450 */ 451 shr_error_e dnx_field_entry_kbp_add( 452 int unit, 453 uint32 flags, 454 dnx_field_group_t fg_id, 455 dnx_field_entry_t * entry_info_p, 456 uint32 *entry_handle_p); 457 458 /** 459 * \brief 460 * Adds a new entry to State Table at the given address and sets its data as the given data 461 * 462 * \param [in] unit - Device ID 463 * \param [in] stage - Stage of the qualifiers 464 * \param [in] entry_key_info_p - Entry key info. Address and data are extracted from it. 465 * 466 * \return 467 * shr_error_e - Error Type 468 * \remark 469 * * This function ignores the Do-Write bit. 470 * \see 471 * * None 472 */ 473 shr_error_e dnx_field_entry_state_table_add( 474 int unit, 475 dnx_field_stage_e stage, 476 dnx_field_entry_key_t * entry_key_info_p); 477 478 /** 479 * \brief 480 * Deletes the State Table entry at the given address. 481 * 482 * \param [in] unit - Device ID 483 * \param [in] stage - Stage of the qualifiers 484 * \param [in] entry_key_info_p - Entry key info. Address is extracted from it. 485 * 486 * \return 487 * shr_error_e - Error Type 488 * \remark 489 * * None 490 * \see 491 * * None 492 */ 493 shr_error_e dnx_field_entry_state_table_delete( 494 int unit, 495 dnx_field_stage_e stage, 496 dnx_field_entry_key_t * entry_key_info_p); 497 498 /** 499 * \brief 500 * Gets the State Table entry data at the given address 501 * 502 * \param [in] unit - Device ID 503 * \param [in] stage - Stage of the qualifiers 504 * \param [in] entry_key_info_p - Entry key info. Address is extracted from it. Data is added to it. 505 * 506 * \return 507 * shr_error_e - Error Type 508 * \remark 509 * * None 510 * \see 511 * * None 512 */ 513 shr_error_e dnx_field_entry_state_table_get( 514 int unit, 515 dnx_field_stage_e stage, 516 dnx_field_entry_key_t * entry_key_info_p); 517 518 /** 519 * \brief 520 * Add a new entry to indicated ACE format. 521 * On input, specify all actions and their values to go into that entry in hardware. 522 * \param [in] unit - Device ID 523 * \param [in] flags - Can be WITH_ID or UPDATE. If UPDATE flag is set, WITH_ID flag is ignored. 524 * \param [in] ace_id - ACE format ID 525 * \param [in] payload_info_p - The actions and their value to fill in the payload of the entry. 526 * \param [in, out] ace_entry_key_p - The entry of the ACE key, the value to be written in the CUD_OUTLIF_OR_MCDB_PTR 527 * action of eMPF for the entry to be matched in the ACE table lookup. 528 * Input if WITH_ID or UPDATE flags are set. 529 * \return 530 * shr_error_e - Error Type 531 * \remark 532 * * The action payload construction and key construction is done in dnx_field_ace_format_add() 533 * * User can fill a subset of the actions, the DBAL will complete the actions to 0 534 * (Including setting the valid bit to zero, thus invalidating the actions). 535 * \see 536 * * None 537 */ 538 shr_error_e dnx_field_ace_entry_add( 539 int unit, 540 uint32 flags, 541 dnx_field_ace_id_t ace_id, 542 dnx_field_entry_payload_t * payload_info_p, 543 dnx_field_ace_key_t * ace_entry_key_p); 544 545 /** 546 * \brief 547 * This function allocates Id that will later be used by TCAM to know where to put the entry inside TCAM banks of the given core 548 * also configure the TCAM manager to find place in the TCAM banks of the given core to put the entry and connect it to the 549 * allocated access id 550 * 551 * \param [in] unit - Device Id 552 * \param [in] core - Core ID 553 * \param [in] dbal_table_id - static DBAL table that was create for the sake of the input entry, 554 * static since api used by non-PMF stages 555 * \param [in] priority - Entry priority, see dnx_field_tcam_entry_t 556 * \param [out] entry_access_id_p - Access_id that was allocated for this entry and 557 * \return 558 * shr_error_e - Error Type 559 * \remark 560 * * This function is being used by non PMF stages (VTT/FLP..) stages that use static tables for TCAM 561 * \see 562 * * dnx_field_entry_access_id_alloc() to see how entry_access_id_p is encoded 563 */ 564 shr_error_e dnx_field_entry_access_id_create( 565 int unit, 566 int core, 567 dbal_tables_e dbal_table_id, 568 uint32 priority, 569 uint32 *entry_access_id_p); 570 571 /** 572 * \brief 573 * Destroy an entry_acces_id for specific DBAL table 574 * Deallocates the access id and delete information from TCAM manager to free the entry 575 * \param [in] unit - Device ID 576 * \param [in] dbal_table_id - DBAL table 577 * \param [in] entry_access_id - Access Id that should be destroyed 578 * \return 579 * shr_error_e - Error Type 580 * \remark 581 * * None 582 * \see 583 * * None 584 */ 585 shr_error_e dnx_field_entry_access_id_destroy( 586 int unit, 587 dbal_tables_e dbal_table_id, 588 uint32 entry_access_id); 589 590 /** 591 * \brief 592 * Destoy all entries that were allocated for specific Dbal table 593 * Deallocates all access id's and deletes information from TCAM manager to free all entries 594 * \param [in] unit - Device ID 595 * \param [in] dbal_table_id - DBAL table to free 596 * \return 597 * shr_error_e - Error Type 598 * \remark 599 * * None 600 * \see 601 * * None 602 */ 603 shr_error_e dnx_field_entry_access_id_destroy_all( 604 int unit, 605 dbal_tables_e dbal_table_id); 606 607 /** 608 * \brief 609 * Delete all entries that were allocated for the given tcam handler id. 610 * \param [in] unit - Device ID 611 * \param [in] fg_id - ID of the field group to delete its entries 612 * \return 613 * shr_error_e - Error Type 614 * \remark 615 * * None 616 * \see 617 * * None 618 */ 619 shr_error_e dnx_field_entry_tcam_delete_all( 620 int unit, 621 dnx_field_group_t fg_id); 622 623 /** 624 * \brief 625 * Delete all entries in the state table (for all state table field groups). 626 * \param [in] unit - Device ID 627 * \return 628 * shr_error_e - Error Type 629 * \remark 630 * * None 631 * \see 632 * * None 633 */ 634 shr_error_e dnx_field_entry_state_table_all_delete_all( 635 int unit); 636 637 /** 638 * \brief 639 * Delete TCAM Entry From HW and free all allocated resources 640 * \param [in] unit - Device ID 641 * \param [in] fg_id - Entry's FG ID 642 * \param [in] entry_handle - unique identifier of entry 643 * \param [in] key_info_p - Key information for DT entries 644 * \return 645 * shr_error_e - Error Type 646 * \remark 647 * * None 648 * \see 649 * * dnx_field_group_entry_delete_all 650 */ 651 shr_error_e dnx_field_entry_tcam_delete( 652 int unit, 653 dnx_field_group_t fg_id, 654 uint32 entry_handle, 655 dnx_field_entry_key_t * key_info_p); 656 657 /** 658 * \brief 659 * Delete External TCAM (KBP) Entry From HW and free all allocated resources 660 * \param [in] unit - Device ID 661 * \param [in] fg_id - Entry's FG ID 662 * \param [in] entry_handle - unique identifier of entry 663 * \return 664 * shr_error_e - Error Type 665 * \remark 666 * * None 667 * \see 668 * * dnx_field_group_entry_delete_all 669 */ 670 shr_error_e dnx_field_entry_kbp_delete( 671 int unit, 672 bcm_field_group_t fg_id, 673 uint32 entry_handle); 674 675 /** 676 * \brief 677 * Delete EXEM Entry From HW. 678 * \param [in] unit - Device ID 679 * \param [in] fg_id - The ID of the field group in which the entry we want to delete. 680 * \param [in] entry_key_p - The key of the entry to delete, used as identifier. 681 * \return 682 * shr_error_e - Error Type 683 * \remark 684 * * None 685 * \see 686 * * dnx_field_group_entry_delete_all 687 */ 688 shr_error_e dnx_field_entry_exem_delete( 689 int unit, 690 dnx_field_group_t fg_id, 691 dnx_field_entry_key_t * entry_key_p); 692 693 /** 694 * \brief 695 * Delete MDB DT Entry From HW. 696 * \param [in] unit - Device ID 697 * \param [in] fg_id - The ID of the field group in which the entry we want to delete. 698 * \param [in] entry_key_p - The key of the entry to delete, used as identifier. 699 * \return 700 * shr_error_e - Error Type 701 * \remark 702 * * None 703 * \see 704 * * dnx_field_group_entry_delete_all 705 */ 706 shr_error_e dnx_field_entry_mdb_dt_delete( 707 int unit, 708 dnx_field_group_t fg_id, 709 dnx_field_entry_key_t * entry_key_p); 710 711 712 shr_error_e dnx_field_ace_entry_delete( 713 int unit, 714 dnx_field_ace_key_t ace_entry_key); 715 716 /** 717 * \brief 718 * Get info for specific TCAM Field group by entry id 719 * \param [in] unit - Device ID 720 * \param [in] fg_id - Entry's FG ID 721 * \param [in] entry_handle - unique entry handle 722 * \param [out] entry_info_p - Pointer to dnx_field_entry_t to get info from TCAM HW 723 * \return 724 * shr_error_e - Error Type 725 * \remark 726 * * None 727 * \see 728 * * None 729 */ 730 shr_error_e dnx_field_entry_tcam_get( 731 int unit, 732 dnx_field_group_t fg_id, 733 uint32 entry_handle, 734 dnx_field_entry_t * entry_info_p); 735 736 /** 737 * \brief 738 * Get info for specific KBP Field group by entry id 739 * \param [in] unit - Device ID 740 * \param [in] fg_id - Entry's FG ID 741 * \param [in] entry_handle - unique entry handle 742 * \param [out] entry_info_p - Pointer to dnx_field_entry_t to get info from KBP HW 743 * \return 744 * shr_error_e - Error Type 745 * \remark 746 * * None 747 * \see 748 * * None 749 */ 750 shr_error_e dnx_field_entry_kbp_get( 751 int unit, 752 bcm_field_group_t fg_id, 753 uint32 entry_handle, 754 dnx_field_entry_t * entry_info_p); 755 756 /** 757 * \brief 758 * Get info for specific EXEM Field group by entry id 759 * \param [in] unit - Device ID 760 * \param [in] fg_id - Field group ID. 761 * \param [in] entry_key_p - The key of the entry we want to read. 762 * \param [out] entry_info_p - Pointer to dnx_field_entry_t to get info from EXEM HW 763 * \return 764 * shr_error_e - Error Type 765 * \remark 766 * * None 767 * \see 768 * * None 769 */ 770 shr_error_e dnx_field_entry_exem_get( 771 int unit, 772 dnx_field_group_t fg_id, 773 dnx_field_entry_key_t * entry_key_p, 774 dnx_field_entry_t * entry_info_p); 775 776 /** 777 * \brief 778 * Get info for specific MDB DT Field group by entry id 779 * \param [in] unit - Device ID 780 * \param [in] fg_id - Field group ID. 781 * \param [in] entry_key_p - The key of the entry we want to read. 782 * \param [out] entry_info_p - Pointer to dnx_field_entry_t to get info from MDB DT HW 783 * \return 784 * shr_error_e - Error Type 785 * \remark 786 * * None 787 * \see 788 * * None 789 */ 790 shr_error_e dnx_field_entry_mdb_dt_get( 791 int unit, 792 dnx_field_group_t fg_id, 793 dnx_field_entry_key_t * entry_key_p, 794 dnx_field_entry_t * entry_info_p); 795 796 /** 797 * \brief 798 * Get info for specific ACE format by key. 799 * \param [in] unit - Device ID 800 * \param [in] ace_entry_key - The key of the entry we want to read. 801 * \param [out] payload_info_p - The action values in the entry. If NULL not filled. 802 * \param [out] ace_id_p - Pointer to the ACE format ID associated with the entry. If NULL not filled. 803 * \return 804 * shr_error_e - Error Type 805 * \remark 806 * * None 807 * \see 808 * * None 809 */ 810 shr_error_e dnx_field_ace_entry_get( 811 int unit, 812 dnx_field_ace_key_t ace_entry_key, 813 dnx_field_entry_payload_t * payload_info_p, 814 dnx_field_ace_id_t * ace_id_p); 815 816 /** 817 * \brief 818 * Get hit indication info for a specific TCAM entry per core. 819 * \param [in] unit - Device ID 820 * \param [in] flags - Flags for future use. 821 * \param [in] entry_handle - Unique entry handle 822 * \param [out] entry_hit_core_bmp_p - 2 bits bitmap, where every 823 * bit indicates on which core the entry was hit: 824 * - bit 0 = core 0 825 * - bit 1 = core 1 826 * There is possibility that entry was hit on both cores, then 827 * both bits will be set. 828 * \return 829 * shr_error_e - Error Type 830 * \remark 831 * * None 832 * \see 833 * * None 834 */ 835 shr_error_e dnx_field_entry_tcam_hit_get( 836 int unit, 837 uint32 flags, 838 uint32 entry_handle, 839 uint8 *entry_hit_core_bmp_p); 840 841 /** 842 * \brief 843 * This function flushes hit information of an entry or all entries, 844 * from hardware. 845 * \param [in] unit - Device ID 846 * \param [in] core_id - Entry core ID 847 * \param [in] flush_all - Indicates if FLUSH_ALL flag was used. TRUE or FALSE. 848 * \param [in] entry_abs_location - Absolute location of an unique 849 * entry handle. 850 * \return 851 * shr_error_e - Error Type 852 * \remark 853 * * None 854 * \see 855 * * None 856 */ 857 shr_error_e dnx_field_entry_tcam_hit_per_location_flush( 858 int unit, 859 dnx_field_tcam_core_e core_id, 860 uint8 flush_all, 861 uint32 entry_abs_location); 862 863 /** 864 * \brief 865 * This function flushes hit information of an entry or all entries, 866 * from hardware. 867 * \param [in] unit - Device ID 868 * \param [in] flags - Flags to indicate what action should be performed 869 * by the API, currently in use is: 870 * - BCM_FIELD_ENTRY_HIT_FLUSH_ALL - used for flushing hit 871 * indication info for all entries. No need to specify an entry ID. 872 * - If no flag is specified, the API will clear information only for 873 * the given entry_handle. 874 * \param [in] entry_handle - Unique entry handle for which the hit 875 * information will be flushed. 876 * \return 877 * shr_error_e - Error Type 878 * \remark 879 * * None 880 * \see 881 * * None 882 */ 883 shr_error_e dnx_field_entry_tcam_hit_flush( 884 int unit, 885 uint32 flags, 886 uint32 entry_handle); 887 888 #endif