mpls.h (50723B)
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_MPLS_H 12 #define BCMINT_LTSW_MBCM_MPLS_H 13 14 #include <bcm/mpls.h> 15 #include <bcm/types.h> 16 #include <bcm_int/ltsw/flexctr.h> 17 18 #include <bcm_int/ltsw/mpls.h> 19 #include <bcm_int/ltsw/mpls_int.h> 20 21 #include <sal/sal_types.h> 22 #include <bcmltd/bcmltd_lt_types.h> 23 24 /*! 25 * \brief Dump device-spefic SW MPLS info. 26 * 27 * \param [in] unit Unit Number. 28 * 29 * \retval SHR_E_NONE No errors. 30 * \retval !SHR_E_NONE Failure. 31 */ 32 typedef int (*mpls_sw_dump_f)(int unit); 33 34 /*! 35 * \brief Initialize device-spefic MPLS info. 36 * 37 * \param [in] unit Unit Number. 38 * 39 * \retval SHR_E_NONE No errors. 40 * \retval !SHR_E_NONE Failure. 41 */ 42 typedef int (*mpls_init_f)(int unit); 43 44 /*! 45 * \brief Deinitialize device-spefic MPLS info. 46 * 47 * \param [in] unit Unit Number. 48 * 49 * \retval SHR_E_NONE No errors. 50 * \retval !SHR_E_NONE Failure. 51 */ 52 typedef int (*mpls_detach_f)(int unit); 53 54 /*! 55 * \brief Add an MPLS tunnel terminator. 56 * 57 * \param [in] unit Unit Number. 58 * \param [in/out] info MPLS tunnel terminator info. 59 * 60 * \retval SHR_E_NONE No errors. 61 * \retval !SHR_E_NONE Failure. 62 */ 63 typedef int (*mpls_tnl_switch_add_f)( 64 int unit, 65 bcm_mpls_tunnel_switch_t *info); 66 67 /*! 68 * \brief Delete an MPLS tunnel terminator. 69 * 70 * \param [in] unit Unit Number. 71 * \param [in] info MPLS tunnel terminator info. 72 * 73 * \retval SHR_E_NONE No errors. 74 * \retval !SHR_E_NONE Failure. 75 */ 76 typedef int (*mpls_tnl_switch_delete_f)( 77 int unit, 78 bcm_mpls_tunnel_switch_t *info); 79 80 /*! 81 * \brief Get an MPLS tunnel terminator. 82 * 83 * \param [in] unit Unit Number. 84 * \param [in/out] info MPLS tunnel terminator info. 85 * 86 * \retval SHR_E_NONE No errors. 87 * \retval !SHR_E_NONE Failure. 88 */ 89 typedef int (*mpls_tnl_switch_get_f)( 90 int unit, 91 bcm_mpls_tunnel_switch_t *info); 92 93 /*! 94 * \brief Traverse valid tunnel terminators and call the callback. 95 * 96 * \param [in] unit Unit Number. 97 * \param [in] cb User callback function, called once per tunnel terminator. 98 * \param [in] user_data Cookie. 99 * 100 * \retval SHR_E_NONE No errors. 101 * \retval !SHR_E_NONE Failure. 102 */ 103 typedef int (*mpls_tnl_switch_traverse_f)( 104 int unit, 105 bcm_mpls_tunnel_switch_traverse_cb cb, 106 void *user_data); 107 108 /*! 109 * \brief Delete all MPLS tunnel terminators. 110 * 111 * \param [in] unit Unit Number. 112 * 113 * \retval SHR_E_NONE No errors. 114 * \retval !SHR_E_NONE Failure. 115 */ 116 typedef int (*mpls_tnl_switch_delete_all_f)(int unit); 117 118 /*! 119 * \brief Clear the MPLS tunnel initiator parameters for an L3 interface. 120 * 121 * \param [in] unit Unit Number. 122 * \param [in] intf The egress L3 interface. 123 * 124 * \retval SHR_E_NONE No errors. 125 * \retval !SHR_E_NONE Failure. 126 */ 127 typedef int (*mpls_tnl_initiator_clear_f)( 128 int unit, 129 bcm_if_t intf); 130 131 /*! 132 * \brief Clear all the MPLS tunnel initiator parameters all L3 Interfaces. 133 * 134 * \param [in] unit Unit Number. 135 * 136 * \retval SHR_E_NONE No errors. 137 * \retval !SHR_E_NONE Failure. 138 */ 139 typedef int (*mpls_tnl_initiator_clear_all_f)(int unit); 140 141 /*! 142 * \brief Get the the MPLS tunnel initiator parameters for an L3 interface. 143 * 144 * \param [in] unit Unit Number. 145 * \param [in] intf The egress L3 interface. 146 * \param [in] label_max Number of entries in label_array. 147 * \param [out] label_array MPLS header information. 148 * \param [out] label_count Actual number of labels returned. 149 * 150 * \retval SHR_E_NONE No errors. 151 * \retval !SHR_E_NONE Failure. 152 */ 153 typedef int (*mpls_tnl_initiator_get_f)( 154 int unit, 155 bcm_if_t intf, 156 int label_max, 157 bcm_mpls_egress_label_t *label_array, 158 int *label_count); 159 160 /*! 161 * \brief Set the MPLS tunnel initiator parameters for an L3 interface. 162 * 163 * \param [in] unit Unit Number. 164 * \param [in] intf The egress L3 interface. 165 * \param [in] num_labels Number of entries in label_array. 166 * \param [in] label_array MPLS header information. 167 * 168 * \retval SHR_E_NONE No errors. 169 * \retval !SHR_E_NONE Failure. 170 */ 171 typedef int (*mpls_tnl_initiator_set_f)( 172 int unit, 173 bcm_if_t intf, 174 int num_labels, 175 bcm_mpls_egress_label_t *label_array); 176 177 /*! 178 * \brief Add the MPLS tunnel initiator. 179 * 180 * \param [in] unit Unit Number. 181 * \param [in] options Opertation options. 182 * \param [in/out] tunnel_encap MPLS tunnel initiator info. 183 * 184 * \retval SHR_E_NONE No errors. 185 * \retval !SHR_E_NONE Failure. 186 */ 187 typedef int (*mpls_tnl_encap_create_f)( 188 int unit, 189 uint32_t options, 190 bcm_mpls_tunnel_encap_t *tunnel_encap); 191 192 /*! 193 * \brief Get the MPLS tunnel initiator. 194 * 195 * \param [in] unit Unit Number. 196 * \param [in/out] tunnel_encap MPLS tunnel initiator info. 197 * 198 * \retval SHR_E_NONE No errors. 199 * \retval !SHR_E_NONE Failure. 200 */ 201 typedef int (*mpls_tnl_encap_get_f)( 202 int unit, 203 bcm_mpls_tunnel_encap_t *tunnel_encap); 204 205 /*! 206 * \brief Destroy the MPLS tunnel initiator. 207 * 208 * \param [in] unit Unit Number. 209 * \param [in] tunnel_id MPLS tunnel initiator info. 210 * 211 * \retval SHR_E_NONE No errors. 212 * \retval !SHR_E_NONE Failure. 213 */ 214 typedef int (*mpls_tnl_encap_destroy_f)( 215 int unit, 216 bcm_gport_t tunnel_id); 217 218 /*! 219 * \brief Destroy all MPLS tunnel initiators. 220 * 221 * \param [in] unit Unit Number. 222 * 223 * \retval SHR_E_NONE No errors. 224 * \retval !SHR_E_NONE Failure. 225 */ 226 typedef int (*mpls_tnl_encap_destroy_all_f)(int unit); 227 228 /*! 229 * \brief Configure the MPLS VFI. 230 * 231 * \param [in] unit Unit Number. 232 * \param [in] opcode Configure operation code. 233 * \param [in] vfi_idx VFI index. 234 * \param [in] info VPN configuration info. 235 * 236 * \retval SHR_E_NONE No errors. 237 * \retval !SHR_E_NONE Failure. 238 */ 239 typedef int (*mpls_vfi_op_f)( 240 int unit, 241 bcmlt_opcode_t opcode, 242 int vfi_idx, 243 bcm_mpls_vpn_config_t *info); 244 245 /*! 246 * \brief Get VPWS info. 247 * 248 * \param [in] unit Unit Number. 249 * \param [in/out] idx_min VPWS index min. 250 * \param [in/out] idx_max VPWS index max. 251 * 252 * \retval SHR_E_NONE No errors. 253 * \retval !SHR_E_NONE Failure. 254 */ 255 typedef int (*mpls_vpws_info_get_f)( 256 int unit, 257 int *idx_min, 258 int *idx_max); 259 260 /*! 261 * \brief Add the MPLS port. 262 * 263 * \param [in] unit Unit Number. 264 * \param [in] vpn VPN ID. 265 * \param [in/out] mpls_port mpls port information. 266 * 267 * \retval SHR_E_NONE No errors. 268 * \retval !SHR_E_NONE Failure. 269 */ 270 typedef int (*mpls_port_add_f)( 271 int unit, 272 bcm_vpn_t vpn, 273 bcm_mpls_port_t *mpls_port); 274 275 /*! 276 * \brief Get the MPLS port. 277 * 278 * \param [in] unit Unit Number. 279 * \param [in] vpn VPN ID. 280 * \param [in] mpls_port_id mpls port ID. 281 * \param [in/out] mpls_port mpls port. 282 * 283 * \retval SHR_E_NONE No errors. 284 * \retval !SHR_E_NONE Failure. 285 */ 286 typedef int (*mpls_port_get_f)( 287 int unit, 288 bcm_vpn_t vpn, 289 bcm_gport_t mpls_port_id, 290 bcm_mpls_port_t *mpls_port); 291 292 /*! 293 * \brief Get all the MPLS ports in the vpn. 294 * 295 * \param [in] unit Unit Number. 296 * \param [in] vpn VPN ID. 297 * \param [in] port_max Maximum number of ports in array. 298 * \param [out] port_array Array of mpls ports. 299 * \param [out] port_count Number of ports returned in array. 300 * 301 * \retval SHR_E_NONE No errors. 302 * \retval !SHR_E_NONE Failure. 303 */ 304 typedef int (*mpls_vpls_port_get_all_f)( 305 int unit, 306 bcm_vpn_t vpn, 307 int port_max, 308 bcm_mpls_port_t *port_array, 309 int *port_count); 310 311 /*! 312 * \brief Delete the MPLS port. 313 * 314 * \param [in] unit Unit Number. 315 * \param [in] vpn VPN ID. 316 * \param [in] mpls_port_id mpls port ID. 317 * 318 * \retval SHR_E_NONE No errors. 319 * \retval !SHR_E_NONE Failure. 320 */ 321 typedef int (*mpls_port_delete_f)( 322 int unit, 323 bcm_vpn_t vpn, 324 bcm_gport_t mpls_port_id); 325 326 /*! 327 * \brief Delete all the MPLS ports in the specified VPLS VPN. 328 * 329 * \param [in] unit Unit Number. 330 * \param [in] vpn VPN ID. 331 * 332 * \retval SHR_E_NONE No errors. 333 * \retval !SHR_E_NONE Failure. 334 */ 335 typedef int (*mpls_vpls_port_delete_by_vpn_f)( 336 int unit, 337 bcm_vpn_t vpn); 338 339 /*! 340 * \brief Delete all vpls ports in the unit. 341 * 342 * \param [in] unit Unit Number. 343 * 344 * \retval SHR_E_NONE No errors. 345 * \retval !SHR_E_NONE Failure. 346 */ 347 typedef int (*mpls_vpls_port_delete_all_f)(int unit); 348 349 /*! 350 * \brief Attach the source port to the destination port. 351 * 352 * \param [in] unit Unit Number. 353 * \param [in] src_port_id Source port ID. 354 * \param [in] dst_port_id Destination port ID. 355 * 356 * \retval SHR_E_NONE No errors. 357 * \retval !SHR_E_NONE Failure. 358 */ 359 typedef int (*mpls_port_attach_f)( 360 int unit, 361 bcm_gport_t src_port_id, 362 bcm_gport_t dst_port_id); 363 364 /*! 365 * \brief Detach the mpls port ID. 366 * 367 * \param [in] unit Unit Number. 368 * \param [in] mpls_port_id mpls port ID. 369 * 370 * \retval SHR_E_NONE No errors. 371 * \retval !SHR_E_NONE Failure. 372 */ 373 typedef int (*mpls_port_detach_f)( 374 int unit, 375 bcm_gport_t mpls_port_id); 376 377 /*! 378 * \brief Validate the mpls port ID. 379 * 380 * \param [in] unit Unit Number. 381 * \param [in] mpls_port_id mpls port ID. 382 * 383 * \retval SHR_E_NONE No errors. 384 * \retval !SHR_E_NONE Failure. 385 */ 386 typedef int (*mpls_port_validate_f)( 387 int unit, 388 bcm_gport_t mpls_port_id); 389 390 /*! 391 * \brief Get the vlan list which contain MPLS ports. 392 * 393 * \param [in] unit Unit Number. 394 * \param [out] vlan_cnt Vlan count. 395 * \param [out] vlan_list Vlan list. 396 * 397 * \retval SHR_E_NONE No errors. 398 * \retval !SHR_E_NONE Failure. 399 */ 400 typedef int (*mpls_vlan_list_get_f)( 401 int unit, 402 int *vlan_cnt, 403 int *vlan_list); 404 405 /*! 406 * \brief Add identifier entry of special label. 407 * 408 * \param [in] unit Unit Number. 409 * \param [in] label_info Speical label info. 410 * 411 * \retval SHR_E_NONE No errors. 412 * \retval !SHR_E_NONE Failure. 413 */ 414 typedef int (*mpls_special_label_identifier_add_f)( 415 int unit, 416 bcm_mpls_special_label_t label_info); 417 418 /*! 419 * \brief Get identifier entry of special label. 420 * 421 * \param [in] unit Unit Number. 422 * \param [in/out] label_info Speical label info. 423 * 424 * \retval SHR_E_NONE No errors. 425 * \retval !SHR_E_NONE Failure. 426 */ 427 typedef int (*mpls_special_label_identifier_get_f)( 428 int unit, 429 bcm_mpls_special_label_t *label_info); 430 431 /*! 432 * \brief Delete identifier entry of special label. 433 * 434 * \param [in] unit Unit Number. 435 * \param [in] label_info Speical label info. 436 * 437 * \retval SHR_E_NONE No errors. 438 * \retval !SHR_E_NONE Failure. 439 */ 440 typedef int (*mpls_special_label_identifier_delete_f)( 441 int unit, 442 bcm_mpls_special_label_t label_info); 443 444 /*! 445 * \brief Delete all identifier entries of special labels. 446 * 447 * \param [in] unit Unit Number. 448 * 449 * \retval SHR_E_NONE No errors. 450 * \retval !SHR_E_NONE Failure. 451 */ 452 typedef int (*mpls_special_label_identifier_delete_all_f)(int unit); 453 454 /*! 455 * \brief Traverse all identifier entries of special labels. 456 * 457 * \param [in] unit Unit Number. 458 * \param [in] cb user callback. 459 * \param [in] user_data user data. 460 * 461 * \retval SHR_E_NONE No errors. 462 * \retval !SHR_E_NONE Failure. 463 */ 464 typedef int (*mpls_special_label_identifier_traverse_f)( 465 int unit, 466 bcm_mpls_special_label_identifier_traverse_cb cb, 467 void *user_data); 468 469 /*! 470 * \brief Set mpls global label range. 471 * 472 * \param [in] unit Unit Number. 473 * \param [in] range_num Range number. 0 : First range, 1 : Second range. 474 * \param [in] range_min Range min indicator. 0 : Range max, 1 : Range min 475 * \param [in] label_val Label value 476 * 477 * \retval SHR_E_NONE No errors. 478 * \retval !SHR_E_NONE Failure. 479 */ 480 typedef int (*mpls_global_label_range_set_f)( 481 int unit, 482 int range_num, 483 int range_min, 484 int label_val); 485 486 /*! 487 * \brief Get mpls global label range. 488 * 489 * \param [in] unit Unit Number. 490 * \param [in] range_num Range number. 0 : First range, 1 : Second range. 491 * \param [out] min_label Min label 492 * \param [out] max_label Max label 493 * 494 * \retval SHR_E_NONE No errors. 495 * \retval !SHR_E_NONE Failure. 496 */ 497 typedef int (*mpls_global_label_range_get_f)( 498 int unit, 499 int range_num, 500 int *min_label, 501 int *max_label); 502 503 /*! 504 * \brief Set MPLS global control. 505 * 506 * \param [in] unit Unit Number. 507 * \param [in] control_type Control type. 508 * \param [in] value Control value 509 * 510 * \retval SHR_E_NONE No errors. 511 * \retval !SHR_E_NONE Failure. 512 */ 513 typedef int (*mpls_global_control_set_f)( 514 int unit, 515 bcmi_ltsw_mpls_global_ctrl_t control_type, 516 int value); 517 518 /*! 519 * \brief Get MPLS global control. 520 * 521 * \param [in] unit Unit Number. 522 * \param [in] control_type Control type. 523 * \param [out] value Control value 524 * 525 * \retval SHR_E_NONE No errors. 526 * \retval !SHR_E_NONE Failure. 527 */ 528 typedef int (*mpls_global_control_get_f)( 529 int unit, 530 bcmi_ltsw_mpls_global_ctrl_t control_type, 531 int *value); 532 533 /*! 534 * \brief Add dst mac into MAC_DA profile. 535 * 536 * \param [in] unit Unit Number. 537 * \param [in] mac Dst MAC. 538 * \param [out] index Profile index. 539 * 540 * \retval SHR_E_NONE No errors. 541 * \retval !SHR_E_NONE Failure. 542 */ 543 typedef int (*mpls_tnl_dst_mac_profile_add_f)( 544 int unit, 545 uint64_t mac, 546 int *index); 547 548 /*! 549 * \brief Delete dst mac from MAC_DA profile. 550 * 551 * \param [in] unit Unit Number. 552 * \param [in] index Profile index. 553 * 554 * \retval SHR_E_NONE No errors. 555 * \retval !SHR_E_NONE Failure. 556 */ 557 typedef int (*mpls_tnl_dst_mac_profile_del_f)( 558 int unit, 559 int index); 560 561 /*! 562 * \brief Get dst mac from MAC_DA profile. 563 * 564 * \param [in] unit Unit Number. 565 * \param [in] index Profile index. 566 * \param [out] mac Dst MAC. 567 * 568 * \retval SHR_E_NONE No errors. 569 * \retval !SHR_E_NONE Failure. 570 */ 571 typedef int (*mpls_tnl_dst_mac_profile_get_f)( 572 int unit, 573 int index, 574 uint64_t *mac); 575 576 /*! 577 * \brief Attach flexctr action to the given MPLS label and gport. 578 * 579 * \param [in] unit Unit Number. 580 * \param [in] label MPLS label. 581 * \param [in] port MPLS Gport. 582 * \param [in] info Flex counter information. 583 * 584 * \retval SHR_E_NONE No errors. 585 * \retval !SHR_E_NONE Failure. 586 */ 587 typedef int (*mpls_label_flexctr_attach_f)( 588 int unit, 589 bcm_mpls_label_t label, 590 bcm_gport_t port, 591 bcmi_ltsw_flexctr_counter_info_t *info); 592 593 /*! 594 * \brief Detach flexctr action of the given MPLS label and gport. 595 * 596 * \param [in] unit Unit Number. 597 * \param [in] label MPLS label. 598 * \param [in] port MPLS Gport. 599 * 600 * \retval SHR_E_NONE No errors. 601 * \retval !SHR_E_NONE Failure. 602 */ 603 typedef int (*mpls_label_flexctr_detach_f)( 604 int unit, 605 bcm_mpls_label_t label, 606 bcm_gport_t port); 607 608 /*! 609 * \brief Get flex counter information of the given MPLS label and gport. 610 * 611 * \param [in] unit Unit Number. 612 * \param [in] label MPLS label. 613 * \param [in] port MPLS Gport. 614 * \param [out] info Flex counter information. 615 * 616 * \retval SHR_E_NONE No errors. 617 * \retval !SHR_E_NONE Failure. 618 */ 619 typedef int (*mpls_label_flexctr_info_get_f)( 620 int unit, 621 bcm_mpls_label_t label, 622 bcm_gport_t port, 623 bcmi_ltsw_flexctr_counter_info_t *info); 624 625 /*! 626 * \brief Set flex counter object value for the given MPLS label and gport. 627 * 628 * \param [in] unit Unit Number. 629 * \param [in] label MPLS label. 630 * \param [in] port MPLS Gport. 631 * \param [in] value The flex counter object value. 632 * 633 * \retval SHR_E_NONE No errors. 634 * \retval !SHR_E_NONE Failure. 635 */ 636 typedef int (*mpls_label_flexctr_object_set_f)( 637 int unit, 638 bcm_mpls_label_t label, 639 bcm_gport_t port, 640 uint32_t value); 641 642 /*! 643 * \brief Get flex counter object value for the given MPLS label and gport. 644 * 645 * \param [in] unit Unit Number. 646 * \param [in] label MPLS label. 647 * \param [in] port MPLS Gport. 648 * \param [out] value The flex counter object value. 649 * 650 * \retval SHR_E_NONE No errors. 651 * \retval !SHR_E_NONE Failure. 652 */ 653 typedef int (*mpls_label_flexctr_object_get_f)( 654 int unit, 655 bcm_mpls_label_t label, 656 bcm_gport_t port, 657 uint32_t *value); 658 659 /*! 660 * \brief Add MPLS encap labels. 661 * 662 * \param [in] unit Unit Number. 663 * \param [in] label_info Encap label info. 664 * \param [out] label_index VC label index. 665 * 666 * \retval SHR_E_NONE No errors. 667 * \retval !SHR_E_NONE Failure. 668 */ 669 typedef int (*mpls_encap_label_add_f)( 670 int unit, 671 bcmi_ltsw_mpls_encap_label_info_t *label_info, 672 int *label_index); 673 674 /*! 675 * \brief Get MPLS encap labels. 676 * 677 * \param [in] unit Unit Number. 678 * \param [in] label_index VC label index. 679 * \param [out] label_info Encap label info. 680 * 681 * \retval SHR_E_NONE No errors. 682 * \retval !SHR_E_NONE Failure. 683 */ 684 typedef int (*mpls_encap_label_get_f)( 685 int unit, 686 int label_index, 687 bcmi_ltsw_mpls_encap_label_info_t *label_info); 688 689 /*! 690 * \brief Delete MPLS encap labels. 691 * 692 * \param [in] unit Unit Number. 693 * \param [in] label_index VC label index. 694 * 695 * \retval SHR_E_NONE No errors. 696 * \retval !SHR_E_NONE Failure. 697 */ 698 typedef int (*mpls_encap_label_delete_f)( 699 int unit, 700 int label_index); 701 702 /*! 703 * \brief Increase reference count of VC label index. 704 * 705 * \param [in] unit Unit Number. 706 * \param [in] label_index VC label index. 707 * 708 * \retval SHR_E_NONE No errors. 709 * \retval !SHR_E_NONE Failure. 710 */ 711 typedef int (*mpls_encap_label_ref_inc_f)( 712 int unit, 713 int label_index); 714 715 /*! 716 * \brief Replace vp value in match entry of mpls port id . 717 * 718 * \param [in] unit Unit Number. 719 * \param [in] mpls_port_id MPLS port ID. 720 * \param [in] new_vp New VP ID. 721 * 722 * \retval SHR_E_NONE No errors. 723 * \retval !SHR_E_NONE Failure. 724 */ 725 typedef int (*mpls_port_match_vp_replace_f)( 726 int unit, 727 bcm_gport_t mpls_port_id, 728 int new_vp); 729 730 /*! 731 * \brief Get the vp value in match entry of mpls port id. 732 * 733 * \param [in] unit Unit Number. 734 * \param [in] mpls_port_id MPLS port ID. 735 * \param [in] new_vp New VP ID. 736 * 737 * \retval SHR_E_NONE No errors. 738 * \retval !SHR_E_NONE Failure. 739 */ 740 typedef int (*mpls_port_match_vp_get_f)( 741 int unit, 742 bcm_gport_t mpls_port_id, 743 int *new_vp); 744 745 /*! 746 * \brief Add an MPLS control packet entry. 747 * 748 * \param [in] unit Unit Number. 749 * \param [in] options Operation options. 750 * \param [in] match MPLS control packet match. 751 * \param [in] action MPLS control packet action. 752 * 753 * \retval SHR_E_NONE No errors. 754 * \retval !SHR_E_NONE Failure. 755 */ 756 typedef int (*mpls_control_pkt_add_f)( 757 int unit, 758 uint32_t options, 759 bcm_mpls_control_pkt_match_t *match, 760 bcm_mpls_control_pkt_action_t *action); 761 762 /*! 763 * \brief Get an MPLS control packet entry. 764 * 765 * \param [in] unit Unit Number. 766 * \param [in/out] match MPLS control packet match. 767 * \param [out] action MPLS control packet action. 768 * 769 * \retval SHR_E_NONE No errors. 770 * \retval !SHR_E_NONE Failure. 771 */ 772 typedef int (*mpls_control_pkt_get_f)( 773 int unit, 774 bcm_mpls_control_pkt_match_t *match, 775 bcm_mpls_control_pkt_action_t *action); 776 777 /*! 778 * \brief Delete an MPLS control packet entry. 779 * 780 * \param [in] unit Unit Number. 781 * \param [in/out] match MPLS control packet match. 782 * 783 * \retval SHR_E_NONE No errors. 784 * \retval !SHR_E_NONE Failure. 785 */ 786 typedef int (*mpls_control_pkt_delete_f)( 787 int unit, 788 bcm_mpls_control_pkt_match_t *match); 789 790 /*! 791 * \brief Traverse all MPLS control packet entries and call user.s callback. 792 * 793 * \param [in] unit Unit Number. 794 * \param [in] cb User callback function. 795 * \param [in] user_data User data. 796 * 797 * \retval SHR_E_NONE No errors. 798 * \retval !SHR_E_NONE Failure. 799 */ 800 typedef int (*mpls_control_pkt_traverse_f)( 801 int unit, 802 bcm_mpls_control_pkt_traverse_cb cb, 803 void *user_data); 804 805 /*! 806 * \brief Delete all MPLS control packet entries. 807 * 808 * \param [in] unit Unit Number. 809 * 810 * \retval SHR_E_NONE No errors. 811 * \retval !SHR_E_NONE Failure. 812 */ 813 typedef int (*mpls_control_pkt_delete_all_f)(int unit); 814 815 /*! 816 * \brief Get counter statistic values for specific MPLS label and gport. 817 * 818 * \param [in] unit Unit Number. 819 * \param [in] label MPLS label. 820 * \param [in] mpls_port MPLS port. 821 * \param [in] stat mpls port information. 822 * \param [out] val Stats value. 823 * 824 * \retval SHR_E_NONE No errors. 825 * \retval !SHR_E_NONE Failure. 826 */ 827 typedef int (*mpls_label_stat_get_f)( 828 int unit, 829 bcm_mpls_label_t label, 830 bcm_gport_t mpls_port, 831 bcm_mpls_stat_t stat, 832 uint64_t *val); 833 834 /*! 835 * \brief Clear counter statistic values for specific MPLS label and gport. 836 * 837 * \param [in] unit Unit Number. 838 * \param [in] label MPLS label. 839 * \param [in] mpls_port MPLS port. 840 * \param [in] stat mpls port information. 841 * 842 * \retval SHR_E_NONE No errors. 843 * \retval !SHR_E_NONE Failure. 844 */ 845 typedef int (*mpls_label_stat_clear_f)( 846 int unit, 847 bcm_mpls_label_t label, 848 bcm_gport_t mpls_port, 849 bcm_mpls_stat_t stat); 850 851 /*! 852 * \brief Set a port match for a MPLS port. 853 * 854 * \param [in] unit Unit Number. 855 * \param [in] mpls_port_id mpls port ID. 856 * \param [in] match mpls port match. 857 * 858 * \retval SHR_E_NONE No errors. 859 * \retval !SHR_E_NONE Failure. 860 */ 861 typedef int (*mpls_port_match_set_f)( 862 int unit, 863 bcm_gport_t mpls_port_id, 864 bcmi_ltsw_mpls_port_match_t *match); 865 866 /*! 867 * \brief Clear a port match for a MPLS port. 868 * 869 * \param [in] unit Unit Number. 870 * \param [in] mpls_port_id mpls port ID. 871 * \param [in] match mpls port match. 872 * 873 * \retval SHR_E_NONE No errors. 874 * \retval !SHR_E_NONE Failure. 875 */ 876 typedef int (*mpls_port_match_clear_f)( 877 int unit, 878 bcm_gport_t mpls_port_id, 879 bcmi_ltsw_mpls_port_match_t *match); 880 881 /*! 882 * \brief Get all port matches for a MPLS port. 883 * 884 * \param [in] unit Unit Number. 885 * \param [in] mpls_port_id mpls port ID. 886 * \param [in] size Match array size. 887 * \param [out] match_array mpls port match. 888 * \param [out] count Port match count. 889 * 890 * \retval SHR_E_NONE No errors. 891 * \retval !SHR_E_NONE Failure. 892 */ 893 typedef int (*mpls_port_match_multi_get_f)( 894 int unit, 895 bcm_gport_t mpls_port_id, 896 int size, 897 bcmi_ltsw_mpls_port_match_t *match_array, 898 int *count); 899 900 /*! 901 * \brief Delete all port matches for MPLS ports in the unit. 902 * 903 * \param [in] unit Unit Number. 904 * 905 * \retval SHR_E_NONE No errors. 906 * \retval !SHR_E_NONE Failure. 907 */ 908 typedef int (*mpls_port_match_delete_all_f)(int unit); 909 910 /*! 911 * \brief Get LT database. 912 * 913 * \param [in] unit Unit Number. 914 * \param [in] lt_db LT database. 915 */ 916 typedef int (*mpls_lt_db_get_f)( 917 int unit, 918 bcmint_mpls_lt_db_t *lt_db); 919 920 /*! 921 * \brief Mpls driver structure. 922 */ 923 typedef struct mbcm_ltsw_mpls_drv_s { 924 925 /*! Dump device-spefic SW MPLS info. */ 926 mpls_sw_dump_f mpls_sw_dump; 927 928 /*! Initialize device-spefic MPLS info. */ 929 mpls_init_f mpls_init; 930 931 /*! Deinitialize device-spefic MPLS info. */ 932 mpls_detach_f mpls_detach; 933 934 /*! Add an MPLS tunnel terminator. */ 935 mpls_tnl_switch_add_f mpls_tnl_switch_add; 936 937 /*! Delete an MPLS tunnel terminator. */ 938 mpls_tnl_switch_delete_f mpls_tnl_switch_delete; 939 940 /*! Get an MPLS tunnel terminator. */ 941 mpls_tnl_switch_get_f mpls_tnl_switch_get; 942 943 /*! Traverse valid tunnel terminators and call the callback. */ 944 mpls_tnl_switch_traverse_f mpls_tnl_switch_traverse; 945 946 /*! Delete all MPLS tunnel terminators. */ 947 mpls_tnl_switch_delete_all_f mpls_tnl_switch_delete_all; 948 949 /*! Clear the MPLS tunnel initiator parameters for an L3 interface. */ 950 mpls_tnl_initiator_clear_f mpls_tnl_initiator_clear; 951 952 /*! Clear all the MPLS tunnel initiator parameters all L3 Interfaces. */ 953 mpls_tnl_initiator_clear_all_f mpls_tnl_initiator_clear_all; 954 955 /*! Get the the MPLS tunnel initiator parameters for an L3 interface. */ 956 mpls_tnl_initiator_get_f mpls_tnl_initiator_get; 957 958 /*! Set the MPLS tunnel initiator parameters for an L3 interface. */ 959 mpls_tnl_initiator_set_f mpls_tnl_initiator_set; 960 961 /*! Add the MPLS tunnel initiator. */ 962 mpls_tnl_encap_create_f mpls_tnl_encap_create; 963 964 /*! Get the MPLS tunnel initiator. */ 965 mpls_tnl_encap_get_f mpls_tnl_encap_get; 966 967 /*! Destroy the MPLS tunnel initiator. */ 968 mpls_tnl_encap_destroy_f mpls_tnl_encap_destroy; 969 970 /*! Destroy all MPLS tunnel initiators. */ 971 mpls_tnl_encap_destroy_all_f mpls_tnl_encap_destroy_all; 972 973 /*! Configure the MPLS VFI. */ 974 mpls_vfi_op_f mpls_vfi_op; 975 976 /*! Get VPWS info. */ 977 mpls_vpws_info_get_f mpls_vpws_info_get; 978 979 /*! Add the MPLS port. */ 980 mpls_port_add_f mpls_port_add; 981 982 /*! Get the MPLS port. */ 983 mpls_port_get_f mpls_port_get; 984 985 /*! Get all the MPLS ports in the vpn. */ 986 mpls_vpls_port_get_all_f mpls_vpls_port_get_all; 987 988 /*! Delete the MPLS port. */ 989 mpls_port_delete_f mpls_port_delete; 990 991 /*! Delete all the MPLS ports in the specified VPLS VPN. */ 992 mpls_vpls_port_delete_by_vpn_f mpls_vpls_port_delete_by_vpn; 993 994 /*! Delete all vpls ports in the unit. */ 995 mpls_vpls_port_delete_all_f mpls_vpls_port_delete_all; 996 997 /*! Attach the source port to the destination port. */ 998 mpls_port_attach_f mpls_port_attach; 999 1000 /*! Detach the mpls port ID. */ 1001 mpls_port_detach_f mpls_port_detach; 1002 1003 /*! Validate the mpls port ID. */ 1004 mpls_port_validate_f mpls_port_validate; 1005 1006 /*! Get the vlan list which contain MPLS ports. */ 1007 mpls_vlan_list_get_f mpls_vlan_list_get; 1008 1009 /*! Add identifier entry of special label. */ 1010 mpls_special_label_identifier_add_f mpls_special_label_identifier_add; 1011 1012 /*! Get identifier entry of special label. */ 1013 mpls_special_label_identifier_get_f mpls_special_label_identifier_get; 1014 1015 /*! Delete identifier entry of special label. */ 1016 mpls_special_label_identifier_delete_f mpls_special_label_identifier_delete; 1017 1018 /*! Delete all identifier entries of special labels. */ 1019 mpls_special_label_identifier_delete_all_f mpls_special_label_identifier_delete_all; 1020 1021 /*! Traverse all identifier entries of special labels. */ 1022 mpls_special_label_identifier_traverse_f mpls_special_label_identifier_traverse; 1023 1024 /*! Set mpls global label range. */ 1025 mpls_global_label_range_set_f mpls_global_label_range_set; 1026 1027 /*! Get mpls global label range. */ 1028 mpls_global_label_range_get_f mpls_global_label_range_get; 1029 1030 /*! Set MPLS global control. */ 1031 mpls_global_control_set_f mpls_global_control_set; 1032 1033 /*! Get MPLS global control. */ 1034 mpls_global_control_get_f mpls_global_control_get; 1035 1036 /*! Add dst mac into MAC_DA profile. */ 1037 mpls_tnl_dst_mac_profile_add_f mpls_tnl_dst_mac_profile_add; 1038 1039 /*! Delete dst mac from MAC_DA profile. */ 1040 mpls_tnl_dst_mac_profile_del_f mpls_tnl_dst_mac_profile_del; 1041 1042 /*! Get dst mac from MAC_DA profile. */ 1043 mpls_tnl_dst_mac_profile_get_f mpls_tnl_dst_mac_profile_get; 1044 1045 /*! Attach flexctr action to the given MPLS label and gport. */ 1046 mpls_label_flexctr_attach_f mpls_label_flexctr_attach; 1047 1048 /*! Detach flexctr action of the given MPLS label and gport. */ 1049 mpls_label_flexctr_detach_f mpls_label_flexctr_detach; 1050 1051 /*! Get flex counter information of the given MPLS label and gport. */ 1052 mpls_label_flexctr_info_get_f mpls_label_flexctr_info_get; 1053 1054 /*! Set flex counter object value for the given MPLS label and gport. */ 1055 mpls_label_flexctr_object_set_f mpls_label_flexctr_object_set; 1056 1057 /*! Get flex counter object value for the given MPLS label and gport. */ 1058 mpls_label_flexctr_object_get_f mpls_label_flexctr_object_get; 1059 1060 /*! Add MPLS encap labels. */ 1061 mpls_encap_label_add_f mpls_encap_label_add; 1062 1063 /*! Get MPLS encap labels. */ 1064 mpls_encap_label_get_f mpls_encap_label_get; 1065 1066 /*! Delete MPLS encap labels. */ 1067 mpls_encap_label_delete_f mpls_encap_label_delete; 1068 1069 /*! Increase reference count of VC label index. */ 1070 mpls_encap_label_ref_inc_f mpls_encap_label_ref_inc; 1071 1072 /*! Replace vp value in match entry of mpls port id . */ 1073 mpls_port_match_vp_replace_f mpls_port_match_vp_replace; 1074 1075 /*! Get the vp value in match entry of mpls port id. */ 1076 mpls_port_match_vp_get_f mpls_port_match_vp_get; 1077 1078 /*! Add an MPLS control packet entry. */ 1079 mpls_control_pkt_add_f mpls_control_pkt_add; 1080 1081 /*! Get an MPLS control packet entry. */ 1082 mpls_control_pkt_get_f mpls_control_pkt_get; 1083 1084 /*! Delete an MPLS control packet entry. */ 1085 mpls_control_pkt_delete_f mpls_control_pkt_delete; 1086 1087 /*! Traverse all MPLS control packet entries and call user.s callback. */ 1088 mpls_control_pkt_traverse_f mpls_control_pkt_traverse; 1089 1090 /*! Delete all MPLS control packet entries. */ 1091 mpls_control_pkt_delete_all_f mpls_control_pkt_delete_all; 1092 1093 /*! Get counter statistic values for specific MPLS label and gport. */ 1094 mpls_label_stat_get_f mpls_label_stat_get; 1095 1096 /*! Clear counter statistic values for specific MPLS label and gport. */ 1097 mpls_label_stat_clear_f mpls_label_stat_clear; 1098 1099 /*! Set a port match for a MPLS port. */ 1100 mpls_port_match_set_f mpls_port_match_set; 1101 1102 /*! Clear a port match for a MPLS port. */ 1103 mpls_port_match_clear_f mpls_port_match_clear; 1104 1105 /*! Get all port matches for a MPLS port. */ 1106 mpls_port_match_multi_get_f mpls_port_match_multi_get; 1107 1108 /*! Delete all port matches for MPLS ports in the unit. */ 1109 mpls_port_match_delete_all_f mpls_port_match_delete_all; 1110 1111 /*! Get LT database. */ 1112 mpls_lt_db_get_f mpls_lt_db_get; 1113 1114 } mbcm_ltsw_mpls_drv_t; 1115 1116 /*! 1117 * \brief Set the MPLS driver of the device. 1118 * 1119 * \param [in] unit Unit Number. 1120 * \param [in] drv Mpls driver to set. 1121 * 1122 * \retval SHR_E_NONE No errors. 1123 * \retval !SHR_E_NONE Failure. 1124 */ 1125 extern int 1126 mbcm_ltsw_mpls_drv_set( 1127 int unit, 1128 mbcm_ltsw_mpls_drv_t *drv); 1129 1130 /*! 1131 * \brief Dump device-spefic SW MPLS info. 1132 * 1133 * \param [in] unit Unit Number. 1134 * 1135 * \retval SHR_E_NONE No errors. 1136 * \retval !SHR_E_NONE Failure. 1137 */ 1138 extern int 1139 mbcm_ltsw_mpls_sw_dump(int unit); 1140 1141 /*! 1142 * \brief Initialize device-spefic MPLS info. 1143 * 1144 * \param [in] unit Unit Number. 1145 * 1146 * \retval SHR_E_NONE No errors. 1147 * \retval !SHR_E_NONE Failure. 1148 */ 1149 extern int 1150 mbcm_ltsw_mpls_init(int unit); 1151 1152 /*! 1153 * \brief Deinitialize device-spefic MPLS info. 1154 * 1155 * \param [in] unit Unit Number. 1156 * 1157 * \retval SHR_E_NONE No errors. 1158 * \retval !SHR_E_NONE Failure. 1159 */ 1160 extern int 1161 mbcm_ltsw_mpls_detach(int unit); 1162 1163 /*! 1164 * \brief Add an MPLS tunnel terminator. 1165 * 1166 * \param [in] unit Unit Number. 1167 * \param [in/out] info MPLS tunnel terminator info. 1168 * 1169 * \retval SHR_E_NONE No errors. 1170 * \retval !SHR_E_NONE Failure. 1171 */ 1172 extern int 1173 mbcm_ltsw_mpls_tnl_switch_add( 1174 int unit, 1175 bcm_mpls_tunnel_switch_t *info); 1176 1177 /*! 1178 * \brief Delete an MPLS tunnel terminator. 1179 * 1180 * \param [in] unit Unit Number. 1181 * \param [in] info MPLS tunnel terminator info. 1182 * 1183 * \retval SHR_E_NONE No errors. 1184 * \retval !SHR_E_NONE Failure. 1185 */ 1186 extern int 1187 mbcm_ltsw_mpls_tnl_switch_delete( 1188 int unit, 1189 bcm_mpls_tunnel_switch_t *info); 1190 1191 /*! 1192 * \brief Get an MPLS tunnel terminator. 1193 * 1194 * \param [in] unit Unit Number. 1195 * \param [in/out] info MPLS tunnel terminator info. 1196 * 1197 * \retval SHR_E_NONE No errors. 1198 * \retval !SHR_E_NONE Failure. 1199 */ 1200 extern int 1201 mbcm_ltsw_mpls_tnl_switch_get( 1202 int unit, 1203 bcm_mpls_tunnel_switch_t *info); 1204 1205 /*! 1206 * \brief Traverse valid tunnel terminators and call the callback. 1207 * 1208 * \param [in] unit Unit Number. 1209 * \param [in] cb User callback function, called once per tunnel terminator. 1210 * \param [in] user_data Cookie. 1211 * 1212 * \retval SHR_E_NONE No errors. 1213 * \retval !SHR_E_NONE Failure. 1214 */ 1215 extern int 1216 mbcm_ltsw_mpls_tnl_switch_traverse( 1217 int unit, 1218 bcm_mpls_tunnel_switch_traverse_cb cb, 1219 void *user_data); 1220 1221 /*! 1222 * \brief Delete all MPLS tunnel terminators. 1223 * 1224 * \param [in] unit Unit Number. 1225 * 1226 * \retval SHR_E_NONE No errors. 1227 * \retval !SHR_E_NONE Failure. 1228 */ 1229 extern int 1230 mbcm_ltsw_mpls_tnl_switch_delete_all(int unit); 1231 1232 /*! 1233 * \brief Clear the MPLS tunnel initiator parameters for an L3 interface. 1234 * 1235 * \param [in] unit Unit Number. 1236 * \param [in] intf The egress L3 interface. 1237 * 1238 * \retval SHR_E_NONE No errors. 1239 * \retval !SHR_E_NONE Failure. 1240 */ 1241 extern int 1242 mbcm_ltsw_mpls_tnl_initiator_clear( 1243 int unit, 1244 bcm_if_t intf); 1245 1246 /*! 1247 * \brief Clear all the MPLS tunnel initiator parameters all L3 Interfaces. 1248 * 1249 * \param [in] unit Unit Number. 1250 * 1251 * \retval SHR_E_NONE No errors. 1252 * \retval !SHR_E_NONE Failure. 1253 */ 1254 extern int 1255 mbcm_ltsw_mpls_tnl_initiator_clear_all(int unit); 1256 1257 /*! 1258 * \brief Get the the MPLS tunnel initiator parameters for an L3 interface. 1259 * 1260 * \param [in] unit Unit Number. 1261 * \param [in] intf The egress L3 interface. 1262 * \param [in] label_max Number of entries in label_array. 1263 * \param [out] label_array MPLS header information. 1264 * \param [out] label_count Actual number of labels returned. 1265 * 1266 * \retval SHR_E_NONE No errors. 1267 * \retval !SHR_E_NONE Failure. 1268 */ 1269 extern int 1270 mbcm_ltsw_mpls_tnl_initiator_get( 1271 int unit, 1272 bcm_if_t intf, 1273 int label_max, 1274 bcm_mpls_egress_label_t *label_array, 1275 int *label_count); 1276 1277 /*! 1278 * \brief Set the MPLS tunnel initiator parameters for an L3 interface. 1279 * 1280 * \param [in] unit Unit Number. 1281 * \param [in] intf The egress L3 interface. 1282 * \param [in] num_labels Number of entries in label_array. 1283 * \param [in] label_array MPLS header information. 1284 * 1285 * \retval SHR_E_NONE No errors. 1286 * \retval !SHR_E_NONE Failure. 1287 */ 1288 extern int 1289 mbcm_ltsw_mpls_tnl_initiator_set( 1290 int unit, 1291 bcm_if_t intf, 1292 int num_labels, 1293 bcm_mpls_egress_label_t *label_array); 1294 1295 /*! 1296 * \brief Add the MPLS tunnel initiator. 1297 * 1298 * \param [in] unit Unit Number. 1299 * \param [in] options Opertation options. 1300 * \param [in/out] tunnel_encap MPLS tunnel initiator info. 1301 * 1302 * \retval SHR_E_NONE No errors. 1303 * \retval !SHR_E_NONE Failure. 1304 */ 1305 extern int 1306 mbcm_ltsw_mpls_tnl_encap_create( 1307 int unit, 1308 uint32_t options, 1309 bcm_mpls_tunnel_encap_t *tunnel_encap); 1310 1311 /*! 1312 * \brief Get the MPLS tunnel initiator. 1313 * 1314 * \param [in] unit Unit Number. 1315 * \param [in/out] tunnel_encap MPLS tunnel initiator info. 1316 * 1317 * \retval SHR_E_NONE No errors. 1318 * \retval !SHR_E_NONE Failure. 1319 */ 1320 extern int 1321 mbcm_ltsw_mpls_tnl_encap_get( 1322 int unit, 1323 bcm_mpls_tunnel_encap_t *tunnel_encap); 1324 1325 /*! 1326 * \brief Destroy the MPLS tunnel initiator. 1327 * 1328 * \param [in] unit Unit Number. 1329 * \param [in] tunnel_id MPLS tunnel initiator info. 1330 * 1331 * \retval SHR_E_NONE No errors. 1332 * \retval !SHR_E_NONE Failure. 1333 */ 1334 extern int 1335 mbcm_ltsw_mpls_tnl_encap_destroy( 1336 int unit, 1337 bcm_gport_t tunnel_id); 1338 1339 /*! 1340 * \brief Destroy all MPLS tunnel initiators. 1341 * 1342 * \param [in] unit Unit Number. 1343 * 1344 * \retval SHR_E_NONE No errors. 1345 * \retval !SHR_E_NONE Failure. 1346 */ 1347 extern int 1348 mbcm_ltsw_mpls_tnl_encap_destroy_all(int unit); 1349 1350 /*! 1351 * \brief Configure the MPLS VFI. 1352 * 1353 * \param [in] unit Unit Number. 1354 * \param [in] opcode Configure operation code. 1355 * \param [in] vfi_idx VFI index. 1356 * \param [in] info VPN configuration info. 1357 * 1358 * \retval SHR_E_NONE No errors. 1359 * \retval !SHR_E_NONE Failure. 1360 */ 1361 extern int 1362 mbcm_ltsw_mpls_vfi_op( 1363 int unit, 1364 bcmlt_opcode_t opcode, 1365 int vfi_idx, 1366 bcm_mpls_vpn_config_t *info); 1367 1368 /*! 1369 * \brief Get VPWS info. 1370 * 1371 * \param [in] unit Unit Number. 1372 * \param [in/out] idx_min VPWS index min. 1373 * \param [in/out] idx_max VPWS index max. 1374 * 1375 * \retval SHR_E_NONE No errors. 1376 * \retval !SHR_E_NONE Failure. 1377 */ 1378 extern int 1379 mbcm_ltsw_mpls_vpws_info_get( 1380 int unit, 1381 int *idx_min, 1382 int *idx_max); 1383 1384 /*! 1385 * \brief Add the MPLS port. 1386 * 1387 * \param [in] unit Unit Number. 1388 * \param [in] vpn VPN ID. 1389 * \param [in/out] mpls_port mpls port information. 1390 * 1391 * \retval SHR_E_NONE No errors. 1392 * \retval !SHR_E_NONE Failure. 1393 */ 1394 extern int 1395 mbcm_ltsw_mpls_port_add( 1396 int unit, 1397 bcm_vpn_t vpn, 1398 bcm_mpls_port_t *mpls_port); 1399 1400 /*! 1401 * \brief Get the MPLS port. 1402 * 1403 * \param [in] unit Unit Number. 1404 * \param [in] vpn VPN ID. 1405 * \param [in] mpls_port_id mpls port ID. 1406 * \param [in/out] mpls_port mpls port. 1407 * 1408 * \retval SHR_E_NONE No errors. 1409 * \retval !SHR_E_NONE Failure. 1410 */ 1411 extern int 1412 mbcm_ltsw_mpls_port_get( 1413 int unit, 1414 bcm_vpn_t vpn, 1415 bcm_gport_t mpls_port_id, 1416 bcm_mpls_port_t *mpls_port); 1417 1418 /*! 1419 * \brief Get all the MPLS ports in the vpn. 1420 * 1421 * \param [in] unit Unit Number. 1422 * \param [in] vpn VPN ID. 1423 * \param [in] port_max Maximum number of ports in array. 1424 * \param [out] port_array Array of mpls ports. 1425 * \param [out] port_count Number of ports returned in array. 1426 * 1427 * \retval SHR_E_NONE No errors. 1428 * \retval !SHR_E_NONE Failure. 1429 */ 1430 extern int 1431 mbcm_ltsw_mpls_vpls_port_get_all( 1432 int unit, 1433 bcm_vpn_t vpn, 1434 int port_max, 1435 bcm_mpls_port_t *port_array, 1436 int *port_count); 1437 1438 /*! 1439 * \brief Delete the MPLS port. 1440 * 1441 * \param [in] unit Unit Number. 1442 * \param [in] vpn VPN ID. 1443 * \param [in] mpls_port_id mpls port ID. 1444 * 1445 * \retval SHR_E_NONE No errors. 1446 * \retval !SHR_E_NONE Failure. 1447 */ 1448 extern int 1449 mbcm_ltsw_mpls_port_delete( 1450 int unit, 1451 bcm_vpn_t vpn, 1452 bcm_gport_t mpls_port_id); 1453 1454 /*! 1455 * \brief Delete all the MPLS ports in the specified VPLS VPN. 1456 * 1457 * \param [in] unit Unit Number. 1458 * \param [in] vpn VPN ID. 1459 * 1460 * \retval SHR_E_NONE No errors. 1461 * \retval !SHR_E_NONE Failure. 1462 */ 1463 extern int 1464 mbcm_ltsw_mpls_vpls_port_delete_by_vpn( 1465 int unit, 1466 bcm_vpn_t vpn); 1467 1468 /*! 1469 * \brief Delete all vpls ports in the unit. 1470 * 1471 * \param [in] unit Unit Number. 1472 * 1473 * \retval SHR_E_NONE No errors. 1474 * \retval !SHR_E_NONE Failure. 1475 */ 1476 extern int 1477 mbcm_ltsw_mpls_vpls_port_delete_all(int unit); 1478 1479 /*! 1480 * \brief Attach the source port to the destination port. 1481 * 1482 * \param [in] unit Unit Number. 1483 * \param [in] src_port_id Source port ID. 1484 * \param [in] dst_port_id Destination port ID. 1485 * 1486 * \retval SHR_E_NONE No errors. 1487 * \retval !SHR_E_NONE Failure. 1488 */ 1489 extern int 1490 mbcm_ltsw_mpls_port_attach( 1491 int unit, 1492 bcm_gport_t src_port_id, 1493 bcm_gport_t dst_port_id); 1494 1495 /*! 1496 * \brief Detach the mpls port ID. 1497 * 1498 * \param [in] unit Unit Number. 1499 * \param [in] mpls_port_id mpls port ID. 1500 * 1501 * \retval SHR_E_NONE No errors. 1502 * \retval !SHR_E_NONE Failure. 1503 */ 1504 extern int 1505 mbcm_ltsw_mpls_port_detach( 1506 int unit, 1507 bcm_gport_t mpls_port_id); 1508 1509 /*! 1510 * \brief Validate the mpls port ID. 1511 * 1512 * \param [in] unit Unit Number. 1513 * \param [in] mpls_port_id mpls port ID. 1514 * 1515 * \retval SHR_E_NONE No errors. 1516 * \retval !SHR_E_NONE Failure. 1517 */ 1518 extern int 1519 mbcm_ltsw_mpls_port_validate( 1520 int unit, 1521 bcm_gport_t mpls_port_id); 1522 1523 /*! 1524 * \brief Get the vlan list which contain MPLS ports. 1525 * 1526 * \param [in] unit Unit Number. 1527 * \param [out] vlan_cnt Vlan count. 1528 * \param [out] vlan_list Vlan list. 1529 * 1530 * \retval SHR_E_NONE No errors. 1531 * \retval !SHR_E_NONE Failure. 1532 */ 1533 extern int 1534 mbcm_ltsw_mpls_vlan_list_get( 1535 int unit, 1536 int *vlan_cnt, 1537 int *vlan_list); 1538 1539 /*! 1540 * \brief Add identifier entry of special label. 1541 * 1542 * \param [in] unit Unit Number. 1543 * \param [in] label_info Speical label info. 1544 * 1545 * \retval SHR_E_NONE No errors. 1546 * \retval !SHR_E_NONE Failure. 1547 */ 1548 extern int 1549 mbcm_ltsw_mpls_special_label_identifier_add( 1550 int unit, 1551 bcm_mpls_special_label_t label_info); 1552 1553 /*! 1554 * \brief Get identifier entry of special label. 1555 * 1556 * \param [in] unit Unit Number. 1557 * \param [in/out] label_info Speical label info. 1558 * 1559 * \retval SHR_E_NONE No errors. 1560 * \retval !SHR_E_NONE Failure. 1561 */ 1562 extern int 1563 mbcm_ltsw_mpls_special_label_identifier_get( 1564 int unit, 1565 bcm_mpls_special_label_t *label_info); 1566 1567 /*! 1568 * \brief Delete identifier entry of special label. 1569 * 1570 * \param [in] unit Unit Number. 1571 * \param [in] label_info Speical label info. 1572 * 1573 * \retval SHR_E_NONE No errors. 1574 * \retval !SHR_E_NONE Failure. 1575 */ 1576 extern int 1577 mbcm_ltsw_mpls_special_label_identifier_delete( 1578 int unit, 1579 bcm_mpls_special_label_t label_info); 1580 1581 /*! 1582 * \brief Delete all identifier entries of special labels. 1583 * 1584 * \param [in] unit Unit Number. 1585 * 1586 * \retval SHR_E_NONE No errors. 1587 * \retval !SHR_E_NONE Failure. 1588 */ 1589 extern int 1590 mbcm_ltsw_mpls_special_label_identifier_delete_all(int unit); 1591 1592 /*! 1593 * \brief Traverse all identifier entries of special labels. 1594 * 1595 * \param [in] unit Unit Number. 1596 * \param [in] cb user callback. 1597 * \param [in] user_data user data. 1598 * 1599 * \retval SHR_E_NONE No errors. 1600 * \retval !SHR_E_NONE Failure. 1601 */ 1602 extern int 1603 mbcm_ltsw_mpls_special_label_identifier_traverse( 1604 int unit, 1605 bcm_mpls_special_label_identifier_traverse_cb cb, 1606 void *user_data); 1607 1608 /*! 1609 * \brief Set mpls global label range. 1610 * 1611 * \param [in] unit Unit Number. 1612 * \param [in] range_num Range number. 0 : First range, 1 : Second range. 1613 * \param [in] range_min Range min indicator. 0 : Range max, 1 : Range min 1614 * \param [in] label_val Label value 1615 * 1616 * \retval SHR_E_NONE No errors. 1617 * \retval !SHR_E_NONE Failure. 1618 */ 1619 extern int 1620 mbcm_ltsw_mpls_global_label_range_set( 1621 int unit, 1622 int range_num, 1623 int range_min, 1624 int label_val); 1625 1626 /*! 1627 * \brief Get mpls global label range. 1628 * 1629 * \param [in] unit Unit Number. 1630 * \param [in] range_num Range number. 0 : First range, 1 : Second range. 1631 * \param [out] min_label Min label 1632 * \param [out] max_label Max label 1633 * 1634 * \retval SHR_E_NONE No errors. 1635 * \retval !SHR_E_NONE Failure. 1636 */ 1637 extern int 1638 mbcm_ltsw_mpls_global_label_range_get( 1639 int unit, 1640 int range_num, 1641 int *min_label, 1642 int *max_label); 1643 1644 /*! 1645 * \brief Set MPLS global control. 1646 * 1647 * \param [in] unit Unit Number. 1648 * \param [in] control_type Control type. 1649 * \param [in] value Control value 1650 * 1651 * \retval SHR_E_NONE No errors. 1652 * \retval !SHR_E_NONE Failure. 1653 */ 1654 extern int 1655 mbcm_ltsw_mpls_global_control_set( 1656 int unit, 1657 bcmi_ltsw_mpls_global_ctrl_t control_type, 1658 int value); 1659 1660 /*! 1661 * \brief Get MPLS global control. 1662 * 1663 * \param [in] unit Unit Number. 1664 * \param [in] control_type Control type. 1665 * \param [out] value Control value 1666 * 1667 * \retval SHR_E_NONE No errors. 1668 * \retval !SHR_E_NONE Failure. 1669 */ 1670 extern int 1671 mbcm_ltsw_mpls_global_control_get( 1672 int unit, 1673 bcmi_ltsw_mpls_global_ctrl_t control_type, 1674 int *value); 1675 1676 /*! 1677 * \brief Add dst mac into MAC_DA profile. 1678 * 1679 * \param [in] unit Unit Number. 1680 * \param [in] mac Dst MAC. 1681 * \param [out] index Profile index. 1682 * 1683 * \retval SHR_E_NONE No errors. 1684 * \retval !SHR_E_NONE Failure. 1685 */ 1686 extern int 1687 mbcm_ltsw_mpls_tnl_dst_mac_profile_add( 1688 int unit, 1689 uint64_t mac, 1690 int *index); 1691 1692 /*! 1693 * \brief Delete dst mac from MAC_DA profile. 1694 * 1695 * \param [in] unit Unit Number. 1696 * \param [in] index Profile index. 1697 * 1698 * \retval SHR_E_NONE No errors. 1699 * \retval !SHR_E_NONE Failure. 1700 */ 1701 extern int 1702 mbcm_ltsw_mpls_tnl_dst_mac_profile_del( 1703 int unit, 1704 int index); 1705 1706 /*! 1707 * \brief Get dst mac from MAC_DA profile. 1708 * 1709 * \param [in] unit Unit Number. 1710 * \param [in] index Profile index. 1711 * \param [out] mac Dst MAC. 1712 * 1713 * \retval SHR_E_NONE No errors. 1714 * \retval !SHR_E_NONE Failure. 1715 */ 1716 extern int 1717 mbcm_ltsw_mpls_tnl_dst_mac_profile_get( 1718 int unit, 1719 int index, 1720 uint64_t *mac); 1721 1722 /*! 1723 * \brief Attach flexctr action to the given MPLS label and gport. 1724 * 1725 * \param [in] unit Unit Number. 1726 * \param [in] label MPLS label. 1727 * \param [in] port MPLS Gport. 1728 * \param [in] info Flex counter information. 1729 * 1730 * \retval SHR_E_NONE No errors. 1731 * \retval !SHR_E_NONE Failure. 1732 */ 1733 extern int 1734 mbcm_ltsw_mpls_label_flexctr_attach( 1735 int unit, 1736 bcm_mpls_label_t label, 1737 bcm_gport_t port, 1738 bcmi_ltsw_flexctr_counter_info_t *info); 1739 1740 /*! 1741 * \brief Detach flexctr action of the given MPLS label and gport. 1742 * 1743 * \param [in] unit Unit Number. 1744 * \param [in] label MPLS label. 1745 * \param [in] port MPLS Gport. 1746 * 1747 * \retval SHR_E_NONE No errors. 1748 * \retval !SHR_E_NONE Failure. 1749 */ 1750 extern int 1751 mbcm_ltsw_mpls_label_flexctr_detach( 1752 int unit, 1753 bcm_mpls_label_t label, 1754 bcm_gport_t port); 1755 1756 /*! 1757 * \brief Get flex counter information of the given MPLS label and gport. 1758 * 1759 * \param [in] unit Unit Number. 1760 * \param [in] label MPLS label. 1761 * \param [in] port MPLS Gport. 1762 * \param [out] info Flex counter information. 1763 * 1764 * \retval SHR_E_NONE No errors. 1765 * \retval !SHR_E_NONE Failure. 1766 */ 1767 extern int 1768 mbcm_ltsw_mpls_label_flexctr_info_get( 1769 int unit, 1770 bcm_mpls_label_t label, 1771 bcm_gport_t port, 1772 bcmi_ltsw_flexctr_counter_info_t *info); 1773 1774 /*! 1775 * \brief Set flex counter object value for the given MPLS label and gport. 1776 * 1777 * \param [in] unit Unit Number. 1778 * \param [in] label MPLS label. 1779 * \param [in] port MPLS Gport. 1780 * \param [in] value The flex counter object value. 1781 * 1782 * \retval SHR_E_NONE No errors. 1783 * \retval !SHR_E_NONE Failure. 1784 */ 1785 extern int 1786 mbcm_ltsw_mpls_label_flexctr_object_set( 1787 int unit, 1788 bcm_mpls_label_t label, 1789 bcm_gport_t port, 1790 uint32_t value); 1791 1792 /*! 1793 * \brief Get flex counter object value for the given MPLS label and gport. 1794 * 1795 * \param [in] unit Unit Number. 1796 * \param [in] label MPLS label. 1797 * \param [in] port MPLS Gport. 1798 * \param [out] value The flex counter object value. 1799 * 1800 * \retval SHR_E_NONE No errors. 1801 * \retval !SHR_E_NONE Failure. 1802 */ 1803 extern int 1804 mbcm_ltsw_mpls_label_flexctr_object_get( 1805 int unit, 1806 bcm_mpls_label_t label, 1807 bcm_gport_t port, 1808 uint32_t *value); 1809 1810 /*! 1811 * \brief Add MPLS encap labels. 1812 * 1813 * \param [in] unit Unit Number. 1814 * \param [in] label_info Encap label info. 1815 * \param [out] label_index VC label index. 1816 * 1817 * \retval SHR_E_NONE No errors. 1818 * \retval !SHR_E_NONE Failure. 1819 */ 1820 extern int 1821 mbcm_ltsw_mpls_encap_label_add( 1822 int unit, 1823 bcmi_ltsw_mpls_encap_label_info_t *label_info, 1824 int *label_index); 1825 1826 /*! 1827 * \brief Get MPLS encap labels. 1828 * 1829 * \param [in] unit Unit Number. 1830 * \param [in] label_index VC label index. 1831 * \param [out] label_info Encap label info. 1832 * 1833 * \retval SHR_E_NONE No errors. 1834 * \retval !SHR_E_NONE Failure. 1835 */ 1836 extern int 1837 mbcm_ltsw_mpls_encap_label_get( 1838 int unit, 1839 int label_index, 1840 bcmi_ltsw_mpls_encap_label_info_t *label_info); 1841 1842 /*! 1843 * \brief Delete MPLS encap labels. 1844 * 1845 * \param [in] unit Unit Number. 1846 * \param [in] label_index VC label index. 1847 * 1848 * \retval SHR_E_NONE No errors. 1849 * \retval !SHR_E_NONE Failure. 1850 */ 1851 extern int 1852 mbcm_ltsw_mpls_encap_label_delete( 1853 int unit, 1854 int label_index); 1855 1856 /*! 1857 * \brief Increase reference count of VC label index. 1858 * 1859 * \param [in] unit Unit Number. 1860 * \param [in] label_index VC label index. 1861 * 1862 * \retval SHR_E_NONE No errors. 1863 * \retval !SHR_E_NONE Failure. 1864 */ 1865 extern int 1866 mbcm_ltsw_mpls_encap_label_ref_inc( 1867 int unit, 1868 int label_index); 1869 1870 /*! 1871 * \brief Replace vp value in match entry of mpls port id . 1872 * 1873 * \param [in] unit Unit Number. 1874 * \param [in] mpls_port_id MPLS port ID. 1875 * \param [in] new_vp New VP ID. 1876 * 1877 * \retval SHR_E_NONE No errors. 1878 * \retval !SHR_E_NONE Failure. 1879 */ 1880 extern int 1881 mbcm_ltsw_mpls_port_match_vp_replace( 1882 int unit, 1883 bcm_gport_t mpls_port_id, 1884 int new_vp); 1885 1886 /*! 1887 * \brief Get the vp value in match entry of mpls port id. 1888 * 1889 * \param [in] unit Unit Number. 1890 * \param [in] mpls_port_id MPLS port ID. 1891 * \param [in] new_vp New VP ID. 1892 * 1893 * \retval SHR_E_NONE No errors. 1894 * \retval !SHR_E_NONE Failure. 1895 */ 1896 extern int 1897 mbcm_ltsw_mpls_port_match_vp_get( 1898 int unit, 1899 bcm_gport_t mpls_port_id, 1900 int *new_vp); 1901 1902 /*! 1903 * \brief Add an MPLS control packet entry. 1904 * 1905 * \param [in] unit Unit Number. 1906 * \param [in] options Operation options. 1907 * \param [in] match MPLS control packet match. 1908 * \param [in] action MPLS control packet action. 1909 * 1910 * \retval SHR_E_NONE No errors. 1911 * \retval !SHR_E_NONE Failure. 1912 */ 1913 extern int 1914 mbcm_ltsw_mpls_control_pkt_add( 1915 int unit, 1916 uint32_t options, 1917 bcm_mpls_control_pkt_match_t *match, 1918 bcm_mpls_control_pkt_action_t *action); 1919 1920 /*! 1921 * \brief Get an MPLS control packet entry. 1922 * 1923 * \param [in] unit Unit Number. 1924 * \param [in/out] match MPLS control packet match. 1925 * \param [out] action MPLS control packet action. 1926 * 1927 * \retval SHR_E_NONE No errors. 1928 * \retval !SHR_E_NONE Failure. 1929 */ 1930 extern int 1931 mbcm_ltsw_mpls_control_pkt_get( 1932 int unit, 1933 bcm_mpls_control_pkt_match_t *match, 1934 bcm_mpls_control_pkt_action_t *action); 1935 1936 /*! 1937 * \brief Delete an MPLS control packet entry. 1938 * 1939 * \param [in] unit Unit Number. 1940 * \param [in/out] match MPLS control packet match. 1941 * 1942 * \retval SHR_E_NONE No errors. 1943 * \retval !SHR_E_NONE Failure. 1944 */ 1945 extern int 1946 mbcm_ltsw_mpls_control_pkt_delete( 1947 int unit, 1948 bcm_mpls_control_pkt_match_t *match); 1949 1950 /*! 1951 * \brief Traverse all MPLS control packet entries and call user.s callback. 1952 * 1953 * \param [in] unit Unit Number. 1954 * \param [in] cb User callback function. 1955 * \param [in] user_data User data. 1956 * 1957 * \retval SHR_E_NONE No errors. 1958 * \retval !SHR_E_NONE Failure. 1959 */ 1960 extern int 1961 mbcm_ltsw_mpls_control_pkt_traverse( 1962 int unit, 1963 bcm_mpls_control_pkt_traverse_cb cb, 1964 void *user_data); 1965 1966 /*! 1967 * \brief Delete all MPLS control packet entries. 1968 * 1969 * \param [in] unit Unit Number. 1970 * 1971 * \retval SHR_E_NONE No errors. 1972 * \retval !SHR_E_NONE Failure. 1973 */ 1974 extern int 1975 mbcm_ltsw_mpls_control_pkt_delete_all(int unit); 1976 1977 /*! 1978 * \brief Get counter statistic values for specific MPLS label and gport. 1979 * 1980 * \param [in] unit Unit Number. 1981 * \param [in] label MPLS label. 1982 * \param [in] mpls_port MPLS port. 1983 * \param [in] stat mpls port information. 1984 * \param [out] val Stats value. 1985 * 1986 * \retval SHR_E_NONE No errors. 1987 * \retval !SHR_E_NONE Failure. 1988 */ 1989 extern int 1990 mbcm_ltsw_mpls_label_stat_get( 1991 int unit, 1992 bcm_mpls_label_t label, 1993 bcm_gport_t mpls_port, 1994 bcm_mpls_stat_t stat, 1995 uint64_t *val); 1996 1997 /*! 1998 * \brief Clear counter statistic values for specific MPLS label and gport. 1999 * 2000 * \param [in] unit Unit Number. 2001 * \param [in] label MPLS label. 2002 * \param [in] mpls_port MPLS port. 2003 * \param [in] stat mpls port information. 2004 * 2005 * \retval SHR_E_NONE No errors. 2006 * \retval !SHR_E_NONE Failure. 2007 */ 2008 extern int 2009 mbcm_ltsw_mpls_label_stat_clear( 2010 int unit, 2011 bcm_mpls_label_t label, 2012 bcm_gport_t mpls_port, 2013 bcm_mpls_stat_t stat); 2014 2015 /*! 2016 * \brief Set a port match for a MPLS port. 2017 * 2018 * \param [in] unit Unit Number. 2019 * \param [in] mpls_port_id mpls port ID. 2020 * \param [in] match mpls port match. 2021 * 2022 * \retval SHR_E_NONE No errors. 2023 * \retval !SHR_E_NONE Failure. 2024 */ 2025 extern int 2026 mbcm_ltsw_mpls_port_match_set( 2027 int unit, 2028 bcm_gport_t mpls_port_id, 2029 bcmi_ltsw_mpls_port_match_t *match); 2030 2031 /*! 2032 * \brief Clear a port match for a MPLS port. 2033 * 2034 * \param [in] unit Unit Number. 2035 * \param [in] mpls_port_id mpls port ID. 2036 * \param [in] match mpls port match. 2037 * 2038 * \retval SHR_E_NONE No errors. 2039 * \retval !SHR_E_NONE Failure. 2040 */ 2041 extern int 2042 mbcm_ltsw_mpls_port_match_clear( 2043 int unit, 2044 bcm_gport_t mpls_port_id, 2045 bcmi_ltsw_mpls_port_match_t *match); 2046 2047 /*! 2048 * \brief Get all port matches for a MPLS port. 2049 * 2050 * \param [in] unit Unit Number. 2051 * \param [in] mpls_port_id mpls port ID. 2052 * \param [in] size Match array size. 2053 * \param [out] match_array mpls port match. 2054 * \param [out] count Port match count. 2055 * 2056 * \retval SHR_E_NONE No errors. 2057 * \retval !SHR_E_NONE Failure. 2058 */ 2059 extern int 2060 mbcm_ltsw_mpls_port_match_multi_get( 2061 int unit, 2062 bcm_gport_t mpls_port_id, 2063 int size, 2064 bcmi_ltsw_mpls_port_match_t *match_array, 2065 int *count); 2066 2067 /*! 2068 * \brief Delete all port matches for MPLS ports in the unit. 2069 * 2070 * \param [in] unit Unit Number. 2071 * 2072 * \retval SHR_E_NONE No errors. 2073 * \retval !SHR_E_NONE Failure. 2074 */ 2075 extern int 2076 mbcm_ltsw_mpls_port_match_delete_all(int unit); 2077 2078 /*! 2079 * \brief Get LT database. 2080 * 2081 * \param [in] unit Unit Number. 2082 * \param [in] lt_db LT database. 2083 */ 2084 extern int 2085 mbcm_ltsw_mpls_lt_db_get( 2086 int unit, 2087 bcmint_mpls_lt_db_t *lt_db); 2088 2089 #endif /* BCMINT_LTSW_MBCM_MPLS_H */