l2.h (29776B)
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_L2_H 12 #define BCMINT_LTSW_MBCM_L2_H 13 14 #include <bcm/l2.h> 15 #include <bcm/types.h> 16 17 #include <bcm_int/ltsw/l2_int.h> 18 #include <bcm_int/ltsw/l2.h> 19 20 #include <sal/sal_types.h> 21 22 /*! 23 * \brief Initialize L2 module. 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 (*l2_init_f)(int unit); 31 32 /*! 33 * \brief Detach L2 module. 34 * 35 * \param [in] unit Unit Number. 36 * 37 * \retval SHR_E_NONE No errors. 38 * \retval !SHR_E_NONE Failure. 39 */ 40 typedef int (*l2_detach_f)(int unit); 41 42 /*! 43 * \brief Add a L2 address entry into device. 44 * 45 * \param [in] unit Unit Number. 46 * \param [in] l2addr L2 address structure. 47 * 48 * \retval SHR_E_NONE No errors. 49 * \retval !SHR_E_NONE Failure. 50 */ 51 typedef int (*l2_addr_add_f)( 52 int unit, 53 bcm_l2_addr_t *l2addr); 54 55 /*! 56 * \brief Get l2 data structure info for given mac and vid from device. 57 * 58 * \param [in] unit Unit Number. 59 * \param [in] mac Mac address. 60 * \param [in] vid Vlan id. 61 * \param [out] l2addr L2 address structure. 62 * 63 * \retval SHR_E_NONE No errors. 64 * \retval !SHR_E_NONE Failure. 65 */ 66 typedef int (*l2_addr_get_f)( 67 int unit, 68 bcm_mac_t mac, 69 bcm_vlan_t vid, 70 bcm_l2_addr_t *l2addr); 71 72 /*! 73 * \brief Delete l2 address entry from device. 74 * 75 * \param [in] unit Unit Number. 76 * \param [in] mac Mac address. 77 * \param [in] vid Vlan id. 78 * 79 * \retval SHR_E_NONE No errors. 80 * \retval !SHR_E_NONE Failure. 81 */ 82 typedef int (*l2_addr_delete_f)( 83 int unit, 84 bcm_mac_t mac, 85 bcm_vlan_t vid); 86 87 /*! 88 * \brief Replace a l2 address entry with given info. 89 * 90 * \param [in] unit Unit Number. 91 * \param [in] rep_st Replace info structure. 92 * 93 * \retval SHR_E_NONE No errors. 94 * \retval !SHR_E_NONE Failure. 95 */ 96 typedef int (*l2_addr_replace_f)( 97 int unit, 98 bcmint_l2_replace_t *rep_st); 99 100 /*! 101 * \brief Traverse L2 address table and call users callback for matched entry. 102 * 103 * \param [in] unit Unit Number. 104 * \param [in] trav_fn User specified callback function. 105 * \param [in] user_data User specified data. 106 * 107 * \retval SHR_E_NONE No errors. 108 * \retval !SHR_E_NONE Failure. 109 */ 110 typedef int (*l2_addr_traverse_f)( 111 int unit, 112 bcm_l2_traverse_cb trav_fn, 113 void *user_data); 114 115 /*! 116 * \brief Purge L2 entries belong to set of (vlan, gport) tuple. 117 * 118 * \param [in] unit Unit Number. 119 * \param [in] tuple_ctrl Tuple control structure. 120 * 121 * \retval SHR_E_NONE No errors. 122 * \retval !SHR_E_NONE Failure. 123 */ 124 typedef int (*l2_addr_del_by_tuple_f)( 125 int unit, 126 bcmint_l2_tuple_ctrl_t *tuple_ctrl); 127 128 /*! 129 * \brief Get size of L2 Station table. 130 * 131 * \param [in] unit Unit Number. 132 * \param [out] tbl_sz L2 Station table size. 133 * 134 * \retval SHR_E_NONE No errors. 135 * \retval !SHR_E_NONE Failure. 136 */ 137 typedef int (*l2_station_size_get_f)( 138 int unit, 139 uint32_t *tbl_sz); 140 141 /*! 142 * \brief Get size of L2 overlay Station table. 143 * 144 * \param [in] unit Unit Number. 145 * \param [out] tbl_sz L2 overlay Station table size. 146 * 147 * \retval SHR_E_NONE No errors. 148 * \retval !SHR_E_NONE Failure. 149 */ 150 typedef int (*l2_overlay_station_size_get_f)( 151 int unit, 152 uint32_t *tbl_sz); 153 154 /*! 155 * \brief Age L2 entries. 156 * 157 * \param [in] unit Unit Number. 158 * 159 * \retval SHR_E_NONE No errors. 160 * \retval !SHR_E_NONE Failure. 161 */ 162 typedef int (*l2_age_f)(int unit); 163 164 /*! 165 * \brief Add a L2 station entry to device. 166 * 167 * \param [in] unit Unit Number. 168 * \param [in] station L2 station entry. 169 * \param [in] flags Internal L2 station flags. 170 * 171 * \retval SHR_E_NONE No errors. 172 * \retval !SHR_E_NONE Failure. 173 */ 174 typedef int (*l2_station_add_f)( 175 int unit, 176 bcm_l2_station_t *station, 177 int flags); 178 179 /*! 180 * \brief Get L2 station entry from device with given key. 181 * 182 * \param [in] unit Unit Number. 183 * \param [in|out] station L2 station entry. 184 * \param [in] flags Internal L2 station flags. 185 * 186 * \retval SHR_E_NONE No errors. 187 * \retval !SHR_E_NONE Failure. 188 */ 189 typedef int (*l2_station_get_f)( 190 int unit, 191 bcm_l2_station_t *station, 192 int flags); 193 194 /*! 195 * \brief Delete a L2 station entry from device. 196 * 197 * \param [in] unit Unit Number. 198 * \param [in] station L2 station entry. 199 * \param [in] flags Internal L2 station flags. 200 * 201 * \retval SHR_E_NONE No errors. 202 * \retval !SHR_E_NONE Failure. 203 */ 204 typedef int (*l2_station_delete_f)( 205 int unit, 206 bcm_l2_station_t *station, 207 int flags); 208 209 /*! 210 * \brief Set force vlan for all L2 entries of associated port. 211 * 212 * \param [in] unit Unit Number. 213 * \param [in] port Port id. 214 * \param [in] vlan Force vlan id. 215 * \param [in] flags Force vlan flags. 216 * 217 * \retval SHR_E_NONE No errors. 218 * \retval !SHR_E_NONE Failure. 219 */ 220 typedef int (*l2_force_vlan_set_f)( 221 int unit, 222 bcm_port_t port, 223 bcm_vlan_t vlan, 224 uint32_t flags); 225 226 /*! 227 * \brief Enable/Disable global L2 learning. 228 * 229 * \param [in] unit Unit Number. 230 * \param [in] enable 1 indicates enable, 0 indicates disable. 231 * 232 * \retval SHR_E_NONE No errors. 233 * \retval !SHR_E_NONE Failure. 234 */ 235 typedef int (*l2_learn_set_f)( 236 int unit, 237 int enable); 238 239 /*! 240 * \brief Get global L2 learning setting. 241 * 242 * \param [in] unit Unit Number. 243 * \param [out] enable Current global L2 learning setting. 244 * 245 * \retval SHR_E_NONE No errors. 246 * \retval !SHR_E_NONE Failure. 247 */ 248 typedef int (*l2_learn_get_f)( 249 int unit, 250 int *enable); 251 252 /*! 253 * \brief Update VLAN info used by station. 254 * 255 * \param [in] unit Unit Number. 256 * \param [in] vid VLAN id. 257 * \param [in] flags Flags to indicate update which part of VLAN info. 258 * \param [in] vlan_info VLAN info used by station. 259 * 260 * \retval SHR_E_NONE No errors. 261 * \retval !SHR_E_NONE Failure. 262 */ 263 typedef int (*l2_station_vlan_update_f)( 264 int unit, 265 int vid, 266 int flags, 267 bcmi_ltsw_l2_station_vlan_t *vlan_info); 268 269 /*! 270 * \brief Get L2 table size. 271 * 272 * \param [in] unit Unit Number. 273 * \param [out] size L2 table size. 274 * 275 * \retval SHR_E_NONE No errors. 276 * \retval !SHR_E_NONE Failure. 277 */ 278 typedef int (*l2_size_get_f)( 279 int unit, 280 int *size); 281 282 /*! 283 * \brief Get L2 entry count. 284 * 285 * \param [in] unit Unit Number. 286 * \param [out] count L2 entry count. 287 * 288 * \retval SHR_E_NONE No errors. 289 * \retval !SHR_E_NONE Failure. 290 */ 291 typedef int (*l2_count_get_f)( 292 int unit, 293 int *count); 294 295 /*! 296 * \brief Init L2 cache. 297 * 298 * \param [in] unit Unit Number. 299 * 300 * \retval SHR_E_NONE No errors. 301 * \retval !SHR_E_NONE Failure. 302 */ 303 typedef int (*l2_cache_init_f)(int unit); 304 305 /*! 306 * \brief Add data to a L2 cache entry. 307 * 308 * \param [in] unit Unit Number. 309 * \param [in] index Physical table index. 310 * \param [in] l2caddr Entry data configured by applications. 311 * \param [out] index_used Index of entry is written acctually. 312 * 313 * \retval SHR_E_NONE No errors. 314 * \retval !SHR_E_NONE Failure. 315 */ 316 typedef int (*l2_cache_set_f)( 317 int unit, 318 int index, 319 bcm_l2_cache_addr_t *l2caddr, 320 int *index_used); 321 322 /*! 323 * \brief Get data from a L2 cache entry. 324 * 325 * \param [in] unit Unit Number. 326 * \param [in] index Physical table index. 327 * \param [out] l2caddr Entry data which format is defined by applications. 328 * 329 * \retval SHR_E_NONE No errors. 330 * \retval !SHR_E_NONE Failure. 331 */ 332 typedef int (*l2_cache_get_f)( 333 int unit, 334 int index, 335 bcm_l2_cache_addr_t *l2caddr); 336 337 /*! 338 * \brief Get depth of L2 cache. 339 * 340 * \param [in] unit Unit Number. 341 * \param [out] size Depth of L2 cache. 342 * 343 * \retval SHR_E_NONE No errors. 344 * \retval !SHR_E_NONE Failure. 345 */ 346 typedef int (*l2_cache_size_get_f)( 347 int unit, 348 int *size); 349 350 /*! 351 * \brief Delete an entry of L2 cache. 352 * 353 * \param [in] unit Unit Number. 354 * \param [in] index Physical table index. 355 * 356 * \retval SHR_E_NONE No errors. 357 * \retval !SHR_E_NONE Failure. 358 */ 359 typedef int (*l2_cache_delete_f)( 360 int unit, 361 int index); 362 363 /*! 364 * \brief Delete all entries of L2 cache. 365 * 366 * \param [in] unit Unit Number. 367 * 368 * \retval SHR_E_NONE No errors. 369 * \retval !SHR_E_NONE Failure. 370 */ 371 typedef int (*l2_cache_delete_all_f)(int unit); 372 373 /*! 374 * \brief Update L2 table view info for a vlan. 375 * 376 * \param [in] unit Unit Number. 377 * \param [in] info L2 table view info. 378 * 379 * \retval SHR_E_NONE No errors. 380 * \retval !SHR_E_NONE Failure. 381 */ 382 typedef int (*l2_view_vlan_update_f)( 383 int unit, 384 bcmi_ltsw_l2_view_vlan_info_t *info); 385 386 /*! 387 * \brief Update logical table L2_OPAQUE_TAG. 388 * 389 * \param [in] unit Unit Number. 390 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 391 * \param [in] tag_size Size of the opaque tag. 392 * \param [in] ether_type Ethertype used to identify the opaque tag. 393 * \param [in] tag_type Type of the opaque tag. 394 * \param [in] valid Make config active or not. 395 * 396 * \retval SHR_E_NONE No errors. 397 * \retval !SHR_E_NONE Failure. 398 */ 399 typedef int (*l2_opaque_tag_set_f)( 400 int unit, 401 int opaque_tag_id, 402 int tag_size, 403 int ether_type, 404 int tag_type, 405 int valid); 406 407 /*! 408 * \brief Get value of fields of logical table L2_OPAQUE_TAG. 409 * 410 * \param [in] unit Unit Number. 411 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 412 * \param [out] tag_size Size of the opaque tag. 413 * \param [out] ether_type Ethertype used to identify the opaque tag. 414 * \param [out] tag_type Type of the opaque tag. 415 * \param [out] valid Make config active or not. 416 * 417 * \retval SHR_E_NONE No errors. 418 * \retval !SHR_E_NONE Failure. 419 */ 420 typedef int (*l2_opaque_tag_get_f)( 421 int unit, 422 int opaque_tag_id, 423 int *tag_size, 424 int *ether_type, 425 int *tag_type, 426 int *valid); 427 428 /*! 429 * \brief Update logical table L2_PAYLOAD_OPAQUE_TAG. 430 * 431 * \param [in] unit Unit Number. 432 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 433 * \param [in] tag_size Size of the opaque tag. 434 * \param [in] ether_type Ethertype used to identify the opaque tag. 435 * \param [in] tag_type Type of the opaque tag. 436 * \param [in] valid Make config active or not. 437 * 438 * \retval SHR_E_NONE No errors. 439 * \retval !SHR_E_NONE Failure. 440 */ 441 typedef int (*l2_payload_opaque_tag_set_f)( 442 int unit, 443 int opaque_tag_id, 444 int tag_size, 445 int ether_type, 446 int tag_type, 447 int valid); 448 449 /*! 450 * \brief Get value of fields of logical table L2_PAYLOAD_OPAQUE_TAG. 451 * 452 * \param [in] unit Unit Number. 453 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 454 * \param [out] tag_size Size of the opaque tag. 455 * \param [out] ether_type Ethertype used to identify the opaque tag. 456 * \param [out] tag_type Type of the opaque tag. 457 * \param [out] valid Make config active or not. 458 * 459 * \retval SHR_E_NONE No errors. 460 * \retval !SHR_E_NONE Failure. 461 */ 462 typedef int (*l2_payload_opaque_tag_get_f)( 463 int unit, 464 int opaque_tag_id, 465 int *tag_size, 466 int *ether_type, 467 int *tag_type, 468 int *valid); 469 470 /*! 471 * \brief Restore L2 MAC learn and move. 472 * 473 * \param [in] unit Unit Number. 474 * \param [out] l2_freeze_mode L2 freeze mode. 475 * 476 * \retval SHR_E_NONE No errors. 477 * \retval !SHR_E_NONE Failure. 478 */ 479 typedef int (*l2_frozen_cml_restore_f)( 480 int unit, 481 int *l2_freeze_mode); 482 483 /*! 484 * \brief Freeze L2 MAC learn and move. 485 * 486 * \param [in] unit Unit Number. 487 * \param [out] l2_freeze_mode L2 freeze mode. 488 * 489 * \retval SHR_E_NONE No errors. 490 * \retval !SHR_E_NONE Failure. 491 */ 492 typedef int (*l2_frozen_cml_save_f)( 493 int unit, 494 int *l2_freeze_mode); 495 496 /*! 497 * \brief Recover L2 learn override during Warmboot. 498 * 499 * \param [in] unit Unit Number. 500 * \param [out] l2_freeze_override L2 frozen by L2_LEARN_OVERRIDE. 501 * 502 * \retval SHR_E_NONE No errors. 503 * \retval !SHR_E_NONE Failure. 504 */ 505 typedef int (*l2_frozen_cml_recover_f)( 506 int unit, 507 int *l2_freeze_override); 508 509 /*! 510 * \brief Dump L2 module software bookkeepings. 511 * 512 * \param [in] unit Unit Number. 513 */ 514 typedef void (*l2_sw_dump_f)(int unit); 515 516 /*! 517 * \brief Update L2 table virtual info for a gport. 518 * 519 * \param [in] unit Unit Number. 520 * \param [in] info Virtual info. 521 * 522 * \retval SHR_E_NONE No errors. 523 * \retval !SHR_E_NONE Failure. 524 */ 525 typedef int (*l2_virtual_info_update_f)( 526 int unit, 527 bcmi_ltsw_l2_virtual_info_t *info); 528 529 /*! 530 * \brief L2 map database initialization. 531 * 532 * \param [in] unit Unit Number. 533 * \param [in|out] map_db L2 map database. 534 * 535 * \retval SHR_E_NONE No errors. 536 * \retval !SHR_E_NONE Failure. 537 */ 538 typedef int (*l2_map_db_init_f)( 539 int unit, 540 const bcmint_l2_map_db_t ** map_db); 541 542 /*! 543 * \brief Detach flex counter resources for L2 hit bit. 544 * 545 * \param [in] unit Unit Number. 546 * \param [in] info Flexctr info pointer. 547 * 548 * \retval SHR_E_NONE No errors. 549 * \retval !SHR_E_NONE Failure. 550 */ 551 typedef int (*l2_hitbit_detach_f)( 552 int unit, 553 bcmint_l2_flexctr_info_t *info); 554 555 /*! 556 * \brief Init flex counter resources for L2 hit bit. 557 * 558 * \param [in] unit Unit Number. 559 * \param [out] info Flexctr info pointer. 560 * 561 * \retval SHR_E_NONE No errors. 562 * \retval !SHR_E_NONE Failure. 563 */ 564 typedef int (*l2_hitbit_init_f)( 565 int unit, 566 bcmint_l2_flexctr_info_t *info); 567 568 /*! 569 * \brief L2 driver structure. 570 */ 571 typedef struct mbcm_ltsw_l2_drv_s { 572 573 /*! Initialize L2 module. */ 574 l2_init_f l2_init; 575 576 /*! Detach L2 module. */ 577 l2_detach_f l2_detach; 578 579 /*! Add a L2 address entry into device. */ 580 l2_addr_add_f l2_addr_add; 581 582 /*! Get l2 data structure info for given mac and vid from device. */ 583 l2_addr_get_f l2_addr_get; 584 585 /*! Delete l2 address entry from device. */ 586 l2_addr_delete_f l2_addr_delete; 587 588 /*! Replace a l2 address entry with given info. */ 589 l2_addr_replace_f l2_addr_replace; 590 591 /*! Traverse L2 address table and call users callback for matched entry. */ 592 l2_addr_traverse_f l2_addr_traverse; 593 594 /*! Purge L2 entries belong to set of (vlan, gport) tuple. */ 595 l2_addr_del_by_tuple_f l2_addr_del_by_tuple; 596 597 /*! Get size of L2 Station table. */ 598 l2_station_size_get_f l2_station_size_get; 599 600 /*! Get size of L2 overlay Station table. */ 601 l2_overlay_station_size_get_f l2_overlay_station_size_get; 602 603 /*! Age L2 entries. */ 604 l2_age_f l2_age; 605 606 /*! Add a L2 station entry to device. */ 607 l2_station_add_f l2_station_add; 608 609 /*! Get L2 station entry from device with given key. */ 610 l2_station_get_f l2_station_get; 611 612 /*! Delete a L2 station entry from device. */ 613 l2_station_delete_f l2_station_delete; 614 615 /*! Set force vlan for all L2 entries of associated port. */ 616 l2_force_vlan_set_f l2_force_vlan_set; 617 618 /*! Enable/Disable global L2 learning. */ 619 l2_learn_set_f l2_learn_set; 620 621 /*! Get global L2 learning setting. */ 622 l2_learn_get_f l2_learn_get; 623 624 /*! Update VLAN info used by station. */ 625 l2_station_vlan_update_f l2_station_vlan_update; 626 627 /*! Get L2 table size. */ 628 l2_size_get_f l2_size_get; 629 630 /*! Get L2 entry count. */ 631 l2_count_get_f l2_count_get; 632 633 /*! Init L2 cache. */ 634 l2_cache_init_f l2_cache_init; 635 636 /*! Add data to a L2 cache entry. */ 637 l2_cache_set_f l2_cache_set; 638 639 /*! Get data from a L2 cache entry. */ 640 l2_cache_get_f l2_cache_get; 641 642 /*! Get depth of L2 cache. */ 643 l2_cache_size_get_f l2_cache_size_get; 644 645 /*! Delete an entry of L2 cache. */ 646 l2_cache_delete_f l2_cache_delete; 647 648 /*! Delete all entries of L2 cache. */ 649 l2_cache_delete_all_f l2_cache_delete_all; 650 651 /*! Update L2 table view info for a vlan. */ 652 l2_view_vlan_update_f l2_view_vlan_update; 653 654 /*! Update logical table L2_OPAQUE_TAG. */ 655 l2_opaque_tag_set_f l2_opaque_tag_set; 656 657 /*! Get value of fields of logical table L2_OPAQUE_TAG. */ 658 l2_opaque_tag_get_f l2_opaque_tag_get; 659 660 /*! Update logical table L2_PAYLOAD_OPAQUE_TAG. */ 661 l2_payload_opaque_tag_set_f l2_payload_opaque_tag_set; 662 663 /*! Get value of fields of logical table L2_PAYLOAD_OPAQUE_TAG. */ 664 l2_payload_opaque_tag_get_f l2_payload_opaque_tag_get; 665 666 /*! Restore L2 MAC learn and move. */ 667 l2_frozen_cml_restore_f l2_frozen_cml_restore; 668 669 /*! Freeze L2 MAC learn and move. */ 670 l2_frozen_cml_save_f l2_frozen_cml_save; 671 672 /*! Recover L2 learn override during Warmboot. */ 673 l2_frozen_cml_recover_f l2_frozen_cml_recover; 674 675 /*! Dump L2 module software bookkeepings. */ 676 l2_sw_dump_f l2_sw_dump; 677 678 /*! Update L2 table virtual info for a gport. */ 679 l2_virtual_info_update_f l2_virtual_info_update; 680 681 /*! L2 map database initialization. */ 682 l2_map_db_init_f l2_map_db_init; 683 684 /*! Detach flex counter resources for L2 hit bit. */ 685 l2_hitbit_detach_f l2_hitbit_detach; 686 687 /*! Init flex counter resources for L2 hit bit. */ 688 l2_hitbit_init_f l2_hitbit_init; 689 690 } mbcm_ltsw_l2_drv_t; 691 692 /*! 693 * \brief Set the L2 driver of the device. 694 * 695 * \param [in] unit Unit Number. 696 * \param [in] drv L2 driver to set. 697 * 698 * \retval SHR_E_NONE No errors. 699 * \retval !SHR_E_NONE Failure. 700 */ 701 extern int 702 mbcm_ltsw_l2_drv_set( 703 int unit, 704 mbcm_ltsw_l2_drv_t *drv); 705 706 /*! 707 * \brief Initialize L2 module. 708 * 709 * \param [in] unit Unit Number. 710 * 711 * \retval SHR_E_NONE No errors. 712 * \retval !SHR_E_NONE Failure. 713 */ 714 extern int 715 mbcm_ltsw_l2_init(int unit); 716 717 /*! 718 * \brief Detach L2 module. 719 * 720 * \param [in] unit Unit Number. 721 * 722 * \retval SHR_E_NONE No errors. 723 * \retval !SHR_E_NONE Failure. 724 */ 725 extern int 726 mbcm_ltsw_l2_detach(int unit); 727 728 /*! 729 * \brief Add a L2 address entry into device. 730 * 731 * \param [in] unit Unit Number. 732 * \param [in] l2addr L2 address structure. 733 * 734 * \retval SHR_E_NONE No errors. 735 * \retval !SHR_E_NONE Failure. 736 */ 737 extern int 738 mbcm_ltsw_l2_addr_add( 739 int unit, 740 bcm_l2_addr_t *l2addr); 741 742 /*! 743 * \brief Get l2 data structure info for given mac and vid from device. 744 * 745 * \param [in] unit Unit Number. 746 * \param [in] mac Mac address. 747 * \param [in] vid Vlan id. 748 * \param [out] l2addr L2 address structure. 749 * 750 * \retval SHR_E_NONE No errors. 751 * \retval !SHR_E_NONE Failure. 752 */ 753 extern int 754 mbcm_ltsw_l2_addr_get( 755 int unit, 756 bcm_mac_t mac, 757 bcm_vlan_t vid, 758 bcm_l2_addr_t *l2addr); 759 760 /*! 761 * \brief Delete l2 address entry from device. 762 * 763 * \param [in] unit Unit Number. 764 * \param [in] mac Mac address. 765 * \param [in] vid Vlan id. 766 * 767 * \retval SHR_E_NONE No errors. 768 * \retval !SHR_E_NONE Failure. 769 */ 770 extern int 771 mbcm_ltsw_l2_addr_delete( 772 int unit, 773 bcm_mac_t mac, 774 bcm_vlan_t vid); 775 776 /*! 777 * \brief Replace a l2 address entry with given info. 778 * 779 * \param [in] unit Unit Number. 780 * \param [in] rep_st Replace info structure. 781 * 782 * \retval SHR_E_NONE No errors. 783 * \retval !SHR_E_NONE Failure. 784 */ 785 extern int 786 mbcm_ltsw_l2_addr_replace( 787 int unit, 788 bcmint_l2_replace_t *rep_st); 789 790 /*! 791 * \brief Traverse L2 address table and call users callback for matched entry. 792 * 793 * \param [in] unit Unit Number. 794 * \param [in] trav_fn User specified callback function. 795 * \param [in] user_data User specified data. 796 * 797 * \retval SHR_E_NONE No errors. 798 * \retval !SHR_E_NONE Failure. 799 */ 800 extern int 801 mbcm_ltsw_l2_addr_traverse( 802 int unit, 803 bcm_l2_traverse_cb trav_fn, 804 void *user_data); 805 806 /*! 807 * \brief Purge L2 entries belong to set of (vlan, gport) tuple. 808 * 809 * \param [in] unit Unit Number. 810 * \param [in] tuple_ctrl Tuple control structure. 811 * 812 * \retval SHR_E_NONE No errors. 813 * \retval !SHR_E_NONE Failure. 814 */ 815 extern int 816 mbcm_ltsw_l2_addr_del_by_tuple( 817 int unit, 818 bcmint_l2_tuple_ctrl_t *tuple_ctrl); 819 820 /*! 821 * \brief Get size of L2 Station table. 822 * 823 * \param [in] unit Unit Number. 824 * \param [out] tbl_sz L2 Station table size. 825 * 826 * \retval SHR_E_NONE No errors. 827 * \retval !SHR_E_NONE Failure. 828 */ 829 extern int 830 mbcm_ltsw_l2_station_size_get( 831 int unit, 832 uint32_t *tbl_sz); 833 834 /*! 835 * \brief Get size of L2 overlay Station table. 836 * 837 * \param [in] unit Unit Number. 838 * \param [out] tbl_sz L2 overlay Station table size. 839 * 840 * \retval SHR_E_NONE No errors. 841 * \retval !SHR_E_NONE Failure. 842 */ 843 extern int 844 mbcm_ltsw_l2_overlay_station_size_get( 845 int unit, 846 uint32_t *tbl_sz); 847 848 /*! 849 * \brief Age L2 entries. 850 * 851 * \param [in] unit Unit Number. 852 * 853 * \retval SHR_E_NONE No errors. 854 * \retval !SHR_E_NONE Failure. 855 */ 856 extern int 857 mbcm_ltsw_l2_age(int unit); 858 859 /*! 860 * \brief Add a L2 station entry to device. 861 * 862 * \param [in] unit Unit Number. 863 * \param [in] station L2 station entry. 864 * \param [in] flags Internal L2 station flags. 865 * 866 * \retval SHR_E_NONE No errors. 867 * \retval !SHR_E_NONE Failure. 868 */ 869 extern int 870 mbcm_ltsw_l2_station_add( 871 int unit, 872 bcm_l2_station_t *station, 873 int flags); 874 875 /*! 876 * \brief Get L2 station entry from device with given key. 877 * 878 * \param [in] unit Unit Number. 879 * \param [in|out] station L2 station entry. 880 * \param [in] flags Internal L2 station flags. 881 * 882 * \retval SHR_E_NONE No errors. 883 * \retval !SHR_E_NONE Failure. 884 */ 885 extern int 886 mbcm_ltsw_l2_station_get( 887 int unit, 888 bcm_l2_station_t *station, 889 int flags); 890 891 /*! 892 * \brief Delete a L2 station entry from device. 893 * 894 * \param [in] unit Unit Number. 895 * \param [in] station L2 station entry. 896 * \param [in] flags Internal L2 station flags. 897 * 898 * \retval SHR_E_NONE No errors. 899 * \retval !SHR_E_NONE Failure. 900 */ 901 extern int 902 mbcm_ltsw_l2_station_delete( 903 int unit, 904 bcm_l2_station_t *station, 905 int flags); 906 907 /*! 908 * \brief Set force vlan for all L2 entries of associated port. 909 * 910 * \param [in] unit Unit Number. 911 * \param [in] port Port id. 912 * \param [in] vlan Force vlan id. 913 * \param [in] flags Force vlan flags. 914 * 915 * \retval SHR_E_NONE No errors. 916 * \retval !SHR_E_NONE Failure. 917 */ 918 extern int 919 mbcm_ltsw_l2_force_vlan_set( 920 int unit, 921 bcm_port_t port, 922 bcm_vlan_t vlan, 923 uint32_t flags); 924 925 /*! 926 * \brief Enable/Disable global L2 learning. 927 * 928 * \param [in] unit Unit Number. 929 * \param [in] enable 1 indicates enable, 0 indicates disable. 930 * 931 * \retval SHR_E_NONE No errors. 932 * \retval !SHR_E_NONE Failure. 933 */ 934 extern int 935 mbcm_ltsw_l2_learn_set( 936 int unit, 937 int enable); 938 939 /*! 940 * \brief Get global L2 learning setting. 941 * 942 * \param [in] unit Unit Number. 943 * \param [out] enable Current global L2 learning setting. 944 * 945 * \retval SHR_E_NONE No errors. 946 * \retval !SHR_E_NONE Failure. 947 */ 948 extern int 949 mbcm_ltsw_l2_learn_get( 950 int unit, 951 int *enable); 952 953 /*! 954 * \brief Update VLAN info used by station. 955 * 956 * \param [in] unit Unit Number. 957 * \param [in] vid VLAN id. 958 * \param [in] flags Flags to indicate update which part of VLAN info. 959 * \param [in] vlan_info VLAN info used by station. 960 * 961 * \retval SHR_E_NONE No errors. 962 * \retval !SHR_E_NONE Failure. 963 */ 964 extern int 965 mbcm_ltsw_l2_station_vlan_update( 966 int unit, 967 int vid, 968 int flags, 969 bcmi_ltsw_l2_station_vlan_t *vlan_info); 970 971 /*! 972 * \brief Get L2 table size. 973 * 974 * \param [in] unit Unit Number. 975 * \param [out] size L2 table size. 976 * 977 * \retval SHR_E_NONE No errors. 978 * \retval !SHR_E_NONE Failure. 979 */ 980 extern int 981 mbcm_ltsw_l2_size_get( 982 int unit, 983 int *size); 984 985 /*! 986 * \brief Get L2 entry count. 987 * 988 * \param [in] unit Unit Number. 989 * \param [out] count L2 entry count. 990 * 991 * \retval SHR_E_NONE No errors. 992 * \retval !SHR_E_NONE Failure. 993 */ 994 extern int 995 mbcm_ltsw_l2_count_get( 996 int unit, 997 int *count); 998 999 /*! 1000 * \brief Init L2 cache. 1001 * 1002 * \param [in] unit Unit Number. 1003 * 1004 * \retval SHR_E_NONE No errors. 1005 * \retval !SHR_E_NONE Failure. 1006 */ 1007 extern int 1008 mbcm_ltsw_l2_cache_init(int unit); 1009 1010 /*! 1011 * \brief Add data to a L2 cache entry. 1012 * 1013 * \param [in] unit Unit Number. 1014 * \param [in] index Physical table index. 1015 * \param [in] l2caddr Entry data configured by applications. 1016 * \param [out] index_used Index of entry is written acctually. 1017 * 1018 * \retval SHR_E_NONE No errors. 1019 * \retval !SHR_E_NONE Failure. 1020 */ 1021 extern int 1022 mbcm_ltsw_l2_cache_set( 1023 int unit, 1024 int index, 1025 bcm_l2_cache_addr_t *l2caddr, 1026 int *index_used); 1027 1028 /*! 1029 * \brief Get data from a L2 cache entry. 1030 * 1031 * \param [in] unit Unit Number. 1032 * \param [in] index Physical table index. 1033 * \param [out] l2caddr Entry data which format is defined by applications. 1034 * 1035 * \retval SHR_E_NONE No errors. 1036 * \retval !SHR_E_NONE Failure. 1037 */ 1038 extern int 1039 mbcm_ltsw_l2_cache_get( 1040 int unit, 1041 int index, 1042 bcm_l2_cache_addr_t *l2caddr); 1043 1044 /*! 1045 * \brief Get depth of L2 cache. 1046 * 1047 * \param [in] unit Unit Number. 1048 * \param [out] size Depth of L2 cache. 1049 * 1050 * \retval SHR_E_NONE No errors. 1051 * \retval !SHR_E_NONE Failure. 1052 */ 1053 extern int 1054 mbcm_ltsw_l2_cache_size_get( 1055 int unit, 1056 int *size); 1057 1058 /*! 1059 * \brief Delete an entry of L2 cache. 1060 * 1061 * \param [in] unit Unit Number. 1062 * \param [in] index Physical table index. 1063 * 1064 * \retval SHR_E_NONE No errors. 1065 * \retval !SHR_E_NONE Failure. 1066 */ 1067 extern int 1068 mbcm_ltsw_l2_cache_delete( 1069 int unit, 1070 int index); 1071 1072 /*! 1073 * \brief Delete all entries of L2 cache. 1074 * 1075 * \param [in] unit Unit Number. 1076 * 1077 * \retval SHR_E_NONE No errors. 1078 * \retval !SHR_E_NONE Failure. 1079 */ 1080 extern int 1081 mbcm_ltsw_l2_cache_delete_all(int unit); 1082 1083 /*! 1084 * \brief Update L2 table view info for a vlan. 1085 * 1086 * \param [in] unit Unit Number. 1087 * \param [in] info L2 table view info. 1088 * 1089 * \retval SHR_E_NONE No errors. 1090 * \retval !SHR_E_NONE Failure. 1091 */ 1092 extern int 1093 mbcm_ltsw_l2_view_vlan_update( 1094 int unit, 1095 bcmi_ltsw_l2_view_vlan_info_t *info); 1096 1097 /*! 1098 * \brief Update logical table L2_OPAQUE_TAG. 1099 * 1100 * \param [in] unit Unit Number. 1101 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 1102 * \param [in] tag_size Size of the opaque tag. 1103 * \param [in] ether_type Ethertype used to identify the opaque tag. 1104 * \param [in] tag_type Type of the opaque tag. 1105 * \param [in] valid Make config active or not. 1106 * 1107 * \retval SHR_E_NONE No errors. 1108 * \retval !SHR_E_NONE Failure. 1109 */ 1110 extern int 1111 mbcm_ltsw_l2_opaque_tag_set( 1112 int unit, 1113 int opaque_tag_id, 1114 int tag_size, 1115 int ether_type, 1116 int tag_type, 1117 int valid); 1118 1119 /*! 1120 * \brief Get value of fields of logical table L2_OPAQUE_TAG. 1121 * 1122 * \param [in] unit Unit Number. 1123 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 1124 * \param [out] tag_size Size of the opaque tag. 1125 * \param [out] ether_type Ethertype used to identify the opaque tag. 1126 * \param [out] tag_type Type of the opaque tag. 1127 * \param [out] valid Make config active or not. 1128 * 1129 * \retval SHR_E_NONE No errors. 1130 * \retval !SHR_E_NONE Failure. 1131 */ 1132 extern int 1133 mbcm_ltsw_l2_opaque_tag_get( 1134 int unit, 1135 int opaque_tag_id, 1136 int *tag_size, 1137 int *ether_type, 1138 int *tag_type, 1139 int *valid); 1140 1141 /*! 1142 * \brief Update logical table L2_PAYLOAD_OPAQUE_TAG. 1143 * 1144 * \param [in] unit Unit Number. 1145 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 1146 * \param [in] tag_size Size of the opaque tag. 1147 * \param [in] ether_type Ethertype used to identify the opaque tag. 1148 * \param [in] tag_type Type of the opaque tag. 1149 * \param [in] valid Make config active or not. 1150 * 1151 * \retval SHR_E_NONE No errors. 1152 * \retval !SHR_E_NONE Failure. 1153 */ 1154 extern int 1155 mbcm_ltsw_l2_payload_opaque_tag_set( 1156 int unit, 1157 int opaque_tag_id, 1158 int tag_size, 1159 int ether_type, 1160 int tag_type, 1161 int valid); 1162 1163 /*! 1164 * \brief Get value of fields of logical table L2_PAYLOAD_OPAQUE_TAG. 1165 * 1166 * \param [in] unit Unit Number. 1167 * \param [in] opaque_tag_id Index into the L2 opaque tag table. 1168 * \param [out] tag_size Size of the opaque tag. 1169 * \param [out] ether_type Ethertype used to identify the opaque tag. 1170 * \param [out] tag_type Type of the opaque tag. 1171 * \param [out] valid Make config active or not. 1172 * 1173 * \retval SHR_E_NONE No errors. 1174 * \retval !SHR_E_NONE Failure. 1175 */ 1176 extern int 1177 mbcm_ltsw_l2_payload_opaque_tag_get( 1178 int unit, 1179 int opaque_tag_id, 1180 int *tag_size, 1181 int *ether_type, 1182 int *tag_type, 1183 int *valid); 1184 1185 /*! 1186 * \brief Restore L2 MAC learn and move. 1187 * 1188 * \param [in] unit Unit Number. 1189 * \param [out] l2_freeze_mode L2 freeze mode. 1190 * 1191 * \retval SHR_E_NONE No errors. 1192 * \retval !SHR_E_NONE Failure. 1193 */ 1194 extern int 1195 mbcm_ltsw_l2_frozen_cml_restore( 1196 int unit, 1197 int *l2_freeze_mode); 1198 1199 /*! 1200 * \brief Freeze L2 MAC learn and move. 1201 * 1202 * \param [in] unit Unit Number. 1203 * \param [out] l2_freeze_mode L2 freeze mode. 1204 * 1205 * \retval SHR_E_NONE No errors. 1206 * \retval !SHR_E_NONE Failure. 1207 */ 1208 extern int 1209 mbcm_ltsw_l2_frozen_cml_save( 1210 int unit, 1211 int *l2_freeze_mode); 1212 1213 /*! 1214 * \brief Recover L2 learn override during Warmboot. 1215 * 1216 * \param [in] unit Unit Number. 1217 * \param [out] l2_freeze_override L2 frozen by L2_LEARN_OVERRIDE. 1218 * 1219 * \retval SHR_E_NONE No errors. 1220 * \retval !SHR_E_NONE Failure. 1221 */ 1222 extern int 1223 mbcm_ltsw_l2_frozen_cml_recover( 1224 int unit, 1225 int *l2_freeze_override); 1226 1227 /*! 1228 * \brief Dump L2 module software bookkeepings. 1229 * 1230 * \param [in] unit Unit Number. 1231 */ 1232 extern void 1233 mbcm_ltsw_l2_sw_dump(int unit); 1234 1235 /*! 1236 * \brief Update L2 table virtual info for a gport. 1237 * 1238 * \param [in] unit Unit Number. 1239 * \param [in] info Virtual info. 1240 * 1241 * \retval SHR_E_NONE No errors. 1242 * \retval !SHR_E_NONE Failure. 1243 */ 1244 extern int 1245 mbcm_ltsw_l2_virtual_info_update( 1246 int unit, 1247 bcmi_ltsw_l2_virtual_info_t *info); 1248 1249 /*! 1250 * \brief L2 map database initialization. 1251 * 1252 * \param [in] unit Unit Number. 1253 * \param [in|out] map_db L2 map database. 1254 * 1255 * \retval SHR_E_NONE No errors. 1256 * \retval !SHR_E_NONE Failure. 1257 */ 1258 extern int 1259 mbcm_ltsw_l2_map_db_init( 1260 int unit, 1261 const bcmint_l2_map_db_t ** map_db); 1262 1263 /*! 1264 * \brief Detach flex counter resources for L2 hit bit. 1265 * 1266 * \param [in] unit Unit Number. 1267 * \param [in] info Flexctr info pointer. 1268 * 1269 * \retval SHR_E_NONE No errors. 1270 * \retval !SHR_E_NONE Failure. 1271 */ 1272 extern int 1273 mbcm_ltsw_l2_hitbit_detach( 1274 int unit, 1275 bcmint_l2_flexctr_info_t *info); 1276 1277 /*! 1278 * \brief Init flex counter resources for L2 hit bit. 1279 * 1280 * \param [in] unit Unit Number. 1281 * \param [out] info Flexctr info pointer. 1282 * 1283 * \retval SHR_E_NONE No errors. 1284 * \retval !SHR_E_NONE Failure. 1285 */ 1286 extern int 1287 mbcm_ltsw_l2_hitbit_init( 1288 int unit, 1289 bcmint_l2_flexctr_info_t *info); 1290 1291 #endif /* BCMINT_LTSW_MBCM_L2_H */