diag_dnx_field.h (19701B)
1 /** 2 * \file diag_dnx_field.h 3 * Purpose: External declarations for command functions and 4 * their associated usage strings. 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 DIAG_DNX_FIELD_H_INCLUDED 13 /* { */ 14 #define DIAG_DNX_FIELD_H_INCLUDED 15 16 /************* 17 * INCLUDES * 18 */ 19 #include <soc/dnx/swstate/auto_generated/types/dnx_field_group_types.h> 20 #include <soc/dnx/swstate/auto_generated/types/dnx_field_types.h> 21 #include <appl/diag/sand/diag_sand_framework.h> 22 #include <appl/diag/sand/diag_sand_prt.h> 23 #include <bcm_int/dnx/field/field_actions.h> 24 /************* 25 * DEFINES * 26 */ 27 28 #define DNX_FIELD_KEY_ALL DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_KEYS*2 29 30 /************* 31 * MACROS * 32 */ 33 34 /** 35 * \brief 36 * Keyword for the field stage. 37 * Relevant ENUMs: 38 * - Field_stage_enum_table[] 39 * - Field_context_diag_stage_enum_table[] 40 * - Field_efes_diag_stage_enum_table[] 41 * - Field_group_diag_stage_enum_table[] 42 * - Field_key_diag_stage_enum_table[] 43 * - Field_last_diag_stage_enum_table[] 44 * - Field_port_diag_stage_enum_table[] 45 * - Field_qualifier_diag_stage_enum_table[] 46 * - Field_range_diag_stage_enum_table[] 47 * - Field_system_diag_stage_enum_table[] 48 * - Field_virtualwire_diag_stage_enum_table[] 49 */ 50 #define DIAG_DNX_FIELD_OPTION_STAGE "stage" 51 /** 52 * \brief 53 * Keyword for the field context. 54 */ 55 #define DIAG_DNX_FIELD_OPTION_CONTEXT "context" 56 /** 57 * \brief 58 * Keyword for the field context. 59 * Relevant ENUM: Field_group_enum_table[] 60 */ 61 #define DIAG_DNX_FIELD_OPTION_GROUP "group" 62 /** 63 * \brief 64 * Keyword for the field group type. 65 * Relevant ENUM: Group_type_enum_table[] 66 */ 67 #define DIAG_DNX_FIELD_OPTION_GROUP_TYPE "group_type" 68 /** 69 * \brief 70 * Keyword for key. 71 * Relevant ENUMs: 72 * - Field_key_enum_table[] 73 * - Field_init_key_enum_table[] 74 */ 75 #define DIAG_DNX_FIELD_OPTION_KEY "key" 76 /** 77 * \brief 78 * Keyword for the entry. 79 * Relevant ENUMs: 80 * - In case of ACE entry: Field_ace_entry_id_enum_table[] 81 * - Otherwise : It should be a specific entry id. 82 */ 83 #define DIAG_DNX_FIELD_OPTION_ENTRY "entry" 84 /** 85 * \brief 86 * Keyword for ACE format. 87 * Relevant ENUM: 88 * - Field_ace_format_id_enum_table[] 89 */ 90 #define DIAG_DNX_FIELD_OPTION_FORMAT "format" 91 /** 92 * \brief 93 * Keyword for IDs. 94 * Relevant ENUMs: 95 * - Field_action_enum_table[] 96 * - Field_qualifier_enum_table[] 97 * - Field_range_type_enum_table[] 98 * - Field_fem_enum_table[] 99 */ 100 #define DIAG_DNX_FIELD_OPTION_ID "id" 101 /** 102 * \brief 103 * Keyword for the program. 104 * Relevant ENUMs: 105 * - In case of FEM: Field_fem_program_enum_table_for_display[] 106 */ 107 #define DIAG_DNX_FIELD_OPTION_PROGRAM "program" 108 /** 109 * \brief 110 * Keyword for the EFES array. 111 */ 112 #define DIAG_DNX_FIELD_OPTION_ARRAY "array" 113 /** 114 * \brief 115 * Keyword for the EFES position within the EFES array. 116 */ 117 #define DIAG_DNX_FIELD_OPTION_POSITION "position" 118 /** 119 * \brief 120 * Keyword for the valid indication. 121 * Cane be '0'-FALSE or '1'-TRUE. 122 */ 123 #define DIAG_DNX_FIELD_OPTION_VALID "valid" 124 /** 125 * \brief 126 * Keyword for the bit map of active 'action's for which FEM info is to be displayed. 127 * Relevant ENUM: 128 * - Field_fem_active_actions_enum_table[] 129 */ 130 #define DIAG_DNX_FIELD_OPTION_ACTIVE_ACTIONS "active_actions" 131 /** 132 * \brief 133 * Keyword for the 'secondary' field group for which FEM info is to be displayed 134 * Relevant ENUM: 135 * - Field_group_enum_table[] 136 */ 137 #define DIAG_DNX_FIELD_OPTION_SEC_GROUP "sec_group" 138 /** 139 * \brief 140 * Keyword for the type. 141 * Relevant ENUMs: 142 * - Field_port_type_enum_table[] 143 */ 144 #define DIAG_DNX_FIELD_OPTION_TYPE "type" 145 /** 146 * \brief 147 * Keyword for the type. 148 * Relevant ENUMs: 149 * - Field_range_type_enum_table[] 150 */ 151 #define DIAG_DNX_FIELD_OPTION_INDEX "index" 152 /** 153 * \brief 154 * Keyword for the HANDLERs. 155 * Relevant ENUMs: 156 * - Field_tcam_handler_id_enum_table[] 157 */ 158 #define DIAG_DNX_FIELD_OPTION_HANDLER "handler" 159 /** 160 * \brief 161 * Keyword for the BANKs. 162 * Relevant ENUMs: 163 * - Field_tcam_bank_id_enum_table[] 164 */ 165 #define DIAG_DNX_FIELD_OPTION_BANK "bank" 166 /** 167 * \brief 168 * Keyword for the external opcode. 169 */ 170 #define DIAG_DNX_FIELD_OPTION_OPCODE "opcode" 171 172 /** 173 * \brief 174 * Keyword for only one packet injection 175 */ 176 #define DIAG_DNX_FIELD_OPTION_ONE_PKT "one_pkt" 177 178 /** 179 * \brief 180 * Keyword for the VirtualWire Name. 181 */ 182 #define DIAG_DNX_FIELD_OPTION_VW_NAME "vw_name" 183 /** 184 * \brief 185 * Keyword for the Predefined qualifier/action Name. 186 */ 187 #define DIAG_DNX_FIELD_OPTION_PREDEFINED_NAME "predefined" 188 /** 189 * \brief 190 * Keyword for the Core. 191 */ 192 #define DIAG_DNX_FIELD_OPTION_CORE "core" 193 /** 194 * \brief 195 * Keyword for the Signal. 196 */ 197 #define DIAG_DNX_FIELD_OPTION_SIGNAL "signal" 198 /** 199 * \brief 200 * Keyword for the showing signals. 201 */ 202 #define DIAG_DNX_FIELD_OPTION_SHOW_SIG "show_sig" 203 /** 204 * \brief 205 * Keyword for the showing description. 206 */ 207 #define DIAG_DNX_FIELD_OPTION_SHOW_DESC "show_desc" 208 209 /************* 210 * GLOBALS * 211 */ 212 extern sh_sand_cmd_t Sh_dnx_field_map_cmds[]; 213 214 extern sh_sand_cmd_t Sh_dnx_field_fem_base_cmds[]; 215 216 extern sh_sand_man_t Sh_dnx_field_man; 217 extern sh_sand_cmd_t Sh_dnx_field_cmds[]; 218 219 /** 220 * \brief 221 * Enum for option requiring all 'fem_programs' values 222 */ 223 extern sh_sand_enum_t Field_fem_program_enum_table_for_display[]; 224 /** 225 * \brief 226 * Enum for option requiring all 'pmf' and none 'pmf' stages 227 */ 228 extern sh_sand_enum_t Field_stage_enum_table[]; 229 /** 230 * \brief 231 * Enum for option requiring 'pmf' and none 'pmf' stages for 'context' diagnostic. 232 */ 233 extern sh_sand_enum_t Field_context_diag_stage_enum_table[]; 234 /** 235 * \brief 236 * Enum for option requiring 'pmf' and none 'pmf' stages for 'efes' diagnostic. 237 */ 238 extern sh_sand_enum_t Field_efes_diag_stage_enum_table[]; 239 /** 240 * \brief 241 * Enum for option requiring 'pmf' and none 'pmf' stages for 'group' diagnostic. 242 */ 243 extern sh_sand_enum_t Field_group_diag_stage_enum_table[]; 244 /** 245 * \brief 246 * Enum for option requiring 'pmf' and none 'pmf' stages for 'key' diagnostic. 247 */ 248 extern sh_sand_enum_t Field_key_diag_stage_enum_table[]; 249 /** 250 * \brief 251 * Enum for option requiring 'pmf' and none 'pmf' stages for 'last' diagnostic. 252 */ 253 extern sh_sand_enum_t Field_last_diag_stage_enum_table[]; 254 /** 255 * \brief 256 * Enum for option requiring 'pmf' and none 'pmf' stages for 'port' diagnostic. 257 */ 258 extern sh_sand_enum_t Field_port_diag_stage_enum_table[]; 259 /** 260 * \brief 261 * Enum for option requiring 'pmf' and none 'pmf' stages for 'qualifier' diagnostic. 262 */ 263 extern sh_sand_enum_t Field_qualifier_diag_stage_enum_table[]; 264 /** 265 * \brief 266 * Enum for option requiring 'pmf' and none 'pmf' stages for 'action' diagnostic. 267 */ 268 extern sh_sand_enum_t Field_action_diag_stage_enum_table[]; 269 /** 270 * \brief 271 * Enum for option requiring 'pmf' and none 'pmf' stages for 'range' diagnostic. 272 */ 273 extern sh_sand_enum_t Field_range_diag_stage_enum_table[]; 274 /** 275 * \brief 276 * Enum for option requiring 'pmf' and none 'pmf' stages for 'system' diagnostic. 277 */ 278 extern sh_sand_enum_t Field_system_diag_stage_enum_table[]; 279 /** 280 * \brief 281 * Enum for option requiring 'pmf' and none 'pmf' stages for 'virtualwire' diagnostic. 282 */ 283 extern sh_sand_enum_t Field_virtualwire_diag_stage_enum_table[]; 284 /** 285 * \brief 286 * Enum for option requiring all 'pmf' qualifier classes 287 */ 288 extern sh_sand_enum_t Field_qual_class_enum_table[]; 289 /** 290 * \brief 291 * Enum for option requiring 'pmf' field groups 292 */ 293 extern sh_sand_enum_t Field_group_enum_table[]; 294 /** 295 * \brief 296 * Enum for option requiring 'pmf' ACE Format IDs 297 */ 298 extern sh_sand_enum_t Field_ace_format_id_enum_table[]; 299 /** 300 * \brief 301 * Enum for option requiring 'pmf' ACE Entry IDs 302 */ 303 extern sh_sand_enum_t Field_ace_entry_id_enum_table[]; 304 /** 305 * \brief 306 * Enum for option requiring 'pmf' TCAM Handler IDs 307 */ 308 extern sh_sand_enum_t Field_tcam_handler_id_enum_table[]; 309 /** 310 * \brief 311 * Enum for option requiring 'pmf' TCAM Bank IDs 312 */ 313 extern sh_sand_enum_t Field_tcam_bank_id_enum_table[]; 314 /** 315 * \brief 316 * Enum for option requiring 'pmf' field qualifiers 317 */ 318 extern sh_sand_enum_t Field_qualifier_enum_table[]; 319 /** 320 * \brief 321 * Enum for option requiring 'pmf' field virtualwire qualifiers 322 */ 323 extern sh_sand_enum_t Field_qualifier_vw_enum_table[]; 324 /** 325 * \brief 326 * Enum for option requiring 'pmf' field actions 327 */ 328 extern sh_sand_enum_t Field_action_enum_table[]; 329 /** 330 * \brief 331 * Enum for option requiring 'pmf' field virtualwire actions 332 */ 333 extern sh_sand_enum_t Field_action_vw_enum_table[]; 334 /** 335 * \brief 336 * Enum for option requiring 'pmf' FEMs 337 */ 338 extern sh_sand_enum_t Field_fem_enum_table[]; 339 /** 340 * \brief 341 * Enum for option requiring all 'group types' 342 */ 343 extern sh_sand_enum_t Group_type_enum_table[]; 344 /** 345 * \brief 346 * Enum for option requiring all 'port types' 347 */ 348 extern sh_sand_enum_t Field_port_type_enum_table[]; 349 /** 350 * \brief 351 * Enum for option requiring 'active actions' for FEMs 352 */ 353 extern sh_sand_enum_t Field_fem_active_actions_enum_table[]; 354 /** 355 * \brief 356 * Enum for option requiring all 'range types' for range diagnostic. 357 */ 358 extern sh_sand_enum_t Field_range_list_range_type_enum_table[]; 359 /** 360 * \brief 361 * Enum for option requiring all 'range types' for range extended diagnostic. 362 */ 363 extern sh_sand_enum_t Field_range_extended_range_type_enum_table[]; 364 /** 365 * \brief 366 * Enum for option requiring all 'range config types' for range extended diagnostic. 367 */ 368 extern sh_sand_enum_t Field_range_extended_range_config_type_enum_table[]; 369 370 extern sh_sand_enum_t Field_level_enum_table[]; 371 extern sh_sand_enum_t Field_offset_enum_table[]; 372 extern sh_sand_enum_t Field_de_type_enum_table[]; 373 extern sh_sand_enum_t field_qual_class_type_enum_table[]; 374 extern sh_sand_enum_t Field_key_enum_table[]; 375 extern sh_sand_enum_t Field_init_key_enum_table[]; 376 extern sh_sand_enum_t Field_key_display_type_enum_table[]; 377 extern sh_sand_enum_t Field_kbp_opcode_type_enum_table[]; 378 /* 379 * Diagnostics procedures common to diag_dnx_field and ctest_dnx_field 380 * { 381 */ 382 /* 383 * Utility procedures, related to FEMs, to be used for, say, display of FEMs (See ctest_dnx_field_action.c) 384 * { 385 */ 386 /** 387 * \brief 388 * Display SWSTATE contents for a specified FEM 389 * \param [in] unit - 390 * Identifier of HW platform. 391 * \param [in] fem_id - 392 * Indicator for which 'FEM id' this operation is intended. 393 * \param [in] test_text - 394 * Name of test to be added to header of table 395 * \param [in] sand_control - 396 * Control information related to each of the 'options' entered by the caller. 397 * \return 398 * \retval Zero - On success 399 * \retval Error - Identifier as per shr_error_e 400 * \remark 401 * * If current severity is higher than 'info' then display nothing. 402 * \see 403 * * appl_dnx_action_starter 404 */ 405 shr_error_e appl_dnx_action_swstate_fem_display( 406 int unit, 407 dnx_field_fem_id_t fem_id, 408 char *test_text, 409 sh_sand_control_t * sand_control); 410 /** 411 * \brief 412 * Display SWSTATE contents for a specified 'FEM and FEM program' pair 413 * \param [in] unit - 414 * Identifier of HW platform. 415 * \param [in] fem_id - 416 * Indicator for which 'FEM id' this operation is intended. 417 * \param [in] fem_program - 418 * Indicator for which 'FEM program' this operation is intended. 419 * \param [in] num_skips_per_row - 420 * Print formatting instruction. Number of columns to skip before getting to the "map index" 421 * column. Since some users add columns before calling this procedure, this 422 * input enables internal control over these added columns. See field_fem_display_by_context_cb(). 423 * \param [in] sand_control - 424 * Control information related to each of the 'options' entered by the caller. 425 * \param [in] prt_ctr - 426 * Control information related PRT tables. Required for procedures which, for example, add 427 * cells to an existing table. 428 * \return 429 * \retval Zero - On success 430 * \retval Error - Identifier as per shr_error_e 431 * \remark 432 * None 433 * \see 434 * * appl_dnx_action_starter 435 */ 436 shr_error_e appl_dnx_action_swstate_fem_prg_display( 437 int unit, 438 dnx_field_fem_id_t fem_id, 439 dnx_field_fem_program_t fem_program, 440 unsigned int num_skips_per_row, 441 sh_sand_control_t * sand_control, 442 prt_control_t * prt_ctr); 443 444 /** 445 * \brief 446 * Check HW contents of all 'conditions' for a specified 'FEM' and 447 * indicate whether there is any condition that is valid and, hence, 448 * points to a valid 'action'. 449 * Indicates, then, whether at least one action is 'valid' for this FEM. 450 * \param [in] unit - 451 * Identifier of HW platform. 452 * \param [in] fem_id - 453 * Indicator for which 'FEM id' this operation is intended. 454 * \param [out] valid_action_found_p - 455 * Pointer to int. This procedure loads pointed memory by a non-zero value if 456 * at least one action is 'valid' for specified 'fem_id'. 457 * \return 458 * \retval Zero - On success 459 * \retval Error - Identifier as per shr_error_e 460 * \remark 461 * * Used to verify that there is at least one action to display for 462 * specified 'fem_id'. If there is none, then info on that 'fem_id' 463 * will, in most cases, not be displayed. 464 * \see 465 * * field_fem_display_actions_cb 466 */ 467 shr_error_e appl_dnx_action_hw_fem_is_any_action_on_condition_valid( 468 int unit, 469 dnx_field_fem_id_t fem_id, 470 int *valid_action_found_p); 471 /** 472 * \brief 473 * Check HW contents of all 'conditions' for a specified 'FEM and FEM program' pair. 474 * Indicate whether at least one condition is 'valid' 475 * \param [in] unit - 476 * Identifier of HW platform. 477 * \param [in] fem_id - 478 * Indicator for which 'FEM id' this operation is intended. 479 * \param [in] fem_program - 480 * Indicator for which 'FEM program' this operation is intended. 481 * \param [out] valid_condition_found_p - 482 * Pointer to int. This procedure loads pointed memory by a non-zero value if 483 * at least one of the 16 conditions is marked 'valid'. 484 * \return 485 * \retval Zero - On success 486 * \retval Error - Identifier as per shr_error_e 487 * \remark 488 * None 489 * \see 490 * * field_fem_display_conditions_cb 491 */ 492 shr_error_e appl_dnx_action_hw_fem_is_any_condition_valid( 493 int unit, 494 dnx_field_fem_id_t fem_id, 495 dnx_field_fem_program_t fem_program, 496 int *valid_condition_found_p); 497 /** 498 * \brief 499 * Display HW contents of all info related to all 'actions' ('fem_map_index') on 500 * a specified 'fem_id'. This info is: 'action type', 'adder', all 'bit descriptors' 501 * and indication of the 'fem_programs' that point to this 'action index'. 502 * \param [in] unit - 503 * Identifier of HW platform. 504 * \param [in] fem_id - 505 * Indicator for which 'FEM id' this operation is intended. 506 * \param [in] num_skips_per_row - 507 * Print formatting instruction. Number of columns to skip before getting to the "action specific info" 508 * columns. Since some users add columns before calling this procedure, this input enables internal 509 * control over these added columns. 510 * \param [in] non_empty_only - 511 * Flag. Boolean. If non-zero then display only actions which are pointed by at least one 'valid' 512 * 'condition'. Otherwise, display HW contents regardless of 'valid' state. 513 * \param [in] sand_control - 514 * Control information related to each of the 'options' entered by the caller. 515 * \param [in] prt_ctr - 516 * Control information related PRT tables. Required for procedures which, for example, add 517 * cells to an existing table. 518 * \param [out] is_any_action_user_defined_p - 519 * Indicates if any of the FEM actions is User Defined. 520 * In case yes will return TRUE, otherwise FALSE. 521 * \return 522 * \retval Zero - On success 523 * \retval Error - Identifier as per shr_error_e 524 * \remark 525 * n the standard case (non_empty_only = TRUE), the caller of this procedure is assumed 526 * to have verified that there is at least one action, on this 'fem_id' which is pointed 527 * by at least one 'condition' on one of the 'fem_programs' that are assigned to this 'fem_id'. 528 * \see 529 * * field_fem_display_conditions_cb 530 */ 531 shr_error_e appl_dnx_action_hw_fem_all_action_display( 532 int unit, 533 dnx_field_fem_id_t fem_id, 534 unsigned int num_skips_per_row, 535 int non_empty_only, 536 sh_sand_control_t * sand_control, 537 prt_control_t * prt_ctr, 538 uint8 *is_any_action_user_defined_p); 539 /** 540 * \brief 541 * Display HW contents of all 'conditions' for a specified 'FEM and FEM program' pair 542 * \param [in] unit - 543 * Identifier of HW platform. 544 * \param [in] fem_id - 545 * Indicator for which 'FEM id' this operation is intended. 546 * \param [in] fem_program - 547 * Indicator for which 'FEM program' this operation is intended. 548 * \param [in] num_skips_per_row - 549 * Print formatting instruction. Number of columns to skip before getting to the "fem_condition_entry" 550 * columns (action_valid, map_data and map_index). Since some users add columns before calling this 551 * procedure, this input enables internal control over these added columns. 552 * \param [in] sand_control - 553 * Control information related to each of the 'options' entered by the caller. 554 * \param [in] prt_ctr - 555 * Control information related PRT tables. Required for procedures which, for example, add 556 * cells to an existing table. 557 * \return 558 * \retval Zero - On success 559 * \retval Error - Identifier as per shr_error_e 560 * \remark 561 * None 562 * \see 563 * * field_fem_display_conditions_cb 564 */ 565 shr_error_e appl_dnx_action_hw_fem_condition_display( 566 int unit, 567 dnx_field_fem_id_t fem_id, 568 dnx_field_fem_program_t fem_program, 569 unsigned int num_skips_per_row, 570 sh_sand_control_t * sand_control, 571 prt_control_t * prt_ctr); 572 573 /** 574 * \brief 575 * Display 'fem context' HW table contents for a specified 'fem context' and 'fem id' range. 576 * \param [in] unit - 577 * Identifier of HW platform. 578 * \param [in] context_id - 579 * Indicator for which 'context id' this operation is intended. 580 * \param [in] non_empty_only - 581 * Flag. Boolean. If non-zero then display only contexts which have at least one 'active' 582 * fem. A fem is considered 'active' if the 'fem key select' field has a legal value. 583 * See 'dbal_enum_value_field_field_pmf_a_fem_key_select_e' and DNX_FIELD_INVALID_FEM_KEY_SELECT 584 * \param [in] fem_id_lower - 585 * Indicator for the lowest 'FEM id' this operation is intended for. 586 * \param [in] fem_id_upper - 587 * Indicator for the highest 'FEM id' this operation is intended for. 588 * \param [in] sand_control - 589 * Control information related to each of the 'options' entered by the caller. 590 * \param [in] prt_ctr - 591 * Control information related PRT tables. Required for procedures which, for example, add 592 * cells to an existing table. 593 * \param [out] context_was_loaded_p - 594 * This procedure loads pointed memory by a non-zero value if at least one fem was found to be 'active' 595 * for specified 'context_id'. 596 * \return 597 * \retval Zero - On success 598 * \retval Error - Identifier as per shr_error_e 599 * \remark 600 * * Note that no info is printed, at all, if both no 'active' FEM is found on specified 'context_id' 601 * and 'non_empty_only' is non-zero. 602 * \see 603 * * field_fem_display_by_context_cb() 604 */ 605 shr_error_e appl_dnx_action_full_fem_context_display( 606 int unit, 607 dnx_field_context_t context_id, 608 int non_empty_only, 609 dnx_field_fem_id_t fem_id_lower, 610 dnx_field_fem_id_t fem_id_upper, 611 sh_sand_control_t * sand_control, 612 prt_control_t * prt_ctr, 613 int *context_was_loaded_p); 614 /* 615 * } 616 */ 617 /* 618 * } 619 */ 620 /* } */ 621 #endif /* DIAG_DNX_FIELD_H_INCLUDED */