cosq_thd.h (29839B)
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_THD_H 12 #define BCMINT_LTSW_MBCM_COSQ_THD_H 13 14 #include <bcm/cosq.h> 15 #include <bcm/types.h> 16 17 #include <sal/sal_types.h> 18 19 /*! 20 * \brief Initialize the cosq_thd module. 21 * 22 * \param [in] unit Unit Number. 23 * 24 * \retval SHR_E_NONE No errors. 25 * \retval !SHR_E_NONE Failure. 26 */ 27 typedef int (*cosq_thd_init_f)(int unit); 28 29 /*! 30 * \brief Detach the cosq_thd module. 31 * 32 * \param [in] unit Unit Number. 33 * 34 * \retval SHR_E_NONE No errors. 35 * \retval !SHR_E_NONE Failure. 36 */ 37 typedef int (*cosq_thd_detach_f)(int unit); 38 39 /*! 40 * \brief Check if a cosq_control_type property can be changed dynamically 41 * 42 * \param [in] unit Unit Number. 43 * \param [in] type Type of operation. 44 * \param [in] dynamic Returns if type can be changed dynamically. 45 * 46 * \retval SHR_E_NONE No errors. 47 * \retval !SHR_E_NONE Failure. 48 */ 49 typedef int (*cosq_thd_dynamic_get_f)( 50 int unit, 51 bcm_cosq_control_t type, 52 bcm_cosq_dynamic_setting_type_t *dynamic); 53 54 /*! 55 * \brief Reset the guarantee of priority group, uc queue, mc queue to the default. 56 * 57 * \param [in] unit Unit Number. 58 * \param [in] port Port Number. 59 * 60 * \retval SHR_E_NONE No errors. 61 * \retval !SHR_E_NONE Failure. 62 */ 63 typedef int (*cosq_thd_port_guarantee_reset_f)( 64 int unit, 65 bcm_port_t port); 66 67 /*! 68 * \brief Set specified feature configuration 69 * 70 * \param [in] unit Unit Number. 71 * \param [in] gport Gport Number. 72 * \param [in] cosq COS queue. 73 * \param [in] buffer buffer id. 74 * \param [in] type Feature. 75 * \param [in] arg Feature value. 76 * 77 * \retval SHR_E_NONE No errors. 78 * \retval !SHR_E_NONE Failure. 79 */ 80 typedef int (*cosq_thd_control_set_f)( 81 int unit, 82 bcm_gport_t gport, 83 bcm_cos_queue_t cosq, 84 bcm_cosq_buffer_id_t buffer, 85 bcm_cosq_control_t type, 86 int arg); 87 88 /*! 89 * \brief Get specified feature configuration 90 * 91 * \param [in] unit Unit Number. 92 * \param [in] gport Gport Number. 93 * \param [in] cosq COS queue. 94 * \param [in] buffer Buffer id. 95 * \param [in] type Feature. 96 * \param [out] arg Feature value. 97 * 98 * \retval SHR_E_NONE No errors. 99 * \retval !SHR_E_NONE Failure. 100 */ 101 typedef int (*cosq_thd_control_get_f)( 102 int unit, 103 bcm_gport_t gport, 104 bcm_cos_queue_t cosq, 105 bcm_cosq_buffer_id_t buffer, 106 bcm_cosq_control_t type, 107 int *arg); 108 109 /*! 110 * \brief Port UC service pool id get. 111 * 112 * \param [in] unit Unit Number. 113 * \param [in] port Port Number. 114 * \param [in] queue queue id. 115 * \param [out] spid pool id. 116 * \param [out] use_qgroup_min true/false. 117 * 118 * \retval SHR_E_NONE No errors. 119 * \retval !SHR_E_NONE Failure. 120 */ 121 typedef int (*cosq_thd_port_uc_spid_get_f)( 122 int unit, 123 bcm_port_t port, 124 int queue, 125 int *spid, 126 int *use_qgroup_min); 127 128 /*! 129 * \brief TM db shared limit get. 130 * 131 * \param [in] unit Unit Number. 132 * \param [in] itm itm. 133 * \param [in] spid ing service pool id. 134 * \param [out] shared_limit shared limit value. 135 * 136 * \retval SHR_E_NONE No errors. 137 * \retval !SHR_E_NONE Failure. 138 */ 139 typedef int (*cosq_thd_shared_limit_get_f)( 140 int unit, 141 int itm, 142 int spid, 143 int *shared_limit); 144 145 /*! 146 * \brief Set the profile for Input priortty to PG mapping for a port. 147 * 148 * \param [in] unit Unit Number. 149 * \param [in] port Port Number. 150 * \param [in] profile_id Profile index. 151 * 152 * \retval SHR_E_NONE No errors. 153 * \retval !SHR_E_NONE Failure. 154 */ 155 typedef int (*cosq_thd_port_inppri_profile_set_f)( 156 int unit, 157 bcm_port_t port, 158 int profile_id); 159 160 /*! 161 * \brief Get the profile for Input priortty to PG mapping for a port. 162 * 163 * \param [in] unit Unit Number. 164 * \param [in] port Port Number. 165 * \param [out] profile_id Profile index. 166 * 167 * \retval SHR_E_NONE No errors. 168 * \retval !SHR_E_NONE Failure. 169 */ 170 typedef int (*cosq_thd_port_inppri_profile_get_f)( 171 int unit, 172 bcm_port_t port, 173 int *profile_id); 174 175 /*! 176 * \brief Set the profile for PG to SPID/HPID/PFCPRI mapping for a port. 177 * 178 * \param [in] unit Unit Number. 179 * \param [in] port Port Number. 180 * \param [in] profile_id Profile index. 181 * 182 * \retval SHR_E_NONE No errors. 183 * \retval !SHR_E_NONE Failure. 184 */ 185 typedef int (*cosq_thd_port_pg_profile_set_f)( 186 int unit, 187 bcm_port_t port, 188 int profile_id); 189 190 /*! 191 * \brief Get the profile for PG to SPID/HPID/PFCPRI mapping for a port. 192 * 193 * \param [in] unit Unit Number. 194 * \param [in] port Port Number. 195 * \param [out] profile_id Profile index. 196 * 197 * \retval SHR_E_NONE No errors. 198 * \retval !SHR_E_NONE Failure. 199 */ 200 typedef int (*cosq_thd_port_pg_profile_get_f)( 201 int unit, 202 bcm_port_t port, 203 int *profile_id); 204 205 /*! 206 * \brief To Set enable or disable status of service pool for a given pool id. 207 * 208 * \param [in] unit Unit Number. 209 * \param [in] id Service pool id. 210 * \param [in] cosq_service_pool Enable/Disable given type service pool. 211 * 212 * \retval SHR_E_NONE No errors. 213 * \retval !SHR_E_NONE Failure. 214 */ 215 typedef int (*cosq_thd_service_pool_set_f)( 216 int unit, 217 bcm_service_pool_id_t id, 218 bcm_cosq_service_pool_t cosq_service_pool); 219 220 /*! 221 * \brief To get enable or disable status of service pool for a given pool id. 222 * 223 * \param [in] unit Unit Number. 224 * \param [in] id Service pool id. 225 * \param [out] cosq_service_pool Get enable or disable status. 226 * 227 * \retval SHR_E_NONE No errors. 228 * \retval !SHR_E_NONE Failure. 229 */ 230 typedef int (*cosq_thd_service_pool_get_f)( 231 int unit, 232 bcm_service_pool_id_t id, 233 bcm_cosq_service_pool_t *cosq_service_pool); 234 235 /*! 236 * \brief Enable or disable service pool override. 237 * 238 * \param [in] unit Unit Number. 239 * \param [in] type Service pool override type. 240 * \param [in] service_pool Service pool id. 241 * \param [in] enable Enable or disable service pool override. 242 * 243 * \retval SHR_E_NONE No errors. 244 * \retval !SHR_E_NONE Failure. 245 */ 246 typedef int (*cosq_thd_service_pool_override_set_f)( 247 int unit, 248 bcm_cosq_service_pool_override_type_t type, 249 bcm_service_pool_id_t service_pool, 250 int enable); 251 252 /*! 253 * \brief Enable or disable service pool override. 254 * 255 * \param [in] unit Unit Number. 256 * \param [in] type Service pool override type. 257 * \param [out] service_pool Service pool id. 258 * \param [out] enable Enable or disable service pool override. 259 * 260 * \retval SHR_E_NONE No errors. 261 * \retval !SHR_E_NONE Failure. 262 */ 263 typedef int (*cosq_thd_service_pool_override_get_f)( 264 int unit, 265 bcm_cosq_service_pool_override_type_t type, 266 bcm_service_pool_id_t *service_pool, 267 int *enable); 268 269 /*! 270 * \brief Set a profile for the various mappings. 271 * 272 * \param [in] unit Unit Number. 273 * \param [in] profile_index profile index. 274 * \param [in] type Mapping type. 275 * \param [in] array_count Number of mappings in array. 276 * \param [in] arg Value of input to mapping type. 277 * 278 * \retval SHR_E_NONE No errors. 279 * \retval !SHR_E_NONE Failure. 280 */ 281 typedef int (*cosq_thd_priority_group_mapping_profile_set_f)( 282 int unit, 283 int profile_index, 284 bcm_cosq_priority_group_mapping_profile_type_t type, 285 int array_count, 286 int *arg); 287 288 /*! 289 * \brief Get a profile for the various mappings. 290 * 291 * \param [in] unit Unit Number. 292 * \param [in] profile_index profile index. 293 * \param [in] type Mapping type. 294 * \param [in] array_max Number of mappings allocated in array. 295 * \param [out] arg Array of input to mapping type. 296 * \param [out] array_count Number of mappings returned. 297 * 298 * \retval SHR_E_NONE No errors. 299 * \retval !SHR_E_NONE Failure. 300 */ 301 typedef int (*cosq_thd_priority_group_mapping_profile_get_f)( 302 int unit, 303 int profile_index, 304 bcm_cosq_priority_group_mapping_profile_type_t type, 305 int array_max, 306 int *arg, 307 int *array_count); 308 309 /*! 310 * \brief Setup per port per priority group properties. 311 * 312 * \param [in] unit Unit Number. 313 * \param [in] port Port Number. 314 * \param [in] priority_group_id priority group. 315 * \param [in] type Port/priority group property. 316 * \param [in] arg set value of property. 317 * 318 * \retval SHR_E_NONE No errors. 319 * \retval !SHR_E_NONE Failure. 320 */ 321 typedef int (*cosq_thd_port_priority_group_property_set_f)( 322 int unit, 323 bcm_port_t port, 324 int priority_group_id, 325 bcm_cosq_port_prigroup_control_t type, 326 int arg); 327 328 /*! 329 * \brief Setup per port per priority group properties. 330 * 331 * \param [in] unit Unit Number. 332 * \param [in] port Port Number. 333 * \param [in] priority_group_id priority group. 334 * \param [in] type Port/priority group property. 335 * \param [out] arg set value of property. 336 * 337 * \retval SHR_E_NONE No errors. 338 * \retval !SHR_E_NONE Failure. 339 */ 340 typedef int (*cosq_thd_port_priority_group_property_get_f)( 341 int unit, 342 bcm_port_t port, 343 int priority_group_id, 344 bcm_cosq_port_prigroup_control_t type, 345 int *arg); 346 347 /*! 348 * \brief Get mutliple buffer ids associated with a specified port. 349 * 350 * \param [in] unit Unit Number. 351 * \param [in] gport Gport Number. 352 * \param [in] cosq Reserved field. 353 * \param [in] direction Specify ingress or egress direction. 354 * \param [in] array_max number of entries to be retrieved. 355 * \param [out] buf_id_array Buffer id array. 356 * \param [out] array_count Actural buffer id count in buf_id_array. 357 * 358 * \retval SHR_E_NONE No errors. 359 * \retval !SHR_E_NONE Failure. 360 */ 361 typedef int (*cosq_thd_buffer_id_multi_get_f)( 362 int unit, 363 bcm_gport_t gport, 364 bcm_cos_queue_t cosq, 365 bcm_cosq_dir_t direction, 366 int array_max, 367 bcm_cosq_buffer_id_t *buf_id_array, 368 int *array_count); 369 370 /*! 371 * \brief To enable/disable Rx of packets on the specified CPU cosq. 372 * 373 * \param [in] unit Unit Number. 374 * \param [in] cosq CPU Cosq ID. 375 * \param [in] enable Enable/Disable. 376 * 377 * \retval SHR_E_NONE No errors. 378 * \retval !SHR_E_NONE Failure. 379 */ 380 typedef int (*cosq_thd_cpu_cosq_enable_set_f)( 381 int unit, 382 bcm_cos_queue_t cosq, 383 int enable); 384 385 /*! 386 * \brief To get enable/disable status on Rx of packets on the specified CPU cosq. 387 * 388 * \param [in] unit Unit Number. 389 * \param [in] cosq CPU Cosq ID. 390 * \param [out] enable Enable/Disable. 391 * 392 * \retval SHR_E_NONE No errors. 393 * \retval !SHR_E_NONE Failure. 394 */ 395 typedef int (*cosq_thd_cpu_cosq_enable_get_f)( 396 int unit, 397 bcm_cos_queue_t cosq, 398 int *enable); 399 400 /*! 401 * \brief Convert BCM enum alpha value to LT enum value. 402 * 403 * \param [in] unit Unit Number. 404 * \param [in] arg BCM Alpha value. 405 * \param [out] alpha LT Alpha value. 406 * 407 * \retval SHR_E_NONE No errors. 408 * \retval !SHR_E_NONE Failure. 409 */ 410 typedef int (*cosq_thd_alpha_bcm_to_lt_convert_f)( 411 int unit, 412 int arg, 413 const char **alpha); 414 415 /*! 416 * \brief Convert LT enum alpha value to BCM enum value. 417 * 418 * \param [in] unit Unit Number. 419 * \param [in] alpha LT Alpha value. 420 * \param [out] arg BCM Alpha value. 421 * 422 * \retval SHR_E_NONE No errors. 423 * \retval !SHR_E_NONE Failure. 424 */ 425 typedef int (*cosq_thd_alpha_lt_to_bcm_convert_f)( 426 int unit, 427 const char *alpha, 428 int *arg); 429 430 /*! 431 * \brief Convert byte to cell. 432 * 433 * \param [in] unit Unit Number. 434 * \param [in] bytes bytes. 435 * \param [out] cells cells. 436 * 437 * \retval SHR_E_NONE No errors. 438 * \retval !SHR_E_NONE Failure. 439 */ 440 typedef int (*cosq_thd_byte_to_cell_f)( 441 int unit, 442 uint32_t bytes, 443 int *cells); 444 445 /*! 446 * \brief Convert cell to byte. 447 * 448 * \param [in] unit Unit Number. 449 * \param [in] cells cells. 450 * \param [out] bytes bytes. 451 * 452 * \retval SHR_E_NONE No errors. 453 * \retval !SHR_E_NONE Failure. 454 */ 455 typedef int (*cosq_thd_cell_to_byte_f)( 456 int unit, 457 uint32_t cells, 458 int *bytes); 459 460 /*! 461 * \brief Calculate and set Headroom Pool limit based on number of lossless classes and packet distribution. 462 * 463 * \param [in] unit Unit Number. 464 * \param [in] hdrm_pool Headroom Pool number. 465 * \param [in] num_lossless_class Max Number of lossless classes expected to use Headroom at a given time. 466 * \param [in] arr_size Array size of packet distribution array. 467 * \param [in] pkt_dist_array Packet distribution array. 468 * 469 * \retval SHR_E_NONE No errors. 470 * \retval !SHR_E_NONE Failure. 471 */ 472 typedef int (*cosq_thd_hdrm_pool_limit_set_f)( 473 int unit, 474 int hdrm_pool, 475 int num_lossless_class, 476 int arr_size, 477 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 478 479 /*! 480 * \brief Setup Port PriorityGroup headroom value based on cable length and packet distribution. 481 * 482 * \param [in] unit Unit Number. 483 * \param [in] port Port number. 484 * \param [in] pri_bmp Internal Priority bitmap for which PG headroom needs to be modified. 485 * \param [in] cable_len Cable length (in meters). 486 * \param [in] arr_size Array size of packet distribution array. 487 * \param [in] pkt_dist_array Packet distribution array. 488 * 489 * \retval SHR_E_NONE No errors. 490 * \retval !SHR_E_NONE Failure. 491 */ 492 typedef int (*cosq_thd_port_prigrp_hdrm_set_f)( 493 int unit, 494 bcm_port_t port, 495 uint32_t pri_bmp, 496 int cable_len, 497 int arr_size, 498 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 499 500 /*! 501 * \brief Cosq_thd driver structure. 502 */ 503 typedef struct mbcm_ltsw_cosq_thd_drv_s { 504 505 /*! Initialize the cosq_thd module. */ 506 cosq_thd_init_f cosq_thd_init; 507 508 /*! Detach the cosq_thd module. */ 509 cosq_thd_detach_f cosq_thd_detach; 510 511 /*! Check if a cosq_control_type property can be changed dynamically */ 512 cosq_thd_dynamic_get_f cosq_thd_dynamic_get; 513 514 /*! Reset the guarantee of priority group, uc queue, mc queue to the default. */ 515 cosq_thd_port_guarantee_reset_f cosq_thd_port_guarantee_reset; 516 517 /*! Set specified feature configuration */ 518 cosq_thd_control_set_f cosq_thd_control_set; 519 520 /*! Get specified feature configuration */ 521 cosq_thd_control_get_f cosq_thd_control_get; 522 523 /*! Port UC service pool id get. */ 524 cosq_thd_port_uc_spid_get_f cosq_thd_port_uc_spid_get; 525 526 /*! TM db shared limit get. */ 527 cosq_thd_shared_limit_get_f cosq_thd_shared_limit_get; 528 529 /*! Set the profile for Input priortty to PG mapping for a port. */ 530 cosq_thd_port_inppri_profile_set_f cosq_thd_port_inppri_profile_set; 531 532 /*! Get the profile for Input priortty to PG mapping for a port. */ 533 cosq_thd_port_inppri_profile_get_f cosq_thd_port_inppri_profile_get; 534 535 /*! Set the profile for PG to SPID/HPID/PFCPRI mapping for a port. */ 536 cosq_thd_port_pg_profile_set_f cosq_thd_port_pg_profile_set; 537 538 /*! Get the profile for PG to SPID/HPID/PFCPRI mapping for a port. */ 539 cosq_thd_port_pg_profile_get_f cosq_thd_port_pg_profile_get; 540 541 /*! To Set enable or disable status of service pool for a given pool id. */ 542 cosq_thd_service_pool_set_f cosq_thd_service_pool_set; 543 544 /*! To get enable or disable status of service pool for a given pool id. */ 545 cosq_thd_service_pool_get_f cosq_thd_service_pool_get; 546 547 /*! Enable or disable service pool override. */ 548 cosq_thd_service_pool_override_set_f cosq_thd_service_pool_override_set; 549 550 /*! Enable or disable service pool override. */ 551 cosq_thd_service_pool_override_get_f cosq_thd_service_pool_override_get; 552 553 /*! Set a profile for the various mappings. */ 554 cosq_thd_priority_group_mapping_profile_set_f cosq_thd_priority_group_mapping_profile_set; 555 556 /*! Get a profile for the various mappings. */ 557 cosq_thd_priority_group_mapping_profile_get_f cosq_thd_priority_group_mapping_profile_get; 558 559 /*! Setup per port per priority group properties. */ 560 cosq_thd_port_priority_group_property_set_f cosq_thd_port_priority_group_property_set; 561 562 /*! Setup per port per priority group properties. */ 563 cosq_thd_port_priority_group_property_get_f cosq_thd_port_priority_group_property_get; 564 565 /*! Get mutliple buffer ids associated with a specified port. */ 566 cosq_thd_buffer_id_multi_get_f cosq_thd_buffer_id_multi_get; 567 568 /*! To enable/disable Rx of packets on the specified CPU cosq. */ 569 cosq_thd_cpu_cosq_enable_set_f cosq_thd_cpu_cosq_enable_set; 570 571 /*! To get enable/disable status on Rx of packets on the specified CPU cosq. */ 572 cosq_thd_cpu_cosq_enable_get_f cosq_thd_cpu_cosq_enable_get; 573 574 /*! Convert BCM enum alpha value to LT enum value. */ 575 cosq_thd_alpha_bcm_to_lt_convert_f cosq_thd_alpha_bcm_to_lt_convert; 576 577 /*! Convert LT enum alpha value to BCM enum value. */ 578 cosq_thd_alpha_lt_to_bcm_convert_f cosq_thd_alpha_lt_to_bcm_convert; 579 580 /*! Convert byte to cell. */ 581 cosq_thd_byte_to_cell_f cosq_thd_byte_to_cell; 582 583 /*! Convert cell to byte. */ 584 cosq_thd_cell_to_byte_f cosq_thd_cell_to_byte; 585 586 /*! Calculate and set Headroom Pool limit based on number of lossless classes and packet distribution. */ 587 cosq_thd_hdrm_pool_limit_set_f cosq_thd_hdrm_pool_limit_set; 588 589 /*! Setup Port PriorityGroup headroom value based on cable length and packet distribution. */ 590 cosq_thd_port_prigrp_hdrm_set_f cosq_thd_port_prigrp_hdrm_set; 591 592 } mbcm_ltsw_cosq_thd_drv_t; 593 594 /*! 595 * \brief Set the COSQ_THD driver of the device. 596 * 597 * \param [in] unit Unit Number. 598 * \param [in] drv Cosq_thd driver to set. 599 * 600 * \retval SHR_E_NONE No errors. 601 * \retval !SHR_E_NONE Failure. 602 */ 603 extern int 604 mbcm_ltsw_cosq_thd_drv_set( 605 int unit, 606 mbcm_ltsw_cosq_thd_drv_t *drv); 607 608 /*! 609 * \brief Initialize the cosq_thd module. 610 * 611 * \param [in] unit Unit Number. 612 * 613 * \retval SHR_E_NONE No errors. 614 * \retval !SHR_E_NONE Failure. 615 */ 616 extern int 617 mbcm_ltsw_cosq_thd_init(int unit); 618 619 /*! 620 * \brief Detach the cosq_thd module. 621 * 622 * \param [in] unit Unit Number. 623 * 624 * \retval SHR_E_NONE No errors. 625 * \retval !SHR_E_NONE Failure. 626 */ 627 extern int 628 mbcm_ltsw_cosq_thd_detach(int unit); 629 630 /*! 631 * \brief Check if a cosq_control_type property can be changed dynamically 632 * 633 * \param [in] unit Unit Number. 634 * \param [in] type Type of operation. 635 * \param [in] dynamic Returns if type can be changed dynamically. 636 * 637 * \retval SHR_E_NONE No errors. 638 * \retval !SHR_E_NONE Failure. 639 */ 640 extern int 641 mbcm_ltsw_cosq_thd_dynamic_get( 642 int unit, 643 bcm_cosq_control_t type, 644 bcm_cosq_dynamic_setting_type_t *dynamic); 645 646 /*! 647 * \brief Reset the guarantee of priority group, uc queue, mc queue to the default. 648 * 649 * \param [in] unit Unit Number. 650 * \param [in] port Port Number. 651 * 652 * \retval SHR_E_NONE No errors. 653 * \retval !SHR_E_NONE Failure. 654 */ 655 extern int 656 mbcm_ltsw_cosq_thd_port_guarantee_reset( 657 int unit, 658 bcm_port_t port); 659 660 /*! 661 * \brief Set specified feature configuration 662 * 663 * \param [in] unit Unit Number. 664 * \param [in] gport Gport Number. 665 * \param [in] cosq COS queue. 666 * \param [in] buffer buffer id. 667 * \param [in] type Feature. 668 * \param [in] arg Feature value. 669 * 670 * \retval SHR_E_NONE No errors. 671 * \retval !SHR_E_NONE Failure. 672 */ 673 extern int 674 mbcm_ltsw_cosq_thd_control_set( 675 int unit, 676 bcm_gport_t gport, 677 bcm_cos_queue_t cosq, 678 bcm_cosq_buffer_id_t buffer, 679 bcm_cosq_control_t type, 680 int arg); 681 682 /*! 683 * \brief Get specified feature configuration 684 * 685 * \param [in] unit Unit Number. 686 * \param [in] gport Gport Number. 687 * \param [in] cosq COS queue. 688 * \param [in] buffer Buffer id. 689 * \param [in] type Feature. 690 * \param [out] arg Feature value. 691 * 692 * \retval SHR_E_NONE No errors. 693 * \retval !SHR_E_NONE Failure. 694 */ 695 extern int 696 mbcm_ltsw_cosq_thd_control_get( 697 int unit, 698 bcm_gport_t gport, 699 bcm_cos_queue_t cosq, 700 bcm_cosq_buffer_id_t buffer, 701 bcm_cosq_control_t type, 702 int *arg); 703 704 /*! 705 * \brief Port UC service pool id get. 706 * 707 * \param [in] unit Unit Number. 708 * \param [in] port Port Number. 709 * \param [in] queue queue id. 710 * \param [out] spid pool id. 711 * \param [out] use_qgroup_min true/false. 712 * 713 * \retval SHR_E_NONE No errors. 714 * \retval !SHR_E_NONE Failure. 715 */ 716 extern int 717 mbcm_ltsw_cosq_thd_port_uc_spid_get( 718 int unit, 719 bcm_port_t port, 720 int queue, 721 int *spid, 722 int *use_qgroup_min); 723 724 /*! 725 * \brief TM db shared limit get. 726 * 727 * \param [in] unit Unit Number. 728 * \param [in] itm itm. 729 * \param [in] spid ing service pool id. 730 * \param [out] shared_limit shared limit value. 731 * 732 * \retval SHR_E_NONE No errors. 733 * \retval !SHR_E_NONE Failure. 734 */ 735 extern int 736 mbcm_ltsw_cosq_thd_shared_limit_get( 737 int unit, 738 int itm, 739 int spid, 740 int *shared_limit); 741 742 /*! 743 * \brief Set the profile for Input priortty to PG mapping for a port. 744 * 745 * \param [in] unit Unit Number. 746 * \param [in] port Port Number. 747 * \param [in] profile_id Profile index. 748 * 749 * \retval SHR_E_NONE No errors. 750 * \retval !SHR_E_NONE Failure. 751 */ 752 extern int 753 mbcm_ltsw_cosq_thd_port_inppri_profile_set( 754 int unit, 755 bcm_port_t port, 756 int profile_id); 757 758 /*! 759 * \brief Get the profile for Input priortty to PG mapping for a port. 760 * 761 * \param [in] unit Unit Number. 762 * \param [in] port Port Number. 763 * \param [out] profile_id Profile index. 764 * 765 * \retval SHR_E_NONE No errors. 766 * \retval !SHR_E_NONE Failure. 767 */ 768 extern int 769 mbcm_ltsw_cosq_thd_port_inppri_profile_get( 770 int unit, 771 bcm_port_t port, 772 int *profile_id); 773 774 /*! 775 * \brief Set the profile for PG to SPID/HPID/PFCPRI mapping for a port. 776 * 777 * \param [in] unit Unit Number. 778 * \param [in] port Port Number. 779 * \param [in] profile_id Profile index. 780 * 781 * \retval SHR_E_NONE No errors. 782 * \retval !SHR_E_NONE Failure. 783 */ 784 extern int 785 mbcm_ltsw_cosq_thd_port_pg_profile_set( 786 int unit, 787 bcm_port_t port, 788 int profile_id); 789 790 /*! 791 * \brief Get the profile for PG to SPID/HPID/PFCPRI mapping for a port. 792 * 793 * \param [in] unit Unit Number. 794 * \param [in] port Port Number. 795 * \param [out] profile_id Profile index. 796 * 797 * \retval SHR_E_NONE No errors. 798 * \retval !SHR_E_NONE Failure. 799 */ 800 extern int 801 mbcm_ltsw_cosq_thd_port_pg_profile_get( 802 int unit, 803 bcm_port_t port, 804 int *profile_id); 805 806 /*! 807 * \brief To Set enable or disable status of service pool for a given pool id. 808 * 809 * \param [in] unit Unit Number. 810 * \param [in] id Service pool id. 811 * \param [in] cosq_service_pool Enable/Disable given type service pool. 812 * 813 * \retval SHR_E_NONE No errors. 814 * \retval !SHR_E_NONE Failure. 815 */ 816 extern int 817 mbcm_ltsw_cosq_thd_service_pool_set( 818 int unit, 819 bcm_service_pool_id_t id, 820 bcm_cosq_service_pool_t cosq_service_pool); 821 822 /*! 823 * \brief To get enable or disable status of service pool for a given pool id. 824 * 825 * \param [in] unit Unit Number. 826 * \param [in] id Service pool id. 827 * \param [out] cosq_service_pool Get enable or disable status. 828 * 829 * \retval SHR_E_NONE No errors. 830 * \retval !SHR_E_NONE Failure. 831 */ 832 extern int 833 mbcm_ltsw_cosq_thd_service_pool_get( 834 int unit, 835 bcm_service_pool_id_t id, 836 bcm_cosq_service_pool_t *cosq_service_pool); 837 838 /*! 839 * \brief Enable or disable service pool override. 840 * 841 * \param [in] unit Unit Number. 842 * \param [in] type Service pool override type. 843 * \param [in] service_pool Service pool id. 844 * \param [in] enable Enable or disable service pool override. 845 * 846 * \retval SHR_E_NONE No errors. 847 * \retval !SHR_E_NONE Failure. 848 */ 849 extern int 850 mbcm_ltsw_cosq_thd_service_pool_override_set( 851 int unit, 852 bcm_cosq_service_pool_override_type_t type, 853 bcm_service_pool_id_t service_pool, 854 int enable); 855 856 /*! 857 * \brief Enable or disable service pool override. 858 * 859 * \param [in] unit Unit Number. 860 * \param [in] type Service pool override type. 861 * \param [out] service_pool Service pool id. 862 * \param [out] enable Enable or disable service pool override. 863 * 864 * \retval SHR_E_NONE No errors. 865 * \retval !SHR_E_NONE Failure. 866 */ 867 extern int 868 mbcm_ltsw_cosq_thd_service_pool_override_get( 869 int unit, 870 bcm_cosq_service_pool_override_type_t type, 871 bcm_service_pool_id_t *service_pool, 872 int *enable); 873 874 /*! 875 * \brief Set a profile for the various mappings. 876 * 877 * \param [in] unit Unit Number. 878 * \param [in] profile_index profile index. 879 * \param [in] type Mapping type. 880 * \param [in] array_count Number of mappings in array. 881 * \param [in] arg Value of input to mapping type. 882 * 883 * \retval SHR_E_NONE No errors. 884 * \retval !SHR_E_NONE Failure. 885 */ 886 extern int 887 mbcm_ltsw_cosq_thd_priority_group_mapping_profile_set( 888 int unit, 889 int profile_index, 890 bcm_cosq_priority_group_mapping_profile_type_t type, 891 int array_count, 892 int *arg); 893 894 /*! 895 * \brief Get a profile for the various mappings. 896 * 897 * \param [in] unit Unit Number. 898 * \param [in] profile_index profile index. 899 * \param [in] type Mapping type. 900 * \param [in] array_max Number of mappings allocated in array. 901 * \param [out] arg Array of input to mapping type. 902 * \param [out] array_count Number of mappings returned. 903 * 904 * \retval SHR_E_NONE No errors. 905 * \retval !SHR_E_NONE Failure. 906 */ 907 extern int 908 mbcm_ltsw_cosq_thd_priority_group_mapping_profile_get( 909 int unit, 910 int profile_index, 911 bcm_cosq_priority_group_mapping_profile_type_t type, 912 int array_max, 913 int *arg, 914 int *array_count); 915 916 /*! 917 * \brief Setup per port per priority group properties. 918 * 919 * \param [in] unit Unit Number. 920 * \param [in] port Port Number. 921 * \param [in] priority_group_id priority group. 922 * \param [in] type Port/priority group property. 923 * \param [in] arg set value of property. 924 * 925 * \retval SHR_E_NONE No errors. 926 * \retval !SHR_E_NONE Failure. 927 */ 928 extern int 929 mbcm_ltsw_cosq_thd_port_priority_group_property_set( 930 int unit, 931 bcm_port_t port, 932 int priority_group_id, 933 bcm_cosq_port_prigroup_control_t type, 934 int arg); 935 936 /*! 937 * \brief Setup per port per priority group properties. 938 * 939 * \param [in] unit Unit Number. 940 * \param [in] port Port Number. 941 * \param [in] priority_group_id priority group. 942 * \param [in] type Port/priority group property. 943 * \param [out] arg set value of property. 944 * 945 * \retval SHR_E_NONE No errors. 946 * \retval !SHR_E_NONE Failure. 947 */ 948 extern int 949 mbcm_ltsw_cosq_thd_port_priority_group_property_get( 950 int unit, 951 bcm_port_t port, 952 int priority_group_id, 953 bcm_cosq_port_prigroup_control_t type, 954 int *arg); 955 956 /*! 957 * \brief Get mutliple buffer ids associated with a specified port. 958 * 959 * \param [in] unit Unit Number. 960 * \param [in] gport Gport Number. 961 * \param [in] cosq Reserved field. 962 * \param [in] direction Specify ingress or egress direction. 963 * \param [in] array_max number of entries to be retrieved. 964 * \param [out] buf_id_array Buffer id array. 965 * \param [out] array_count Actural buffer id count in buf_id_array. 966 * 967 * \retval SHR_E_NONE No errors. 968 * \retval !SHR_E_NONE Failure. 969 */ 970 extern int 971 mbcm_ltsw_cosq_thd_buffer_id_multi_get( 972 int unit, 973 bcm_gport_t gport, 974 bcm_cos_queue_t cosq, 975 bcm_cosq_dir_t direction, 976 int array_max, 977 bcm_cosq_buffer_id_t *buf_id_array, 978 int *array_count); 979 980 /*! 981 * \brief To enable/disable Rx of packets on the specified CPU cosq. 982 * 983 * \param [in] unit Unit Number. 984 * \param [in] cosq CPU Cosq ID. 985 * \param [in] enable Enable/Disable. 986 * 987 * \retval SHR_E_NONE No errors. 988 * \retval !SHR_E_NONE Failure. 989 */ 990 extern int 991 mbcm_ltsw_cosq_thd_cpu_cosq_enable_set( 992 int unit, 993 bcm_cos_queue_t cosq, 994 int enable); 995 996 /*! 997 * \brief To get enable/disable status on Rx of packets on the specified CPU cosq. 998 * 999 * \param [in] unit Unit Number. 1000 * \param [in] cosq CPU Cosq ID. 1001 * \param [out] enable Enable/Disable. 1002 * 1003 * \retval SHR_E_NONE No errors. 1004 * \retval !SHR_E_NONE Failure. 1005 */ 1006 extern int 1007 mbcm_ltsw_cosq_thd_cpu_cosq_enable_get( 1008 int unit, 1009 bcm_cos_queue_t cosq, 1010 int *enable); 1011 1012 /*! 1013 * \brief Convert BCM enum alpha value to LT enum value. 1014 * 1015 * \param [in] unit Unit Number. 1016 * \param [in] arg BCM Alpha value. 1017 * \param [out] alpha LT Alpha value. 1018 * 1019 * \retval SHR_E_NONE No errors. 1020 * \retval !SHR_E_NONE Failure. 1021 */ 1022 extern int 1023 mbcm_ltsw_cosq_thd_alpha_bcm_to_lt_convert( 1024 int unit, 1025 int arg, 1026 const char **alpha); 1027 1028 /*! 1029 * \brief Convert LT enum alpha value to BCM enum value. 1030 * 1031 * \param [in] unit Unit Number. 1032 * \param [in] alpha LT Alpha value. 1033 * \param [out] arg BCM Alpha value. 1034 * 1035 * \retval SHR_E_NONE No errors. 1036 * \retval !SHR_E_NONE Failure. 1037 */ 1038 extern int 1039 mbcm_ltsw_cosq_thd_alpha_lt_to_bcm_convert( 1040 int unit, 1041 const char *alpha, 1042 int *arg); 1043 1044 /*! 1045 * \brief Convert byte to cell. 1046 * 1047 * \param [in] unit Unit Number. 1048 * \param [in] bytes bytes. 1049 * \param [out] cells cells. 1050 * 1051 * \retval SHR_E_NONE No errors. 1052 * \retval !SHR_E_NONE Failure. 1053 */ 1054 extern int 1055 mbcm_ltsw_cosq_thd_byte_to_cell( 1056 int unit, 1057 uint32_t bytes, 1058 int *cells); 1059 1060 /*! 1061 * \brief Convert cell to byte. 1062 * 1063 * \param [in] unit Unit Number. 1064 * \param [in] cells cells. 1065 * \param [out] bytes bytes. 1066 * 1067 * \retval SHR_E_NONE No errors. 1068 * \retval !SHR_E_NONE Failure. 1069 */ 1070 extern int 1071 mbcm_ltsw_cosq_thd_cell_to_byte( 1072 int unit, 1073 uint32_t cells, 1074 int *bytes); 1075 1076 /*! 1077 * \brief Calculate and set Headroom Pool limit based on number of lossless classes and packet distribution. 1078 * 1079 * \param [in] unit Unit Number. 1080 * \param [in] hdrm_pool Headroom Pool number. 1081 * \param [in] num_lossless_class Max Number of lossless classes expected to use Headroom at a given time. 1082 * \param [in] arr_size Array size of packet distribution array. 1083 * \param [in] pkt_dist_array Packet distribution array. 1084 * 1085 * \retval SHR_E_NONE No errors. 1086 * \retval !SHR_E_NONE Failure. 1087 */ 1088 extern int 1089 mbcm_ltsw_cosq_thd_hdrm_pool_limit_set( 1090 int unit, 1091 int hdrm_pool, 1092 int num_lossless_class, 1093 int arr_size, 1094 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 1095 1096 /*! 1097 * \brief Setup Port PriorityGroup headroom value based on cable length and packet distribution. 1098 * 1099 * \param [in] unit Unit Number. 1100 * \param [in] port Port number. 1101 * \param [in] pri_bmp Internal Priority bitmap for which PG headroom needs to be modified. 1102 * \param [in] cable_len Cable length (in meters). 1103 * \param [in] arr_size Array size of packet distribution array. 1104 * \param [in] pkt_dist_array Packet distribution array. 1105 * 1106 * \retval SHR_E_NONE No errors. 1107 * \retval !SHR_E_NONE Failure. 1108 */ 1109 extern int 1110 mbcm_ltsw_cosq_thd_port_prigrp_hdrm_set( 1111 int unit, 1112 bcm_port_t port, 1113 uint32_t pri_bmp, 1114 int cable_len, 1115 int arr_size, 1116 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 1117 1118 #endif /* BCMINT_LTSW_MBCM_COSQ_THD_H */