mirror.h (66110B)
1 /* 2 * DO NOT EDIT THIS FILE! 3 * This file is auto-generated. 4 * Edits to this file will be lost when it is regenerated. 5 * 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 11 #ifndef BCMINT_LTSW_MBCM_MIRROR_H 12 #define BCMINT_LTSW_MBCM_MIRROR_H 13 14 #include <bcm/mirror.h> 15 #include <bcm/types.h> 16 #include <bcm/switch.h> 17 18 #include <bcm_int/ltsw/mirror_int.h> 19 #include <bcm_int/ltsw/mirror.h> 20 21 #include <sal/sal_types.h> 22 23 /*! 24 * \brief Initialize Mirror control info. 25 * 26 * \param [in] unit Unit Number. 27 * \param [out] mirror_ctrl Mirror control info. 28 * 29 * \retval SHR_E_NONE No errors. 30 * \retval !SHR_E_NONE Failure. 31 */ 32 typedef int (*mirror_ctrl_info_init_f)( 33 int unit, 34 bcmint_mirror_ctrl_info_t *mirror_ctrl); 35 36 /*! 37 * \brief Chip specific mirror init. 38 * 39 * \param [in] unit Unit Number. 40 * 41 * \retval SHR_E_NONE No errors. 42 * \retval !SHR_E_NONE Failure. 43 */ 44 typedef int (*mirror_init_f)(int unit); 45 46 /*! 47 * \brief Chip specific mirror de-init. 48 * 49 * \param [in] unit Unit Number. 50 * 51 * \retval SHR_E_NONE No errors. 52 * \retval !SHR_E_NONE Failure. 53 */ 54 typedef int (*mirror_deinit_f)(int unit); 55 56 /*! 57 * \brief Add Mirror encap entry and return the encap index. 58 * 59 * \param [in] unit Unit Number. 60 * \param [in] egr Egress Mirror encap. 61 * \param [in] mirror_dest Mirror destination pointer. 62 * \param [out] index Mirror encap index. 63 * 64 * \retval SHR_E_NONE No errors. 65 * \retval !SHR_E_NONE Failure. 66 */ 67 typedef int (*mirror_encap_add_f)( 68 int unit, 69 bool egr, 70 bcm_mirror_destination_t *mirror_dest, 71 int *index); 72 73 /*! 74 * \brief Delete Mirror encap entry. 75 * 76 * \param [in] unit Unit Number. 77 * \param [in] mirror_dest Mirror destination pointer. 78 * \param [in] index Mirror encap index. 79 * 80 * \retval SHR_E_NONE No errors. 81 * \retval !SHR_E_NONE Failure. 82 */ 83 typedef int (*mirror_encap_delete_f)( 84 int unit, 85 bcm_mirror_destination_t *mirror_dest, 86 int index); 87 88 /*! 89 * \brief Get Mirror destination for given encap index. 90 * 91 * \param [in] unit Unit Number. 92 * \param [in] index Mirror encap index. 93 * \param [out] mirror_dest Mirror destination pointer. 94 * 95 * \retval SHR_E_NONE No errors. 96 * \retval !SHR_E_NONE Failure. 97 */ 98 typedef int (*mirror_encap_get_f)( 99 int unit, 100 int index, 101 bcm_mirror_destination_t *mirror_dest); 102 103 /*! 104 * \brief Add Mirror session entry. 105 * 106 * \param [in] unit Unit Number. 107 * \param [in] session_id Mirror session id. 108 * \param [in] session Mirror session entry. 109 * 110 * \retval SHR_E_NONE No errors. 111 * \retval !SHR_E_NONE Failure. 112 */ 113 typedef int (*mirror_session_add_f)( 114 int unit, 115 int session_id, 116 bcmint_mirror_session_entry_t *session); 117 118 /*! 119 * \brief Delete Mirror session entry with given session id. 120 * 121 * \param [in] unit Unit Number. 122 * \param [in] session_id Mirror session id. 123 * \param [in] egr For egress or ingress Mirroring. 124 * \param [in] cosq_mod For cosq_mod Mirroring. 125 * 126 * \retval SHR_E_NONE No errors. 127 * \retval !SHR_E_NONE Failure. 128 */ 129 typedef int (*mirror_session_delete_f)( 130 int unit, 131 int session_id, 132 bool egr, 133 bool cosq_mod); 134 135 /*! 136 * \brief Get Mirror session entry for given id. 137 * 138 * \param [in] unit Unit Number. 139 * \param [in] session_id Mirror session id. 140 * \param [out] session Mirror session entry. 141 * 142 * \retval SHR_E_NONE No errors. 143 * \retval !SHR_E_NONE Failure. 144 */ 145 typedef int (*mirror_session_get_f)( 146 int unit, 147 int session_id, 148 bcmint_mirror_session_entry_t *session); 149 150 /*! 151 * \brief Get statistics for a Mirror session. 152 * 153 * \param [in] unit Unit Number. 154 * \param [in] session_id Mirror session id. 155 * \param [in] sync Sync mode. 156 * \param [out] value Statistics. 157 * 158 * \retval SHR_E_NONE No errors. 159 * \retval !SHR_E_NONE Failure. 160 */ 161 typedef int (*mirror_session_stat_get_f)( 162 int unit, 163 int session_id, 164 bool sync, 165 uint64_t *value); 166 167 /*! 168 * \brief Set statistics for a Mirror session. 169 * 170 * \param [in] unit Unit Number. 171 * \param [in] session_id Mirror session id. 172 * \param [in] value Statistics. 173 * 174 * \retval SHR_E_NONE No errors. 175 * \retval !SHR_E_NONE Failure. 176 */ 177 typedef int (*mirror_session_stat_set_f)( 178 int unit, 179 int session_id, 180 uint64_t value); 181 182 /*! 183 * \brief Get Mirror enable status on a Mirror source. 184 * 185 * \param [in] unit Unit Number. 186 * \param [in] source Mirror source. 187 * \param [out] enable Enable status. 188 * \param [out] instance_id Mirror instance id. 189 * 190 * \retval SHR_E_NONE No errors. 191 * \retval !SHR_E_NONE Failure. 192 */ 193 typedef int (*mirror_enable_get_f)( 194 int unit, 195 bcmint_mirror_source_t *source, 196 int *enable, 197 int *instance_id); 198 199 /*! 200 * \brief Set Mirror enable status on a Mirror source. 201 * 202 * \param [in] unit Unit Number. 203 * \param [in] source Mirror source. 204 * \param [in] mc_bmp Bitmap of Mirror containers cared. 205 * \param [in] enable Enable status for Mirror container. 206 * \param [in] instance_id Mirror instance id. 207 * 208 * \retval SHR_E_NONE No errors. 209 * \retval !SHR_E_NONE Failure. 210 */ 211 typedef int (*mirror_enable_set_f)( 212 int unit, 213 bcmint_mirror_source_t *source, 214 int mc_bmp, 215 int enable, 216 int *instance_id); 217 218 /*! 219 * \brief Mirror misc init. 220 * 221 * \param [in] unit Unit Number. 222 * 223 * \retval SHR_E_NONE No errors. 224 * \retval !SHR_E_NONE Failure. 225 */ 226 typedef int (*mirror_misc_init_f)(int unit); 227 228 /*! 229 * \brief Mirror misc deinit. 230 * 231 * \param [in] unit Unit Number. 232 * 233 * \retval SHR_E_NONE No errors. 234 * \retval !SHR_E_NONE Failure. 235 */ 236 typedef int (*mirror_misc_deinit_f)(int unit); 237 238 /*! 239 * \brief Init sample profile. 240 * 241 * \param [in] unit Unit Number. 242 * 243 * \retval SHR_E_NONE No errors. 244 * \retval !SHR_E_NONE Failure. 245 */ 246 typedef int (*mirror_sample_profile_init_f)(int unit); 247 248 /*! 249 * \brief Deinit sample profile. 250 * 251 * \param [in] unit Unit Number. 252 * 253 * \retval SHR_E_NONE No errors. 254 * \retval !SHR_E_NONE Failure. 255 */ 256 typedef int (*mirror_sample_profile_deinit_f)(int unit); 257 258 /*! 259 * \brief Get max rate range of egress sampler. 260 * 261 * \param [in] unit Unit Number. 262 * \param [out] range_max Max rate range. 263 * 264 * \retval SHR_E_NONE No errors. 265 * \retval !SHR_E_NONE Failure. 266 */ 267 typedef int (*mirror_egress_sampler_rate_range_max_f)( 268 int unit, 269 int *range_max); 270 271 /*! 272 * \brief Set sampler random seed value. 273 * 274 * \param [in] unit Unit Number. 275 * \param [in] type Sampler seed type. 276 * \param [in] value Sampler seed value. 277 * 278 * \retval SHR_E_NONE No errors. 279 * \retval !SHR_E_NONE Failure. 280 */ 281 typedef int (*mirror_sampler_seed_set_f)( 282 int unit, 283 bcmi_ltsw_mirror_sampler_seed_type_t type, 284 int value); 285 286 /*! 287 * \brief Get sampler random seed value. 288 * 289 * \param [in] unit Unit Number. 290 * \param [in] type Sampler seed type. 291 * \param [out] value Sampler seed value. 292 * 293 * \retval SHR_E_NONE No errors. 294 * \retval !SHR_E_NONE Failure. 295 */ 296 typedef int (*mirror_sampler_seed_get_f)( 297 int unit, 298 bcmi_ltsw_mirror_sampler_seed_type_t type, 299 int *value); 300 301 /*! 302 * \brief Set sFlow version number. 303 * 304 * \param [in] unit Unit Number. 305 * \param [in] value sFlow version number. 306 * 307 * \retval SHR_E_NONE No errors. 308 * \retval !SHR_E_NONE Failure. 309 */ 310 typedef int (*mirror_sample_version_set_f)( 311 int unit, 312 int value); 313 314 /*! 315 * \brief Get sFlow version number. 316 * 317 * \param [in] unit Unit Number. 318 * \param [out] value sFlow version number. 319 * 320 * \retval SHR_E_NONE No errors. 321 * \retval !SHR_E_NONE Failure. 322 */ 323 typedef int (*mirror_sample_version_get_f)( 324 int unit, 325 int *value); 326 327 /*! 328 * \brief Set PSAMP IPFIX version number. 329 * 330 * \param [in] unit Unit Number. 331 * \param [in] value PSAMP IPFIX version number. 332 * 333 * \retval SHR_E_NONE No errors. 334 * \retval !SHR_E_NONE Failure. 335 */ 336 typedef int (*mirror_psamp_ipfix_version_set_f)( 337 int unit, 338 int value); 339 340 /*! 341 * \brief Get PSAMP IPFIX version number. 342 * 343 * \param [in] unit Unit Number. 344 * \param [out] value PSAMP IPFIX version number. 345 * 346 * \retval SHR_E_NONE No errors. 347 * \retval !SHR_E_NONE Failure. 348 */ 349 typedef int (*mirror_psamp_ipfix_version_get_f)( 350 int unit, 351 int *value); 352 353 /*! 354 * \brief Set PSAMP epoch number. 355 * 356 * \param [in] unit Unit Number. 357 * \param [in] value PSAMP epoch number. 358 * 359 * \retval SHR_E_NONE No errors. 360 * \retval !SHR_E_NONE Failure. 361 */ 362 typedef int (*mirror_psamp_epoch_set_f)( 363 int unit, 364 int value); 365 366 /*! 367 * \brief Get PSAMP epoch number. 368 * 369 * \param [in] unit Unit Number. 370 * \param [out] value PSAMP epoch number. 371 * 372 * \retval SHR_E_NONE No errors. 373 * \retval !SHR_E_NONE Failure. 374 */ 375 typedef int (*mirror_psamp_epoch_get_f)( 376 int unit, 377 int *value); 378 379 /*! 380 * \brief Set uc_cos for mirror copies. 381 * 382 * \param [in] unit Unit Number. 383 * \param [in] uc_cos UC cos value. 384 * 385 * \retval SHR_E_NONE No errors. 386 * \retval !SHR_E_NONE Failure. 387 */ 388 typedef int (*mirror_uc_cos_set_f)( 389 int unit, 390 int uc_cos); 391 392 /*! 393 * \brief Get uc_cos for mirror copies. 394 * 395 * \param [in] unit Unit Number. 396 * \param [out] uc_cos UC cos value. 397 * 398 * \retval SHR_E_NONE No errors. 399 * \retval !SHR_E_NONE Failure. 400 */ 401 typedef int (*mirror_uc_cos_get_f)( 402 int unit, 403 int *uc_cos); 404 405 /*! 406 * \brief Set mc_cos for mirror copies. 407 * 408 * \param [in] unit Unit Number. 409 * \param [in] mc_cos MC cos value. 410 * 411 * \retval SHR_E_NONE No errors. 412 * \retval !SHR_E_NONE Failure. 413 */ 414 typedef int (*mirror_mc_cos_set_f)( 415 int unit, 416 int mc_cos); 417 418 /*! 419 * \brief Get mc_cos for mirror copies. 420 * 421 * \param [in] unit Unit Number. 422 * \param [out] mc_cos MC cos value. 423 * 424 * \retval SHR_E_NONE No errors. 425 * \retval !SHR_E_NONE Failure. 426 */ 427 typedef int (*mirror_mc_cos_get_f)( 428 int unit, 429 int *mc_cos); 430 431 /*! 432 * \brief Set cpu_cos for mirror-to-cpu copies. This cos will override cpu_cos from CCBI bus. 433 * 434 * \param [in] unit Unit Number. 435 * \param [in] cpu_cos Cpu_cos value. 436 * 437 * \retval SHR_E_NONE No errors. 438 * \retval !SHR_E_NONE Failure. 439 */ 440 typedef int (*mirror_cpu_cos_set_f)( 441 int unit, 442 int cpu_cos); 443 444 /*! 445 * \brief Get cpu_cos for mirror-to-cpu copies. 446 * 447 * \param [in] unit Unit Number. 448 * \param [out] cpu_cos Cpu_cos value. 449 * 450 * \retval SHR_E_NONE No errors. 451 * \retval !SHR_E_NONE Failure. 452 */ 453 typedef int (*mirror_cpu_cos_get_f)( 454 int unit, 455 int *cpu_cos); 456 457 /*! 458 * \brief Set enable status for mirror traffic to drop pkts with invalid VLAN. 459 * 460 * \param [in] unit Unit Number. 461 * \param [in] enable Enable status. 462 * 463 * \retval SHR_E_NONE No errors. 464 * \retval !SHR_E_NONE Failure. 465 */ 466 typedef int (*mirror_invalid_vlan_drop_set_f)( 467 int unit, 468 int enable); 469 470 /*! 471 * \brief Get enable status of mirror traffic dropping pkts with invalid VLAN. 472 * 473 * \param [in] unit Unit Number. 474 * \param [out] enable Enable status. 475 * 476 * \retval SHR_E_NONE No errors. 477 * \retval !SHR_E_NONE Failure. 478 */ 479 typedef int (*mirror_invalid_vlan_drop_get_f)( 480 int unit, 481 int *enable); 482 483 /*! 484 * \brief Set enable status for skipping packet checks for mirror packets. 485 * 486 * \param [in] unit Unit Number. 487 * \param [in] enable Enable status. 488 * 489 * \retval SHR_E_NONE No errors. 490 * \retval !SHR_E_NONE Failure. 491 */ 492 typedef int (*mirror_pkt_checks_set_f)( 493 int unit, 494 int enable); 495 496 /*! 497 * \brief Get enable status of skipping packet checks for mirror packets. 498 * 499 * \param [in] unit Unit Number. 500 * \param [out] enable Enable status. 501 * 502 * \retval SHR_E_NONE No errors. 503 * \retval !SHR_E_NONE Failure. 504 */ 505 typedef int (*mirror_pkt_checks_get_f)( 506 int unit, 507 int *enable); 508 509 /*! 510 * \brief Validate mirror destination structure parameters. 511 * 512 * \param [in] unit Unit Number. 513 * \param [in] mirror_dest Mirror destination pointer. 514 * 515 * \retval SHR_E_NONE No errors. 516 * \retval !SHR_E_NONE Failure. 517 */ 518 typedef int (*mirror_destination_validate_f)( 519 int unit, 520 bcm_mirror_destination_t *mirror_dest); 521 522 /*! 523 * \brief Set sample profile entry. 524 * 525 * \param [in] unit Unit Number. 526 * \param [in] type Sample type. 527 * \param [in] profile_id Sample profile id. 528 * \param [in] profile Sample profile entry. 529 * 530 * \retval SHR_E_NONE No errors. 531 * \retval !SHR_E_NONE Failure. 532 */ 533 typedef int (*mirror_sample_profile_set_f)( 534 int unit, 535 bcmint_mirror_sample_type_t type, 536 int profile_id, 537 bcm_mirror_sample_profile_t *profile); 538 539 /*! 540 * \brief Get sample profile entry. 541 * 542 * \param [in] unit Unit Number. 543 * \param [in] type Sample type. 544 * \param [in] profile_id Sample profile id. 545 * \param [out] profile Sample profile entry. 546 * 547 * \retval SHR_E_NONE No errors. 548 * \retval !SHR_E_NONE Failure. 549 */ 550 typedef int (*mirror_sample_profile_get_f)( 551 int unit, 552 bcmint_mirror_sample_type_t type, 553 int profile_id, 554 bcm_mirror_sample_profile_t *profile); 555 556 /*! 557 * \brief Attach counter entries to a sample type. 558 * 559 * \param [in] unit Unit Number. 560 * \param [in] type Sample type. 561 * \param [in] stat_counter_id Counter id. 562 * 563 * \retval SHR_E_NONE No errors. 564 * \retval !SHR_E_NONE Failure. 565 */ 566 typedef int (*mirror_sample_stat_attach_f)( 567 int unit, 568 bcmint_mirror_sample_type_t type, 569 uint32_t stat_counter_id); 570 571 /*! 572 * \brief Detach counter entries from a sample type. 573 * 574 * \param [in] unit Unit Number. 575 * \param [in] type Sample type. 576 * \param [in] stat_counter_id Counter id. 577 * 578 * \retval SHR_E_NONE No errors. 579 * \retval !SHR_E_NONE Failure. 580 */ 581 typedef int (*mirror_sample_stat_detach_f)( 582 int unit, 583 bcmint_mirror_sample_type_t type, 584 uint32_t stat_counter_id); 585 586 /*! 587 * \brief Set global mirror truncate. 588 * 589 * \param [in] unit Unit Number. 590 * \param [in] global_truncate Mirror global truncate pointer. 591 * 592 * \retval SHR_E_NONE No errors. 593 * \retval !SHR_E_NONE Failure. 594 */ 595 typedef int (*mirror_global_truncate_set_f)( 596 int unit, 597 bcm_mirror_global_truncate_t *global_truncate); 598 599 /*! 600 * \brief Get global mirror truncate. 601 * 602 * \param [in] unit Unit Number. 603 * \param [out] global_truncate Mirror global truncate pointer. 604 * 605 * \retval SHR_E_NONE No errors. 606 * \retval !SHR_E_NONE Failure. 607 */ 608 typedef int (*mirror_global_truncate_get_f)( 609 int unit, 610 bcm_mirror_global_truncate_t *global_truncate); 611 612 /*! 613 * \brief Create a truncate length profile. 614 * 615 * \param [in] unit Unit Number. 616 * \param [in] options Options flags. 617 * \param [inout] profile_id Profile id. 618 * \param [in] profile Profile entry. 619 * 620 * \retval SHR_E_NONE No errors. 621 * \retval !SHR_E_NONE Failure. 622 */ 623 typedef int (*mirror_truncate_length_profile_create_f)( 624 int unit, 625 uint32_t options, 626 int *profile_id, 627 bcm_mirror_truncate_length_profile_t *profile); 628 629 /*! 630 * \brief Destroy a truncate length profile. 631 * 632 * \param [in] unit Unit Number. 633 * \param [in] profile_id Profile id. 634 * 635 * \retval SHR_E_NONE No errors. 636 * \retval !SHR_E_NONE Failure. 637 */ 638 typedef int (*mirror_truncate_length_profile_destroy_f)( 639 int unit, 640 int profile_id); 641 642 /*! 643 * \brief Get a truncate length profile with given profile id. 644 * 645 * \param [in] unit Unit Number. 646 * \param [in] profile_id Profile id. 647 * \param [out] profile Profile entry. 648 * 649 * \retval SHR_E_NONE No errors. 650 * \retval !SHR_E_NONE Failure. 651 */ 652 typedef int (*mirror_truncate_length_profile_get_f)( 653 int unit, 654 int profile_id, 655 bcm_mirror_truncate_length_profile_t *profile); 656 657 /*! 658 * \brief Get VLAN for egress mirrored packets on a port (RSPAN). 659 * 660 * \param [in] unit Unit Number. 661 * \param [in] port Mirror-to port for which to get tag info. 662 * \param [out] tpid Tag protocol id. 663 * \param [out] vlan Virtual LAN number. 664 * 665 * \retval SHR_E_NONE No errors. 666 * \retval !SHR_E_NONE Failure. 667 */ 668 typedef int (*mirror_vlan_get_f)( 669 int unit, 670 bcm_port_t port, 671 uint16_t *tpid, 672 uint16_t *vlan); 673 674 /*! 675 * \brief Set VLAN for egress mirrored packets on a port (RSPAN). 676 * 677 * \param [in] unit Unit Number. 678 * \param [in] port Mirror-to port for which to get tag info. 679 * \param [in] tpid Tag protocol id. 680 * \param [in] vlan Virtual LAN number. 681 * 682 * \retval SHR_E_NONE No errors. 683 * \retval !SHR_E_NONE Failure. 684 */ 685 typedef int (*mirror_vlan_set_f)( 686 int unit, 687 bcm_port_t port, 688 uint16_t tpid, 689 uint16_t vlan); 690 691 /*! 692 * \brief Retrive a list of payload offset and protocol values from HW. 693 * 694 * \param [in] unit Unit Number. 695 * \param [in/out] pyld_zero_cfg Array with the desired 'field_id' initialized with a valid bcm_mirror_payload_zero_field_t enum value in each array member. 696 * \param [in] num_elems Number of elements in pyld_zero_cfg array. Must be between 1 to bcmMirrorPayloadZeroCount. 697 * 698 * \retval SHR_E_NONE No errors. 699 * \retval !SHR_E_NONE Failure. 700 */ 701 typedef int (*mirror_payload_zero_control_multi_get_f)( 702 int unit, 703 bcm_mirror_payload_zero_info_t *pyld_zero_cfg, 704 int num_elems); 705 706 /*! 707 * \brief This function programs payload offset and protocol values required for payload wiping feature. They are used when this feature is enabled on a MTP. 708 * 709 * \param [in] unit Unit Number. 710 * \param [in] pyld_zero_cfg Array containing protocol number or port number and/or offset value for the fields represented by bcm_mirror_payload_zero_field_t. 711 * \param [in] num_elems Number of elements in pyld_zero_cfg array. Must be between 1 to bcmMirrorPayloadZeroCount. 712 * 713 * \retval SHR_E_NONE No errors. 714 * \retval !SHR_E_NONE Failure. 715 */ 716 typedef int (*mirror_payload_zero_control_multi_set_f)( 717 int unit, 718 bcm_mirror_payload_zero_info_t *pyld_zero_cfg, 719 int num_elems); 720 721 /*! 722 * \brief This function creates the zero payload offset profile used for the mirror payload wiping feature by FP. 723 * 724 * \param [in] unit Unit Number. 725 * \param [in] mirror_payload_offset_info Structure with the egress zero payload offsets. 726 * \param [in] flags Define module using the profile entry. 727 * \param [in] profile_index Profile index created. 728 * 729 * \retval SHR_E_NONE No errors. 730 * \retval !SHR_E_NONE Failure. 731 */ 732 typedef int (*mirror_payload_zero_profile_create_f)( 733 int unit, 734 bcm_mirror_payload_zero_offsets_t *mirror_payload_offset_info, 735 uint32 flags, 736 uint32 * profile_index); 737 738 /*! 739 * \brief This function deletes the zero payload offset profile created for the mirror payload wiping feature by FP. 740 * 741 * \param [in] unit Unit Number. 742 * \param [in] flags Define module using the profile entry. 743 * \param [in] profile_index Profile index to be deleted. 744 * 745 * \retval SHR_E_NONE No errors. 746 * \retval !SHR_E_NONE Failure. 747 */ 748 typedef int (*mirror_payload_zero_profile_destroy_f)( 749 int unit, 750 uint32 flags, 751 uint32 profile_index); 752 753 /*! 754 * \brief Create an ingress mirror-on-drop event group. 755 * 756 * \param [in] unit Unit Number. 757 * \param [in] event_array Ingress mirror-on-drop events of the group. 758 * \param [in] num_events Number of events given. 759 * \param [out] group Event group. 760 * 761 * \retval SHR_E_NONE No errors. 762 * \retval !SHR_E_NONE Failure. 763 */ 764 typedef int (*mirror_ingress_mod_event_group_create_f)( 765 int unit, 766 bcm_mirror_ingress_mod_event_t *event_array, 767 int num_events, 768 bcm_mirror_ingress_mod_event_group_t *group); 769 770 /*! 771 * \brief Destroy an ingress mirror-on-drop event group. 772 * 773 * \param [in] unit Unit Number. 774 * \param [in] group Event group. 775 * 776 * \retval SHR_E_NONE No errors. 777 * \retval !SHR_E_NONE Failure. 778 */ 779 typedef int (*mirror_ingress_mod_event_group_destroy_f)( 780 int unit, 781 bcm_mirror_ingress_mod_event_group_t group); 782 783 /*! 784 * \brief Get all ingress mirror-on-drop event groups. 785 * 786 * \param [in] unit Unit Number. 787 * \param [out] group_array Event group array. 788 * \param [in/out] count Count of the event groups. 789 * 790 * \retval SHR_E_NONE No errors. 791 * \retval !SHR_E_NONE Failure. 792 */ 793 typedef int (*mirror_ingress_mod_event_group_get_all_f)( 794 int unit, 795 bcm_mirror_ingress_mod_event_group_t *group_array, 796 int *count); 797 798 /*! 799 * \brief Get events of an ingress mirror-on-drop event group. 800 * 801 * \param [in] unit Unit Number. 802 * \param [in] group Event group. 803 * \param [out] event_array Ingress mirror-on-drop events of the group. 804 * \param [in/out] count Count of the events in the group. 805 * 806 * \retval SHR_E_NONE No errors. 807 * \retval !SHR_E_NONE Failure. 808 */ 809 typedef int (*mirror_ingress_mod_event_group_event_get_f)( 810 int unit, 811 bcm_mirror_ingress_mod_event_group_t group, 812 bcm_mirror_ingress_mod_event_t *event_array, 813 int *count); 814 815 /*! 816 * \brief Create an ingress mirror-on-drop event profile. 817 * 818 * \param [in] unit Unit Number. 819 * \param [in] profile Ingress mirror-on-drop event profile data. 820 * \param [out] profile_id Profile id returned on success. 821 * 822 * \retval SHR_E_NONE No errors. 823 * \retval !SHR_E_NONE Failure. 824 */ 825 typedef int (*mirror_ingress_mod_event_profile_create_f)( 826 int unit, 827 bcm_mirror_ingress_mod_event_profile_t *profile, 828 int *profile_id); 829 830 /*! 831 * \brief Destroy an ingress mirror-on-drop event profile. 832 * 833 * \param [in] unit Unit Number. 834 * \param [in] profile_id Ingress mirror-on-drop event profile id. 835 * 836 * \retval SHR_E_NONE No errors. 837 * \retval !SHR_E_NONE Failure. 838 */ 839 typedef int (*mirror_ingress_mod_event_profile_destroy_f)( 840 int unit, 841 int profile_id); 842 843 /*! 844 * \brief Get all ingress mirror-on-drop event profile ids. 845 * 846 * \param [in] unit Unit Number. 847 * \param [out] profile_id_array Event profile id array. 848 * \param [in/out] count Count of the event profiles. 849 * 850 * \retval SHR_E_NONE No errors. 851 * \retval !SHR_E_NONE Failure. 852 */ 853 typedef int (*mirror_ingress_mod_event_profile_get_all_f)( 854 int unit, 855 int *profile_id_array, 856 int *count); 857 858 /*! 859 * \brief Get an ingress mirror-on-drop event profile config. 860 * 861 * \param [in] unit Unit Number. 862 * \param [in] profile_id Event profile id. 863 * \param [out] profile Event profile. 864 * 865 * \retval SHR_E_NONE No errors. 866 * \retval !SHR_E_NONE Failure. 867 */ 868 typedef int (*mirror_ingress_mod_event_profile_cfg_get_f)( 869 int unit, 870 int profile_id, 871 bcm_mirror_ingress_mod_event_profile_t *profile); 872 873 /*! 874 * \brief Add an ingress mirror-on-drop event group to an event profile. 875 * 876 * \param [in] unit Unit Number. 877 * \param [in] profile_id Event profile id. 878 * \param [in] group Event group. 879 * \param [in] hit Event group hit expectation. 880 * 881 * \retval SHR_E_NONE No errors. 882 * \retval !SHR_E_NONE Failure. 883 */ 884 typedef int (*mirror_ingress_mod_event_profile_group_add_f)( 885 int unit, 886 int profile_id, 887 bcm_mirror_ingress_mod_event_group_t group, 888 int hit); 889 890 /*! 891 * \brief Delete an ingress mirror-on-drop event group to an event profile. 892 * 893 * \param [in] unit Unit Number. 894 * \param [in] profile_id Event profile id. 895 * \param [in] group Event group. 896 * 897 * \retval SHR_E_NONE No errors. 898 * \retval !SHR_E_NONE Failure. 899 */ 900 typedef int (*mirror_ingress_mod_event_profile_group_delete_f)( 901 int unit, 902 int profile_id, 903 bcm_mirror_ingress_mod_event_group_t group); 904 905 /*! 906 * \brief Get all event groups of an ingress mirror-on-drop event profile. 907 * 908 * \param [in] unit Unit Number. 909 * \param [in] profile_id Event profile id. 910 * \param [out] group_array Event group array. 911 * \param [in/out] count Count of the groups in the profile. 912 * 913 * \retval SHR_E_NONE No errors. 914 * \retval !SHR_E_NONE Failure. 915 */ 916 typedef int (*mirror_ingress_mod_event_profile_group_get_all_f)( 917 int unit, 918 int profile_id, 919 bcm_mirror_ingress_mod_event_group_t *group_array, 920 int *count); 921 922 /*! 923 * \brief Get hit expectation of an ingress mirror-on-drop event group from an event profile. 924 * 925 * \param [in] unit Unit Number. 926 * \param [in] profile_id Event profile id. 927 * \param [in] group Event group array. 928 * \param [out] hit Event group hit expectation. 929 * 930 * \retval SHR_E_NONE No errors. 931 * \retval !SHR_E_NONE Failure. 932 */ 933 typedef int (*mirror_ingress_mod_event_profile_group_get_f)( 934 int unit, 935 int profile_id, 936 bcm_mirror_ingress_mod_event_group_t group, 937 int *hit); 938 939 /*! 940 * \brief Create a group of multiple destination IPv4 addresses. 941 * 942 * \param [in] unit Unit Number. 943 * \param [in] num_entries Number of entries of the group. 944 * \param [in] ipv4_addr_array The addresses to be set for the group. 945 * \param [out] group Multiple destination IP group. 946 * 947 * \retval SHR_E_NONE No errors. 948 * \retval !SHR_E_NONE Failure. 949 */ 950 typedef int (*mirror_multi_dip_group_ipv4_create_f)( 951 int unit, 952 bcm_mirror_multi_dip_entry_num_t num_entries, 953 bcm_ip_t *ipv4_addr_array, 954 bcm_mirror_multi_dip_group_t *group); 955 956 /*! 957 * \brief Remove a group of multiple destination IPv4 addresses. 958 * 959 * \param [in] unit Unit Number. 960 * \param [in] group Multiple destination IP group. 961 * 962 * \retval SHR_E_NONE No errors. 963 * \retval !SHR_E_NONE Failure. 964 */ 965 typedef int (*mirror_multi_dip_group_ipv4_destroy_f)( 966 int unit, 967 bcm_mirror_multi_dip_group_t group); 968 969 /*! 970 * \brief Get all groups of multiple destination IPv4 addresses. 971 * 972 * \param [in] unit Unit Number. 973 * \param [out] ipv4_group_array Number of entries of the group. 974 * \param [in/out] count Count of the ipv4_groups. 975 * 976 * \retval SHR_E_NONE No errors. 977 * \retval !SHR_E_NONE Failure. 978 */ 979 typedef int (*mirror_multi_dip_group_ipv4_get_all_f)( 980 int unit, 981 bcm_mirror_multi_dip_group_t *ipv4_group_array, 982 int *count); 983 984 /*! 985 * \brief Get a group of multiple destination IPv4 addresses. 986 * 987 * \param [in] unit Unit Number. 988 * \param [in] group Multiple destination ip group. 989 * \param [out] ipv4_addr_array The addresses of the group. 990 * \param [in/out] count Count of addresses in the group. 991 * 992 * \retval SHR_E_NONE No errors. 993 * \retval !SHR_E_NONE Failure. 994 */ 995 typedef int (*mirror_multi_dip_group_ipv4_get_f)( 996 int unit, 997 bcm_mirror_multi_dip_group_t group, 998 bcm_ip_t *ipv4_addr_array, 999 int *count); 1000 1001 /*! 1002 * \brief Create a group of multiple destination IPv6 addresses. 1003 * 1004 * \param [in] unit Unit Number. 1005 * \param [in] num_entries Number of entries of the group. 1006 * \param [in] ipv6_addr_array The addresses to be set for the group. 1007 * \param [out] group Multiple destination IP group. 1008 * 1009 * \retval SHR_E_NONE No errors. 1010 * \retval !SHR_E_NONE Failure. 1011 */ 1012 typedef int (*mirror_multi_dip_group_ipv6_create_f)( 1013 int unit, 1014 bcm_mirror_multi_dip_entry_num_t num_entries, 1015 bcm_ip6_t *ipv6_addr_array, 1016 bcm_mirror_multi_dip_group_t *group); 1017 1018 /*! 1019 * \brief Remove a group of multiple destination IPv6 addresses. 1020 * 1021 * \param [in] unit Unit Number. 1022 * \param [in] group Multiple destination IP group. 1023 * 1024 * \retval SHR_E_NONE No errors. 1025 * \retval !SHR_E_NONE Failure. 1026 */ 1027 typedef int (*mirror_multi_dip_group_ipv6_destroy_f)( 1028 int unit, 1029 bcm_mirror_multi_dip_group_t group); 1030 1031 /*! 1032 * \brief Get all groups of multiple destination IPv6 addresses. 1033 * 1034 * \param [in] unit Unit Number. 1035 * \param [out] ipv6_group_array Number of entries of the group. 1036 * \param [in/out] count Count of the ipv6_groups. 1037 * 1038 * \retval SHR_E_NONE No errors. 1039 * \retval !SHR_E_NONE Failure. 1040 */ 1041 typedef int (*mirror_multi_dip_group_ipv6_get_all_f)( 1042 int unit, 1043 bcm_mirror_multi_dip_group_t *ipv6_group_array, 1044 int *count); 1045 1046 /*! 1047 * \brief Get a group of multiple destination IPv6 addresses. 1048 * 1049 * \param [in] unit Unit Number. 1050 * \param [in] group Multiple destination ip group. 1051 * \param [out] ipv6_addr_array The addresses of the group. 1052 * \param [in/out] count Count of addresses in the group. 1053 * 1054 * \retval SHR_E_NONE No errors. 1055 * \retval !SHR_E_NONE Failure. 1056 */ 1057 typedef int (*mirror_multi_dip_group_ipv6_get_f)( 1058 int unit, 1059 bcm_mirror_multi_dip_group_t group, 1060 bcm_ip6_t *ipv6_addr_array, 1061 int *count); 1062 1063 /*! 1064 * \brief Dump multiple destination IP allocators. 1065 * 1066 * \param [in] unit Unit Number. 1067 * 1068 * \retval SHR_E_NONE No errors. 1069 * \retval !SHR_E_NONE Failure. 1070 */ 1071 typedef int (*mirror_multi_dip_dump_f)(int unit); 1072 1073 /*! 1074 * \brief Mirror database initialization. 1075 * 1076 * \param [in] unit Unit Number. 1077 * 1078 * \retval SHR_E_NONE No errors. 1079 * \retval !SHR_E_NONE Failure. 1080 */ 1081 typedef int (*mirror_db_init_f)(int unit); 1082 1083 /*! 1084 * \brief Specify general mirror switch behaviors. 1085 * 1086 * \param [in] unit Unit Number. 1087 * \param [in] type The desired switch control type. 1088 * \param [in] arg Value to set. 1089 * 1090 * \retval SHR_E_NONE No errors. 1091 * \retval !SHR_E_NONE Failure. 1092 */ 1093 typedef int (*mirror_switch_control_set_f)( 1094 int unit, 1095 bcm_switch_control_t type, 1096 int arg); 1097 1098 /*! 1099 * \brief Retrieve general mirror switch behaviors. 1100 * 1101 * \param [in] unit Unit Number. 1102 * \param [in] type The desired switch control type. 1103 * \param [out] arg Value to get. 1104 * 1105 * \retval SHR_E_NONE No errors. 1106 * \retval !SHR_E_NONE Failure. 1107 */ 1108 typedef int (*mirror_switch_control_get_f)( 1109 int unit, 1110 bcm_switch_control_t type, 1111 int *arg); 1112 1113 /*! 1114 * \brief Mirror driver structure. 1115 */ 1116 typedef struct mbcm_ltsw_mirror_drv_s { 1117 1118 /*! Initialize Mirror control info. */ 1119 mirror_ctrl_info_init_f mirror_ctrl_info_init; 1120 1121 /*! Chip specific mirror init. */ 1122 mirror_init_f mirror_init; 1123 1124 /*! Chip specific mirror de-init. */ 1125 mirror_deinit_f mirror_deinit; 1126 1127 /*! Add Mirror encap entry and return the encap index. */ 1128 mirror_encap_add_f mirror_encap_add; 1129 1130 /*! Delete Mirror encap entry. */ 1131 mirror_encap_delete_f mirror_encap_delete; 1132 1133 /*! Get Mirror destination for given encap index. */ 1134 mirror_encap_get_f mirror_encap_get; 1135 1136 /*! Add Mirror session entry. */ 1137 mirror_session_add_f mirror_session_add; 1138 1139 /*! Delete Mirror session entry with given session id. */ 1140 mirror_session_delete_f mirror_session_delete; 1141 1142 /*! Get Mirror session entry for given id. */ 1143 mirror_session_get_f mirror_session_get; 1144 1145 /*! Get statistics for a Mirror session. */ 1146 mirror_session_stat_get_f mirror_session_stat_get; 1147 1148 /*! Set statistics for a Mirror session. */ 1149 mirror_session_stat_set_f mirror_session_stat_set; 1150 1151 /*! Get Mirror enable status on a Mirror source. */ 1152 mirror_enable_get_f mirror_enable_get; 1153 1154 /*! Set Mirror enable status on a Mirror source. */ 1155 mirror_enable_set_f mirror_enable_set; 1156 1157 /*! Mirror misc init. */ 1158 mirror_misc_init_f mirror_misc_init; 1159 1160 /*! Mirror misc deinit. */ 1161 mirror_misc_deinit_f mirror_misc_deinit; 1162 1163 /*! Init sample profile. */ 1164 mirror_sample_profile_init_f mirror_sample_profile_init; 1165 1166 /*! Deinit sample profile. */ 1167 mirror_sample_profile_deinit_f mirror_sample_profile_deinit; 1168 1169 /*! Get max rate range of egress sampler. */ 1170 mirror_egress_sampler_rate_range_max_f mirror_egress_sampler_rate_range_max; 1171 1172 /*! Set sampler random seed value. */ 1173 mirror_sampler_seed_set_f mirror_sampler_seed_set; 1174 1175 /*! Get sampler random seed value. */ 1176 mirror_sampler_seed_get_f mirror_sampler_seed_get; 1177 1178 /*! Set sFlow version number. */ 1179 mirror_sample_version_set_f mirror_sample_version_set; 1180 1181 /*! Get sFlow version number. */ 1182 mirror_sample_version_get_f mirror_sample_version_get; 1183 1184 /*! Set PSAMP IPFIX version number. */ 1185 mirror_psamp_ipfix_version_set_f mirror_psamp_ipfix_version_set; 1186 1187 /*! Get PSAMP IPFIX version number. */ 1188 mirror_psamp_ipfix_version_get_f mirror_psamp_ipfix_version_get; 1189 1190 /*! Set PSAMP epoch number. */ 1191 mirror_psamp_epoch_set_f mirror_psamp_epoch_set; 1192 1193 /*! Get PSAMP epoch number. */ 1194 mirror_psamp_epoch_get_f mirror_psamp_epoch_get; 1195 1196 /*! Set uc_cos for mirror copies. */ 1197 mirror_uc_cos_set_f mirror_uc_cos_set; 1198 1199 /*! Get uc_cos for mirror copies. */ 1200 mirror_uc_cos_get_f mirror_uc_cos_get; 1201 1202 /*! Set mc_cos for mirror copies. */ 1203 mirror_mc_cos_set_f mirror_mc_cos_set; 1204 1205 /*! Get mc_cos for mirror copies. */ 1206 mirror_mc_cos_get_f mirror_mc_cos_get; 1207 1208 /*! Set cpu_cos for mirror-to-cpu copies. This cos will override cpu_cos from CCBI bus. */ 1209 mirror_cpu_cos_set_f mirror_cpu_cos_set; 1210 1211 /*! Get cpu_cos for mirror-to-cpu copies. */ 1212 mirror_cpu_cos_get_f mirror_cpu_cos_get; 1213 1214 /*! Set enable status for mirror traffic to drop pkts with invalid VLAN. */ 1215 mirror_invalid_vlan_drop_set_f mirror_invalid_vlan_drop_set; 1216 1217 /*! Get enable status of mirror traffic dropping pkts with invalid VLAN. */ 1218 mirror_invalid_vlan_drop_get_f mirror_invalid_vlan_drop_get; 1219 1220 /*! Set enable status for skipping packet checks for mirror packets. */ 1221 mirror_pkt_checks_set_f mirror_pkt_checks_set; 1222 1223 /*! Get enable status of skipping packet checks for mirror packets. */ 1224 mirror_pkt_checks_get_f mirror_pkt_checks_get; 1225 1226 /*! Validate mirror destination structure parameters. */ 1227 mirror_destination_validate_f mirror_destination_validate; 1228 1229 /*! Set sample profile entry. */ 1230 mirror_sample_profile_set_f mirror_sample_profile_set; 1231 1232 /*! Get sample profile entry. */ 1233 mirror_sample_profile_get_f mirror_sample_profile_get; 1234 1235 /*! Attach counter entries to a sample type. */ 1236 mirror_sample_stat_attach_f mirror_sample_stat_attach; 1237 1238 /*! Detach counter entries from a sample type. */ 1239 mirror_sample_stat_detach_f mirror_sample_stat_detach; 1240 1241 /*! Set global mirror truncate. */ 1242 mirror_global_truncate_set_f mirror_global_truncate_set; 1243 1244 /*! Get global mirror truncate. */ 1245 mirror_global_truncate_get_f mirror_global_truncate_get; 1246 1247 /*! Create a truncate length profile. */ 1248 mirror_truncate_length_profile_create_f mirror_truncate_length_profile_create; 1249 1250 /*! Destroy a truncate length profile. */ 1251 mirror_truncate_length_profile_destroy_f mirror_truncate_length_profile_destroy; 1252 1253 /*! Get a truncate length profile with given profile id. */ 1254 mirror_truncate_length_profile_get_f mirror_truncate_length_profile_get; 1255 1256 /*! Get VLAN for egress mirrored packets on a port (RSPAN). */ 1257 mirror_vlan_get_f mirror_vlan_get; 1258 1259 /*! Set VLAN for egress mirrored packets on a port (RSPAN). */ 1260 mirror_vlan_set_f mirror_vlan_set; 1261 1262 /*! Retrive a list of payload offset and protocol values from HW. */ 1263 mirror_payload_zero_control_multi_get_f mirror_payload_zero_control_multi_get; 1264 1265 /*! This function programs payload offset and protocol values required for payload wiping feature. They are used when this feature is enabled on a MTP. */ 1266 mirror_payload_zero_control_multi_set_f mirror_payload_zero_control_multi_set; 1267 1268 /*! This function creates the zero payload offset profile used for the mirror payload wiping feature by FP. */ 1269 mirror_payload_zero_profile_create_f mirror_payload_zero_profile_create; 1270 1271 /*! This function deletes the zero payload offset profile created for the mirror payload wiping feature by FP. */ 1272 mirror_payload_zero_profile_destroy_f mirror_payload_zero_profile_destroy; 1273 1274 /*! Create an ingress mirror-on-drop event group. */ 1275 mirror_ingress_mod_event_group_create_f mirror_ingress_mod_event_group_create; 1276 1277 /*! Destroy an ingress mirror-on-drop event group. */ 1278 mirror_ingress_mod_event_group_destroy_f mirror_ingress_mod_event_group_destroy; 1279 1280 /*! Get all ingress mirror-on-drop event groups. */ 1281 mirror_ingress_mod_event_group_get_all_f mirror_ingress_mod_event_group_get_all; 1282 1283 /*! Get events of an ingress mirror-on-drop event group. */ 1284 mirror_ingress_mod_event_group_event_get_f mirror_ingress_mod_event_group_event_get; 1285 1286 /*! Create an ingress mirror-on-drop event profile. */ 1287 mirror_ingress_mod_event_profile_create_f mirror_ingress_mod_event_profile_create; 1288 1289 /*! Destroy an ingress mirror-on-drop event profile. */ 1290 mirror_ingress_mod_event_profile_destroy_f mirror_ingress_mod_event_profile_destroy; 1291 1292 /*! Get all ingress mirror-on-drop event profile ids. */ 1293 mirror_ingress_mod_event_profile_get_all_f mirror_ingress_mod_event_profile_get_all; 1294 1295 /*! Get an ingress mirror-on-drop event profile config. */ 1296 mirror_ingress_mod_event_profile_cfg_get_f mirror_ingress_mod_event_profile_cfg_get; 1297 1298 /*! Add an ingress mirror-on-drop event group to an event profile. */ 1299 mirror_ingress_mod_event_profile_group_add_f mirror_ingress_mod_event_profile_group_add; 1300 1301 /*! Delete an ingress mirror-on-drop event group to an event profile. */ 1302 mirror_ingress_mod_event_profile_group_delete_f mirror_ingress_mod_event_profile_group_delete; 1303 1304 /*! Get all event groups of an ingress mirror-on-drop event profile. */ 1305 mirror_ingress_mod_event_profile_group_get_all_f mirror_ingress_mod_event_profile_group_get_all; 1306 1307 /*! Get hit expectation of an ingress mirror-on-drop event group from an event profile. */ 1308 mirror_ingress_mod_event_profile_group_get_f mirror_ingress_mod_event_profile_group_get; 1309 1310 /*! Create a group of multiple destination IPv4 addresses. */ 1311 mirror_multi_dip_group_ipv4_create_f mirror_multi_dip_group_ipv4_create; 1312 1313 /*! Remove a group of multiple destination IPv4 addresses. */ 1314 mirror_multi_dip_group_ipv4_destroy_f mirror_multi_dip_group_ipv4_destroy; 1315 1316 /*! Get all groups of multiple destination IPv4 addresses. */ 1317 mirror_multi_dip_group_ipv4_get_all_f mirror_multi_dip_group_ipv4_get_all; 1318 1319 /*! Get a group of multiple destination IPv4 addresses. */ 1320 mirror_multi_dip_group_ipv4_get_f mirror_multi_dip_group_ipv4_get; 1321 1322 /*! Create a group of multiple destination IPv6 addresses. */ 1323 mirror_multi_dip_group_ipv6_create_f mirror_multi_dip_group_ipv6_create; 1324 1325 /*! Remove a group of multiple destination IPv6 addresses. */ 1326 mirror_multi_dip_group_ipv6_destroy_f mirror_multi_dip_group_ipv6_destroy; 1327 1328 /*! Get all groups of multiple destination IPv6 addresses. */ 1329 mirror_multi_dip_group_ipv6_get_all_f mirror_multi_dip_group_ipv6_get_all; 1330 1331 /*! Get a group of multiple destination IPv6 addresses. */ 1332 mirror_multi_dip_group_ipv6_get_f mirror_multi_dip_group_ipv6_get; 1333 1334 /*! Dump multiple destination IP allocators. */ 1335 mirror_multi_dip_dump_f mirror_multi_dip_dump; 1336 1337 /*! Mirror database initialization. */ 1338 mirror_db_init_f mirror_db_init; 1339 1340 /*! Specify general mirror switch behaviors. */ 1341 mirror_switch_control_set_f mirror_switch_control_set; 1342 1343 /*! Retrieve general mirror switch behaviors. */ 1344 mirror_switch_control_get_f mirror_switch_control_get; 1345 1346 } mbcm_ltsw_mirror_drv_t; 1347 1348 /*! 1349 * \brief Set the MIRROR driver of the device. 1350 * 1351 * \param [in] unit Unit Number. 1352 * \param [in] drv Mirror driver to set. 1353 * 1354 * \retval SHR_E_NONE No errors. 1355 * \retval !SHR_E_NONE Failure. 1356 */ 1357 extern int 1358 mbcm_ltsw_mirror_drv_set( 1359 int unit, 1360 mbcm_ltsw_mirror_drv_t *drv); 1361 1362 /*! 1363 * \brief Initialize Mirror control info. 1364 * 1365 * \param [in] unit Unit Number. 1366 * \param [out] mirror_ctrl Mirror control info. 1367 * 1368 * \retval SHR_E_NONE No errors. 1369 * \retval !SHR_E_NONE Failure. 1370 */ 1371 extern int 1372 mbcm_ltsw_mirror_ctrl_info_init( 1373 int unit, 1374 bcmint_mirror_ctrl_info_t *mirror_ctrl); 1375 1376 /*! 1377 * \brief Chip specific mirror init. 1378 * 1379 * \param [in] unit Unit Number. 1380 * 1381 * \retval SHR_E_NONE No errors. 1382 * \retval !SHR_E_NONE Failure. 1383 */ 1384 extern int 1385 mbcm_ltsw_mirror_init(int unit); 1386 1387 /*! 1388 * \brief Chip specific mirror de-init. 1389 * 1390 * \param [in] unit Unit Number. 1391 * 1392 * \retval SHR_E_NONE No errors. 1393 * \retval !SHR_E_NONE Failure. 1394 */ 1395 extern int 1396 mbcm_ltsw_mirror_deinit(int unit); 1397 1398 /*! 1399 * \brief Add Mirror encap entry and return the encap index. 1400 * 1401 * \param [in] unit Unit Number. 1402 * \param [in] egr Egress Mirror encap. 1403 * \param [in] mirror_dest Mirror destination pointer. 1404 * \param [out] index Mirror encap index. 1405 * 1406 * \retval SHR_E_NONE No errors. 1407 * \retval !SHR_E_NONE Failure. 1408 */ 1409 extern int 1410 mbcm_ltsw_mirror_encap_add( 1411 int unit, 1412 bool egr, 1413 bcm_mirror_destination_t *mirror_dest, 1414 int *index); 1415 1416 /*! 1417 * \brief Delete Mirror encap entry. 1418 * 1419 * \param [in] unit Unit Number. 1420 * \param [in] mirror_dest Mirror destination pointer. 1421 * \param [in] index Mirror encap index. 1422 * 1423 * \retval SHR_E_NONE No errors. 1424 * \retval !SHR_E_NONE Failure. 1425 */ 1426 extern int 1427 mbcm_ltsw_mirror_encap_delete( 1428 int unit, 1429 bcm_mirror_destination_t *mirror_dest, 1430 int index); 1431 1432 /*! 1433 * \brief Get Mirror destination for given encap index. 1434 * 1435 * \param [in] unit Unit Number. 1436 * \param [in] index Mirror encap index. 1437 * \param [out] mirror_dest Mirror destination pointer. 1438 * 1439 * \retval SHR_E_NONE No errors. 1440 * \retval !SHR_E_NONE Failure. 1441 */ 1442 extern int 1443 mbcm_ltsw_mirror_encap_get( 1444 int unit, 1445 int index, 1446 bcm_mirror_destination_t *mirror_dest); 1447 1448 /*! 1449 * \brief Add Mirror session entry. 1450 * 1451 * \param [in] unit Unit Number. 1452 * \param [in] session_id Mirror session id. 1453 * \param [in] session Mirror session entry. 1454 * 1455 * \retval SHR_E_NONE No errors. 1456 * \retval !SHR_E_NONE Failure. 1457 */ 1458 extern int 1459 mbcm_ltsw_mirror_session_add( 1460 int unit, 1461 int session_id, 1462 bcmint_mirror_session_entry_t *session); 1463 1464 /*! 1465 * \brief Delete Mirror session entry with given session id. 1466 * 1467 * \param [in] unit Unit Number. 1468 * \param [in] session_id Mirror session id. 1469 * \param [in] egr For egress or ingress Mirroring. 1470 * \param [in] cosq_mod For cosq_mod Mirroring. 1471 * 1472 * \retval SHR_E_NONE No errors. 1473 * \retval !SHR_E_NONE Failure. 1474 */ 1475 extern int 1476 mbcm_ltsw_mirror_session_delete( 1477 int unit, 1478 int session_id, 1479 bool egr, 1480 bool cosq_mod); 1481 1482 /*! 1483 * \brief Get Mirror session entry for given id. 1484 * 1485 * \param [in] unit Unit Number. 1486 * \param [in] session_id Mirror session id. 1487 * \param [out] session Mirror session entry. 1488 * 1489 * \retval SHR_E_NONE No errors. 1490 * \retval !SHR_E_NONE Failure. 1491 */ 1492 extern int 1493 mbcm_ltsw_mirror_session_get( 1494 int unit, 1495 int session_id, 1496 bcmint_mirror_session_entry_t *session); 1497 1498 /*! 1499 * \brief Get statistics for a Mirror session. 1500 * 1501 * \param [in] unit Unit Number. 1502 * \param [in] session_id Mirror session id. 1503 * \param [in] sync Sync mode. 1504 * \param [out] value Statistics. 1505 * 1506 * \retval SHR_E_NONE No errors. 1507 * \retval !SHR_E_NONE Failure. 1508 */ 1509 extern int 1510 mbcm_ltsw_mirror_session_stat_get( 1511 int unit, 1512 int session_id, 1513 bool sync, 1514 uint64_t *value); 1515 1516 /*! 1517 * \brief Set statistics for a Mirror session. 1518 * 1519 * \param [in] unit Unit Number. 1520 * \param [in] session_id Mirror session id. 1521 * \param [in] value Statistics. 1522 * 1523 * \retval SHR_E_NONE No errors. 1524 * \retval !SHR_E_NONE Failure. 1525 */ 1526 extern int 1527 mbcm_ltsw_mirror_session_stat_set( 1528 int unit, 1529 int session_id, 1530 uint64_t value); 1531 1532 /*! 1533 * \brief Get Mirror enable status on a Mirror source. 1534 * 1535 * \param [in] unit Unit Number. 1536 * \param [in] source Mirror source. 1537 * \param [out] enable Enable status. 1538 * \param [out] instance_id Mirror instance id. 1539 * 1540 * \retval SHR_E_NONE No errors. 1541 * \retval !SHR_E_NONE Failure. 1542 */ 1543 extern int 1544 mbcm_ltsw_mirror_enable_get( 1545 int unit, 1546 bcmint_mirror_source_t *source, 1547 int *enable, 1548 int *instance_id); 1549 1550 /*! 1551 * \brief Set Mirror enable status on a Mirror source. 1552 * 1553 * \param [in] unit Unit Number. 1554 * \param [in] source Mirror source. 1555 * \param [in] mc_bmp Bitmap of Mirror containers cared. 1556 * \param [in] enable Enable status for Mirror container. 1557 * \param [in] instance_id Mirror instance id. 1558 * 1559 * \retval SHR_E_NONE No errors. 1560 * \retval !SHR_E_NONE Failure. 1561 */ 1562 extern int 1563 mbcm_ltsw_mirror_enable_set( 1564 int unit, 1565 bcmint_mirror_source_t *source, 1566 int mc_bmp, 1567 int enable, 1568 int *instance_id); 1569 1570 /*! 1571 * \brief Mirror misc init. 1572 * 1573 * \param [in] unit Unit Number. 1574 * 1575 * \retval SHR_E_NONE No errors. 1576 * \retval !SHR_E_NONE Failure. 1577 */ 1578 extern int 1579 mbcm_ltsw_mirror_misc_init(int unit); 1580 1581 /*! 1582 * \brief Mirror misc deinit. 1583 * 1584 * \param [in] unit Unit Number. 1585 * 1586 * \retval SHR_E_NONE No errors. 1587 * \retval !SHR_E_NONE Failure. 1588 */ 1589 extern int 1590 mbcm_ltsw_mirror_misc_deinit(int unit); 1591 1592 /*! 1593 * \brief Init sample profile. 1594 * 1595 * \param [in] unit Unit Number. 1596 * 1597 * \retval SHR_E_NONE No errors. 1598 * \retval !SHR_E_NONE Failure. 1599 */ 1600 extern int 1601 mbcm_ltsw_mirror_sample_profile_init(int unit); 1602 1603 /*! 1604 * \brief Deinit sample profile. 1605 * 1606 * \param [in] unit Unit Number. 1607 * 1608 * \retval SHR_E_NONE No errors. 1609 * \retval !SHR_E_NONE Failure. 1610 */ 1611 extern int 1612 mbcm_ltsw_mirror_sample_profile_deinit(int unit); 1613 1614 /*! 1615 * \brief Get max rate range of egress sampler. 1616 * 1617 * \param [in] unit Unit Number. 1618 * \param [out] range_max Max rate range. 1619 * 1620 * \retval SHR_E_NONE No errors. 1621 * \retval !SHR_E_NONE Failure. 1622 */ 1623 extern int 1624 mbcm_ltsw_mirror_egress_sampler_rate_range_max( 1625 int unit, 1626 int *range_max); 1627 1628 /*! 1629 * \brief Set sampler random seed value. 1630 * 1631 * \param [in] unit Unit Number. 1632 * \param [in] type Sampler seed type. 1633 * \param [in] value Sampler seed value. 1634 * 1635 * \retval SHR_E_NONE No errors. 1636 * \retval !SHR_E_NONE Failure. 1637 */ 1638 extern int 1639 mbcm_ltsw_mirror_sampler_seed_set( 1640 int unit, 1641 bcmi_ltsw_mirror_sampler_seed_type_t type, 1642 int value); 1643 1644 /*! 1645 * \brief Get sampler random seed value. 1646 * 1647 * \param [in] unit Unit Number. 1648 * \param [in] type Sampler seed type. 1649 * \param [out] value Sampler seed value. 1650 * 1651 * \retval SHR_E_NONE No errors. 1652 * \retval !SHR_E_NONE Failure. 1653 */ 1654 extern int 1655 mbcm_ltsw_mirror_sampler_seed_get( 1656 int unit, 1657 bcmi_ltsw_mirror_sampler_seed_type_t type, 1658 int *value); 1659 1660 /*! 1661 * \brief Set sFlow version number. 1662 * 1663 * \param [in] unit Unit Number. 1664 * \param [in] value sFlow version number. 1665 * 1666 * \retval SHR_E_NONE No errors. 1667 * \retval !SHR_E_NONE Failure. 1668 */ 1669 extern int 1670 mbcm_ltsw_mirror_sample_version_set( 1671 int unit, 1672 int value); 1673 1674 /*! 1675 * \brief Get sFlow version number. 1676 * 1677 * \param [in] unit Unit Number. 1678 * \param [out] value sFlow version number. 1679 * 1680 * \retval SHR_E_NONE No errors. 1681 * \retval !SHR_E_NONE Failure. 1682 */ 1683 extern int 1684 mbcm_ltsw_mirror_sample_version_get( 1685 int unit, 1686 int *value); 1687 1688 /*! 1689 * \brief Set PSAMP IPFIX version number. 1690 * 1691 * \param [in] unit Unit Number. 1692 * \param [in] value PSAMP IPFIX version number. 1693 * 1694 * \retval SHR_E_NONE No errors. 1695 * \retval !SHR_E_NONE Failure. 1696 */ 1697 extern int 1698 mbcm_ltsw_mirror_psamp_ipfix_version_set( 1699 int unit, 1700 int value); 1701 1702 /*! 1703 * \brief Get PSAMP IPFIX version number. 1704 * 1705 * \param [in] unit Unit Number. 1706 * \param [out] value PSAMP IPFIX version number. 1707 * 1708 * \retval SHR_E_NONE No errors. 1709 * \retval !SHR_E_NONE Failure. 1710 */ 1711 extern int 1712 mbcm_ltsw_mirror_psamp_ipfix_version_get( 1713 int unit, 1714 int *value); 1715 1716 /*! 1717 * \brief Set PSAMP epoch number. 1718 * 1719 * \param [in] unit Unit Number. 1720 * \param [in] value PSAMP epoch number. 1721 * 1722 * \retval SHR_E_NONE No errors. 1723 * \retval !SHR_E_NONE Failure. 1724 */ 1725 extern int 1726 mbcm_ltsw_mirror_psamp_epoch_set( 1727 int unit, 1728 int value); 1729 1730 /*! 1731 * \brief Get PSAMP epoch number. 1732 * 1733 * \param [in] unit Unit Number. 1734 * \param [out] value PSAMP epoch number. 1735 * 1736 * \retval SHR_E_NONE No errors. 1737 * \retval !SHR_E_NONE Failure. 1738 */ 1739 extern int 1740 mbcm_ltsw_mirror_psamp_epoch_get( 1741 int unit, 1742 int *value); 1743 1744 /*! 1745 * \brief Set uc_cos for mirror copies. 1746 * 1747 * \param [in] unit Unit Number. 1748 * \param [in] uc_cos UC cos value. 1749 * 1750 * \retval SHR_E_NONE No errors. 1751 * \retval !SHR_E_NONE Failure. 1752 */ 1753 extern int 1754 mbcm_ltsw_mirror_uc_cos_set( 1755 int unit, 1756 int uc_cos); 1757 1758 /*! 1759 * \brief Get uc_cos for mirror copies. 1760 * 1761 * \param [in] unit Unit Number. 1762 * \param [out] uc_cos UC cos value. 1763 * 1764 * \retval SHR_E_NONE No errors. 1765 * \retval !SHR_E_NONE Failure. 1766 */ 1767 extern int 1768 mbcm_ltsw_mirror_uc_cos_get( 1769 int unit, 1770 int *uc_cos); 1771 1772 /*! 1773 * \brief Set mc_cos for mirror copies. 1774 * 1775 * \param [in] unit Unit Number. 1776 * \param [in] mc_cos MC cos value. 1777 * 1778 * \retval SHR_E_NONE No errors. 1779 * \retval !SHR_E_NONE Failure. 1780 */ 1781 extern int 1782 mbcm_ltsw_mirror_mc_cos_set( 1783 int unit, 1784 int mc_cos); 1785 1786 /*! 1787 * \brief Get mc_cos for mirror copies. 1788 * 1789 * \param [in] unit Unit Number. 1790 * \param [out] mc_cos MC cos value. 1791 * 1792 * \retval SHR_E_NONE No errors. 1793 * \retval !SHR_E_NONE Failure. 1794 */ 1795 extern int 1796 mbcm_ltsw_mirror_mc_cos_get( 1797 int unit, 1798 int *mc_cos); 1799 1800 /*! 1801 * \brief Set cpu_cos for mirror-to-cpu copies. This cos will override cpu_cos from CCBI bus. 1802 * 1803 * \param [in] unit Unit Number. 1804 * \param [in] cpu_cos Cpu_cos value. 1805 * 1806 * \retval SHR_E_NONE No errors. 1807 * \retval !SHR_E_NONE Failure. 1808 */ 1809 extern int 1810 mbcm_ltsw_mirror_cpu_cos_set( 1811 int unit, 1812 int cpu_cos); 1813 1814 /*! 1815 * \brief Get cpu_cos for mirror-to-cpu copies. 1816 * 1817 * \param [in] unit Unit Number. 1818 * \param [out] cpu_cos Cpu_cos value. 1819 * 1820 * \retval SHR_E_NONE No errors. 1821 * \retval !SHR_E_NONE Failure. 1822 */ 1823 extern int 1824 mbcm_ltsw_mirror_cpu_cos_get( 1825 int unit, 1826 int *cpu_cos); 1827 1828 /*! 1829 * \brief Set enable status for mirror traffic to drop pkts with invalid VLAN. 1830 * 1831 * \param [in] unit Unit Number. 1832 * \param [in] enable Enable status. 1833 * 1834 * \retval SHR_E_NONE No errors. 1835 * \retval !SHR_E_NONE Failure. 1836 */ 1837 extern int 1838 mbcm_ltsw_mirror_invalid_vlan_drop_set( 1839 int unit, 1840 int enable); 1841 1842 /*! 1843 * \brief Get enable status of mirror traffic dropping pkts with invalid VLAN. 1844 * 1845 * \param [in] unit Unit Number. 1846 * \param [out] enable Enable status. 1847 * 1848 * \retval SHR_E_NONE No errors. 1849 * \retval !SHR_E_NONE Failure. 1850 */ 1851 extern int 1852 mbcm_ltsw_mirror_invalid_vlan_drop_get( 1853 int unit, 1854 int *enable); 1855 1856 /*! 1857 * \brief Set enable status for skipping packet checks for mirror packets. 1858 * 1859 * \param [in] unit Unit Number. 1860 * \param [in] enable Enable status. 1861 * 1862 * \retval SHR_E_NONE No errors. 1863 * \retval !SHR_E_NONE Failure. 1864 */ 1865 extern int 1866 mbcm_ltsw_mirror_pkt_checks_set( 1867 int unit, 1868 int enable); 1869 1870 /*! 1871 * \brief Get enable status of skipping packet checks for mirror packets. 1872 * 1873 * \param [in] unit Unit Number. 1874 * \param [out] enable Enable status. 1875 * 1876 * \retval SHR_E_NONE No errors. 1877 * \retval !SHR_E_NONE Failure. 1878 */ 1879 extern int 1880 mbcm_ltsw_mirror_pkt_checks_get( 1881 int unit, 1882 int *enable); 1883 1884 /*! 1885 * \brief Validate mirror destination structure parameters. 1886 * 1887 * \param [in] unit Unit Number. 1888 * \param [in] mirror_dest Mirror destination pointer. 1889 * 1890 * \retval SHR_E_NONE No errors. 1891 * \retval !SHR_E_NONE Failure. 1892 */ 1893 extern int 1894 mbcm_ltsw_mirror_destination_validate( 1895 int unit, 1896 bcm_mirror_destination_t *mirror_dest); 1897 1898 /*! 1899 * \brief Set sample profile entry. 1900 * 1901 * \param [in] unit Unit Number. 1902 * \param [in] type Sample type. 1903 * \param [in] profile_id Sample profile id. 1904 * \param [in] profile Sample profile entry. 1905 * 1906 * \retval SHR_E_NONE No errors. 1907 * \retval !SHR_E_NONE Failure. 1908 */ 1909 extern int 1910 mbcm_ltsw_mirror_sample_profile_set( 1911 int unit, 1912 bcmint_mirror_sample_type_t type, 1913 int profile_id, 1914 bcm_mirror_sample_profile_t *profile); 1915 1916 /*! 1917 * \brief Get sample profile entry. 1918 * 1919 * \param [in] unit Unit Number. 1920 * \param [in] type Sample type. 1921 * \param [in] profile_id Sample profile id. 1922 * \param [out] profile Sample profile entry. 1923 * 1924 * \retval SHR_E_NONE No errors. 1925 * \retval !SHR_E_NONE Failure. 1926 */ 1927 extern int 1928 mbcm_ltsw_mirror_sample_profile_get( 1929 int unit, 1930 bcmint_mirror_sample_type_t type, 1931 int profile_id, 1932 bcm_mirror_sample_profile_t *profile); 1933 1934 /*! 1935 * \brief Attach counter entries to a sample type. 1936 * 1937 * \param [in] unit Unit Number. 1938 * \param [in] type Sample type. 1939 * \param [in] stat_counter_id Counter id. 1940 * 1941 * \retval SHR_E_NONE No errors. 1942 * \retval !SHR_E_NONE Failure. 1943 */ 1944 extern int 1945 mbcm_ltsw_mirror_sample_stat_attach( 1946 int unit, 1947 bcmint_mirror_sample_type_t type, 1948 uint32_t stat_counter_id); 1949 1950 /*! 1951 * \brief Detach counter entries from a sample type. 1952 * 1953 * \param [in] unit Unit Number. 1954 * \param [in] type Sample type. 1955 * \param [in] stat_counter_id Counter id. 1956 * 1957 * \retval SHR_E_NONE No errors. 1958 * \retval !SHR_E_NONE Failure. 1959 */ 1960 extern int 1961 mbcm_ltsw_mirror_sample_stat_detach( 1962 int unit, 1963 bcmint_mirror_sample_type_t type, 1964 uint32_t stat_counter_id); 1965 1966 /*! 1967 * \brief Set global mirror truncate. 1968 * 1969 * \param [in] unit Unit Number. 1970 * \param [in] global_truncate Mirror global truncate pointer. 1971 * 1972 * \retval SHR_E_NONE No errors. 1973 * \retval !SHR_E_NONE Failure. 1974 */ 1975 extern int 1976 mbcm_ltsw_mirror_global_truncate_set( 1977 int unit, 1978 bcm_mirror_global_truncate_t *global_truncate); 1979 1980 /*! 1981 * \brief Get global mirror truncate. 1982 * 1983 * \param [in] unit Unit Number. 1984 * \param [out] global_truncate Mirror global truncate pointer. 1985 * 1986 * \retval SHR_E_NONE No errors. 1987 * \retval !SHR_E_NONE Failure. 1988 */ 1989 extern int 1990 mbcm_ltsw_mirror_global_truncate_get( 1991 int unit, 1992 bcm_mirror_global_truncate_t *global_truncate); 1993 1994 /*! 1995 * \brief Create a truncate length profile. 1996 * 1997 * \param [in] unit Unit Number. 1998 * \param [in] options Options flags. 1999 * \param [inout] profile_id Profile id. 2000 * \param [in] profile Profile entry. 2001 * 2002 * \retval SHR_E_NONE No errors. 2003 * \retval !SHR_E_NONE Failure. 2004 */ 2005 extern int 2006 mbcm_ltsw_mirror_truncate_length_profile_create( 2007 int unit, 2008 uint32_t options, 2009 int *profile_id, 2010 bcm_mirror_truncate_length_profile_t *profile); 2011 2012 /*! 2013 * \brief Destroy a truncate length profile. 2014 * 2015 * \param [in] unit Unit Number. 2016 * \param [in] profile_id Profile id. 2017 * 2018 * \retval SHR_E_NONE No errors. 2019 * \retval !SHR_E_NONE Failure. 2020 */ 2021 extern int 2022 mbcm_ltsw_mirror_truncate_length_profile_destroy( 2023 int unit, 2024 int profile_id); 2025 2026 /*! 2027 * \brief Get a truncate length profile with given profile id. 2028 * 2029 * \param [in] unit Unit Number. 2030 * \param [in] profile_id Profile id. 2031 * \param [out] profile Profile entry. 2032 * 2033 * \retval SHR_E_NONE No errors. 2034 * \retval !SHR_E_NONE Failure. 2035 */ 2036 extern int 2037 mbcm_ltsw_mirror_truncate_length_profile_get( 2038 int unit, 2039 int profile_id, 2040 bcm_mirror_truncate_length_profile_t *profile); 2041 2042 /*! 2043 * \brief Get VLAN for egress mirrored packets on a port (RSPAN). 2044 * 2045 * \param [in] unit Unit Number. 2046 * \param [in] port Mirror-to port for which to get tag info. 2047 * \param [out] tpid Tag protocol id. 2048 * \param [out] vlan Virtual LAN number. 2049 * 2050 * \retval SHR_E_NONE No errors. 2051 * \retval !SHR_E_NONE Failure. 2052 */ 2053 extern int 2054 mbcm_ltsw_mirror_vlan_get( 2055 int unit, 2056 bcm_port_t port, 2057 uint16_t *tpid, 2058 uint16_t *vlan); 2059 2060 /*! 2061 * \brief Set VLAN for egress mirrored packets on a port (RSPAN). 2062 * 2063 * \param [in] unit Unit Number. 2064 * \param [in] port Mirror-to port for which to get tag info. 2065 * \param [in] tpid Tag protocol id. 2066 * \param [in] vlan Virtual LAN number. 2067 * 2068 * \retval SHR_E_NONE No errors. 2069 * \retval !SHR_E_NONE Failure. 2070 */ 2071 extern int 2072 mbcm_ltsw_mirror_vlan_set( 2073 int unit, 2074 bcm_port_t port, 2075 uint16_t tpid, 2076 uint16_t vlan); 2077 2078 /*! 2079 * \brief Retrive a list of payload offset and protocol values from HW. 2080 * 2081 * \param [in] unit Unit Number. 2082 * \param [in/out] pyld_zero_cfg Array with the desired 'field_id' initialized with a valid bcm_mirror_payload_zero_field_t enum value in each array member. 2083 * \param [in] num_elems Number of elements in pyld_zero_cfg array. Must be between 1 to bcmMirrorPayloadZeroCount. 2084 * 2085 * \retval SHR_E_NONE No errors. 2086 * \retval !SHR_E_NONE Failure. 2087 */ 2088 extern int 2089 mbcm_ltsw_mirror_payload_zero_control_multi_get( 2090 int unit, 2091 bcm_mirror_payload_zero_info_t *pyld_zero_cfg, 2092 int num_elems); 2093 2094 /*! 2095 * \brief This function programs payload offset and protocol values required for payload wiping feature. They are used when this feature is enabled on a MTP. 2096 * 2097 * \param [in] unit Unit Number. 2098 * \param [in] pyld_zero_cfg Array containing protocol number or port number and/or offset value for the fields represented by bcm_mirror_payload_zero_field_t. 2099 * \param [in] num_elems Number of elements in pyld_zero_cfg array. Must be between 1 to bcmMirrorPayloadZeroCount. 2100 * 2101 * \retval SHR_E_NONE No errors. 2102 * \retval !SHR_E_NONE Failure. 2103 */ 2104 extern int 2105 mbcm_ltsw_mirror_payload_zero_control_multi_set( 2106 int unit, 2107 bcm_mirror_payload_zero_info_t *pyld_zero_cfg, 2108 int num_elems); 2109 2110 /*! 2111 * \brief This function creates the zero payload offset profile used for the mirror payload wiping feature by FP. 2112 * 2113 * \param [in] unit Unit Number. 2114 * \param [in] mirror_payload_offset_info Structure with the egress zero payload offsets. 2115 * \param [in] flags Define module using the profile entry. 2116 * \param [in] profile_index Profile index created. 2117 * 2118 * \retval SHR_E_NONE No errors. 2119 * \retval !SHR_E_NONE Failure. 2120 */ 2121 extern int 2122 mbcm_ltsw_mirror_payload_zero_profile_create( 2123 int unit, 2124 bcm_mirror_payload_zero_offsets_t *mirror_payload_offset_info, 2125 uint32 flags, 2126 uint32 * profile_index); 2127 2128 /*! 2129 * \brief This function deletes the zero payload offset profile created for the mirror payload wiping feature by FP. 2130 * 2131 * \param [in] unit Unit Number. 2132 * \param [in] flags Define module using the profile entry. 2133 * \param [in] profile_index Profile index to be deleted. 2134 * 2135 * \retval SHR_E_NONE No errors. 2136 * \retval !SHR_E_NONE Failure. 2137 */ 2138 extern int 2139 mbcm_ltsw_mirror_payload_zero_profile_destroy( 2140 int unit, 2141 uint32 flags, 2142 uint32 profile_index); 2143 2144 /*! 2145 * \brief Create an ingress mirror-on-drop event group. 2146 * 2147 * \param [in] unit Unit Number. 2148 * \param [in] event_array Ingress mirror-on-drop events of the group. 2149 * \param [in] num_events Number of events given. 2150 * \param [out] group Event group. 2151 * 2152 * \retval SHR_E_NONE No errors. 2153 * \retval !SHR_E_NONE Failure. 2154 */ 2155 extern int 2156 mbcm_ltsw_mirror_ingress_mod_event_group_create( 2157 int unit, 2158 bcm_mirror_ingress_mod_event_t *event_array, 2159 int num_events, 2160 bcm_mirror_ingress_mod_event_group_t *group); 2161 2162 /*! 2163 * \brief Destroy an ingress mirror-on-drop event group. 2164 * 2165 * \param [in] unit Unit Number. 2166 * \param [in] group Event group. 2167 * 2168 * \retval SHR_E_NONE No errors. 2169 * \retval !SHR_E_NONE Failure. 2170 */ 2171 extern int 2172 mbcm_ltsw_mirror_ingress_mod_event_group_destroy( 2173 int unit, 2174 bcm_mirror_ingress_mod_event_group_t group); 2175 2176 /*! 2177 * \brief Get all ingress mirror-on-drop event groups. 2178 * 2179 * \param [in] unit Unit Number. 2180 * \param [out] group_array Event group array. 2181 * \param [in/out] count Count of the event groups. 2182 * 2183 * \retval SHR_E_NONE No errors. 2184 * \retval !SHR_E_NONE Failure. 2185 */ 2186 extern int 2187 mbcm_ltsw_mirror_ingress_mod_event_group_get_all( 2188 int unit, 2189 bcm_mirror_ingress_mod_event_group_t *group_array, 2190 int *count); 2191 2192 /*! 2193 * \brief Get events of an ingress mirror-on-drop event group. 2194 * 2195 * \param [in] unit Unit Number. 2196 * \param [in] group Event group. 2197 * \param [out] event_array Ingress mirror-on-drop events of the group. 2198 * \param [in/out] count Count of the events in the group. 2199 * 2200 * \retval SHR_E_NONE No errors. 2201 * \retval !SHR_E_NONE Failure. 2202 */ 2203 extern int 2204 mbcm_ltsw_mirror_ingress_mod_event_group_event_get( 2205 int unit, 2206 bcm_mirror_ingress_mod_event_group_t group, 2207 bcm_mirror_ingress_mod_event_t *event_array, 2208 int *count); 2209 2210 /*! 2211 * \brief Create an ingress mirror-on-drop event profile. 2212 * 2213 * \param [in] unit Unit Number. 2214 * \param [in] profile Ingress mirror-on-drop event profile data. 2215 * \param [out] profile_id Profile id returned on success. 2216 * 2217 * \retval SHR_E_NONE No errors. 2218 * \retval !SHR_E_NONE Failure. 2219 */ 2220 extern int 2221 mbcm_ltsw_mirror_ingress_mod_event_profile_create( 2222 int unit, 2223 bcm_mirror_ingress_mod_event_profile_t *profile, 2224 int *profile_id); 2225 2226 /*! 2227 * \brief Destroy an ingress mirror-on-drop event profile. 2228 * 2229 * \param [in] unit Unit Number. 2230 * \param [in] profile_id Ingress mirror-on-drop event profile id. 2231 * 2232 * \retval SHR_E_NONE No errors. 2233 * \retval !SHR_E_NONE Failure. 2234 */ 2235 extern int 2236 mbcm_ltsw_mirror_ingress_mod_event_profile_destroy( 2237 int unit, 2238 int profile_id); 2239 2240 /*! 2241 * \brief Get all ingress mirror-on-drop event profile ids. 2242 * 2243 * \param [in] unit Unit Number. 2244 * \param [out] profile_id_array Event profile id array. 2245 * \param [in/out] count Count of the event profiles. 2246 * 2247 * \retval SHR_E_NONE No errors. 2248 * \retval !SHR_E_NONE Failure. 2249 */ 2250 extern int 2251 mbcm_ltsw_mirror_ingress_mod_event_profile_get_all( 2252 int unit, 2253 int *profile_id_array, 2254 int *count); 2255 2256 /*! 2257 * \brief Get an ingress mirror-on-drop event profile config. 2258 * 2259 * \param [in] unit Unit Number. 2260 * \param [in] profile_id Event profile id. 2261 * \param [out] profile Event profile. 2262 * 2263 * \retval SHR_E_NONE No errors. 2264 * \retval !SHR_E_NONE Failure. 2265 */ 2266 extern int 2267 mbcm_ltsw_mirror_ingress_mod_event_profile_cfg_get( 2268 int unit, 2269 int profile_id, 2270 bcm_mirror_ingress_mod_event_profile_t *profile); 2271 2272 /*! 2273 * \brief Add an ingress mirror-on-drop event group to an event profile. 2274 * 2275 * \param [in] unit Unit Number. 2276 * \param [in] profile_id Event profile id. 2277 * \param [in] group Event group. 2278 * \param [in] hit Event group hit expectation. 2279 * 2280 * \retval SHR_E_NONE No errors. 2281 * \retval !SHR_E_NONE Failure. 2282 */ 2283 extern int 2284 mbcm_ltsw_mirror_ingress_mod_event_profile_group_add( 2285 int unit, 2286 int profile_id, 2287 bcm_mirror_ingress_mod_event_group_t group, 2288 int hit); 2289 2290 /*! 2291 * \brief Delete an ingress mirror-on-drop event group to an event profile. 2292 * 2293 * \param [in] unit Unit Number. 2294 * \param [in] profile_id Event profile id. 2295 * \param [in] group Event group. 2296 * 2297 * \retval SHR_E_NONE No errors. 2298 * \retval !SHR_E_NONE Failure. 2299 */ 2300 extern int 2301 mbcm_ltsw_mirror_ingress_mod_event_profile_group_delete( 2302 int unit, 2303 int profile_id, 2304 bcm_mirror_ingress_mod_event_group_t group); 2305 2306 /*! 2307 * \brief Get all event groups of an ingress mirror-on-drop event profile. 2308 * 2309 * \param [in] unit Unit Number. 2310 * \param [in] profile_id Event profile id. 2311 * \param [out] group_array Event group array. 2312 * \param [in/out] count Count of the groups in the profile. 2313 * 2314 * \retval SHR_E_NONE No errors. 2315 * \retval !SHR_E_NONE Failure. 2316 */ 2317 extern int 2318 mbcm_ltsw_mirror_ingress_mod_event_profile_group_get_all( 2319 int unit, 2320 int profile_id, 2321 bcm_mirror_ingress_mod_event_group_t *group_array, 2322 int *count); 2323 2324 /*! 2325 * \brief Get hit expectation of an ingress mirror-on-drop event group from an event profile. 2326 * 2327 * \param [in] unit Unit Number. 2328 * \param [in] profile_id Event profile id. 2329 * \param [in] group Event group array. 2330 * \param [out] hit Event group hit expectation. 2331 * 2332 * \retval SHR_E_NONE No errors. 2333 * \retval !SHR_E_NONE Failure. 2334 */ 2335 extern int 2336 mbcm_ltsw_mirror_ingress_mod_event_profile_group_get( 2337 int unit, 2338 int profile_id, 2339 bcm_mirror_ingress_mod_event_group_t group, 2340 int *hit); 2341 2342 /*! 2343 * \brief Create a group of multiple destination IPv4 addresses. 2344 * 2345 * \param [in] unit Unit Number. 2346 * \param [in] num_entries Number of entries of the group. 2347 * \param [in] ipv4_addr_array The addresses to be set for the group. 2348 * \param [out] group Multiple destination IP group. 2349 * 2350 * \retval SHR_E_NONE No errors. 2351 * \retval !SHR_E_NONE Failure. 2352 */ 2353 extern int 2354 mbcm_ltsw_mirror_multi_dip_group_ipv4_create( 2355 int unit, 2356 bcm_mirror_multi_dip_entry_num_t num_entries, 2357 bcm_ip_t *ipv4_addr_array, 2358 bcm_mirror_multi_dip_group_t *group); 2359 2360 /*! 2361 * \brief Remove a group of multiple destination IPv4 addresses. 2362 * 2363 * \param [in] unit Unit Number. 2364 * \param [in] group Multiple destination IP group. 2365 * 2366 * \retval SHR_E_NONE No errors. 2367 * \retval !SHR_E_NONE Failure. 2368 */ 2369 extern int 2370 mbcm_ltsw_mirror_multi_dip_group_ipv4_destroy( 2371 int unit, 2372 bcm_mirror_multi_dip_group_t group); 2373 2374 /*! 2375 * \brief Get all groups of multiple destination IPv4 addresses. 2376 * 2377 * \param [in] unit Unit Number. 2378 * \param [out] ipv4_group_array Number of entries of the group. 2379 * \param [in/out] count Count of the ipv4_groups. 2380 * 2381 * \retval SHR_E_NONE No errors. 2382 * \retval !SHR_E_NONE Failure. 2383 */ 2384 extern int 2385 mbcm_ltsw_mirror_multi_dip_group_ipv4_get_all( 2386 int unit, 2387 bcm_mirror_multi_dip_group_t *ipv4_group_array, 2388 int *count); 2389 2390 /*! 2391 * \brief Get a group of multiple destination IPv4 addresses. 2392 * 2393 * \param [in] unit Unit Number. 2394 * \param [in] group Multiple destination ip group. 2395 * \param [out] ipv4_addr_array The addresses of the group. 2396 * \param [in/out] count Count of addresses in the group. 2397 * 2398 * \retval SHR_E_NONE No errors. 2399 * \retval !SHR_E_NONE Failure. 2400 */ 2401 extern int 2402 mbcm_ltsw_mirror_multi_dip_group_ipv4_get( 2403 int unit, 2404 bcm_mirror_multi_dip_group_t group, 2405 bcm_ip_t *ipv4_addr_array, 2406 int *count); 2407 2408 /*! 2409 * \brief Create a group of multiple destination IPv6 addresses. 2410 * 2411 * \param [in] unit Unit Number. 2412 * \param [in] num_entries Number of entries of the group. 2413 * \param [in] ipv6_addr_array The addresses to be set for the group. 2414 * \param [out] group Multiple destination IP group. 2415 * 2416 * \retval SHR_E_NONE No errors. 2417 * \retval !SHR_E_NONE Failure. 2418 */ 2419 extern int 2420 mbcm_ltsw_mirror_multi_dip_group_ipv6_create( 2421 int unit, 2422 bcm_mirror_multi_dip_entry_num_t num_entries, 2423 bcm_ip6_t *ipv6_addr_array, 2424 bcm_mirror_multi_dip_group_t *group); 2425 2426 /*! 2427 * \brief Remove a group of multiple destination IPv6 addresses. 2428 * 2429 * \param [in] unit Unit Number. 2430 * \param [in] group Multiple destination IP group. 2431 * 2432 * \retval SHR_E_NONE No errors. 2433 * \retval !SHR_E_NONE Failure. 2434 */ 2435 extern int 2436 mbcm_ltsw_mirror_multi_dip_group_ipv6_destroy( 2437 int unit, 2438 bcm_mirror_multi_dip_group_t group); 2439 2440 /*! 2441 * \brief Get all groups of multiple destination IPv6 addresses. 2442 * 2443 * \param [in] unit Unit Number. 2444 * \param [out] ipv6_group_array Number of entries of the group. 2445 * \param [in/out] count Count of the ipv6_groups. 2446 * 2447 * \retval SHR_E_NONE No errors. 2448 * \retval !SHR_E_NONE Failure. 2449 */ 2450 extern int 2451 mbcm_ltsw_mirror_multi_dip_group_ipv6_get_all( 2452 int unit, 2453 bcm_mirror_multi_dip_group_t *ipv6_group_array, 2454 int *count); 2455 2456 /*! 2457 * \brief Get a group of multiple destination IPv6 addresses. 2458 * 2459 * \param [in] unit Unit Number. 2460 * \param [in] group Multiple destination ip group. 2461 * \param [out] ipv6_addr_array The addresses of the group. 2462 * \param [in/out] count Count of addresses in the group. 2463 * 2464 * \retval SHR_E_NONE No errors. 2465 * \retval !SHR_E_NONE Failure. 2466 */ 2467 extern int 2468 mbcm_ltsw_mirror_multi_dip_group_ipv6_get( 2469 int unit, 2470 bcm_mirror_multi_dip_group_t group, 2471 bcm_ip6_t *ipv6_addr_array, 2472 int *count); 2473 2474 /*! 2475 * \brief Dump multiple destination IP allocators. 2476 * 2477 * \param [in] unit Unit Number. 2478 * 2479 * \retval SHR_E_NONE No errors. 2480 * \retval !SHR_E_NONE Failure. 2481 */ 2482 extern int 2483 mbcm_ltsw_mirror_multi_dip_dump(int unit); 2484 2485 /*! 2486 * \brief Mirror database initialization. 2487 * 2488 * \param [in] unit Unit Number. 2489 * 2490 * \retval SHR_E_NONE No errors. 2491 * \retval !SHR_E_NONE Failure. 2492 */ 2493 extern int 2494 mbcm_ltsw_mirror_db_init(int unit); 2495 2496 /*! 2497 * \brief Specify general mirror switch behaviors. 2498 * 2499 * \param [in] unit Unit Number. 2500 * \param [in] type The desired switch control type. 2501 * \param [in] arg Value to set. 2502 * 2503 * \retval SHR_E_NONE No errors. 2504 * \retval !SHR_E_NONE Failure. 2505 */ 2506 extern int 2507 mbcm_ltsw_mirror_switch_control_set( 2508 int unit, 2509 bcm_switch_control_t type, 2510 int arg); 2511 2512 /*! 2513 * \brief Retrieve general mirror switch behaviors. 2514 * 2515 * \param [in] unit Unit Number. 2516 * \param [in] type The desired switch control type. 2517 * \param [out] arg Value to get. 2518 * 2519 * \retval SHR_E_NONE No errors. 2520 * \retval !SHR_E_NONE Failure. 2521 */ 2522 extern int 2523 mbcm_ltsw_mirror_switch_control_get( 2524 int unit, 2525 bcm_switch_control_t type, 2526 int *arg); 2527 2528 #endif /* BCMINT_LTSW_MBCM_MIRROR_H */