ingress_congestion.h (48099B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 /* 7 * ! \file bcm_int/dnx/cosq/ingress/ingress_congestion.h 8 * Reserved.$ 9 */ 10 #ifndef _DNX_INGRESS_CONGESTION_H_INCLUDED_ 11 /* 12 * { 13 */ 14 #define _DNX_INGRESS_CONGESTION_H_INCLUDED_ 15 16 #ifndef BCM_DNX_SUPPORT 17 #error "This file is for use by DNX (JR2) family only!" 18 #endif 19 20 #include <soc/dnx/dbal/auto_generated/dbal_defines_fields.h> 21 #include <bcm_int/dnx/cosq/egress/egr_queuing.h> 22 #include <bcm_int/dnx/cosq/cosq.h> 23 #include <bcm_int/dnx/algo/template_mngr/template_mngr.h>/** for dnx_sw_state_pretty_print_t */ 24 #include <soc/dnx/dnx_data/auto_generated/dnx_data_ingr_congestion.h> 25 #include <soc/dnx/dbal/dbal.h> 26 27 /* 28 * Defines: 29 * { 30 */ 31 32 typedef enum 33 { 34 /* 35 * VSQ group A - category 36 */ 37 DNX_INGRESS_CONGESTION_VSQ_GROUP_CTGRY = 0, 38 /* 39 * VSQ group B - category and traffic class 40 */ 41 DNX_INGRESS_CONGESTION_VSQ_GROUP_CTGRY_TRAFFIC_CLS, 42 /* 43 * VSQ group C - category and connection class 44 */ 45 DNX_INGRESS_CONGESTION_VSQ_GROUP_CTGRY_CNCTN_CLS, 46 /* 47 * VSQ group D - statistics tag 48 */ 49 DNX_INGRESS_CONGESTION_VSQ_GROUP_STTSTCS_TAG, 50 /* 51 * VSQ group E - Link Level Flow Control 52 */ 53 DNX_INGRESS_CONGESTION_VSQ_GROUP_SRC_PORT, 54 /* 55 * VSQ group F - Port Priority Flow Control 56 */ 57 DNX_INGRESS_CONGESTION_VSQ_GROUP_PG, 58 /* 59 * Global VSQ 60 */ 61 DNX_INGRESS_CONGESTION_VSQ_GLOBAL, 62 /* 63 * Must be the last value 64 * Global is not counted 65 */ 66 DNX_INGRESS_CONGESTION_VSQ_GROUP_NOF = DNX_INGRESS_CONGESTION_VSQ_GLOBAL 67 } dnx_ingress_congestion_vsq_group_e; 68 69 /* 70 * } 71 */ 72 73 typedef enum 74 { 75 DNX_INGRESS_CONGESTION_RESOURCE_INVALID = -1, 76 DNX_INGRESS_CONGESTION_RESOURCE_TOTAL_BYTES = 0, 77 DNX_INGRESS_CONGESTION_RESOURCE_SRAM_BUFFERS, 78 DNX_INGRESS_CONGESTION_RESOURCE_SRAM_PDS, 79 DNX_INGRESS_CONGESTION_RESOURCE_NOF 80 } dnx_ingress_congestion_resource_type_e; 81 82 /* 83 * DRAM Bound resource types 84 */ 85 typedef enum 86 { 87 DNX_INGRESS_CONGESTION_DRAM_BOUND_RESOURCE_INVALID = -1, 88 DNX_INGRESS_CONGESTION_DRAM_BOUND_RESOURCE_SRAM_BYTES = 0, 89 DNX_INGRESS_CONGESTION_DRAM_BOUND_RESOURCE_SRAM_BUFFERS, 90 DNX_INGRESS_CONGESTION_DRAM_BOUND_RESOURCE_SRAM_PDS, 91 DNX_INGRESS_CONGESTION_DRAM_BOUND_RESOURCE_NOF 92 } dnx_ingress_congestion_dram_bound_resource_type_e; 93 94 /* 95 * DRAM Bound threshold types 96 */ 97 typedef enum 98 { 99 DNX_INGRESS_CONGESTION_DRAM_BOUND = 0, 100 DNX_INGRESS_CONGESTION_DRAM_BOUND_RECOVERY_FAILURE, 101 DNX_INGRESS_CONGESTION_DRAM_BOUND_THR_TYPE_NOF 102 } dnx_ingress_congestion_dram_bound_threshold_type_e; 103 104 /* 105 * ingress congestion management statistics types 106 */ 107 typedef enum 108 { 109 DNX_INGRESS_CONGESTION_STATISTICS_BDBS = 0, 110 DNX_INGRESS_CONGESTION_STATISTICS_SRAM_BUFFERS, 111 DNX_INGRESS_CONGESTION_STATISTICS_SRAM_PDS, 112 DNX_INGRESS_CONGESTION_STATISTICS_NOF 113 } dnx_ingress_congestion_statistics_types_t; 114 115 typedef enum 116 { 117 /** VOQ Reject Mask */ 118 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_SRAM_PDS_TOTAL_SHARED = 0, 119 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_SRAM_PDS_MAX_SIZE, 120 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_SRAM_BUFFERS_TOTAL_SHARED, 121 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_SRAM_BUFFERS_MAX_SIZE, 122 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_WORDS_TOTAL_SHARED, 123 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_WORDS_MAX_SIZE, 124 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_SYSTEM_RED, 125 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_LATENCY, 126 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_WRED, 127 DNX_INGRESS_CONGESTION_REJECT_BIT_VOQ_DRAM_BLOCK, 128 129 /** VSQ Reject Mask */ 130 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_SRAM_PDS_TOTAL_SHARED, 131 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_SRAM_PDS_MAX_SIZE, 132 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_D_SRAM_PDS_MAX_SIZE, 133 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_C_SRAM_PDS_MAX_SIZE, 134 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_B_SRAM_PDS_MAX_SIZE, 135 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_A_SRAM_PDS_MAX_SIZE, 136 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_SRAM_BUFFERS_TOTAL_SHARED, 137 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_SRAM_BUFFERS_MAX_SIZE, 138 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_D_SRAM_BUFFERS_MAX_SIZE, 139 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_C_SRAM_BUFFERS_MAX_SIZE, 140 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_B_SRAM_BUFFERS_MAX_SIZE, 141 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_A_SRAM_BUFFERS_MAX_SIZE, 142 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_WORDS_TOTAL_SHARED, 143 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_F_WORDS_MAX_SIZE, 144 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_D_WORDS_MAX_SIZE, 145 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_C_WORDS_MAX_SIZE, 146 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_B_WORDS_MAX_SIZE, 147 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_A_WORDS_MAX_SIZE, 148 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_F_WORDS_WRED, 149 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_E_WORDS_WRED, 150 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_D_WORDS_WRED, 151 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_C_WORDS_WRED, 152 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_B_WORDS_WRED, 153 DNX_INGRESS_CONGESTION_REJECT_BIT_VSQ_A_WORDS_WRED, 154 155 /** Global Reject Mask */ 156 DNX_INGRESS_CONGESTION_REJECT_BIT_DRAM_BDBS_OCCUPANCY, 157 DNX_INGRESS_CONGESTION_REJECT_BIT_SRAM_BUFFERS_OCCUPANCY, 158 DNX_INGRESS_CONGESTION_REJECT_BIT_SRAM_PDS_OCCUPANCY, 159 DNX_INGRESS_CONGESTION_REJECT_BIT_DP_LEVEL, 160 161 /** total bits */ 162 DNX_INGRESS_CONGESTION_REJECT_BIT_NOF 163 } dnx_ingress_congestion_reject_bit_e; 164 165 typedef enum 166 { 167 /** VOQ DRAM BLOCK Bit Mask */ 168 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_DP_LEVEL = 0, 169 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_GLBL_SRAM_PDBS, 170 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_GLBL_SRAM_BUFFERS, 171 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_GLBL_DRAM_BDBS, 172 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_LATENCY_BIT, 173 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_WORDS_MAX_QSIZE, 174 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_WRED, 175 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_SYS_RED_BIT, 176 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_TOTAL_FREE_SHARED_WORDS, 177 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_SRAM_BUFFERS_MAX_QSIZE, 178 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_TOTAL_FREE_SHARED_SRAM_BUFFERS, 179 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_SRAM_PDS_MAX_QSIZE, 180 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VOQ_TOTAL_FREE_SHARED_SRAM_PDS, 181 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_QUEUE_BASED_VSQ_WRED, 182 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_VSQ_WRED, 183 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_QUEUE_BASED_WORDS_MAX_QSIZE, 184 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_WORDS_MAX_QSIZE, 185 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_VSQ_TOTAL_FREE_SHARED_WORDS, 186 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_QUEUE_BASED_SRAM_BUFFERS_MAX_QSIZE, 187 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_SRAM_BUFFERS_MAX_QSIZE, 188 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_VSQ_TOTAL_FREE_SHARED_SRAM_BUFFERS, 189 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_QUEUE_BASED_SRAM_PDS_MAX_QSIZE, 190 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_SRAM_PDS_MAX_QSIZE, 191 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_VSQ_PORT_BASED_VSQ_TOTAL_FREE_SHARED_SRAM_PDS, 192 193 /** total bits */ 194 DNX_INGRESS_CONGESTION_DRAM_BLOCK_BITMAP_NOF 195 } dnx_ingress_congestion_dram_block_bitmap_e; 196 197 typedef struct 198 { 199 /* 200 * Tail drop settings 201 */ 202 /* 203 * Maximal VSQ size per type per DP 204 */ 205 uint32 max_size_th[DNX_INGRESS_CONGESTION_RESOURCE_NOF][DNX_COSQ_NOF_DP]; 206 } dnx_ingress_congestion_vsq_rate_class_taildrop_info_t; 207 208 typedef struct 209 { 210 /** 211 * Indicator: 212 * 1 - enable WRED test 213 * 0 - disable test 214 * For VSQ WRED, this indication is ignored. 215 * To enable VSQ WRED, use 'soc_jer2_tmcitm_vsq_wred_gen_set' API. 216 */ 217 int wred_en; 218 219 /** 220 * Relating to queue average size. Minimum Average Threshold 221 * - Below this threshold, packet is admitted into the 222 * queue. Resolution of bytes. The device resolution is of 16 223 * bytes. Has to be lower than max_avrg_th. 224 */ 225 uint32 min_avrg_th; 226 227 /** 228 * Relating to queue average size. Maximum Average Threshold 229 * - Above this threshold, packet is discarded from the 230 * queue. Resolution of bytes. The device resolution is of 16 231 * bytes. Has to be higher than min_avrg_th. 232 */ 233 uint32 max_avrg_th; 234 235 /** 236 * The maximum probability of discarding a packet (when the 237 * queue reaches the maximum average size ('max_avrg_th') 238 * and the packet size is the maximum size 239 * ('max_packet_size')). 1% = 1, 23% = 23. Range: 0 - 100. 240 */ 241 uint32 max_probability; 242 } dnx_ingress_congestion_wred_info_t; 243 244 typedef struct 245 { 246 dnx_ingress_congestion_wred_info_t wred_params[DNX_COSQ_NOF_DP]; 247 248 } dnx_ingress_congestion_vsq_rate_class_wred_info_t; 249 250 /** 251 * PG parameters 252 */ 253 typedef struct 254 { 255 int is_lossless; 256 int pool_id; 257 int admit_profile; 258 } dnx_ingress_congestion_pg_params_t; 259 260 typedef struct 261 { 262 uint32 max_headroom; 263 uint32 max_headroom_nominal; 264 uint32 max_headroom_extension; 265 } dnx_ingress_congestion_vsq_rate_class_pg_headroom_info_t; 266 267 typedef struct 268 { 269 dnx_ingress_congestion_vsq_rate_class_wred_info_t wred; 270 /* 271 * WRED exp. weight 272 */ 273 uint32 wred_exp_wq; 274 275 dnx_ingress_congestion_vsq_rate_class_taildrop_info_t taildrop; 276 dnx_cosq_hyst_threshold_t fc[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 277 } dnx_ingress_congestion_queue_vsq_rate_class_info_t; 278 279 typedef struct 280 { 281 dnx_ingress_congestion_vsq_rate_class_wred_info_t wred; 282 283 dnx_cosq_hyst_threshold_t fc[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 284 285 uint32 guaranteed_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF][DNX_COSQ_NOF_DP]; 286 uint32 shared_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF][DNX_COSQ_NOF_DP]; 287 uint32 headroom_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 288 } dnx_ingress_congestion_src_port_pool_vsq_rate_class_info_t; 289 290 typedef struct 291 { 292 dnx_ingress_congestion_src_port_pool_vsq_rate_class_info_t pool[DNX_DATA_MAX_INGR_CONGESTION_VSQ_POOL_NOF]; 293 /* 294 * WRED exp. weight 295 */ 296 uint32 wred_exp_wq; 297 } dnx_ingress_congestion_src_port_vsq_rate_class_info_t; 298 299 typedef struct 300 { 301 dnx_ingress_congestion_vsq_rate_class_wred_info_t wred; 302 303 /* 304 * WRED exp. weight 305 */ 306 uint32 wred_exp_wq; 307 308 dnx_cosq_fadt_hyst_threshold_t fadt_fc[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 309 310 uint32 guaranteed_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF][DNX_COSQ_NOF_DP]; 311 312 dnx_cosq_fadt_threshold_t shared_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF][DNX_COSQ_NOF_DP]; 313 314 dnx_ingress_congestion_vsq_rate_class_pg_headroom_info_t headroom_size[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 315 } dnx_ingress_congestion_pg_vsq_rate_class_info_t; 316 317 /* 318 * VSQ rate class data 319 * can hold rate class data of any vsq type 320 */ 321 typedef struct 322 { 323 dnx_ingress_congestion_vsq_group_e vsq_type; 324 union 325 { 326 dnx_ingress_congestion_queue_vsq_rate_class_info_t vsq_a_d_rate_class_info; 327 dnx_ingress_congestion_src_port_vsq_rate_class_info_t vsq_e_rate_class_info; 328 dnx_ingress_congestion_pg_vsq_rate_class_info_t vsq_f_rate_class_info; 329 } data; 330 } dnx_ingress_congestion_vsq_rate_class_info_t; 331 332 typedef struct 333 { 334 uint8 pg[DNX_COSQ_NOF_TC]; 335 } dnx_ingress_congestion_vsq_tc_pg_mapping_t; 336 337 /* 338 * ingress congestion management statistics. 339 */ 340 typedef struct 341 { 342 uint32 free_count[DNX_INGRESS_CONGESTION_STATISTICS_NOF]; 343 uint32 min_free_count[DNX_INGRESS_CONGESTION_STATISTICS_NOF]; 344 } dnx_ingress_congestion_statistics_info_t; 345 346 /** 347 * \brief Ingress congestion voq occupancy statistics. 348 */ 349 typedef struct 350 { 351 /** 352 * ID of current queue 353 */ 354 uint32 id; 355 /** 356 * Total size in Bytes of current VOQ 357 */ 358 uint32 size; 359 /** 360 * Total size in Bytes of current VOQ in SRAM 361 */ 362 uint32 size_sram; 363 /** 364 * Total size in buffers of current VOQ 365 */ 366 uint32 buffer_size; 367 /** 368 * Total size in PDS of current VOQ 369 */ 370 uint32 nof_pds_in_sram; 371 /** 372 * Average size size in words in both DRAM and SRAM 373 */ 374 uint32 size_avrg; 375 } dnx_ingress_congestion_voq_occupancy_info_t; 376 377 /* 378 * ingress congestion management statistics. 379 */ 380 /** 381 * \brief - Structure for collecting VSQ and VOQ counter info 382 */ 383 typedef struct 384 { 385 /** 386 * NOF Enqueued packets 387 */ 388 int sram_enq_pkt_ovf; 389 uint32 sram_enq_pkt_cnt; 390 /** 391 * NOF Rejected packets 392 */ 393 int sram_disc_pkt_ovf; 394 uint32 sram_disc_pkt_cnt; 395 /** 396 * NOF Dequeued packets from SRAM to DRAM 397 */ 398 int sram_to_dram_pkt_ovf; 399 uint32 sram_to_dram_pkt_cnt; 400 /** 401 * NOF Dequeued packets from SRAM to Fabric 402 */ 403 int sram_to_fabric_pkt_ovf; 404 uint32 sram_to_fabric_pkt_cnt; 405 /** 406 * NOF Deleted packets in SRAM 407 */ 408 int sram_del_pkt_ovf; 409 uint32 sram_del_pkt_cnt; 410 /** 411 * NOF Dequeued bundles 412 */ 413 int dram_deq_bundle_ovf; 414 uint32 dram_deq_bundle_cnt; 415 /** 416 * NOF Deleted bundles 417 */ 418 int dram_del_bundle_ovf; 419 uint32 dram_del_bundle_cnt; 420 /** 421 * NOF Enqueued bytes 422 */ 423 int sram_enq_byte_ovf; 424 uint64 sram_enq_byte_cnt; 425 /** 426 * NOF Rejected bytes 427 */ 428 int sram_disc_byte_ovf; 429 uint64 sram_disc_byte_cnt; 430 /** 431 * NOF Deleted bytes in SRAM 432 */ 433 int sram_del_byte_ovf; 434 uint64 sram_del_byte_cnt; 435 /** 436 * NOF Dequeued bytes from SRAM to DRAM 437 */ 438 int sram_to_dram_byte_ovf; 439 uint64 sram_to_dram_byte_cnt; 440 /** 441 * NOF Dequeued bytes from SRAM to Fabric 442 */ 443 int sram_to_fabric_byte_ovf; 444 uint64 sram_to_fabric_byte_cnt; 445 } dnx_ingress_congestion_counter_info_t; 446 447 /* 448 * ingress congestion voq occupancy statistics. 449 */ 450 /** 451 * \brief - 452 */ 453 typedef struct 454 { 455 /** 456 * Total 457 */ 458 uint32 total; 459 /** 460 * Guaranteed 461 */ 462 uint32 guaranteed[DNX_DATA_MAX_INGR_CONGESTION_VSQ_POOL_NOF]; 463 464 /** 465 * Shared 466 */ 467 uint32 shared[DNX_DATA_MAX_INGR_CONGESTION_VSQ_POOL_NOF]; 468 /** 469 * Headroom 470 */ 471 uint32 headroom[DNX_DATA_MAX_INGR_CONGESTION_VSQ_POOL_NOF]; 472 /** 473 * Headroom Extension - used only for VSQ F, has only 1 pool 474 */ 475 uint32 headroom_ex; 476 477 } dnx_ingress_congestion_vsq_resource_spaces_t; 478 479 /** 480 * \brief - Structure for collecting VSQ occupancy info 481 */ 482 typedef struct 483 { 484 /** 485 * ID of current queue in the VSQ group 486 */ 487 uint32 vsq_id; 488 /** 489 * Average size in Bytes of current VSQ in the VSQ group 490 */ 491 uint32 size_avrg; 492 /** 493 * Total size in all buffers in Bytes, OCB Buffesrs and OCB PDS 494 * of current VSQ in the VSQ group 495 */ 496 dnx_ingress_congestion_vsq_resource_spaces_t resources[DNX_INGRESS_CONGESTION_RESOURCE_NOF]; 497 498 } dnx_ingress_congestion_vsq_occupancy_info_t; 499 500 /** 501 * \brief - Structure for collecting the information about the last enqueued packet 502 */ 503 typedef struct 504 { 505 /** 506 * Queue id of the last enqueued packed 507 */ 508 uint32 qnum; 509 /** 510 * Packet size of the last enqueued packed 511 */ 512 uint32 pkt_size; 513 /** 514 * Compensation 515 */ 516 int compensation; 517 } dnx_ingress_congestion_last_enqueued_cmd_info_t; 518 519 /* 520 * Exposing internal declarations - 521 * the following functions are required in shell command "tm ingress queue map info" implementation. 522 * see sh_dnx_tm_queue_mapping_info_cmd() 523 * for information about these functions, see declaration in ingress_congestion_dbal.h 524 */ 525 526 /** 527 * \brief - Get rate class profile for a VOQ 528 * 529 * \param [in] unit - chip unit id. 530 * \param [in] core - device core id. 531 * \param [in] voq - voq index 532 * \param [out] rate_class - rate class profile 533 * 534 * \return shr_error_e 535 */ 536 extern shr_error_e dnx_ingress_congestion_dbal_voq_rate_class_get( 537 int unit, 538 int core, 539 uint32 voq, 540 uint32 *rate_class); 541 542 /** 543 * \brief - Get traffic class for a VOQ 544 * 545 * \param [in] unit - chip unit id. 546 * \param [in] core - device core id. 547 * \param [in] voq - voq index 548 * \param [out] traffic_class - traffic class profile 549 * 550 * \return shr_error_e 551 */ 552 extern shr_error_e dnx_ingress_congestion_dbal_voq_traffic_class_get( 553 int unit, 554 int core, 555 uint32 voq, 556 uint32 *traffic_class); 557 558 /** 559 * \brief - Get connection class profile for a VOQ 560 * 561 * \param [in] unit - chip unit id. 562 * \param [in] core - device core id. 563 * \param [in] voq - voq index 564 * \param [out] connection_class - connection class profile 565 * 566 * \return shr_error_e 567 */ 568 extern shr_error_e dnx_ingress_congestion_dbal_voq_connection_class_get( 569 int unit, 570 int core, 571 uint32 voq, 572 uint32 *connection_class); 573 574 /** 575 * \brief - Callback to configure ingress congestion information 576 * for port to be added 577 * 578 * \par DIRECT_INPUT: 579 * \param [in] unit - Unit-ID 580 * 581 * \par INDIRECT INPUT: 582 * * port which is in process of being added 583 * \par DIRECT OUTPUT: 584 * shr_error_e 585 * \par INDIRECT OUTPUT 586 * * HW configuration of ingress port 587 * \remark 588 * * Invoked during bcm_dnx_port_add 589 * \see 590 * * None 591 */ 592 shr_error_e dnx_ingress_congestion_port_add_handle( 593 int unit); 594 595 /** 596 * \brief - Callback to clean ingress congestion data 597 * from port which is in process of removing 598 * 599 * \par DIRECT_INPUT: 600 * \param [in] unit - Unit-ID 601 * 602 * \par INDIRECT INPUT: 603 * * port which is in process of being removed 604 * \par DIRECT OUTPUT: 605 * shr_error_e 606 * \par INDIRECT OUTPUT 607 * * HW configuration of reassembly and port termination context 608 * \remark 609 * * Invoked during bcm_dnx_port_remove 610 * * Must be invoked before Ingress Port handles port removing 611 * \see 612 * * None 613 */ 614 shr_error_e dnx_ingress_congestion_port_remove_handle( 615 int unit); 616 617 /** 618 * \brief - allocate vsq-e id for non phy ports 619 * 620 * \param [in] unit - chip unit id. 621 * \param [in] src_port - source logical port 622 * \param [out] vsq_e_id - allocated VSQ-E ID 623 * 624 * \return shr_error_e 625 */ 626 shr_error_e dnx_ingress_congestion_vsq_e_id_alloc( 627 int unit, 628 bcm_port_t src_port, 629 int *vsq_e_id); 630 631 /** 632 * \brief - deallocate vsq-e id for non phy ports 633 * 634 * \param [in] unit - chip unit id. 635 * \param [in] src_port - source logical port 636 * \param [in] vsq_e_id - VSQ-E ID 637 * 638 * \return shr_error_e 639 */ 640 shr_error_e dnx_ingress_congestion_vsq_e_id_dealloc( 641 int unit, 642 bcm_port_t src_port, 643 int vsq_e_id); 644 645 /** 646 * \brief - allocate vsq-f id for non phy ports 647 * 648 * \param [in] unit - chip unit id. 649 * \param [in] src_port - source logical port 650 * \param [in] numq - number of VSQ-Fs 651 * \param [out] vsq_f_id - allocated VSQ-F base ID 652 * 653 * \return shr_error_e 654 */ 655 shr_error_e dnx_ingress_congestion_vsq_f_id_alloc( 656 int unit, 657 bcm_port_t src_port, 658 int numq, 659 int *vsq_f_id); 660 /** 661 * \brief - deallocate vsq-f id for non phy ports 662 * 663 * \param [in] unit - chip unit id. 664 * \param [in] src_port - source logical port 665 * \param [in] numq - number of VSQ-Fs 666 * \param [in] vsq_f_id - VSQ-F base ID 667 * 668 * \return shr_error_e 669 */ 670 shr_error_e dnx_ingress_congestion_vsq_f_id_dealloc( 671 int unit, 672 bcm_port_t src_port, 673 int numq, 674 int vsq_f_id); 675 676 /** 677 * \brief - 678 * Get vsq to rate class mapping 679 * 680 * \param [in] unit - unit 681 * \param [in] core - core 682 * \param [in] vsq_type - VSQ type 683 * \param [in] vsq_id - VSQ ID 684 * \param [out] rt_cls - VSQ rate class 685 * 686 * \return 687 * See shr_error_e 688 * \remark 689 * * None 690 * \see 691 * * None 692 */ 693 int dnx_vsq_rate_class_mapping_get( 694 int unit, 695 int core, 696 dnx_ingress_congestion_vsq_group_e vsq_type, 697 int vsq_id, 698 int *rt_cls); 699 700 /* 701 * brief - init configuration for VOQ programmable counters 702 * 703 * \param [in] unit - unit 704 * \param [in] core - core 705 * 706 * \return 707 * See shr_error_e 708 * \remark 709 * * None 710 * \see 711 * * None 712 */ 713 shr_error_e dnx_ingress_congestion_programmable_counter_voq_init_config_set( 714 int unit, 715 bcm_core_t core); 716 717 /* 718 * brief - init configuration for VSQ programmable counters 719 * 720 * \param [in] unit - unit 721 * \param [in] core - core 722 * 723 * \return 724 * See shr_error_e 725 * \remark 726 * * None 727 * \see 728 * * None 729 */ 730 shr_error_e dnx_ingress_congestion_programmable_counter_vsq_init_config_set( 731 int unit, 732 bcm_core_t core); 733 734 /** 735 * \brief - Function to configure the VOQ programmable counter 736 * to track certain VOQ or VOQ bundle 737 * 738 * \param [in] unit - unit 739 * \param [in] core - core 740 * \param [in] base_voq_id - base VOQ ID 741 * \param [in] nof_voqs - number of VOQs 742 * 743 * \return 744 * See shr_error_e 745 * \remark 746 * * None 747 * \see 748 * * None 749 */ 750 shr_error_e dnx_ingress_congestion_voq_programmable_counter_configuration_set( 751 int unit, 752 int core, 753 uint32 base_voq_id, 754 uint32 nof_voqs); 755 756 /** 757 * \brief - Function to get all VOQ programmable counter 758 * statistics 759 * 760 * \param [in] unit - unit 761 * \param [in] core - core 762 * \param [out] counter_info - counter info 763 * 764 * \return 765 * See shr_error_e 766 * \remark 767 * * None 768 * \see 769 * * None 770 */ 771 shr_error_e dnx_ingress_congestion_voq_programmable_counter_info_get( 772 int unit, 773 int core, 774 dnx_ingress_congestion_counter_info_t * counter_info); 775 776 /** 777 * \brief - Function to configure the VSQ programmable counter 778 * to track certain VSQ and queue id 779 * 780 * \param [in] unit - unit 781 * \param [in] core - core 782 * \param [in] vsq_group - VSQ type 783 * \param [in] queue_id - VSQ id 784 * \param [in] queue_id_provided - is VSQ ID provided 785 * 786 * \return 787 * See shr_error_e 788 * \remark 789 * * None 790 * \see 791 * * None 792 */ 793 shr_error_e dnx_ingress_congestion_vsq_programmable_counter_configuration_set( 794 int unit, 795 int core, 796 int vsq_group, 797 int queue_id, 798 int queue_id_provided); 799 800 /** 801 * \brief - Function to get all VSQ programmable counter 802 * statistics 803 * 804 * \param [in] unit - unit index 805 * \param [in] core - core index 806 * \param [out] counter_info - counter info 807 * 808 * \return 809 * shr_error_e 810 * 811 * \remark 812 * * 813 * \see 814 * * None 815 */ 816 shr_error_e dnx_ingress_congestion_vsq_programmable_counter_info_get( 817 int unit, 818 int core, 819 dnx_ingress_congestion_counter_info_t * counter_info); 820 821 /** 822 * \brief - Function to get all the occupancy statistics for the 823 * current VOQ defined by the dbal iterator. 824 * 825 * \param [in] unit - unit index 826 * \param [in] entry_handle_id - dbal entry handle 827 * \param [out] voq_occupancy_info - occupancy info 828 * 829 * \return 830 * shr_error_e 831 * 832 * \remark 833 * * 834 * \see 835 * * None 836 */ 837 shr_error_e dnx_ingress_congestion_current_voq_occupancy_info_get( 838 int unit, 839 uint32 entry_handle_id, 840 dnx_ingress_congestion_voq_occupancy_info_t * voq_occupancy_info); 841 842 /** 843 * \brief - Function to get all the occupancy statistics for 844 * a specific VOQ. 845 * 846 * \param [in] unit - unit index 847 * \param [in] core - core id 848 * \param [in] queue_id - VOQ id 849 * \param [out] voq_occupancy_info - occupancy info 850 * 851 * \return 852 * shr_error_e 853 * 854 * \remark 855 * * 856 * \see 857 * * None 858 */ 859 shr_error_e dnx_ingress_congestion_voq_occupancy_info_get( 860 int unit, 861 int core, 862 int queue_id, 863 dnx_ingress_congestion_voq_occupancy_info_t * voq_occupancy_info); 864 865 /** 866 * \brief - Function to get all the occupancy statistics for the 867 * current VSQ and its queue id defined by the dbal iterator. 868 * 869 * \param [in] unit - unit index 870 * \param [in] entry_handle_id - dbal entry handle 871 * \param [in] vsq_group - VSQ type 872 * \param [out] vsq_non_empty_info_array - info array 873 * 874 * \return 875 * shr_error_e 876 * 877 * \remark 878 * * 879 * \see 880 * * None 881 */ 882 shr_error_e dnx_ingress_congestion_current_vsq_occupancy_info_get( 883 int unit, 884 uint32 entry_handle_id, 885 int vsq_group, 886 dnx_ingress_congestion_vsq_occupancy_info_t * vsq_non_empty_info_array); 887 888 /** print callbacks */ 889 890 /** 891 * \brief - print callback for VSQ A-D template manager 892 * 893 * \param [in] unit - unit index 894 * \param [in] data - template manager data 895 * 896 * \return 897 * shr_error_e 898 * 899 * \remark 900 * * 901 * \see 902 * * None 903 */ 904 void dnx_ingress_congestion_alloc_vsq_a_d_rate_cls_print_cb( 905 int unit, 906 const void *data); 907 /** 908 * \brief - print callback for VSQ E template manager 909 * 910 * \param [in] unit - unit index 911 * \param [in] data - template manager data 912 * 913 * \return 914 * shr_error_e 915 * 916 * \remark 917 * * 918 * \see 919 * * None 920 */ 921 void dnx_ingress_congestion_alloc_vsq_e_rate_cls_print_cb( 922 int unit, 923 const void *data); 924 /** 925 * \brief - print callback for VSQ F template manager 926 * 927 * \param [in] unit - unit index 928 * \param [in] data - template manager data 929 * 930 * \return 931 * shr_error_e 932 * 933 * \remark 934 * * 935 * \see 936 * * None 937 */ 938 void dnx_ingress_congestion_alloc_vsq_f_rate_cls_print_cb( 939 int unit, 940 const void *data); 941 942 /** 943 * \brief - print callback for TC->PG template manager 944 * 945 * \param [in] unit - unit index 946 * \param [in] data - template manager data 947 * 948 * \return 949 * shr_error_e 950 * 951 * \remark 952 * * 953 * \see 954 * * None 955 */ 956 void dnx_ingress_congestion_alloc_vsq_pg_tc_mapping_profile_print_cb( 957 int unit, 958 const void *data); 959 960 /** 961 * \brief - stop usage of dram. 962 * future APIs will not update HW regarding dram bound rate class attributes until dram usage is restored 963 * 964 * \param [in] unit - unit index 965 * 966 * \return 967 * shr_error_e 968 * 969 * \remark 970 * * this function uses both legacy and new dnx mechanisms (mbcm and dbal) 971 * \see 972 * * None 973 */ 974 shr_error_e dnx_ingress_congestion_dram_usage_stop( 975 int unit); 976 977 /** 978 * \brief - restore usage of dram, 979 * get from SW-State what should be the current state of all rate classes and set accordingly 980 * 981 * \param [in] unit - unit index 982 * 983 * \return 984 * shr_error_e 985 * 986 * \remark 987 * * this function uses both legacy and new dnx mechanisms (mbcm and dbal) 988 * \see 989 * * None 990 */ 991 shr_error_e dnx_ingress_congestion_dram_usage_restore( 992 int unit); 993 994 /** 995 * \brief - get free resource count and minimum free resources count for all resource types 996 * 997 * \param [in] unit - unit index 998 * \param [in] core - core id. 999 * \param [out] stats - all counter values read from HW. 1000 * 1001 * \return 1002 * shr_error_e 1003 * 1004 * \remark 1005 * \see 1006 * * None 1007 */ 1008 shr_error_e dnx_ingress_congestion_free_resource_counter_get( 1009 int unit, 1010 int core, 1011 dnx_ingress_congestion_statistics_info_t * stats); 1012 1013 /** 1014 * \brief - get information for last enqueued packet 1015 * 1016 * \param [in] unit - unit index 1017 * \param [in] core - relevant core 1018 * \param [out] last_cmd_info - structure with information for the last enqueued packet 1019 * 1020 * \return 1021 * shr_error_e 1022 * 1023 * \remark 1024 * \see 1025 * * None 1026 */ 1027 shr_error_e dnx_ingress_congestion_dbal_last_enqueued_cmd_info_get( 1028 int unit, 1029 int core, 1030 dnx_ingress_congestion_last_enqueued_cmd_info_t * last_cmd_info); 1031 1032 /** 1033 * \brief 1034 * Get voq dram bound state 1035 * 1036 * \param [in] unit - unit. 1037 * \param [in] core - core. 1038 * \param [in] queue_id - queue_id. 1039 * \param [out] dram_bound_status - dram_bound_status. 1040 * 1041 * \return 1042 * See shr_error_e 1043 * \remark 1044 * * None 1045 * \see 1046 * * None 1047 */ 1048 shr_error_e dnx_ingress_congestion_dbal_voq_dram_bound_state_get( 1049 int unit, 1050 int core, 1051 int queue_id, 1052 dbal_enum_value_field_dram_bound_state_e * dram_bound_status); 1053 1054 /** 1055 * \brief 1056 * Set VSQ global drop threshold 1057 * 1058 * \param [in] unit - unit. 1059 * \param [in] core_id - core id 1060 * \param [in] index_type - index type 1061 * \param [in] index_info - index info 1062 * \param [in] thresh_info - threshold info 1063 * \param [in] threshold - threshold 1064 * 1065 * \return 1066 * See shr_error_e 1067 * \remark 1068 * * None 1069 * \see 1070 * * None 1071 */ 1072 int dnx_ingress_congestion_vsq_gl_drop_threshold_set( 1073 int unit, 1074 int core_id, 1075 dnx_cosq_threshold_index_type_t index_type, 1076 dnx_cosq_threshold_index_info_t * index_info, 1077 bcm_cosq_static_threshold_info_t * thresh_info, 1078 bcm_cosq_static_threshold_t * threshold); 1079 1080 /** 1081 * \brief 1082 * Get VSQ global drop threshold 1083 * 1084 * \param [in] unit - unit. 1085 * \param [in] core_id - core id. 1086 * \param [in] index_type - index type 1087 * \param [in] index_info - index info 1088 * \param [in] thresh_info - threshold info 1089 * \param [out] threshold - threshold 1090 * 1091 * \return 1092 * See shr_error_e 1093 * \remark 1094 * * None 1095 * \see 1096 * * None 1097 */ 1098 int dnx_ingress_congestion_vsq_gl_drop_threshold_get( 1099 int unit, 1100 int core_id, 1101 dnx_cosq_threshold_index_type_t index_type, 1102 dnx_cosq_threshold_index_info_t * index_info, 1103 bcm_cosq_static_threshold_info_t * thresh_info, 1104 bcm_cosq_static_threshold_t * threshold); 1105 1106 /** 1107 * \brief 1108 * Set global threshold 1109 * 1110 * \param [in] unit - unit. 1111 * \param [in] flags - flags 1112 * \param [in] index_type - index type 1113 * \param [in] index_info - index info 1114 * \param [in] thresh_info - threshold info 1115 * \param [in] threshold - threshold 1116 * 1117 * \return 1118 * See shr_error_e 1119 * \remark 1120 * * None 1121 * \see 1122 * * None 1123 */ 1124 int dnx_ingress_congestion_global_device_static_threshold_set( 1125 int unit, 1126 uint32 flags, 1127 dnx_cosq_threshold_index_type_t index_type, 1128 dnx_cosq_threshold_index_info_t * index_info, 1129 bcm_cosq_static_threshold_info_t * thresh_info, 1130 bcm_cosq_static_threshold_t * threshold); 1131 1132 /** 1133 * \brief 1134 * Get global threshold 1135 * 1136 * \param [in] unit - unit. 1137 * \param [in] flags - flags 1138 * \param [in] index_type - index type 1139 * \param [in] index_info - index info 1140 * \param [in] thresh_info - threshold info 1141 * \param [out] threshold - threshold 1142 * 1143 * \return 1144 * See shr_error_e 1145 * \remark 1146 * * None 1147 * \see 1148 * * None 1149 */ 1150 int dnx_ingress_congestion_global_device_static_threshold_get( 1151 int unit, 1152 uint32 flags, 1153 dnx_cosq_threshold_index_type_t index_type, 1154 dnx_cosq_threshold_index_info_t * index_info, 1155 bcm_cosq_static_threshold_info_t * thresh_info, 1156 bcm_cosq_static_threshold_t * threshold); 1157 1158 /** 1159 * \brief 1160 * set FC threshold for VSQ 1161 * 1162 * \param [in] unit - unit. 1163 * \param [in] gport - gport 1164 * \param [in] cosq - cosq 1165 * \param [in] flags - flags 1166 * \param [in] pfc_threshold - FC threshold 1167 * 1168 * \return 1169 * See shr_error_e 1170 * \remark 1171 * * None 1172 * \see 1173 * * None 1174 */ 1175 int dnx_ingress_congestion_vsq_fc_threshold_set( 1176 int unit, 1177 bcm_gport_t gport, 1178 bcm_cos_queue_t cosq, 1179 uint32 flags, 1180 bcm_cosq_pfc_config_t * pfc_threshold); 1181 1182 /** 1183 * \brief 1184 * get FC threshold for VSQ 1185 * 1186 * \param [in] unit - unit. 1187 * \param [in] gport - gport 1188 * \param [in] cosq - cosq 1189 * \param [in] flags - flags 1190 * \param [out] pfc_threshold - FC threshold 1191 * 1192 * \return 1193 * See shr_error_e 1194 * \remark 1195 * * None 1196 * \see 1197 * * None 1198 */ 1199 int dnx_ingress_congestion_vsq_fc_threshold_get( 1200 int unit, 1201 bcm_gport_t gport, 1202 bcm_cos_queue_t cosq, 1203 uint32 flags, 1204 bcm_cosq_pfc_config_t * pfc_threshold); 1205 1206 /** 1207 * \brief - set rate class profile to operate only on OCB. 1208 * 1209 * \param [in] unit - The unit number. 1210 * \param [in] gport - rate class profile gport 1211 * \param [in] cosq - irrelevant here. set to 0 1212 * \param [in] is_ocb_only - indication is rate class should opearte only on OCB or OCB + DRAM. 1213 * 1214 * \return 1215 * \retval Zero if no error was detected 1216 * \retval Negative if error was detected. See \ref shr_error_e 1217 * \remark 1218 * * None 1219 * \see 1220 * dnx_ingress_congestion_gport_threshold_set 1221 */ 1222 shr_error_e dnx_ingress_congestion_voq_ocb_only_set( 1223 int unit, 1224 bcm_gport_t gport, 1225 bcm_cos_queue_t cosq, 1226 int is_ocb_only); 1227 1228 /** 1229 * \brief - Get rate class profile indication if operates only on OCB. 1230 * 1231 * \param [in] unit - The unit number. 1232 * \param [in] gport - rate class profile gport 1233 * \param [in] cosq - irrelevant here. set to 0 1234 * \param [out] is_ocb_only - indication is rate class opeartes only on OCB or OCB + DRAM. 1235 * 1236 * \return 1237 * \retval Zero if no error was detected 1238 * \retval Negative if error was detected. See \ref shr_error_e 1239 * \remark 1240 * * None 1241 * \see 1242 * dnx_ingress_congestion_gport_threshold_set 1243 */ 1244 shr_error_e dnx_ingress_congestion_voq_ocb_only_get( 1245 int unit, 1246 bcm_gport_t gport, 1247 bcm_cos_queue_t cosq, 1248 int *is_ocb_only); 1249 1250 /** 1251 * \brief - Configure global drop per DP 1252 * 1253 * \param [in] unit - The unit number. 1254 * \param [in] flags - flags to set which DP to discard. see BCM_COSQ_DISCARD_* 1255 * supported flags: 1256 * BCM_COSQ_DISCARD_ENABLE 1257 * BCM_COSQ_DISCARD_COLOR_ALL 1258 * BCM_COSQ_DISCARD_COLOR_YELLOW 1259 * BCM_COSQ_DISCARD_COLOR_RED 1260 * BCM_COSQ_DISCARD_COLOR_BLACK 1261 * 1262 * \return 1263 * \retval Zero if no error was detected 1264 * \retval Negative if error was detected. See \ref shr_error_e 1265 * \remark 1266 * * None 1267 * \see 1268 */ 1269 shr_error_e dnx_ingress_congestion_discard_set( 1270 int unit, 1271 uint32 flags); 1272 1273 /** 1274 * \brief - Configure global drop per DP 1275 * 1276 * \param [in] unit - The unit number. 1277 * \param [out] flags - indication for which DP is discarded. 1278 * 1279 * \return 1280 * \retval Zero if no error was detected 1281 * \retval Negative if error was detected. See \ref shr_error_e 1282 * \remark 1283 * * None 1284 * \see 1285 * dnx_ingress_congestion_discard_set 1286 */ 1287 shr_error_e dnx_ingress_congestion_discard_get( 1288 int unit, 1289 uint32 *flags); 1290 1291 /** 1292 * \brief - set threshold according to gport type. 1293 * 1294 * \param [in] unit - The unit number. 1295 * \param [in] gport - rate class profile gport 1296 * \param [in] cosq - irrelevant here. set to 0 1297 * \param [in] threshold - threshold info. relevant fields: 1298 * - flags => threshold specification. currently supported only BCM_COSQ_THRESHOLD_QSIZE_RECOVERY 1299 * - type => threshold type. currently supported only bcmCosqThresholdBytes. 1300 * - value => threshold value to set. 1301 * 1302 * \return 1303 * \retval Zero if no error was detected 1304 * \retval Negative if error was detected. See \ref shr_error_e 1305 * \remark 1306 * * None 1307 * \see 1308 */ 1309 shr_error_e dnx_ingress_congestion_gport_threshold_set( 1310 int unit, 1311 bcm_gport_t gport, 1312 bcm_cos_queue_t cosq, 1313 bcm_cosq_threshold_t * threshold); 1314 1315 /** 1316 * \brief - get threshold according to gport type. 1317 * 1318 * \param [in] unit - The unit number. 1319 * \param [in] gport - rate class profile gport 1320 * \param [in] cosq - irrelevant here. set to 0 1321 * \param [in,out] threshold - threshold info. 1322 * 1323 * \return 1324 * \retval Zero if no error was detected 1325 * \retval Negative if error was detected. See \ref shr_error_e 1326 * \remark 1327 * * None 1328 * \see 1329 * dnx_ingress_congestion_gport_threshold_set 1330 */ 1331 shr_error_e dnx_ingress_congestion_gport_threshold_get( 1332 int unit, 1333 bcm_gport_t gport, 1334 bcm_cos_queue_t cosq, 1335 bcm_cosq_threshold_t * threshold); 1336 1337 /** 1338 * \brief - Map VOQ to rate class profile. 1339 * 1340 * \param [in] unit - The unit number. 1341 * \param [in] core - device core id. 1342 * \param [in] voq - VOQ number to map. 1343 * \param [in] rate_class - rate class profile to map the VOQ to. 1344 * 1345 * \return 1346 * \retval Zero if no error was detected 1347 * \retval Negative if error was detected. See \ref shr_error_e 1348 * \remark 1349 * * None 1350 * \see 1351 * * None 1352 */ 1353 shr_error_e dnx_ingress_congestion_voq_to_rate_class_profile_map_set( 1354 int unit, 1355 int core, 1356 int voq, 1357 int rate_class); 1358 1359 /** 1360 * \brief - get mapped rate class profile from VOQ. 1361 * 1362 * \param [in] unit - The unit number. 1363 * \param [in] core - device core id. 1364 * \param [in] voq - VOQ number. 1365 * \param [in] rate_class - rate class profile mapped to the given VOQ. 1366 * 1367 * \return 1368 * \retval Zero if no error was detected 1369 * \retval Negative if error was detected. See \ref shr_error_e 1370 * \remark 1371 * * None 1372 * \see 1373 * * None 1374 */ 1375 shr_error_e dnx_ingress_congestion_voq_to_rate_class_profile_map_get( 1376 int unit, 1377 int core, 1378 int voq, 1379 int *rate_class); 1380 1381 /** 1382 * \brief - 1383 * retrieve VSQ information 1384 * 1385 * \param [in] unit - unit. 1386 * \param [in] vsq - vsq gport 1387 * \param [out] vsq_info - VSQ info 1388 * 1389 * \return 1390 * See shr_error_e 1391 * \remark 1392 * * None 1393 * \see 1394 * * None 1395 */ 1396 int dnx_ingress_congestion_vsq_info_get( 1397 int unit, 1398 bcm_gport_t vsq, 1399 bcm_cosq_vsq_info_t * vsq_info); 1400 1401 /** 1402 * \brief - Set DRAM bound / recovery fail thresholds (FADT). 1403 * 1404 * \param [in] unit - The unit number. 1405 * \param [in] fadt_info - which FADT threshold to set: 1406 * - gport => rate class profile gport 1407 * - cosq => not relevant. is set to 0 1408 * - resource_type => SRAM bytes / buffers / PDs 1409 * - thresh_type => dram bound / dram recovery fail 1410 * \param [in] threshold - fadt values to set. 1411 * - thresh_min => min value for FADT algorithm 1412 * - thresh_max => max value for FADT algorithm 1413 * - alpha - alpha fsctor for FADT algoritm 1414 * - resource_range_min - apply FADT algorithm only when free_res >= resource_range_min 1415 * - resource_range_max - apply FADT algorithm only when free_res <= resource_range_max. 1416 * NOTE: resource_range is not supported in all resource types. if it is not supported these values will be set to 0. 1417 * 1418 * \return 1419 * \retval Zero if no error was detected 1420 * \retval Negative if error was detected. See \ref shr_error_e 1421 * \remark 1422 * * None 1423 * \see 1424 * * None 1425 */ 1426 shr_error_e dnx_ingress_congestion_dram_bound_fadt_threshold_set( 1427 int unit, 1428 bcm_cosq_fadt_info_t * fadt_info, 1429 bcm_cosq_fadt_threshold_t * threshold); 1430 1431 /** 1432 * \brief - Get DRAM bound / recovery fail thresholds (FADT). 1433 * 1434 * \param [in] unit - The unit number. 1435 * \param [in] fadt_info - which FADT threshold to get 1436 * \param [out] threshold - fadt values to set. 1437 * 1438 * \return 1439 * \retval Zero if no error was detected 1440 * \retval Negative if error was detected. See \ref shr_error_e 1441 * \remark 1442 * * None 1443 * \see 1444 * * dnx_ingress_congestion_dram_bound_fadt_threshold_set 1445 */ 1446 shr_error_e dnx_ingress_congestion_dram_bound_fadt_threshold_get( 1447 int unit, 1448 bcm_cosq_fadt_info_t * fadt_info, 1449 bcm_cosq_fadt_threshold_t * threshold); 1450 1451 /** 1452 * \brief - Set VOQ congestion notification FADT threshold 1453 * 1454 * \param [in] unit - The unit number. 1455 * \param [in] flags - specific flags. currently no flags supported 1456 * \param [in] fadt_info - info abouth the threshold: 1457 * - gport => rate class profile gport 1458 * - cosq => not relevant. is set to 0 1459 * - resource_type => bytes / SRAM buffers / SRAM PDs 1460 * - thresh_type => congestion notification 1461 * \param [in] threshold - threshold info. 1462 * - thresh_min => min value for FADT algorithm 1463 * - thresh_max => max value for FADT algorithm 1464 * - alpha - alpha fsctor for FADT algoritm 1465 * \return 1466 * \retval Zero if no error was detected 1467 * \retval Negative if error was detected. See \ref shr_error_e 1468 * \remark 1469 * * None 1470 * \see 1471 */ 1472 shr_error_e dnx_ingress_congestion_voq_congestion_notification_fadt_threshold_set( 1473 int unit, 1474 uint32 flags, 1475 bcm_cosq_fadt_info_t * fadt_info, 1476 bcm_cosq_fadt_threshold_t * threshold); 1477 1478 /** 1479 * \brief - Get VOQ congestion notification FADT threshold 1480 * 1481 * \param [in] unit - The unit number. 1482 * \param [in] flags - specific flags. currently no flags supported 1483 * \param [in] fadt_info - info about the threshold. 1484 * \param [in,out] threshold - threshold info. 1485 * 1486 * \return 1487 * \retval Zero if no error was detected 1488 * \retval Negative if error was detected. See \ref shr_error_e 1489 * \remark 1490 * * None 1491 * \see 1492 * dnx_ingress_congestion_voq_congestion_notification_fadt_threshold_set 1493 */ 1494 shr_error_e dnx_ingress_congestion_voq_congestion_notification_fadt_threshold_get( 1495 int unit, 1496 uint32 flags, 1497 bcm_cosq_fadt_info_t * fadt_info, 1498 bcm_cosq_fadt_threshold_t * threshold); 1499 1500 /** 1501 * \brief - 1502 * convert BCM API cosq resource to internal resource 1503 * 1504 * \param [in] unit - unit. 1505 * \param [in] cosq_resource - BCM API cosq resource 1506 * \param [out] ingress_resource - internal resource 1507 * 1508 * \return 1509 * See shr_error_e 1510 * \remark 1511 * * None 1512 * \see 1513 * * None 1514 */ 1515 int dnx_ingress_congestion_cosq_resource_to_ingress_resource( 1516 int unit, 1517 bcm_cosq_resource_t cosq_resource, 1518 dnx_ingress_congestion_resource_type_e * ingress_resource); 1519 1520 /** 1521 * \brief - Set mirror on drop aging time per group type 1522 * 1523 * \param [in] unit - unit. 1524 * \param [in] type - Group type (bcmCosqControlMirrorOnDropAgingGlobal, bcmCosqControlMirrorOnDropAgingVoq, 1525 * bcmCosqControlMirrorOnDropAgingVsq) 1526 * \param [in] arg - Aging time in microseconds units 1527 * 1528 * \return 1529 * See shr_error_e 1530 * \remark 1531 * * None 1532 * \see 1533 * * None 1534 */ 1535 shr_error_e dnx_ingress_congestion_mirror_on_drop_aging_set( 1536 int unit, 1537 bcm_cosq_control_t type, 1538 int arg); 1539 1540 /** 1541 * \brief - Get mirror on drop aging time per group type 1542 * 1543 * \param [in] unit - unit. 1544 * \param [in] type - Group type (bcmCosqControlMirrorOnDropAgingGlobal, bcmCosqControlMirrorOnDropAgingVoq, 1545 * bcmCosqControlMirrorOnDropAgingVsq) 1546 * \param [out] arg - Aging time in microseconds units 1547 * 1548 * \return 1549 * See shr_error_e 1550 * \remark 1551 * * None 1552 * \see 1553 * * None 1554 */ 1555 shr_error_e dnx_ingress_congestion_mirror_on_drop_aging_get( 1556 int unit, 1557 bcm_cosq_control_t type, 1558 int *arg); 1559 1560 /** 1561 * \brief - 1562 * Gets FADT drop and guaranteed parameters - per rate-class and drop precedence. 1563 * 1564 * \param [in] unit - unit. 1565 * \param [in] gport - VOQ rate class gport 1566 * \param [in] color - DP 1567 * \param [in] flags - API flags 1568 * \param [in] get_hw - should get be done from HW 1569 * \param [out] gport_size - FADT drop and guaranteed parameters 1570 * 1571 * \return 1572 * See shr_error_e 1573 * \remark 1574 * * None 1575 * \see 1576 * * None 1577 */ 1578 shr_error_e dnx_voq_rate_class_color_size_dual_get( 1579 int unit, 1580 bcm_gport_t gport, 1581 bcm_color_t color, 1582 uint32 flags, 1583 int get_hw, 1584 bcm_cosq_gport_size_t * gport_size); 1585 1586 /** 1587 * \brief - Get DRAM bound threshold (FADT) from HW. per rate class profile 1588 * 1589 * \param [in] unit - The unit number. 1590 * \param [in] resource - resource type to set the thresholds (SRAM bytes/ buffers/ PDs). 1591 * \param [in] rt_cls - rate class profile ID 1592 * \param [out] fadt - fadt thresholds. note that for some resources, there can be a free-resources limit on the FADT algorithm. 1593 * it means the FADT algorithm will be used only when the number of free resources is between the specified MIN and MAX values. 1594 * \return 1595 * \retval Zero if no error was detected 1596 * \retval Negative if error was detected. See \ref shr_error_e 1597 * \remark 1598 * * None 1599 * \see 1600 * * None 1601 */ 1602 shr_error_e dnx_voq_rate_class_fadt_dram_bound_get( 1603 int unit, 1604 dnx_ingress_congestion_dram_bound_resource_type_e resource, 1605 uint32 rt_cls, 1606 bcm_cosq_fadt_threshold_t * fadt); 1607 1608 /** 1609 * \brief -Get DRAM recovery fail threshold (FADT) from HW. per rate class profile 1610 * 1611 * \param [in] unit - The unit number. 1612 * \param [in] resource - resource type to set the thresholds (SRAM bytes/ buffers/ PDs). 1613 * \param [in] rt_cls - rate class profile ID 1614 * \param [out] fadt - fadt thresholds. note that for some resources, there can be a free-resources limit on the FADT algorithm. 1615 * it means the FADT algorithm will be used only when the number of free resources is between the specified MIN and MAX values. 1616 * \return 1617 * \retval Zero if no error was detected 1618 * \retval Negative if error was detected. See \ref shr_error_e 1619 * \remark 1620 * * None 1621 * \see 1622 * * None 1623 */ 1624 shr_error_e dnx_voq_rate_class_fadt_dram_recovery_fail_get( 1625 int unit, 1626 dnx_ingress_congestion_dram_bound_resource_type_e resource, 1627 uint32 rt_cls, 1628 bcm_cosq_fadt_threshold_t * fadt); 1629 1630 /** 1631 * \brief - Get DRAM recovery threshold from HW. per rate class profile 1632 * 1633 * \param [in] unit - The unit number. 1634 * \param [in] rt_cls - rate class profile ID 1635 * \param [out] recovery_threshold - recovery threshold in bytes 1636 * \return 1637 * \retval Zero if no error was detected 1638 * \retval Negative if error was detected. See \ref shr_error_e 1639 * \remark 1640 * * None 1641 * \see 1642 * * None 1643 */ 1644 shr_error_e dnx_voq_rate_class_dram_recovery_get( 1645 int unit, 1646 uint32 rt_cls, 1647 uint32 *recovery_threshold); 1648 1649 /** 1650 * \brief - 1651 * get VOQ state - is the VOQ in DRAM 1652 * 1653 * \param [in] unit - unit. 1654 * \param [in] voq_gport - VOQ group gport 1655 * \param [in] cosq - queue offset 1656 * \param [out] is_in_dram - indication if the VOQ is in DRAM 1657 * 1658 * \return 1659 * See shr_error_e 1660 * \remark 1661 * * None 1662 * \see 1663 * * None 1664 */ 1665 shr_error_e dnx_ingress_congestion_voq_is_in_dram_get( 1666 int unit, 1667 bcm_gport_t voq_gport, 1668 bcm_cos_queue_t cosq, 1669 int *is_in_dram); 1670 1671 /** 1672 * \brief - 1673 * get PG params 1674 */ 1675 shr_error_e dnx_ingress_congestion_dbal_pg_params_get( 1676 int unit, 1677 int core, 1678 int pg, 1679 dnx_ingress_congestion_pg_params_t * pg_params); 1680 1681 /** 1682 * \brief - Function to get all the current occupancy statistics per VSQ ID. 1683 * 1684 * \param [in] unit - unit index 1685 * \param [in] core - device core 1686 * \param [in] vsq_group - VSQ type 1687 * \param [in] vsq_id - VSQ index 1688 * \param [in] pool_id - Shared memory pool id (relevant for VSQE) 1689 * \param [out] info - occupancy info array 1690 * 1691 * \return 1692 * shr_error_e 1693 * 1694 * \remark 1695 * * 1696 * \see 1697 * * None 1698 */ 1699 shr_error_e dnx_ingress_congestion_vsq_id_current_occupancy_info_get( 1700 int unit, 1701 int core, 1702 int vsq_group, 1703 int vsq_id, 1704 int pool_id, 1705 dnx_ingress_congestion_vsq_occupancy_info_t * info); 1706 1707 /** 1708 * \brief - Function to get all the current occupancy statistics per VSQ ID. 1709 * 1710 * \param [in] unit - unit index 1711 * \param [in] core - device core 1712 * \param [in] vsq_group - VSQ type 1713 * \param [in] vsq_id - VSQ index 1714 * \param [in] pool_id - Shared memory pool id (relevant for VSQE) 1715 * \param [out] info - max occupancy info array 1716 * 1717 * \return 1718 * shr_error_e 1719 * 1720 * \remark 1721 * * 1722 * \see 1723 * * None 1724 */ 1725 shr_error_e dnx_ingress_congestion_vsq_id_max_occupancy_info_get( 1726 int unit, 1727 int core, 1728 int vsq_group, 1729 int vsq_id, 1730 int pool_id, 1731 dnx_ingress_congestion_vsq_occupancy_info_t * info); 1732 1733 /** 1734 * \brief - Function get the appropriate DBAL table and fields from the COSQ resource format 1735 * 1736 * \par DIRECT_INPUT: 1737 * \param [in] unit - unit id 1738 * \param [in] cosq_resource - COSQ resource 1739 * \param [out] table - DBAL table 1740 * \param [out] thresh_field - DBAL field for SET threshold, CLEAR threshold is the same 1741 * 1742 * \remark 1743 * * None 1744 * \see 1745 * * None 1746 */ 1747 shr_error_e dnx_cosq_voq_gl_ecn_resource_to_dbal_info( 1748 int unit, 1749 bcm_cosq_resource_t cosq_resource, 1750 dbal_tables_e * table, 1751 dbal_fields_e * thresh_field); 1752 1753 /** 1754 * \brief - Function set the thresholds for ECN marking from global resources. 1755 * 1756 * \par DIRECT_INPUT: 1757 * \param [in] unit - unit id 1758 * \param [in] core_id - Core ID 1759 * \param [in] index_type - indicates the type of the index according to which priority is determined 1760 * \param [in] index_info - additional information derived from the index 1761 * \param [in] thresh_info - complementary information describing the threshold to be set 1762 * \param [in] threshold - threshold value 1763 * 1764 * \remark 1765 * * None 1766 * \see 1767 * * None 1768 */ 1769 shr_error_e dnx_ingress_congestion_global_ecn_marking_threshold_set( 1770 int unit, 1771 int core_id, 1772 dnx_cosq_threshold_index_type_t index_type, 1773 dnx_cosq_threshold_index_info_t * index_info, 1774 bcm_cosq_static_threshold_info_t * thresh_info, 1775 bcm_cosq_static_threshold_t * threshold); 1776 1777 /** 1778 * \brief - Function get the thresholds for ECN marking from global resources. 1779 * 1780 * \par DIRECT_INPUT: 1781 * \param [in] unit - unit id 1782 * \param [in] core_id - Core ID 1783 * \param [in] index_type - indicates the type of the index according to which priority is determined 1784 * \param [in] index_info - additional information derived from the index 1785 * \param [in] thresh_info - complementary information describing the threshold to be set 1786 * \param [out] threshold - threshold value 1787 * 1788 * \remark 1789 * * None 1790 * \see 1791 * * None 1792 */ 1793 shr_error_e dnx_ingress_congestion_global_ecn_marking_threshold_get( 1794 int unit, 1795 int core_id, 1796 dnx_cosq_threshold_index_type_t index_type, 1797 dnx_cosq_threshold_index_info_t * index_info, 1798 bcm_cosq_static_threshold_info_t * thresh_info, 1799 bcm_cosq_static_threshold_t * threshold); 1800 1801 /** } */ 1802 #endif /*_DNX_INGRESS_CONGESTION_H_INCLUDED_*/