port.h (115071B)
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_PORT_H 12 #define BCMINT_LTSW_MBCM_PORT_H 13 14 #include <bcm/types.h> 15 #include <bcm/port.h> 16 17 #include <bcm_int/ltsw/port.h> 18 #include <bcm_int/ltsw/port_int.h> 19 20 #include <sal/sal_types.h> 21 22 /*! 23 * \brief Initialize device specific information. 24 * 25 * \param [in] unit Unit Number. 26 * 27 * \retval SHR_E_NONE No errors. 28 * \retval !SHR_E_NONE Failure. 29 */ 30 typedef int (*port_info_init_f)(int unit); 31 32 /*! 33 * \brief Initialize device specific information for a port. 34 * 35 * \param [in] unit Unit Number. 36 * \param [in] port Port Number. 37 * 38 * \retval SHR_E_NONE No errors. 39 * \retval !SHR_E_NONE Failure. 40 */ 41 typedef int (*port_info_init_per_port_f)( 42 int unit, 43 bcm_port_t port); 44 45 /*! 46 * \brief De-initialize device specific information. 47 * 48 * \param [in] unit Unit Number. 49 * 50 * \retval SHR_E_NONE No errors. 51 * \retval !SHR_E_NONE Failure. 52 */ 53 typedef int (*port_info_deinit_f)(int unit); 54 55 /*! 56 * \brief Recover device specific information. 57 * 58 * \param [in] unit Unit Number. 59 * 60 * \retval SHR_E_NONE No errors. 61 * \retval !SHR_E_NONE Failure. 62 */ 63 typedef int (*port_info_recover_f)(int unit); 64 65 /*! 66 * \brief Initialize port profile tables. 67 * 68 * \param [in] unit Unit Number. 69 * 70 * \retval SHR_E_NONE No errors. 71 * \retval !SHR_E_NONE Failure. 72 */ 73 typedef int (*port_profile_init_f)(int unit); 74 75 /*! 76 * \brief De-initialize port profile tables. 77 * 78 * \param [in] unit Unit Number. 79 * 80 * \retval SHR_E_NONE No errors. 81 * \retval !SHR_E_NONE Failure. 82 */ 83 typedef int (*port_profile_deinit_f)(int unit); 84 85 /*! 86 * \brief Initialize basic port pipeline configuration. 87 * 88 * \param [in] unit Unit Number. 89 * 90 * \retval SHR_E_NONE No errors. 91 * \retval !SHR_E_NONE Failure. 92 */ 93 typedef int (*port_service_init_f)(int unit); 94 95 /*! 96 * \brief De-initialize basic port pipeline configuration. 97 * 98 * \param [in] unit Unit Number. 99 * 100 * \retval SHR_E_NONE No errors. 101 * \retval !SHR_E_NONE Failure. 102 */ 103 typedef int (*port_service_deinit_f)(int unit); 104 105 /*! 106 * \brief Port module misc init. 107 * 108 * \param [in] unit Unit Number. 109 * 110 * \retval SHR_E_NONE No errors. 111 * \retval !SHR_E_NONE Failure. 112 */ 113 typedef int (*port_misc_init_f)(int unit); 114 115 /*! 116 * \brief Port module misc deinit. 117 * 118 * \param [in] unit Unit Number. 119 * 120 * \retval SHR_E_NONE No errors. 121 * \retval !SHR_E_NONE Failure. 122 */ 123 typedef int (*port_misc_deinit_f)(int unit); 124 125 /*! 126 * \brief Port database initialization. 127 * 128 * \param [in] unit Unit Number. 129 * 130 * \retval SHR_E_NONE No errors. 131 * \retval !SHR_E_NONE Failure. 132 */ 133 typedef int (*port_db_init_f)(int unit); 134 135 /*! 136 * \brief Set the status of specified port feature. 137 * 138 * \param [in] unit Unit Number. 139 * \param [in] port Port Number. 140 * \param [in] type Enum value of the port feature. 141 * \param [in] value Value of the port feature to be set. 142 * 143 * \retval SHR_E_NONE No errors. 144 * \retval !SHR_E_NONE Failure. 145 */ 146 typedef int (*port_control_set_f)( 147 int unit, 148 bcm_port_t port, 149 bcm_port_control_t type, 150 int value); 151 152 /*! 153 * \brief Get the status of specified port feature. 154 * 155 * \param [in] unit Unit Number. 156 * \param [in] port Port Number. 157 * \param [in] type Enum value of the port feature. 158 * \param [out] value Current value of the port feature. 159 * 160 * \retval SHR_E_NONE No errors. 161 * \retval !SHR_E_NONE Failure. 162 */ 163 typedef int (*port_control_get_f)( 164 int unit, 165 bcm_port_t port, 166 bcm_port_control_t type, 167 int *value); 168 169 /*! 170 * \brief Control the sampling of packets ingressing or egressing a port. 171 * 172 * \param [in] unit Unit Number. 173 * \param [in] port Port Number. 174 * \param [in] ingress_rate Ingress direction rate. 175 * \param [in] egress_rate Egress direction rate. 176 * 177 * \retval SHR_E_NONE No errors. 178 * \retval !SHR_E_NONE Failure. 179 */ 180 typedef int (*port_sample_rate_set_f)( 181 int unit, 182 bcm_port_t port, 183 int ingress_rate, 184 int egress_rate); 185 186 /*! 187 * \brief Get the sampling rate of packets ingressing or egressing a port. 188 * 189 * \param [in] unit Unit Number. 190 * \param [in] port Port Number. 191 * \param [out] ingress_rate Ingress direction rate. 192 * \param [out] egress_rate Egress direction rate. 193 * 194 * \retval SHR_E_NONE No errors. 195 * \retval !SHR_E_NONE Failure. 196 */ 197 typedef int (*port_sample_rate_get_f)( 198 int unit, 199 bcm_port_t port, 200 int *ingress_rate, 201 int *egress_rate); 202 203 /*! 204 * \brief Update profile for a port. 205 * 206 * \param [in] unit Unit Number. 207 * \param [in] fields Field list. 208 * \param [in] fields_cnt Field number in list. 209 * 210 * \retval SHR_E_NONE No errors. 211 * \retval !SHR_E_NONE Failure. 212 */ 213 typedef int (*port_profile_lport_tab_update_f)( 214 int unit, 215 ltsw_port_tab_field_t *fields, 216 int fields_cnt); 217 218 /*! 219 * \brief Add profile. 220 * 221 * \param [in] unit Unit Number. 222 * \param [in] profile Profile to be added. 223 * \param [out] index Index of the added or existed profile enrty. 224 * 225 * \retval SHR_E_NONE No errors. 226 * \retval !SHR_E_NONE Failure. 227 */ 228 typedef int (*port_profile_port_pkt_ctrl_add_f)( 229 int unit, 230 void *profile, 231 int *index); 232 233 /*! 234 * \brief Get profile from LT. 235 * 236 * \param [in] unit Unit Number. 237 * \param [in] index Index of the first entry. 238 * \param [out] profile Profile entries. 239 * 240 * \retval SHR_E_NONE No errors. 241 * \retval !SHR_E_NONE Failure. 242 */ 243 typedef int (*port_profile_port_pkt_ctrl_get_f)( 244 int unit, 245 int index, 246 void *profile); 247 248 /*! 249 * \brief Delete profile. 250 * 251 * \param [in] unit Unit Number. 252 * \param [in] index Index of the first entry to be deleted. 253 * 254 * \retval SHR_E_NONE No errors. 255 * \retval !SHR_E_NONE Failure. 256 */ 257 typedef int (*port_profile_port_pkt_ctrl_delete_f)( 258 int unit, 259 int index); 260 261 /*! 262 * \brief Recover hash and reference count for profile. 263 * 264 * \param [in] unit Unit Number. 265 * \param [in] index Profile index to be recovered. 266 * 267 * \retval SHR_E_NONE No errors. 268 * \retval !SHR_E_NONE Failure. 269 */ 270 typedef int (*port_profile_port_pkt_ctrl_recover_f)( 271 int unit, 272 int index); 273 274 /*! 275 * \brief Update one field of PORT_PKT_CONTROL. 276 * 277 * \param [in] unit Unit Number. 278 * \param [in] port port ID. 279 * \param [in] lt_fld_name Field name of PORT_PKT_CONTROL. 280 * \param [in] lt_fld_value Field value of PORT_PKT_CONTROL. 281 * 282 * \retval SHR_E_NONE No errors. 283 * \retval !SHR_E_NONE Failure. 284 */ 285 typedef int (*port_profile_port_pkt_ctrl_update_f)( 286 int unit, 287 int port, 288 const char *lt_fld_name, 289 int lt_fld_value); 290 291 /*! 292 * \brief Get one field value of PORT_PKT_CONTROL. 293 * 294 * \param [in] unit Unit Number. 295 * \param [in] port port ID. 296 * \param [in] lt_fld_name Field name of PORT_PKT_CONTROL. 297 * \param [out] lt_fld_value Field value of PORT_PKT_CONTROL. 298 * 299 * \retval SHR_E_NONE No errors. 300 * \retval !SHR_E_NONE Failure. 301 */ 302 typedef int (*port_profile_port_pkt_ctrl_field_get_f)( 303 int unit, 304 int port, 305 const char *lt_fld_name, 306 int *lt_fld_value); 307 308 /*! 309 * \brief Add specified entry to L2_IF based tables. 310 * 311 * \param [in] unit Unit Number. 312 * \param [in] l2_if L2 interface. 313 * 314 * \retval SHR_E_NONE No errors. 315 * \retval !SHR_E_NONE Failure. 316 */ 317 typedef int (*l2_if_add_f)( 318 int unit, 319 int l2_if); 320 321 /*! 322 * \brief Delete specified entry of L2_IF based tables. 323 * 324 * \param [in] unit Unit Number. 325 * \param [in] l2_if L2 interface. 326 * 327 * \retval SHR_E_NONE No errors. 328 * \retval !SHR_E_NONE Failure. 329 */ 330 typedef int (*l2_if_del_f)( 331 int unit, 332 int l2_if); 333 334 /*! 335 * \brief Get port from L2 interface. 336 * 337 * \param [in] unit Unit Number. 338 * \param [in] l2_if L2 interface. 339 * \param [out] port Port Number. 340 * 341 * \retval SHR_E_NONE No errors. 342 * \retval !SHR_E_NONE Failure. 343 */ 344 typedef int (*l2_if_to_port_f)( 345 int unit, 346 int l2_if, 347 bcm_port_t *port); 348 349 /*! 350 * \brief Get L2 interface from port. 351 * 352 * \param [in] unit Unit Number. 353 * \param [in] port Port Number. 354 * \param [out] l2_if L2 interface. 355 * 356 * \retval SHR_E_NONE No errors. 357 * \retval !SHR_E_NONE Failure. 358 */ 359 typedef int (*port_to_l2_if_f)( 360 int unit, 361 bcm_port_t port, 362 int *l2_if); 363 364 /*! 365 * \brief Get port mask from L2 interface mask. 366 * 367 * \param [in] unit Unit Number. 368 * \param [in] l2_if_mask L2 interface mask. 369 * \param [out] port_mask Local logical port mask. 370 * 371 * \retval SHR_E_NONE No errors. 372 * \retval !SHR_E_NONE Failure. 373 */ 374 typedef int (*l2_if_mask_to_port_mask_f)( 375 int unit, 376 int l2_if_mask, 377 int *port_mask); 378 379 /*! 380 * \brief Get L2 interface mask from port mask. 381 * 382 * \param [in] unit Unit Number. 383 * \param [in] port_mask Local logical port mask. 384 * \param [out] l2_if_mask L2 interface mask. 385 * 386 * \retval SHR_E_NONE No errors. 387 * \retval !SHR_E_NONE Failure. 388 */ 389 typedef int (*port_mask_to_l2_if_mask_f)( 390 int unit, 391 int port_mask, 392 int *l2_if_mask); 393 394 /*! 395 * \brief Get which pipes are using identified L2 interface. 396 * 397 * \param [in] unit Unit Number. 398 * \param [in] l2_if L2 interface. 399 * \param [out] pipe_bmp Pipe bitmap. 400 * 401 * \retval SHR_E_NONE No errors. 402 * \retval !SHR_E_NONE Failure. 403 */ 404 typedef int (*l2_if_to_pipes_f)( 405 int unit, 406 int l2_if, 407 uint32_t *pipe_bmp); 408 409 /*! 410 * \brief Add specified entry to System Port based tables. 411 * 412 * \param [in] unit Unit Number. 413 * \param [in] sys_port System port. 414 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 415 * 416 * \retval SHR_E_NONE No errors. 417 * \retval !SHR_E_NONE Failure. 418 */ 419 typedef int (*sys_port_add_f)( 420 int unit, 421 int sys_port, 422 int flags); 423 424 /*! 425 * \brief Delete specified entry of System Port based tables. 426 * 427 * \param [in] unit Unit Number. 428 * \param [in] sys_port System port. 429 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 430 * 431 * \retval SHR_E_NONE No errors. 432 * \retval !SHR_E_NONE Failure. 433 */ 434 typedef int (*sys_port_del_f)( 435 int unit, 436 int sys_port, 437 int flags); 438 439 /*! 440 * \brief Change the system port of a port. The settings of the old system port is moved to the new system port. The old system port is deleted then. 441 * 442 * \param [in] unit Unit Number. 443 * \param [in] port Port Number. 444 * \param [in] sys_port New system port. 445 * 446 * \retval SHR_E_NONE No errors. 447 * \retval !SHR_E_NONE Failure. 448 */ 449 typedef int (*port_sys_port_move_f)( 450 int unit, 451 bcm_port_t port, 452 int sys_port); 453 454 /*! 455 * \brief Get gport from system port. 456 * 457 * \param [in] unit Unit Number. 458 * \param [in] sys_port System port. 459 * \param [out] port Port Number. 460 * 461 * \retval SHR_E_NONE No errors. 462 * \retval !SHR_E_NONE Failure. 463 */ 464 typedef int (*sys_port_to_port_f)( 465 int unit, 466 int sys_port, 467 bcm_port_t *port); 468 469 /*! 470 * \brief Get system port from port or gport. 471 * 472 * \param [in] unit Unit Number. 473 * \param [in] port Port Number. 474 * \param [out] sys_port System port. 475 * 476 * \retval SHR_E_NONE No errors. 477 * \retval !SHR_E_NONE Failure. 478 */ 479 typedef int (*port_to_sys_port_f)( 480 int unit, 481 bcm_port_t port, 482 int *sys_port); 483 484 /*! 485 * \brief Get system ports from port or gport. 486 * 487 * \param [in] unit Unit Number. 488 * \param [in] port Local logical port or gport. 489 * \param [in] array_size Size of system port array. 490 * \param [out] sys_port_array System port array. 491 * \param [out] count Real count of system ports. 492 * 493 * \retval SHR_E_NONE No errors. 494 * \retval !SHR_E_NONE Failure. 495 */ 496 typedef int (*port_to_sys_ports_f)( 497 int unit, 498 bcm_port_t port, 499 int array_size, 500 int *sys_port_array, 501 int *count); 502 503 /*! 504 * \brief Map System Port with L2 interface. 505 * 506 * \param [in] unit Unit Number. 507 * \param [in] sys_port System port. 508 * \param [in] l2_if L2 interface. 509 * 510 * \retval SHR_E_NONE No errors. 511 * \retval !SHR_E_NONE Failure. 512 */ 513 typedef int (*sys_port_map_l2_if_f)( 514 int unit, 515 int sys_port, 516 int l2_if); 517 518 /*! 519 * \brief Demap System Port and L2 interface. 520 * 521 * \param [in] unit Unit Number. 522 * \param [in] sys_port System port. 523 * \param [in] l2_if L2 interface. 524 * 525 * \retval SHR_E_NONE No errors. 526 * \retval !SHR_E_NONE Failure. 527 */ 528 typedef int (*sys_port_demap_l2_if_f)( 529 int unit, 530 int sys_port, 531 int l2_if); 532 533 /*! 534 * \brief Traverse over all system ports. 535 * 536 * \param [in] unit Unit Number. 537 * \param [in] cb Callback function. 538 * \param [in] user_data User data to a call back. 539 * 540 * \retval SHR_E_NONE No errors. 541 * \retval !SHR_E_NONE Failure. 542 */ 543 typedef int (*sys_port_traverse_f)( 544 int unit, 545 bcmi_ltsw_port_traverse_cb cb, 546 void *user_data); 547 548 /*! 549 * \brief Get logic table info from port tab type. 550 * 551 * \param [in] unit Unit Number. 552 * \param [inout] fields A set of fields which contain type and LT info. 553 * \param [in] count Number of fields. 554 * 555 * \retval SHR_E_NONE No errors. 556 * \retval !SHR_E_NONE Failure. 557 */ 558 typedef int (*port_tabs_info_get_f)( 559 int unit, 560 ltsw_port_tab_field_t *fields, 561 int count); 562 563 /*! 564 * \brief Get operation flags for logic table access. 565 * 566 * \param [in] unit Unit Number. 567 * \param [in] port Port or gport. 568 * \param [inout] fields A set of fields which contain type and LT info. 569 * \param [in] count Number of fields. 570 * \param [out] op Operation flags. 571 * 572 * \retval SHR_E_NONE No errors. 573 * \retval !SHR_E_NONE Failure. 574 */ 575 typedef int (*port_tabs_op_get_f)( 576 int unit, 577 bcm_port_t port, 578 ltsw_port_tab_field_t *fields, 579 int count, 580 uint32_t *op); 581 582 /*! 583 * \brief Get parameters for logic table access. 584 * 585 * \param [in] unit Unit Number. 586 * \param [in] port Port or gport. 587 * \param [inout] fields A set of fields which contain type and LT info. 588 * \param [in] count Number of fields. 589 * \param [in] op Port tab operation flags. 590 * 591 * \retval SHR_E_NONE No errors. 592 * \retval !SHR_E_NONE Failure. 593 */ 594 typedef int (*port_tabs_para_get_f)( 595 int unit, 596 bcm_port_t port, 597 ltsw_port_tab_field_t *fields, 598 int count, 599 uint32_t op); 600 601 /*! 602 * \brief Set the ARL hardware learning options for this port. 603 * 604 * \param [in] unit Unit Number. 605 * \param [in] port Port Number. 606 * \param [in] flags Logical OR of BCM_PORT_LEARN_xxx flags. 607 * 608 * \retval SHR_E_NONE No errors. 609 * \retval !SHR_E_NONE Failure. 610 */ 611 typedef int (*port_learn_set_f)( 612 int unit, 613 bcm_port_t port, 614 uint32_t flags); 615 616 /*! 617 * \brief Get the ARL hardware learning options for this port. 618 * 619 * \param [in] unit Unit Number. 620 * \param [in] port Port Number. 621 * \param [out] flags Logical OR of BCM_PORT_LEARN_xxx flags. 622 * 623 * \retval SHR_E_NONE No errors. 624 * \retval !SHR_E_NONE Failure. 625 */ 626 typedef int (*port_learn_get_f)( 627 int unit, 628 bcm_port_t port, 629 uint32_t *flags); 630 631 /*! 632 * \brief Enable/Disable L3 switching on the specified port. 633 * 634 * \param [in] unit Unit Number. 635 * \param [in] port Port Number. 636 * \param [in] enable TRUE to enable, FALSE to disable. 637 * 638 * \retval SHR_E_NONE No errors. 639 * \retval !SHR_E_NONE Failure. 640 */ 641 typedef int (*port_l3_enable_set_f)( 642 int unit, 643 bcm_port_t port, 644 int enable); 645 646 /*! 647 * \brief Return whether L3 switching is enabled on the specified port. 648 * 649 * \param [in] unit Unit Number. 650 * \param [in] port Port Number. 651 * \param [out] enable TRUE if enabled, FALSE if disabled. 652 * 653 * \retval SHR_E_NONE No errors. 654 * \retval !SHR_E_NONE Failure. 655 */ 656 typedef int (*port_l3_enable_get_f)( 657 int unit, 658 bcm_port_t port, 659 int *enable); 660 661 /*! 662 * \brief Set the maximum L3 frame size for the port. 663 * 664 * \param [in] unit Unit Number. 665 * \param [in] port Port Number. 666 * \param [in] size Maximum frame size in bytes. 667 * 668 * \retval SHR_E_NONE No errors. 669 * \retval !SHR_E_NONE Failure. 670 */ 671 typedef int (*port_l3_mtu_set_f)( 672 int unit, 673 bcm_port_t port, 674 int size); 675 676 /*! 677 * \brief Get the maximum L3 frame size for the port. 678 * 679 * \param [in] unit Unit Number. 680 * \param [in] port Port Number. 681 * \param [out] size Maximum frame size in bytes. 682 * 683 * \retval SHR_E_NONE No errors. 684 * \retval !SHR_E_NONE Failure. 685 */ 686 typedef int (*port_l3_mtu_get_f)( 687 int unit, 688 bcm_port_t port, 689 int *size); 690 691 /*! 692 * \brief Set the L3 multicast options for the port. 693 * 694 * \param [in] unit Unit Number. 695 * \param [in] port Port Number. 696 * \param [in] flags Logical OR of BCM_PORT_IPMC_xxx flags. 697 * 698 * \retval SHR_E_NONE No errors. 699 * \retval !SHR_E_NONE Failure. 700 */ 701 typedef int (*port_ipmc_modify_set_f)( 702 int unit, 703 bcm_port_t port, 704 uint32_t flags); 705 706 /*! 707 * \brief Get the L3 multicast options for the port. 708 * 709 * \param [in] unit Unit Number. 710 * \param [in] port Port Number. 711 * \param [out] flags Logical OR of BCM_PORT_IPMC_xxx flags. 712 * 713 * \retval SHR_E_NONE No errors. 714 * \retval !SHR_E_NONE Failure. 715 */ 716 typedef int (*port_ipmc_modify_get_f)( 717 int unit, 718 bcm_port_t port, 719 uint32_t *flags); 720 721 /*! 722 * \brief Add allowed TPID for a port. 723 * 724 * \param [in] unit Unit Number. 725 * \param [in] port Port Number. 726 * \param [in] type TPID type. 727 * \param [in] tpid Tag Protocol ID. 728 * \param [in] color_select Color mode of the TPID. 729 * 730 * \retval SHR_E_NONE No errors. 731 * \retval !SHR_E_NONE Failure. 732 */ 733 typedef int (*port_tpid_add_f)( 734 int unit, 735 bcm_port_t port, 736 int type, 737 uint16_t tpid, 738 int color_select); 739 740 /*! 741 * \brief Set the default Tag Protocol ID for a port. 742 * 743 * \param [in] unit Unit Number. 744 * \param [in] port Port Number. 745 * \param [in] type TPID type. 746 * \param [in] tpid Tag Protocol ID. 747 * 748 * \retval SHR_E_NONE No errors. 749 * \retval !SHR_E_NONE Failure. 750 */ 751 typedef int (*port_tpid_set_f)( 752 int unit, 753 bcm_port_t port, 754 int type, 755 uint16_t tpid); 756 757 /*! 758 * \brief Retrieve the default Tag Protocol ID for a port. 759 * 760 * \param [in] unit Unit Number. 761 * \param [in] port Port Number. 762 * \param [in] type TPID type. 763 * \param [out] tpid Tag Protocol ID. 764 * 765 * \retval SHR_E_NONE No errors. 766 * \retval !SHR_E_NONE Failure. 767 */ 768 typedef int (*port_tpid_get_f)( 769 int unit, 770 bcm_port_t port, 771 int type, 772 uint16_t *tpid); 773 774 /*! 775 * \brief Get a list of tpids and associated color selections for a given port. 776 * 777 * \param [in] unit Unit Number. 778 * \param [in] port Port Number. 779 * \param [in] type TPID type. 780 * \param [in] size Number of elements of the next two array parameters. 781 * \param [out] tpid_array Buffer array to hold a list of retrieved tpids. 782 * \param [out] color_array Buffer array to hold a list of retrieved color selections. 783 * \param [out] count Actual number of tpids retrieved. 784 * 785 * \retval SHR_E_NONE No errors. 786 * \retval !SHR_E_NONE Failure. 787 */ 788 typedef int (*port_tpid_get_all_f)( 789 int unit, 790 bcm_port_t port, 791 int type, 792 int size, 793 uint16_t *tpid_array, 794 int *color_array, 795 int *count); 796 797 /*! 798 * \brief Delete allowed TPID for a port. 799 * 800 * \param [in] unit Unit Number. 801 * \param [in] port Port Number. 802 * \param [in] type TPID type. 803 * \param [in] tpid Tag Protocol ID. 804 * 805 * \retval SHR_E_NONE No errors. 806 * \retval !SHR_E_NONE Failure. 807 */ 808 typedef int (*port_tpid_delete_f)( 809 int unit, 810 bcm_port_t port, 811 int type, 812 uint16_t tpid); 813 814 /*! 815 * \brief Delete all allowed TPID for a port. 816 * 817 * \param [in] unit Unit Number. 818 * \param [in] port Port Number. 819 * \param [in] type TPID type. 820 * 821 * \retval SHR_E_NONE No errors. 822 * \retval !SHR_E_NONE Failure. 823 */ 824 typedef int (*port_tpid_delete_all_f)( 825 int unit, 826 bcm_port_t port, 827 int type); 828 829 /*! 830 * \brief Set the expected TPID for the inner tag in double-tagging mode. 831 * 832 * \param [in] unit Unit Number. 833 * \param [in] port Port Number. 834 * \param [in] tpid Tag Protocol ID. 835 * 836 * \retval SHR_E_NONE No errors. 837 * \retval !SHR_E_NONE Failure. 838 */ 839 typedef int (*port_inner_tpid_set_f)( 840 int unit, 841 bcm_port_t port, 842 uint16_t tpid); 843 844 /*! 845 * \brief Get the expected TPID for the inner tag in double-tagging mode. 846 * 847 * \param [in] unit Unit Number. 848 * \param [in] port Port Number. 849 * \param [out] tpid Tag Protocol ID. 850 * 851 * \retval SHR_E_NONE No errors. 852 * \retval !SHR_E_NONE Failure. 853 */ 854 typedef int (*port_inner_tpid_get_f)( 855 int unit, 856 bcm_port_t port, 857 uint16_t *tpid); 858 859 /*! 860 * \brief Set the default VLAN ID for received untagged packets on a port. 861 * 862 * \param [in] unit Unit Number. 863 * \param [in] port Port Number. 864 * \param [in] vid VLAN ID. 865 * 866 * \retval SHR_E_NONE No errors. 867 * \retval !SHR_E_NONE Failure. 868 */ 869 typedef int (*port_untagged_vlan_set_f)( 870 int unit, 871 bcm_port_t port, 872 bcm_vlan_t vid); 873 874 /*! 875 * \brief Retrieve the default VLAN ID for received untagged packets on a port. 876 * 877 * \param [in] unit Unit Number. 878 * \param [in] port Port Number. 879 * \param [out] vid VLAN ID. 880 * 881 * \retval SHR_E_NONE No errors. 882 * \retval !SHR_E_NONE Failure. 883 */ 884 typedef int (*port_untagged_vlan_get_f)( 885 int unit, 886 bcm_port_t port, 887 bcm_vlan_t *vid); 888 889 /*! 890 * \brief Set the 802.1p priority for received untagged packets on a port. 891 * 892 * \param [in] unit Unit Number. 893 * \param [in] port Port Number. 894 * \param [in] priority 802.1p priority. 895 * 896 * \retval SHR_E_NONE No errors. 897 * \retval !SHR_E_NONE Failure. 898 */ 899 typedef int (*port_untagged_priority_set_f)( 900 int unit, 901 bcm_port_t port, 902 int priority); 903 904 /*! 905 * \brief Retrieve the 802.1p priority for received untagged packets on a port. 906 * 907 * \param [in] unit Unit Number. 908 * \param [in] port Port Number. 909 * \param [out] priority 802.1p priority. 910 * 911 * \retval SHR_E_NONE No errors. 912 * \retval !SHR_E_NONE Failure. 913 */ 914 typedef int (*port_untagged_priority_get_f)( 915 int unit, 916 bcm_port_t port, 917 int *priority); 918 919 /*! 920 * \brief Set the private VLAN attribute of a port. 921 * 922 * \param [in] unit Unit Number. 923 * \param [in] port Port Number. 924 * \param [in] vlan VLAN ID. 925 * \param [in] pkt_prio Egress packet priority. 926 * \param [in] flags BCM_PORT_FORCE_VLAN_xxx. 927 * 928 * \retval SHR_E_NONE No errors. 929 * \retval !SHR_E_NONE Failure. 930 */ 931 typedef int (*port_force_vlan_set_f)( 932 int unit, 933 bcm_port_t port, 934 bcm_vlan_t vlan, 935 int pkt_prio, 936 uint32_t flags); 937 938 /*! 939 * \brief Get the private VLAN attribute of a port. 940 * 941 * \param [in] unit Unit Number. 942 * \param [in] port Port Number. 943 * \param [out] vlan VLAN ID. 944 * \param [out] pkt_prio Egress packet priority. 945 * \param [out] flags BCM_PORT_FORCE_VLAN_xxx. 946 * 947 * \retval SHR_E_NONE No errors. 948 * \retval !SHR_E_NONE Failure. 949 */ 950 typedef int (*port_force_vlan_get_f)( 951 int unit, 952 bcm_port_t port, 953 bcm_vlan_t *vlan, 954 int *pkt_prio, 955 uint32_t *flags); 956 957 /*! 958 * \brief Set the trunk group for a given port. 959 * 960 * \param [in] unit Unit Number. 961 * \param [in] port Port Number. 962 * \param [in] tid trunk ID. 963 * \param [in] psc trunk selection criterion. 964 * 965 * \retval SHR_E_NONE No errors. 966 * \retval !SHR_E_NONE Failure. 967 */ 968 typedef int (*port_tgid_set_f)( 969 int unit, 970 bcm_port_t port, 971 int tid, 972 int psc); 973 974 /*! 975 * \brief Get the trunk group for a given port. 976 * 977 * \param [in] unit Unit Number. 978 * \param [in] port Port Number. 979 * \param [out] tid trunk ID. 980 * \param [out] psc trunk selection criterion. 981 * 982 * \retval SHR_E_NONE No errors. 983 * \retval !SHR_E_NONE Failure. 984 */ 985 typedef int (*port_tgid_get_f)( 986 int unit, 987 bcm_port_t port, 988 int *tid, 989 int *psc); 990 991 /*! 992 * \brief Set ingress and egress filter mode for a port. 993 * 994 * \param [in] unit Unit Number. 995 * \param [in] port Port Number. 996 * \param [in] flags BCM_PORT_VLAN_MEMBER_xxx. 997 * 998 * \retval SHR_E_NONE No errors. 999 * \retval !SHR_E_NONE Failure. 1000 */ 1001 typedef int (*port_vlan_member_set_f)( 1002 int unit, 1003 bcm_port_t port, 1004 uint32_t flags); 1005 1006 /*! 1007 * \brief Get filter mode for a port. 1008 * 1009 * \param [in] unit Unit Number. 1010 * \param [in] port Port Number. 1011 * \param [out] flags BCM_PORT_VLAN_MEMBER_xxx. 1012 * 1013 * \retval SHR_E_NONE No errors. 1014 * \retval !SHR_E_NONE Failure. 1015 */ 1016 typedef int (*port_vlan_member_get_f)( 1017 int unit, 1018 bcm_port_t port, 1019 uint32_t *flags); 1020 1021 /*! 1022 * \brief Set port default vlan tag actions. 1023 * 1024 * \param [in] unit Unit Number. 1025 * \param [in] port Port Number. 1026 * \param [in] action Vlan tag actions. 1027 * \param [in] action_profile_index Index of vlan action profile. 1028 * 1029 * \retval SHR_E_NONE No errors. 1030 * \retval !SHR_E_NONE Failure. 1031 */ 1032 typedef int (*port_ing_vlan_action_set_f)( 1033 int unit, 1034 bcm_port_t port, 1035 bcm_vlan_action_set_t *action, 1036 int action_profile_index); 1037 1038 /*! 1039 * \brief Get port default vlan tag actions. 1040 * 1041 * \param [in] unit Unit Number. 1042 * \param [in] port Port Number. 1043 * \param [out] action Vlan tag actions. 1044 * \param [out] action_profile_index Index of vlan action profile. 1045 * 1046 * \retval SHR_E_NONE No errors. 1047 * \retval !SHR_E_NONE Failure. 1048 */ 1049 typedef int (*port_ing_vlan_action_get_f)( 1050 int unit, 1051 bcm_port_t port, 1052 bcm_vlan_action_set_t *action, 1053 int *action_profile_index); 1054 1055 /*! 1056 * \brief Set port egr vlan tag actions. 1057 * 1058 * \param [in] unit Unit Number. 1059 * \param [in] port Port Number. 1060 * \param [in] action Vlan tag actions. 1061 * \param [in] action_profile_index Index of egr vlan action profile. 1062 * 1063 * \retval SHR_E_NONE No errors. 1064 * \retval !SHR_E_NONE Failure. 1065 */ 1066 typedef int (*port_egr_vlan_action_set_f)( 1067 int unit, 1068 bcm_port_t port, 1069 bcm_vlan_action_set_t *action, 1070 int action_profile_index); 1071 1072 /*! 1073 * \brief Get port egr vlan tag actions. 1074 * 1075 * \param [in] unit Unit Number. 1076 * \param [in] port Port Number. 1077 * \param [out] action Vlan tag actions. 1078 * \param [out] action_profile_index Index of egr vlan action profile. 1079 * 1080 * \retval SHR_E_NONE No errors. 1081 * \retval !SHR_E_NONE Failure. 1082 */ 1083 typedef int (*port_egr_vlan_action_get_f)( 1084 int unit, 1085 bcm_port_t port, 1086 bcm_vlan_action_set_t *action, 1087 int *action_profile_index); 1088 1089 /*! 1090 * \brief Set port default vlan tag actions to reset values. 1091 * 1092 * \param [in] unit Unit Number. 1093 * \param [in] port Port Number. 1094 * 1095 * \retval SHR_E_NONE No errors. 1096 * \retval !SHR_E_NONE Failure. 1097 */ 1098 typedef int (*port_ing_vlan_action_reset_f)( 1099 int unit, 1100 bcm_port_t port); 1101 1102 /*! 1103 * \brief Set egress vlan translation enable. 1104 * 1105 * \param [in] unit Unit Number. 1106 * \param [in] port Port Number. 1107 * \param [in] enable Egress vlan translation enable. 1108 * 1109 * \retval SHR_E_NONE No errors. 1110 * \retval !SHR_E_NONE Failure. 1111 */ 1112 typedef int (*port_egr_vlan_xlate_enable_set_f)( 1113 int unit, 1114 bcm_port_t port, 1115 int enable); 1116 1117 /*! 1118 * \brief Get egress vlan translation enable. 1119 * 1120 * \param [in] unit Unit Number. 1121 * \param [in] port Port Number. 1122 * \param [out] enable Egress vlan translation enable. 1123 * 1124 * \retval SHR_E_NONE No errors. 1125 * \retval !SHR_E_NONE Failure. 1126 */ 1127 typedef int (*port_egr_vlan_xlate_enable_get_f)( 1128 int unit, 1129 bcm_port_t port, 1130 int *enable); 1131 1132 /*! 1133 * \brief Set the ports class ID. 1134 * 1135 * \param [in] unit Unit Number. 1136 * \param [in] port Port Number. 1137 * \param [in] class Classification type. 1138 * \param [in] class_id Class ID of the port. 1139 * 1140 * \retval SHR_E_NONE No errors. 1141 * \retval !SHR_E_NONE Failure. 1142 */ 1143 typedef int (*port_class_set_f)( 1144 int unit, 1145 bcm_port_t port, 1146 bcm_port_class_t class, 1147 uint32_t class_id); 1148 1149 /*! 1150 * \brief Get the ports class ID. 1151 * 1152 * \param [in] unit Unit Number. 1153 * \param [in] port Port Number. 1154 * \param [in] class Classification type. 1155 * \param [out] class_id Class ID of the port. 1156 * 1157 * \retval SHR_E_NONE No errors. 1158 * \retval !SHR_E_NONE Failure. 1159 */ 1160 typedef int (*port_class_get_f)( 1161 int unit, 1162 bcm_port_t port, 1163 bcm_port_class_t class, 1164 uint32_t *class_id); 1165 1166 /*! 1167 * \brief Get which pipes are using identified port group. 1168 * 1169 * \param [in] unit Unit Number. 1170 * \param [in] port_group Port group. 1171 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 1172 * \param [out] pipe_bmp Pipe bitmap. 1173 * 1174 * \retval SHR_E_NONE No errors. 1175 * \retval !SHR_E_NONE Failure. 1176 */ 1177 typedef int (*port_group_to_pipes_f)( 1178 int unit, 1179 int port_group, 1180 int flags, 1181 uint32_t *pipe_bmp); 1182 1183 /*! 1184 * \brief Set port discard attributes. 1185 * 1186 * \param [in] unit Unit Number. 1187 * \param [in] port Port Number. 1188 * \param [in] mode Port discard mode, BCM_PORT_DISCARD_xxx. 1189 * 1190 * \retval SHR_E_NONE No errors. 1191 * \retval !SHR_E_NONE Failure. 1192 */ 1193 typedef int (*port_discard_set_f)( 1194 int unit, 1195 bcm_port_t port, 1196 int mode); 1197 1198 /*! 1199 * \brief Get port discard attributes. 1200 * 1201 * \param [in] unit Unit Number. 1202 * \param [in] port Port Number. 1203 * \param [out] mode Port discard mode, BCM_PORT_DISCARD_xxx. 1204 * 1205 * \retval SHR_E_NONE No errors. 1206 * \retval !SHR_E_NONE Failure. 1207 */ 1208 typedef int (*port_discard_get_f)( 1209 int unit, 1210 bcm_port_t port, 1211 int *mode); 1212 1213 /*! 1214 * \brief Set packet priority and cfi to internal priority and congestion mapping. 1215 * 1216 * \param [in] unit Unit Number. 1217 * \param [in] port Port Number. 1218 * \param [in] pri Packet 802.1p priority. -1 means any priority. 1219 * \param [in] cfi Packet CFI. -1 means any CFI. 1220 * \param [in] int_pri Internal priority. -1 means not to change it. 1221 * \param [in] cng Congestion. -1 means not to change it. 1222 * 1223 * \retval SHR_E_NONE No errors. 1224 * \retval !SHR_E_NONE Failure. 1225 */ 1226 typedef int (*port_vlan_phb_map_set_f)( 1227 int unit, 1228 bcm_port_t port, 1229 int pri, 1230 int cfi, 1231 int int_pri, 1232 int cng); 1233 1234 /*! 1235 * \brief Get packet priority and cfi to internal priority and congestion mapping. 1236 * 1237 * \param [in] unit Unit Number. 1238 * \param [in] port Port Number. 1239 * \param [in] pri Packet 802.1p priority. -1 means first priority. 1240 * \param [in] cfi Packet CFI. -1 means first CFI. 1241 * \param [out] int_pri Internal priority. NULL means not to get it. 1242 * \param [out] cng Congestion. NULL means not to get it. 1243 * 1244 * \retval SHR_E_NONE No errors. 1245 * \retval !SHR_E_NONE Failure. 1246 */ 1247 typedef int (*port_vlan_phb_map_get_f)( 1248 int unit, 1249 bcm_port_t port, 1250 int pri, 1251 int cfi, 1252 int *int_pri, 1253 int *cng); 1254 1255 /*! 1256 * \brief Set DSCP remapping, and DSCP to internal priority and congestion mapping. 1257 * 1258 * \param [in] unit Unit Number. 1259 * \param [in] port Port Number. 1260 * \param [in] srccp Source DSCP. -1 means any DSCP. 1261 * \param [in] mapcp Mapped DSCP. -1 means not to change it. 1262 * \param [in] int_pri Internal priority. -1 means not to change it. 1263 * \param [in] cng Congestion. -1 means not to change it. 1264 * 1265 * \retval SHR_E_NONE No errors. 1266 * \retval !SHR_E_NONE Failure. 1267 */ 1268 typedef int (*port_dscp_phb_map_set_f)( 1269 int unit, 1270 bcm_port_t port, 1271 int srccp, 1272 int mapcp, 1273 int int_pri, 1274 int cng); 1275 1276 /*! 1277 * \brief Get DSCP remapping, and DSCP to internal priority and congestion mapping. 1278 * 1279 * \param [in] unit Unit Number. 1280 * \param [in] port Port Number. 1281 * \param [in] srccp Source DSCP. -1 means first DSCP. 1282 * \param [out] mapcp Mapped DSCP. NULL means not to get it. 1283 * \param [out] int_pri Internal priority. NULL means not to get it. 1284 * \param [out] cng Congestion. NULL means not to get it. 1285 * 1286 * \retval SHR_E_NONE No errors. 1287 * \retval !SHR_E_NONE Failure. 1288 */ 1289 typedef int (*port_dscp_phb_map_get_f)( 1290 int unit, 1291 bcm_port_t port, 1292 int srccp, 1293 int *mapcp, 1294 int *int_pri, 1295 int *cng); 1296 1297 /*! 1298 * \brief Set internal priority and congestion to packet priority and cfi mapping. 1299 * 1300 * \param [in] unit Unit Number. 1301 * \param [in] port Port Number. 1302 * \param [in] int_pri Internal priority. -1 means any internal priority. 1303 * \param [in] cng Congestion. -1 means any congestion. 1304 * \param [in] pri Packet 802.1p priority. -1 means not to change it. 1305 * \param [in] cfi Packet CFI. -1 means not to change it. 1306 * 1307 * \retval SHR_E_NONE No errors. 1308 * \retval !SHR_E_NONE Failure. 1309 */ 1310 typedef int (*port_phb_vlan_map_set_f)( 1311 int unit, 1312 bcm_port_t port, 1313 int int_pri, 1314 int cng, 1315 int pri, 1316 int cfi); 1317 1318 /*! 1319 * \brief Get internal priority and congestion to packet priority and cfi mapping. 1320 * 1321 * \param [in] unit Unit Number. 1322 * \param [in] port Port Number. 1323 * \param [in] int_pri Internal priority. -1 means first internal priority. 1324 * \param [in] cng Congestion. -1 means first congestion. 1325 * \param [out] pri Packet 802.1p priority. NULL means not to get it. 1326 * \param [out] cfi Packet CFI. NULL means not to get it. 1327 * 1328 * \retval SHR_E_NONE No errors. 1329 * \retval !SHR_E_NONE Failure. 1330 */ 1331 typedef int (*port_phb_vlan_map_get_f)( 1332 int unit, 1333 bcm_port_t port, 1334 int int_pri, 1335 int cng, 1336 int *pri, 1337 int *cfi); 1338 1339 /*! 1340 * \brief Set internal priority and congestion to packet DSCP mapping. 1341 * 1342 * \param [in] unit Unit Number. 1343 * \param [in] port Port Number. 1344 * \param [in] int_pri Internal priority. -1 means any internal priority. 1345 * \param [in] cng Congestion. -1 means any congestion. 1346 * \param [in] dscp DSCP marking on outgoing packet. -1 means not to change it. 1347 * 1348 * \retval SHR_E_NONE No errors. 1349 * \retval !SHR_E_NONE Failure. 1350 */ 1351 typedef int (*port_phb_dscp_map_set_f)( 1352 int unit, 1353 bcm_port_t port, 1354 int int_pri, 1355 int cng, 1356 int dscp); 1357 1358 /*! 1359 * \brief Get internal priority and congestion to packet DSCP mapping. 1360 * 1361 * \param [in] unit Unit Number. 1362 * \param [in] port Port Number. 1363 * \param [in] int_pri Internal priority. -1 means first internal priority. 1364 * \param [in] cng Congestion. -1 means first congestion. 1365 * \param [out] dscp DSCP marking on outgoing packet. NULL means not to get it. 1366 * 1367 * \retval SHR_E_NONE No errors. 1368 * \retval !SHR_E_NONE Failure. 1369 */ 1370 typedef int (*port_phb_dscp_map_get_f)( 1371 int unit, 1372 bcm_port_t port, 1373 int int_pri, 1374 int cng, 1375 int *dscp); 1376 1377 /*! 1378 * \brief Set DSCP mapping mode. 1379 * 1380 * \param [in] unit Unit Number. 1381 * \param [in] port Port Number. 1382 * \param [in] mode DSCP mapping mode. 1383 * 1384 * \retval SHR_E_NONE No errors. 1385 * \retval !SHR_E_NONE Failure. 1386 */ 1387 typedef int (*port_dscp_phb_map_mode_set_f)( 1388 int unit, 1389 bcm_port_t port, 1390 int mode); 1391 1392 /*! 1393 * \brief Get DSCP mapping mode. 1394 * 1395 * \param [in] unit Unit Number. 1396 * \param [in] port Port Number. 1397 * \param [out] mode DSCP mapping mode. 1398 * 1399 * \retval SHR_E_NONE No errors. 1400 * \retval !SHR_E_NONE Failure. 1401 */ 1402 typedef int (*port_dscp_phb_map_mode_get_f)( 1403 int unit, 1404 bcm_port_t port, 1405 int *mode); 1406 1407 /*! 1408 * \brief Enable/Disable BPDU reception on the specified port. 1409 * 1410 * \param [in] unit Unit Number. 1411 * \param [in] port Port Number. 1412 * \param [in] enable TRUE to enable, FALSE to disable (reject bpdu). 1413 * 1414 * \retval SHR_E_NONE No errors. 1415 * \retval !SHR_E_NONE Failure. 1416 */ 1417 typedef int (*port_bpdu_enable_set_f)( 1418 int unit, 1419 bcm_port_t port, 1420 int enable); 1421 1422 /*! 1423 * \brief Return whether BPDU reception is enabled on the specified port. 1424 * 1425 * \param [in] unit Unit Number. 1426 * \param [in] port Port Number. 1427 * \param [out] enable TRUE if enabled, FALSE if disabled 1428 * 1429 * \retval SHR_E_NONE No errors. 1430 * \retval !SHR_E_NONE Failure. 1431 */ 1432 typedef int (*port_bpdu_enable_get_f)( 1433 int unit, 1434 bcm_port_t port, 1435 int *enable); 1436 1437 /*! 1438 * \brief Set egress shaper information. 1439 * 1440 * \param [in] unit Unit Number. 1441 * \param [in] port Port Number. 1442 * \param [in] bandwidth Port bandwidth in kbps or pps. 0 means shaper is disabled. 1443 * \param [in] burst Maximum burst size in kbits or packets. 1444 * \param [in] mode Byte mode or packet mode. 1445 * 1446 * \retval SHR_E_NONE No errors. 1447 * \retval !SHR_E_NONE Failure. 1448 */ 1449 typedef int (*port_egr_shaper_set_f)( 1450 int unit, 1451 bcm_port_t port, 1452 uint32_t bandwidth, 1453 uint32_t burst, 1454 bcmi_ltsw_port_shaper_mode_t mode); 1455 1456 /*! 1457 * \brief Get egress shaper information. 1458 * 1459 * \param [in] unit Unit Number. 1460 * \param [in] port Port Number. 1461 * \param [out] bandwidth Port bandwidth in kbps or pps. 1462 * \param [out] burst Maximum burst size in kbits or packets. 1463 * \param [out] mode Byte mode or packet mode. 1464 * 1465 * \retval SHR_E_NONE No errors. 1466 * \retval !SHR_E_NONE Failure. 1467 */ 1468 typedef int (*port_egr_shaper_get_f)( 1469 int unit, 1470 bcm_port_t port, 1471 uint32_t *bandwidth, 1472 uint32_t *burst, 1473 bcmi_ltsw_port_shaper_mode_t *mode); 1474 1475 /*! 1476 * \brief Validate egress shaper settings. 1477 * 1478 * \param [in] unit Unit Number. 1479 * \param [in] port Port Number. 1480 * \param [in] bandwidth Port bandwidth in kbps or pps. 0 means shaper is disabled. 1481 * \param [in] burst Maximum burst size in kbits or packets. 1482 * \param [in] mode Byte mode or packet mode. 1483 * 1484 * \retval SHR_E_NONE No errors. 1485 * \retval !SHR_E_NONE Failure. 1486 */ 1487 typedef int (*port_egr_shaper_validate_f)( 1488 int unit, 1489 bcm_port_t port, 1490 uint32_t bandwidth, 1491 uint32_t burst, 1492 bcmi_ltsw_port_shaper_mode_t mode); 1493 1494 /*! 1495 * \brief Validate port class settings. 1496 * 1497 * \param [in] unit Unit Number. 1498 * \param [inout] port Port Number. 1499 * \param [in] class Classification type. 1500 * \param [in] class_id Class ID of the port. 1501 * 1502 * \retval SHR_E_NONE No errors. 1503 * \retval !SHR_E_NONE Failure. 1504 */ 1505 typedef int (*port_class_validate_f)( 1506 int unit, 1507 bcm_port_t *port, 1508 bcm_port_class_t class, 1509 uint32_t class_id); 1510 1511 /*! 1512 * \brief Get port group range based on destination type. 1513 * 1514 * \param [in] unit Unit Number. 1515 * \param [in] type Destination type. 1516 * \param [out] range Range of port group. 1517 * 1518 * \retval SHR_E_NONE No errors. 1519 * \retval !SHR_E_NONE Failure. 1520 */ 1521 typedef int (*port_group_range_get_f)( 1522 int unit, 1523 bcm_port_group_type_t type, 1524 bcm_port_group_range_t *range); 1525 1526 /*! 1527 * \brief Get the count of packets (or cells) currently buffered for a port. 1528 * 1529 * \param [in] unit Unit Number. 1530 * \param [in] port Port Number. 1531 * \param [out] count Count of packets (or cells) currently buffered. 1532 * 1533 * \retval SHR_E_NONE No errors. 1534 * \retval !SHR_E_NONE Failure. 1535 */ 1536 typedef int (*port_queue_count_get_f)( 1537 int unit, 1538 bcm_port_t port, 1539 uint32_t *count); 1540 1541 /*! 1542 * \brief Check flexport input parameters and port status are valid. 1543 * 1544 * \param [in] unit Unit Number. 1545 * \param [in] resource Flexport internal resource. 1546 * 1547 * \retval SHR_E_NONE No errors. 1548 * \retval !SHR_E_NONE Failure. 1549 */ 1550 typedef int (*flexport_input_validate_f)( 1551 int unit, 1552 ltsw_flexport_resource_t *resource); 1553 1554 /*! 1555 * \brief Check device has enough resource to complete all operations. 1556 * 1557 * \param [in] unit Unit Number. 1558 * \param [in] resource Flexport internal resource. 1559 * 1560 * \retval SHR_E_NONE No errors. 1561 * \retval !SHR_E_NONE Failure. 1562 */ 1563 typedef int (*flexport_resource_validate_f)( 1564 int unit, 1565 ltsw_flexport_resource_t *resource); 1566 1567 /*! 1568 * \brief check if Portmacro accommodate the new speed. 1569 * 1570 * \param [in] unit Unit Number. 1571 * \param [in] speed_resource speed resource. 1572 * \param [out] affected_ports Bitmap of affected ports. 1573 * 1574 * \retval SHR_E_NONE No errors. 1575 * \retval !SHR_E_NONE Failure. 1576 */ 1577 typedef int (*port_speed_config_validate_f)( 1578 int unit, 1579 bcm_port_resource_t *speed_resource, 1580 bcm_pbmp_t *affected_ports); 1581 1582 /*! 1583 * \brief Check if the device has enough resource to complete all operations and rearrange ports in one pm. 1584 * 1585 * \param [in] unit Unit Number. 1586 * \param [in] nport Port number. 1587 * \param [in] port_resource Port configuration resource. 1588 * \param [in] original_tvco PM original tvco. 1589 * 1590 * \retval SHR_E_NONE No errors. 1591 * \retval !SHR_E_NONE Failure. 1592 */ 1593 typedef int (*pm_port_init_adjust_f)( 1594 int unit, 1595 int nport, 1596 ltsw_flexport_port_cfg_t *port_resource, 1597 int original_tvco); 1598 1599 /*! 1600 * \brief Attach ports to the BCM layer and initialize them to the default state. 1601 * 1602 * \param [in] unit Unit Number. 1603 * \param [in] resource Flexport internal resource. 1604 * 1605 * \retval SHR_E_NONE No errors. 1606 * \retval !SHR_E_NONE Failure. 1607 */ 1608 typedef int (*flexport_resource_attach_f)( 1609 int unit, 1610 ltsw_flexport_resource_t *resource); 1611 1612 /*! 1613 * \brief Detach ports from the BCM layer. 1614 * 1615 * \param [in] unit Unit Number. 1616 * \param [in] resource Flexport internal resource. 1617 * 1618 * \retval SHR_E_NONE No errors. 1619 * \retval !SHR_E_NONE Failure. 1620 */ 1621 typedef int (*flexport_resource_detach_f)( 1622 int unit, 1623 ltsw_flexport_resource_t *resource); 1624 1625 /*! 1626 * \brief Update the port resource status to depedent modules after flex operation. 1627 * 1628 * \param [in] unit Unit Number. 1629 * \param [in] resource Flexport internal resource. 1630 * 1631 * \retval SHR_E_NONE No errors. 1632 * \retval !SHR_E_NONE Failure. 1633 */ 1634 typedef int (*flexport_resource_status_update_f)( 1635 int unit, 1636 ltsw_flexport_resource_t *resource); 1637 1638 /*! 1639 * \brief Attach counter entries to the given port. 1640 * 1641 * \param [in] unit Unit Number. 1642 * \param [in] port Port Number. 1643 * \param [in] stat_id Stat Counter ID. 1644 * 1645 * \retval SHR_E_NONE No errors. 1646 * \retval !SHR_E_NONE Failure. 1647 */ 1648 typedef int (*port_stat_attach_f)( 1649 int unit, 1650 bcm_port_t port, 1651 uint32_t stat_id); 1652 1653 /*! 1654 * \brief Detach counter entries to given port. 1655 * 1656 * \param [in] unit Unit Number. 1657 * \param [in] port Port Number. 1658 * \param [in] stat_id Stat Counter ID. 1659 * 1660 * \retval SHR_E_NONE No errors. 1661 * \retval !SHR_E_NONE Failure. 1662 */ 1663 typedef int (*port_stat_detach_f)( 1664 int unit, 1665 bcm_port_t port, 1666 uint32_t stat_id); 1667 1668 /*! 1669 * \brief Attach flex state action to the given port. 1670 * 1671 * \param [in] unit Unit Number. 1672 * \param [in] port Port Number. 1673 * \param [in] action_id Flex state ID. 1674 * 1675 * \retval SHR_E_NONE No errors. 1676 * \retval !SHR_E_NONE Failure. 1677 */ 1678 typedef int (*port_flexstate_attach_f)( 1679 int unit, 1680 bcm_port_t port, 1681 uint32_t action_id); 1682 1683 /*! 1684 * \brief Detach flex state action to given port. 1685 * 1686 * \param [in] unit Unit Number. 1687 * \param [in] port Port Number. 1688 * \param [in] action_id Flex state ID. 1689 * 1690 * \retval SHR_E_NONE No errors. 1691 * \retval !SHR_E_NONE Failure. 1692 */ 1693 typedef int (*port_flexstate_detach_f)( 1694 int unit, 1695 bcm_port_t port, 1696 uint32_t action_id); 1697 1698 /*! 1699 * \brief Set selective per-port blocking of flooded traffic. 1700 * 1701 * \param [in] unit Unit Number. 1702 * \param [in] ing_port Ingress port. 1703 * \param [in] egr_port Egress port. 1704 * \param [in] flags Specifies the type of traffic to block. 1705 * 1706 * \retval SHR_E_NONE No errors. 1707 * \retval !SHR_E_NONE Failure. 1708 */ 1709 typedef int (*port_flood_block_set_f)( 1710 int unit, 1711 bcm_port_t ing_port, 1712 bcm_port_t egr_port, 1713 uint32_t flags); 1714 1715 /*! 1716 * \brief Get the current per-port flood block settings. 1717 * 1718 * \param [in] unit Unit Number. 1719 * \param [in] ing_port Ingress port. 1720 * \param [in] egr_port Egress port. 1721 * \param [out] flags Specifies the type of traffic to block. 1722 * 1723 * \retval SHR_E_NONE No errors. 1724 * \retval !SHR_E_NONE Failure. 1725 */ 1726 typedef int (*port_flood_block_get_f)( 1727 int unit, 1728 bcm_port_t ing_port, 1729 bcm_port_t egr_port, 1730 uint32_t *flags); 1731 1732 /*! 1733 * \brief Set switching only to indicated ports from given (modid, port). 1734 * 1735 * \param [in] unit Unit Number. 1736 * \param [in] port Ingress port or gport. 1737 * \param [in] modid Source module ID. 1738 * \param [in] pbmp Bitmap of ports to allow egress. 1739 * 1740 * \retval SHR_E_NONE No errors. 1741 * \retval !SHR_E_NONE Failure. 1742 */ 1743 typedef int (*port_egress_set_f)( 1744 int unit, 1745 bcm_port_t port, 1746 int modid, 1747 bcm_pbmp_t pbmp); 1748 1749 /*! 1750 * \brief Retrieve bitmap of ports for which switching is enabled for (modid, port). 1751 * 1752 * \param [in] unit Unit Number. 1753 * \param [in] port Ingress port or gport. 1754 * \param [in] modid Source module ID. 1755 * \param [out] pbmp Bitmap of ports where egress allowed. 1756 * 1757 * \retval SHR_E_NONE No errors. 1758 * \retval !SHR_E_NONE Failure. 1759 */ 1760 typedef int (*port_egress_get_f)( 1761 int unit, 1762 bcm_port_t port, 1763 int modid, 1764 bcm_pbmp_t *pbmp); 1765 1766 /*! 1767 * \brief Add a match to an existing port. 1768 * 1769 * \param [in] unit Unit Number. 1770 * \param [in] port Port Number. 1771 * \param [in] match Match criteria. 1772 * 1773 * \retval SHR_E_NONE No errors. 1774 * \retval !SHR_E_NONE Failure. 1775 */ 1776 typedef int (*port_match_add_f)( 1777 int unit, 1778 bcm_port_t port, 1779 bcm_port_match_info_t *match); 1780 1781 /*! 1782 * \brief Remove a match from an existing port. 1783 * 1784 * \param [in] unit Unit Number. 1785 * \param [in] port Port Number. 1786 * \param [in] match Match criteria. 1787 * 1788 * \retval SHR_E_NONE No errors. 1789 * \retval !SHR_E_NONE Failure. 1790 */ 1791 typedef int (*port_match_delete_f)( 1792 int unit, 1793 bcm_port_t port, 1794 bcm_port_match_info_t *match); 1795 1796 /*! 1797 * \brief Get all the matches for an existing port. 1798 * 1799 * \param [in] unit Unit Number. 1800 * \param [in] port Port Number. 1801 * \param [in] size Number of elements in match array. 1802 * \param [out] array Match criteria array. 1803 * \param [out] count Match count. 1804 * 1805 * \retval SHR_E_NONE No errors. 1806 * \retval !SHR_E_NONE Failure. 1807 */ 1808 typedef int (*port_match_multi_get_f)( 1809 int unit, 1810 bcm_port_t port, 1811 int size, 1812 bcm_port_match_info_t *array, 1813 int *count); 1814 1815 /*! 1816 * \brief Set port HG3 enable. 1817 * 1818 * \param [in] unit Unit Number. 1819 * \param [in] port Port Number. 1820 * \param [in] enable HG3 enable. 1821 * 1822 * \retval SHR_E_NONE No errors. 1823 * \retval !SHR_E_NONE Failure. 1824 */ 1825 typedef int (*port_hg3_enable_set_f)( 1826 int unit, 1827 bcm_port_t port, 1828 int enable); 1829 1830 /*! 1831 * \brief Get port HG3 enable. 1832 * 1833 * \param [in] unit Unit Number. 1834 * \param [in] port Port Number. 1835 * \param [out] enable HG3 enable. 1836 * 1837 * \retval SHR_E_NONE No errors. 1838 * \retval !SHR_E_NONE Failure. 1839 */ 1840 typedef int (*port_hg3_enable_get_f)( 1841 int unit, 1842 bcm_port_t port, 1843 int *enable); 1844 1845 /*! 1846 * \brief Set HG3 Ethernet Type. 1847 * 1848 * \param [in] unit Unit Number. 1849 * \param [in] type HG3 Ethernet Type. 1850 * 1851 * \retval SHR_E_NONE No errors. 1852 * \retval !SHR_E_NONE Failure. 1853 */ 1854 typedef int (*port_hg3_eth_type_set_f)( 1855 int unit, 1856 int type); 1857 1858 /*! 1859 * \brief Get HG3 Ethernet Type. 1860 * 1861 * \param [in] unit Unit Number. 1862 * \param [out] type HG3 Ethernet Type. 1863 * 1864 * \retval SHR_E_NONE No errors. 1865 * \retval !SHR_E_NONE Failure. 1866 */ 1867 typedef int (*port_hg3_eth_type_get_f)( 1868 int unit, 1869 int *type); 1870 1871 /*! 1872 * \brief Get the list of ancillary ports belonging to the same port block as the controlling port. 1873 * 1874 * \param [in] unit Unit Number. 1875 * \param [in] port Controlling port. 1876 * \param [out] pbmp Ports belonging to the controlling port. 1877 * 1878 * \retval SHR_E_NONE No errors. 1879 * \retval !SHR_E_NONE Failure. 1880 */ 1881 typedef int (*port_subsidiary_ports_get_f)( 1882 int unit, 1883 bcm_port_t port, 1884 bcm_pbmp_t *pbmp); 1885 1886 /*! 1887 * \brief Get the spec of port module resources. 1888 * 1889 * \param [in] unit Unit Number. 1890 * \param [in] type Resource type. 1891 * \param [out] spec Spec of identified resource. 1892 * 1893 * \retval SHR_E_NONE No errors. 1894 * \retval !SHR_E_NONE Failure. 1895 */ 1896 typedef int (*port_resource_spec_get_f)( 1897 int unit, 1898 bcmi_ltsw_port_resource_type_t type, 1899 const bcmi_ltsw_port_resource_spec_t **spec); 1900 1901 /*! 1902 * \brief Enable egress VLAN membership check for IFP redirection. 1903 * 1904 * \param [in] unit Unit Number. 1905 * \param [in] enable Enable or disable. 1906 * 1907 * \retval SHR_E_NONE No errors. 1908 * \retval !SHR_E_NONE Failure. 1909 */ 1910 typedef int (*port_ifp_egr_vlan_check_enable_set_f)( 1911 int unit, 1912 uint32_t enable); 1913 1914 /*! 1915 * \brief Get egress VLAN membership check enable for IFP redirection. 1916 * 1917 * \param [in] unit Unit Number. 1918 * \param [out] enable Enable or disable. 1919 * 1920 * \retval SHR_E_NONE No errors. 1921 * \retval !SHR_E_NONE Failure. 1922 */ 1923 typedef int (*port_ifp_egr_vlan_check_enable_get_f)( 1924 int unit, 1925 uint32_t *enable); 1926 1927 /*! 1928 * \brief Get flags to disable VLAN membership check. 1929 * 1930 * \param [in] unit Unit Number. 1931 * \param [in] port Port Number. 1932 * \param [out] flags Flags to disable VLAN membership check. 1933 * 1934 * \retval SHR_E_NONE No errors. 1935 * \retval !SHR_E_NONE Failure. 1936 */ 1937 typedef int (*port_vlan_check_disable_get_f)( 1938 int unit, 1939 bcm_port_t port, 1940 uint16_t *flags); 1941 1942 /*! 1943 * \brief Get flags to disable STG check. 1944 * 1945 * \param [in] unit Unit Number. 1946 * \param [in] port Port Number. 1947 * \param [out] flags Flags to disable STG check. 1948 * 1949 * \retval SHR_E_NONE No errors. 1950 * \retval !SHR_E_NONE Failure. 1951 */ 1952 typedef int (*port_stg_check_disable_get_f)( 1953 int unit, 1954 bcm_port_t port, 1955 uint16_t *flags); 1956 1957 /*! 1958 * \brief Dump port sw infomation. 1959 * 1960 * \param [in] unit Unit Number. 1961 * 1962 * \retval SHR_E_NONE No errors. 1963 * \retval !SHR_E_NONE Failure. 1964 */ 1965 typedef int (*port_dump_sw_f)(int unit); 1966 1967 /*! 1968 * \brief Allocate an ID from L2_IF pool. 1969 * 1970 * \param [in] unit Unit Number. 1971 * \param [out] l2_if Allocated ID. 1972 * 1973 * \retval SHR_E_NONE No errors. 1974 * \retval SHR_E_EMPTY No available ID to allocacte. 1975 * \retval !SHR_E_NONE Failure. 1976 */ 1977 typedef int (*l2_if_alloc_f)( 1978 int unit, 1979 int *l2_if); 1980 1981 /*! 1982 * \brief Free an ID to L2_IF pool. 1983 * 1984 * \param [in] unit Unit Number. 1985 * \param [in] l2_if ID to free. 1986 * 1987 * \retval SHR_E_NONE No errors. 1988 * \retval SHR_E_FULL The ID is already free. 1989 * \retval !SHR_E_NONE Failure. 1990 */ 1991 typedef int (*l2_if_free_f)( 1992 int unit, 1993 int l2_if); 1994 1995 /*! 1996 * \brief Dump L2_IF pool. 1997 * 1998 * \param [in] unit Unit Number. 1999 * 2000 * \retval SHR_E_NONE No errors. 2001 * \retval !SHR_E_NONE Failure. 2002 */ 2003 typedef int (*l2_if_dump_f)(int unit); 2004 2005 /*! 2006 * \brief Set the configuration for Flight Data Recorder (FDR) on a port. 2007 * 2008 * \param [in] unit Unit Number. 2009 * \param [in] port Port number. 2010 * \param [in] fdr_config Flight Data Recorder (FDR) configuration 2011 * 2012 * \retval SHR_E_NONE No errors. 2013 * \retval !SHR_E_NONE Failure. 2014 */ 2015 typedef int (*port_fdr_config_set_f)( 2016 int unit, 2017 bcm_port_t port, 2018 bcm_port_fdr_config_t *fdr_config); 2019 2020 /*! 2021 * \brief Get the configuration for Flight Data Recorder (FDR) on a port. 2022 * 2023 * \param [in] unit Unit Number. 2024 * \param [in] port Port number. 2025 * \param [out] fdr_config Flight Data Recorder (FDR) configuration 2026 * 2027 * \retval SHR_E_NONE No errors. 2028 * \retval !SHR_E_NONE Failure. 2029 */ 2030 typedef int (*port_fdr_config_get_f)( 2031 int unit, 2032 bcm_port_t port, 2033 bcm_port_fdr_config_t *fdr_config); 2034 2035 /*! 2036 * \brief Get the statistics of Flight Data Recorder (FDR) on a port. 2037 * 2038 * \param [in] unit Unit Number. 2039 * \param [in] port Port number. 2040 * \param [out] fdr_stats Flight Data Recorder (FDR) statistics 2041 * 2042 * \retval SHR_E_NONE No errors. 2043 * \retval !SHR_E_NONE Failure. 2044 */ 2045 typedef int (*port_fdr_stats_get_f)( 2046 int unit, 2047 bcm_port_t port, 2048 bcm_port_fdr_stats_t *fdr_stats); 2049 2050 /*! 2051 * \brief Register port Flight Data Recorder (FDR) interrupt notification callbacks. 2052 * 2053 * \param [in] unit Unit Number. 2054 * \param [in] f Flight Data Recorder (FDR) callback 2055 * \param [in] user_data user data pointer 2056 * 2057 * \retval SHR_E_NONE No errors. 2058 * \retval !SHR_E_NONE Failure. 2059 */ 2060 typedef int (*port_fdr_callback_register_f)( 2061 int unit, 2062 bcm_port_fdr_handler_t f, 2063 void *user_data); 2064 2065 /*! 2066 * \brief Unregister port Flight Data Recorder (FDR) interrupt notification callbacks. 2067 * 2068 * \param [in] unit Unit Number. 2069 * \param [in] f Flight Data Recorder (FDR) callback 2070 * \param [in] user_data user data pointer 2071 * 2072 * \retval SHR_E_NONE No errors. 2073 * \retval !SHR_E_NONE Failure. 2074 */ 2075 typedef int (*port_fdr_callback_unregister_f)( 2076 int unit, 2077 bcm_port_fdr_handler_t f, 2078 void *user_data); 2079 2080 /*! 2081 * \brief Port driver structure. 2082 */ 2083 typedef struct mbcm_ltsw_port_drv_s { 2084 2085 /*! Initialize device specific information. */ 2086 port_info_init_f port_info_init; 2087 2088 /*! Initialize device specific information for a port. */ 2089 port_info_init_per_port_f port_info_init_per_port; 2090 2091 /*! De-initialize device specific information. */ 2092 port_info_deinit_f port_info_deinit; 2093 2094 /*! Recover device specific information. */ 2095 port_info_recover_f port_info_recover; 2096 2097 /*! Initialize port profile tables. */ 2098 port_profile_init_f port_profile_init; 2099 2100 /*! De-initialize port profile tables. */ 2101 port_profile_deinit_f port_profile_deinit; 2102 2103 /*! Initialize basic port pipeline configuration. */ 2104 port_service_init_f port_service_init; 2105 2106 /*! De-initialize basic port pipeline configuration. */ 2107 port_service_deinit_f port_service_deinit; 2108 2109 /*! Port module misc init. */ 2110 port_misc_init_f port_misc_init; 2111 2112 /*! Port module misc deinit. */ 2113 port_misc_deinit_f port_misc_deinit; 2114 2115 /*! Port database initialization. */ 2116 port_db_init_f port_db_init; 2117 2118 /*! Set the status of specified port feature. */ 2119 port_control_set_f port_control_set; 2120 2121 /*! Get the status of specified port feature. */ 2122 port_control_get_f port_control_get; 2123 2124 /*! Control the sampling of packets ingressing or egressing a port. */ 2125 port_sample_rate_set_f port_sample_rate_set; 2126 2127 /*! Get the sampling rate of packets ingressing or egressing a port. */ 2128 port_sample_rate_get_f port_sample_rate_get; 2129 2130 /*! Update profile for a port. */ 2131 port_profile_lport_tab_update_f port_profile_lport_tab_update; 2132 2133 /*! Add profile. */ 2134 port_profile_port_pkt_ctrl_add_f port_profile_port_pkt_ctrl_add; 2135 2136 /*! Get profile from LT. */ 2137 port_profile_port_pkt_ctrl_get_f port_profile_port_pkt_ctrl_get; 2138 2139 /*! Delete profile. */ 2140 port_profile_port_pkt_ctrl_delete_f port_profile_port_pkt_ctrl_delete; 2141 2142 /*! Recover hash and reference count for profile. */ 2143 port_profile_port_pkt_ctrl_recover_f port_profile_port_pkt_ctrl_recover; 2144 2145 /*! Update one field of PORT_PKT_CONTROL. */ 2146 port_profile_port_pkt_ctrl_update_f port_profile_port_pkt_ctrl_update; 2147 2148 /*! Get one field value of PORT_PKT_CONTROL. */ 2149 port_profile_port_pkt_ctrl_field_get_f port_profile_port_pkt_ctrl_field_get; 2150 2151 /*! Add specified entry to L2_IF based tables. */ 2152 l2_if_add_f l2_if_add; 2153 2154 /*! Delete specified entry of L2_IF based tables. */ 2155 l2_if_del_f l2_if_del; 2156 2157 /*! Get port from L2 interface. */ 2158 l2_if_to_port_f l2_if_to_port; 2159 2160 /*! Get L2 interface from port. */ 2161 port_to_l2_if_f port_to_l2_if; 2162 2163 /*! Get port mask from L2 interface mask. */ 2164 l2_if_mask_to_port_mask_f l2_if_mask_to_port_mask; 2165 2166 /*! Get L2 interface mask from port mask. */ 2167 port_mask_to_l2_if_mask_f port_mask_to_l2_if_mask; 2168 2169 /*! Get which pipes are using identified L2 interface. */ 2170 l2_if_to_pipes_f l2_if_to_pipes; 2171 2172 /*! Add specified entry to System Port based tables. */ 2173 sys_port_add_f sys_port_add; 2174 2175 /*! Delete specified entry of System Port based tables. */ 2176 sys_port_del_f sys_port_del; 2177 2178 /*! Change the system port of a port. The settings of the old system port is moved to the new system port. The old system port is deleted then. */ 2179 port_sys_port_move_f port_sys_port_move; 2180 2181 /*! Get gport from system port. */ 2182 sys_port_to_port_f sys_port_to_port; 2183 2184 /*! Get system port from port or gport. */ 2185 port_to_sys_port_f port_to_sys_port; 2186 2187 /*! Get system ports from port or gport. */ 2188 port_to_sys_ports_f port_to_sys_ports; 2189 2190 /*! Map System Port with L2 interface. */ 2191 sys_port_map_l2_if_f sys_port_map_l2_if; 2192 2193 /*! Demap System Port and L2 interface. */ 2194 sys_port_demap_l2_if_f sys_port_demap_l2_if; 2195 2196 /*! Traverse over all system ports. */ 2197 sys_port_traverse_f sys_port_traverse; 2198 2199 /*! Get logic table info from port tab type. */ 2200 port_tabs_info_get_f port_tabs_info_get; 2201 2202 /*! Get operation flags for logic table access. */ 2203 port_tabs_op_get_f port_tabs_op_get; 2204 2205 /*! Get parameters for logic table access. */ 2206 port_tabs_para_get_f port_tabs_para_get; 2207 2208 /*! Set the ARL hardware learning options for this port. */ 2209 port_learn_set_f port_learn_set; 2210 2211 /*! Get the ARL hardware learning options for this port. */ 2212 port_learn_get_f port_learn_get; 2213 2214 /*! Enable/Disable L3 switching on the specified port. */ 2215 port_l3_enable_set_f port_l3_enable_set; 2216 2217 /*! Return whether L3 switching is enabled on the specified port. */ 2218 port_l3_enable_get_f port_l3_enable_get; 2219 2220 /*! Set the maximum L3 frame size for the port. */ 2221 port_l3_mtu_set_f port_l3_mtu_set; 2222 2223 /*! Get the maximum L3 frame size for the port. */ 2224 port_l3_mtu_get_f port_l3_mtu_get; 2225 2226 /*! Set the L3 multicast options for the port. */ 2227 port_ipmc_modify_set_f port_ipmc_modify_set; 2228 2229 /*! Get the L3 multicast options for the port. */ 2230 port_ipmc_modify_get_f port_ipmc_modify_get; 2231 2232 /*! Add allowed TPID for a port. */ 2233 port_tpid_add_f port_tpid_add; 2234 2235 /*! Set the default Tag Protocol ID for a port. */ 2236 port_tpid_set_f port_tpid_set; 2237 2238 /*! Retrieve the default Tag Protocol ID for a port. */ 2239 port_tpid_get_f port_tpid_get; 2240 2241 /*! Get a list of tpids and associated color selections for a given port. */ 2242 port_tpid_get_all_f port_tpid_get_all; 2243 2244 /*! Delete allowed TPID for a port. */ 2245 port_tpid_delete_f port_tpid_delete; 2246 2247 /*! Delete all allowed TPID for a port. */ 2248 port_tpid_delete_all_f port_tpid_delete_all; 2249 2250 /*! Set the expected TPID for the inner tag in double-tagging mode. */ 2251 port_inner_tpid_set_f port_inner_tpid_set; 2252 2253 /*! Get the expected TPID for the inner tag in double-tagging mode. */ 2254 port_inner_tpid_get_f port_inner_tpid_get; 2255 2256 /*! Set the default VLAN ID for received untagged packets on a port. */ 2257 port_untagged_vlan_set_f port_untagged_vlan_set; 2258 2259 /*! Retrieve the default VLAN ID for received untagged packets on a port. */ 2260 port_untagged_vlan_get_f port_untagged_vlan_get; 2261 2262 /*! Set the 802.1p priority for received untagged packets on a port. */ 2263 port_untagged_priority_set_f port_untagged_priority_set; 2264 2265 /*! Retrieve the 802.1p priority for received untagged packets on a port. */ 2266 port_untagged_priority_get_f port_untagged_priority_get; 2267 2268 /*! Set the private VLAN attribute of a port. */ 2269 port_force_vlan_set_f port_force_vlan_set; 2270 2271 /*! Get the private VLAN attribute of a port. */ 2272 port_force_vlan_get_f port_force_vlan_get; 2273 2274 /*! Set the trunk group for a given port. */ 2275 port_tgid_set_f port_tgid_set; 2276 2277 /*! Get the trunk group for a given port. */ 2278 port_tgid_get_f port_tgid_get; 2279 2280 /*! Set ingress and egress filter mode for a port. */ 2281 port_vlan_member_set_f port_vlan_member_set; 2282 2283 /*! Get filter mode for a port. */ 2284 port_vlan_member_get_f port_vlan_member_get; 2285 2286 /*! Set port default vlan tag actions. */ 2287 port_ing_vlan_action_set_f port_ing_vlan_action_set; 2288 2289 /*! Get port default vlan tag actions. */ 2290 port_ing_vlan_action_get_f port_ing_vlan_action_get; 2291 2292 /*! Set port egr vlan tag actions. */ 2293 port_egr_vlan_action_set_f port_egr_vlan_action_set; 2294 2295 /*! Get port egr vlan tag actions. */ 2296 port_egr_vlan_action_get_f port_egr_vlan_action_get; 2297 2298 /*! Set port default vlan tag actions to reset values. */ 2299 port_ing_vlan_action_reset_f port_ing_vlan_action_reset; 2300 2301 /*! Set egress vlan translation enable. */ 2302 port_egr_vlan_xlate_enable_set_f port_egr_vlan_xlate_enable_set; 2303 2304 /*! Get egress vlan translation enable. */ 2305 port_egr_vlan_xlate_enable_get_f port_egr_vlan_xlate_enable_get; 2306 2307 /*! Set the ports class ID. */ 2308 port_class_set_f port_class_set; 2309 2310 /*! Get the ports class ID. */ 2311 port_class_get_f port_class_get; 2312 2313 /*! Get which pipes are using identified port group. */ 2314 port_group_to_pipes_f port_group_to_pipes; 2315 2316 /*! Set port discard attributes. */ 2317 port_discard_set_f port_discard_set; 2318 2319 /*! Get port discard attributes. */ 2320 port_discard_get_f port_discard_get; 2321 2322 /*! Set packet priority and cfi to internal priority and congestion mapping. */ 2323 port_vlan_phb_map_set_f port_vlan_phb_map_set; 2324 2325 /*! Get packet priority and cfi to internal priority and congestion mapping. */ 2326 port_vlan_phb_map_get_f port_vlan_phb_map_get; 2327 2328 /*! Set DSCP remapping, and DSCP to internal priority and congestion mapping. */ 2329 port_dscp_phb_map_set_f port_dscp_phb_map_set; 2330 2331 /*! Get DSCP remapping, and DSCP to internal priority and congestion mapping. */ 2332 port_dscp_phb_map_get_f port_dscp_phb_map_get; 2333 2334 /*! Set internal priority and congestion to packet priority and cfi mapping. */ 2335 port_phb_vlan_map_set_f port_phb_vlan_map_set; 2336 2337 /*! Get internal priority and congestion to packet priority and cfi mapping. */ 2338 port_phb_vlan_map_get_f port_phb_vlan_map_get; 2339 2340 /*! Set internal priority and congestion to packet DSCP mapping. */ 2341 port_phb_dscp_map_set_f port_phb_dscp_map_set; 2342 2343 /*! Get internal priority and congestion to packet DSCP mapping. */ 2344 port_phb_dscp_map_get_f port_phb_dscp_map_get; 2345 2346 /*! Set DSCP mapping mode. */ 2347 port_dscp_phb_map_mode_set_f port_dscp_phb_map_mode_set; 2348 2349 /*! Get DSCP mapping mode. */ 2350 port_dscp_phb_map_mode_get_f port_dscp_phb_map_mode_get; 2351 2352 /*! Enable/Disable BPDU reception on the specified port. */ 2353 port_bpdu_enable_set_f port_bpdu_enable_set; 2354 2355 /*! Return whether BPDU reception is enabled on the specified port. */ 2356 port_bpdu_enable_get_f port_bpdu_enable_get; 2357 2358 /*! Set egress shaper information. */ 2359 port_egr_shaper_set_f port_egr_shaper_set; 2360 2361 /*! Get egress shaper information. */ 2362 port_egr_shaper_get_f port_egr_shaper_get; 2363 2364 /*! Validate egress shaper settings. */ 2365 port_egr_shaper_validate_f port_egr_shaper_validate; 2366 2367 /*! Validate port class settings. */ 2368 port_class_validate_f port_class_validate; 2369 2370 /*! Get port group range based on destination type. */ 2371 port_group_range_get_f port_group_range_get; 2372 2373 /*! Get the count of packets (or cells) currently buffered for a port. */ 2374 port_queue_count_get_f port_queue_count_get; 2375 2376 /*! Check flexport input parameters and port status are valid. */ 2377 flexport_input_validate_f flexport_input_validate; 2378 2379 /*! Check device has enough resource to complete all operations. */ 2380 flexport_resource_validate_f flexport_resource_validate; 2381 2382 /*! check if Portmacro accommodate the new speed. */ 2383 port_speed_config_validate_f port_speed_config_validate; 2384 2385 /*! Check if the device has enough resource to complete all operations and rearrange ports in one pm. */ 2386 pm_port_init_adjust_f pm_port_init_adjust; 2387 2388 /*! Attach ports to the BCM layer and initialize them to the default state. */ 2389 flexport_resource_attach_f flexport_resource_attach; 2390 2391 /*! Detach ports from the BCM layer. */ 2392 flexport_resource_detach_f flexport_resource_detach; 2393 2394 /*! Update the port resource status to depedent modules after flex operation. */ 2395 flexport_resource_status_update_f flexport_resource_status_update; 2396 2397 /*! Attach counter entries to the given port. */ 2398 port_stat_attach_f port_stat_attach; 2399 2400 /*! Detach counter entries to given port. */ 2401 port_stat_detach_f port_stat_detach; 2402 2403 /*! Attach flex state action to the given port. */ 2404 port_flexstate_attach_f port_flexstate_attach; 2405 2406 /*! Detach flex state action to given port. */ 2407 port_flexstate_detach_f port_flexstate_detach; 2408 2409 /*! Set selective per-port blocking of flooded traffic. */ 2410 port_flood_block_set_f port_flood_block_set; 2411 2412 /*! Get the current per-port flood block settings. */ 2413 port_flood_block_get_f port_flood_block_get; 2414 2415 /*! Set switching only to indicated ports from given (modid, port). */ 2416 port_egress_set_f port_egress_set; 2417 2418 /*! Retrieve bitmap of ports for which switching is enabled for (modid, port). */ 2419 port_egress_get_f port_egress_get; 2420 2421 /*! Add a match to an existing port. */ 2422 port_match_add_f port_match_add; 2423 2424 /*! Remove a match from an existing port. */ 2425 port_match_delete_f port_match_delete; 2426 2427 /*! Get all the matches for an existing port. */ 2428 port_match_multi_get_f port_match_multi_get; 2429 2430 /*! Set port HG3 enable. */ 2431 port_hg3_enable_set_f port_hg3_enable_set; 2432 2433 /*! Get port HG3 enable. */ 2434 port_hg3_enable_get_f port_hg3_enable_get; 2435 2436 /*! Set HG3 Ethernet Type. */ 2437 port_hg3_eth_type_set_f port_hg3_eth_type_set; 2438 2439 /*! Get HG3 Ethernet Type. */ 2440 port_hg3_eth_type_get_f port_hg3_eth_type_get; 2441 2442 /*! Get the list of ancillary ports belonging to the same port block as the controlling port. */ 2443 port_subsidiary_ports_get_f port_subsidiary_ports_get; 2444 2445 /*! Get the spec of port module resources. */ 2446 port_resource_spec_get_f port_resource_spec_get; 2447 2448 /*! Enable egress VLAN membership check for IFP redirection. */ 2449 port_ifp_egr_vlan_check_enable_set_f port_ifp_egr_vlan_check_enable_set; 2450 2451 /*! Get egress VLAN membership check enable for IFP redirection. */ 2452 port_ifp_egr_vlan_check_enable_get_f port_ifp_egr_vlan_check_enable_get; 2453 2454 /*! Get flags to disable VLAN membership check. */ 2455 port_vlan_check_disable_get_f port_vlan_check_disable_get; 2456 2457 /*! Get flags to disable STG check. */ 2458 port_stg_check_disable_get_f port_stg_check_disable_get; 2459 2460 /*! Dump port sw infomation. */ 2461 port_dump_sw_f port_dump_sw; 2462 2463 /*! Allocate an ID from L2_IF pool. */ 2464 l2_if_alloc_f l2_if_alloc; 2465 2466 /*! Free an ID to L2_IF pool. */ 2467 l2_if_free_f l2_if_free; 2468 2469 /*! Dump L2_IF pool. */ 2470 l2_if_dump_f l2_if_dump; 2471 2472 /*! Set the configuration for Flight Data Recorder (FDR) on a port. */ 2473 port_fdr_config_set_f port_fdr_config_set; 2474 2475 /*! Get the configuration for Flight Data Recorder (FDR) on a port. */ 2476 port_fdr_config_get_f port_fdr_config_get; 2477 2478 /*! Get the statistics of Flight Data Recorder (FDR) on a port. */ 2479 port_fdr_stats_get_f port_fdr_stats_get; 2480 2481 /*! Register port Flight Data Recorder (FDR) interrupt notification callbacks. */ 2482 port_fdr_callback_register_f port_fdr_callback_register; 2483 2484 /*! Unregister port Flight Data Recorder (FDR) interrupt notification callbacks. */ 2485 port_fdr_callback_unregister_f port_fdr_callback_unregister; 2486 2487 } mbcm_ltsw_port_drv_t; 2488 2489 /*! 2490 * \brief Set the PORT driver of the device. 2491 * 2492 * \param [in] unit Unit Number. 2493 * \param [in] drv Port driver to set. 2494 * 2495 * \retval SHR_E_NONE No errors. 2496 * \retval !SHR_E_NONE Failure. 2497 */ 2498 extern int 2499 mbcm_ltsw_port_drv_set( 2500 int unit, 2501 mbcm_ltsw_port_drv_t *drv); 2502 2503 /*! 2504 * \brief Initialize device specific information. 2505 * 2506 * \param [in] unit Unit Number. 2507 * 2508 * \retval SHR_E_NONE No errors. 2509 * \retval !SHR_E_NONE Failure. 2510 */ 2511 extern int 2512 mbcm_ltsw_port_info_init(int unit); 2513 2514 /*! 2515 * \brief Initialize device specific information for a port. 2516 * 2517 * \param [in] unit Unit Number. 2518 * \param [in] port Port Number. 2519 * 2520 * \retval SHR_E_NONE No errors. 2521 * \retval !SHR_E_NONE Failure. 2522 */ 2523 extern int 2524 mbcm_ltsw_port_info_init_per_port( 2525 int unit, 2526 bcm_port_t port); 2527 2528 /*! 2529 * \brief De-initialize device specific information. 2530 * 2531 * \param [in] unit Unit Number. 2532 * 2533 * \retval SHR_E_NONE No errors. 2534 * \retval !SHR_E_NONE Failure. 2535 */ 2536 extern int 2537 mbcm_ltsw_port_info_deinit(int unit); 2538 2539 /*! 2540 * \brief Recover device specific information. 2541 * 2542 * \param [in] unit Unit Number. 2543 * 2544 * \retval SHR_E_NONE No errors. 2545 * \retval !SHR_E_NONE Failure. 2546 */ 2547 extern int 2548 mbcm_ltsw_port_info_recover(int unit); 2549 2550 /*! 2551 * \brief Initialize port profile tables. 2552 * 2553 * \param [in] unit Unit Number. 2554 * 2555 * \retval SHR_E_NONE No errors. 2556 * \retval !SHR_E_NONE Failure. 2557 */ 2558 extern int 2559 mbcm_ltsw_port_profile_init(int unit); 2560 2561 /*! 2562 * \brief De-initialize port profile tables. 2563 * 2564 * \param [in] unit Unit Number. 2565 * 2566 * \retval SHR_E_NONE No errors. 2567 * \retval !SHR_E_NONE Failure. 2568 */ 2569 extern int 2570 mbcm_ltsw_port_profile_deinit(int unit); 2571 2572 /*! 2573 * \brief Initialize basic port pipeline configuration. 2574 * 2575 * \param [in] unit Unit Number. 2576 * 2577 * \retval SHR_E_NONE No errors. 2578 * \retval !SHR_E_NONE Failure. 2579 */ 2580 extern int 2581 mbcm_ltsw_port_service_init(int unit); 2582 2583 /*! 2584 * \brief De-initialize basic port pipeline configuration. 2585 * 2586 * \param [in] unit Unit Number. 2587 * 2588 * \retval SHR_E_NONE No errors. 2589 * \retval !SHR_E_NONE Failure. 2590 */ 2591 extern int 2592 mbcm_ltsw_port_service_deinit(int unit); 2593 2594 /*! 2595 * \brief Port module misc init. 2596 * 2597 * \param [in] unit Unit Number. 2598 * 2599 * \retval SHR_E_NONE No errors. 2600 * \retval !SHR_E_NONE Failure. 2601 */ 2602 extern int 2603 mbcm_ltsw_port_misc_init(int unit); 2604 2605 /*! 2606 * \brief Port module misc deinit. 2607 * 2608 * \param [in] unit Unit Number. 2609 * 2610 * \retval SHR_E_NONE No errors. 2611 * \retval !SHR_E_NONE Failure. 2612 */ 2613 extern int 2614 mbcm_ltsw_port_misc_deinit(int unit); 2615 2616 /*! 2617 * \brief Port database initialization. 2618 * 2619 * \param [in] unit Unit Number. 2620 * 2621 * \retval SHR_E_NONE No errors. 2622 * \retval !SHR_E_NONE Failure. 2623 */ 2624 extern int 2625 mbcm_ltsw_port_db_init(int unit); 2626 2627 /*! 2628 * \brief Set the status of specified port feature. 2629 * 2630 * \param [in] unit Unit Number. 2631 * \param [in] port Port Number. 2632 * \param [in] type Enum value of the port feature. 2633 * \param [in] value Value of the port feature to be set. 2634 * 2635 * \retval SHR_E_NONE No errors. 2636 * \retval !SHR_E_NONE Failure. 2637 */ 2638 extern int 2639 mbcm_ltsw_port_control_set( 2640 int unit, 2641 bcm_port_t port, 2642 bcm_port_control_t type, 2643 int value); 2644 2645 /*! 2646 * \brief Get the status of specified port feature. 2647 * 2648 * \param [in] unit Unit Number. 2649 * \param [in] port Port Number. 2650 * \param [in] type Enum value of the port feature. 2651 * \param [out] value Current value of the port feature. 2652 * 2653 * \retval SHR_E_NONE No errors. 2654 * \retval !SHR_E_NONE Failure. 2655 */ 2656 extern int 2657 mbcm_ltsw_port_control_get( 2658 int unit, 2659 bcm_port_t port, 2660 bcm_port_control_t type, 2661 int *value); 2662 2663 /*! 2664 * \brief Control the sampling of packets ingressing or egressing a port. 2665 * 2666 * \param [in] unit Unit Number. 2667 * \param [in] port Port Number. 2668 * \param [in] ingress_rate Ingress direction rate. 2669 * \param [in] egress_rate Egress direction rate. 2670 * 2671 * \retval SHR_E_NONE No errors. 2672 * \retval !SHR_E_NONE Failure. 2673 */ 2674 extern int 2675 mbcm_ltsw_port_sample_rate_set( 2676 int unit, 2677 bcm_port_t port, 2678 int ingress_rate, 2679 int egress_rate); 2680 2681 /*! 2682 * \brief Get the sampling rate of packets ingressing or egressing a port. 2683 * 2684 * \param [in] unit Unit Number. 2685 * \param [in] port Port Number. 2686 * \param [out] ingress_rate Ingress direction rate. 2687 * \param [out] egress_rate Egress direction rate. 2688 * 2689 * \retval SHR_E_NONE No errors. 2690 * \retval !SHR_E_NONE Failure. 2691 */ 2692 extern int 2693 mbcm_ltsw_port_sample_rate_get( 2694 int unit, 2695 bcm_port_t port, 2696 int *ingress_rate, 2697 int *egress_rate); 2698 2699 /*! 2700 * \brief Update profile for a port. 2701 * 2702 * \param [in] unit Unit Number. 2703 * \param [in] fields Field list. 2704 * \param [in] fields_cnt Field number in list. 2705 * 2706 * \retval SHR_E_NONE No errors. 2707 * \retval !SHR_E_NONE Failure. 2708 */ 2709 extern int 2710 mbcm_ltsw_port_profile_lport_tab_update( 2711 int unit, 2712 ltsw_port_tab_field_t *fields, 2713 int fields_cnt); 2714 2715 /*! 2716 * \brief Add profile. 2717 * 2718 * \param [in] unit Unit Number. 2719 * \param [in] profile Profile to be added. 2720 * \param [out] index Index of the added or existed profile enrty. 2721 * 2722 * \retval SHR_E_NONE No errors. 2723 * \retval !SHR_E_NONE Failure. 2724 */ 2725 extern int 2726 mbcm_ltsw_port_profile_port_pkt_ctrl_add( 2727 int unit, 2728 void *profile, 2729 int *index); 2730 2731 /*! 2732 * \brief Get profile from LT. 2733 * 2734 * \param [in] unit Unit Number. 2735 * \param [in] index Index of the first entry. 2736 * \param [out] profile Profile entries. 2737 * 2738 * \retval SHR_E_NONE No errors. 2739 * \retval !SHR_E_NONE Failure. 2740 */ 2741 extern int 2742 mbcm_ltsw_port_profile_port_pkt_ctrl_get( 2743 int unit, 2744 int index, 2745 void *profile); 2746 2747 /*! 2748 * \brief Delete profile. 2749 * 2750 * \param [in] unit Unit Number. 2751 * \param [in] index Index of the first entry to be deleted. 2752 * 2753 * \retval SHR_E_NONE No errors. 2754 * \retval !SHR_E_NONE Failure. 2755 */ 2756 extern int 2757 mbcm_ltsw_port_profile_port_pkt_ctrl_delete( 2758 int unit, 2759 int index); 2760 2761 /*! 2762 * \brief Recover hash and reference count for profile. 2763 * 2764 * \param [in] unit Unit Number. 2765 * \param [in] index Profile index to be recovered. 2766 * 2767 * \retval SHR_E_NONE No errors. 2768 * \retval !SHR_E_NONE Failure. 2769 */ 2770 extern int 2771 mbcm_ltsw_port_profile_port_pkt_ctrl_recover( 2772 int unit, 2773 int index); 2774 2775 /*! 2776 * \brief Update one field of PORT_PKT_CONTROL. 2777 * 2778 * \param [in] unit Unit Number. 2779 * \param [in] port port ID. 2780 * \param [in] lt_fld_name Field name of PORT_PKT_CONTROL. 2781 * \param [in] lt_fld_value Field value of PORT_PKT_CONTROL. 2782 * 2783 * \retval SHR_E_NONE No errors. 2784 * \retval !SHR_E_NONE Failure. 2785 */ 2786 extern int 2787 mbcm_ltsw_port_profile_port_pkt_ctrl_update( 2788 int unit, 2789 int port, 2790 const char *lt_fld_name, 2791 int lt_fld_value); 2792 2793 /*! 2794 * \brief Get one field value of PORT_PKT_CONTROL. 2795 * 2796 * \param [in] unit Unit Number. 2797 * \param [in] port port ID. 2798 * \param [in] lt_fld_name Field name of PORT_PKT_CONTROL. 2799 * \param [out] lt_fld_value Field value of PORT_PKT_CONTROL. 2800 * 2801 * \retval SHR_E_NONE No errors. 2802 * \retval !SHR_E_NONE Failure. 2803 */ 2804 extern int 2805 mbcm_ltsw_port_profile_port_pkt_ctrl_field_get( 2806 int unit, 2807 int port, 2808 const char *lt_fld_name, 2809 int *lt_fld_value); 2810 2811 /*! 2812 * \brief Add specified entry to L2_IF based tables. 2813 * 2814 * \param [in] unit Unit Number. 2815 * \param [in] l2_if L2 interface. 2816 * 2817 * \retval SHR_E_NONE No errors. 2818 * \retval !SHR_E_NONE Failure. 2819 */ 2820 extern int 2821 mbcm_ltsw_l2_if_add( 2822 int unit, 2823 int l2_if); 2824 2825 /*! 2826 * \brief Delete specified entry of L2_IF based tables. 2827 * 2828 * \param [in] unit Unit Number. 2829 * \param [in] l2_if L2 interface. 2830 * 2831 * \retval SHR_E_NONE No errors. 2832 * \retval !SHR_E_NONE Failure. 2833 */ 2834 extern int 2835 mbcm_ltsw_l2_if_del( 2836 int unit, 2837 int l2_if); 2838 2839 /*! 2840 * \brief Get port from L2 interface. 2841 * 2842 * \param [in] unit Unit Number. 2843 * \param [in] l2_if L2 interface. 2844 * \param [out] port Port Number. 2845 * 2846 * \retval SHR_E_NONE No errors. 2847 * \retval !SHR_E_NONE Failure. 2848 */ 2849 extern int 2850 mbcm_ltsw_l2_if_to_port( 2851 int unit, 2852 int l2_if, 2853 bcm_port_t *port); 2854 2855 /*! 2856 * \brief Get L2 interface from port. 2857 * 2858 * \param [in] unit Unit Number. 2859 * \param [in] port Port Number. 2860 * \param [out] l2_if L2 interface. 2861 * 2862 * \retval SHR_E_NONE No errors. 2863 * \retval !SHR_E_NONE Failure. 2864 */ 2865 extern int 2866 mbcm_ltsw_port_to_l2_if( 2867 int unit, 2868 bcm_port_t port, 2869 int *l2_if); 2870 2871 /*! 2872 * \brief Get port mask from L2 interface mask. 2873 * 2874 * \param [in] unit Unit Number. 2875 * \param [in] l2_if_mask L2 interface mask. 2876 * \param [out] port_mask Local logical port mask. 2877 * 2878 * \retval SHR_E_NONE No errors. 2879 * \retval !SHR_E_NONE Failure. 2880 */ 2881 extern int 2882 mbcm_ltsw_l2_if_mask_to_port_mask( 2883 int unit, 2884 int l2_if_mask, 2885 int *port_mask); 2886 2887 /*! 2888 * \brief Get L2 interface mask from port mask. 2889 * 2890 * \param [in] unit Unit Number. 2891 * \param [in] port_mask Local logical port mask. 2892 * \param [out] l2_if_mask L2 interface mask. 2893 * 2894 * \retval SHR_E_NONE No errors. 2895 * \retval !SHR_E_NONE Failure. 2896 */ 2897 extern int 2898 mbcm_ltsw_port_mask_to_l2_if_mask( 2899 int unit, 2900 int port_mask, 2901 int *l2_if_mask); 2902 2903 /*! 2904 * \brief Get which pipes are using identified L2 interface. 2905 * 2906 * \param [in] unit Unit Number. 2907 * \param [in] l2_if L2 interface. 2908 * \param [out] pipe_bmp Pipe bitmap. 2909 * 2910 * \retval SHR_E_NONE No errors. 2911 * \retval !SHR_E_NONE Failure. 2912 */ 2913 extern int 2914 mbcm_ltsw_l2_if_to_pipes( 2915 int unit, 2916 int l2_if, 2917 uint32_t *pipe_bmp); 2918 2919 /*! 2920 * \brief Add specified entry to System Port based tables. 2921 * 2922 * \param [in] unit Unit Number. 2923 * \param [in] sys_port System port. 2924 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 2925 * 2926 * \retval SHR_E_NONE No errors. 2927 * \retval !SHR_E_NONE Failure. 2928 */ 2929 extern int 2930 mbcm_ltsw_sys_port_add( 2931 int unit, 2932 int sys_port, 2933 int flags); 2934 2935 /*! 2936 * \brief Delete specified entry of System Port based tables. 2937 * 2938 * \param [in] unit Unit Number. 2939 * \param [in] sys_port System port. 2940 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 2941 * 2942 * \retval SHR_E_NONE No errors. 2943 * \retval !SHR_E_NONE Failure. 2944 */ 2945 extern int 2946 mbcm_ltsw_sys_port_del( 2947 int unit, 2948 int sys_port, 2949 int flags); 2950 2951 /*! 2952 * \brief Change the system port of a port. The settings of the old system port is moved to the new system port. The old system port is deleted then. 2953 * 2954 * \param [in] unit Unit Number. 2955 * \param [in] port Port Number. 2956 * \param [in] sys_port New system port. 2957 * 2958 * \retval SHR_E_NONE No errors. 2959 * \retval !SHR_E_NONE Failure. 2960 */ 2961 extern int 2962 mbcm_ltsw_port_sys_port_move( 2963 int unit, 2964 bcm_port_t port, 2965 int sys_port); 2966 2967 /*! 2968 * \brief Get gport from system port. 2969 * 2970 * \param [in] unit Unit Number. 2971 * \param [in] sys_port System port. 2972 * \param [out] port Port Number. 2973 * 2974 * \retval SHR_E_NONE No errors. 2975 * \retval !SHR_E_NONE Failure. 2976 */ 2977 extern int 2978 mbcm_ltsw_sys_port_to_port( 2979 int unit, 2980 int sys_port, 2981 bcm_port_t *port); 2982 2983 /*! 2984 * \brief Get system port from port or gport. 2985 * 2986 * \param [in] unit Unit Number. 2987 * \param [in] port Port Number. 2988 * \param [out] sys_port System port. 2989 * 2990 * \retval SHR_E_NONE No errors. 2991 * \retval !SHR_E_NONE Failure. 2992 */ 2993 extern int 2994 mbcm_ltsw_port_to_sys_port( 2995 int unit, 2996 bcm_port_t port, 2997 int *sys_port); 2998 2999 /*! 3000 * \brief Get system ports from port or gport. 3001 * 3002 * \param [in] unit Unit Number. 3003 * \param [in] port Local logical port or gport. 3004 * \param [in] array_size Size of system port array. 3005 * \param [out] sys_port_array System port array. 3006 * \param [out] count Real count of system ports. 3007 * 3008 * \retval SHR_E_NONE No errors. 3009 * \retval !SHR_E_NONE Failure. 3010 */ 3011 extern int 3012 mbcm_ltsw_port_to_sys_ports( 3013 int unit, 3014 bcm_port_t port, 3015 int array_size, 3016 int *sys_port_array, 3017 int *count); 3018 3019 /*! 3020 * \brief Map System Port with L2 interface. 3021 * 3022 * \param [in] unit Unit Number. 3023 * \param [in] sys_port System port. 3024 * \param [in] l2_if L2 interface. 3025 * 3026 * \retval SHR_E_NONE No errors. 3027 * \retval !SHR_E_NONE Failure. 3028 */ 3029 extern int 3030 mbcm_ltsw_sys_port_map_l2_if( 3031 int unit, 3032 int sys_port, 3033 int l2_if); 3034 3035 /*! 3036 * \brief Demap System Port and L2 interface. 3037 * 3038 * \param [in] unit Unit Number. 3039 * \param [in] sys_port System port. 3040 * \param [in] l2_if L2 interface. 3041 * 3042 * \retval SHR_E_NONE No errors. 3043 * \retval !SHR_E_NONE Failure. 3044 */ 3045 extern int 3046 mbcm_ltsw_sys_port_demap_l2_if( 3047 int unit, 3048 int sys_port, 3049 int l2_if); 3050 3051 /*! 3052 * \brief Traverse over all system ports. 3053 * 3054 * \param [in] unit Unit Number. 3055 * \param [in] cb Callback function. 3056 * \param [in] user_data User data to a call back. 3057 * 3058 * \retval SHR_E_NONE No errors. 3059 * \retval !SHR_E_NONE Failure. 3060 */ 3061 extern int 3062 mbcm_ltsw_sys_port_traverse( 3063 int unit, 3064 bcmi_ltsw_port_traverse_cb cb, 3065 void *user_data); 3066 3067 /*! 3068 * \brief Get logic table info from port tab type. 3069 * 3070 * \param [in] unit Unit Number. 3071 * \param [inout] fields A set of fields which contain type and LT info. 3072 * \param [in] count Number of fields. 3073 * 3074 * \retval SHR_E_NONE No errors. 3075 * \retval !SHR_E_NONE Failure. 3076 */ 3077 extern int 3078 mbcm_ltsw_port_tabs_info_get( 3079 int unit, 3080 ltsw_port_tab_field_t *fields, 3081 int count); 3082 3083 /*! 3084 * \brief Get operation flags for logic table access. 3085 * 3086 * \param [in] unit Unit Number. 3087 * \param [in] port Port or gport. 3088 * \param [inout] fields A set of fields which contain type and LT info. 3089 * \param [in] count Number of fields. 3090 * \param [out] op Operation flags. 3091 * 3092 * \retval SHR_E_NONE No errors. 3093 * \retval !SHR_E_NONE Failure. 3094 */ 3095 extern int 3096 mbcm_ltsw_port_tabs_op_get( 3097 int unit, 3098 bcm_port_t port, 3099 ltsw_port_tab_field_t *fields, 3100 int count, 3101 uint32_t *op); 3102 3103 /*! 3104 * \brief Get parameters for logic table access. 3105 * 3106 * \param [in] unit Unit Number. 3107 * \param [in] port Port or gport. 3108 * \param [inout] fields A set of fields which contain type and LT info. 3109 * \param [in] count Number of fields. 3110 * \param [in] op Port tab operation flags. 3111 * 3112 * \retval SHR_E_NONE No errors. 3113 * \retval !SHR_E_NONE Failure. 3114 */ 3115 extern int 3116 mbcm_ltsw_port_tabs_para_get( 3117 int unit, 3118 bcm_port_t port, 3119 ltsw_port_tab_field_t *fields, 3120 int count, 3121 uint32_t op); 3122 3123 /*! 3124 * \brief Set the ARL hardware learning options for this port. 3125 * 3126 * \param [in] unit Unit Number. 3127 * \param [in] port Port Number. 3128 * \param [in] flags Logical OR of BCM_PORT_LEARN_xxx flags. 3129 * 3130 * \retval SHR_E_NONE No errors. 3131 * \retval !SHR_E_NONE Failure. 3132 */ 3133 extern int 3134 mbcm_ltsw_port_learn_set( 3135 int unit, 3136 bcm_port_t port, 3137 uint32_t flags); 3138 3139 /*! 3140 * \brief Get the ARL hardware learning options for this port. 3141 * 3142 * \param [in] unit Unit Number. 3143 * \param [in] port Port Number. 3144 * \param [out] flags Logical OR of BCM_PORT_LEARN_xxx flags. 3145 * 3146 * \retval SHR_E_NONE No errors. 3147 * \retval !SHR_E_NONE Failure. 3148 */ 3149 extern int 3150 mbcm_ltsw_port_learn_get( 3151 int unit, 3152 bcm_port_t port, 3153 uint32_t *flags); 3154 3155 /*! 3156 * \brief Enable/Disable L3 switching on the specified port. 3157 * 3158 * \param [in] unit Unit Number. 3159 * \param [in] port Port Number. 3160 * \param [in] enable TRUE to enable, FALSE to disable. 3161 * 3162 * \retval SHR_E_NONE No errors. 3163 * \retval !SHR_E_NONE Failure. 3164 */ 3165 extern int 3166 mbcm_ltsw_port_l3_enable_set( 3167 int unit, 3168 bcm_port_t port, 3169 int enable); 3170 3171 /*! 3172 * \brief Return whether L3 switching is enabled on the specified port. 3173 * 3174 * \param [in] unit Unit Number. 3175 * \param [in] port Port Number. 3176 * \param [out] enable TRUE if enabled, FALSE if disabled. 3177 * 3178 * \retval SHR_E_NONE No errors. 3179 * \retval !SHR_E_NONE Failure. 3180 */ 3181 extern int 3182 mbcm_ltsw_port_l3_enable_get( 3183 int unit, 3184 bcm_port_t port, 3185 int *enable); 3186 3187 /*! 3188 * \brief Set the maximum L3 frame size for the port. 3189 * 3190 * \param [in] unit Unit Number. 3191 * \param [in] port Port Number. 3192 * \param [in] size Maximum frame size in bytes. 3193 * 3194 * \retval SHR_E_NONE No errors. 3195 * \retval !SHR_E_NONE Failure. 3196 */ 3197 extern int 3198 mbcm_ltsw_port_l3_mtu_set( 3199 int unit, 3200 bcm_port_t port, 3201 int size); 3202 3203 /*! 3204 * \brief Get the maximum L3 frame size for the port. 3205 * 3206 * \param [in] unit Unit Number. 3207 * \param [in] port Port Number. 3208 * \param [out] size Maximum frame size in bytes. 3209 * 3210 * \retval SHR_E_NONE No errors. 3211 * \retval !SHR_E_NONE Failure. 3212 */ 3213 extern int 3214 mbcm_ltsw_port_l3_mtu_get( 3215 int unit, 3216 bcm_port_t port, 3217 int *size); 3218 3219 /*! 3220 * \brief Set the L3 multicast options for the port. 3221 * 3222 * \param [in] unit Unit Number. 3223 * \param [in] port Port Number. 3224 * \param [in] flags Logical OR of BCM_PORT_IPMC_xxx flags. 3225 * 3226 * \retval SHR_E_NONE No errors. 3227 * \retval !SHR_E_NONE Failure. 3228 */ 3229 extern int 3230 mbcm_ltsw_port_ipmc_modify_set( 3231 int unit, 3232 bcm_port_t port, 3233 uint32_t flags); 3234 3235 /*! 3236 * \brief Get the L3 multicast options for the port. 3237 * 3238 * \param [in] unit Unit Number. 3239 * \param [in] port Port Number. 3240 * \param [out] flags Logical OR of BCM_PORT_IPMC_xxx flags. 3241 * 3242 * \retval SHR_E_NONE No errors. 3243 * \retval !SHR_E_NONE Failure. 3244 */ 3245 extern int 3246 mbcm_ltsw_port_ipmc_modify_get( 3247 int unit, 3248 bcm_port_t port, 3249 uint32_t *flags); 3250 3251 /*! 3252 * \brief Add allowed TPID for a port. 3253 * 3254 * \param [in] unit Unit Number. 3255 * \param [in] port Port Number. 3256 * \param [in] type TPID type. 3257 * \param [in] tpid Tag Protocol ID. 3258 * \param [in] color_select Color mode of the TPID. 3259 * 3260 * \retval SHR_E_NONE No errors. 3261 * \retval !SHR_E_NONE Failure. 3262 */ 3263 extern int 3264 mbcm_ltsw_port_tpid_add( 3265 int unit, 3266 bcm_port_t port, 3267 int type, 3268 uint16_t tpid, 3269 int color_select); 3270 3271 /*! 3272 * \brief Set the default Tag Protocol ID for a port. 3273 * 3274 * \param [in] unit Unit Number. 3275 * \param [in] port Port Number. 3276 * \param [in] type TPID type. 3277 * \param [in] tpid Tag Protocol ID. 3278 * 3279 * \retval SHR_E_NONE No errors. 3280 * \retval !SHR_E_NONE Failure. 3281 */ 3282 extern int 3283 mbcm_ltsw_port_tpid_set( 3284 int unit, 3285 bcm_port_t port, 3286 int type, 3287 uint16_t tpid); 3288 3289 /*! 3290 * \brief Retrieve the default Tag Protocol ID for a port. 3291 * 3292 * \param [in] unit Unit Number. 3293 * \param [in] port Port Number. 3294 * \param [in] type TPID type. 3295 * \param [out] tpid Tag Protocol ID. 3296 * 3297 * \retval SHR_E_NONE No errors. 3298 * \retval !SHR_E_NONE Failure. 3299 */ 3300 extern int 3301 mbcm_ltsw_port_tpid_get( 3302 int unit, 3303 bcm_port_t port, 3304 int type, 3305 uint16_t *tpid); 3306 3307 /*! 3308 * \brief Get a list of tpids and associated color selections for a given port. 3309 * 3310 * \param [in] unit Unit Number. 3311 * \param [in] port Port Number. 3312 * \param [in] type TPID type. 3313 * \param [in] size Number of elements of the next two array parameters. 3314 * \param [out] tpid_array Buffer array to hold a list of retrieved tpids. 3315 * \param [out] color_array Buffer array to hold a list of retrieved color selections. 3316 * \param [out] count Actual number of tpids retrieved. 3317 * 3318 * \retval SHR_E_NONE No errors. 3319 * \retval !SHR_E_NONE Failure. 3320 */ 3321 extern int 3322 mbcm_ltsw_port_tpid_get_all( 3323 int unit, 3324 bcm_port_t port, 3325 int type, 3326 int size, 3327 uint16_t *tpid_array, 3328 int *color_array, 3329 int *count); 3330 3331 /*! 3332 * \brief Delete allowed TPID for a port. 3333 * 3334 * \param [in] unit Unit Number. 3335 * \param [in] port Port Number. 3336 * \param [in] type TPID type. 3337 * \param [in] tpid Tag Protocol ID. 3338 * 3339 * \retval SHR_E_NONE No errors. 3340 * \retval !SHR_E_NONE Failure. 3341 */ 3342 extern int 3343 mbcm_ltsw_port_tpid_delete( 3344 int unit, 3345 bcm_port_t port, 3346 int type, 3347 uint16_t tpid); 3348 3349 /*! 3350 * \brief Delete all allowed TPID for a port. 3351 * 3352 * \param [in] unit Unit Number. 3353 * \param [in] port Port Number. 3354 * \param [in] type TPID type. 3355 * 3356 * \retval SHR_E_NONE No errors. 3357 * \retval !SHR_E_NONE Failure. 3358 */ 3359 extern int 3360 mbcm_ltsw_port_tpid_delete_all( 3361 int unit, 3362 bcm_port_t port, 3363 int type); 3364 3365 /*! 3366 * \brief Set the expected TPID for the inner tag in double-tagging mode. 3367 * 3368 * \param [in] unit Unit Number. 3369 * \param [in] port Port Number. 3370 * \param [in] tpid Tag Protocol ID. 3371 * 3372 * \retval SHR_E_NONE No errors. 3373 * \retval !SHR_E_NONE Failure. 3374 */ 3375 extern int 3376 mbcm_ltsw_port_inner_tpid_set( 3377 int unit, 3378 bcm_port_t port, 3379 uint16_t tpid); 3380 3381 /*! 3382 * \brief Get the expected TPID for the inner tag in double-tagging mode. 3383 * 3384 * \param [in] unit Unit Number. 3385 * \param [in] port Port Number. 3386 * \param [out] tpid Tag Protocol ID. 3387 * 3388 * \retval SHR_E_NONE No errors. 3389 * \retval !SHR_E_NONE Failure. 3390 */ 3391 extern int 3392 mbcm_ltsw_port_inner_tpid_get( 3393 int unit, 3394 bcm_port_t port, 3395 uint16_t *tpid); 3396 3397 /*! 3398 * \brief Set the default VLAN ID for received untagged packets on a port. 3399 * 3400 * \param [in] unit Unit Number. 3401 * \param [in] port Port Number. 3402 * \param [in] vid VLAN ID. 3403 * 3404 * \retval SHR_E_NONE No errors. 3405 * \retval !SHR_E_NONE Failure. 3406 */ 3407 extern int 3408 mbcm_ltsw_port_untagged_vlan_set( 3409 int unit, 3410 bcm_port_t port, 3411 bcm_vlan_t vid); 3412 3413 /*! 3414 * \brief Retrieve the default VLAN ID for received untagged packets on a port. 3415 * 3416 * \param [in] unit Unit Number. 3417 * \param [in] port Port Number. 3418 * \param [out] vid VLAN ID. 3419 * 3420 * \retval SHR_E_NONE No errors. 3421 * \retval !SHR_E_NONE Failure. 3422 */ 3423 extern int 3424 mbcm_ltsw_port_untagged_vlan_get( 3425 int unit, 3426 bcm_port_t port, 3427 bcm_vlan_t *vid); 3428 3429 /*! 3430 * \brief Set the 802.1p priority for received untagged packets on a port. 3431 * 3432 * \param [in] unit Unit Number. 3433 * \param [in] port Port Number. 3434 * \param [in] priority 802.1p priority. 3435 * 3436 * \retval SHR_E_NONE No errors. 3437 * \retval !SHR_E_NONE Failure. 3438 */ 3439 extern int 3440 mbcm_ltsw_port_untagged_priority_set( 3441 int unit, 3442 bcm_port_t port, 3443 int priority); 3444 3445 /*! 3446 * \brief Retrieve the 802.1p priority for received untagged packets on a port. 3447 * 3448 * \param [in] unit Unit Number. 3449 * \param [in] port Port Number. 3450 * \param [out] priority 802.1p priority. 3451 * 3452 * \retval SHR_E_NONE No errors. 3453 * \retval !SHR_E_NONE Failure. 3454 */ 3455 extern int 3456 mbcm_ltsw_port_untagged_priority_get( 3457 int unit, 3458 bcm_port_t port, 3459 int *priority); 3460 3461 /*! 3462 * \brief Set the private VLAN attribute of a port. 3463 * 3464 * \param [in] unit Unit Number. 3465 * \param [in] port Port Number. 3466 * \param [in] vlan VLAN ID. 3467 * \param [in] pkt_prio Egress packet priority. 3468 * \param [in] flags BCM_PORT_FORCE_VLAN_xxx. 3469 * 3470 * \retval SHR_E_NONE No errors. 3471 * \retval !SHR_E_NONE Failure. 3472 */ 3473 extern int 3474 mbcm_ltsw_port_force_vlan_set( 3475 int unit, 3476 bcm_port_t port, 3477 bcm_vlan_t vlan, 3478 int pkt_prio, 3479 uint32_t flags); 3480 3481 /*! 3482 * \brief Get the private VLAN attribute of a port. 3483 * 3484 * \param [in] unit Unit Number. 3485 * \param [in] port Port Number. 3486 * \param [out] vlan VLAN ID. 3487 * \param [out] pkt_prio Egress packet priority. 3488 * \param [out] flags BCM_PORT_FORCE_VLAN_xxx. 3489 * 3490 * \retval SHR_E_NONE No errors. 3491 * \retval !SHR_E_NONE Failure. 3492 */ 3493 extern int 3494 mbcm_ltsw_port_force_vlan_get( 3495 int unit, 3496 bcm_port_t port, 3497 bcm_vlan_t *vlan, 3498 int *pkt_prio, 3499 uint32_t *flags); 3500 3501 /*! 3502 * \brief Set the trunk group for a given port. 3503 * 3504 * \param [in] unit Unit Number. 3505 * \param [in] port Port Number. 3506 * \param [in] tid trunk ID. 3507 * \param [in] psc trunk selection criterion. 3508 * 3509 * \retval SHR_E_NONE No errors. 3510 * \retval !SHR_E_NONE Failure. 3511 */ 3512 extern int 3513 mbcm_ltsw_port_tgid_set( 3514 int unit, 3515 bcm_port_t port, 3516 int tid, 3517 int psc); 3518 3519 /*! 3520 * \brief Get the trunk group for a given port. 3521 * 3522 * \param [in] unit Unit Number. 3523 * \param [in] port Port Number. 3524 * \param [out] tid trunk ID. 3525 * \param [out] psc trunk selection criterion. 3526 * 3527 * \retval SHR_E_NONE No errors. 3528 * \retval !SHR_E_NONE Failure. 3529 */ 3530 extern int 3531 mbcm_ltsw_port_tgid_get( 3532 int unit, 3533 bcm_port_t port, 3534 int *tid, 3535 int *psc); 3536 3537 /*! 3538 * \brief Set ingress and egress filter mode for a port. 3539 * 3540 * \param [in] unit Unit Number. 3541 * \param [in] port Port Number. 3542 * \param [in] flags BCM_PORT_VLAN_MEMBER_xxx. 3543 * 3544 * \retval SHR_E_NONE No errors. 3545 * \retval !SHR_E_NONE Failure. 3546 */ 3547 extern int 3548 mbcm_ltsw_port_vlan_member_set( 3549 int unit, 3550 bcm_port_t port, 3551 uint32_t flags); 3552 3553 /*! 3554 * \brief Get filter mode for a port. 3555 * 3556 * \param [in] unit Unit Number. 3557 * \param [in] port Port Number. 3558 * \param [out] flags BCM_PORT_VLAN_MEMBER_xxx. 3559 * 3560 * \retval SHR_E_NONE No errors. 3561 * \retval !SHR_E_NONE Failure. 3562 */ 3563 extern int 3564 mbcm_ltsw_port_vlan_member_get( 3565 int unit, 3566 bcm_port_t port, 3567 uint32_t *flags); 3568 3569 /*! 3570 * \brief Set port default vlan tag actions. 3571 * 3572 * \param [in] unit Unit Number. 3573 * \param [in] port Port Number. 3574 * \param [in] action Vlan tag actions. 3575 * \param [in] action_profile_index Index of vlan action profile. 3576 * 3577 * \retval SHR_E_NONE No errors. 3578 * \retval !SHR_E_NONE Failure. 3579 */ 3580 extern int 3581 mbcm_ltsw_port_ing_vlan_action_set( 3582 int unit, 3583 bcm_port_t port, 3584 bcm_vlan_action_set_t *action, 3585 int action_profile_index); 3586 3587 /*! 3588 * \brief Get port default vlan tag actions. 3589 * 3590 * \param [in] unit Unit Number. 3591 * \param [in] port Port Number. 3592 * \param [out] action Vlan tag actions. 3593 * \param [out] action_profile_index Index of vlan action profile. 3594 * 3595 * \retval SHR_E_NONE No errors. 3596 * \retval !SHR_E_NONE Failure. 3597 */ 3598 extern int 3599 mbcm_ltsw_port_ing_vlan_action_get( 3600 int unit, 3601 bcm_port_t port, 3602 bcm_vlan_action_set_t *action, 3603 int *action_profile_index); 3604 3605 /*! 3606 * \brief Set port egr vlan tag actions. 3607 * 3608 * \param [in] unit Unit Number. 3609 * \param [in] port Port Number. 3610 * \param [in] action Vlan tag actions. 3611 * \param [in] action_profile_index Index of egr vlan action profile. 3612 * 3613 * \retval SHR_E_NONE No errors. 3614 * \retval !SHR_E_NONE Failure. 3615 */ 3616 extern int 3617 mbcm_ltsw_port_egr_vlan_action_set( 3618 int unit, 3619 bcm_port_t port, 3620 bcm_vlan_action_set_t *action, 3621 int action_profile_index); 3622 3623 /*! 3624 * \brief Get port egr vlan tag actions. 3625 * 3626 * \param [in] unit Unit Number. 3627 * \param [in] port Port Number. 3628 * \param [out] action Vlan tag actions. 3629 * \param [out] action_profile_index Index of egr vlan action profile. 3630 * 3631 * \retval SHR_E_NONE No errors. 3632 * \retval !SHR_E_NONE Failure. 3633 */ 3634 extern int 3635 mbcm_ltsw_port_egr_vlan_action_get( 3636 int unit, 3637 bcm_port_t port, 3638 bcm_vlan_action_set_t *action, 3639 int *action_profile_index); 3640 3641 /*! 3642 * \brief Set port default vlan tag actions to reset values. 3643 * 3644 * \param [in] unit Unit Number. 3645 * \param [in] port Port Number. 3646 * 3647 * \retval SHR_E_NONE No errors. 3648 * \retval !SHR_E_NONE Failure. 3649 */ 3650 extern int 3651 mbcm_ltsw_port_ing_vlan_action_reset( 3652 int unit, 3653 bcm_port_t port); 3654 3655 /*! 3656 * \brief Set egress vlan translation enable. 3657 * 3658 * \param [in] unit Unit Number. 3659 * \param [in] port Port Number. 3660 * \param [in] enable Egress vlan translation enable. 3661 * 3662 * \retval SHR_E_NONE No errors. 3663 * \retval !SHR_E_NONE Failure. 3664 */ 3665 extern int 3666 mbcm_ltsw_port_egr_vlan_xlate_enable_set( 3667 int unit, 3668 bcm_port_t port, 3669 int enable); 3670 3671 /*! 3672 * \brief Get egress vlan translation enable. 3673 * 3674 * \param [in] unit Unit Number. 3675 * \param [in] port Port Number. 3676 * \param [out] enable Egress vlan translation enable. 3677 * 3678 * \retval SHR_E_NONE No errors. 3679 * \retval !SHR_E_NONE Failure. 3680 */ 3681 extern int 3682 mbcm_ltsw_port_egr_vlan_xlate_enable_get( 3683 int unit, 3684 bcm_port_t port, 3685 int *enable); 3686 3687 /*! 3688 * \brief Set the ports class ID. 3689 * 3690 * \param [in] unit Unit Number. 3691 * \param [in] port Port Number. 3692 * \param [in] class Classification type. 3693 * \param [in] class_id Class ID of the port. 3694 * 3695 * \retval SHR_E_NONE No errors. 3696 * \retval !SHR_E_NONE Failure. 3697 */ 3698 extern int 3699 mbcm_ltsw_port_class_set( 3700 int unit, 3701 bcm_port_t port, 3702 bcm_port_class_t class, 3703 uint32_t class_id); 3704 3705 /*! 3706 * \brief Get the ports class ID. 3707 * 3708 * \param [in] unit Unit Number. 3709 * \param [in] port Port Number. 3710 * \param [in] class Classification type. 3711 * \param [out] class_id Class ID of the port. 3712 * 3713 * \retval SHR_E_NONE No errors. 3714 * \retval !SHR_E_NONE Failure. 3715 */ 3716 extern int 3717 mbcm_ltsw_port_class_get( 3718 int unit, 3719 bcm_port_t port, 3720 bcm_port_class_t class, 3721 uint32_t *class_id); 3722 3723 /*! 3724 * \brief Get which pipes are using identified port group. 3725 * 3726 * \param [in] unit Unit Number. 3727 * \param [in] port_group Port group. 3728 * \param [in] flags Operation flags BCMI_LTSW_PORT_XXX. 3729 * \param [out] pipe_bmp Pipe bitmap. 3730 * 3731 * \retval SHR_E_NONE No errors. 3732 * \retval !SHR_E_NONE Failure. 3733 */ 3734 extern int 3735 mbcm_ltsw_port_group_to_pipes( 3736 int unit, 3737 int port_group, 3738 int flags, 3739 uint32_t *pipe_bmp); 3740 3741 /*! 3742 * \brief Set port discard attributes. 3743 * 3744 * \param [in] unit Unit Number. 3745 * \param [in] port Port Number. 3746 * \param [in] mode Port discard mode, BCM_PORT_DISCARD_xxx. 3747 * 3748 * \retval SHR_E_NONE No errors. 3749 * \retval !SHR_E_NONE Failure. 3750 */ 3751 extern int 3752 mbcm_ltsw_port_discard_set( 3753 int unit, 3754 bcm_port_t port, 3755 int mode); 3756 3757 /*! 3758 * \brief Get port discard attributes. 3759 * 3760 * \param [in] unit Unit Number. 3761 * \param [in] port Port Number. 3762 * \param [out] mode Port discard mode, BCM_PORT_DISCARD_xxx. 3763 * 3764 * \retval SHR_E_NONE No errors. 3765 * \retval !SHR_E_NONE Failure. 3766 */ 3767 extern int 3768 mbcm_ltsw_port_discard_get( 3769 int unit, 3770 bcm_port_t port, 3771 int *mode); 3772 3773 /*! 3774 * \brief Set packet priority and cfi to internal priority and congestion mapping. 3775 * 3776 * \param [in] unit Unit Number. 3777 * \param [in] port Port Number. 3778 * \param [in] pri Packet 802.1p priority. -1 means any priority. 3779 * \param [in] cfi Packet CFI. -1 means any CFI. 3780 * \param [in] int_pri Internal priority. -1 means not to change it. 3781 * \param [in] cng Congestion. -1 means not to change it. 3782 * 3783 * \retval SHR_E_NONE No errors. 3784 * \retval !SHR_E_NONE Failure. 3785 */ 3786 extern int 3787 mbcm_ltsw_port_vlan_phb_map_set( 3788 int unit, 3789 bcm_port_t port, 3790 int pri, 3791 int cfi, 3792 int int_pri, 3793 int cng); 3794 3795 /*! 3796 * \brief Get packet priority and cfi to internal priority and congestion mapping. 3797 * 3798 * \param [in] unit Unit Number. 3799 * \param [in] port Port Number. 3800 * \param [in] pri Packet 802.1p priority. -1 means first priority. 3801 * \param [in] cfi Packet CFI. -1 means first CFI. 3802 * \param [out] int_pri Internal priority. NULL means not to get it. 3803 * \param [out] cng Congestion. NULL means not to get it. 3804 * 3805 * \retval SHR_E_NONE No errors. 3806 * \retval !SHR_E_NONE Failure. 3807 */ 3808 extern int 3809 mbcm_ltsw_port_vlan_phb_map_get( 3810 int unit, 3811 bcm_port_t port, 3812 int pri, 3813 int cfi, 3814 int *int_pri, 3815 int *cng); 3816 3817 /*! 3818 * \brief Set DSCP remapping, and DSCP to internal priority and congestion mapping. 3819 * 3820 * \param [in] unit Unit Number. 3821 * \param [in] port Port Number. 3822 * \param [in] srccp Source DSCP. -1 means any DSCP. 3823 * \param [in] mapcp Mapped DSCP. -1 means not to change it. 3824 * \param [in] int_pri Internal priority. -1 means not to change it. 3825 * \param [in] cng Congestion. -1 means not to change it. 3826 * 3827 * \retval SHR_E_NONE No errors. 3828 * \retval !SHR_E_NONE Failure. 3829 */ 3830 extern int 3831 mbcm_ltsw_port_dscp_phb_map_set( 3832 int unit, 3833 bcm_port_t port, 3834 int srccp, 3835 int mapcp, 3836 int int_pri, 3837 int cng); 3838 3839 /*! 3840 * \brief Get DSCP remapping, and DSCP to internal priority and congestion mapping. 3841 * 3842 * \param [in] unit Unit Number. 3843 * \param [in] port Port Number. 3844 * \param [in] srccp Source DSCP. -1 means first DSCP. 3845 * \param [out] mapcp Mapped DSCP. NULL means not to get it. 3846 * \param [out] int_pri Internal priority. NULL means not to get it. 3847 * \param [out] cng Congestion. NULL means not to get it. 3848 * 3849 * \retval SHR_E_NONE No errors. 3850 * \retval !SHR_E_NONE Failure. 3851 */ 3852 extern int 3853 mbcm_ltsw_port_dscp_phb_map_get( 3854 int unit, 3855 bcm_port_t port, 3856 int srccp, 3857 int *mapcp, 3858 int *int_pri, 3859 int *cng); 3860 3861 /*! 3862 * \brief Set internal priority and congestion to packet priority and cfi mapping. 3863 * 3864 * \param [in] unit Unit Number. 3865 * \param [in] port Port Number. 3866 * \param [in] int_pri Internal priority. -1 means any internal priority. 3867 * \param [in] cng Congestion. -1 means any congestion. 3868 * \param [in] pri Packet 802.1p priority. -1 means not to change it. 3869 * \param [in] cfi Packet CFI. -1 means not to change it. 3870 * 3871 * \retval SHR_E_NONE No errors. 3872 * \retval !SHR_E_NONE Failure. 3873 */ 3874 extern int 3875 mbcm_ltsw_port_phb_vlan_map_set( 3876 int unit, 3877 bcm_port_t port, 3878 int int_pri, 3879 int cng, 3880 int pri, 3881 int cfi); 3882 3883 /*! 3884 * \brief Get internal priority and congestion to packet priority and cfi mapping. 3885 * 3886 * \param [in] unit Unit Number. 3887 * \param [in] port Port Number. 3888 * \param [in] int_pri Internal priority. -1 means first internal priority. 3889 * \param [in] cng Congestion. -1 means first congestion. 3890 * \param [out] pri Packet 802.1p priority. NULL means not to get it. 3891 * \param [out] cfi Packet CFI. NULL means not to get it. 3892 * 3893 * \retval SHR_E_NONE No errors. 3894 * \retval !SHR_E_NONE Failure. 3895 */ 3896 extern int 3897 mbcm_ltsw_port_phb_vlan_map_get( 3898 int unit, 3899 bcm_port_t port, 3900 int int_pri, 3901 int cng, 3902 int *pri, 3903 int *cfi); 3904 3905 /*! 3906 * \brief Set internal priority and congestion to packet DSCP mapping. 3907 * 3908 * \param [in] unit Unit Number. 3909 * \param [in] port Port Number. 3910 * \param [in] int_pri Internal priority. -1 means any internal priority. 3911 * \param [in] cng Congestion. -1 means any congestion. 3912 * \param [in] dscp DSCP marking on outgoing packet. -1 means not to change it. 3913 * 3914 * \retval SHR_E_NONE No errors. 3915 * \retval !SHR_E_NONE Failure. 3916 */ 3917 extern int 3918 mbcm_ltsw_port_phb_dscp_map_set( 3919 int unit, 3920 bcm_port_t port, 3921 int int_pri, 3922 int cng, 3923 int dscp); 3924 3925 /*! 3926 * \brief Get internal priority and congestion to packet DSCP mapping. 3927 * 3928 * \param [in] unit Unit Number. 3929 * \param [in] port Port Number. 3930 * \param [in] int_pri Internal priority. -1 means first internal priority. 3931 * \param [in] cng Congestion. -1 means first congestion. 3932 * \param [out] dscp DSCP marking on outgoing packet. NULL means not to get it. 3933 * 3934 * \retval SHR_E_NONE No errors. 3935 * \retval !SHR_E_NONE Failure. 3936 */ 3937 extern int 3938 mbcm_ltsw_port_phb_dscp_map_get( 3939 int unit, 3940 bcm_port_t port, 3941 int int_pri, 3942 int cng, 3943 int *dscp); 3944 3945 /*! 3946 * \brief Set DSCP mapping mode. 3947 * 3948 * \param [in] unit Unit Number. 3949 * \param [in] port Port Number. 3950 * \param [in] mode DSCP mapping mode. 3951 * 3952 * \retval SHR_E_NONE No errors. 3953 * \retval !SHR_E_NONE Failure. 3954 */ 3955 extern int 3956 mbcm_ltsw_port_dscp_phb_map_mode_set( 3957 int unit, 3958 bcm_port_t port, 3959 int mode); 3960 3961 /*! 3962 * \brief Get DSCP mapping mode. 3963 * 3964 * \param [in] unit Unit Number. 3965 * \param [in] port Port Number. 3966 * \param [out] mode DSCP mapping mode. 3967 * 3968 * \retval SHR_E_NONE No errors. 3969 * \retval !SHR_E_NONE Failure. 3970 */ 3971 extern int 3972 mbcm_ltsw_port_dscp_phb_map_mode_get( 3973 int unit, 3974 bcm_port_t port, 3975 int *mode); 3976 3977 /*! 3978 * \brief Enable/Disable BPDU reception on the specified port. 3979 * 3980 * \param [in] unit Unit Number. 3981 * \param [in] port Port Number. 3982 * \param [in] enable TRUE to enable, FALSE to disable (reject bpdu). 3983 * 3984 * \retval SHR_E_NONE No errors. 3985 * \retval !SHR_E_NONE Failure. 3986 */ 3987 extern int 3988 mbcm_ltsw_port_bpdu_enable_set( 3989 int unit, 3990 bcm_port_t port, 3991 int enable); 3992 3993 /*! 3994 * \brief Return whether BPDU reception is enabled on the specified port. 3995 * 3996 * \param [in] unit Unit Number. 3997 * \param [in] port Port Number. 3998 * \param [out] enable TRUE if enabled, FALSE if disabled 3999 * 4000 * \retval SHR_E_NONE No errors. 4001 * \retval !SHR_E_NONE Failure. 4002 */ 4003 extern int 4004 mbcm_ltsw_port_bpdu_enable_get( 4005 int unit, 4006 bcm_port_t port, 4007 int *enable); 4008 4009 /*! 4010 * \brief Set egress shaper information. 4011 * 4012 * \param [in] unit Unit Number. 4013 * \param [in] port Port Number. 4014 * \param [in] bandwidth Port bandwidth in kbps or pps. 0 means shaper is disabled. 4015 * \param [in] burst Maximum burst size in kbits or packets. 4016 * \param [in] mode Byte mode or packet mode. 4017 * 4018 * \retval SHR_E_NONE No errors. 4019 * \retval !SHR_E_NONE Failure. 4020 */ 4021 extern int 4022 mbcm_ltsw_port_egr_shaper_set( 4023 int unit, 4024 bcm_port_t port, 4025 uint32_t bandwidth, 4026 uint32_t burst, 4027 bcmi_ltsw_port_shaper_mode_t mode); 4028 4029 /*! 4030 * \brief Get egress shaper information. 4031 * 4032 * \param [in] unit Unit Number. 4033 * \param [in] port Port Number. 4034 * \param [out] bandwidth Port bandwidth in kbps or pps. 4035 * \param [out] burst Maximum burst size in kbits or packets. 4036 * \param [out] mode Byte mode or packet mode. 4037 * 4038 * \retval SHR_E_NONE No errors. 4039 * \retval !SHR_E_NONE Failure. 4040 */ 4041 extern int 4042 mbcm_ltsw_port_egr_shaper_get( 4043 int unit, 4044 bcm_port_t port, 4045 uint32_t *bandwidth, 4046 uint32_t *burst, 4047 bcmi_ltsw_port_shaper_mode_t *mode); 4048 4049 /*! 4050 * \brief Validate egress shaper settings. 4051 * 4052 * \param [in] unit Unit Number. 4053 * \param [in] port Port Number. 4054 * \param [in] bandwidth Port bandwidth in kbps or pps. 0 means shaper is disabled. 4055 * \param [in] burst Maximum burst size in kbits or packets. 4056 * \param [in] mode Byte mode or packet mode. 4057 * 4058 * \retval SHR_E_NONE No errors. 4059 * \retval !SHR_E_NONE Failure. 4060 */ 4061 extern int 4062 mbcm_ltsw_port_egr_shaper_validate( 4063 int unit, 4064 bcm_port_t port, 4065 uint32_t bandwidth, 4066 uint32_t burst, 4067 bcmi_ltsw_port_shaper_mode_t mode); 4068 4069 /*! 4070 * \brief Validate port class settings. 4071 * 4072 * \param [in] unit Unit Number. 4073 * \param [inout] port Port Number. 4074 * \param [in] class Classification type. 4075 * \param [in] class_id Class ID of the port. 4076 * 4077 * \retval SHR_E_NONE No errors. 4078 * \retval !SHR_E_NONE Failure. 4079 */ 4080 extern int 4081 mbcm_ltsw_port_class_validate( 4082 int unit, 4083 bcm_port_t *port, 4084 bcm_port_class_t class, 4085 uint32_t class_id); 4086 4087 /*! 4088 * \brief Get port group range based on destination type. 4089 * 4090 * \param [in] unit Unit Number. 4091 * \param [in] type Destination type. 4092 * \param [out] range Range of port group. 4093 * 4094 * \retval SHR_E_NONE No errors. 4095 * \retval !SHR_E_NONE Failure. 4096 */ 4097 extern int 4098 mbcm_ltsw_port_group_range_get( 4099 int unit, 4100 bcm_port_group_type_t type, 4101 bcm_port_group_range_t *range); 4102 4103 /*! 4104 * \brief Get the count of packets (or cells) currently buffered for a port. 4105 * 4106 * \param [in] unit Unit Number. 4107 * \param [in] port Port Number. 4108 * \param [out] count Count of packets (or cells) currently buffered. 4109 * 4110 * \retval SHR_E_NONE No errors. 4111 * \retval !SHR_E_NONE Failure. 4112 */ 4113 extern int 4114 mbcm_ltsw_port_queue_count_get( 4115 int unit, 4116 bcm_port_t port, 4117 uint32_t *count); 4118 4119 /*! 4120 * \brief Check flexport input parameters and port status are valid. 4121 * 4122 * \param [in] unit Unit Number. 4123 * \param [in] resource Flexport internal resource. 4124 * 4125 * \retval SHR_E_NONE No errors. 4126 * \retval !SHR_E_NONE Failure. 4127 */ 4128 extern int 4129 mbcm_ltsw_flexport_input_validate( 4130 int unit, 4131 ltsw_flexport_resource_t *resource); 4132 4133 /*! 4134 * \brief Check device has enough resource to complete all operations. 4135 * 4136 * \param [in] unit Unit Number. 4137 * \param [in] resource Flexport internal resource. 4138 * 4139 * \retval SHR_E_NONE No errors. 4140 * \retval !SHR_E_NONE Failure. 4141 */ 4142 extern int 4143 mbcm_ltsw_flexport_resource_validate( 4144 int unit, 4145 ltsw_flexport_resource_t *resource); 4146 4147 /*! 4148 * \brief check if Portmacro accommodate the new speed. 4149 * 4150 * \param [in] unit Unit Number. 4151 * \param [in] speed_resource speed resource. 4152 * \param [out] affected_ports Bitmap of affected ports. 4153 * 4154 * \retval SHR_E_NONE No errors. 4155 * \retval !SHR_E_NONE Failure. 4156 */ 4157 extern int 4158 mbcm_ltsw_port_speed_config_validate( 4159 int unit, 4160 bcm_port_resource_t *speed_resource, 4161 bcm_pbmp_t *affected_ports); 4162 4163 /*! 4164 * \brief Check if the device has enough resource to complete all operations and rearrange ports in one pm. 4165 * 4166 * \param [in] unit Unit Number. 4167 * \param [in] nport Port number. 4168 * \param [in] port_resource Port configuration resource. 4169 * \param [in] original_tvco PM original tvco. 4170 * 4171 * \retval SHR_E_NONE No errors. 4172 * \retval !SHR_E_NONE Failure. 4173 */ 4174 extern int 4175 mbcm_ltsw_pm_port_init_adjust( 4176 int unit, 4177 int nport, 4178 ltsw_flexport_port_cfg_t *port_resource, 4179 int original_tvco); 4180 4181 /*! 4182 * \brief Attach ports to the BCM layer and initialize them to the default state. 4183 * 4184 * \param [in] unit Unit Number. 4185 * \param [in] resource Flexport internal resource. 4186 * 4187 * \retval SHR_E_NONE No errors. 4188 * \retval !SHR_E_NONE Failure. 4189 */ 4190 extern int 4191 mbcm_ltsw_flexport_resource_attach( 4192 int unit, 4193 ltsw_flexport_resource_t *resource); 4194 4195 /*! 4196 * \brief Detach ports from the BCM layer. 4197 * 4198 * \param [in] unit Unit Number. 4199 * \param [in] resource Flexport internal resource. 4200 * 4201 * \retval SHR_E_NONE No errors. 4202 * \retval !SHR_E_NONE Failure. 4203 */ 4204 extern int 4205 mbcm_ltsw_flexport_resource_detach( 4206 int unit, 4207 ltsw_flexport_resource_t *resource); 4208 4209 /*! 4210 * \brief Update the port resource status to depedent modules after flex operation. 4211 * 4212 * \param [in] unit Unit Number. 4213 * \param [in] resource Flexport internal resource. 4214 * 4215 * \retval SHR_E_NONE No errors. 4216 * \retval !SHR_E_NONE Failure. 4217 */ 4218 extern int 4219 mbcm_ltsw_flexport_resource_status_update( 4220 int unit, 4221 ltsw_flexport_resource_t *resource); 4222 4223 /*! 4224 * \brief Attach counter entries to the given port. 4225 * 4226 * \param [in] unit Unit Number. 4227 * \param [in] port Port Number. 4228 * \param [in] stat_id Stat Counter ID. 4229 * 4230 * \retval SHR_E_NONE No errors. 4231 * \retval !SHR_E_NONE Failure. 4232 */ 4233 extern int 4234 mbcm_ltsw_port_stat_attach( 4235 int unit, 4236 bcm_port_t port, 4237 uint32_t stat_id); 4238 4239 /*! 4240 * \brief Detach counter entries to given port. 4241 * 4242 * \param [in] unit Unit Number. 4243 * \param [in] port Port Number. 4244 * \param [in] stat_id Stat Counter ID. 4245 * 4246 * \retval SHR_E_NONE No errors. 4247 * \retval !SHR_E_NONE Failure. 4248 */ 4249 extern int 4250 mbcm_ltsw_port_stat_detach( 4251 int unit, 4252 bcm_port_t port, 4253 uint32_t stat_id); 4254 4255 /*! 4256 * \brief Attach flex state action to the given port. 4257 * 4258 * \param [in] unit Unit Number. 4259 * \param [in] port Port Number. 4260 * \param [in] action_id Flex state ID. 4261 * 4262 * \retval SHR_E_NONE No errors. 4263 * \retval !SHR_E_NONE Failure. 4264 */ 4265 extern int 4266 mbcm_ltsw_port_flexstate_attach( 4267 int unit, 4268 bcm_port_t port, 4269 uint32_t action_id); 4270 4271 /*! 4272 * \brief Detach flex state action to given port. 4273 * 4274 * \param [in] unit Unit Number. 4275 * \param [in] port Port Number. 4276 * \param [in] action_id Flex state ID. 4277 * 4278 * \retval SHR_E_NONE No errors. 4279 * \retval !SHR_E_NONE Failure. 4280 */ 4281 extern int 4282 mbcm_ltsw_port_flexstate_detach( 4283 int unit, 4284 bcm_port_t port, 4285 uint32_t action_id); 4286 4287 /*! 4288 * \brief Set selective per-port blocking of flooded traffic. 4289 * 4290 * \param [in] unit Unit Number. 4291 * \param [in] ing_port Ingress port. 4292 * \param [in] egr_port Egress port. 4293 * \param [in] flags Specifies the type of traffic to block. 4294 * 4295 * \retval SHR_E_NONE No errors. 4296 * \retval !SHR_E_NONE Failure. 4297 */ 4298 extern int 4299 mbcm_ltsw_port_flood_block_set( 4300 int unit, 4301 bcm_port_t ing_port, 4302 bcm_port_t egr_port, 4303 uint32_t flags); 4304 4305 /*! 4306 * \brief Get the current per-port flood block settings. 4307 * 4308 * \param [in] unit Unit Number. 4309 * \param [in] ing_port Ingress port. 4310 * \param [in] egr_port Egress port. 4311 * \param [out] flags Specifies the type of traffic to block. 4312 * 4313 * \retval SHR_E_NONE No errors. 4314 * \retval !SHR_E_NONE Failure. 4315 */ 4316 extern int 4317 mbcm_ltsw_port_flood_block_get( 4318 int unit, 4319 bcm_port_t ing_port, 4320 bcm_port_t egr_port, 4321 uint32_t *flags); 4322 4323 /*! 4324 * \brief Set switching only to indicated ports from given (modid, port). 4325 * 4326 * \param [in] unit Unit Number. 4327 * \param [in] port Ingress port or gport. 4328 * \param [in] modid Source module ID. 4329 * \param [in] pbmp Bitmap of ports to allow egress. 4330 * 4331 * \retval SHR_E_NONE No errors. 4332 * \retval !SHR_E_NONE Failure. 4333 */ 4334 extern int 4335 mbcm_ltsw_port_egress_set( 4336 int unit, 4337 bcm_port_t port, 4338 int modid, 4339 bcm_pbmp_t pbmp); 4340 4341 /*! 4342 * \brief Retrieve bitmap of ports for which switching is enabled for (modid, port). 4343 * 4344 * \param [in] unit Unit Number. 4345 * \param [in] port Ingress port or gport. 4346 * \param [in] modid Source module ID. 4347 * \param [out] pbmp Bitmap of ports where egress allowed. 4348 * 4349 * \retval SHR_E_NONE No errors. 4350 * \retval !SHR_E_NONE Failure. 4351 */ 4352 extern int 4353 mbcm_ltsw_port_egress_get( 4354 int unit, 4355 bcm_port_t port, 4356 int modid, 4357 bcm_pbmp_t *pbmp); 4358 4359 /*! 4360 * \brief Add a match to an existing port. 4361 * 4362 * \param [in] unit Unit Number. 4363 * \param [in] port Port Number. 4364 * \param [in] match Match criteria. 4365 * 4366 * \retval SHR_E_NONE No errors. 4367 * \retval !SHR_E_NONE Failure. 4368 */ 4369 extern int 4370 mbcm_ltsw_port_match_add( 4371 int unit, 4372 bcm_port_t port, 4373 bcm_port_match_info_t *match); 4374 4375 /*! 4376 * \brief Remove a match from an existing port. 4377 * 4378 * \param [in] unit Unit Number. 4379 * \param [in] port Port Number. 4380 * \param [in] match Match criteria. 4381 * 4382 * \retval SHR_E_NONE No errors. 4383 * \retval !SHR_E_NONE Failure. 4384 */ 4385 extern int 4386 mbcm_ltsw_port_match_delete( 4387 int unit, 4388 bcm_port_t port, 4389 bcm_port_match_info_t *match); 4390 4391 /*! 4392 * \brief Get all the matches for an existing port. 4393 * 4394 * \param [in] unit Unit Number. 4395 * \param [in] port Port Number. 4396 * \param [in] size Number of elements in match array. 4397 * \param [out] array Match criteria array. 4398 * \param [out] count Match count. 4399 * 4400 * \retval SHR_E_NONE No errors. 4401 * \retval !SHR_E_NONE Failure. 4402 */ 4403 extern int 4404 mbcm_ltsw_port_match_multi_get( 4405 int unit, 4406 bcm_port_t port, 4407 int size, 4408 bcm_port_match_info_t *array, 4409 int *count); 4410 4411 /*! 4412 * \brief Set port HG3 enable. 4413 * 4414 * \param [in] unit Unit Number. 4415 * \param [in] port Port Number. 4416 * \param [in] enable HG3 enable. 4417 * 4418 * \retval SHR_E_NONE No errors. 4419 * \retval !SHR_E_NONE Failure. 4420 */ 4421 extern int 4422 mbcm_ltsw_port_hg3_enable_set( 4423 int unit, 4424 bcm_port_t port, 4425 int enable); 4426 4427 /*! 4428 * \brief Get port HG3 enable. 4429 * 4430 * \param [in] unit Unit Number. 4431 * \param [in] port Port Number. 4432 * \param [out] enable HG3 enable. 4433 * 4434 * \retval SHR_E_NONE No errors. 4435 * \retval !SHR_E_NONE Failure. 4436 */ 4437 extern int 4438 mbcm_ltsw_port_hg3_enable_get( 4439 int unit, 4440 bcm_port_t port, 4441 int *enable); 4442 4443 /*! 4444 * \brief Set HG3 Ethernet Type. 4445 * 4446 * \param [in] unit Unit Number. 4447 * \param [in] type HG3 Ethernet Type. 4448 * 4449 * \retval SHR_E_NONE No errors. 4450 * \retval !SHR_E_NONE Failure. 4451 */ 4452 extern int 4453 mbcm_ltsw_port_hg3_eth_type_set( 4454 int unit, 4455 int type); 4456 4457 /*! 4458 * \brief Get HG3 Ethernet Type. 4459 * 4460 * \param [in] unit Unit Number. 4461 * \param [out] type HG3 Ethernet Type. 4462 * 4463 * \retval SHR_E_NONE No errors. 4464 * \retval !SHR_E_NONE Failure. 4465 */ 4466 extern int 4467 mbcm_ltsw_port_hg3_eth_type_get( 4468 int unit, 4469 int *type); 4470 4471 /*! 4472 * \brief Get the list of ancillary ports belonging to the same port block as the controlling port. 4473 * 4474 * \param [in] unit Unit Number. 4475 * \param [in] port Controlling port. 4476 * \param [out] pbmp Ports belonging to the controlling port. 4477 * 4478 * \retval SHR_E_NONE No errors. 4479 * \retval !SHR_E_NONE Failure. 4480 */ 4481 extern int 4482 mbcm_ltsw_port_subsidiary_ports_get( 4483 int unit, 4484 bcm_port_t port, 4485 bcm_pbmp_t *pbmp); 4486 4487 /*! 4488 * \brief Get the spec of port module resources. 4489 * 4490 * \param [in] unit Unit Number. 4491 * \param [in] type Resource type. 4492 * \param [out] spec Spec of identified resource. 4493 * 4494 * \retval SHR_E_NONE No errors. 4495 * \retval !SHR_E_NONE Failure. 4496 */ 4497 extern int 4498 mbcm_ltsw_port_resource_spec_get( 4499 int unit, 4500 bcmi_ltsw_port_resource_type_t type, 4501 const bcmi_ltsw_port_resource_spec_t **spec); 4502 4503 /*! 4504 * \brief Enable egress VLAN membership check for IFP redirection. 4505 * 4506 * \param [in] unit Unit Number. 4507 * \param [in] enable Enable or disable. 4508 * 4509 * \retval SHR_E_NONE No errors. 4510 * \retval !SHR_E_NONE Failure. 4511 */ 4512 extern int 4513 mbcm_ltsw_port_ifp_egr_vlan_check_enable_set( 4514 int unit, 4515 uint32_t enable); 4516 4517 /*! 4518 * \brief Get egress VLAN membership check enable for IFP redirection. 4519 * 4520 * \param [in] unit Unit Number. 4521 * \param [out] enable Enable or disable. 4522 * 4523 * \retval SHR_E_NONE No errors. 4524 * \retval !SHR_E_NONE Failure. 4525 */ 4526 extern int 4527 mbcm_ltsw_port_ifp_egr_vlan_check_enable_get( 4528 int unit, 4529 uint32_t *enable); 4530 4531 /*! 4532 * \brief Get flags to disable VLAN membership check. 4533 * 4534 * \param [in] unit Unit Number. 4535 * \param [in] port Port Number. 4536 * \param [out] flags Flags to disable VLAN membership check. 4537 * 4538 * \retval SHR_E_NONE No errors. 4539 * \retval !SHR_E_NONE Failure. 4540 */ 4541 extern int 4542 mbcm_ltsw_port_vlan_check_disable_get( 4543 int unit, 4544 bcm_port_t port, 4545 uint16_t *flags); 4546 4547 /*! 4548 * \brief Get flags to disable STG check. 4549 * 4550 * \param [in] unit Unit Number. 4551 * \param [in] port Port Number. 4552 * \param [out] flags Flags to disable STG check. 4553 * 4554 * \retval SHR_E_NONE No errors. 4555 * \retval !SHR_E_NONE Failure. 4556 */ 4557 extern int 4558 mbcm_ltsw_port_stg_check_disable_get( 4559 int unit, 4560 bcm_port_t port, 4561 uint16_t *flags); 4562 4563 /*! 4564 * \brief Dump port sw infomation. 4565 * 4566 * \param [in] unit Unit Number. 4567 * 4568 * \retval SHR_E_NONE No errors. 4569 * \retval !SHR_E_NONE Failure. 4570 */ 4571 extern int 4572 mbcm_ltsw_port_dump_sw(int unit); 4573 4574 /*! 4575 * \brief Allocate an ID from L2_IF pool. 4576 * 4577 * \param [in] unit Unit Number. 4578 * \param [out] l2_if Allocated ID. 4579 * 4580 * \retval SHR_E_NONE No errors. 4581 * \retval SHR_E_EMPTY No available ID to allocacte. 4582 * \retval !SHR_E_NONE Failure. 4583 */ 4584 extern int 4585 mbcm_ltsw_l2_if_alloc( 4586 int unit, 4587 int *l2_if); 4588 4589 /*! 4590 * \brief Free an ID to L2_IF pool. 4591 * 4592 * \param [in] unit Unit Number. 4593 * \param [in] l2_if ID to free. 4594 * 4595 * \retval SHR_E_NONE No errors. 4596 * \retval SHR_E_FULL The ID is already free. 4597 * \retval !SHR_E_NONE Failure. 4598 */ 4599 extern int 4600 mbcm_ltsw_l2_if_free( 4601 int unit, 4602 int l2_if); 4603 4604 /*! 4605 * \brief Dump L2_IF pool. 4606 * 4607 * \param [in] unit Unit Number. 4608 * 4609 * \retval SHR_E_NONE No errors. 4610 * \retval !SHR_E_NONE Failure. 4611 */ 4612 extern int 4613 mbcm_ltsw_l2_if_dump(int unit); 4614 4615 /*! 4616 * \brief Set the configuration for Flight Data Recorder (FDR) on a port. 4617 * 4618 * \param [in] unit Unit Number. 4619 * \param [in] port Port number. 4620 * \param [in] fdr_config Flight Data Recorder (FDR) configuration 4621 * 4622 * \retval SHR_E_NONE No errors. 4623 * \retval !SHR_E_NONE Failure. 4624 */ 4625 extern int 4626 mbcm_ltsw_port_fdr_config_set( 4627 int unit, 4628 bcm_port_t port, 4629 bcm_port_fdr_config_t *fdr_config); 4630 4631 /*! 4632 * \brief Get the configuration for Flight Data Recorder (FDR) on a port. 4633 * 4634 * \param [in] unit Unit Number. 4635 * \param [in] port Port number. 4636 * \param [out] fdr_config Flight Data Recorder (FDR) configuration 4637 * 4638 * \retval SHR_E_NONE No errors. 4639 * \retval !SHR_E_NONE Failure. 4640 */ 4641 extern int 4642 mbcm_ltsw_port_fdr_config_get( 4643 int unit, 4644 bcm_port_t port, 4645 bcm_port_fdr_config_t *fdr_config); 4646 4647 /*! 4648 * \brief Get the statistics of Flight Data Recorder (FDR) on a port. 4649 * 4650 * \param [in] unit Unit Number. 4651 * \param [in] port Port number. 4652 * \param [out] fdr_stats Flight Data Recorder (FDR) statistics 4653 * 4654 * \retval SHR_E_NONE No errors. 4655 * \retval !SHR_E_NONE Failure. 4656 */ 4657 extern int 4658 mbcm_ltsw_port_fdr_stats_get( 4659 int unit, 4660 bcm_port_t port, 4661 bcm_port_fdr_stats_t *fdr_stats); 4662 4663 /*! 4664 * \brief Register port Flight Data Recorder (FDR) interrupt notification callbacks. 4665 * 4666 * \param [in] unit Unit Number. 4667 * \param [in] f Flight Data Recorder (FDR) callback 4668 * \param [in] user_data user data pointer 4669 * 4670 * \retval SHR_E_NONE No errors. 4671 * \retval !SHR_E_NONE Failure. 4672 */ 4673 extern int 4674 mbcm_ltsw_port_fdr_callback_register( 4675 int unit, 4676 bcm_port_fdr_handler_t f, 4677 void *user_data); 4678 4679 /*! 4680 * \brief Unregister port Flight Data Recorder (FDR) interrupt notification callbacks. 4681 * 4682 * \param [in] unit Unit Number. 4683 * \param [in] f Flight Data Recorder (FDR) callback 4684 * \param [in] user_data user data pointer 4685 * 4686 * \retval SHR_E_NONE No errors. 4687 * \retval !SHR_E_NONE Failure. 4688 */ 4689 extern int 4690 mbcm_ltsw_port_fdr_callback_unregister( 4691 int unit, 4692 bcm_port_fdr_handler_t f, 4693 void *user_data); 4694 4695 #endif /* BCMINT_LTSW_MBCM_PORT_H */