cosq.h (59379B)
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_COSQ_H 12 #define BCMINT_LTSW_MBCM_COSQ_H 13 14 #include <bcm/types.h> 15 #include <bcm/cosq.h> 16 17 #include <bcm_int/ltsw/cosq_int.h> 18 #include <bcm_int/ltsw/cosq.h> 19 20 #include <sal/sal_types.h> 21 22 /*! 23 * \brief Initialize cosq module 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 (*cosq_init_f)(int unit); 31 32 /*! 33 * \brief Destroy cosq module information 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 (*cosq_detach_f)(int unit); 41 42 /*! 43 * \brief Cosq map database initialization. 44 * 45 * \param [in] unit Unit Number. 46 * \param [in|out] map_db Cosq map database. 47 * 48 * \retval SHR_E_NONE No errors. 49 * \retval !SHR_E_NONE Failure. 50 */ 51 typedef int (*cosq_map_db_init_f)( 52 int unit, 53 const bcmint_cosq_map_db_t ** map_db); 54 55 /*! 56 * \brief retrieve TM_Q_ASSIGNMENT_INFO. 57 * 58 * \param [in] unit Unit Number. 59 * \param [in] info_id Queue assignment info id. 60 * \param [out] info Queue assignment info. 61 * 62 * \retval SHR_E_NONE No errors. 63 * \retval !SHR_E_NONE Failure. 64 */ 65 typedef int (*cosq_queue_assignment_info_get_f)( 66 int unit, 67 const char *info_id, 68 bcmint_cosq_assignment_info_t *info); 69 70 /*! 71 * \brief Get port number and queue or scheduler identifier for the specified GPORT. 72 * 73 * \param [in] unit Unit Number. 74 * \param [in] gport GPORT identifier. 75 * \param [out] port port number. 76 * \param [out] id Queue or scheduler identifier 77 * 78 * \retval SHR_E_NONE No errors. 79 * \retval !SHR_E_NONE Failure. 80 */ 81 typedef int (*cosq_gport_port_resolve_f)( 82 int unit, 83 bcm_gport_t gport, 84 bcm_gport_t *port, 85 int *id); 86 87 /*! 88 * \brief Validate input parameters of ingress threshold. 89 * 90 * \param [in] unit Unit Number. 91 * \param [in] port port ID. 92 * \param [out] itm itm 93 * 94 * \retval SHR_E_NONE No errors. 95 * \retval !SHR_E_NONE Failure. 96 */ 97 typedef int (*cosq_port_itm_validate_f)( 98 int unit, 99 int port, 100 int *itm); 101 102 /*! 103 * \brief Displays COS Queue information maintained by software. 104 * 105 * \param [in] unit Unit Number. 106 * 107 * \retval SHR_E_NONE No errors. 108 * \retval !SHR_E_NONE Failure. 109 */ 110 typedef int (*cosq_sw_dump_f)(int unit); 111 112 /*! 113 * \brief COS queue bandwidth control bucket setting. 114 * 115 * \param [in] unit Unit Number. 116 * \param [in] gport GPORT identifier. 117 * \param [in] cosq COS queue number. 118 * \param [in] min_quantum kbps or packet/second. 119 * \param [in] max_quantum kbps or packet/second. 120 * \param [in] burst_size_auto Enables automatic calculation of burst size. 121 * \param [in] kbits_burst_min Configured size of minimum burst traffic. 122 * \param [in] kbits_burst_max Configured size of maximum burst traffic. 123 * \param [in] flags flags. 124 * 125 * \retval SHR_E_NONE No errors. 126 * \retval !SHR_E_NONE Failure. 127 */ 128 typedef int (*cosq_bucket_set_f)( 129 int unit, 130 bcm_gport_t gport, 131 bcm_cos_queue_t cosq, 132 uint32_t min_quantum, 133 uint32_t max_quantum, 134 bool burst_size_auto, 135 uint32_t kbits_burst_min, 136 uint32_t kbits_burst_max, 137 uint32_t flags); 138 139 /*! 140 * \brief Get COS queue bandwidth control bucket setting. 141 * 142 * \param [in] unit Unit Number. 143 * \param [in] gport GPORT identifier. 144 * \param [in] cosq COS queue number. 145 * \param [out] min_quantum kbps or packet/second. 146 * \param [out] max_quantum kbps or packet/second. 147 * \param [in] burst_size_auto Enables automatic calculation of burst size. 148 * \param [out] kbits_burst_min Configured size of minimum burst traffic. 149 * \param [out] kbits_burst_max Configured size of maximum burst traffic. 150 * \param [out] flags flags. 151 * 152 * \retval SHR_E_NONE No errors. 153 * \retval !SHR_E_NONE Failure. 154 */ 155 typedef int (*cosq_bucket_get_f)( 156 int unit, 157 bcm_gport_t gport, 158 bcm_cos_queue_t cosq, 159 uint32_t *min_quantum, 160 uint32_t *max_quantum, 161 bool burst_size_auto, 162 uint32_t *kbits_burst_min, 163 uint32_t *kbits_burst_max, 164 uint32_t *flags); 165 166 /*! 167 * \brief Clear cosq configuration of port 168 * 169 * \param [in] unit Unit Number. 170 * \param [in] port Port Number. 171 * 172 * \retval SHR_E_NONE No errors. 173 * \retval !SHR_E_NONE Failure. 174 */ 175 typedef int (*cosq_port_detach_f)( 176 int unit, 177 bcm_port_t port); 178 179 /*! 180 * \brief Initialize Cosq for newly added port 181 * 182 * \param [in] unit Unit Number. 183 * \param [in] port Port Number. 184 * 185 * \retval SHR_E_NONE No errors. 186 * \retval !SHR_E_NONE Failure. 187 */ 188 typedef int (*cosq_port_attach_f)( 189 int unit, 190 bcm_port_t port); 191 192 /*! 193 * \brief Enable to use multicast COS from mirroring. 194 * 195 * \param [in] unit Unit Number. 196 * \param [in] enable Enable 197 * 198 * \retval SHR_E_NONE No errors. 199 * \retval !SHR_E_NONE Failure. 200 */ 201 typedef int (*cosq_mc_cos_mirror_set_f)( 202 int unit, 203 int enable); 204 205 /*! 206 * \brief Enable to use multicast COS from mirroring. 207 * 208 * \param [in] unit Unit Number. 209 * \param [out] enable Enable status 210 * 211 * \retval SHR_E_NONE No errors. 212 * \retval !SHR_E_NONE Failure. 213 */ 214 typedef int (*cosq_mc_cos_mirror_get_f)( 215 int unit, 216 int *enable); 217 218 /*! 219 * \brief Get the number of child nodes and child node gport array for scheduler gport 220 * 221 * \param [in] unit Unit Number. 222 * \param [in] sched_gport GPORT identifier. 223 * \param [out] num_uc_child number of uc child 224 * \param [out] uc_queue uc queue array 225 * \param [out] num_mc_child number of mc child 226 * \param [out] mc_queue mc queue array 227 * 228 * \retval SHR_E_NONE No errors. 229 * \retval !SHR_E_NONE Failure. 230 */ 231 typedef int (*cosq_sched_node_child_get_f)( 232 int unit, 233 bcm_gport_t sched_gport, 234 int *num_uc_child, 235 int *uc_queue, 236 int *num_mc_child, 237 int *mc_queue); 238 239 /*! 240 * \brief Get a cosq gport structure 241 * 242 * \param [in] unit Unit Number. 243 * \param [in] gport GPORT identifier. 244 * \param [out] port port number. 245 * \param [out] numq number of COS queues 246 * \param [out] flags flags (BCM_COSQ_GPORT_XXX) 247 * 248 * \retval SHR_E_NONE No errors. 249 * \retval !SHR_E_NONE Failure. 250 */ 251 typedef int (*cosq_gport_get_f)( 252 int unit, 253 bcm_gport_t gport, 254 bcm_gport_t *port, 255 int *numq, 256 uint32_t *flags); 257 258 /*! 259 * \brief Get the child node GPORT atatched to N-th index (cosq) 260 * 261 * \param [in] unit Unit Number. 262 * \param [in] in_gport Scheduler GPORT ID. 263 * \param [in] cosq COS queue attached to 264 * \param [out] out_gport child GPORT ID 265 * 266 * \retval SHR_E_NONE No errors. 267 * \retval !SHR_E_NONE Failure. 268 */ 269 typedef int (*cosq_gport_child_get_f)( 270 int unit, 271 bcm_gport_t in_gport, 272 bcm_cos_queue_t cosq, 273 bcm_gport_t *out_gport); 274 275 /*! 276 * \brief Attach sched_port to the specified index (cosq) of input_port. 277 * 278 * \param [in] unit Unit Number. 279 * \param [in] input_gport GPORT id, that will attach to parent gport. 280 * \param [in] parent_gport Parent Gport to which current gport will be attached 281 * \param [in] cosq COS queue attached to 282 * 283 * \retval SHR_E_NONE No errors. 284 * \retval !SHR_E_NONE Failure. 285 */ 286 typedef int (*cosq_gport_attach_f)( 287 int unit, 288 bcm_gport_t input_gport, 289 bcm_gport_t parent_gport, 290 bcm_cos_queue_t cosq); 291 292 /*! 293 * \brief Attach sched_port to the specified index (cosq) of input_port. 294 * 295 * \param [in] unit Unit Number. 296 * \param [in] input_gport GPORT id, that will attach to parent gport. 297 * \param [in] parent_gport Parent Gport to which current gport will be detached 298 * \param [in] cosq COS queue detached from 299 * 300 * \retval SHR_E_NONE No errors. 301 * \retval !SHR_E_NONE Failure. 302 */ 303 typedef int (*cosq_gport_detach_f)( 304 int unit, 305 bcm_gport_t input_gport, 306 bcm_gport_t parent_gport, 307 bcm_cos_queue_t cosq); 308 309 /*! 310 * \brief Get attached status of a scheduler port. 311 * 312 * \param [in] unit Unit Number. 313 * \param [in] sched_gport scheduler GPORT identifier. 314 * \param [out] input_gport GPORT to attach to 315 * \param [out] cosq COS queue attached to 316 * 317 * \retval SHR_E_NONE No errors. 318 * \retval !SHR_E_NONE Failure. 319 */ 320 typedef int (*cosq_gport_attach_get_f)( 321 int unit, 322 bcm_gport_t sched_gport, 323 bcm_gport_t *input_gport, 324 bcm_cos_queue_t *cosq); 325 326 /*! 327 * \brief Walks through the valid COSQ GPORTs and calls the user supplied callback function for each entry. 328 * 329 * \param [in] unit Unit Number. 330 * \param [in] cb Callback function. 331 * \param [out] user_data User data to be passed to callback function 332 * 333 * \retval SHR_E_NONE No errors. 334 * \retval !SHR_E_NONE Failure. 335 */ 336 typedef int (*cosq_gport_traverse_f)( 337 int unit, 338 bcm_cosq_gport_traverse_cb cb, 339 void *user_data); 340 341 /*! 342 * \brief Retrieve maximum weights for given COS policy. 343 * 344 * \param [in] unit Unit Number. 345 * \param [in] mode Scheduling mode, one of BCM_COSQ_xxx. 346 * \param [out] weight_max Maximum weight for COS queue 347 * 348 * \retval SHR_E_NONE No errors. 349 * \retval !SHR_E_NONE Failure. 350 */ 351 typedef int (*cosq_sched_weight_max_get_f)( 352 int unit, 353 int mode, 354 int *weight_max); 355 356 /*! 357 * \brief Cosq schedq mapping set 358 * 359 * \param [in] unit Unit Number. 360 * \param [in] profile_index Profile index. 361 * \param [in] size Array size. 362 * \param [in] cosq_mapping_arr Cosq to queue mapping for scheduler. 363 * 364 * \retval SHR_E_NONE No errors. 365 * \retval !SHR_E_NONE Failure. 366 */ 367 typedef int (*cosq_schedq_mapping_set_f)( 368 int unit, 369 int profile_index, 370 int size, 371 bcm_cosq_mapping_t *cosq_mapping_arr); 372 373 /*! 374 * \brief cosq schedq mapping get 375 * 376 * \param [in] unit Unit Number. 377 * \param [in] profile_index Profile index. 378 * \param [in] array_max Max size. 379 * \param [out] cosq_mapping_arr Cosq to queue mapping for scheduler. 380 * \param [out] size Array size. 381 * 382 * \retval SHR_E_NONE No errors. 383 * \retval !SHR_E_NONE Failure. 384 */ 385 typedef int (*cosq_schedq_mapping_get_f)( 386 int unit, 387 int profile_index, 388 int array_max, 389 bcm_cosq_mapping_t *cosq_mapping_arr, 390 int *size); 391 392 /*! 393 * \brief Set Port to Profile Mapping for Cosq profiles 394 * 395 * \param [in] unit Unit Number. 396 * \param [in] port Port Number. 397 * \param [in] profile_id Profile index. 398 * 399 * \retval SHR_E_NONE No errors. 400 * \retval !SHR_E_NONE Failure. 401 */ 402 typedef int (*cosq_port_scheduler_profile_set_f)( 403 int unit, 404 bcm_port_t port, 405 int profile_id); 406 407 /*! 408 * \brief Get Port to Profile Mapping for Cosq profiles 409 * 410 * \param [in] unit Unit Number. 411 * \param [in] port Port Number. 412 * \param [out] profile_id Profile index. 413 * 414 * \retval SHR_E_NONE No errors. 415 * \retval !SHR_E_NONE Failure. 416 */ 417 typedef int (*cosq_port_scheduler_profile_get_f)( 418 int unit, 419 bcm_port_t port, 420 int *profile_id); 421 422 /*! 423 * \brief Set port node scheduling mode and weight 424 * 425 * \param [in] unit Unit Number. 426 * \param [in] gport Port number or GPORT identifier. 427 * \param [in] cosq Node id. 428 * \param [in] mode sched mode. 429 * \param [in] weight weight. 430 * 431 * \retval SHR_E_NONE No errors. 432 * \retval !SHR_E_NONE Failure. 433 */ 434 typedef int (*cosq_sched_set_f)( 435 int unit, 436 bcm_port_t gport, 437 bcm_cos_queue_t cosq, 438 int mode, 439 int weight); 440 441 /*! 442 * \brief Get port node scheduling mode and weight 443 * 444 * \param [in] unit Unit Number. 445 * \param [in] gport Port number or GPORT identifier. 446 * \param [in] cosq COS queue number. 447 * \param [out] mode sched mode. 448 * \param [out] weight weight. 449 * 450 * \retval SHR_E_NONE No errors. 451 * \retval !SHR_E_NONE Failure. 452 */ 453 typedef int (*cosq_sched_get_f)( 454 int unit, 455 bcm_port_t gport, 456 bcm_cos_queue_t cosq, 457 int *mode, 458 int *weight); 459 460 /*! 461 * \brief Retrieve maximum number for given profile. 462 * 463 * \param [in] unit Unit Number. 464 * \param [in] profile_type Profile type. 465 * \param [out] max_num Maximum number for profile 466 * 467 * \retval SHR_E_NONE No errors. 468 * \retval !SHR_E_NONE Failure. 469 */ 470 typedef int (*cosq_cosq_profile_max_num_get_f)( 471 int unit, 472 bcm_cosq_profile_type_t profile_type, 473 int *max_num); 474 475 /*! 476 * \brief Set up class-of-service policy and corresponding weights and mode 477 * 478 * \param [in] unit Unit Number. 479 * \param [in] pbm port bitmap. 480 * \param [in] mode Scheduling mode. 481 * \param [in] weight_arr_size Size of the weights array. 482 * \param [in] weights Weights for each COS queue. 483 * 484 * \retval SHR_E_NONE No errors. 485 * \retval !SHR_E_NONE Failure. 486 */ 487 typedef int (*cosq_port_sched_config_set_f)( 488 int unit, 489 bcm_pbmp_t pbm, 490 int mode, 491 int weight_arr_size, 492 int *weights); 493 494 /*! 495 * \brief Retrieve class-of-service policy and corresponding weights and mode 496 * 497 * \param [in] unit Unit Number. 498 * \param [in] pbm port bitmap. 499 * \param [in] weight_arr_size Size of the weights array. 500 * \param [out] weights Weights for each COS queue. 501 * \param [out] weight_arr_count Actual size of weights array. 502 * \param [out] mode Scheduling mode. 503 * 504 * \retval SHR_E_NONE No errors. 505 * \retval !SHR_E_NONE Failure. 506 */ 507 typedef int (*cosq_port_sched_config_get_f)( 508 int unit, 509 bcm_pbmp_t pbm, 510 int weight_arr_size, 511 int *weights, 512 int *weight_arr_count, 513 int *mode); 514 515 /*! 516 * \brief Set the COS queue WRED parameters 517 * 518 * \param [in] unit Unit Number. 519 * \param [in] flags BCM_COSQ_DISCARD_* 520 * 521 * \retval SHR_E_NONE No errors. 522 * \retval !SHR_E_NONE Failure. 523 */ 524 typedef int (*cosq_discard_set_f)( 525 int unit, 526 uint32_t flags); 527 528 /*! 529 * \brief Get the COS queue WRED parameters 530 * 531 * \param [in] unit Unit Number. 532 * \param [out] flags BCM_COSQ_DISCARD_* 533 * 534 * \retval SHR_E_NONE No errors. 535 * \retval !SHR_E_NONE Failure. 536 */ 537 typedef int (*cosq_discard_get_f)( 538 int unit, 539 uint32_t *flags); 540 541 /*! 542 * \brief Set the COS queue WRED parameters 543 * 544 * \param [in] unit Unit Number. 545 * \param [in] gport GPORT ID. 546 * \param [in] cosq cosq. 547 * \param [in] discard Discard settings. 548 * 549 * \retval SHR_E_NONE No errors. 550 * \retval !SHR_E_NONE Failure. 551 */ 552 typedef int (*cosq_gport_discard_set_f)( 553 int unit, 554 bcm_gport_t gport, 555 bcm_cos_queue_t cosq, 556 bcm_cosq_gport_discard_t *discard); 557 558 /*! 559 * \brief Get the COS queue WRED parameters 560 * 561 * \param [in] unit Unit Number. 562 * \param [in] gport GPORT ID. 563 * \param [in] cosq cosq. 564 * \param [out] discard Discard settings. 565 * 566 * \retval SHR_E_NONE No errors. 567 * \retval !SHR_E_NONE Failure. 568 */ 569 typedef int (*cosq_gport_discard_get_f)( 570 int unit, 571 bcm_gport_t gport, 572 bcm_cos_queue_t cosq, 573 bcm_cosq_gport_discard_t *discard); 574 575 /*! 576 * \brief Create an empty rule profile 577 * 578 * \param [in] unit Unit Number. 579 * \param [in] profile_id Profile index. 580 * 581 * \retval SHR_E_NONE No errors. 582 * \retval !SHR_E_NONE Failure. 583 */ 584 typedef int (*cosq_discard_profile_create_f)( 585 int unit, 586 int *profile_id); 587 588 /*! 589 * \brief Destroy a rule profile 590 * 591 * \param [in] unit Unit Number. 592 * \param [in] profile_id Profile index. 593 * 594 * \retval SHR_E_NONE No errors. 595 * \retval !SHR_E_NONE Failure. 596 */ 597 typedef int (*cosq_discard_profile_destroy_f)( 598 int unit, 599 int profile_id); 600 601 /*! 602 * \brief Update one rule in a profile 603 * 604 * \param [in] unit Unit Number. 605 * \param [in] profile_id Profile index. 606 * \param [in] rule discard rule 607 * 608 * \retval SHR_E_NONE No errors. 609 * \retval !SHR_E_NONE Failure. 610 */ 611 typedef int (*cosq_discard_profile_update_f)( 612 int unit, 613 int profile_id, 614 bcm_cosq_discard_rule_t *rule); 615 616 /*! 617 * \brief Get all rules of a profile 618 * 619 * \param [in] unit Unit Number. 620 * \param [in] profile_id Profile index. 621 * \param [in] max rule array size. 622 * \param [out] rule_array rule array. 623 * \param [out] rule_count actual rules count. 624 * 625 * \retval SHR_E_NONE No errors. 626 * \retval !SHR_E_NONE Failure. 627 */ 628 typedef int (*cosq_discard_profile_get_f)( 629 int unit, 630 int profile_id, 631 int max, 632 bcm_cosq_discard_rule_t *rule_array, 633 int *rule_count); 634 635 /*! 636 * \brief Set COS queue for the specified priority of an ingress port 637 * 638 * \param [in] unit Unit Number. 639 * \param [in] local_port local port 640 * \param [in] priority priority value to map 641 * \param [in] flags BCM_COSQ_GPORT_XXX_QUEUE_GROUP 642 * \param [in] gport queue group GPORT identifier 643 * \param [in] cosq COS queue number 644 * 645 * \retval SHR_E_NONE No errors. 646 * \retval !SHR_E_NONE Failure. 647 */ 648 typedef int (*cosq_cos_mapping_set_f)( 649 int unit, 650 bcm_port_t local_port, 651 bcm_cos_t priority, 652 uint32_t flags, 653 bcm_gport_t gport, 654 bcm_cos_queue_t cosq); 655 656 /*! 657 * \brief Get COS queue for the specified priority of an ingress port. 658 * 659 * \param [in] unit Unit Number. 660 * \param [in] local_port local port 661 * \param [in] priority priority value to map 662 * \param [in] flags BCM_COSQ_GPORT_XXX_QUEUE_GROUP 663 * \param [out] gport queue group GPORT identifier 664 * \param [out] cosq COS queue number 665 * 666 * \retval SHR_E_NONE No errors. 667 * \retval !SHR_E_NONE Failure. 668 */ 669 typedef int (*cosq_cos_mapping_get_f)( 670 int unit, 671 bcm_port_t local_port, 672 bcm_cos_t priority, 673 uint32_t flags, 674 bcm_gport_t *gport, 675 bcm_cos_queue_t *cosq); 676 677 /*! 678 * \brief Get shaper configure from LT TM_SHAPER_CONFIG 679 * 680 * \param [in] unit Unit Number. 681 * \param [out] refresh_time Refresh time. 682 * \param [out] itu_mode itu mode enable. 683 * \param [out] shaper Shaper enable. 684 * 685 * \retval SHR_E_NONE No errors. 686 * \retval !SHR_E_NONE Failure. 687 */ 688 typedef int (*cosq_shaper_config_get_f)( 689 int unit, 690 int *refresh_time, 691 int *itu_mode, 692 int *shaper); 693 694 /*! 695 * \brief Create a cosq classifier. 696 * 697 * \param [in] unit Unit Number. 698 * \param [out] classifier_id Classifier ID. 699 * 700 * \retval SHR_E_NONE No errors. 701 * \retval !SHR_E_NONE Failure. 702 */ 703 typedef int (*cosq_field_classifier_id_create_f)( 704 int unit, 705 int *classifier_id); 706 707 /*! 708 * \brief Free resource associated with this field classifier id. 709 * 710 * \param [in] unit Unit Number. 711 * \param [in] classifier_id Classifier ID. 712 * 713 * \retval SHR_E_NONE No errors. 714 * \retval !SHR_E_NONE Failure. 715 */ 716 typedef int (*cosq_field_classifier_id_destroy_f)( 717 int unit, 718 int classifier_id); 719 720 /*! 721 * \brief Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. 722 * 723 * \param [in] unit Unit Number. 724 * \param [in] classifier_id Classifier ID. 725 * \param [in] count Number of elements in priority_array and cosq_array. 726 * \param [in] priority_array Array of internal priorities. 727 * \param [in] cosq_array Array of COS queues. 728 * 729 * \retval SHR_E_NONE No errors. 730 * \retval !SHR_E_NONE Failure. 731 */ 732 typedef int (*cosq_field_classifier_map_set_f)( 733 int unit, 734 int classifier_id, 735 int count, 736 bcm_cos_t *priority_array, 737 bcm_cos_queue_t *cosq_array); 738 739 /*! 740 * \brief Get internal priority to ingress field processor CoS queue override mapping information. 741 * 742 * \param [in] unit Unit Number. 743 * \param [in] classifier_id Classifier ID. 744 * \param [in] array_max Size of priority_array and cosq_array. 745 * \param [in] priority_array Array of internal priorities. 746 * \param [out] cosq_array Array of COS queues. 747 * \param [out] array_count Size of cosq_array. 748 * 749 * \retval SHR_E_NONE No errors. 750 * \retval !SHR_E_NONE Failure. 751 */ 752 typedef int (*cosq_field_classifier_map_get_f)( 753 int unit, 754 int classifier_id, 755 int array_max, 756 bcm_cos_t *priority_array, 757 bcm_cos_queue_t *cosq_array, 758 int *array_count); 759 760 /*! 761 * \brief Delete an internal priority to ingress field processor CoS queue override mapping profile set. 762 * 763 * \param [in] unit Unit Number. 764 * \param [in] classifier_id Classifier ID. 765 * 766 * \retval SHR_E_NONE No errors. 767 * \retval !SHR_E_NONE Failure. 768 */ 769 typedef int (*cosq_field_classifier_map_clear_f)( 770 int unit, 771 int classifier_id); 772 773 /*! 774 * \brief Create a cosq classifier. 775 * 776 * \param [in] unit Unit Number. 777 * \param [out] classifier_id Classifier ID. 778 * 779 * \retval SHR_E_NONE No errors. 780 * \retval !SHR_E_NONE Failure. 781 */ 782 typedef int (*cosq_field_hi_classifier_id_create_f)( 783 int unit, 784 int *classifier_id); 785 786 /*! 787 * \brief Free resource associated with this field classifier id. 788 * 789 * \param [in] unit Unit Number. 790 * \param [in] classifier_id Classifier ID. 791 * 792 * \retval SHR_E_NONE No errors. 793 * \retval !SHR_E_NONE Failure. 794 */ 795 typedef int (*cosq_field_hi_classifier_id_destroy_f)( 796 int unit, 797 int classifier_id); 798 799 /*! 800 * \brief Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. 801 * 802 * \param [in] unit Unit Number. 803 * \param [in] classifier_id Classifier ID. 804 * \param [in] count Number of elements in priority_array and cosq_array. 805 * \param [in] priority_array Array of internal priorities. 806 * \param [in] cosq_array Array of COS queues. 807 * 808 * \retval SHR_E_NONE No errors. 809 * \retval !SHR_E_NONE Failure. 810 */ 811 typedef int (*cosq_field_hi_classifier_map_set_f)( 812 int unit, 813 int classifier_id, 814 int count, 815 bcm_cos_t *priority_array, 816 bcm_cos_queue_t *cosq_array); 817 818 /*! 819 * \brief Get internal priority to ingress field processor CoS queue override mapping information. 820 * 821 * \param [in] unit Unit Number. 822 * \param [in] classifier_id Classifier ID. 823 * \param [in] array_max Size of priority_array and cosq_array. 824 * \param [in] priority_array Array of internal priorities. 825 * \param [out] cosq_array Array of COS queues. 826 * \param [out] array_count Size of cosq_array. 827 * 828 * \retval SHR_E_NONE No errors. 829 * \retval !SHR_E_NONE Failure. 830 */ 831 typedef int (*cosq_field_hi_classifier_map_get_f)( 832 int unit, 833 int classifier_id, 834 int array_max, 835 bcm_cos_t *priority_array, 836 bcm_cos_queue_t *cosq_array, 837 int *array_count); 838 839 /*! 840 * \brief Delete an internal priority to ingress field processor CoS queue override mapping profile set. 841 * 842 * \param [in] unit Unit Number. 843 * \param [in] classifier_id Classifier ID. 844 * 845 * \retval SHR_E_NONE No errors. 846 * \retval !SHR_E_NONE Failure. 847 */ 848 typedef int (*cosq_field_hi_classifier_map_clear_f)( 849 int unit, 850 int classifier_id); 851 852 /*! 853 * \brief Retrieve number UC&MC queue according to multcast queue mode. 854 * 855 * \param [in] unit Unit Number. 856 * \param [out] num_ucq unicast queue number. 857 * \param [out] num_mcq multcast queue number. 858 * 859 * \retval SHR_E_NONE No errors. 860 * \retval !SHR_E_NONE Failure. 861 */ 862 typedef int (*cosq_num_queue_get_f)( 863 int unit, 864 int *num_ucq, 865 int *num_mcq); 866 867 /*! 868 * \brief Get port map information 869 * 870 * \param [in] unit Unit Number. 871 * \param [in] port Port Number. 872 * \param [out] info port map information. 873 * 874 * \retval SHR_E_NONE No errors. 875 * \retval !SHR_E_NONE Failure. 876 */ 877 typedef int (*cosq_port_map_info_get_f)( 878 int unit, 879 bcm_port_t port, 880 bcmi_ltsw_cosq_port_map_info_t *info); 881 882 /*! 883 * \brief Get device specific TM information 884 * 885 * \param [in] unit Unit Number. 886 * \param [out] info Device specific TM information. 887 * 888 * \retval SHR_E_NONE No errors. 889 * \retval !SHR_E_NONE Failure. 890 */ 891 typedef int (*cosq_device_info_get_f)( 892 int unit, 893 bcmi_ltsw_cosq_device_info_t *info); 894 895 /*! 896 * \brief Set cut-through mode for a specific port 897 * 898 * \param [in] unit Unit Number. 899 * \param [in] port Port Number. 900 * \param [in] enable Enable to use cut-through mode. 901 * 902 * \retval SHR_E_NONE No errors. 903 * \retval !SHR_E_NONE Failure. 904 */ 905 typedef int (*cosq_port_ct_mode_set_f)( 906 int unit, 907 bcm_port_t port, 908 int enable); 909 910 /*! 911 * \brief Get cut-through mode for a specific port 912 * 913 * \param [in] unit Unit Number. 914 * \param [in] port Port Number. 915 * \param [out] enable Enable to use cut-through mode. 916 * 917 * \retval SHR_E_NONE No errors. 918 * \retval !SHR_E_NONE Failure. 919 */ 920 typedef int (*cosq_port_ct_mode_get_f)( 921 int unit, 922 bcm_port_t port, 923 int *enable); 924 925 /*! 926 * \brief Dump per-port asf configurations to diag Shell 927 * 928 * \param [in] unit Unit Number. 929 * \param [in] port Port Number. 930 * \param [in] port_speed Port speed in MB/s. 931 * 932 * \retval SHR_E_NONE No errors. 933 * \retval !SHR_E_NONE Failure. 934 */ 935 typedef int (*cosq_port_asf_config_dump_f)( 936 int unit, 937 bcm_port_t port, 938 int port_speed); 939 940 /*! 941 * \brief Print per-port traffic forwarding mode in diag Shell 942 * 943 * \param [in] unit Unit Number. 944 * \param [in] port Port Number. 945 * \param [in] port_speed Port speed in MB/s. 946 * 947 * \retval SHR_E_NONE No errors. 948 * \retval !SHR_E_NONE Failure. 949 */ 950 typedef int (*cosq_port_asf_config_show_f)( 951 int unit, 952 bcm_port_t port, 953 int port_speed); 954 955 /*! 956 * \brief Get the associated rx channel with a given cosq 957 * 958 * \param [in] unit Unit Number. 959 * \param [in] queue_id input queue id 960 * \param [in] chan_id channel index 961 * \param [out] enable enable state 962 * 963 * \retval SHR_E_NONE No errors. 964 * \retval !SHR_E_NONE Failure. 965 */ 966 typedef int (*cosq_rx_queue_channel_get_f)( 967 int unit, 968 bcm_cos_queue_t queue_id, 969 bcm_rx_chan_t chan_id, 970 bool *enable); 971 972 /*! 973 * \brief Assign a RX channel to a cosq 974 * 975 * \param [in] unit Unit Number. 976 * \param [in] queue_id input queue id 977 * \param [in] chan_id channel index 978 * \param [in] enable enable state 979 * 980 * \retval SHR_E_NONE No errors. 981 * \retval !SHR_E_NONE Failure. 982 */ 983 typedef int (*cosq_rx_queue_channel_set_f)( 984 int unit, 985 bcm_cos_queue_t queue_id, 986 bcm_rx_chan_t chan_id, 987 bool enable); 988 989 /*! 990 * \brief Tests whether the corresponding COS_BMP bit is set or not 991 * 992 * \param [in] unit Unit Number. 993 * \param [in] queue_id input queue id 994 * \param [in] chan_id channel index 995 * 996 * \retval SHR_E_NONE No errors. 997 * \retval !SHR_E_NONE Failure. 998 */ 999 typedef int (*cosq_rx_queue_channel_set_test_f)( 1000 int unit, 1001 bcm_cos_queue_t queue_id, 1002 bcm_rx_chan_t chan_id); 1003 1004 /*! 1005 * \brief Walks through the valid COSQ GPORTs belong to a port and calls the user supplied callback function for each entry. 1006 * 1007 * \param [in] unit Unit Number. 1008 * \param [in] port GPORT identifier. 1009 * \param [in] cb Callback function. 1010 * \param [out] user_data User data to be passed to callback function 1011 * 1012 * \retval SHR_E_NONE No errors. 1013 * \retval !SHR_E_NONE Failure. 1014 */ 1015 typedef int (*cosq_gport_traverse_by_port_f)( 1016 int unit, 1017 bcm_gport_t port, 1018 bcm_cosq_gport_traverse_cb cb, 1019 void *user_data); 1020 1021 /*! 1022 * \brief Cosq driver structure. 1023 */ 1024 typedef struct mbcm_ltsw_cosq_drv_s { 1025 1026 /*! Initialize cosq module information */ 1027 cosq_init_f cosq_init; 1028 1029 /*! Destroy cosq module information */ 1030 cosq_detach_f cosq_detach; 1031 1032 /*! Cosq map database initialization. */ 1033 cosq_map_db_init_f cosq_map_db_init; 1034 1035 /*! retrieve TM_Q_ASSIGNMENT_INFO. */ 1036 cosq_queue_assignment_info_get_f cosq_queue_assignment_info_get; 1037 1038 /*! Get port number and queue or scheduler identifier for the specified GPORT. */ 1039 cosq_gport_port_resolve_f cosq_gport_port_resolve; 1040 1041 /*! Validate input parameters of ingress threshold. */ 1042 cosq_port_itm_validate_f cosq_port_itm_validate; 1043 1044 /*! Displays COS Queue information maintained by software. */ 1045 cosq_sw_dump_f cosq_sw_dump; 1046 1047 /*! COS queue bandwidth control bucket setting. */ 1048 cosq_bucket_set_f cosq_bucket_set; 1049 1050 /*! Get COS queue bandwidth control bucket setting. */ 1051 cosq_bucket_get_f cosq_bucket_get; 1052 1053 /*! Clear cosq configuration of port */ 1054 cosq_port_detach_f cosq_port_detach; 1055 1056 /*! Initialize Cosq for newly added port */ 1057 cosq_port_attach_f cosq_port_attach; 1058 1059 /*! Enable to use multicast COS from mirroring. */ 1060 cosq_mc_cos_mirror_set_f cosq_mc_cos_mirror_set; 1061 1062 /*! Enable to use multicast COS from mirroring. */ 1063 cosq_mc_cos_mirror_get_f cosq_mc_cos_mirror_get; 1064 1065 /*! Get the number of child nodes and child node gport array for scheduler gport */ 1066 cosq_sched_node_child_get_f cosq_sched_node_child_get; 1067 1068 /*! Get a cosq gport structure */ 1069 cosq_gport_get_f cosq_gport_get; 1070 1071 /*! Get the child node GPORT atatched to N-th index (cosq) */ 1072 cosq_gport_child_get_f cosq_gport_child_get; 1073 1074 /*! Attach sched_port to the specified index (cosq) of input_port. */ 1075 cosq_gport_attach_f cosq_gport_attach; 1076 1077 /*! Attach sched_port to the specified index (cosq) of input_port. */ 1078 cosq_gport_detach_f cosq_gport_detach; 1079 1080 /*! Get attached status of a scheduler port. */ 1081 cosq_gport_attach_get_f cosq_gport_attach_get; 1082 1083 /*! Walks through the valid COSQ GPORTs and calls the user supplied callback function for each entry. */ 1084 cosq_gport_traverse_f cosq_gport_traverse; 1085 1086 /*! Retrieve maximum weights for given COS policy. */ 1087 cosq_sched_weight_max_get_f cosq_sched_weight_max_get; 1088 1089 /*! Cosq schedq mapping set */ 1090 cosq_schedq_mapping_set_f cosq_schedq_mapping_set; 1091 1092 /*! cosq schedq mapping get */ 1093 cosq_schedq_mapping_get_f cosq_schedq_mapping_get; 1094 1095 /*! Set Port to Profile Mapping for Cosq profiles */ 1096 cosq_port_scheduler_profile_set_f cosq_port_scheduler_profile_set; 1097 1098 /*! Get Port to Profile Mapping for Cosq profiles */ 1099 cosq_port_scheduler_profile_get_f cosq_port_scheduler_profile_get; 1100 1101 /*! Set port node scheduling mode and weight */ 1102 cosq_sched_set_f cosq_sched_set; 1103 1104 /*! Get port node scheduling mode and weight */ 1105 cosq_sched_get_f cosq_sched_get; 1106 1107 /*! Retrieve maximum number for given profile. */ 1108 cosq_cosq_profile_max_num_get_f cosq_cosq_profile_max_num_get; 1109 1110 /*! Set up class-of-service policy and corresponding weights and mode */ 1111 cosq_port_sched_config_set_f cosq_port_sched_config_set; 1112 1113 /*! Retrieve class-of-service policy and corresponding weights and mode */ 1114 cosq_port_sched_config_get_f cosq_port_sched_config_get; 1115 1116 /*! Set the COS queue WRED parameters */ 1117 cosq_discard_set_f cosq_discard_set; 1118 1119 /*! Get the COS queue WRED parameters */ 1120 cosq_discard_get_f cosq_discard_get; 1121 1122 /*! Set the COS queue WRED parameters */ 1123 cosq_gport_discard_set_f cosq_gport_discard_set; 1124 1125 /*! Get the COS queue WRED parameters */ 1126 cosq_gport_discard_get_f cosq_gport_discard_get; 1127 1128 /*! Create an empty rule profile */ 1129 cosq_discard_profile_create_f cosq_discard_profile_create; 1130 1131 /*! Destroy a rule profile */ 1132 cosq_discard_profile_destroy_f cosq_discard_profile_destroy; 1133 1134 /*! Update one rule in a profile */ 1135 cosq_discard_profile_update_f cosq_discard_profile_update; 1136 1137 /*! Get all rules of a profile */ 1138 cosq_discard_profile_get_f cosq_discard_profile_get; 1139 1140 /*! Set COS queue for the specified priority of an ingress port */ 1141 cosq_cos_mapping_set_f cosq_cos_mapping_set; 1142 1143 /*! Get COS queue for the specified priority of an ingress port. */ 1144 cosq_cos_mapping_get_f cosq_cos_mapping_get; 1145 1146 /*! Get shaper configure from LT TM_SHAPER_CONFIG */ 1147 cosq_shaper_config_get_f cosq_shaper_config_get; 1148 1149 /*! Create a cosq classifier. */ 1150 cosq_field_classifier_id_create_f cosq_field_classifier_id_create; 1151 1152 /*! Free resource associated with this field classifier id. */ 1153 cosq_field_classifier_id_destroy_f cosq_field_classifier_id_destroy; 1154 1155 /*! Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. */ 1156 cosq_field_classifier_map_set_f cosq_field_classifier_map_set; 1157 1158 /*! Get internal priority to ingress field processor CoS queue override mapping information. */ 1159 cosq_field_classifier_map_get_f cosq_field_classifier_map_get; 1160 1161 /*! Delete an internal priority to ingress field processor CoS queue override mapping profile set. */ 1162 cosq_field_classifier_map_clear_f cosq_field_classifier_map_clear; 1163 1164 /*! Create a cosq classifier. */ 1165 cosq_field_hi_classifier_id_create_f cosq_field_hi_classifier_id_create; 1166 1167 /*! Free resource associated with this field classifier id. */ 1168 cosq_field_hi_classifier_id_destroy_f cosq_field_hi_classifier_id_destroy; 1169 1170 /*! Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. */ 1171 cosq_field_hi_classifier_map_set_f cosq_field_hi_classifier_map_set; 1172 1173 /*! Get internal priority to ingress field processor CoS queue override mapping information. */ 1174 cosq_field_hi_classifier_map_get_f cosq_field_hi_classifier_map_get; 1175 1176 /*! Delete an internal priority to ingress field processor CoS queue override mapping profile set. */ 1177 cosq_field_hi_classifier_map_clear_f cosq_field_hi_classifier_map_clear; 1178 1179 /*! Retrieve number UC&MC queue according to multcast queue mode. */ 1180 cosq_num_queue_get_f cosq_num_queue_get; 1181 1182 /*! Get port map information */ 1183 cosq_port_map_info_get_f cosq_port_map_info_get; 1184 1185 /*! Get device specific TM information */ 1186 cosq_device_info_get_f cosq_device_info_get; 1187 1188 /*! Set cut-through mode for a specific port */ 1189 cosq_port_ct_mode_set_f cosq_port_ct_mode_set; 1190 1191 /*! Get cut-through mode for a specific port */ 1192 cosq_port_ct_mode_get_f cosq_port_ct_mode_get; 1193 1194 /*! Dump per-port asf configurations to diag Shell */ 1195 cosq_port_asf_config_dump_f cosq_port_asf_config_dump; 1196 1197 /*! Print per-port traffic forwarding mode in diag Shell */ 1198 cosq_port_asf_config_show_f cosq_port_asf_config_show; 1199 1200 /*! Get the associated rx channel with a given cosq */ 1201 cosq_rx_queue_channel_get_f cosq_rx_queue_channel_get; 1202 1203 /*! Assign a RX channel to a cosq */ 1204 cosq_rx_queue_channel_set_f cosq_rx_queue_channel_set; 1205 1206 /*! Tests whether the corresponding COS_BMP bit is set or not */ 1207 cosq_rx_queue_channel_set_test_f cosq_rx_queue_channel_set_test; 1208 1209 /*! Walks through the valid COSQ GPORTs belong to a port and calls the user supplied callback function for each entry. */ 1210 cosq_gport_traverse_by_port_f cosq_gport_traverse_by_port; 1211 1212 } mbcm_ltsw_cosq_drv_t; 1213 1214 /*! 1215 * \brief Set the COSQ driver of the device. 1216 * 1217 * \param [in] unit Unit Number. 1218 * \param [in] drv Cosq driver to set. 1219 * 1220 * \retval SHR_E_NONE No errors. 1221 * \retval !SHR_E_NONE Failure. 1222 */ 1223 extern int 1224 mbcm_ltsw_cosq_drv_set( 1225 int unit, 1226 mbcm_ltsw_cosq_drv_t *drv); 1227 1228 /*! 1229 * \brief Initialize cosq module information 1230 * 1231 * \param [in] unit Unit Number. 1232 * 1233 * \retval SHR_E_NONE No errors. 1234 * \retval !SHR_E_NONE Failure. 1235 */ 1236 extern int 1237 mbcm_ltsw_cosq_init(int unit); 1238 1239 /*! 1240 * \brief Destroy cosq module information 1241 * 1242 * \param [in] unit Unit Number. 1243 * 1244 * \retval SHR_E_NONE No errors. 1245 * \retval !SHR_E_NONE Failure. 1246 */ 1247 extern int 1248 mbcm_ltsw_cosq_detach(int unit); 1249 1250 /*! 1251 * \brief Cosq map database initialization. 1252 * 1253 * \param [in] unit Unit Number. 1254 * \param [in|out] map_db Cosq map database. 1255 * 1256 * \retval SHR_E_NONE No errors. 1257 * \retval !SHR_E_NONE Failure. 1258 */ 1259 extern int 1260 mbcm_ltsw_cosq_map_db_init( 1261 int unit, 1262 const bcmint_cosq_map_db_t ** map_db); 1263 1264 /*! 1265 * \brief retrieve TM_Q_ASSIGNMENT_INFO. 1266 * 1267 * \param [in] unit Unit Number. 1268 * \param [in] info_id Queue assignment info id. 1269 * \param [out] info Queue assignment info. 1270 * 1271 * \retval SHR_E_NONE No errors. 1272 * \retval !SHR_E_NONE Failure. 1273 */ 1274 extern int 1275 mbcm_ltsw_cosq_queue_assignment_info_get( 1276 int unit, 1277 const char *info_id, 1278 bcmint_cosq_assignment_info_t *info); 1279 1280 /*! 1281 * \brief Get port number and queue or scheduler identifier for the specified GPORT. 1282 * 1283 * \param [in] unit Unit Number. 1284 * \param [in] gport GPORT identifier. 1285 * \param [out] port port number. 1286 * \param [out] id Queue or scheduler identifier 1287 * 1288 * \retval SHR_E_NONE No errors. 1289 * \retval !SHR_E_NONE Failure. 1290 */ 1291 extern int 1292 mbcm_ltsw_cosq_gport_port_resolve( 1293 int unit, 1294 bcm_gport_t gport, 1295 bcm_gport_t *port, 1296 int *id); 1297 1298 /*! 1299 * \brief Validate input parameters of ingress threshold. 1300 * 1301 * \param [in] unit Unit Number. 1302 * \param [in] port port ID. 1303 * \param [out] itm itm 1304 * 1305 * \retval SHR_E_NONE No errors. 1306 * \retval !SHR_E_NONE Failure. 1307 */ 1308 extern int 1309 mbcm_ltsw_cosq_port_itm_validate( 1310 int unit, 1311 int port, 1312 int *itm); 1313 1314 /*! 1315 * \brief Displays COS Queue information maintained by software. 1316 * 1317 * \param [in] unit Unit Number. 1318 * 1319 * \retval SHR_E_NONE No errors. 1320 * \retval !SHR_E_NONE Failure. 1321 */ 1322 extern int 1323 mbcm_ltsw_cosq_sw_dump(int unit); 1324 1325 /*! 1326 * \brief COS queue bandwidth control bucket setting. 1327 * 1328 * \param [in] unit Unit Number. 1329 * \param [in] gport GPORT identifier. 1330 * \param [in] cosq COS queue number. 1331 * \param [in] min_quantum kbps or packet/second. 1332 * \param [in] max_quantum kbps or packet/second. 1333 * \param [in] burst_size_auto Enables automatic calculation of burst size. 1334 * \param [in] kbits_burst_min Configured size of minimum burst traffic. 1335 * \param [in] kbits_burst_max Configured size of maximum burst traffic. 1336 * \param [in] flags flags. 1337 * 1338 * \retval SHR_E_NONE No errors. 1339 * \retval !SHR_E_NONE Failure. 1340 */ 1341 extern int 1342 mbcm_ltsw_cosq_bucket_set( 1343 int unit, 1344 bcm_gport_t gport, 1345 bcm_cos_queue_t cosq, 1346 uint32_t min_quantum, 1347 uint32_t max_quantum, 1348 bool burst_size_auto, 1349 uint32_t kbits_burst_min, 1350 uint32_t kbits_burst_max, 1351 uint32_t flags); 1352 1353 /*! 1354 * \brief Get COS queue bandwidth control bucket setting. 1355 * 1356 * \param [in] unit Unit Number. 1357 * \param [in] gport GPORT identifier. 1358 * \param [in] cosq COS queue number. 1359 * \param [out] min_quantum kbps or packet/second. 1360 * \param [out] max_quantum kbps or packet/second. 1361 * \param [in] burst_size_auto Enables automatic calculation of burst size. 1362 * \param [out] kbits_burst_min Configured size of minimum burst traffic. 1363 * \param [out] kbits_burst_max Configured size of maximum burst traffic. 1364 * \param [out] flags flags. 1365 * 1366 * \retval SHR_E_NONE No errors. 1367 * \retval !SHR_E_NONE Failure. 1368 */ 1369 extern int 1370 mbcm_ltsw_cosq_bucket_get( 1371 int unit, 1372 bcm_gport_t gport, 1373 bcm_cos_queue_t cosq, 1374 uint32_t *min_quantum, 1375 uint32_t *max_quantum, 1376 bool burst_size_auto, 1377 uint32_t *kbits_burst_min, 1378 uint32_t *kbits_burst_max, 1379 uint32_t *flags); 1380 1381 /*! 1382 * \brief Clear cosq configuration of port 1383 * 1384 * \param [in] unit Unit Number. 1385 * \param [in] port Port Number. 1386 * 1387 * \retval SHR_E_NONE No errors. 1388 * \retval !SHR_E_NONE Failure. 1389 */ 1390 extern int 1391 mbcm_ltsw_cosq_port_detach( 1392 int unit, 1393 bcm_port_t port); 1394 1395 /*! 1396 * \brief Initialize Cosq for newly added port 1397 * 1398 * \param [in] unit Unit Number. 1399 * \param [in] port Port Number. 1400 * 1401 * \retval SHR_E_NONE No errors. 1402 * \retval !SHR_E_NONE Failure. 1403 */ 1404 extern int 1405 mbcm_ltsw_cosq_port_attach( 1406 int unit, 1407 bcm_port_t port); 1408 1409 /*! 1410 * \brief Enable to use multicast COS from mirroring. 1411 * 1412 * \param [in] unit Unit Number. 1413 * \param [in] enable Enable 1414 * 1415 * \retval SHR_E_NONE No errors. 1416 * \retval !SHR_E_NONE Failure. 1417 */ 1418 extern int 1419 mbcm_ltsw_cosq_mc_cos_mirror_set( 1420 int unit, 1421 int enable); 1422 1423 /*! 1424 * \brief Enable to use multicast COS from mirroring. 1425 * 1426 * \param [in] unit Unit Number. 1427 * \param [out] enable Enable status 1428 * 1429 * \retval SHR_E_NONE No errors. 1430 * \retval !SHR_E_NONE Failure. 1431 */ 1432 extern int 1433 mbcm_ltsw_cosq_mc_cos_mirror_get( 1434 int unit, 1435 int *enable); 1436 1437 /*! 1438 * \brief Get the number of child nodes and child node gport array for scheduler gport 1439 * 1440 * \param [in] unit Unit Number. 1441 * \param [in] sched_gport GPORT identifier. 1442 * \param [out] num_uc_child number of uc child 1443 * \param [out] uc_queue uc queue array 1444 * \param [out] num_mc_child number of mc child 1445 * \param [out] mc_queue mc queue array 1446 * 1447 * \retval SHR_E_NONE No errors. 1448 * \retval !SHR_E_NONE Failure. 1449 */ 1450 extern int 1451 mbcm_ltsw_cosq_sched_node_child_get( 1452 int unit, 1453 bcm_gport_t sched_gport, 1454 int *num_uc_child, 1455 int *uc_queue, 1456 int *num_mc_child, 1457 int *mc_queue); 1458 1459 /*! 1460 * \brief Get a cosq gport structure 1461 * 1462 * \param [in] unit Unit Number. 1463 * \param [in] gport GPORT identifier. 1464 * \param [out] port port number. 1465 * \param [out] numq number of COS queues 1466 * \param [out] flags flags (BCM_COSQ_GPORT_XXX) 1467 * 1468 * \retval SHR_E_NONE No errors. 1469 * \retval !SHR_E_NONE Failure. 1470 */ 1471 extern int 1472 mbcm_ltsw_cosq_gport_get( 1473 int unit, 1474 bcm_gport_t gport, 1475 bcm_gport_t *port, 1476 int *numq, 1477 uint32_t *flags); 1478 1479 /*! 1480 * \brief Get the child node GPORT atatched to N-th index (cosq) 1481 * 1482 * \param [in] unit Unit Number. 1483 * \param [in] in_gport Scheduler GPORT ID. 1484 * \param [in] cosq COS queue attached to 1485 * \param [out] out_gport child GPORT ID 1486 * 1487 * \retval SHR_E_NONE No errors. 1488 * \retval !SHR_E_NONE Failure. 1489 */ 1490 extern int 1491 mbcm_ltsw_cosq_gport_child_get( 1492 int unit, 1493 bcm_gport_t in_gport, 1494 bcm_cos_queue_t cosq, 1495 bcm_gport_t *out_gport); 1496 1497 /*! 1498 * \brief Attach sched_port to the specified index (cosq) of input_port. 1499 * 1500 * \param [in] unit Unit Number. 1501 * \param [in] input_gport GPORT id, that will attach to parent gport. 1502 * \param [in] parent_gport Parent Gport to which current gport will be attached 1503 * \param [in] cosq COS queue attached to 1504 * 1505 * \retval SHR_E_NONE No errors. 1506 * \retval !SHR_E_NONE Failure. 1507 */ 1508 extern int 1509 mbcm_ltsw_cosq_gport_attach( 1510 int unit, 1511 bcm_gport_t input_gport, 1512 bcm_gport_t parent_gport, 1513 bcm_cos_queue_t cosq); 1514 1515 /*! 1516 * \brief Attach sched_port to the specified index (cosq) of input_port. 1517 * 1518 * \param [in] unit Unit Number. 1519 * \param [in] input_gport GPORT id, that will attach to parent gport. 1520 * \param [in] parent_gport Parent Gport to which current gport will be detached 1521 * \param [in] cosq COS queue detached from 1522 * 1523 * \retval SHR_E_NONE No errors. 1524 * \retval !SHR_E_NONE Failure. 1525 */ 1526 extern int 1527 mbcm_ltsw_cosq_gport_detach( 1528 int unit, 1529 bcm_gport_t input_gport, 1530 bcm_gport_t parent_gport, 1531 bcm_cos_queue_t cosq); 1532 1533 /*! 1534 * \brief Get attached status of a scheduler port. 1535 * 1536 * \param [in] unit Unit Number. 1537 * \param [in] sched_gport scheduler GPORT identifier. 1538 * \param [out] input_gport GPORT to attach to 1539 * \param [out] cosq COS queue attached to 1540 * 1541 * \retval SHR_E_NONE No errors. 1542 * \retval !SHR_E_NONE Failure. 1543 */ 1544 extern int 1545 mbcm_ltsw_cosq_gport_attach_get( 1546 int unit, 1547 bcm_gport_t sched_gport, 1548 bcm_gport_t *input_gport, 1549 bcm_cos_queue_t *cosq); 1550 1551 /*! 1552 * \brief Walks through the valid COSQ GPORTs and calls the user supplied callback function for each entry. 1553 * 1554 * \param [in] unit Unit Number. 1555 * \param [in] cb Callback function. 1556 * \param [out] user_data User data to be passed to callback function 1557 * 1558 * \retval SHR_E_NONE No errors. 1559 * \retval !SHR_E_NONE Failure. 1560 */ 1561 extern int 1562 mbcm_ltsw_cosq_gport_traverse( 1563 int unit, 1564 bcm_cosq_gport_traverse_cb cb, 1565 void *user_data); 1566 1567 /*! 1568 * \brief Retrieve maximum weights for given COS policy. 1569 * 1570 * \param [in] unit Unit Number. 1571 * \param [in] mode Scheduling mode, one of BCM_COSQ_xxx. 1572 * \param [out] weight_max Maximum weight for COS queue 1573 * 1574 * \retval SHR_E_NONE No errors. 1575 * \retval !SHR_E_NONE Failure. 1576 */ 1577 extern int 1578 mbcm_ltsw_cosq_sched_weight_max_get( 1579 int unit, 1580 int mode, 1581 int *weight_max); 1582 1583 /*! 1584 * \brief Cosq schedq mapping set 1585 * 1586 * \param [in] unit Unit Number. 1587 * \param [in] profile_index Profile index. 1588 * \param [in] size Array size. 1589 * \param [in] cosq_mapping_arr Cosq to queue mapping for scheduler. 1590 * 1591 * \retval SHR_E_NONE No errors. 1592 * \retval !SHR_E_NONE Failure. 1593 */ 1594 extern int 1595 mbcm_ltsw_cosq_schedq_mapping_set( 1596 int unit, 1597 int profile_index, 1598 int size, 1599 bcm_cosq_mapping_t *cosq_mapping_arr); 1600 1601 /*! 1602 * \brief cosq schedq mapping get 1603 * 1604 * \param [in] unit Unit Number. 1605 * \param [in] profile_index Profile index. 1606 * \param [in] array_max Max size. 1607 * \param [out] cosq_mapping_arr Cosq to queue mapping for scheduler. 1608 * \param [out] size Array size. 1609 * 1610 * \retval SHR_E_NONE No errors. 1611 * \retval !SHR_E_NONE Failure. 1612 */ 1613 extern int 1614 mbcm_ltsw_cosq_schedq_mapping_get( 1615 int unit, 1616 int profile_index, 1617 int array_max, 1618 bcm_cosq_mapping_t *cosq_mapping_arr, 1619 int *size); 1620 1621 /*! 1622 * \brief Set Port to Profile Mapping for Cosq profiles 1623 * 1624 * \param [in] unit Unit Number. 1625 * \param [in] port Port Number. 1626 * \param [in] profile_id Profile index. 1627 * 1628 * \retval SHR_E_NONE No errors. 1629 * \retval !SHR_E_NONE Failure. 1630 */ 1631 extern int 1632 mbcm_ltsw_cosq_port_scheduler_profile_set( 1633 int unit, 1634 bcm_port_t port, 1635 int profile_id); 1636 1637 /*! 1638 * \brief Get Port to Profile Mapping for Cosq profiles 1639 * 1640 * \param [in] unit Unit Number. 1641 * \param [in] port Port Number. 1642 * \param [out] profile_id Profile index. 1643 * 1644 * \retval SHR_E_NONE No errors. 1645 * \retval !SHR_E_NONE Failure. 1646 */ 1647 extern int 1648 mbcm_ltsw_cosq_port_scheduler_profile_get( 1649 int unit, 1650 bcm_port_t port, 1651 int *profile_id); 1652 1653 /*! 1654 * \brief Set port node scheduling mode and weight 1655 * 1656 * \param [in] unit Unit Number. 1657 * \param [in] gport Port number or GPORT identifier. 1658 * \param [in] cosq Node id. 1659 * \param [in] mode sched mode. 1660 * \param [in] weight weight. 1661 * 1662 * \retval SHR_E_NONE No errors. 1663 * \retval !SHR_E_NONE Failure. 1664 */ 1665 extern int 1666 mbcm_ltsw_cosq_sched_set( 1667 int unit, 1668 bcm_port_t gport, 1669 bcm_cos_queue_t cosq, 1670 int mode, 1671 int weight); 1672 1673 /*! 1674 * \brief Get port node scheduling mode and weight 1675 * 1676 * \param [in] unit Unit Number. 1677 * \param [in] gport Port number or GPORT identifier. 1678 * \param [in] cosq COS queue number. 1679 * \param [out] mode sched mode. 1680 * \param [out] weight weight. 1681 * 1682 * \retval SHR_E_NONE No errors. 1683 * \retval !SHR_E_NONE Failure. 1684 */ 1685 extern int 1686 mbcm_ltsw_cosq_sched_get( 1687 int unit, 1688 bcm_port_t gport, 1689 bcm_cos_queue_t cosq, 1690 int *mode, 1691 int *weight); 1692 1693 /*! 1694 * \brief Retrieve maximum number for given profile. 1695 * 1696 * \param [in] unit Unit Number. 1697 * \param [in] profile_type Profile type. 1698 * \param [out] max_num Maximum number for profile 1699 * 1700 * \retval SHR_E_NONE No errors. 1701 * \retval !SHR_E_NONE Failure. 1702 */ 1703 extern int 1704 mbcm_ltsw_cosq_cosq_profile_max_num_get( 1705 int unit, 1706 bcm_cosq_profile_type_t profile_type, 1707 int *max_num); 1708 1709 /*! 1710 * \brief Set up class-of-service policy and corresponding weights and mode 1711 * 1712 * \param [in] unit Unit Number. 1713 * \param [in] pbm port bitmap. 1714 * \param [in] mode Scheduling mode. 1715 * \param [in] weight_arr_size Size of the weights array. 1716 * \param [in] weights Weights for each COS queue. 1717 * 1718 * \retval SHR_E_NONE No errors. 1719 * \retval !SHR_E_NONE Failure. 1720 */ 1721 extern int 1722 mbcm_ltsw_cosq_port_sched_config_set( 1723 int unit, 1724 bcm_pbmp_t pbm, 1725 int mode, 1726 int weight_arr_size, 1727 int *weights); 1728 1729 /*! 1730 * \brief Retrieve class-of-service policy and corresponding weights and mode 1731 * 1732 * \param [in] unit Unit Number. 1733 * \param [in] pbm port bitmap. 1734 * \param [in] weight_arr_size Size of the weights array. 1735 * \param [out] weights Weights for each COS queue. 1736 * \param [out] weight_arr_count Actual size of weights array. 1737 * \param [out] mode Scheduling mode. 1738 * 1739 * \retval SHR_E_NONE No errors. 1740 * \retval !SHR_E_NONE Failure. 1741 */ 1742 extern int 1743 mbcm_ltsw_cosq_port_sched_config_get( 1744 int unit, 1745 bcm_pbmp_t pbm, 1746 int weight_arr_size, 1747 int *weights, 1748 int *weight_arr_count, 1749 int *mode); 1750 1751 /*! 1752 * \brief Set the COS queue WRED parameters 1753 * 1754 * \param [in] unit Unit Number. 1755 * \param [in] flags BCM_COSQ_DISCARD_* 1756 * 1757 * \retval SHR_E_NONE No errors. 1758 * \retval !SHR_E_NONE Failure. 1759 */ 1760 extern int 1761 mbcm_ltsw_cosq_discard_set( 1762 int unit, 1763 uint32_t flags); 1764 1765 /*! 1766 * \brief Get the COS queue WRED parameters 1767 * 1768 * \param [in] unit Unit Number. 1769 * \param [out] flags BCM_COSQ_DISCARD_* 1770 * 1771 * \retval SHR_E_NONE No errors. 1772 * \retval !SHR_E_NONE Failure. 1773 */ 1774 extern int 1775 mbcm_ltsw_cosq_discard_get( 1776 int unit, 1777 uint32_t *flags); 1778 1779 /*! 1780 * \brief Set the COS queue WRED parameters 1781 * 1782 * \param [in] unit Unit Number. 1783 * \param [in] gport GPORT ID. 1784 * \param [in] cosq cosq. 1785 * \param [in] discard Discard settings. 1786 * 1787 * \retval SHR_E_NONE No errors. 1788 * \retval !SHR_E_NONE Failure. 1789 */ 1790 extern int 1791 mbcm_ltsw_cosq_gport_discard_set( 1792 int unit, 1793 bcm_gport_t gport, 1794 bcm_cos_queue_t cosq, 1795 bcm_cosq_gport_discard_t *discard); 1796 1797 /*! 1798 * \brief Get the COS queue WRED parameters 1799 * 1800 * \param [in] unit Unit Number. 1801 * \param [in] gport GPORT ID. 1802 * \param [in] cosq cosq. 1803 * \param [out] discard Discard settings. 1804 * 1805 * \retval SHR_E_NONE No errors. 1806 * \retval !SHR_E_NONE Failure. 1807 */ 1808 extern int 1809 mbcm_ltsw_cosq_gport_discard_get( 1810 int unit, 1811 bcm_gport_t gport, 1812 bcm_cos_queue_t cosq, 1813 bcm_cosq_gport_discard_t *discard); 1814 1815 /*! 1816 * \brief Create an empty rule profile 1817 * 1818 * \param [in] unit Unit Number. 1819 * \param [in] profile_id Profile index. 1820 * 1821 * \retval SHR_E_NONE No errors. 1822 * \retval !SHR_E_NONE Failure. 1823 */ 1824 extern int 1825 mbcm_ltsw_cosq_discard_profile_create( 1826 int unit, 1827 int *profile_id); 1828 1829 /*! 1830 * \brief Destroy a rule profile 1831 * 1832 * \param [in] unit Unit Number. 1833 * \param [in] profile_id Profile index. 1834 * 1835 * \retval SHR_E_NONE No errors. 1836 * \retval !SHR_E_NONE Failure. 1837 */ 1838 extern int 1839 mbcm_ltsw_cosq_discard_profile_destroy( 1840 int unit, 1841 int profile_id); 1842 1843 /*! 1844 * \brief Update one rule in a profile 1845 * 1846 * \param [in] unit Unit Number. 1847 * \param [in] profile_id Profile index. 1848 * \param [in] rule discard rule 1849 * 1850 * \retval SHR_E_NONE No errors. 1851 * \retval !SHR_E_NONE Failure. 1852 */ 1853 extern int 1854 mbcm_ltsw_cosq_discard_profile_update( 1855 int unit, 1856 int profile_id, 1857 bcm_cosq_discard_rule_t *rule); 1858 1859 /*! 1860 * \brief Get all rules of a profile 1861 * 1862 * \param [in] unit Unit Number. 1863 * \param [in] profile_id Profile index. 1864 * \param [in] max rule array size. 1865 * \param [out] rule_array rule array. 1866 * \param [out] rule_count actual rules count. 1867 * 1868 * \retval SHR_E_NONE No errors. 1869 * \retval !SHR_E_NONE Failure. 1870 */ 1871 extern int 1872 mbcm_ltsw_cosq_discard_profile_get( 1873 int unit, 1874 int profile_id, 1875 int max, 1876 bcm_cosq_discard_rule_t *rule_array, 1877 int *rule_count); 1878 1879 /*! 1880 * \brief Set COS queue for the specified priority of an ingress port 1881 * 1882 * \param [in] unit Unit Number. 1883 * \param [in] local_port local port 1884 * \param [in] priority priority value to map 1885 * \param [in] flags BCM_COSQ_GPORT_XXX_QUEUE_GROUP 1886 * \param [in] gport queue group GPORT identifier 1887 * \param [in] cosq COS queue number 1888 * 1889 * \retval SHR_E_NONE No errors. 1890 * \retval !SHR_E_NONE Failure. 1891 */ 1892 extern int 1893 mbcm_ltsw_cosq_cos_mapping_set( 1894 int unit, 1895 bcm_port_t local_port, 1896 bcm_cos_t priority, 1897 uint32_t flags, 1898 bcm_gport_t gport, 1899 bcm_cos_queue_t cosq); 1900 1901 /*! 1902 * \brief Get COS queue for the specified priority of an ingress port. 1903 * 1904 * \param [in] unit Unit Number. 1905 * \param [in] local_port local port 1906 * \param [in] priority priority value to map 1907 * \param [in] flags BCM_COSQ_GPORT_XXX_QUEUE_GROUP 1908 * \param [out] gport queue group GPORT identifier 1909 * \param [out] cosq COS queue number 1910 * 1911 * \retval SHR_E_NONE No errors. 1912 * \retval !SHR_E_NONE Failure. 1913 */ 1914 extern int 1915 mbcm_ltsw_cosq_cos_mapping_get( 1916 int unit, 1917 bcm_port_t local_port, 1918 bcm_cos_t priority, 1919 uint32_t flags, 1920 bcm_gport_t *gport, 1921 bcm_cos_queue_t *cosq); 1922 1923 /*! 1924 * \brief Get shaper configure from LT TM_SHAPER_CONFIG 1925 * 1926 * \param [in] unit Unit Number. 1927 * \param [out] refresh_time Refresh time. 1928 * \param [out] itu_mode itu mode enable. 1929 * \param [out] shaper Shaper enable. 1930 * 1931 * \retval SHR_E_NONE No errors. 1932 * \retval !SHR_E_NONE Failure. 1933 */ 1934 extern int 1935 mbcm_ltsw_cosq_shaper_config_get( 1936 int unit, 1937 int *refresh_time, 1938 int *itu_mode, 1939 int *shaper); 1940 1941 /*! 1942 * \brief Create a cosq classifier. 1943 * 1944 * \param [in] unit Unit Number. 1945 * \param [out] classifier_id Classifier ID. 1946 * 1947 * \retval SHR_E_NONE No errors. 1948 * \retval !SHR_E_NONE Failure. 1949 */ 1950 extern int 1951 mbcm_ltsw_cosq_field_classifier_id_create( 1952 int unit, 1953 int *classifier_id); 1954 1955 /*! 1956 * \brief Free resource associated with this field classifier id. 1957 * 1958 * \param [in] unit Unit Number. 1959 * \param [in] classifier_id Classifier ID. 1960 * 1961 * \retval SHR_E_NONE No errors. 1962 * \retval !SHR_E_NONE Failure. 1963 */ 1964 extern int 1965 mbcm_ltsw_cosq_field_classifier_id_destroy( 1966 int unit, 1967 int classifier_id); 1968 1969 /*! 1970 * \brief Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. 1971 * 1972 * \param [in] unit Unit Number. 1973 * \param [in] classifier_id Classifier ID. 1974 * \param [in] count Number of elements in priority_array and cosq_array. 1975 * \param [in] priority_array Array of internal priorities. 1976 * \param [in] cosq_array Array of COS queues. 1977 * 1978 * \retval SHR_E_NONE No errors. 1979 * \retval !SHR_E_NONE Failure. 1980 */ 1981 extern int 1982 mbcm_ltsw_cosq_field_classifier_map_set( 1983 int unit, 1984 int classifier_id, 1985 int count, 1986 bcm_cos_t *priority_array, 1987 bcm_cos_queue_t *cosq_array); 1988 1989 /*! 1990 * \brief Get internal priority to ingress field processor CoS queue override mapping information. 1991 * 1992 * \param [in] unit Unit Number. 1993 * \param [in] classifier_id Classifier ID. 1994 * \param [in] array_max Size of priority_array and cosq_array. 1995 * \param [in] priority_array Array of internal priorities. 1996 * \param [out] cosq_array Array of COS queues. 1997 * \param [out] array_count Size of cosq_array. 1998 * 1999 * \retval SHR_E_NONE No errors. 2000 * \retval !SHR_E_NONE Failure. 2001 */ 2002 extern int 2003 mbcm_ltsw_cosq_field_classifier_map_get( 2004 int unit, 2005 int classifier_id, 2006 int array_max, 2007 bcm_cos_t *priority_array, 2008 bcm_cos_queue_t *cosq_array, 2009 int *array_count); 2010 2011 /*! 2012 * \brief Delete an internal priority to ingress field processor CoS queue override mapping profile set. 2013 * 2014 * \param [in] unit Unit Number. 2015 * \param [in] classifier_id Classifier ID. 2016 * 2017 * \retval SHR_E_NONE No errors. 2018 * \retval !SHR_E_NONE Failure. 2019 */ 2020 extern int 2021 mbcm_ltsw_cosq_field_classifier_map_clear( 2022 int unit, 2023 int classifier_id); 2024 2025 /*! 2026 * \brief Create a cosq classifier. 2027 * 2028 * \param [in] unit Unit Number. 2029 * \param [out] classifier_id Classifier ID. 2030 * 2031 * \retval SHR_E_NONE No errors. 2032 * \retval !SHR_E_NONE Failure. 2033 */ 2034 extern int 2035 mbcm_ltsw_cosq_field_hi_classifier_id_create( 2036 int unit, 2037 int *classifier_id); 2038 2039 /*! 2040 * \brief Free resource associated with this field classifier id. 2041 * 2042 * \param [in] unit Unit Number. 2043 * \param [in] classifier_id Classifier ID. 2044 * 2045 * \retval SHR_E_NONE No errors. 2046 * \retval !SHR_E_NONE Failure. 2047 */ 2048 extern int 2049 mbcm_ltsw_cosq_field_hi_classifier_id_destroy( 2050 int unit, 2051 int classifier_id); 2052 2053 /*! 2054 * \brief Set the mapping from port, classifier, and multiple internal priorities to multiple COS queues in a queue group. 2055 * 2056 * \param [in] unit Unit Number. 2057 * \param [in] classifier_id Classifier ID. 2058 * \param [in] count Number of elements in priority_array and cosq_array. 2059 * \param [in] priority_array Array of internal priorities. 2060 * \param [in] cosq_array Array of COS queues. 2061 * 2062 * \retval SHR_E_NONE No errors. 2063 * \retval !SHR_E_NONE Failure. 2064 */ 2065 extern int 2066 mbcm_ltsw_cosq_field_hi_classifier_map_set( 2067 int unit, 2068 int classifier_id, 2069 int count, 2070 bcm_cos_t *priority_array, 2071 bcm_cos_queue_t *cosq_array); 2072 2073 /*! 2074 * \brief Get internal priority to ingress field processor CoS queue override mapping information. 2075 * 2076 * \param [in] unit Unit Number. 2077 * \param [in] classifier_id Classifier ID. 2078 * \param [in] array_max Size of priority_array and cosq_array. 2079 * \param [in] priority_array Array of internal priorities. 2080 * \param [out] cosq_array Array of COS queues. 2081 * \param [out] array_count Size of cosq_array. 2082 * 2083 * \retval SHR_E_NONE No errors. 2084 * \retval !SHR_E_NONE Failure. 2085 */ 2086 extern int 2087 mbcm_ltsw_cosq_field_hi_classifier_map_get( 2088 int unit, 2089 int classifier_id, 2090 int array_max, 2091 bcm_cos_t *priority_array, 2092 bcm_cos_queue_t *cosq_array, 2093 int *array_count); 2094 2095 /*! 2096 * \brief Delete an internal priority to ingress field processor CoS queue override mapping profile set. 2097 * 2098 * \param [in] unit Unit Number. 2099 * \param [in] classifier_id Classifier ID. 2100 * 2101 * \retval SHR_E_NONE No errors. 2102 * \retval !SHR_E_NONE Failure. 2103 */ 2104 extern int 2105 mbcm_ltsw_cosq_field_hi_classifier_map_clear( 2106 int unit, 2107 int classifier_id); 2108 2109 /*! 2110 * \brief Retrieve number UC&MC queue according to multcast queue mode. 2111 * 2112 * \param [in] unit Unit Number. 2113 * \param [out] num_ucq unicast queue number. 2114 * \param [out] num_mcq multcast queue number. 2115 * 2116 * \retval SHR_E_NONE No errors. 2117 * \retval !SHR_E_NONE Failure. 2118 */ 2119 extern int 2120 mbcm_ltsw_cosq_num_queue_get( 2121 int unit, 2122 int *num_ucq, 2123 int *num_mcq); 2124 2125 /*! 2126 * \brief Get port map information 2127 * 2128 * \param [in] unit Unit Number. 2129 * \param [in] port Port Number. 2130 * \param [out] info port map information. 2131 * 2132 * \retval SHR_E_NONE No errors. 2133 * \retval !SHR_E_NONE Failure. 2134 */ 2135 extern int 2136 mbcm_ltsw_cosq_port_map_info_get( 2137 int unit, 2138 bcm_port_t port, 2139 bcmi_ltsw_cosq_port_map_info_t *info); 2140 2141 /*! 2142 * \brief Get device specific TM information 2143 * 2144 * \param [in] unit Unit Number. 2145 * \param [out] info Device specific TM information. 2146 * 2147 * \retval SHR_E_NONE No errors. 2148 * \retval !SHR_E_NONE Failure. 2149 */ 2150 extern int 2151 mbcm_ltsw_cosq_device_info_get( 2152 int unit, 2153 bcmi_ltsw_cosq_device_info_t *info); 2154 2155 /*! 2156 * \brief Set cut-through mode for a specific port 2157 * 2158 * \param [in] unit Unit Number. 2159 * \param [in] port Port Number. 2160 * \param [in] enable Enable to use cut-through mode. 2161 * 2162 * \retval SHR_E_NONE No errors. 2163 * \retval !SHR_E_NONE Failure. 2164 */ 2165 extern int 2166 mbcm_ltsw_cosq_port_ct_mode_set( 2167 int unit, 2168 bcm_port_t port, 2169 int enable); 2170 2171 /*! 2172 * \brief Get cut-through mode for a specific port 2173 * 2174 * \param [in] unit Unit Number. 2175 * \param [in] port Port Number. 2176 * \param [out] enable Enable to use cut-through mode. 2177 * 2178 * \retval SHR_E_NONE No errors. 2179 * \retval !SHR_E_NONE Failure. 2180 */ 2181 extern int 2182 mbcm_ltsw_cosq_port_ct_mode_get( 2183 int unit, 2184 bcm_port_t port, 2185 int *enable); 2186 2187 /*! 2188 * \brief Dump per-port asf configurations to diag Shell 2189 * 2190 * \param [in] unit Unit Number. 2191 * \param [in] port Port Number. 2192 * \param [in] port_speed Port speed in MB/s. 2193 * 2194 * \retval SHR_E_NONE No errors. 2195 * \retval !SHR_E_NONE Failure. 2196 */ 2197 extern int 2198 mbcm_ltsw_cosq_port_asf_config_dump( 2199 int unit, 2200 bcm_port_t port, 2201 int port_speed); 2202 2203 /*! 2204 * \brief Print per-port traffic forwarding mode in diag Shell 2205 * 2206 * \param [in] unit Unit Number. 2207 * \param [in] port Port Number. 2208 * \param [in] port_speed Port speed in MB/s. 2209 * 2210 * \retval SHR_E_NONE No errors. 2211 * \retval !SHR_E_NONE Failure. 2212 */ 2213 extern int 2214 mbcm_ltsw_cosq_port_asf_config_show( 2215 int unit, 2216 bcm_port_t port, 2217 int port_speed); 2218 2219 /*! 2220 * \brief Get the associated rx channel with a given cosq 2221 * 2222 * \param [in] unit Unit Number. 2223 * \param [in] queue_id input queue id 2224 * \param [in] chan_id channel index 2225 * \param [out] enable enable state 2226 * 2227 * \retval SHR_E_NONE No errors. 2228 * \retval !SHR_E_NONE Failure. 2229 */ 2230 extern int 2231 mbcm_ltsw_cosq_rx_queue_channel_get( 2232 int unit, 2233 bcm_cos_queue_t queue_id, 2234 bcm_rx_chan_t chan_id, 2235 bool *enable); 2236 2237 /*! 2238 * \brief Assign a RX channel to a cosq 2239 * 2240 * \param [in] unit Unit Number. 2241 * \param [in] queue_id input queue id 2242 * \param [in] chan_id channel index 2243 * \param [in] enable enable state 2244 * 2245 * \retval SHR_E_NONE No errors. 2246 * \retval !SHR_E_NONE Failure. 2247 */ 2248 extern int 2249 mbcm_ltsw_cosq_rx_queue_channel_set( 2250 int unit, 2251 bcm_cos_queue_t queue_id, 2252 bcm_rx_chan_t chan_id, 2253 bool enable); 2254 2255 /*! 2256 * \brief Tests whether the corresponding COS_BMP bit is set or not 2257 * 2258 * \param [in] unit Unit Number. 2259 * \param [in] queue_id input queue id 2260 * \param [in] chan_id channel index 2261 * 2262 * \retval SHR_E_NONE No errors. 2263 * \retval !SHR_E_NONE Failure. 2264 */ 2265 extern int 2266 mbcm_ltsw_cosq_rx_queue_channel_set_test( 2267 int unit, 2268 bcm_cos_queue_t queue_id, 2269 bcm_rx_chan_t chan_id); 2270 2271 /*! 2272 * \brief Walks through the valid COSQ GPORTs belong to a port and calls the user supplied callback function for each entry. 2273 * 2274 * \param [in] unit Unit Number. 2275 * \param [in] port GPORT identifier. 2276 * \param [in] cb Callback function. 2277 * \param [out] user_data User data to be passed to callback function 2278 * 2279 * \retval SHR_E_NONE No errors. 2280 * \retval !SHR_E_NONE Failure. 2281 */ 2282 extern int 2283 mbcm_ltsw_cosq_gport_traverse_by_port( 2284 int unit, 2285 bcm_gport_t port, 2286 bcm_cosq_gport_traverse_cb cb, 2287 void *user_data); 2288 2289 #endif /* BCMINT_LTSW_MBCM_COSQ_H */