cosq.h (322328B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_COSQ_H__ 11 #define __BCM_COSQ_H__ 12 13 #include <bcm/types.h> 14 #include <bcm/fabric.h> 15 #include <bcm/field.h> 16 #include <bcm/switch.h> 17 #include <shared/port.h> 18 19 #ifndef BCM_HIDE_DISPATCHABLE 20 21 /* Initialize the CoSQ subsystem. */ 22 extern int bcm_cosq_init( 23 int unit); 24 25 /* De-initialize the CoSQ subsystem. */ 26 extern int bcm_cosq_detach( 27 int unit); 28 29 /* Configure the number of Class of Service Queues (COSQs). */ 30 extern int bcm_cosq_config_set( 31 int unit, 32 int numq); 33 34 /* Configure the number of Class of Service Queues (COSQs). */ 35 extern int bcm_cosq_config_get( 36 int unit, 37 int *numq); 38 39 /* Get or set the mapping from internal priority to CoS queue. */ 40 extern int bcm_cosq_mapping_set( 41 int unit, 42 bcm_cos_t priority, 43 bcm_cos_queue_t cosq); 44 45 /* Get or set the mapping from internal priority to CoS queue. */ 46 extern int bcm_cosq_mapping_get( 47 int unit, 48 bcm_cos_t priority, 49 bcm_cos_queue_t *cosq); 50 51 #endif /* BCM_HIDE_DISPATCHABLE */ 52 53 /* 1st dimension. */ 54 typedef struct bcm_cosq_fadt_threshold_s { 55 uint32 thresh_min; /* minimum value of the FADT threshold */ 56 uint32 thresh_max; /* maximum value of the FADT threshold */ 57 int alpha; /* alpha parameter of the FADT threshold */ 58 uint32 resource_range_min; /* minimum limit of resource range */ 59 uint32 resource_range_max; /* maximum limit of resource range */ 60 } bcm_cosq_fadt_threshold_t; 61 62 /* Config parameters for Priority flow control */ 63 typedef struct bcm_cosq_pfc_config_s { 64 int xoff_threshold; /* Assert backpressure when number of 65 buffers used is at or above this 66 threshold. */ 67 int xon_threshold; /* Remove backpressure when number of 68 buffers used drops below this 69 threshold. */ 70 bcm_cosq_fadt_threshold_t xoff_fadt_threshold; /* Assert backpressure when number of 71 resources used is at or above this 72 FADT threshold. */ 73 int xon_fadt_offset; /* Remove backpressure when number of 74 resources used drops below FADT 75 threshold defined by 76 xoff_fadt_threshold - fadt_offset. */ 77 int xon_fadt_floor; /* Remove backpressure in FADT mode when 78 number of resources used drops below 79 this threshold. */ 80 int xoff_threshold_bd; /* Assert backpressure when number of 81 buffer descriptors used is at or 82 above this threshold. */ 83 int xon_threshold_bd; /* Remove backpressure when number of 84 buffer descriptors used drops below 85 this threshold. */ 86 int drop_threshold; /* Drop packets when number of buffers 87 used hit this threshold. */ 88 int reserved_buffers; /* Number of buffers reserved for the 89 specified priority group. */ 90 int lossless; /* lossless PFC enable for the specified 91 priority group. */ 92 } bcm_cosq_pfc_config_t; 93 94 #ifndef BCM_HIDE_DISPATCHABLE 95 96 /* Configure Priority-Based Flow Control (PFC). */ 97 extern int bcm_cosq_pfc_config_set( 98 int unit, 99 bcm_gport_t gport, 100 bcm_cos_queue_t cosq, 101 uint32 flags, 102 bcm_cosq_pfc_config_t *config); 103 104 /* Configure Priority-Based Flow Control (PFC). */ 105 extern int bcm_cosq_pfc_config_get( 106 int unit, 107 bcm_gport_t gport, 108 bcm_cos_queue_t cosq, 109 uint32 flags, 110 bcm_cosq_pfc_config_t *config); 111 112 /* Get or set the mapping from internal priority to CoS queue. */ 113 extern int bcm_cosq_port_mapping_set( 114 int unit, 115 bcm_port_t port, 116 bcm_cos_t priority, 117 bcm_cos_queue_t cosq); 118 119 /* Get or set the mapping from internal priority to CoS queue. */ 120 extern int bcm_cosq_port_mapping_get( 121 int unit, 122 bcm_port_t port, 123 bcm_cos_t priority, 124 bcm_cos_queue_t *cosq); 125 126 /* 127 * Get or set the mapping of multiple internal priorities to their 128 * corresponding CoS queues. 129 */ 130 extern int bcm_cosq_port_mapping_multi_set( 131 int unit, 132 bcm_port_t port, 133 int count, 134 bcm_cos_t *priority_array, 135 bcm_cos_queue_t *cosq_array); 136 137 /* 138 * Get or set the mapping of multiple internal priorities to their 139 * corresponding CoS queues. 140 */ 141 extern int bcm_cosq_port_mapping_multi_get( 142 int unit, 143 bcm_port_t port, 144 int count, 145 bcm_cos_t *priority_array, 146 bcm_cos_queue_t *cosq_array); 147 148 #endif /* BCM_HIDE_DISPATCHABLE */ 149 150 /* parameters for congestion mapping */ 151 typedef struct bcm_cosq_congestion_mapping_info_s { 152 bcm_cos_t flow_control_bits[BCM_COS_COUNT]; /* Valid flow control bits in Fabric 153 0(Invalid), 1(Valid), -1(ignore). */ 154 } bcm_cosq_congestion_mapping_info_t; 155 156 /* Initialize a CoSQ congestion mapping information structure. */ 157 extern void bcm_cosq_congestion_mapping_info_t_init( 158 bcm_cosq_congestion_mapping_info_t *config); 159 160 #ifndef BCM_HIDE_DISPATCHABLE 161 162 /* 163 * Set/Get flow control bits as per valid cos values for the connected 164 * fabric module. 165 */ 166 extern int bcm_cosq_congestion_mapping_set( 167 int unit, 168 int fabric_modid, 169 bcm_cosq_congestion_mapping_info_t *mapping_info); 170 171 /* 172 * Set/Get flow control bits as per valid cos values for the connected 173 * fabric module. 174 */ 175 extern int bcm_cosq_congestion_mapping_get( 176 int unit, 177 int fabric_modid, 178 bcm_cosq_congestion_mapping_info_t *mapping_info); 179 180 #endif /* BCM_HIDE_DISPATCHABLE */ 181 182 /* Class of Service policies. */ 183 #define BCM_COSQ_NONE 0x0 /* Pass through. */ 184 #define BCM_COSQ_STRICT 0x01 /* Weights are ignored. */ 185 #define BCM_COSQ_ROUND_ROBIN 0x02 /* Weights are ignored. */ 186 #define BCM_COSQ_WEIGHTED_ROUND_ROBIN 0x03 187 #define BCM_COSQ_WEIGHTED_FAIR_QUEUING 0x04 188 #define BCM_COSQ_DEFICIT_ROUND_ROBIN 0x05 /* XGS3 only. */ 189 #define BCM_COSQ_BOUNDED_DELAY 0x06 /* Strata only. */ 190 #define BCM_COSQ_SP BCM_COSQ_STRICT /* Strict priority. */ 191 #define BCM_COSQ_EF 0x07 /* Expedited forwarding. */ 192 #define BCM_COSQ_AF 0x08 /* Assured forwarding. */ 193 #define BCM_COSQ_SP_GLOBAL 0x09 194 #define BCM_COSQ_BE 0x0A /* Best effort. */ 195 #define BCM_COSQ_CALENDAR 0x0B /* Calendar based 196 scheduling discipline. */ 197 #define BCM_COSQ_SP0 0x0C /* Strict priority level 198 0. */ 199 #define BCM_COSQ_SP1 0x0D /* Strict priority level 200 1. */ 201 #define BCM_COSQ_SP2 0x0E /* Strict priority level 202 2. */ 203 #define BCM_COSQ_SP3 0x0F /* Strict priority level 204 3. */ 205 #define BCM_COSQ_SP4 0x10 /* Strict priority level 206 4. */ 207 #define BCM_COSQ_SP5 0x11 /* Strict priority level 208 5. */ 209 #define BCM_COSQ_SP6 0x12 /* Strict priority level 210 6. */ 211 #define BCM_COSQ_SP7 0x13 /* Strict priority level 212 7. */ 213 #define BCM_COSQ_SP8 0x14 /* Strict priority level 214 8. */ 215 #define BCM_COSQ_SP9 0x15 /* Strict priority level 216 9. */ 217 #define BCM_COSQ_SP10 0x16 /* Strict priority level 218 10. */ 219 #define BCM_COSQ_AF0 0x17 /* Assured forwarding 220 level 0. */ 221 #define BCM_COSQ_AF1 0x18 /* Assured forwarding 222 level 1. */ 223 #define BCM_COSQ_AF2 0x19 /* Assured forwarding 224 level 2. */ 225 #define BCM_COSQ_AF3 0x1A /* Assured forwarding 226 level 3. */ 227 #define BCM_COSQ_AF4 0x1B /* Assured forwarding 228 level 4. */ 229 #define BCM_COSQ_AF5 0x1C /* Assured forwarding 230 level 5. */ 231 #define BCM_COSQ_AF6 0x1D /* Assured forwarding 232 level 6. */ 233 #define BCM_COSQ_AF7 0x1E /* Assured forwarding 234 level 7. */ 235 #define BCM_COSQ_GSP0 0x1F /* Global Strict priority 236 level 0. */ 237 #define BCM_COSQ_GSP1 0x20 /* Global Strict priority 238 level 1. */ 239 #define BCM_COSQ_GSP2 0x21 /* Global Strict priority 240 level 2. */ 241 #define BCM_COSQ_GSP3 0x22 /* Global Strict priority 242 level 3. */ 243 #define BCM_COSQ_GSP4 0x23 /* Global Strict priority 244 level 4. */ 245 #define BCM_COSQ_GSP5 0x24 /* Global Strict priority 246 level 5. */ 247 #define BCM_COSQ_GSP6 0x25 /* Global Strict priority 248 level 6. */ 249 #define BCM_COSQ_GSP7 0x26 /* Global Strict priority 250 level 7. */ 251 #define BCM_COSQ_GSP8 0x27 /* Global Strict priority 252 level 8. */ 253 #define BCM_COSQ_GSP9 0x28 /* Global Strict priority 254 level 9. */ 255 #define BCM_COSQ_GSP10 0x29 /* Global Strict priority 256 level 10. */ 257 #define BCM_COSQ_DELAY_TOLERANCE_NORMAL 0x2A /* Delay tolerance is 258 normal */ 259 #define BCM_COSQ_DELAY_TOLERANCE_LOW_DELAY 0x2B /* Delay tolerance is low 260 delay */ 261 #define BCM_COSQ_DELAY_TOLERANCE_02 0x2C /* Flexible delay 262 tolerance level. 263 Mainly needed for 264 interfaces with rates 265 higher than 10G (e.g. 266 Interlaken) */ 267 #define BCM_COSQ_DELAY_TOLERANCE_03 0x2D /* Flexible delay 268 tolerance level. 269 Mainly needed for 270 interfaces with rates 271 higher than 10G (e.g. 272 Interlaken) */ 273 #define BCM_COSQ_DELAY_TOLERANCE_04 0x2E /* Flexible delay 274 tolerance level. 275 Mainly needed for 276 interfaces with rates 277 higher than 10G (e.g. 278 Interlaken) */ 279 #define BCM_COSQ_DELAY_TOLERANCE_05 0x2F /* Flexible delay 280 tolerance level. 281 Mainly needed for 282 interfaces with rates 283 higher than 10G (e.g. 284 Interlaken) */ 285 #define BCM_COSQ_DELAY_TOLERANCE_06 0x30 /* Flexible delay 286 tolerance level. 287 Mainly needed for 288 interfaces with rates 289 higher than 10G (e.g. 290 Interlaken) */ 291 #define BCM_COSQ_DELAY_TOLERANCE_07 0x31 /* Flexible delay 292 tolerance level. 293 Mainly needed for 294 interfaces with rates 295 higher than 10G (e.g. 296 Interlaken) */ 297 #define BCM_COSQ_DELAY_TOLERANCE_08 0x32 /* Flexible delay 298 tolerance level. */ 299 #define BCM_COSQ_DELAY_TOLERANCE_09 0x33 /* Flexible delay 300 tolerance level. */ 301 #define BCM_COSQ_DELAY_TOLERANCE_10 0x34 /* Flexible delay 302 tolerance level */ 303 #define BCM_COSQ_DELAY_TOLERANCE_11 0x35 /* Flexible delay 304 tolerance level */ 305 #define BCM_COSQ_DELAY_TOLERANCE_12 0x36 /* Flexible delay 306 tolerance level */ 307 #define BCM_COSQ_DELAY_TOLERANCE_13 0x37 /* Flexible delay 308 tolerance level */ 309 #define BCM_COSQ_DELAY_TOLERANCE_14 0x38 /* Flexible delay 310 tolerance level */ 311 #define BCM_COSQ_DELAY_TOLERANCE_15 0x39 /* Flexible delay 312 tolerance level */ 313 #define BCM_COSQ_PON_DROPDOWN 0x3A /* Weights for EPON DBA 314 Dropdown. */ 315 #define BCM_COSQ_DELAY_TOLERANCE_10G_SLOW_ENABLED 0x3B /* Adjusted for slow 316 enabled 10Gb ports */ 317 #define BCM_COSQ_DELAY_TOLERANCE_10G_LOW_DELAY 0x3C /* Adjusted for low delay 318 10Gb ports */ 319 #define BCM_COSQ_DELAY_TOLERANCE_1G 0x3D /* Adjusted for 1Gb ports */ 320 #define BCM_COSQ_DELAY_TOLERANCE_40G_SLOW_ENABLED 0x3E /* Adjusted for slow 321 enabled 40Gb ports */ 322 #define BCM_COSQ_DELAY_TOLERANCE_40G_LOW_DELAY 0x3F /* Adjusted for low delay 323 40Gb ports */ 324 #define BCM_COSQ_DELAY_TOLERANCE_100G_SLOW_ENABLED 0x40 /* Adjusted for slow 325 enabled 100Gb ports */ 326 #define BCM_COSQ_DELAY_TOLERANCE_100G_LOW_DELAY 0x41 /* Adjusted for low delay 327 100Gb ports */ 328 #define BCM_COSQ_DELAY_TOLERANCE_200G_SLOW_ENABLED 0x42 /* Adjusted for slow 329 enabled 200Gb ports */ 330 #define BCM_COSQ_DELAY_TOLERANCE_200G_LOW_DELAY 0x43 /* Adjusted for low delay 331 200Gb ports */ 332 #define BCM_COSQ_DELAY_TOLERANCE_SET_COMMON_STATUS_MSG -2 /* sets the status 333 message generation 334 period, in the common 335 status message mode */ 336 #define BCM_COSQ_MAX 0x43 337 #define BCM_COSQ_DELAY_TOLERANCE_16 0x44 /* Flexible delay 338 tolerance level */ 339 #define BCM_COSQ_DELAY_TOLERANCE_17 0x45 /* Flexible delay 340 tolerance level */ 341 #define BCM_COSQ_DELAY_TOLERANCE_18 0x46 /* Flexible delay 342 tolerance level */ 343 #define BCM_COSQ_DELAY_TOLERANCE_19 0x47 /* Flexible delay 344 tolerance level */ 345 #define BCM_COSQ_DELAY_TOLERANCE_20 0x48 /* Flexible delay 346 tolerance level */ 347 #define BCM_COSQ_DELAY_TOLERANCE_21 0x49 /* Flexible delay 348 tolerance level */ 349 #define BCM_COSQ_DELAY_TOLERANCE_22 0x4A /* Flexible delay 350 tolerance level */ 351 #define BCM_COSQ_DELAY_TOLERANCE_23 0x4B /* Flexible delay 352 tolerance level */ 353 354 #define BCM_COSQ_WEIGHT_UNLIMITED -1 355 #define BCM_COSQ_WEIGHT_STRICT 0 356 #define BCM_COSQ_WEIGHT_MIN 1 357 358 #define BCM_COSQ_PRIO_VALID(prio) ((prio) >= 0 && (prio < 8)) 359 360 #define BCM_COSQ_QUEUE_VALID(unit, numq) \ 361 ((numq) >= 0 && (numq) < NUM_COS(unit)) 362 363 #ifndef BCM_HIDE_DISPATCHABLE 364 365 /* Get or set Class of Service policy, weights and delay. */ 366 extern int bcm_cosq_sched_set( 367 int unit, 368 int mode, 369 const int weights[BCM_COS_COUNT], 370 int delay); 371 372 /* Get or set Class of Service policy, weights and delay. */ 373 extern int bcm_cosq_port_sched_set( 374 int unit, 375 bcm_pbmp_t pbm, 376 int mode, 377 const int weights[BCM_COS_COUNT], 378 int delay); 379 380 /* Get or set Class of Service policy, weights and delay. */ 381 extern int bcm_cosq_sched_get( 382 int unit, 383 int *mode, 384 int weights[BCM_COS_COUNT], 385 int *delay); 386 387 /* Get or set Class of Service policy, weights and delay. */ 388 extern int bcm_cosq_port_sched_get( 389 int unit, 390 bcm_pbmp_t pbm, 391 int *mode, 392 int weights[BCM_COS_COUNT], 393 int *delay); 394 395 /* Get or set Class of Service policy, weights and delay. */ 396 extern int bcm_cosq_sched_config_set( 397 int unit, 398 int mode, 399 int weight_arr_size, 400 int *weights); 401 402 /* Get or set Class of Service policy, weights and delay. */ 403 extern int bcm_cosq_port_sched_config_set( 404 int unit, 405 bcm_pbmp_t pbm, 406 int mode, 407 int weight_arr_size, 408 int *weights); 409 410 /* Get or set Class of Service policy, weights and delay. */ 411 extern int bcm_cosq_sched_config_get( 412 int unit, 413 int weight_arr_size, 414 int *weights, 415 int *weight_arr_count, 416 int *mode); 417 418 /* Get or set Class of Service policy, weights and delay. */ 419 extern int bcm_cosq_port_sched_config_get( 420 int unit, 421 bcm_pbmp_t pbm, 422 int weight_arr_size, 423 int *weights, 424 int *weight_arr_count, 425 int *mode); 426 427 /* Retrieve maximum weights for given CoS policy. */ 428 extern int bcm_cosq_sched_weight_max_get( 429 int unit, 430 int mode, 431 int *weight_max); 432 433 #endif /* BCM_HIDE_DISPATCHABLE */ 434 435 #define BCM_COSQ_ALL 0x00000001 436 #define BCM_COSQ_BW_EAV_MODE 0x00000008 /* Prioritize selected 437 queue(s) for bandwidth 438 before non-selected 439 queue(s). */ 440 #define BCM_COSQ_BW_LLFC 0x00000010 /* Link Level Flow 441 Control setting */ 442 #define BCM_COSQ_BW_PACKET_MODE 0x00000020 /* The bandwidth 443 specified is in 444 packets per second 445 instead of kbits per 446 second */ 447 #define BCM_COSQ_BW_NOT_COMMIT 0x00000040 /* Set rate to SW DB 448 only, commit to HW is 449 done when calling the 450 API with the same 451 GPort type and without 452 NOT_COMMIT flag. */ 453 #define BCM_COSQ_BW_EAV_TAS_MODE 0x00000080 /* Avoid burstiness when 454 gate is opening or 455 after queue is empty. */ 456 #define BCM_COSQ_BW_TAS_TOKEN_FREEZE 0x00000100 /* Freeze shaper token 457 when gate is closed to 458 avoid burstiness. */ 459 #define BCM_COSQ_BW_ALT_CALC 0x00000200 /* Use alternative 460 building algorithm for 461 bandwidth calculation. */ 462 #define BCM_COSQ_BW_FABRIC_ADJUST_CONFIG_SHARED 0x00000400 /* Indicates we want to 463 config shared DRM. */ 464 #define BCM_COSQ_BW_BURST_CALCULATE 0x00000800 /* Re-calculate burst 465 based on configured 466 rate. */ 467 #define BCM_COSQ_BW_ROUND_TO_CLOSEST 0x00001000 /* Round up or down to 468 the closest number. */ 469 470 #ifndef BCM_HIDE_DISPATCHABLE 471 472 /* Configure a port's bandwidth distribution among CoS queues. */ 473 extern int bcm_cosq_port_bandwidth_set( 474 int unit, 475 bcm_port_t port, 476 bcm_cos_queue_t cosq, 477 uint32 kbits_sec_min, 478 uint32 kbits_sec_max, 479 uint32 flags); 480 481 /* Configure a port's bandwidth distribution among CoS queues. */ 482 extern int bcm_cosq_port_bandwidth_get( 483 int unit, 484 bcm_port_t port, 485 bcm_cos_queue_t cosq, 486 uint32 *kbits_sec_min, 487 uint32 *kbits_sec_max, 488 uint32 *flags); 489 490 #endif /* BCM_HIDE_DISPATCHABLE */ 491 492 /* Discard (WRED) related flags. */ 493 #define BCM_COSQ_DISCARD_ENABLE 0x0001 494 #define BCM_COSQ_DISCARD_CAP_AVERAGE 0x0002 495 #define BCM_COSQ_DISCARD_NONTCP 0x0004 496 #define BCM_COSQ_DISCARD_GRANULARITY_1K 0x0008 /* Threshold values are 497 expected in 1K 498 granularity */ 499 #define BCM_COSQ_DISCARD_COLOR_GREEN 0x0100 500 #define BCM_COSQ_DISCARD_COLOR_YELLOW 0x0200 501 #define BCM_COSQ_DISCARD_COLOR_RED 0x0400 502 #define BCM_COSQ_DISCARD_COLOR_BLACK 0x0800 503 #define BCM_COSQ_DISCARD_COLOR_ALL 0x0F00 504 #define BCM_COSQ_DISCARD_DROP_FIRST BCM_COSQ_DISCARD_COLOR_RED 505 #define BCM_COSQ_DISCARD_PACKETS 0x1000 506 #define BCM_COSQ_DISCARD_BYTES 0x2000 507 #define BCM_COSQ_DISCARD_MARK_CONGESTION 0x4000 508 #define BCM_COSQ_DISCARD_PORT 0x8000 509 #define BCM_COSQ_DISCARD_DEVICE 0x10000 510 #define BCM_COSQ_DISCARD_BUFFER_DESC 0x20000 511 #define BCM_COSQ_DISCARD_TCP 0x40000 512 #define BCM_COSQ_DISCARD_SYSTEM 0x80000 513 #define BCM_COSQ_DISCARD_PROBABILITY1 0x100000 514 #define BCM_COSQ_DISCARD_PROBABILITY2 0x200000 515 #define BCM_COSQ_DISCARD_IFP 0x400000 516 #define BCM_COSQ_DISCARD_OUTER_CFI 0x800000 517 #define BCM_COSQ_DISCARD_ECT_MARKED 0x2000000 /* WCS for ECT Marked 518 packets */ 519 #define BCM_COSQ_DISCARD_RESPONSIVE_DROP 0x4000000 /* WCS for Responsive 520 Drop packets */ 521 #define BCM_COSQ_DISCARD_NON_RESPONSIVE_DROP 0x8000000 /* WCS for Non-Responsive 522 Drop packets */ 523 #define BCM_COSQ_DISCARD_EGRESS 0x10000000 524 #define BCM_COSQ_DISCARD_POOL_0 0x20000000 /* Apply on pool 0 */ 525 #define BCM_COSQ_DISCARD_POOL_1 0x40000000 /* Apply on pool 1 */ 526 527 #ifndef BCM_HIDE_DISPATCHABLE 528 529 /* Configure Weighted Random Early Discard (WRED). */ 530 extern int bcm_cosq_discard_set( 531 int unit, 532 uint32 flags); 533 534 /* Configure Weighted Random Early Discard (WRED). */ 535 extern int bcm_cosq_discard_get( 536 int unit, 537 uint32 *flags); 538 539 /* Configure a port's Weighted Random Early Discard (WRED) parameters. */ 540 extern int bcm_cosq_discard_port_set( 541 int unit, 542 bcm_port_t port, 543 bcm_cos_queue_t cosq, 544 uint32 color, 545 int drop_start, 546 int drop_slope, 547 int average_time); 548 549 /* Configure a port's Weighted Random Early Discard (WRED) parameters. */ 550 extern int bcm_cosq_discard_port_get( 551 int unit, 552 bcm_port_t port, 553 bcm_cos_queue_t cosq, 554 uint32 color, 555 int *drop_start, 556 int *drop_slope, 557 int *average_time); 558 559 #endif /* BCM_HIDE_DISPATCHABLE */ 560 561 /* 562 * Definitions for queue priorities. Used for end-to-end scheduler flow 563 * control configuration and for threshold setting 564 */ 565 #define BCM_COSQ_HIGH_PRIORITY -4 566 #define BCM_COSQ_LOW_PRIORITY -5 567 568 /* flags for various admission tests */ 569 #define BCM_COSQ_CONTROL_ADMISSION_CT 0x0001 /* Category */ 570 #define BCM_COSQ_CONTROL_ADMISSION_CTTC 0x0002 /* category, traffic class */ 571 #define BCM_COSQ_CONTROL_ADMISSION_CTCC 0x0004 /* category, connection class */ 572 #define BCM_COSQ_CONTROL_ADMISSION_ST 0x0008 /* statistics tag */ 573 #define BCM_COSQ_CONTROL_ADMISSION_LLFC 0x0010 574 #define BCM_COSQ_CONTROL_ADMISSION_PFC 0x0020 575 576 /* 577 * Definitions used to select a specific configuration knob for OBM 578 * buffer thresholds configuration 579 */ 580 #define BCM_COSQ_OBM_CLASS_LOSSLESS0 0 /* used for configuring 581 thresholds for traffic 582 class lossless0. */ 583 #define BCM_COSQ_OBM_CLASS_LOSSLESS1 1 /* used for configuring 584 thresholds for traffic 585 class lossless1. */ 586 #define BCM_COSQ_OBM_CLASS_LOSSY_LOW 2 /* used for configuring 587 thresholds for traffic 588 class lossy low. */ 589 #define BCM_COSQ_OBM_CLASS_LOSSY 3 /* used for configuring 590 combined thresholds for 591 traffic classes lossy low 592 and lossy high. */ 593 #define BCM_COSQ_OBM_CLASS_EXPRESS 4 /* used for configuring 594 thresholds for traffic 595 class express. */ 596 #define BCM_COSQ_OBM_CLASS_ALL 5 /* used for configuring 597 combined thresholds for 598 all traffic classes. */ 599 600 /* Definitions for ADT group priority */ 601 #define BCM_COSQ_ADT_PRI_GROUP_MIDDLE 0 /* Queues that neither 602 trigger nor are subject to 603 adaptive alpha change. */ 604 #define BCM_COSQ_ADT_PRI_GROUP_LOW 1 /* Queues that their burst 605 absorption (alpha) is 606 adaptively changed to 607 provide space for high 608 priority queues. */ 609 #define BCM_COSQ_ADT_PRI_GROUP_HIGH 2 /* Queues that get precedence 610 in buffer usage by 611 triggering changes in low 612 priority queues alpha. */ 613 614 /* Features that can be controlled on a gport/cosq basis. */ 615 typedef enum bcm_cosq_control_e { 616 bcmCosqControlFabricConnectMinUtilization = 0, /* percentage of minimum utilization 617 before connection is established. */ 618 bcmCosqControlFabricConnectMaxTime = 1, /* timeout configuration for minimum 619 utilization connection setting. */ 620 bcmCosqControlBandwidthBurstMax = 2, /* kbits burst for maximum rate 621 restriction if different from default 622 burst size. */ 623 bcmCosqControlBandwidthBurstMin = 3, /* Burst for maximum rate restriction in 624 kbits (for DNX [MZ] devices, check 625 documentation for burst max units). */ 626 bcmCosqControlFabricConnectMax = 4, /* length a queue retains its fabric 627 connection */ 628 bcmCosqControlSchedulable = 14, /* Allow TX scheduling of packets in the 629 queue. */ 630 bcmCosqControlPacketLengthAdjust = 16, /* positive or negative queue packet 631 length adjustment in bytes */ 632 bcmCosqControlCongestionManagedQueue = 17, /* Congestion managed queue identifier */ 633 bcmCosqControlCongestionFeedbackWeight = 18, /* Congestion feedback weight */ 634 bcmCosqControlCongestionSetPoint = 19, /* Congestion point queue size set point */ 635 bcmCosqControlCongestionSampleBytesMin = 20, /* Minimum number of bytes to enqueue 636 between congestion status sampling */ 637 bcmCosqControlCongestionSampleBytesMax = 21, /* Maximum number of bytes to enqueue 638 between congestion status sampling */ 639 bcmCosqControlFabricPortIngressScheduler = 22, /* Associating ingress scheduler node 640 with Fabric/Child gport */ 641 bcmCosqControlFlowControlPriority = 23, /* Flow Control Mapping to port level HR 642 end-to-end scheduler. For end-to-end 643 port scheduler only 644 BCM_COSQ_HIGH_PRIORITY value is 645 meaningful for arg parameter. */ 646 bcmCosqControlSpLevelMax = 24, /* Retreive Max SP level of a scheduler 647 Element */ 648 bcmCosqControlSp0WeightMax = 25, /* For a Scheduler Element, retreive the 649 Max weight support for SP level 0 */ 650 bcmCosqControlSp1WeightMax = 26, /* For a Scheduler Element, retreive the 651 Max weight support for SP level 1 */ 652 bcmCosqControlSp2WeightMax = 27, /* For a Scheduler Element, retreive the 653 Max weight support for SP level 2 */ 654 bcmCosqControlSp3WeightMax = 28, /* For a Scheduler Element, retreive the 655 Max weight support for SP level 3 */ 656 bcmCosqControlSp4WeightMax = 29, /* For a Scheduler Element, retreive the 657 Max weight support for SP level 4 */ 658 bcmCosqControlSp5WeightMax = 30, /* For a Scheduler Element, retreive the 659 Max weight support for SP level 5 */ 660 bcmCosqControlSp6WeightMax = 31, /* For a Scheduler Element, retreive the 661 Max weight support for SP level 6 */ 662 bcmCosqControlSp7WeightMax = 32, /* For a Scheduler Element, retreive the 663 Max weight support for SP level 7 */ 664 bcmCosqControlSp8WeightMax = 33, /* For a Scheduler Element, retreive the 665 Max weight support for SP level 8 */ 666 bcmCosqControlSp9WeightMax = 34, /* For a Scheduler Element, retreive the 667 Max weight support for SP level 9 */ 668 bcmCosqControlSp10WeightMax = 35, /* For a Scheduler Element, retreive the 669 Max weight support for SP level 10 */ 670 bcmCosqControlDropLimitAlpha = 36, /* Congestion drop limit alpha */ 671 bcmCosqControlDropLimitBytes = 37, /* Congestion drop limit bytes */ 672 bcmCosqControlResumeLimitBytes = 38, /* Resume traffic flow from Congestion 673 drop */ 674 bcmCosqControlYellowDropLimitBytes = 39, /* Congestion yellow drop limit bytes */ 675 bcmCosqControlRedDropLimitBytes = 40, /* Congestion red drop limit bytes */ 676 bcmCosqControlQselOffset = 41, /* associate qsel_offset_id */ 677 bcmCosqControlEgressFlowControlThreshold0 = 42, /* Boundary before which all traffic 678 flows */ 679 bcmCosqControlEgressFlowControlThreshold1 = 43, /* Boundary for some traffic throttling */ 680 bcmCosqControlEgressFlowControlThreshold2 = 44, /* Boundary for higher traffic 681 throttling */ 682 bcmCosqControlEgressFlowControlThreshold3 = 45, /* Boundary after which all traffic 683 drops */ 684 bcmCosqControlFabricPortScheduler = 46, /* Associating scheduler node with 685 Fabric/Child gport */ 686 bcmCosqControlClassMap = 47, /* Associate an Egress Cos to a specific 687 resource */ 688 bcmCosqControlSchedulerAdoptAllPriority = 48, /* Scheduler node priority adoption 689 scheme, 1 - adopt all priorities, 0 - 690 standard behaviour */ 691 bcmCosqControlEgressPool = 49, /* Associate an Egress Cos to a specific 692 service pool under both Hierarchical 693 and non-Hierarchical mode.In 694 Non-Hierarchical Mode, egress service 695 pool for MC queue should be set. */ 696 bcmCosqControlEgressPoolLimitBytes = 50, /* Shared pool limit setting */ 697 bcmCosqControlEgressPoolYellowLimitBytes = 51, /* Shared pool limit setting for yellow 698 packets */ 699 bcmCosqControlEgressPoolRedLimitBytes = 52, /* Shared pool limit setting for red 700 packets */ 701 bcmCosqControlEgressPoolLimitEnable = 53, /* Enable or disable using egress shared 702 pool */ 703 bcmCosqControlEfPropagation = 54, /* Enable or disable EF propagation */ 704 bcmCosqControlFlowControlState = 55, /* Set flow control state for the 705 specified gport */ 706 bcmCosqControlHeaderUpdateField = 56, /* updating header with queue specific 707 information/signature */ 708 bcmCosqControlFlowSlowRate1 = 57, /* configure the device wide slow rate 709 one */ 710 bcmCosqControlFlowSlowRate2 = 58, /* configure the device wide slow rate 711 two */ 712 bcmCosqControlFlowSlowRate = 59, /* associate slow rate with a connector 713 gport or scheduling element gport. In 714 case of a composite element this 715 configuration should be done with 716 gport created when the element was 717 added. the valid values are 0 => 718 disable, 1 => slowRate one, 2 => slow 719 Rate two */ 720 bcmCosqControlDiscreteWeightLevel0 = 60, /* weight associated with level 0 of 721 scheduler element having discrete 722 weight attribute */ 723 bcmCosqControlDiscreteWeightLevel1 = 61, /* weight associated with level 1 of 724 scheduler element having discrete 725 weight attribute */ 726 bcmCosqControlDiscreteWeightLevel2 = 62, /* weight associated with level 2 of 727 scheduler element having discrete 728 weight attribute */ 729 bcmCosqControlDiscreteWeightLevel3 = 63, /* weight associated with level 3 of 730 scheduler element having discrete 731 weight attribute */ 732 bcmCosqControlAdmissionTestProfileA = 64, /* admission test profile A */ 733 bcmCosqControlAdmissionTestProfileB = 65, /* admission test profile B */ 734 bcmCosqControlFlowControlEnable = 66, /* Enables / Disables device-level flow 735 control functionality */ 736 bcmCosqControlEgressBandwidthEnable = 67, /* Enable / Disables Egress bandwidth 737 functionality */ 738 bcmCosqControlCongestionFeedbackMax = 68, /* Maximum value of the Congestion 739 Feedback. Units: bytes */ 740 bcmCosqControlCongestionManagedQueueMin = 69, /* It defines the range of VOQs mapped 741 to CP-Id */ 742 bcmCosqControlCongestionManagedQueueMax = 70, /* It defines the range of VOQs mapped 743 to CP-Id */ 744 bcmCosqControlCongestionThresholdRandom = 71, /* Randomize the Congestion Sample 745 Threshold */ 746 bcmCosqControlIgnoreAnemic = 72, /* Ignore anemic priority */ 747 bcmCosqControlCongestionProxy = 73, /* Enable/disable QCN Proxy */ 748 bcmCosqControlMulticastPriorityIngressScheduling = 78, /* Multicast packets traffic class 749 mapping to high/low strict priority */ 750 bcmCosqControlEgressUCQueueSharedLimitBytes = 79, /* Egress UC Shared Queue limit setting */ 751 bcmCosqControlEgressUCQueueMinLimitBytes = 80, /* UC Min Queue limit setting */ 752 bcmCosqControlEgressUCSharedDynamicEnable = 81, /* Enable Dynamic threshold limit for 753 Egress UC Queue */ 754 bcmCosqControlEgressUCQueueLimitEnable = 82, /* Enable Discards based on configured 755 threshold for Egress UC Queue */ 756 bcmCosqControlEgressMCQueueSharedLimitBytes = 83, /* Egress MC Shared Queue limit setting */ 757 bcmCosqControlEgressMCQueueMinLimitBytes = 84, /* MC Min Queue limit setting */ 758 bcmCosqControlEgressMCSharedDynamicEnable = 85, /* Enable Dynamic threshold limit for 759 Egress MC Queue */ 760 bcmCosqControlEgressMCQueueLimitEnable = 86, /* Enable Discards based on configured 761 threshold for Egress UC Queue */ 762 bcmCosqControlIngressPortPGSharedLimitBytes = 87, /* Ingress Port PG Shared limit setting */ 763 bcmCosqControlIngressPortPGMinLimitBytes = 88, /* Ingress Port PG Min limit setting */ 764 bcmCosqControlIngressPortPGSharedDynamicEnable = 89, /* Enable Dynamic threshold limit for 765 Ingress Port PG */ 766 bcmCosqControlIngressPortPoolMaxLimitBytes = 90, /* Ingress Port SP Max limit setting */ 767 bcmCosqControlIngressPortPoolMinLimitBytes = 91, /* Ingress Port SP Min limit setting */ 768 bcmCosqControlBandwidthBurstMaxEmptyQueue = 92, /* Sets the maximum amount of credits 769 that an empty queue can get */ 770 bcmCosqControlBandwidthBurstMaxFlowControlledQueue = 93, /* Sets the maximum amount of credits 771 for a flow controlled queue */ 772 bcmCosqControlSPPortLimitState = 94, /* For each port , retrieve limit state 773 of the corresponding shared pool of 774 the port */ 775 bcmCosqControlPGPortLimitState = 95, /* For each port , retrieve limit state 776 of the corresponding priority group 777 of the port */ 778 bcmCosqControlPGPortXoffState = 96, /* For each port , retrieve xoff state 779 of the corresponding priority group 780 of the port */ 781 bcmCosqControlPoolRedDropState = 97, /* For each pool , retrieve drop state 782 of the red packets for the pool */ 783 bcmCosqControlPoolYellowDropState = 98, /* For each pool , retrieve drop state 784 of the yellow packets for the pool */ 785 bcmCosqControlPoolGreenDropState = 99, /* For each pool , retrieve drop state 786 of the green packets for the pool */ 787 bcmCosqControlIngressPool = 100, /* Associate an Ingress Cos to a 788 specific service pool */ 789 bcmCosqControlEEEQueueThresholdProfileSelect = 101, /* Select queue depth threshold as the 790 condition to exit LPI state */ 791 bcmCosqControlEEEPacketLatencyProfileSelect = 102, /* Select packet max latency as the 792 condition to exit LPI state */ 793 bcmCosqControlPortQueueUcast = 103, /* retrieve port, cosq queue number of 794 PBSMH UC packet headers */ 795 bcmCosqControlPortQueueMcast = 104, /* retrieve port, cosq queue number of 796 PBSMH MC packet headers */ 797 bcmCosqControlEgressPortPoolYellowLimitBytes = 105, /* Egress Port Service Pool limit 798 setting for yellow packets */ 799 bcmCosqControlEgressPortPoolRedLimitBytes = 106, /* Egress Port Service Pool limit 800 setting for red packets */ 801 bcmCosqControlSingleCalendarMode = 107, /* Set single calendar mode for an 802 interface */ 803 bcmCosqControlPriorityPropagationEnable = 108, /* Enable priority propagation */ 804 bcmCosqControlPrioritySelect = 109, /* Set high/low port priority for 805 propagation */ 806 bcmCosqControlFlowControlErrWatchdog = 110, /* Watchdog period */ 807 bcmCosqControlFlowControlErrHandle = 111, /* Fc indication that will be sent when 808 watch-dog error is reported */ 809 bcmCosqControlUCEgressPool = 112, /* Set Egress service pool for UC queue 810 in Non-Hierarchical mode only */ 811 bcmCosqControlMCEgressPool = 113, /* Set Egress service pool for MC queue 812 in Non-Hierarchical mode only */ 813 bcmCosqControlRedirectQueueSharedLimitBytes = 114, /* Redirected Queue Shared Limited in 814 Bytes */ 815 bcmCosqControlRedirectQueueMinLimitBytes = 115, /* Redirected Queue Min. Limit in Bytes */ 816 bcmCosqControlRedirectSharedDynamicEnable = 116, /* Redirected Queue Enable Dynamic 817 Shared */ 818 bcmCosqControlRedirectQueueLimitEnable = 117, /* Redirected Queue Limit Enable */ 819 bcmCosqControlRedirectColorDynamicEnable = 118, /* Redirected Queue Color Dynamic 820 Enable */ 821 bcmCosqControlRedirectColorEnable = 119, /* Redirected Queue Color Enable */ 822 bcmCosqControlUCDropLimitAlpha = 120, /* UC Congestion drop limit alpha */ 823 bcmCosqControlMCDropLimitAlpha = 121, /* MC Congestion drop limit alpha */ 824 bcmCosqControlIngressPoolLimitBytes = 122, /* Ingress Shared Pool Limit in Bytes */ 825 bcmCosqControlIngressHeadroomPoolLimitBytes = 123, /* Ingress Headroom Pool Limit in Bytes */ 826 bcmCosqControlIngressHeadroomPool = 124, /* Associate an Ingress [Port, Prio] to 827 a specific Headroom pool */ 828 bcmCosqControlPFCBackpressureEnable = 125, /* Selection of being backpressured by 829 PFC message received */ 830 bcmCosqControlE2ECCTransmitEnable = 126, /* Enabling Transmission of E2ECC 831 message */ 832 bcmCosqControlIngressPortPGHeadroomLimitBytes = 127, /* Ingress port PG Headroom limit 833 setting */ 834 bcmCosqControlIngressPortPGResetFloorBytes = 128, /* Ingress port PG reset floor setting */ 835 bcmCosqControlEgressPoolSharedLimitBytes = 129, /* Shared limit setting for per chip 836 based egress Service Pool */ 837 bcmCosqControlEgressPoolResumeLimitBytes = 130, /* Resume limit setting for per chip 838 based egress Service Pool */ 839 bcmCosqControlEgressPoolYellowSharedLimitBytes = 131, /* Shared limit setting for per chip 840 based egress Service Pool for yellow 841 packets */ 842 bcmCosqControlEgressPoolYellowResumeLimitBytes = 132, /* Resume limit setting for per chip 843 based egress Service Pool for yellow 844 packets */ 845 bcmCosqControlEgressPoolRedSharedLimitBytes = 133, /* Shared limit setting for per chip 846 based egress Service Pool for red 847 packets */ 848 bcmCosqControlEgressPoolRedResumeLimitBytes = 134, /* Resume limit setting for per chip 849 based egress Service Pool for red 850 packets */ 851 bcmCosqControlOCBOnly = 135, /* Configures a queue to be OCB only */ 852 bcmCosqControlDefaultInvalidQueue = 136, /* Configures the default queue that 853 traffic will be redirected to in case 854 it's destined for invalid queue */ 855 bcmCosqControlIngressPortDropTpid1 = 137, /* cosq ingress port drop global TPID 1. */ 856 bcmCosqControlIngressPortDropTpid2 = 138, /* cosq ingress port drop global TPID 2. */ 857 bcmCosqControlIngressPortDropUntaggedPCP = 139, /* cosq ingress port drop untagged PCP. */ 858 bcmCosqControlIngressLatencyEnable = 140, /* enable latency measurements between 859 IRPP and ITPP */ 860 bcmCosqControlIngressPortDropTpid3 = 141, /* cosq ingress port drop global TPID 3. */ 861 bcmCosqControlIngressPortDropTpid4 = 142, /* cosq ingress port drop global TPID 4. */ 862 bcmCosqControlIngressPortDropIgnoreIpDscp = 143, /* cosq ingress port drop ignore IP 863 DSCP. */ 864 bcmCosqControlIngressPortDropIgnoreMplsExp = 144, /* cosq ingress port drop ignore MPLS 865 EXP. */ 866 bcmCosqControlIngressPortDropIgnoreInnerTag = 145, /* cosq ingress port drop ignore inner 867 VLAN tag. */ 868 bcmCosqControlIngressPortDropIgonreOuterTag = 146, /* cosq ingress port drop ignore outer 869 VLAN tag. */ 870 bcmCosqControlEgressUCQueueGroupMinEnable = 147, /* Specify to use queue guarantee or 871 qgroup guarantee fro Unicast queue */ 872 bcmCosqControlEgressUCQueueGroupSharedLimitEnable = 148, /* Enable qgroup limit for the Unicast 873 Queue */ 874 bcmCosqControlEgressUCQueueGroupMinLimitBytes = 149, /* Min Guarantee setting for Egress 875 Qgroup */ 876 bcmCosqControlEgressUCQueueGroupSharedLimitBytes = 150, /* Shared Limit setting for Egress 877 Qgroup */ 878 bcmCosqControlEgressUCQueueGroupSharedDynamicEnable = 151, /* Enable Dynamic Threshold for Qgroup 879 shared limit */ 880 bcmCosqControlAlternateStoreForward = 152, /* configure ASF mode */ 881 bcmCosqControlEgressUCQueueGroupDropLimitAlpha = 153, /* Egress Qgroup Congestion drop limit 882 alpha */ 883 bcmCosqControlOcbFadtDropEnable = 154, /* to allow activating the Ocb FADT by: 884 bcm_cosq_control_set(unit, 0, 0, 885 bcmCosqControlOcbFadtDropEnable, 1 / 886 0); */ 887 bcmCosqControlEgressPriorityOverCast = 155, /* To allow activating SP before WFQ 888 mode (per OTM port) by: 889 bcm_cosq_control_set(unit, 890 bcmCosqGportTypeLocalPort, 0, 891 bcmCosqControlEgressPriorityOverCast, 892 1 / 0); */ 893 bcmCosqControlEgressMCQueueGroupMinLimitBytes = 156, /* Min Guarantee setting for Egress 894 Qgroup for Multicast */ 895 bcmCosqControlEgressMCQueueGroupMinEnable = 157, /* Specify to use queue guarantee or 896 qgroup guarantee fro Multicast queue */ 897 bcmCosqControlIsHighPriority = 158, /* Flow can be high or low Priority, 898 used for Rci Throttling. */ 899 bcmCosqControlIsFabric = 159, /* Flow can be fabric(remote) or local 900 flow, used for Rci Throttling */ 901 bcmCosqControlEgressPoolHighCongestionLimitBytes = 160, /* Egress pool high congestion 902 threshold, for WRED */ 903 bcmCosqControlEgressPoolLowCongestionLimitBytes = 161, /* Egress pool low congestion threshold, 904 for WRED */ 905 bcmCosqControlMulticastQueueToPdSpMap = 160, /* Map Multicast egress queue to PDs SP. */ 906 bcmCosqControlSourcePortSchedCompensationEnable = 161, 907 bcmCosqControlIngressPortPGResetOffsetBytes = 162, /* Ingress port PG reset Offset setting */ 908 bcmCosqControlIngressPublicPoolLimitBytes = 163, /* Public Service Pool Limit Bytes */ 909 bcmCosqControlIngressPoolResetOffsetLimitBytes = 164, /* Specify the Per pool reset offset 910 limit */ 911 bcmCosqControlEgressUCQueueColorLimitDynamicEnable = 165, /* Specify if Color limit settings is 912 static or dynamic for unicast queue */ 913 bcmCosqControlEgressUCQueueRedLimit = 166, /* Specify the Per queue red limit for 914 unicast */ 915 bcmCosqControlEgressUCQueueYellowLimit = 167, /* Specify the Per queue yellow limit 916 for unicast */ 917 bcmCosqControlEgressMCQueueColorLimitDynamicEnable = 168, /* Specify if Color limit settings is 918 static or dynamic for multicast queue */ 919 bcmCosqControlEgressMCQueueRedLimit = 169, /* Specify the Per queue red limit for 920 multicast */ 921 bcmCosqControlEgressMCQueueYellowLimit = 170, /* Specify the Per queue yellow limit 922 for multicast */ 923 bcmCosqControlEgressPortPoolSharedLimitBytes = 171, /* Egress port service pool limit 924 setting for shared */ 925 bcmCosqControlEgressPortPoolRedResumeBytes = 172, /* Resume limit setting for port egress 926 Service Pool for red packets */ 927 bcmCosqControlEgressPortPoolYellowResumeBytes = 173, /* Resume limit setting for port egress 928 Service Pool for yellow packets */ 929 bcmCosqControlEgressPortPoolSharedResumeBytes = 174, /* Resume limit setting for port egress 930 Service pool drop state */ 931 bcmCosqControlIngressPortPoolResumeLimitBytes = 175, /* Ingress Port SP resume limit setting */ 932 bcmCosqControlEgressMCQueueColorLimitEnable = 176, /* Enable Discards based on configured 933 threshold for Egress MC Queue color 934 discard thresholds */ 935 bcmCosqControlEgressUCQueueColorLimitEnable = 177, /* Enable Discards based on configured 936 threshold for Egress UC Queue color 937 discard thresholds */ 938 bcmCosqControlObmDiscardLimit = 178, /* Configure discard limit in Bytes. 939 Cosq value used in API 940 bcm_cosq_control_set and 941 bcm_cosq_control_get must be set 942 using BCM_COSQ_OBM_CLASS_XXX. */ 943 bcmCosqControlObmMinLimit = 179, /* Configure guaranteed limit in Bytes. 944 Cosq value used in API 945 bcm_cosq_control_set and 946 bcm_cosq_control_get must be set to 947 BCM_COSQ_OBM_CLASS_LOSSY. */ 948 bcmCosqControlPgVsqFadtFcEnable = 180, /* Enable FADT Flow Control on PG-VSQ */ 949 bcmCosqControlIngressPortPGGlobalHeadroomEnable = 181, /* Enable ingress port PG to make use of 950 global Headroom */ 951 bcmCosqControlEgressTCGCirSpEnable = 182, /* Sets the TCG CIR SP per code */ 952 bcmCosqControlLatencyCounterEnable = 183, /* Enable latency counting */ 953 bcmCosqControlLatencyDropEnable = 184, /* Enable drop based on latency */ 954 bcmCosqControlLatencyEcnEnable = 185, /* Enable Ecn (cni) mark based on 955 latency */ 956 bcmCosqControlLatencyDropThreshold = 186, /* Latency drop threshold */ 957 bcmCosqControlLatencyEcnThreshold = 187, /* Latency ecn (mark cni) threshold */ 958 bcmCosqControlLatencyTrackDropPacket = 188, /* Enable tracking packets which dropped 959 due to latency */ 960 bcmCosqControlLatencyEgressCounterCommand = 189, /* Latency egress counter command */ 961 bcmCosqControlLatencyBinThreshold = 190, /* Latency bin threshold. use the cosq 962 to select the bin index you refer to */ 963 bcmCosqControlLatencyTrack = 191, /* Enable tracking latency packets in 964 dedicated table. */ 965 bcmCosqControlIsInDram = 192, /* Returns if VOQ is in DRAM or not */ 966 bcmCosqControlGroup = 193, /* Control group value of an element */ 967 bcmCosqControlIngressPortPoolSharedLimitBytes = 194, /* Ingress Port SP Shared limit setting */ 968 bcmCosqControlEgressUCQueueResumeOffsetBytes = 195, /* Egress UC Queue Resume Offset limit */ 969 bcmCosqControlEgressMCQueueResumeOffsetBytes = 196, /* Egress MC Queue Resume Offset limit */ 970 bcmCosqControlLatencyVoqRejectBinThreshold = 197, /* Latency bin threshold. use the cosq 971 to select the bin index you refer to */ 972 bcmCosqControlLatencyVoqRejectFilterMulticast = 198, /* Configure MC packets to update VOQ 973 latency */ 974 bcmCosqControlLatencyVoqRejectFilterSniff = 199, /* Configure SNIFF packets to update VOQ 975 latency */ 976 bcmCosqControlMirrorOnDropAgingGlobal = 200, /* Mirror on Drop aging time for global 977 type */ 978 bcmCosqControlMirrorOnDropAgingVoq = 201, /* Mirror on Drop aging time for voq 979 type */ 980 bcmCosqControlMirrorOnDropAgingVsq = 202, /* Mirror on Drop aging time for vsq 981 type */ 982 bcmCosqControlFlush = 203, /* Flush the element specified by Gport */ 983 bcmCosqControlPhantomQueueThreshold = 204, /* Control threshold for phantom queues */ 984 bcmCosqControlEgrRateMeasurementInterval = 205, /* Control Interval [usec] for Egress 985 rate measurement */ 986 bcmCosqControlEgrRateMeasurementWeight = 206, /* Control rate weight for Egress rate 987 measurements. see 988 BCM_COSQ_RATE_WEIGHT_XXX */ 989 bcmCosqControlShaperPacketMode = 207, /* Control shaper resolution mode: 990 'packet' or 'bit'. If set to '1' 991 ('packet') then shaping is per full 992 packets. */ 993 bcmCosqControlEgressPoolMCSharedLimitEntries = 208, /* Egress MC Port Pool Shared Limit */ 994 bcmCosqControlEgressMCQueueSharedLimitEntries = 209, /* Egress MC Queue Shared Limit Entries */ 995 bcmCosqControlEgressRQESharedLimitBytes = 210, /* Egress RQE Threshold */ 996 bcmCosqControlEgressMCQueueDataBufferSharedLimitBytes = 211, /* Egress MC Shared Queue limit setting 997 of data buffers in bytes */ 998 bcmCosqControlEgressMCQueueDataBufferRedLimit = 212, /* Specify the Per queue red limit of 999 data buffers for multicast */ 1000 bcmCosqControlEgressMCQueueEntryRedLimit = 213, /* Specify the Per queue red limit of 1001 egress queue entries for multicast */ 1002 bcmCosqControlEgressMCQueueDataBufferYellowLimit = 214, /* Specify the Per queue yellow limit of 1003 data buffers for multicast */ 1004 bcmCosqControlEgressMCQueueEntryYellowLimit = 215, /* Specify the Per queue yellow limit of 1005 egress queue entries for multicast */ 1006 bcmCosqControlOcbRangeSelectThreshold = 216, /* Controls the OCB range in selected 1007 threshold. */ 1008 bcmCosqLowRateVoqConnectorFactor = 217, /* Low rate VOQ connector factor. */ 1009 bcmCosqControlIngressPortDropPortProfileMap = 218, /* Map port to prd profile. */ 1010 bcmCosqControlE2ETCGCirSpEnable = 219, /* enable Strict Priority between E2E 1011 TCGs. */ 1012 bcmCosqControlLatencyDropProbEnable = 220, /* Enable drop probability based on 1013 latency */ 1014 bcmCosqControlLatencyDropProbBaseThreshold = 221, /* Define the drop base threshold - 1015 relevant if drop probability enabled */ 1016 bcmCosqControlLatencyEcnProbEnable = 222, /* Enable ECN (cni) marking probability 1017 based on latency */ 1018 bcmCosqControlLatencyEcnProbBaseThreshold = 223, /* Latency ECN(mark cni) probability 1019 base threshold */ 1020 bcmCosqControlLatencyEcnProbConvertExponent = 224, /* Latency ECN Probability Convert 1021 Exponent - define the converted Ecn 1022 marking probability function for 1023 classic TCP packets in coupled mode */ 1024 bcmCosqControlLatencyEcnProbConvertCoeff = 225, /* Latency ECN Probability Convert 1025 Coefficient - define the converted 1026 Ecn marking probability function for 1027 classic TCP packets in coupled mode */ 1028 bcmCosqControlLatencyEgressAqmFlowId = 226, /* Egress latency AQM - map port and tc 1029 to flow id gport */ 1030 bcmCosqControlLatencyEgressAqmFlowIdToProfile = 227, /* Egress latency AQM - Map AQM flow id 1031 to AQM profile */ 1032 bcmCosqControlLatencyEgressCoupledAqmMode = 228, /* Egress latency AQM - define per Aqm 1033 e2e profile if working in coupled 1034 mode or not */ 1035 bcmCosqControlLatencyEgressAqmL4sEcnClassificationThresholdMax = 229, /* Egress latency AQM - define the max 1036 latency value (in nanoseconds), in 1037 which packet will be define L4S, 1038 relevant only to 1039 LATENCY_END_TO_END_AQM profile. */ 1040 bcmCosqControlLatencyEgressAqmAverageWeight = 230, /* Egress latency AQM - define the 1041 weight of the current latency sample, 1042 in order to calculate average 1043 latency. relevant only to 1044 LATENCY_END_TO_END_AQM profile. */ 1045 bcmCosqControlLatencyEcnInstantThreshold = 231, /* Latency-based ECN instantaneous mode 1046 threshold. */ 1047 bcmCosqControlIngressMinLowPriority = 232, 1048 bcmCosqControlAdtPriGroup = 233, /* Set ADT group for a UC queue. */ 1049 bcmCosqControlEgressPoolAdtHighPriAlpha = 234, /* Set ADT high priority queue alpha 1050 used to compute margin value of 1051 shared service pool. */ 1052 bcmCosqControlEgressPoolAdtMargin0 = 235, /* Set ADT margin level for margin 0 in 1053 bytes of shared service pool. */ 1054 bcmCosqControlEgressPoolAdtMargin1 = 236, /* Set ADT margin level for margin 1 in 1055 bytes of service pool. */ 1056 bcmCosqControlEgressPoolAdtMargin2 = 237, /* Set ADT margin level for margin 2 in 1057 bytes of service pool. */ 1058 bcmCosqControlEgressPoolAdtMargin3 = 238, /* Set ADT margin level for margin 3 in 1059 bytes of shared service pool. */ 1060 bcmCosqControlEgressPoolAdtMargin4 = 239, /* Set ADT margin level for margin 4 in 1061 bytes of service pool. */ 1062 bcmCosqControlEgressPoolAdtMargin5 = 240, /* Set ADT margin level for margin 5 in 1063 bytes of service pool. */ 1064 bcmCosqControlEgressPoolAdtMargin6 = 241, /* Set ADT margin level for margin 6 in 1065 bytes of shared service pool. */ 1066 bcmCosqControlEgressPoolAdtMargin7 = 242, /* Set ADT margin level for margin 7 in 1067 bytes of service pool. */ 1068 bcmCosqControlEgressPoolAdtMargin8 = 243, /* Set ADT margin level for margin 8 in 1069 bytes of service pool. */ 1070 bcmCosqControlEgressPoolAdtMargin9 = 244, /* Set ADT margin level for margin 9 in 1071 bytes of shared service pool. */ 1072 bcmCosqControlAdtLowPriMonitorPool = 245, /* Set egress pool on which ADT margin 1073 levels are monitored. */ 1074 bcmCosqControlEgressPoolToIngressPoolMap = 246, /* Associate egress service pool to 1075 ingress service pools. Bit [3..0] - 1076 ingress pool [3..0]. */ 1077 bcmCosqControlEgressPoolMCSharedEntryLimit = 247, /* Egress MC Pool Shared Limit Entries */ 1078 bcmCosqControlPolicerTCSMThresh = 248 /* Set Policer TCSM thresholds in % of 1079 the meter bucket size. */ 1080 } bcm_cosq_control_t; 1081 1082 #ifndef BCM_HIDE_DISPATCHABLE 1083 1084 /* Set various features at the gport/cosq level. */ 1085 extern int bcm_cosq_control_set( 1086 int unit, 1087 bcm_gport_t port, 1088 bcm_cos_queue_t cosq, 1089 bcm_cosq_control_t type, 1090 int arg); 1091 1092 #endif /* BCM_HIDE_DISPATCHABLE */ 1093 1094 typedef enum bcm_cosq_priority_mapping_e { 1095 bcmCosqPriorityGroup = 0, /* Index is priority group. */ 1096 bcmCosqIngressPool = 1 /* Index is service pool. */ 1097 } bcm_cosq_priority_mapping_t; 1098 1099 #ifndef BCM_HIDE_DISPATCHABLE 1100 1101 /* 1102 * Get priority list attched to a priority group or service pool on a 1103 * port. 1104 */ 1105 extern int bcm_cosq_priority_mapping_get_all( 1106 int unit, 1107 bcm_gport_t gport, 1108 int index, 1109 bcm_cosq_priority_mapping_t type, 1110 int pri_max, 1111 int *pri_array, 1112 int *pri_count); 1113 1114 /* Set various features at the gport/cosq level. */ 1115 extern int bcm_cosq_control_get( 1116 int unit, 1117 bcm_gport_t port, 1118 bcm_cos_queue_t cosq, 1119 bcm_cosq_control_t type, 1120 int *arg); 1121 1122 #endif /* BCM_HIDE_DISPATCHABLE */ 1123 1124 /* max number of buffers */ 1125 #define BCM_COSQ_MAX_BUFFER 4 1126 1127 /* integrated cosq indexes for cosq APIs */ 1128 typedef struct bcm_cosq_object_id_s { 1129 bcm_gport_t port; /* gport */ 1130 bcm_cos_queue_t cosq; /* cosq or priority */ 1131 bcm_cosq_buffer_id_t buffer; /* buffer id */ 1132 } bcm_cosq_object_id_t; 1133 1134 /* Initialize COSQ compound index structure. */ 1135 extern void bcm_cosq_object_id_t_init( 1136 bcm_cosq_object_id_t *id); 1137 1138 /* Integrated cosq feature data. */ 1139 typedef struct bcm_cosq_control_data_s { 1140 bcm_cosq_control_t type; /* cosq feature. */ 1141 int arg; /* cosq feature value. */ 1142 } bcm_cosq_control_data_t; 1143 1144 /* Initialize COSQ control data structure. */ 1145 extern void bcm_cosq_control_data_t_init( 1146 bcm_cosq_control_data_t *control); 1147 1148 #ifndef BCM_HIDE_DISPATCHABLE 1149 1150 /* Set/get various features at the gport, cosq, and/or other level. */ 1151 extern int bcm_cosq_control_extended_set( 1152 int unit, 1153 bcm_cosq_object_id_t *id, 1154 bcm_cosq_control_data_t *control); 1155 1156 /* Set/get various features at the gport, cosq, and/or other level. */ 1157 extern int bcm_cosq_control_extended_get( 1158 int unit, 1159 bcm_cosq_object_id_t *id, 1160 bcm_cosq_control_data_t *control); 1161 1162 #endif /* BCM_HIDE_DISPATCHABLE */ 1163 1164 /* For Virtual output queues (system ports) */ 1165 typedef struct bcm_cosq_gport_discard_s { 1166 uint32 flags; 1167 int min_thresh; /* Queue depth in bytes to begin dropping. */ 1168 int max_thresh; /* Queue depth in bytes to drop all packets. */ 1169 int drop_probability; /* Drop probability at max threshold. */ 1170 int gain; /* Determines the smoothing that should be applied. */ 1171 int ecn_thresh; /* Queue depth in bytes to stop marking and start 1172 dropping. */ 1173 int refresh_time; /* Actual average refresh time. */ 1174 uint32 use_queue_group; /* Use QGroupMin instead of QMin for WRED 1175 resolution. */ 1176 uint32 profile_id; /* Profile of discard rules. */ 1177 } bcm_cosq_gport_discard_t; 1178 1179 /* For Virtual output queues (system ports) */ 1180 typedef enum bcm_cosq_gport_stats_e { 1181 bcmCosqGportGreenAcceptedPkts = 0, /* Green/DP0, accepted packet count. */ 1182 bcmCosqGportGreenAcceptedBytes = 1, /* Green/DP0, accepted byte count. */ 1183 bcmCosqGportNotGreenAcceptedPkts = 2, /* Not Green/DP1-3, accepted packet 1184 count. */ 1185 bcmCosqGportNotGreenAcceptedBytes = 3, /* Not Green/DP1-3, accepted byte count. */ 1186 bcmCosqGportGreenCongestionMarkedPkts = 4, /* Green/DP0, ECN Marked packets. */ 1187 bcmCosqGportGreenCongestionMarkedBytes = 5, /* Green/DP0, ECN Marked bytes. */ 1188 bcmCosqGportGreenDiscardDroppedPkts = 6, /* Green/DP0, WRED dropped packets. */ 1189 bcmCosqGportGreenDiscardDroppedBytes = 7, /* Green/DP0, WRED dropped bytes. */ 1190 bcmCosqGportYellowAcceptedPkts = 8, /* Yellow/DP1, accepted packet count. */ 1191 bcmCosqGportYellowAcceptedBytes = 9, /* Yellow/DP1, accepted byte count. */ 1192 bcmCosqGportYellowCongestionMarkedPkts = 10, /* Yellow/DP1, ECN Marked packets. */ 1193 bcmCosqGportYellowCongestionMarkedBytes = 11, /* Yellow/DP1, ECN nMarked bytes. */ 1194 bcmCosqGportYellowDiscardDroppedPkts = 12, /* Yellow/DP1, WRED dropped packets. */ 1195 bcmCosqGportYellowDiscardDroppedBytes = 13, /* Yellow/DP1, WRED dropped bytes. */ 1196 bcmCosqGportRedAcceptedPkts = 14, /* Red/DP2, accepted packet count. */ 1197 bcmCosqGportRedAcceptedBytes = 15, /* Red/DP2, accepted byte count. */ 1198 bcmCosqGportRedCongestionMarkedPkts = 16, /* Red/DP2, ECN Marked packets. */ 1199 bcmCosqGportRedCongestionMarkedBytes = 17, /* Red/DP2, ECN Marked bytes. */ 1200 bcmCosqGportRedDiscardDroppedPkts = 18, /* Red/DP2, WRED dropped packets. */ 1201 bcmCosqGportRedDiscardDroppedBytes = 19, /* Red/DP2, WRED dropped bytes. */ 1202 bcmCosqGportBlackAcceptedPkts = 20, /* Black/DP3, accepted packet count. */ 1203 bcmCosqGportBlackAcceptedBytes = 21, /* Black/DP3, accepted byte count. */ 1204 bcmCosqGportNonWredDroppedPkts = 22, /* NON-WRED dropped packet count. */ 1205 bcmCosqGportNonWredDroppedBytes = 23, /* NON-WRED dropped byte count. */ 1206 bcmCosqGportDequeuedPkts = 24, /* dequeued packets. */ 1207 bcmCosqGportDequeuedBytes = 25, /* dequeued bytes. */ 1208 bcmCosqGportGreenDroppedPkts = 26, /* Green/DP0, non-WRED dropped pkts. */ 1209 bcmCosqGportGreenDroppedBytes = 27, /* Green/DP0, non-WRED dropped bytes. */ 1210 bcmCosqGportNotGreenDroppedPkts = 28, /* Not Green/DP1-3 dropped pkts. */ 1211 bcmCosqGportNotGreenDroppedBytes = 29, /* Not Green/DP1-3 dropped bytes. */ 1212 bcmCosqGportYellowDroppedPkts = 30, /* Yellow/DP1, non-WRED dropped pkts. */ 1213 bcmCosqGportYellowDroppedBytes = 31, /* Yellow/DP1, non-WRED dropped bytes. */ 1214 bcmCosqGportRedDroppedPkts = 32, /* Red/DP2, non-WRED dropped pkts. */ 1215 bcmCosqGportRedDroppedBytes = 33, /* Red/DP2, non-WRED dropped bytes. */ 1216 bcmCosqGportBlackCongestionMarkedPkts = 34, /* Black/DP3, ECN Marked packets. */ 1217 bcmCosqGportBlackCongestionMarkedBytes = 35, /* Black/DP3, ECN Marked bytes. */ 1218 bcmCosqGportBlackDiscardDroppedPkts = 36, /* Black/DP3, WRED dropped at packets. */ 1219 bcmCosqGportBlackDiscardDroppedBytes = 37, /* Black/DP3, WRED dropped bytes. */ 1220 bcmCosqGportBlackDroppedPkts = 38, /* Black/DP3, non-WRED dropped at 1221 packets. */ 1222 bcmCosqGportBlackDroppedBytes = 39, /* Black/DP3, non-WRED dropped bytes. */ 1223 bcmCosqGportOverSubscribeTotelDroppedPkts = 40, /* Free list underflow, pkts dropped. */ 1224 bcmCosqGportOverSubscribeTotalDroppedBytes = 41, /* Free list underflow, bytes dropped. */ 1225 bcmCosqGportOverSubscribeGuaranteeDroppedPkts = 42, /* Gbl buf thres guarantee, pkts 1226 dropped. */ 1227 bcmCosqGportOverSubscribeGuaranteedDroppedBytes = 43, /* Gbl buf thres guarantee, bytes 1228 dropped. */ 1229 bcmCosqGportYellowRedDiscardDroppedPkts = 46, /* Yellow and Red dropped packets */ 1230 bcmCosqGportYellowRedDiscardDroppedBytes = 47, /* Yellow and Red dropped bytes */ 1231 bcmCosqGportEnqueuedPkts = 48, /* enqueued packets */ 1232 bcmCosqGportEnqueuedBytes = 49, /* enqueued bytes */ 1233 bcmCosqGportOutLimitDroppedPkts = 50, /* Egress Admission Control (EAC) 1234 dropped pkts */ 1235 bcmCosqGportOutLimitDroppedBytes = 51, /* EAC dropped bytes */ 1236 bcmCosqGportOutLimitDroppedGreenPkts = 52, /* EAC dropped green pkts */ 1237 bcmCosqGportOutLimitDroppedGreenBytes = 53, /* EAC dropped green bytes */ 1238 bcmCosqGportOutLimitDroppedYellowPkts = 54, /* EAC dropped yellow pkts */ 1239 bcmCosqGportOutLimitDroppedYellowBytes = 55, /* EAC dropped yellow bytes */ 1240 bcmCosqGportOutLimitDroppedRedPkts = 56, /* EAC dropped red pkts */ 1241 bcmCosqGportOutLimitDroppedRedBytes = 57, /* EAC dropped red bytes */ 1242 bcmCosqGportOutLimitDroppedMulticastPkts = 58, /* EAC dropped multicast pkts */ 1243 bcmCosqGportOutLimitDroppedMulticastBytes = 59, /* EAC dropped multicast bytes */ 1244 bcmCosqGportOutPkts = 60, /* Egress Interface. */ 1245 bcmCosqGportOutBytes = 61, /* Egress Interface. */ 1246 bcmCosqGportReceivedBytes = 62, /* Bytes received into queue. */ 1247 bcmCosqGportReceivedPkts = 63, /* Pkts received into queue. */ 1248 bcmCosqGportDroppedBytes = 64, /* Bytes dropped in queue. */ 1249 bcmCosqGportDroppedPkts = 65, /* Pkts dropped in queue. */ 1250 bcmCosqGportDelayedBytes = 66, /* Delayed bytes. */ 1251 bcmCosqGportDelayedHundredUs = 67, /* Maximum Pkts delay. */ 1252 bcmCosqGportGreenPkts = 68, /* Green/DP0 packet count. */ 1253 bcmCosqGportGreenBytes = 69, /* Green/DP0 byte count. */ 1254 bcmCosqGportNotGreenPkts = 70, /* Not-Green/DP0 packet count. */ 1255 bcmCosqGportNotGreenBytes = 71, /* Not-Green/DP0 byte count. */ 1256 bcmCosqGportOffset0Bytes = 72, /* Byte count at configurable offset 0. */ 1257 bcmCosqGportOffset0Packets = 73, /* Packet count at configurable offset 1258 0. */ 1259 bcmCosqGportOffset1Bytes = 74, /* Byte count at configurable offset 1. */ 1260 bcmCosqGportOffset1Packets = 75, /* Packet count at configurable offset 1261 1. */ 1262 bcmCosqGportOffset2Bytes = 76, /* Byte count at configurable offset 2. */ 1263 bcmCosqGportOffset2Packets = 77, /* Packet count at configurable offset 1264 2. */ 1265 bcmCosqGportOffset3Bytes = 78, /* Byte count at configurable offset 3. */ 1266 bcmCosqGportOffset3Packets = 79, /* Packet count at configurable offset 1267 3. */ 1268 bcmCosqGportOffset4Bytes = 80, /* Byte count at configurable offset 4. */ 1269 bcmCosqGportOffset4Packets = 81, /* Packet count at configurable offset 1270 4. */ 1271 bcmCosqGportOffset5Bytes = 82, /* Byte count at configurable offset 5. */ 1272 bcmCosqGportOffset5Packets = 83, /* Packet count at configurable offset 1273 5. */ 1274 bcmCosqGportOffset6Bytes = 84, /* Byte count at configurable offset 6. */ 1275 bcmCosqGportOffset6Packets = 85, /* Packet count at configurable offset 1276 6. */ 1277 bcmCosqGportOffset7Bytes = 86, /* Byte count at configurable offset 7. */ 1278 bcmCosqGportOffset7Packets = 87, /* Packet count at configurable offset 1279 7. */ 1280 bcmCosqGportStatCount = 88 /* Must be the last entry ! */ 1281 } bcm_cosq_gport_stats_t; 1282 1283 /* Profile stat event-related flags. */ 1284 #define BCM_COSQ_GPORT_STATS_SHARED 0x00000001 1285 1286 /* egress mapping redirection cos related flags. */ 1287 #define BCM_COSQ_GPORT_EGRESS_MAPPING_REDIRECTION_COS 0x00000001 1288 1289 /* Statistics Profile */ 1290 typedef struct bcm_cosq_gport_stat_profile_s { 1291 SHR_BITDCL stats[_SHR_BITDCLSIZE(bcmCosqGportOutBytes)]; /* Use Gport Stats Enumeration */ 1292 } bcm_cosq_gport_stat_profile_t; 1293 1294 #define BCM_COSQ_GPORT_STAT_PROFILE_INIT(_profile_set) SHR_BITCLR_RANGE(_profile_set.stats, 0, (sizeof(_profile_set)*8)) 1295 #define BCM_COSQ_GPORT_STAT_PROFILE_ADD(_profile_set, _stat) SHR_BITSET(_profile_set.stats, _stat) 1296 #define BCM_COSQ_GPORT_STAT_PROFILE_REMOVE(_profile_set, _stat) SHR_BITCLR(_profile_set.stats, _stat) 1297 #define BCM_COSQ_GPORT_STAT_PROFILE_TEST(_profile_set, _stat) SHR_BITGET(_profile_set.stats, _stat) 1298 1299 #define BCM_COSQ_PRIORITY_PROFILE_MAX_SIZE 64 /* Maximum priority 1300 profile size across 1301 all devices. */ 1302 1303 /* Priority Profile */ 1304 typedef struct bcm_cosq_gport_priority_profile_s { 1305 SHR_BITDCL pri[_SHR_BITDCLSIZE(BCM_COSQ_PRIORITY_PROFILE_MAX_SIZE)]; /* Use Gport priority macros Enumeration */ 1306 } bcm_cosq_gport_priority_profile_t; 1307 1308 #define BCM_COSQ_PRI_PROFILE_SET(_profile, _offset) SHR_BITSET(_profile.pri, _offset) 1309 #define BCM_COSQ_PRI_PROFILE_GET(_profile, _offset) SHR_BITGET(_profile.pri, _offset) 1310 #define BCM_COSQ_PRI_PROFILE_CLEAR(_profile, _offset) SHR_BITCLR(_profile.pri, (sizeof(_profile))) 1311 #define BCM_COSQ_PRI_PROFILE_CLEAR_ALL(_profile) SHR_BITCLR_RANGE(_profile.pri, 0, BCM_COSQ_PRIORITY_PROFILE_MAX_SIZE) 1312 #define BCM_COSQ_PRI_PROFILE_SET_ALL(_profile) SHR_BITSET_RANGE(_profile.pri, 0, BCM_COSQ_PRIORITY_PROFILE_MAX_SIZE) 1313 1314 #ifndef BCM_HIDE_DISPATCHABLE 1315 1316 /* Get a profile of hi/lo priorities used for ingress queuing */ 1317 extern int bcm_cosq_priority_profile_get( 1318 int unit, 1319 int pri_profile_id, 1320 int *count, 1321 bcm_cosq_gport_priority_profile_t *pri_profile); 1322 1323 /* Set up a profile of hi/lo priorities used for ingress queuing */ 1324 extern int bcm_cosq_priority_profile_set( 1325 int unit, 1326 int pri_profile_id, 1327 int count, 1328 bcm_cosq_gport_priority_profile_t *pri_profile); 1329 1330 /* Associate a priority profile with a queue range. */ 1331 extern int bcm_cosq_priority_set( 1332 int unit, 1333 int start_queue, 1334 int end_queue, 1335 int pri_profile_id); 1336 1337 /* Get the priority profile associated with a queue range. */ 1338 extern int bcm_cosq_priority_get( 1339 int unit, 1340 int start_queue, 1341 int end_queue, 1342 int *pri_profile_id); 1343 1344 /* 1345 * Set/Get a node to be flow controlled when a flow control packet is 1346 * recevied. 1347 */ 1348 extern int bcm_cosq_subport_flow_control_set( 1349 int unit, 1350 bcm_gport_t subport, 1351 bcm_gport_t sched_port); 1352 1353 /* 1354 * Set/Get a node to be flow controlled when a flow control packet is 1355 * recevied. 1356 */ 1357 extern int bcm_cosq_subport_flow_control_get( 1358 int unit, 1359 bcm_gport_t subport, 1360 bcm_gport_t *sched_port); 1361 1362 #endif /* BCM_HIDE_DISPATCHABLE */ 1363 1364 /* Initialize a CoSQ gport discard structure. */ 1365 extern void bcm_cosq_gport_discard_t_init( 1366 bcm_cosq_gport_discard_t *discard); 1367 1368 #ifndef BCM_HIDE_DISPATCHABLE 1369 1370 /* 1371 * Allocate/Retrieve unicast queue group and scheduler queue group 1372 * configuration. 1373 */ 1374 extern int bcm_cosq_gport_get( 1375 int unit, 1376 bcm_gport_t gport, 1377 bcm_gport_t *physical_port, 1378 int *num_cos_levels, 1379 uint32 *flags); 1380 1381 #endif /* BCM_HIDE_DISPATCHABLE */ 1382 1383 typedef int (*bcm_cosq_gport_traverse_cb)( 1384 int unit, 1385 bcm_gport_t port, 1386 int numq, 1387 uint32 flags, 1388 bcm_gport_t gport, 1389 void *user_data); 1390 1391 #ifndef BCM_HIDE_DISPATCHABLE 1392 1393 /* 1394 * Traverse all added CoS queue GPORTs and call the supplied callback 1395 * routine for each one. 1396 */ 1397 extern int bcm_cosq_gport_traverse( 1398 int unit, 1399 bcm_cosq_gport_traverse_cb cb, 1400 void *user_data); 1401 1402 /* 1403 * Traverse all added CoS queue GPORTs belong to a port and call the 1404 * supplied callback 1405 * routine for each one. 1406 */ 1407 extern int bcm_cosq_gport_traverse_by_port( 1408 int unit, 1409 bcm_gport_t port, 1410 bcm_cosq_gport_traverse_cb cb, 1411 void *user_data); 1412 1413 /* Configure/retrieve minimum and maximum queue depth size setting */ 1414 extern int bcm_cosq_gport_size_set( 1415 int unit, 1416 bcm_gport_t gport, 1417 bcm_cos_queue_t cosq, 1418 uint32 bytes_min, 1419 uint32 bytes_max); 1420 1421 /* Configure/retrieve minimum and maximum queue depth size setting */ 1422 extern int bcm_cosq_gport_size_get( 1423 int unit, 1424 bcm_gport_t gport, 1425 bcm_cos_queue_t cosq, 1426 uint32 *bytes_min, 1427 uint32 *bytes_max); 1428 1429 #endif /* BCM_HIDE_DISPATCHABLE */ 1430 1431 /* color size related flags. */ 1432 #define BCM_COSQ_GPORT_SIZE_BYTES 0x0001 1433 #define BCM_COSQ_GPORT_SIZE_BUFFER_DESC 0x0002 1434 #define BCM_COSQ_GPORT_SIZE_COLOR_BLIND 0x0004 1435 #define BCM_COSQ_GPORT_SIZE_COLOR_SYSTEM_RED 0x0008 1436 #define BCM_COSQ_GPORT_SIZE_OCB 0x0010 /* OCB configuration */ 1437 #define BCM_COSQ_GPORT_SIZE_SRC_VSQ_POOL1 0x0020 /* Configure the pool-1 1438 source VSQ, else 1439 configure the pool-0 1440 source VSQ. */ 1441 #define BCM_COSQ_GPORT_SIZE_PACKET_DESC 0x0040 /* Configure packet 1442 description */ 1443 #define BCM_COSQ_GPORT_SIZE_BUFFERS 0x0080 /* Configure buffers size */ 1444 1445 #define BCM_COSQ_GPORT_SIZE_SRAM BCM_COSQ_GPORT_SIZE_OCB /* For backward compatibility 1446 support. */ 1447 1448 /* color size configuration */ 1449 typedef struct bcm_cosq_gport_size_s { 1450 uint32 size_min; /* minimum size */ 1451 uint32 size_max; /* maximum size */ 1452 int32 size_alpha_max; /* additional maximum size limit: free size * 2 ^ 1453 size_alpha_max */ 1454 uint32 size_fadt_min; /* additional minimal size (used mostly in FADT) */ 1455 } bcm_cosq_gport_size_t; 1456 1457 #ifndef BCM_HIDE_DISPATCHABLE 1458 1459 /* 1460 * Configure/retrieve minimum and maximum queue depth color based size 1461 * setting 1462 */ 1463 extern int bcm_cosq_gport_color_size_set( 1464 int unit, 1465 bcm_gport_t gport, 1466 bcm_cos_queue_t cosq, 1467 bcm_color_t color, 1468 uint32 flags, 1469 bcm_cosq_gport_size_t *gport_size); 1470 1471 /* 1472 * Configure/retrieve minimum and maximum queue depth color based size 1473 * setting 1474 */ 1475 extern int bcm_cosq_gport_color_size_get( 1476 int unit, 1477 bcm_gport_t gport, 1478 bcm_cos_queue_t cosq, 1479 bcm_color_t color, 1480 uint32 flags, 1481 bcm_cosq_gport_size_t *gport_size); 1482 1483 /* 1484 * Configure/Retrieve enable/disable state of a cos level in a queue 1485 * group. 1486 * BCM88230 only: Also configure/Retrieve enable/disable state of a FIFO 1487 * in an egress group. 1488 */ 1489 extern int bcm_cosq_gport_enable_set( 1490 int unit, 1491 bcm_gport_t gport, 1492 bcm_cos_queue_t cosq, 1493 int enable); 1494 1495 /* Force an immediate counter update and retrieve statistics. */ 1496 extern int bcm_cosq_gport_stat_sync_get( 1497 int unit, 1498 bcm_gport_t gport, 1499 bcm_cos_queue_t cosq, 1500 bcm_cosq_gport_stats_t stat, 1501 uint64 *value); 1502 1503 /* 1504 * Configure/Retrieve enable/disable state of a cos level in a queue 1505 * group. 1506 * BCM88230 only: Also configure/Retrieve enable/disable state of a FIFO 1507 * in an egress group. 1508 */ 1509 extern int bcm_cosq_gport_enable_get( 1510 int unit, 1511 bcm_gport_t gport, 1512 bcm_cos_queue_t cosq, 1513 int *enable); 1514 1515 /* Enable/Disable statistics for queue group. */ 1516 extern int bcm_cosq_gport_stat_enable_set( 1517 int unit, 1518 bcm_gport_t gport, 1519 int enable); 1520 1521 /* Retrieve queue group statistic setting. */ 1522 extern int bcm_cosq_gport_stat_enable_get( 1523 int unit, 1524 bcm_gport_t gport, 1525 int *enable); 1526 1527 /* Retrieve/Set Statistics */ 1528 extern int bcm_cosq_gport_stat_get( 1529 int unit, 1530 bcm_gport_t gport, 1531 bcm_cos_queue_t cosq, 1532 bcm_cosq_gport_stats_t stat, 1533 uint64 *value); 1534 1535 /* Retrieve/Set Statistics */ 1536 extern int bcm_cosq_gport_stat_set( 1537 int unit, 1538 bcm_gport_t gport, 1539 bcm_cos_queue_t cosq, 1540 bcm_cosq_gport_stats_t stat, 1541 uint64 value); 1542 1543 /* Get the values associated with a set of Central Statistics Indices. */ 1544 extern int bcm_cosq_gport_statistic_multi_get( 1545 int unit, 1546 bcm_gport_t gport, 1547 bcm_gport_t lgl_gport, 1548 bcm_cos_queue_t cosq, 1549 int stat_count, 1550 bcm_cosq_gport_stats_t *stats_array, 1551 int value_count, 1552 uint64 *value_array); 1553 1554 extern int bcm_cosq_gport_statistic_multi_set( 1555 int unit, 1556 bcm_gport_t gport, 1557 bcm_gport_t lgl_gport, 1558 bcm_cos_queue_t cosq, 1559 int stat_count, 1560 bcm_cosq_gport_stats_t *stats_array, 1561 uint64 value); 1562 1563 #endif /* BCM_HIDE_DISPATCHABLE */ 1564 1565 #define BCM_COSQ_GPORT_WITH_ID 0x00000001 1566 #define BCM_COSQ_GPORT_SCHEDULER 0x00000002 1567 #define BCM_COSQ_GPORT_OVERLAY 0x00000004 1568 #define BCM_COSQ_GPORT_LATENCY_AQM_FLOW_ID 0x00000004 /* For DNX devices - AQM 1569 flow id gport */ 1570 #define BCM_COSQ_GPORT_UCAST_QUEUE_GROUP 0x00000008 1571 #define BCM_COSQ_GPORT_DESTMOD_UCAST_QUEUE_GROUP 0x00000010 1572 #define BCM_COSQ_GPORT_MCAST_QUEUE 0x00000010 1573 #define BCM_COSQ_GPORT_MCAST_QUEUE_GROUP 0x00000020 1574 #define BCM_COSQ_GPORT_SUBSCRIBER 0x00000040 1575 #define BCM_COSQ_GPORT_TM_FLOW_ID 0x00000040 1576 #define BCM_COSQ_GPORT_EGRESS_GROUP 0x00000080 1577 #define BCM_COSQ_GPORT_DISABLE 0x00000100 /* Disable queue, used 1578 for 1579 BCM_COSQ_GPORT_CALENDAR 1580 scheduling discipline */ 1581 #define BCM_COSQ_GPORT_CALENDAR 0x00000200 /* Indicates that this 1582 gport is of scheduling 1583 type CALENDAR */ 1584 #define BCM_COSQ_GPORT_ELEPHANT_UCAST_QUEUE_GROUP 0x00000200 /* Unicast queue for 1585 elephant flows */ 1586 #define BCM_COSQ_GPORT_QSEL_ENTRY_DISABLE 0x00000400 /* Inhibits automatic 1587 update of queue 1588 mapping table based 1589 upon the GPORT 1590 parameters */ 1591 #define BCM_COSQ_GPORT_VOQ_CONNECTOR 0x00000800 /* Indicates a VoQ 1592 connector resource has 1593 to be allocated */ 1594 #define BCM_COSQ_GPORT_VSQ 0x00001000 /* Indicates a VSQ 1595 resource has to be 1596 allocated */ 1597 #define BCM_COSQ_GPORT_ISQ 0x00002000 /* indicates that an ISQ 1598 resource has to be 1599 allocated */ 1600 #define BCM_COSQ_GPORT_REPLACE 0x00004000 /* modify configuration */ 1601 #define BCM_COSQ_GPORT_RECYCLE 0x00008000 /* Indicate a recycle 1602 queue space */ 1603 #define BCM_COSQ_GPORT_SCHEDULER_PFC_ALIGN 0x00008000 /* Indicate aligned 1604 allocation of 1605 scheduler node */ 1606 #define BCM_COSQ_GPORT_SCHEDULER_HR_DUAL_WFQ 0x00010000 /* The scheduler works in 1607 Dual HR mode */ 1608 #define BCM_COSQ_GPORT_SCHEDULER_HR_ENHANCED 0x00020000 /* The scheduler works in 1609 Enhanced HR mode */ 1610 #define BCM_COSQ_GPORT_SCHEDULER_HR_SINGLE_WFQ 0x00030000 /* The scheduler works in 1611 Single HR mode */ 1612 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_MODE1_4SP 0x00040000 /* The scheduler works in 1613 4 SP levels CL mode */ 1614 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_MODE2_3SP_WFQ 0x00080000 /* The scheduler works in 1615 3 SP levels, the last 1616 being WFQ */ 1617 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_MODE3_WFQ_2SP 0x000C0000 /* The scheduler works in 1618 2 SP levels, the first 1619 one being WFQ */ 1620 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_MODE4_2SP_WFQ 0x00100000 /* The scheduler works in 1621 2 SP levels, the last 1622 one being WFQ */ 1623 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_MODE5_1SP_WFQ 0x00140000 /* The scheduler works in 1624 1 SP level and that is 1625 WFQ mode */ 1626 #define BCM_COSQ_GPORT_SCHEDULER_FQ 0x00200000 /* The scheduler works in 1627 Fair Queue mode */ 1628 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_ENHANCED_LOWPRI_FQ 0x00400000 /* The CL scheduler 1629 element is in enhanced 1630 CL mode, when the 1631 spouse FQ is the 1632 lowest priority */ 1633 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_ENHANCED_HIGHPRI_FQ 0x00800000 /* The CL scheduler 1634 element is in enhanced 1635 CL mode, when the 1636 spouse FQ is the 1637 highest priority */ 1638 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_WFQ_MODE_DISCREET 0x01000000 /* WFQ mode is Discreet */ 1639 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_WFQ_MODE_CLASS 0x02000000 /* WFQ mode is class 1640 based */ 1641 #define BCM_COSQ_GPORT_SCHEDULER_WFQ 0x02000000 /* The scheduler works in 1642 generic WFQ mode */ 1643 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_WFQ_MODE_INDEPENDENT 0x03000000 /* WFQ mode is 1644 independent (inverse) */ 1645 #define BCM_COSQ_GPORT_SCHEDULER_CLASS_WFQ_MODE_INDEPENDENT_PROPORTIONAL 0x08000000 /* WFQ mode is 1646 independent 1647 (proportinal) */ 1648 #define BCM_COSQ_GPORT_SCHEDULER_DUAL_SHAPER 0x04000000 /* The scheduler element 1649 is in Dual shaper 1650 mode. This scheduler 1651 element is composed of 1652 CL scheduler element 1653 for CIR and a FQ 1654 scheduler element for 1655 EIR. */ 1656 #define BCM_COSQ_GPORT_COMPOSITE 0x10000000 /* composite mode for 1657 CIR/PIR functionality */ 1658 #define BCM_COSQ_GPORT_NON_CONTIGUOUS_VOQ_CONNECTOR 0x00010000 /* queue, connector 1659 resource associated 1660 with non-contiguous 1661 connector region */ 1662 #define BCM_COSQ_GPORT_WITH_SHAPING 0x04000000 1663 #define BCM_COSQ_GPORT_WITHOUT_SHAPING 0x08000000 1664 #define BCM_COSQ_GPORT_MULTIPATH 0x10000000 1665 #define BCM_COSQ_GPORT_VLAN_UCAST_QUEUE_GROUP 0x20000000 1666 #define BCM_COSQ_GPORT_VIRTUAL_PORT 0x40000000 1667 #define BCM_COSQ_GPORT_ADD_COS 0x80000000 1668 #define BCM_COSQ_GPORT_CONF_SCOPE_CORE0 0x20000000 1669 #define BCM_COSQ_GPORT_CONF_SCOPE_CORE1 0x40000000 1670 #define BCM_COSQ_GPORT_SW_ONLY 0x80000000 1671 1672 #define BCM_COSQ_GPORT_PRIORITY_PROFILE_SET(_flags, _profile) \ 1673 _SHR_COSQ_GPORT_PRIORITY_PROFILE_SET(_flags, _profile) 1674 1675 #define BCM_COSQ_GPORT_LOCAL BCM_COSQ_GPORT_SUBSCRIBER /* for compatibility */ 1676 1677 #define BCM_COSQ_SUBSCRIBER_MAP_PORT_VLAN 0x00000001 1678 #define BCM_COSQ_SUBSCRIBER_MAP_ENCAP_ID 0x00000002 1679 1680 typedef struct bcm_cosq_subscriber_map_s { 1681 uint32 flags; 1682 bcm_port_t port; 1683 bcm_vlan_t vlan; 1684 bcm_if_t encap_id; 1685 bcm_gport_t queue_id; 1686 } bcm_cosq_subscriber_map_t; 1687 1688 #ifndef BCM_HIDE_DISPATCHABLE 1689 1690 /* Hierarchical queuing support */ 1691 extern int bcm_cosq_subscriber_map_add( 1692 int unit, 1693 bcm_cosq_subscriber_map_t *map); 1694 1695 /* Hierarchical queuing support */ 1696 extern int bcm_cosq_subscriber_map_delete( 1697 int unit, 1698 bcm_cosq_subscriber_map_t *map); 1699 1700 /* Hierarchical queuing support */ 1701 extern int bcm_cosq_subscriber_map_delete_all( 1702 int unit); 1703 1704 /* Hierarchical queuing support */ 1705 extern int bcm_cosq_subscriber_map_get( 1706 int unit, 1707 bcm_cosq_subscriber_map_t *map); 1708 1709 #endif /* BCM_HIDE_DISPATCHABLE */ 1710 1711 typedef int (*bcm_cosq_subscriber_map_traverse_cb)( 1712 int unit, 1713 bcm_cosq_subscriber_map_t *map, 1714 void *user_data); 1715 1716 #ifndef BCM_HIDE_DISPATCHABLE 1717 1718 /* Hierarchical queuing support */ 1719 extern int bcm_cosq_subscriber_traverse( 1720 int unit, 1721 bcm_cosq_subscriber_map_traverse_cb cb, 1722 void *user_data); 1723 1724 /* 1725 * Allocate/Retrieve unicast queue group and scheduler queue group 1726 * configuration. 1727 */ 1728 extern int bcm_cosq_gport_add( 1729 int unit, 1730 bcm_gport_t port, 1731 int numq, 1732 uint32 flags, 1733 bcm_gport_t *gport); 1734 1735 #endif /* BCM_HIDE_DISPATCHABLE */ 1736 1737 /* Config parameters for ingress queue bundle creation. */ 1738 typedef struct bcm_cosq_voq_connector_gport_s { 1739 uint32 flags; 1740 bcm_gport_t port; /* A gport that the created voq connector will 1741 be connected to at the to of the scheduling 1742 scheme. */ 1743 int numq; /* number of cos levels to be created/number of 1744 voq connectors in the created bundle. */ 1745 bcm_module_t remote_modid; /* Ingress module id */ 1746 uint32 nof_remote_cores; /* indicates how many connectors should be 1747 allocated */ 1748 } bcm_cosq_voq_connector_gport_t; 1749 1750 /* New flags for bcm_cosq_voq_connector_gport_add. */ 1751 #define BCM_COSQ_VOQ_CONNECTOR_GPORT_F_COMPOSITE 0x10000000 /* composite VOQ 1752 connector */ 1753 #define BCM_COSQ_VOQ_CONNECTOR_GPORT_F_NON_CONTIGUOUS 0x00010000 /* Create on 1754 non-contiguous 1755 connector region */ 1756 #define BCM_COSQ_VOQ_CONNECTOR_GPORT_F_WITH_ID 0x00000001 /* VOQ connector ID */ 1757 #define BCM_COSQ_VOQ_CONNECTOR_GPORT_F_LOW_RATE 0x00000002 /* Low rate VOQ connector */ 1758 #define BCM_COSQ_VOQ_CONNECTOR_GPORT_F_RESERVED 0x00000800 /* Place holder for 1759 legacy 1760 BCM_COSQ_GPORT_VOQ_CONNECTOR 1761 flag */ 1762 1763 #ifndef BCM_HIDE_DISPATCHABLE 1764 1765 /* Allocate voq connectors */ 1766 extern int bcm_cosq_voq_connector_gport_add( 1767 int unit, 1768 bcm_cosq_voq_connector_gport_t *config, 1769 bcm_gport_t *gport); 1770 1771 extern int bcm_cosq_voq_connector_gport_get( 1772 int unit, 1773 bcm_gport_t gport, 1774 bcm_cosq_voq_connector_gport_t *config); 1775 1776 /* Deletes queue group */ 1777 extern int bcm_cosq_gport_delete( 1778 int unit, 1779 bcm_gport_t gport); 1780 1781 #endif /* BCM_HIDE_DISPATCHABLE */ 1782 1783 /* Config parameters for rate class create. */ 1784 typedef struct bcm_cosq_rate_class_create_info_s { 1785 int rate; /* port rate in Gbps. */ 1786 uint32 attributes; /* additinal attributes for the rate class. see 1787 COSQ_RATE_CLASS_CREATE_ATTR_XXX */ 1788 } bcm_cosq_rate_class_create_info_t; 1789 1790 #define BCM_COSQ_RATE_CLASS_CREATE_ATTR_SLOW_ENABLED 0x2 /* slow mechanism enabled */ 1791 #define BCM_COSQ_RATE_CLASS_CREATE_ATTR_OCB_ONLY 0x4 /* rate class to be used 1792 on OCB only */ 1793 #define BCM_COSQ_RATE_CLASS_CREATE_ATTR_MULTICAST 0x8 /* rate class for FMQs 1794 (Fabric Multicast 1795 Queues) */ 1796 1797 #ifndef BCM_HIDE_DISPATCHABLE 1798 1799 /* create a rate class with the specified attributes. */ 1800 extern int bcm_cosq_gport_rate_class_create( 1801 int unit, 1802 bcm_gport_t gport, 1803 uint32 flags, 1804 bcm_cosq_rate_class_create_info_t *create_info); 1805 1806 #endif /* BCM_HIDE_DISPATCHABLE */ 1807 1808 /* Config parameters for ingress queue attributes. */ 1809 typedef struct bcm_cosq_queue_attributes_s { 1810 int delay_tolerance_level; /* Credit request profile of each queue in the 1811 bundle. */ 1812 int rate_class; /* Rate class profile of each queue in the 1813 bundle. */ 1814 } bcm_cosq_queue_attributes_t; 1815 1816 /* Config parameters for ingress queue bundle creation. */ 1817 typedef struct bcm_cosq_ingress_queue_bundle_gport_config_s { 1818 uint32 flags; 1819 bcm_gport_t port; /* A gport that the created queue will 1820 be connected to, usually a system 1821 port. */ 1822 bcm_core_t local_core_id; /* Used to select the core of the 1823 created gport when 1824 BCM_COSQ_GPORT_WITH_ID is not used. 1825 Only relevant when asymmetrical mode. */ 1826 int numq; /* number of cos levels to be 1827 created/number of queues in the 1828 created bundle. */ 1829 bcm_cosq_queue_attributes_t queue_atrributes[BCM_COS_COUNT]; /* Config parameters for ingress queue 1830 attributes. */ 1831 } bcm_cosq_ingress_queue_bundle_gport_config_t; 1832 1833 #ifndef BCM_HIDE_DISPATCHABLE 1834 1835 /* Create an ingress queue bundle. */ 1836 extern int bcm_cosq_ingress_queue_bundle_gport_add( 1837 int unit, 1838 bcm_cosq_ingress_queue_bundle_gport_config_t *config, 1839 bcm_gport_t *gport); 1840 1841 /* Get or set the mapping from internal priority to CoS queue. */ 1842 extern int bcm_cosq_gport_mapping_set( 1843 int unit, 1844 bcm_port_t ing_port, 1845 bcm_cos_t int_pri, 1846 uint32 flags, 1847 bcm_gport_t gport, 1848 bcm_cos_queue_t cosq); 1849 1850 /* Get or set the mapping from internal priority to CoS queue. */ 1851 extern int bcm_cosq_gport_mapping_get( 1852 int unit, 1853 bcm_port_t ing_port, 1854 bcm_cos_t int_pri, 1855 uint32 flags, 1856 bcm_gport_t *gport, 1857 bcm_cos_queue_t *cosq); 1858 1859 /* Configure/Retrieve bandwidth setting. */ 1860 extern int bcm_cosq_gport_bandwidth_set( 1861 int unit, 1862 bcm_gport_t gport, 1863 bcm_cos_queue_t cosq, 1864 uint32 kbits_sec_min, 1865 uint32 kbits_sec_max, 1866 uint32 flags); 1867 1868 /* Configure/Retrieve bandwidth setting. */ 1869 extern int bcm_cosq_gport_bandwidth_get( 1870 int unit, 1871 bcm_gport_t gport, 1872 bcm_cos_queue_t cosq, 1873 uint32 *kbits_sec_min, 1874 uint32 *kbits_sec_max, 1875 uint32 *flags); 1876 1877 /* Configure/retrieve scheduling policy */ 1878 extern int bcm_cosq_gport_sched_set( 1879 int unit, 1880 bcm_gport_t gport, 1881 bcm_cos_queue_t cosq, 1882 int mode, 1883 int weight); 1884 1885 /* Configure/retrieve scheduling policy */ 1886 extern int bcm_cosq_gport_sched_get( 1887 int unit, 1888 bcm_gport_t gport, 1889 bcm_cos_queue_t cosq, 1890 int *mode, 1891 int *weight); 1892 1893 #endif /* BCM_HIDE_DISPATCHABLE */ 1894 1895 /* dynamic weights types. */ 1896 typedef enum bcm_cosq_dynamic_state_e { 1897 bcmCosqDynamicStateNormal = 0, /* Regular weight */ 1898 bcmCosqDynamicStateQueue0Congested = 1, /* Pipe 0 is congested, Pipe 1 not 1899 congested */ 1900 bcmCosqDynamicStateQueue1Congested = 2, /* Pipe 1 is congested, Pipe 0 not 1901 congested */ 1902 bcmCosqDynamicStateCongested = 3 /* Weight for congested pipe */ 1903 } bcm_cosq_dynamic_state_t; 1904 1905 #ifndef BCM_HIDE_DISPATCHABLE 1906 1907 /* set/get weights dynamic or regular weights */ 1908 extern int bcm_cosq_gport_dynamic_sched_set( 1909 int unit, 1910 bcm_gport_t gport, 1911 bcm_cos_queue_t cosq, 1912 bcm_cosq_dynamic_state_t state, 1913 int weight); 1914 1915 /* set/get weights dynamic or regular weights */ 1916 extern int bcm_cosq_gport_dynamic_sched_get( 1917 int unit, 1918 bcm_gport_t gport, 1919 bcm_cos_queue_t cosq, 1920 bcm_cosq_dynamic_state_t state, 1921 int *weight); 1922 1923 #endif /* BCM_HIDE_DISPATCHABLE */ 1924 1925 /* Discard rules. */ 1926 typedef struct bcm_cosq_discard_rule_s { 1927 uint32 egress_pool_congestion_state; /* Pool congestion state. */ 1928 uint32 queue_min_congestion_state; /* Q min use state. */ 1929 uint32 action; /* Discard action. */ 1930 } bcm_cosq_discard_rule_t; 1931 1932 #define BCM_COSQ_DISCARD_CONGESTION_LOW 0 1933 #define BCM_COSQ_DISCARD_CONGESTION_MEDIUM 1 1934 #define BCM_COSQ_DISCARD_CONGESTION_HIGH 2 1935 1936 #define BCM_COSQ_DISCARD_ACTION_WRED_DROP 0 1937 #define BCM_COSQ_DISCARD_ACTION_FORCE_DROP 1 1938 #define BCM_COSQ_DISCARD_ACTION_FORCE_NO_DROP 2 1939 1940 /* Initialize a discard rule structure. */ 1941 extern void bcm_cosq_discard_rule_t_init( 1942 bcm_cosq_discard_rule_t *rule); 1943 1944 #ifndef BCM_HIDE_DISPATCHABLE 1945 1946 /* Create an empty discard rule profile. */ 1947 extern int bcm_cosq_discard_profile_create( 1948 int unit, 1949 int *profile_id); 1950 1951 /* Destroy a discard rule profile. */ 1952 extern int bcm_cosq_discard_profile_destroy( 1953 int unit, 1954 int profile_id); 1955 1956 /* Update one rule in a profile. */ 1957 extern int bcm_cosq_discard_profile_update( 1958 int unit, 1959 int profile_id, 1960 bcm_cosq_discard_rule_t *rule); 1961 1962 extern int bcm_cosq_discard_profile_get( 1963 int unit, 1964 int profile_id, 1965 int max, 1966 bcm_cosq_discard_rule_t *rule_array, 1967 int *rule_count); 1968 1969 /* Configure/Retrieve discard setting. */ 1970 extern int bcm_cosq_gport_discard_set( 1971 int unit, 1972 bcm_gport_t gport, 1973 bcm_cos_queue_t cosq, 1974 bcm_cosq_gport_discard_t *discard); 1975 1976 /* Configure/Retrieve discard setting. */ 1977 extern int bcm_cosq_gport_discard_get( 1978 int unit, 1979 bcm_gport_t gport, 1980 bcm_cos_queue_t cosq, 1981 bcm_cosq_gport_discard_t *discard); 1982 1983 /* Configure/Retrieve discard setting. */ 1984 extern int bcm_cosq_gport_discard_extended_set( 1985 int unit, 1986 bcm_cosq_object_id_t *id, 1987 bcm_cosq_gport_discard_t *discard); 1988 1989 /* Configure/Retrieve discard setting. */ 1990 extern int bcm_cosq_gport_discard_extended_get( 1991 int unit, 1992 bcm_cosq_object_id_t *id, 1993 bcm_cosq_gport_discard_t *discard); 1994 1995 #endif /* BCM_HIDE_DISPATCHABLE */ 1996 1997 #define BCM_COSQ_SCHED_CONFIG_EXPEDITE 0x00000001 1998 1999 #ifndef BCM_HIDE_DISPATCHABLE 2000 2001 /* Mapping/redirecting scheduling discipline to Egress FIFO. */ 2002 extern int bcm_cosq_gport_sched_config_set( 2003 int unit, 2004 bcm_gport_t gport, 2005 int sched_mode, 2006 int int_pri, 2007 uint32 flags); 2008 2009 /* Mapping/redirecting scheduling discipline to Egress FIFO. */ 2010 extern int bcm_cosq_gport_sched_config_get( 2011 int unit, 2012 bcm_gport_t gport, 2013 int sched_mode, 2014 int int_pri, 2015 uint32 *flags); 2016 2017 /* 2018 * Configure/retrieve mapping of fabric egress cos level to front panel 2019 * cos level. 2020 */ 2021 extern int bcm_cosq_gport_flow_control_set( 2022 int unit, 2023 bcm_gport_t port, 2024 bcm_cos_t int_pri, 2025 uint32 flow_control_mask); 2026 2027 /* 2028 * Configure/retrieve mapping of fabric egress cos level to front panel 2029 * cos level. 2030 */ 2031 extern int bcm_cosq_gport_flow_control_get( 2032 int unit, 2033 bcm_gport_t port, 2034 bcm_cos_t int_pri, 2035 uint32 *flow_control_mask); 2036 2037 /* Attach/Detach the output of a GPORT to the input of a scheduler GPORT. */ 2038 extern int bcm_cosq_gport_attach( 2039 int unit, 2040 bcm_gport_t sched_port, 2041 bcm_gport_t input_port, 2042 bcm_cos_queue_t cosq); 2043 2044 /* Attach/Detach the output of a GPORT to the input of a scheduler GPORT. */ 2045 extern int bcm_cosq_gport_detach( 2046 int unit, 2047 bcm_gport_t sched_port, 2048 bcm_gport_t input_port, 2049 bcm_cos_queue_t cosq); 2050 2051 /* Attach/Detach the output of a GPORT to the input of a scheduler GPORT. */ 2052 extern int bcm_cosq_gport_attach_get( 2053 int unit, 2054 bcm_gport_t sched_port, 2055 bcm_gport_t *input_port, 2056 bcm_cos_queue_t *cosq); 2057 2058 /* 2059 * Get the child node GPORT atatched to N-th index (cosq) of the 2060 * scheduler GPORT. 2061 */ 2062 extern int bcm_cosq_gport_child_get( 2063 int unit, 2064 bcm_gport_t in_gport, 2065 bcm_cos_queue_t cosq, 2066 bcm_gport_t *out_gport); 2067 2068 /* retrieve parent scheduler for a child gport */ 2069 extern int bcm_cosq_gport_parent_get( 2070 int unit, 2071 bcm_gport_t child_port, 2072 bcm_cos_queue_t cos, 2073 bcm_gport_t *parent_port); 2074 2075 #endif /* BCM_HIDE_DISPATCHABLE */ 2076 2077 #define BCM_COSQ_GPORT_QUEUE_ATTACH_WITH_ID 0x00000001 2078 #define BCM_COS_MULTICAST_EF -2 2079 #define BCM_COS_MULTICAST_NON_EF -3 2080 2081 #define BCM_COSQ_GPORT_ATTACH_ID_SYSPORT_SET(_attach_id, _sysport) \ 2082 _SHR_COSQ_GPORT_ATTACH_ID_SYSPORT_SET(_attach_id,_sysport) 2083 2084 #ifndef BCM_HIDE_DISPATCHABLE 2085 2086 extern int bcm_cosq_gport_queue_attach( 2087 int unit, 2088 uint32 flags, 2089 bcm_gport_t ingress_queue, 2090 bcm_cos_t ingress_int_pri, 2091 bcm_gport_t egress_queue, 2092 bcm_cos_t egress_int_pri, 2093 int *attach_id); 2094 2095 extern int bcm_cosq_gport_queue_detach( 2096 int unit, 2097 bcm_gport_t ingress_queue, 2098 bcm_cos_t ingress_int_pri, 2099 int attach_id); 2100 2101 extern int bcm_cosq_gport_queue_attach_get( 2102 int unit, 2103 bcm_gport_t ingress_queue, 2104 bcm_cos_t ingress_int_pri, 2105 bcm_gport_t *egress_queue, 2106 bcm_cos_t *egress_int_pri, 2107 int attach_id); 2108 2109 #endif /* BCM_HIDE_DISPATCHABLE */ 2110 2111 #define BCM_COSQ_GPORT_CONNECTION_INGRESS 0x01 /* establishing the 2112 connection on ingress */ 2113 #define BCM_COSQ_GPORT_CONNECTION_EGRESS 0x02 /* establishing the 2114 connection on egress */ 2115 #define BCM_COSQ_GPORT_CONNECTION_INVALID 0x04 /* removing the 2116 connection */ 2117 #define BCM_COSQ_GPORT_CONNECTION_MODID_OVERRIDE 0x08 2118 2119 /* connection information */ 2120 typedef struct bcm_cosq_gport_connection_s { 2121 uint32 flags; 2122 bcm_module_t remote_modid; /* remote module id. */ 2123 bcm_gport_t voq; /* voq gport */ 2124 bcm_gport_t voq_connector; /* voq connector gport */ 2125 } bcm_cosq_gport_connection_t; 2126 2127 #ifndef BCM_HIDE_DISPATCHABLE 2128 2129 /* attaches VoQ connector to the VoQ */ 2130 extern int bcm_cosq_gport_connection_set( 2131 int unit, 2132 bcm_cosq_gport_connection_t *gport_connect); 2133 2134 /* attaches VoQ connector to the VoQ */ 2135 extern int bcm_cosq_gport_connection_get( 2136 int unit, 2137 bcm_cosq_gport_connection_t *gport_connect); 2138 2139 #endif /* BCM_HIDE_DISPATCHABLE */ 2140 2141 #define BCM_COSQ_DELAY_TOLERANCE_SLOW_LEVELS 7 /* Number of slow 2142 threshold levels. */ 2143 2144 /* delay tolerance configuration */ 2145 typedef struct bcm_cosq_delay_tolerance_s { 2146 int credit_request_watchdog_status_msg_gen; /* Watch Dog Status Message Generation 2147 Period. When the Watch Dog Status 2148 Message Generation Period time passed 2149 since the last credit for an active 2150 Queue, the Queue will generate flow 2151 status message again. Range depends 2152 on mode. ARAD A supports 1-15 in 2153 aggressive status message credit 2154 watchdog mode, and 33-500 in the 2155 normal mode. (0 disables TH). 2156 Resolution: WD full cycle units. */ 2157 int credit_request_watchdog_delete_queue_thresh; /* Watch Dog Delete Queue Threshold. 2158 When the Watch Dog Delete Queue 2159 Threshold time passed since the last 2160 credit for an active Queue, the Queue 2161 will be in Delete State. Range: 2162 100-500. (0 disables TH). Not 2163 supported in aggressive status 2164 message credit watchdog mode of ARAD 2165 A. Units: milliseconds. Resolution: 2166 WD full cycle units. */ 2167 int credit_request_hungry_off_to_slow_thresh; /* When (QsizeCrBal) > 2168 off_to_slow_thresh, and CRS==OFF, CRS 2169 may be changed to SLOW. Resolution in 2170 bytes. Range: (-229376) - (229376). 2171 Resolution: 1 Byte. */ 2172 int credit_request_hungry_off_to_normal_thresh; /* When (QsizeCrBal) > 2173 off_to_normal_thresh, and CRS==OFF, 2174 CRS may be changed to NORM. 2175 Resolution in bytes. Range: (-229376) 2176 - (229376). Resolution: 1 Byte. */ 2177 int credit_request_hungry_slow_to_normal_thresh; /* When (QsizeCrBal) > 2178 slow_to_normal_thresh, and CRS==SLOW, 2179 CRS may be changed to NORM. 2180 Resolution in bytes. Range: 2181 (-229376) - (229376). Resolution: 1 2182 Byte. */ 2183 int credit_request_hungry_normal_to_slow_thresh; /* When (QsizeCrBal) < 2184 normal_to_slow_th, and CRS==NORM, CRS 2185 may be changed to SLOW. Resolution in 2186 bytes. Range: (-229376) - (229376). 2187 Resolution: 1 Byte. */ 2188 int credit_request_hungry_multiplier; /* When queue size crosses a multiply of 2189 multiplier a new FlowStatus Cell is 2190 generated. Resolution in bytes. 2191 Range: 2^5 2^12. (2^4 disables 2192 mechanism). */ 2193 int credit_request_satisfied_backoff_enter_thresh; /* When the Credit Balance is bigger 2194 than the threshold, the device sends 2195 OFF message to the scheduler. This is 2196 to prevent credit accumulation from a 2197 certain threshold. Resolution in 2198 bytes. Range: 0 491520. Resolution: 2199 1 Byte. */ 2200 int credit_request_satisfied_backoff_exit_thresh; /* Hysteresis value for to the Backoff 2201 Enter. Resolution in bytes. Range: 0 2202 491520. Resolution: 1 Byte. */ 2203 int credit_request_satisfied_backlog_enter_thresh; /* When the Credit Balance is bigger 2204 Backlog Enter threshold bytes than 2205 the queue size, the device sends OFF 2206 message to the scheduler. This 2207 threshold acts as Slow/Norm to off 2208 threshold. Resolution in bytes. 2209 Range: 0 491520. Resolution: 1 Byte. */ 2210 int credit_request_satisfied_backlog_exit_thresh; /* Hysteresis value for to the Backlog 2211 Exit. Resolution in bytes. Range: 0 2212 491520. Resolution: 1 Byte. */ 2213 int credit_request_satisfied_backslow_enter_thresh; /* Hysteresis value for to the Backslow 2214 Enter. Resolution in bytes. Range: 0 2215 491520. Resolution: 1 Byte. */ 2216 int credit_request_satisfied_backslow_exit_thresh; /* Hysteresis value for to the Backslow 2217 Exit. Resolution in bytes. Range: 0 2218 491520. Resolution: 1 Byte. */ 2219 int credit_request_satisfied_empty_queue_thresh; /* When Qsize==0 and CrBal >= 2220 satisfied_empty_q_th, the CRS is 2221 changed to OFF. This threshold is a 2222 specific case of 2223 PETRA_ITM_CR_REQUEST_CR_BALANCE_TH. 2224 backlog_enter_th threshold. 2225 Resolution in bytes. Range: 32768 2226 32767. */ 2227 int credit_request_satisfied_empty_queue_max_balance_thresh; /* Max Empty Queue Credit Balance. This 2228 value is the maximum credits an empty 2229 queue can accumulate. Resolution in 2230 bytes. Range: 32768 32767. */ 2231 int credit_request_satisfied_empty_queue_exceed_thresh; /* Exceed Max Empty Queue Credit 2232 Balance. This indication permits the 2233 credit balance of an empty queue to 2234 exceed configured Exceed Max Empty 2235 Queue Credit Balance up to (Credit 2236 Value minus 1), when a credit is 2237 received. This is used to prevent the 2238 deletion of partial credits. */ 2239 uint32 flags; /* flags for the API */ 2240 int slow_level_thresh_up[BCM_COSQ_DELAY_TOLERANCE_SLOW_LEVELS]; /* Slow level thresholds upwards */ 2241 int slow_level_thresh_down[BCM_COSQ_DELAY_TOLERANCE_SLOW_LEVELS]; /* Slow level thresholds downwards */ 2242 int bandwidth_level; /* Level of rate (port rate) */ 2243 } bcm_cosq_delay_tolerance_t; 2244 2245 /* 2246 * tolerance level related flags specified in the flags field of 2247 * bcm_cosq_delay_tolerance_t. 2248 */ 2249 #define BCM_COSQ_DELAY_TOLERANCE_REMOTE_CREDIT_VALUE 0x1 /* Specifies that the 2250 profile works with the 2251 remote credit value, 2252 works only in specific 2253 device types */ 2254 #define BCM_COSQ_DELAY_TOLERANCE_IS_LOW_LATENCY 0x2 /* Specifies that the 2255 profile is for low 2256 latency queues 2257 enabling multiple 2258 packet dequeues */ 2259 #define BCM_COSQ_DELAY_TOLERANCE_HIGH_Q_PRIORITY 0x4 /* Specifies that the 2260 profile is for high 2261 priority queue. */ 2262 #define BCM_COSQ_DELAY_TOLERANCE_TOLERANCE_OCB_ONLY 0x8 /* Specifies that the 2263 profile is for 2264 OCB-only queues. */ 2265 #define BCM_COSQ_DELAY_TOLERANCE_BANDWIDTH_PROFILE_HIGH 0x10 /* Set a queue MAX 2266 command credits 2267 configurations for 2268 high bandwidth 2269 traffic. */ 2270 #define BCM_COSQ_DELAY_TOLERANCE_PUSH_QUEUE 0x20 /* Specifies that the 2271 profile is for push 2272 queue. */ 2273 2274 #ifndef BCM_HIDE_DISPATCHABLE 2275 2276 /* Configures delay tolerance scheduling disciplines */ 2277 extern int bcm_cosq_delay_tolerance_level_set( 2278 int unit, 2279 int delay_tolerance_level, 2280 bcm_cosq_delay_tolerance_t *delay_tolerance); 2281 2282 /* Configures delay tolerance scheduling disciplines */ 2283 extern int bcm_cosq_delay_tolerance_level_get( 2284 int unit, 2285 int delay_tolerance_level, 2286 bcm_cosq_delay_tolerance_t *delay_tolerance); 2287 2288 #endif /* BCM_HIDE_DISPATCHABLE */ 2289 2290 /* attributes use to get a set of recommended delay tolerance values */ 2291 typedef struct bcm_cosq_delay_tolerance_preset_attr_s { 2292 int rate; /* approximately the desired credit rate in Gbps */ 2293 int credit_size; /* egress device credit size in bytes */ 2294 uint32 flags; /* additional attributes - 2295 BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_XXX */ 2296 } bcm_cosq_delay_tolerance_preset_attr_t; 2297 2298 /* attributes used by bcm_cosq_delay_tolerance_preset_attr_t.flags */ 2299 #define BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_HIGH_PRIORITY 0x1 /* used to get 2300 recommended values for 2301 high priority queues */ 2302 #define BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_SLOW_ENABLED 0x2 /* used to get 2303 recommended values 2304 with slow mechanism 2305 enabled */ 2306 #define BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_OCB_ONLY 0x4 /* used to get 2307 recommended values for 2308 OCB only queues. */ 2309 #define BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_MULTICAST 0x8 /* used to get 2310 recommended values for 2311 FMQs (Fabric Multicast 2312 Queues). */ 2313 #define BCM_COSQ_DELAY_TOLERANCE_PRESET_ATTR_F_PUSH_QUEUE 0x10 /* Used to get parameters 2314 for push queue 2315 profile. */ 2316 2317 #ifndef BCM_HIDE_DISPATCHABLE 2318 2319 /* Get recommended set of delay tolerance thresholds */ 2320 extern int bcm_cosq_delay_tolerance_preset_get( 2321 int unit, 2322 bcm_cosq_delay_tolerance_preset_attr_t *preset_attr, 2323 bcm_cosq_delay_tolerance_t *delay_tolerance); 2324 2325 #endif /* BCM_HIDE_DISPATCHABLE */ 2326 2327 /* Initialize a preset attributes structure. */ 2328 extern void bcm_cosq_delay_tolerance_preset_attr_t_init( 2329 bcm_cosq_delay_tolerance_preset_attr_t *preset_attr); 2330 2331 #ifndef BCM_HIDE_DISPATCHABLE 2332 2333 /* 2334 * Configure/retrieve {traffic class, dp} mapping to egress queue on a 2335 * port. 2336 */ 2337 extern int bcm_cosq_gport_egress_map_set( 2338 int unit, 2339 bcm_gport_t gport, 2340 bcm_cos_t ingress_pri, 2341 bcm_color_t ingress_dp, 2342 bcm_cos_queue_t offset); 2343 2344 /* 2345 * Configure/retrieve {traffic class, dp} mapping to egress queue on a 2346 * port. 2347 */ 2348 extern int bcm_cosq_gport_egress_map_get( 2349 int unit, 2350 bcm_gport_t gport, 2351 bcm_cos_t ingress_pri, 2352 bcm_color_t ingress_dp, 2353 bcm_cos_queue_t *offset); 2354 2355 #endif /* BCM_HIDE_DISPATCHABLE */ 2356 2357 /* flag values for multicast config setting */ 2358 #define BCM_COSQ_MULTICAST_SCHEDULED 0x00000001 /* multicast scheduled values 2359 are valid */ 2360 #define BCM_COSQ_MULTICAST_UNSCHEDULED 0x00000002 /* multicast unscheduled 2361 values are valid */ 2362 2363 /* multicast configuration settings */ 2364 typedef enum bcm_cosq_egress_multicast_service_pools_e { 2365 bcmCosqEgressMulticastServicePool0 = 0, /* Service pool 0 identifier */ 2366 bcmCosqEgressMulticastServicePool1 = 1 /* Service pool 1 identifier */ 2367 } bcm_cosq_egress_multicast_service_pools_t; 2368 2369 /* multicast configuration settings */ 2370 typedef struct bcm_cosq_egress_multicast_config_s { 2371 bcm_color_t scheduled_dp; /* drop precedence */ 2372 bcm_cos_t priority; /* TC */ 2373 int unscheduled_se; /* shared resource eligibility */ 2374 int unscheduled_sp; /* service pool ID */ 2375 } bcm_cosq_egress_multicast_config_t; 2376 2377 #ifndef BCM_HIDE_DISPATCHABLE 2378 2379 /* 2380 * Configure/retrieve {traffic class, dp} mapping to multicast egress 2381 * configuration on a port. 2382 */ 2383 extern int bcm_cosq_gport_egress_multicast_config_set( 2384 int unit, 2385 bcm_gport_t gport, 2386 bcm_cos_t ingress_pri, 2387 bcm_color_t ingress_dp, 2388 uint32 flags, 2389 bcm_cosq_egress_multicast_config_t *config); 2390 2391 /* 2392 * Configure/retrieve {traffic class, dp} mapping to multicast egress 2393 * configuration on a port. 2394 */ 2395 extern int bcm_cosq_gport_egress_multicast_config_get( 2396 int unit, 2397 bcm_gport_t gport, 2398 bcm_cos_t ingress_pri, 2399 bcm_color_t ingress_dp, 2400 uint32 flags, 2401 bcm_cosq_egress_multicast_config_t *config); 2402 2403 #endif /* BCM_HIDE_DISPATCHABLE */ 2404 2405 /* flag values for VSQ creation */ 2406 #define BCM_COSQ_VSQ_GL 1 /* create 1 global VSQ */ 2407 #define BCM_COSQ_VSQ_CT 2 /* create according to Category */ 2408 #define BCM_COSQ_VSQ_CTTC 3 /* create according to Category * 2409 Traffic-Class */ 2410 #define BCM_COSQ_VSQ_CTCC 4 /* create according to Category * 2411 Connection-Class */ 2412 #define BCM_COSQ_VSQ_PP 5 /* create according to 2413 ST-VSQ-Pointer, arrived from the 2414 field processor or external PP */ 2415 #define BCM_COSQ_VSQ_LLFC 6 /* create according to Source Network 2416 Port */ 2417 #define BCM_COSQ_VSQ_PFC 7 /* create according to Packet 2418 Priority */ 2419 2420 /* VSQ info settings */ 2421 typedef struct bcm_cosq_vsq_info_s { 2422 uint32 flags; /* flags for vsq info */ 2423 int ct_id; /* Category ID. Relevant when flag is CT/CTTC/CTCC */ 2424 int cc_id; /* Connection Class ID. Relevant when flag is CTCC */ 2425 int traffic_class; /* VSQ Traffic Class ID. The VSQ traffic class ID 2426 only relevant for the VSQ mapping and doesn't 2427 remap the system TC. Relevant when flag is CTTC */ 2428 bcm_gport_t src_port; /* Source Physical port ID. The network interface ID 2429 that the packet arrived from. Relevant when flag 2430 is LLFC, PFC */ 2431 int pp_vsq_id; /* The ID of the VSQ, in the PP space. Relevant when 2432 flag PP is set. In this case, the user specifies 2433 the ST-VSQ-Pointer in the range 0-255 from the 2434 FP/PP that needs to be mapped to the VSQ */ 2435 bcm_core_t core_id; /* The core ID of the VSQ */ 2436 } bcm_cosq_vsq_info_t; 2437 2438 #ifndef BCM_HIDE_DISPATCHABLE 2439 2440 /* Create the VSQ. */ 2441 extern int bcm_cosq_gport_vsq_create( 2442 int unit, 2443 bcm_cosq_vsq_info_t *vsq_info, 2444 bcm_gport_t *vsq_gport); 2445 2446 #endif /* BCM_HIDE_DISPATCHABLE */ 2447 2448 #define BCM_COSQ_VSQ_NOF_PG 8 /* The Maximum number of PGs in 2449 bundle. */ 2450 2451 /* Config parameters for PG VSQs attributes. */ 2452 typedef struct bcm_cosq_pg_vsq_attributes_s { 2453 uint8 cosq_bitmap; /* a bitmap of the priorities/TCs (0-7) that are 2454 included in the PG */ 2455 uint8 ocb_only; /* is OCB-only (otherwise it is DRAM-mix. */ 2456 uint8 pool_id; /* pool ID, can be is 0 or 1 */ 2457 uint8 is_lossles; /* is it lossless (eligible to headroom) */ 2458 } bcm_cosq_pg_vsq_attributes_t; 2459 2460 /* Config parameters for src based VSQs attributes. */ 2461 typedef struct bcm_cosq_src_vsqs_gport_config_s { 2462 uint32 flags; 2463 int numq; /* the PG size bundle. */ 2464 bcm_cosq_pg_vsq_attributes_t pg_attributes[BCM_COSQ_VSQ_NOF_PG]; /* Config parameters for src based VSQs 2465 attributes. */ 2466 } bcm_cosq_src_vsqs_gport_config_t; 2467 2468 #ifndef BCM_HIDE_DISPATCHABLE 2469 2470 /* Create the source based VSQ. */ 2471 extern int bcm_cosq_src_vsqs_gport_add( 2472 int unit, 2473 bcm_gport_t port, 2474 bcm_cosq_src_vsqs_gport_config_t *config, 2475 bcm_gport_t *src_port_vsq_gport, 2476 bcm_gport_t *pg_base_vsq_gport); 2477 2478 /* Create the source based VSQ. */ 2479 extern int bcm_cosq_src_vsqs_gport_get( 2480 int unit, 2481 bcm_gport_t port, 2482 bcm_cosq_src_vsqs_gport_config_t *config, 2483 bcm_gport_t *src_port_vsq_gport, 2484 bcm_gport_t *pg_base_vsq_gport); 2485 2486 /* Destroy the VSQ. */ 2487 extern int bcm_cosq_gport_vsq_destroy( 2488 int unit, 2489 bcm_gport_t vsq_gport); 2490 2491 /* adding/deleting queue to vsq */ 2492 extern int bcm_cosq_gport_vsq_add( 2493 int unit, 2494 bcm_gport_t vsq, 2495 bcm_gport_t queue, 2496 bcm_cos_queue_t cosq); 2497 2498 /* adding/deleting queue to vsq */ 2499 extern int bcm_cosq_gport_vsq_delete( 2500 int unit, 2501 bcm_gport_t vsq, 2502 bcm_gport_t queue, 2503 bcm_cos_queue_t cosq); 2504 2505 /* deleting all queues from vsq */ 2506 extern int bcm_cosq_gport_vsq_delete_all( 2507 int unit, 2508 bcm_gport_t vsq); 2509 2510 /* retrieving queues that are part of vsq */ 2511 extern int bcm_cosq_gport_vsq_get( 2512 int unit, 2513 bcm_gport_t vsq, 2514 int queue_max, 2515 bcm_gport_t *queue_array, 2516 bcm_cos_queue_t *cosq_array, 2517 int *queue_count); 2518 2519 #endif /* BCM_HIDE_DISPATCHABLE */ 2520 2521 /* flag values for threshold setting */ 2522 #define BCM_COSQ_THRESHOLD_PER_DP 0x00000001 /* dp field meaningful */ 2523 #define BCM_COSQ_THRESHOLD_INGRESS 0x00000002 /* device level ingress 2524 thresholds */ 2525 #define BCM_COSQ_THRESHOLD_EGRESS 0x00000004 /* device level egress 2526 thresholds */ 2527 #define BCM_COSQ_THRESHOLD_UNICAST 0x00000008 /* device level unicast 2528 thresholds */ 2529 #define BCM_COSQ_THRESHOLD_MULTICAST 0x00000010 /* device level multicast 2530 thresholds */ 2531 #define BCM_COSQ_THRESHOLD_SET 0x00000020 /* threshold for assert 2532 condition (where 2533 applicable) */ 2534 #define BCM_COSQ_THRESHOLD_CLEAR 0x00000040 /* threshold for 2535 de-assert (where 2536 applicable) */ 2537 #define BCM_COSQ_THRESHOLD_NOT_COMMIT 0x00000080 /* to aid in template 2538 management */ 2539 #define BCM_COSQ_THRESHOLD_FLOW_CONTROL 0x00000100 /* flow control */ 2540 #define BCM_COSQ_THRESHOLD_DROP 0x00000200 /* Admission Control */ 2541 #define BCM_COSQ_THRESHOLD_MULTICAST_SP0 0x00000400 /* Multicast Service-Pool 2542 0 */ 2543 #define BCM_COSQ_THRESHOLD_MULTICAST_SP1 0x00000800 /* Multicast Service-Pool 2544 1 */ 2545 #define BCM_COSQ_THRESHOLD_COLOR_SYSTEM_RED 0x00001000 /* Set Color System red 2546 format */ 2547 #define BCM_COSQ_THRESHOLD_RANGE_0 0x00002000 /* Set Range 0 threshold, 2548 where threshold value 2549 indicates the max size 2550 of the specific range */ 2551 #define BCM_COSQ_THRESHOLD_RANGE_1 0x00004000 /* Set Range 1 threshold, 2552 where threshold value 2553 indicates the max size 2554 of the specific range */ 2555 #define BCM_COSQ_THRESHOLD_RANGE_2 0x00008000 /* Set Range 2 threshold, 2556 where threshold value 2557 indicates the max size 2558 of the specific range */ 2559 #define BCM_COSQ_THRESHOLD_RANGE_3 0x00010000 /* Set Range 3 threshold, 2560 where threshold value 2561 indicates the max size 2562 of the specific range */ 2563 #define BCM_COSQ_THRESHOLD_OCB 0x00020000 /* On-Chip buffer */ 2564 #define BCM_COSQ_THRESHOLD_RCI 0x00040000 /* Set threshold value 2565 for RCI */ 2566 #define BCM_COSQ_THRESHOLD_ETH_PORT_LLFC 0x00080000 /* Set LLFC threshold 2567 value for Ethernet 2568 port */ 2569 #define BCM_COSQ_THRESHOLD_ETH_PORT_PFC 0x00100000 /* Set PFC threshold 2570 value for Ethernet 2571 port */ 2572 #define BCM_COSQ_THRESHOLD_POOL0 0x00200000 /* Set threshold value 2573 for shared Pool 0 2574 resource */ 2575 #define BCM_COSQ_THRESHOLD_POOL1 0x00400000 /* Set threshold value 2576 for shared Pool 1 2577 resource */ 2578 #define BCM_COSQ_THRESHOLD_QSIZE_RECOVERY 0x00800000 /* Queue size recovery 2579 threshold settings */ 2580 #define BCM_COSQ_THRESHOLD_HEADROOM 0x01000000 /* Set threshold value 2581 for sram headroom 2582 resource */ 2583 #define BCM_COSQ_THRESHOLD_ETH_PORT_HIGH_FIFO 0x02000000 /* Set threshold value 2584 for High priority RMC */ 2585 #define BCM_COSQ_THRESHOLD_ETH_PORT_LOW_FIFO 0x04000000 /* Set threshold value 2586 for Low priority RMC */ 2587 #define BCM_COSQ_THRESHOLD_ETH_PORT_TDM_FIFO 0x08000000 /* Set threshold value 2588 for TDM priority RMC */ 2589 2590 /* threshold type enumerartions */ 2591 typedef enum bcm_cosq_threshold_type_e { 2592 bcmCosqThresholdBytes = _SHR_COSQ_THRESHOLD_BYTES, /* consumed bytes. Egress Drop 2593 threshold, Unicast, multicast, dp 2594 (multicast) at port and device level. 2595 Egress Flow control threshold, 2596 unicast , multicast, port, channel 2597 and device level. */ 2598 bcmCosqThresholdPacketDescriptors = _SHR_COSQ_THRESHOLD_PACKET_DESCRIPTORS, /* consumed packet descriptors. Egress 2599 drop threshold, unicast, multicast, 2600 dp (multicast) at port level. Egress 2601 Flow control threshold, unicast, 2602 multicast device level. */ 2603 bcmCosqThresholdPackets = _SHR_COSQ_THRESHOLD_PACKETS, /* consumed packets. Egress Drop 2604 threshold, Unicast, multicast, 2605 dp(multicast) at device level. Egress 2606 Flow control threshold, multicast at 2607 device level. */ 2608 bcmCosqThresholdDataBuffers = _SHR_COSQ_THRESHOLD_DATA_BUFFERS, /* consumed data buffers. Egress Drop 2609 threshold, multicast, dp at device 2610 level Egress Flow control threshold, 2611 unicast, multicast at device level. */ 2612 bcmCosqThresholdAvailablePacketDescriptors = _SHR_COSQ_THRESHOLD_AVAILABLE_PACKET_DESCRIPTORS, /* available Packet Descriptors. Egress 2613 Drop threshold, Unicast, multicast, 2614 dp (multicast) at port and device 2615 level. */ 2616 bcmCosqThresholdAvailableDataBuffers = _SHR_COSQ_THRESHOLD_AVAILABLE_DATA_BUFFERS, /* available data buffers. Egress Drop 2617 threshold, multicast, dp at device 2618 level. */ 2619 bcmCosqThresholdBufferDescriptorBuffers = _SHR_COSQ_THRESHOLD_BUFFER_DESCRIPTOR_BUFFERS, /* consumed Buffer descriptor Buffers. 2620 Ingress Drop threshold, DP at device 2621 level. Ingress Flow control threshold 2622 at device level. */ 2623 bcmCosqThresholdBufferDescriptors = _SHR_COSQ_THRESHOLD_BUFFER_DESCRIPTORS, /* consumed buffer descriptors. Ingress 2624 Drop threshold, DP at device level. */ 2625 bcmCosqThresholdDbuffs = _SHR_COSQ_THRESHOLD_DBUFFS, /* consumed Dbuffs. Ingress Drop 2626 threshold, DP, unicast at device 2627 level. Ingress flow control 2628 threshold, unicast, multicast at 2629 device level. */ 2630 bcmCosqThresholdFullDbuffs = _SHR_COSQ_THRESHOLD_FULL_DBUFFS, /* consumed Full Dbuffs. Ingress Drop 2631 threshold, DP, multicast at device 2632 level. */ 2633 bcmCosqThresholdMiniDbuffs = _SHR_COSQ_THRESHOLD_MINI_DBUFFS, /* consumed mini Dbuffs. Ingress Drop 2634 threshold, DP, multicast at device 2635 level. */ 2636 bcmCosqThresholdDynamicWeight = _SHR_COSQ_THRESHOLD_DYNAMIC_WEIGHT, /* Dynamic scheduling threshold. */ 2637 bcmCosqThresholdPacketDescriptorsMin = _SHR_COSQ_THRESHOLD_PACKET_DESCRIPTORS_MIN, /* Fair Adaptive Thresholds support for 2638 bcmCosqThresholdPacketDescriptors. */ 2639 bcmCosqThresholdPacketDescriptorsMax = _SHR_COSQ_THRESHOLD_PACKET_DESCRIPTORS_MAX, /* Fair Adaptive Thresholds support for 2640 bcmCosqThresholdPacketDescriptors. */ 2641 bcmCosqThresholdPacketDescriptorsAlpha = _SHR_COSQ_THRESHOLD_PACKET_DESCRIPTORS_ALPHA, /* Fair Adaptive Thresholds support for 2642 bcmCosqThresholdPacketDescriptors. */ 2643 bcmCosqThresholdDataBuffersMin = _SHR_COSQ_THRESHOLD_DATA_BUFFERS_MIN, /* Fair Adaptive Thresholds support for 2644 bcmCosqThresholdDataBuffers. */ 2645 bcmCosqThresholdDataBuffersMax = _SHR_COSQ_THRESHOLD_DATA_BUFFERS_MAX, /* Fair Adaptive Thresholds support for 2646 bcmCosqThresholdDataBuffers. */ 2647 bcmCosqThresholdDataBuffersAlpha = _SHR_COSQ_THERESHOLD_DATA_BUFFERS_ALPHA, /* Fair Adaptive Thresholds support for 2648 bcmCosqThresholdDataBuffers. */ 2649 bcmCosqThresholdOcbDbuffs = _SHR_COSQ_THRESHOLD_OCB_DBUFFS, /* consumed OCB Dbuffs. Ingress Drop 2650 threshold, DP, at device level. */ 2651 bcmCosqThresholdPacketDescriptorBuffers = _SHR_COSQ_THRESHOLD_PACKET_DESCRIPTOR_BUFFERS, /* consumed PDBs. Ingress Drop 2652 threshold, DP, at device level. */ 2653 bcmCosqThresholdBundleDescriptorBuffers = _SHR_COSQ_THRESHOLD_BUNDLE_DESCRIPTOR_BUFFERS, /* consumed Bundle Descriptor Buffers. 2654 Ingress Drop threshold, DP, at device 2655 level. */ 2656 bcmCosqThresholdDataBuffersAlpha1 = _SHR_COSQ_THERESHOLD_DATA_BUFFERS_ALPHA1, /* Additional Alpha factor for Fair 2657 Adaptive Thresholds for 2658 bcmCosqThresholdDataBuffers. */ 2659 bcmCosqThresholdOcbPacketDescriptorBuffers = _SHR_COSQ_THRESHOLD_OCB_PACKET_DESCRIPTOR_BUFFERS /* OCB packet descriptor buffers. */ 2660 } bcm_cosq_threshold_type_t; 2661 2662 /* flag values for threshold setting valid bitmap */ 2663 #define BCM_COSQ_THRESHOLD_VALID_DP 0x00000001 /* dp field should be be 2664 used */ 2665 #define BCM_COSQ_THRESHOLD_VALID_VALUE 0x00000002 /* value field should be 2666 be used */ 2667 #define BCM_COSQ_THRESHOLD_VALID_TC 0x00000004 /* tc field should be be 2668 used */ 2669 #define BCM_COSQ_THRESHOLD_VALID_VSQ_CATEGORY 0x00000008 /* vsq category field 2670 should be be used */ 2671 2672 /* flow control / addmission settings */ 2673 typedef struct bcm_cosq_threshold_s { 2674 uint32 flags; /* BCM_COSQ_THRESHOLD_* flag values */ 2675 bcm_color_t dp; /* drop precedence. relevant for 2676 BCM_COSQ_THRESHOLD_PER_DP flag value */ 2677 bcm_cosq_threshold_type_t type; /* threshold type */ 2678 int value; /* threshold value for drop/flow control */ 2679 int tc; /* traffic class for which the thresholds 2680 are to be configured */ 2681 int vsq_category; /* VSQ category for which the thresholds are 2682 to be configured */ 2683 uint32 valid; /* a bitmap representing enabled fields in 2684 the struct. */ 2685 int priority; /* priority */ 2686 } bcm_cosq_threshold_t; 2687 2688 /* Initialize a COSQ threshold structure. */ 2689 extern void bcm_cosq_threshold_t_init( 2690 bcm_cosq_threshold_t *threshold); 2691 2692 #ifndef BCM_HIDE_DISPATCHABLE 2693 2694 /* 2695 * Configuring/retrieving Ingress / egress Thresholds for Flow control 2696 * and Admission Control 2697 */ 2698 extern int bcm_cosq_gport_threshold_set( 2699 int unit, 2700 bcm_gport_t gport, 2701 bcm_cos_queue_t cosq, 2702 bcm_cosq_threshold_t *threshold); 2703 2704 /* 2705 * Configuring/retrieving Ingress / egress Thresholds for Flow control 2706 * and Admission Control 2707 */ 2708 extern int bcm_cosq_gport_threshold_get( 2709 int unit, 2710 bcm_gport_t gport, 2711 bcm_cos_queue_t cosq, 2712 bcm_cosq_threshold_t *threshold); 2713 2714 #endif /* BCM_HIDE_DISPATCHABLE */ 2715 2716 /* cosq gport type eumerations */ 2717 typedef enum bcm_cosq_gport_type_e { 2718 bcmCosqGportTypeE2EPort = 0, /* Ports in E2E hierarchy */ 2719 bcmCosqGportTypeUnicastEgress = 1, /* Unicast Egress Queues - Port 2720 hierarchy */ 2721 bcmCosqGportTypeMulticastEgress = 2, /* Multicast Egress Queues - Port 2722 Hierarchy */ 2723 bcmCosqGportTypeCompositeFlow2 = 3, /* 2nd flow of either composite 2724 connector or composite SE */ 2725 bcmCosqGportTypeSchedCIR = 4, /* SE(scheduling Element) of CIR type. 2726 Applicable for Dual Shaper SE */ 2727 bcmCosqGportTypeSchedPIR = 5, /* SE(scheduling Element) of CIR type. 2728 Applicable for Dual Shaper SE */ 2729 bcmCosqGportTypeLocalPort = 6, /* Ports in Egress transmit hierarchy */ 2730 bcmCosqGportTypeLocalPortTC = 7, /* Port TC level in Egress transmit 2731 hierarchy */ 2732 bcmCosqGportTypeLocalPortTCG = 8, /* Port TC Group level in Egress 2733 transmit hierarchy */ 2734 bcmCosqGportTypeE2EPortTC = 9, /* Port TC level in End-to-End hierarchy */ 2735 bcmCosqGportTypeE2EPortTCG = 10, /* Port TC Group level in End-to-End 2736 hierarchy */ 2737 bcmCosqGportTypeGlobalFmqRoot = 11, /* FMQ Root gport. TypeGlobal indicates 2738 single instance */ 2739 bcmCosqGportTypeGlobalFmqGuaranteed = 12, /* FMQ Guaranteed gport */ 2740 bcmCosqGportTypeGlobalFmqBestEffortAggregate = 13, /* FMQ Best Effort aggregate gport */ 2741 bcmCosqGportTypeGlobalFmqBestEffort0 = 14, /* FMQ Best Effort 0 gport */ 2742 bcmCosqGportTypeGlobalFmqBestEffort1 = 15, /* FMQ Best Effort 1 gport */ 2743 bcmCosqGportTypeGlobalFmqBestEffort2 = 16, /* FMQ Best Effort 2 gport */ 2744 bcmCosqGportTypeGlobalFmqClass1 = 17, /* FMQ Class 1 gport */ 2745 bcmCosqGportTypeGlobalFmqClass2 = 18, /* FMQ Class 2 gport */ 2746 bcmCosqGportTypeGlobalFmqClass3 = 19, /* FMQ Class 3 gport */ 2747 bcmCosqGportTypeGlobalFmqClass4 = 20, /* FMQ Class 4 gport */ 2748 bcmCosqGportTypeGlobalIsqRoot = 21, /* ISQ Root gport */ 2749 bcmCosqGportTypeGlobalFabricMeshLocal = 22, /* Ingress Mesh Scheduler - Local */ 2750 bcmCosqGportTypeGlobalFabricMeshDev1 = 23, /* Ingress Mesh Scheduler - Destination 2751 Device 1 */ 2752 bcmCosqGportTypeGlobalFabricMeshDev2 = 24, /* Ingress Mesh Scheduler - Destination 2753 Device 2 */ 2754 bcmCosqGportTypeGlobalFabricMeshDev3 = 25, /* Ingress Mesh Scheduler - Destination 2755 Device 3 */ 2756 bcmCosqGportTypeGlobalFabricMeshDev4 = 26, /* Ingress Mesh Scheduler - Destination 2757 Device 4 */ 2758 bcmCosqGportTypeGlobalFabricMeshDev5 = 27, /* Ingress Mesh Scheduler - Destination 2759 Device 5 */ 2760 bcmCosqGportTypeGlobalFabricMeshDev6 = 28, /* Ingress Mesh Scheduler - Destination 2761 Device 6 */ 2762 bcmCosqGportTypeGlobalFabricMeshDev7 = 29, /* Ingress Mesh Scheduler - Destination 2763 Device 7 */ 2764 bcmCosqGportTypeGlobalFabricClosUnicastLocal = 30, /* Ingress Clos Fabric scheduler - 2765 shaper e (Ref Arch Spec) */ 2766 bcmCosqGportTypeGlobalFabricClosUnicastLocalLow = 31, /* Ingress Clos Fabric scheduler - WFQ 3 2767 (Ref Arch Spec) */ 2768 bcmCosqGportTypeGlobalFabricClosUnicastLocalHigh = 32, /* Ingress Clos Fabric scheduler - 2769 shaper a and WFQ 2 (Ref Arch Spec) */ 2770 bcmCosqGportTypeGlobalFabricClosFabric = 33, /* Ingress Clos Fabric scheduler - 2771 shaper f (Ref Arch Spec) */ 2772 bcmCosqGportTypeGlobalFabricClosFabricHigh = 34, /* Ingress Clos Fabric scheduler - WFQ 2 2773 (Ref Arch Spec) */ 2774 bcmCosqGportTypeGlobalFabricClosFabricLow = 35, /* Ingress Clos Fabric scheduler - WFQ 3 2775 (Ref Arch Spec) */ 2776 bcmCosqGportTypeGlobalFabricClosUnicastFabricHigh = 36, /* Ingress Clos Fabric scheduler - 2777 shaper b and WFQ 4 (Ref Arch Spec) */ 2778 bcmCosqGportTypeGlobalFabricClosUnicastFabricLow = 37, /* Ingress Clos Fabric scheduler - WFQ 5 2779 (Ref Arch Spec) */ 2780 bcmCosqGportTypeGlobalFabricClosFmqGuaranteed = 38, /* Ingress Clos Fabric scheduler - 2781 shaper c and WFQ 4 (Ref Arch Spec) */ 2782 bcmCosqGportTypeGlobalFabricClosFmqBestEffort = 39, /* Ingress Clos Fabric scheduler - WFQ 5 2783 (Ref Arch Spec) */ 2784 bcmCosqGportTypeSched = 40, /* SE(scheduling Element) */ 2785 bcmCosqGportTypeGlobalSystemRed = 41, /* System RED gport */ 2786 bcmCosqGportTypeFabricPipe = 42, /* Fabric all pipes */ 2787 bcmCosqGportTypeFabricPipeEgress = 43, /* Fabric egress pipes */ 2788 bcmCosqGportTypeFabricPipeIngress = 44, /* Fabric ingress pipes */ 2789 bcmCosqGportTypeFabricPipeMiddle = 45, /* Fabric middle pipes */ 2790 bcmCosqGportTypeGlobalFabricMeshCommonLocal0 = 46, /* Mesh common local 0 */ 2791 bcmCosqGportTypeGlobalFabricMeshCommonLocal1 = 47, /* Mesh common local 1 */ 2792 bcmCosqGportTypeGlobalFabricMeshCommonDev1 = 48, /* Mesh common dev 1 */ 2793 bcmCosqGportTypeGlobalFabricMeshCommonDev2 = 49, /* Mesh common dev 2 */ 2794 bcmCosqGportTypeGlobalFabricMeshCommonDev3 = 50, /* Mesh common dev 3 */ 2795 bcmCosqGportTypeGlobalFabricMeshCommonMc = 51, /* Mesh common multicast */ 2796 bcmCosqGportTypeGlobalFabricClosCommonLocal0 = 52, /* Clos common local 0 */ 2797 bcmCosqGportTypeGlobalFabricClosCommonLocal1 = 53, /* Clos common local 1 */ 2798 bcmCosqGportTypeGlobalFabricClosCommonFabric = 54, /* Clos common fabric */ 2799 bcmCosqGportTypeGlobalFabricClosCommonUnicastFabric = 55, /* Clos common unicast fabric */ 2800 bcmCosqGportTypeGlobalFabricClosCommonMulticastFabric = 56, /* Clos common multicast fabric */ 2801 bcmCosqGportTypeGlobalFabricMeshLocal0OcbHigh = 57, /* Mesh local 0 ocb high */ 2802 bcmCosqGportTypeGlobalFabricMeshLocal0OcbLow = 58, /* Mesh local 0 ocb low */ 2803 bcmCosqGportTypeGlobalFabricMeshLocal0MixHigh = 59, /* Mesh local 0 mix high */ 2804 bcmCosqGportTypeGlobalFabricMeshLocal0MixLow = 60, /* Mesh local 0 mix low */ 2805 bcmCosqGportTypeGlobalFabricMeshLocal1OcbHigh = 61, /* Mesh local 1 ocb high */ 2806 bcmCosqGportTypeGlobalFabricMeshLocal1OcbLow = 62, /* Mesh local 1 ocb low */ 2807 bcmCosqGportTypeGlobalFabricMeshLocal1MixHigh = 63, /* Mesh local 1 mix high */ 2808 bcmCosqGportTypeGlobalFabricMeshLocal1MixLow = 64, /* Mesh local 1 mix low */ 2809 bcmCosqGportTypeGlobalFabricMeshDev1OcbHigh = 65, /* Mesh device 1 ocb high */ 2810 bcmCosqGportTypeGlobalFabricMeshDev1OcbLow = 66, /* Mesh device 1 ocb low */ 2811 bcmCosqGportTypeGlobalFabricMeshDev1MixHigh = 67, /* Mesh device 1 mix high */ 2812 bcmCosqGportTypeGlobalFabricMeshDev1MixLow = 68, /* Mesh device 1 mix low */ 2813 bcmCosqGportTypeGlobalFabricMeshDev2OcbHigh = 69, /* Mesh device 2 ocb high */ 2814 bcmCosqGportTypeGlobalFabricMeshDev2OcbLow = 70, /* Mesh device 2 ocb low */ 2815 bcmCosqGportTypeGlobalFabricMeshDev2MixHigh = 71, /* Mesh device 2 mix high */ 2816 bcmCosqGportTypeGlobalFabricMeshDev2MixLow = 72, /* Mesh device 2 mix low */ 2817 bcmCosqGportTypeGlobalFabricMeshDev3OcbHigh = 73, /* Mesh device 3 ocb high */ 2818 bcmCosqGportTypeGlobalFabricMeshDev3OcbLow = 74, /* Mesh device 3 ocb low */ 2819 bcmCosqGportTypeGlobalFabricMeshDev3MixHigh = 75, /* Mesh device 3 mix high */ 2820 bcmCosqGportTypeGlobalFabricMeshDev3MixLow = 76, /* Mesh device 3 mix low */ 2821 bcmCosqGportTypeGlobalFabricMeshMcOcbHigh = 77, /* Mesh multicast ocb high */ 2822 bcmCosqGportTypeGlobalFabricMeshMcOcbLow = 78, /* Mesh multicast ocb low */ 2823 bcmCosqGportTypeGlobalFabricMeshMcMixHigh = 79, /* Mesh multicast mix high */ 2824 bcmCosqGportTypeGlobalFabricMeshMcMixLow = 80, /* Mesh multicast mix low */ 2825 bcmCosqGportTypeGlobalFabricMeshLocal0 = 81, /* Mesh local 0 */ 2826 bcmCosqGportTypeGlobalFabricMeshLocal1 = 82, /* Mesh local 1 */ 2827 bcmCosqGportTypeGlobalFabricMeshMc = 83, /* Mesh multicast */ 2828 bcmCosqGportTypeGlobalFabricMesh = 84, /* Mesh */ 2829 bcmCosqGportTypeGlobalFabricClosLocal0OcbHigh = 85, /* Clos local 0 ocb high */ 2830 bcmCosqGportTypeGlobalFabricClosLocal0OcbLow = 86, /* Clos local 0 ocb low */ 2831 bcmCosqGportTypeGlobalFabricClosLocal0MixHigh = 87, /* Clos local 0 mix high */ 2832 bcmCosqGportTypeGlobalFabricClosLocal0MixLow = 88, /* Clos local 0 mix low */ 2833 bcmCosqGportTypeGlobalFabricClosLocal1OcbHigh = 89, /* Clos local 1 ocb high */ 2834 bcmCosqGportTypeGlobalFabricClosLocal1OcbLow = 90, /* Clos local 1 ocb low */ 2835 bcmCosqGportTypeGlobalFabricClosLocal1MixHigh = 91, /* Clos local 1 mix high */ 2836 bcmCosqGportTypeGlobalFabricClosLocal1MixLow = 92, /* Clos local 1 mix low */ 2837 bcmCosqGportTypeGlobalFabricClosUnicastFabricOcbHigh = 93, /* Clos unicast ocb high */ 2838 bcmCosqGportTypeGlobalFabricClosUnicastFabricOcbLow = 94, /* Clos unicast ocb low */ 2839 bcmCosqGportTypeGlobalFabricClosUnicastFabricMixHigh = 95, /* Clos unicast mix high */ 2840 bcmCosqGportTypeGlobalFabricClosUnicastFabricMixLow = 96, /* Clos unicast mix low */ 2841 bcmCosqGportTypeGlobalFabricClosFmqGuaranteedOcb = 97, /* Clos guaranteed multicast ocb */ 2842 bcmCosqGportTypeGlobalFabricClosFmqBestEffortOcb = 98, /* Clos best effort multicast ocb */ 2843 bcmCosqGportTypeGlobalFabricClosFmqGuaranteedMix = 99, /* Clos guaranteed multicast mix */ 2844 bcmCosqGportTypeGlobalFabricClosFmqBestEffortMix = 100, /* Clos best effort multicast mix */ 2845 bcmCosqGportTypeGlobalFabricClosLocal0 = 101, /* Clos local 0 */ 2846 bcmCosqGportTypeGlobalFabricClosLocal1 = 102, /* Clos local 1 */ 2847 bcmCosqGportTypeGlobalFabricClosLocal0High = 103, /* Clos local 0 high */ 2848 bcmCosqGportTypeGlobalFabricClosLocal0Low = 104, /* Clos local 0 low */ 2849 bcmCosqGportTypeGlobalFabricClosLocal1High = 105, /* Clos local 1 high */ 2850 bcmCosqGportTypeGlobalFabricClosLocal1Low = 106, /* Clos local 1 low */ 2851 bcmCosqGportTypeGlobalFabricClosOcbHigh = 107, /* Clos ocb high */ 2852 bcmCosqGportTypeGlobalFabricClosMixHigh = 108, /* Clos mix high */ 2853 bcmCosqGportTypeGlobalFabricClosOcbLow = 109, /* Clos ocb low */ 2854 bcmCosqGportTypeGlobalFabricClosMixLow = 110, /* Clos mix low */ 2855 bcmCosqGportTypeGlobalFabricClos = 111, /* Clos */ 2856 bcmCosqGportTypeFabricRxUnicast = 112, /* Fabric unicast FIFO */ 2857 bcmCosqGportTypeFabricRxMulticast = 113, /* Fabric multicast FIFO */ 2858 bcmCosqGportTypeFabricRxTdm = 114, /* Fabric TDM FIFO */ 2859 bcmCosqGportTypeFabricRxLocalUnicast = 115, /* Local unicast FIFO */ 2860 bcmCosqGportTypeFabricRxLocalMulticast = 116, /* MESH-MC FIFO */ 2861 bcmCosqGportTypeFabricRxLocalTdm = 117, /* Local TDM bypass FIFO */ 2862 bcmCosqGportTypeGlobalFabricMeshDev0 = 118, /* Ingress Mesh Scheduler - Destination 2863 Device 0 */ 2864 bcmCosqGportTypeCore = 119, /* Gport Type Core */ 2865 bcmCosqGportTypeSchedSharedShaper0 = 120, /* Element at index 0 inside shared 2866 shaper */ 2867 bcmCosqGportTypeSchedSharedShaper1 = 121, /* Element at index 1 inside shared 2868 shaper */ 2869 bcmCosqGportTypeSchedSharedShaper2 = 122, /* Element at index 2 inside shared 2870 shaper */ 2871 bcmCosqGportTypeSchedSharedShaper3 = 123, /* Element at index 3 inside shared 2872 shaper */ 2873 bcmCosqGportTypeSchedSharedShaper4 = 124, /* Element at index 4 inside shared 2874 shaper */ 2875 bcmCosqGportTypeSchedSharedShaper5 = 125, /* Element at index 5 inside shared 2876 shaper */ 2877 bcmCosqGportTypeSchedSharedShaper6 = 126, /* Element at index 6 inside shared 2878 shaper */ 2879 bcmCosqGportTypeSchedSharedShaper7 = 127 /* Element at index 7 inside shared 2880 shaper */ 2881 } bcm_cosq_gport_type_t; 2882 2883 /* gport information related to getting a handle */ 2884 typedef struct bcm_cosq_gport_info_s { 2885 bcm_gport_t in_gport; /* gport to be converted. NULL for global gports 2886 (i.e. single instance on a device) */ 2887 bcm_cos_queue_t cosq; /* Num of cosq levels */ 2888 bcm_gport_t out_gport; /* retreived gport */ 2889 } bcm_cosq_gport_info_t; 2890 2891 /* gport information related to getting a handle */ 2892 typedef struct bcm_cosq_gport_info_core_s { 2893 bcm_cosq_gport_type_t gport_type; /* cosq gport type enumeration */ 2894 bcm_gport_t in_gport; /* gport to be converted. NULL for 2895 global gports (i.e. single instance 2896 on a device) */ 2897 bcm_cos_queue_t cosq; /* Num of cosq levels */ 2898 uint32 flags; /* relevant flags */ 2899 } bcm_cosq_gport_info_core_t; 2900 2901 #ifndef BCM_HIDE_DISPATCHABLE 2902 2903 /* Getting a gport handle */ 2904 extern int bcm_cosq_gport_handle_get( 2905 int unit, 2906 bcm_cosq_gport_type_t gport_type, 2907 bcm_cosq_gport_info_t *gport_info); 2908 2909 /* Getting a gport handle */ 2910 extern int bcm_cosq_gport_handle_core_get( 2911 int unit, 2912 bcm_core_t core, 2913 bcm_cosq_gport_info_core_t *gport_info, 2914 bcm_gport_t *out_gport); 2915 2916 #endif /* BCM_HIDE_DISPATCHABLE */ 2917 2918 /* flow control direction type eumerations */ 2919 typedef enum bcm_cosq_fc_direction_type_e { 2920 bcmCosqFlowControlGeneration = 0, /* flow control generation */ 2921 bcmCosqFlowControlReception = 1, /* flow control reception */ 2922 bcmCosqFlowControlInternal = 2 /* internal flow control */ 2923 } bcm_cosq_fc_direction_type_t; 2924 2925 /* flag values for flow control path configuration */ 2926 #define BCM_COSQ_FC_ENDPOINT_PORT_ALL 0x00000001 /* all ports as endpoint, 2927 e.g. generate flow 2928 control on all 2929 interfaces */ 2930 #define BCM_COSQ_FC_ENDPOINT_PORT_IMPLICIT 0x00000002 /* endpoint not 2931 specified. It is 2932 implicitly specified. 2933 e.g. for flow control 2934 generation based on 2935 in-band VSQ the target 2936 endpoint is determined 2937 by the VSQ interface 2938 attribute */ 2939 #define BCM_COSQ_FC_INHERIT_UP 0x00000004 /* also applies flow 2940 control to all cos 2941 levels greater then 2942 that specified via 2943 flow control endpoint */ 2944 #define BCM_COSQ_FC_INHERIT_DOWN 0x00000008 /* also applies flow 2945 control to all cos 2946 levels lower then that 2947 specified via flow 2948 control endpoint */ 2949 #define BCM_COSQ_FC_RETRANSMIT 0x00000010 /* ILKN Retransmit - 2950 relevant for both FC 2951 directions */ 2952 #define BCM_COSQ_FC_HCFC_BITMAP 0x00000020 /* HCFC Bitmap */ 2953 #define BCM_COSQ_FC_PORT_OVER_PFC 0x00000040 /* mapping PFC source to 2954 port target for FC 2955 reception */ 2956 #define BCM_COSQ_FC_INTF_COSQ_PFC 0x00000080 /* mapping PFC source to 2957 relevant priorioty in 2958 all ports on same 2959 interface for FC 2960 reception */ 2961 #define BCM_COSQ_FC_ETH_PORT 0x00000100 /* FC triggered by RX 2962 Port FIFO */ 2963 #define BCM_COSQ_FC_BDB 0x00000200 /* FC triggered by BDB 2964 resource */ 2965 #define BCM_COSQ_FC_MINI_DB 0x00000400 /* FC triggered by 2966 Mini-Multicast Dbuffs */ 2967 #define BCM_COSQ_FC_FULL_DB 0x00000800 /* FC triggered by 2968 Full-Multicast Dbuffs */ 2969 #define BCM_COSQ_FC_OCB_DB 0x00001000 /* FC triggered by OCB 2970 Dbuffs */ 2971 #define BCM_COSQ_FC_IS_OCB_ONLY 0x00002000 /* Specifies that FC 2972 triggered by OCB-only 2973 Resouce */ 2974 #define BCM_COSQ_FC_MUB 0x00004000 /* FC receive or generate 2975 via Multi-Use Bit */ 2976 #define BCM_COSQ_FC_MASK_POOL_INDICATION 0x00008000 /* Ignore Pool related 2977 threshold */ 2978 #define BCM_COSQ_FC_HEADROOM 0x00010000 /* Specifies that FC 2979 triggered by Headroom 2980 Resouce */ 2981 2982 /* Endpoint(source or reaction/target) definition */ 2983 typedef struct bcm_cosq_fc_endpoint_s { 2984 uint32 flags; /* flags to qualify a endpoint */ 2985 bcm_gport_t port; /* gport identifing the underlying resource */ 2986 bcm_cos_queue_t cosq; /* cosq/class */ 2987 int calender_index; /* calender entry */ 2988 int priority; /* priority. Example, E2E Scheduler Element priority 2989 level - for mapping flow control to E2E SE 2990 (Scheduler Element) */ 2991 } bcm_cosq_fc_endpoint_t; 2992 2993 #ifndef BCM_HIDE_DISPATCHABLE 2994 2995 /* configure flow control path */ 2996 extern int bcm_cosq_fc_path_add( 2997 int unit, 2998 bcm_cosq_fc_direction_type_t fc_direction, 2999 bcm_cosq_fc_endpoint_t *source, 3000 bcm_cosq_fc_endpoint_t *target); 3001 3002 /* retrieve flow control path information */ 3003 extern int bcm_cosq_fc_path_get( 3004 int unit, 3005 bcm_cosq_fc_direction_type_t fc_direction, 3006 bcm_cosq_fc_endpoint_t *source, 3007 int target_max, 3008 bcm_cosq_fc_endpoint_t *target, 3009 int *target_count); 3010 3011 /* delete flow control path configuration */ 3012 extern int bcm_cosq_fc_path_delete( 3013 int unit, 3014 bcm_cosq_fc_direction_type_t fc_direction, 3015 bcm_cosq_fc_endpoint_t *source, 3016 bcm_cosq_fc_endpoint_t *target); 3017 3018 /* 3019 * Set/Unset the traffic from ingress port going to destination module 3020 * to use virtual destination queues 3021 */ 3022 extern int bcm_cosq_gport_destmod_attach( 3023 int unit, 3024 bcm_gport_t gport, 3025 bcm_port_t ingress_port, 3026 bcm_module_t dest_modid, 3027 int fabric_egress_port); 3028 3029 /* 3030 * Set/Unset the traffic from ingress port going to destination module 3031 * to use virtual destination queues 3032 */ 3033 extern int bcm_cosq_gport_destmod_detach( 3034 int unit, 3035 bcm_gport_t gport, 3036 bcm_port_t ingress_port, 3037 bcm_module_t dest_modid, 3038 int fabric_egress_port); 3039 3040 extern int bcm_cosq_gport_multipath_add( 3041 int unit, 3042 bcm_gport_t multipath_gport, 3043 bcm_gport_t member_gport, 3044 bcm_cos_queue_t member_gport_cosq); 3045 3046 extern int bcm_cosq_gport_multipath_get( 3047 int unit, 3048 bcm_gport_t multipath_gport, 3049 int member_gport_max, 3050 bcm_gport_t *member_gport_array, 3051 bcm_cos_queue_t *member_gport_cosq_array, 3052 int *member_gport_count); 3053 3054 extern int bcm_cosq_gport_multipath_delete( 3055 int unit, 3056 bcm_gport_t multipath_gport, 3057 bcm_gport_t member_gport, 3058 bcm_cos_queue_t member_gport_cosq); 3059 3060 #endif /* BCM_HIDE_DISPATCHABLE */ 3061 3062 /* For queue report thresholds on EPON */ 3063 typedef struct bcm_cosq_report_threshold_s { 3064 int threshold0; /* Queue report threshold0. */ 3065 int threshold1; /* Queue report threshold1. */ 3066 int threshold2; /* Queue report threshold2. */ 3067 int threshold3; /* Queue report threshold3. */ 3068 } bcm_cosq_report_threshold_t; 3069 3070 #ifndef BCM_HIDE_DISPATCHABLE 3071 3072 /* Get/set queue report thresholds */ 3073 extern int bcm_cosq_gport_report_threshold_get( 3074 int unit, 3075 bcm_gport_t gport, 3076 bcm_cos_queue_t cosq, 3077 bcm_cosq_report_threshold_t *threshold); 3078 3079 /* Get/set queue report thresholds */ 3080 extern int bcm_cosq_gport_report_threshold_set( 3081 int unit, 3082 bcm_gport_t gport, 3083 bcm_cos_queue_t cosq, 3084 bcm_cosq_report_threshold_t *threshold); 3085 3086 /* Get or set the mapping from internal priority to CoS egress queue. */ 3087 extern int bcm_cosq_gport_egress_mapping_set( 3088 int unit, 3089 bcm_gport_t gport, 3090 bcm_cos_t int_pri, 3091 bcm_cos_t cos, 3092 uint32 flags); 3093 3094 /* Get or set the mapping from internal priority to CoS egress queue. */ 3095 extern int bcm_cosq_gport_egress_mapping_get( 3096 int unit, 3097 bcm_gport_t gport, 3098 bcm_cos_t *int_pri, 3099 bcm_cos_t *cos, 3100 uint32 flags); 3101 3102 #endif /* BCM_HIDE_DISPATCHABLE */ 3103 3104 /* XGS3 cosq counters */ 3105 typedef enum bcm_cosq_stat_e { 3106 bcmCosqStatDroppedPackets = 0, /* Dropped packet count. */ 3107 bcmCosqStatDroppedBytes = 1, /* Dropped byte count. */ 3108 bcmCosqStatYellowCongestionDroppedPackets = 2, /* Dropped yellow packets due to 3109 congestion. */ 3110 bcmCosqStatRedCongestionDroppedPackets = 3, /* Dropped red packets due to 3111 congestion. */ 3112 bcmCosqStatGreenDiscardDroppedPackets = 4, /* WRED green packets. */ 3113 bcmCosqStatYellowDiscardDroppedPackets = 5, /* WRED yellow packets. */ 3114 bcmCosqStatRedDiscardDroppedPackets = 6, /* WRED red packets. */ 3115 bcmCosqStatOutPackets = 7, /* Transmit packet count. */ 3116 bcmCosqStatOutBytes = 8, /* Transmit byte count. */ 3117 bcmCosqStatIeee8021CnCpTransmittedCnms = 9, /* QCN CNM Transmit packet count. */ 3118 bcmCosqStatHighPriDroppedPackets = 10, /* PGW OBM high priority dropped packet 3119 count. */ 3120 bcmCosqStatLowPriDroppedPackets = 11, /* PGW OBM low priority dropped packet 3121 count. */ 3122 bcmCosqStatHighPriDroppedBytes = 12, /* PGW OBM high priority dropped bytes 3123 count. */ 3124 bcmCosqStatLowPriDroppedBytes = 13, /* PGW OBM low priority dropped byte 3125 count. */ 3126 bcmCosqStatGlobalHeadroomBytes0Peak = 14, /* Total Bytes used Global Headroom by X 3127 pipe Peak */ 3128 bcmCosqStatGlobalHeadroomBytes0Current = 15, /* Total Bytes used Global Headroom by X 3129 pipe Current */ 3130 bcmCosqStatGlobalHeadroomBytes1Peak = 16, /* Total Bytes used Global Headroom by Y 3131 pipe Peak */ 3132 bcmCosqStatGlobalHeadroomBytes1Current = 17, /* Total Bytes used Global Headroom by Y 3133 pipe Current */ 3134 bcmCosqStatIngressPortPoolSharedBytesPeak = 18, /* Peak value of shared buffers in use 3135 by all ports for each service pool in 3136 bytes. */ 3137 bcmCosqStatIngressPortPoolSharedBytesCurrent = 19, /* Current value buffers in use by all 3138 ports for each service pool in bytes. */ 3139 bcmCosqStatIngressPortPGMinBytesPeak = 20, /* Peak value of buffers in use from PG 3140 min space per port per PG in bytes. */ 3141 bcmCosqStatIngressPortPGMinBytesCurrent = 21, /* Current value of buffers in use from 3142 PG min space per port per PG in 3143 bytes. */ 3144 bcmCosqStatIngressPortPGSharedBytesPeak = 22, /* Peak value of buffers in use from 3145 shared space per port per PG in 3146 bytes. */ 3147 bcmCosqStatIngressPortPGSharedBytesCurrent = 23, /* Current value of buffers in use from 3148 shared space per port per PG in 3149 bytes. */ 3150 bcmCosqStatIngressPortPGHeadroomBytesPeak = 24, /* Peak value of buffers in use from PG 3151 headroom space in bytes. */ 3152 bcmCosqStatIngressPortPGHeadroomBytesCurrent = 25, /* Current value of buffers in use from 3153 PG headroom space in bytes. */ 3154 bcmCosqStatEgressMCQueueBytesPeak = 26, /* Peak value of multicast queue 3155 buffers in use in bytes. */ 3156 bcmCosqStatEgressMCQueueBytesCurrent = 27, /* Current value of multicast queue 3157 buffers in use in bytes. */ 3158 bcmCosqStatEgressUCQueueBytesPeak = 28, /* Peak value of unicast queue buffers 3159 in use in bytes. */ 3160 bcmCosqStatEgressUCQueueBytesCurrent = 29, /* Current value of unicast queue 3161 buffers in use in bytes. */ 3162 bcmCosqStatEgressUCQueuePortBytesPeak = 30, /* Peak value of unicast queue shared 3163 buffer in use in bytes. */ 3164 bcmCosqStatEgressUCQueuePortBytesCurrent = 31, /* Current value of unicast queue shared 3165 buffer in use in bytes. */ 3166 bcmCosqStatDiscardDroppedPackets = 32, /* WRED dropped packets. */ 3167 bcmCosqStatUCDroppedPackets = 33, /* Dropped unicast packet count. */ 3168 bcmCosqStatMCDroppedPackets = 34, /* Dropped multicast packet count. */ 3169 bcmCosqStatUCDroppedBytes = 35, /* Dropped unicast byte count. */ 3170 bcmCosqStatMCDroppedBytes = 36, /* Dropped multicast byte count. */ 3171 bcmCosqStatUCOutPackets = 37, /* Transmit unicast packet count. */ 3172 bcmCosqStatMCOutPackets = 38, /* Transmit multicast packet count. */ 3173 bcmCosqStatUCOutBytes = 39, /* Transmit unicast byte count. */ 3174 bcmCosqStatMCOutBytes = 40, /* Transmit multicast byte count. */ 3175 bcmCosqStatOBMLossless0DroppedPackets = 41, /* OBM Lossless Class 0 dropped packets 3176 count. */ 3177 bcmCosqStatOBMLossless0DroppedBytes = 42, /* OBM Lossless Class 0 dropped bytes 3178 count. */ 3179 bcmCosqStatOBMLossless1DroppedPackets = 43, /* OBM Lossless Class 1 dropped packets 3180 count. */ 3181 bcmCosqStatOBMLossless1DroppedBytes = 44, /* OBM Lossless Class 1 dropped bytes 3182 count. */ 3183 bcmCosqStatOBMLossyHighPriDroppedPackets = 45, /* OBM high priority dropped packets 3184 count. */ 3185 bcmCosqStatOBMLossyHighPriDroppedBytes = 46, /* OBM high priority dropped bytes 3186 count. */ 3187 bcmCosqStatOBMLossyLowPriDroppedPackets = 47, /* OBM low priority dropped packets 3188 count. */ 3189 bcmCosqStatOBMLossyLowPriDroppedBytes = 48, /* OBM low priority dropped bytes count. */ 3190 bcmCosqStatYellowCongestionDroppedBytes = 49, /* Yellow congestion dropped bytes. */ 3191 bcmCosqStatRedCongestionDroppedBytes = 50, /* Red congestion dropped bytes. */ 3192 bcmCosqStatDiscardDroppedBytes = 51, /* WRED drop bytes. */ 3193 bcmCosqStatGreenDiscardDroppedBytes = 52, /* WRED Green drop bytes. */ 3194 bcmCosqStatYellowDiscardDroppedBytes = 53, /* WRED Yellow drop bytes. */ 3195 bcmCosqStatRedDiscardDroppedBytes = 54, /* WRED Red drop bytes. */ 3196 bcmCosqStatHOLDropPackets = 55, /* per COSQ HOL drop packet count. */ 3197 bcmCosqStatOBMHighWatermark = 56, /* per port OBM cell max usage. */ 3198 bcmCosqStatOBMBufferBytes = 57, /* per port OBM cell buffer use count. */ 3199 bcmCosqStatOBMFlowControlEvents = 58, /* per port OBM generated flow control 3200 events. */ 3201 bcmCosqStatTASTxOverrunPackets = 59, /* Number of transmission overrun events 3202 where a packet is still being 3203 transmitted at the time when the 3204 transmission gate of the queue 3205 closed. */ 3206 bcmCosqStatEgressPortPoolTotalBytesCurrent = 60, /* Per-port Per Service pool total 3207 Buffer Use Count. */ 3208 bcmCosqStatEgressPortPoolSharedBytesCurrent = 61, /* Per-port Per Service pool shared 3209 Buffer Use Count. */ 3210 bcmCosqStatEgressMCQueueMinBytesCurrent = 62, /* Current value of multicast queue 3211 minimum guarantee buffers in use in 3212 bytes. */ 3213 bcmCosqStatEgressQgroupMinBytesCurrent = 63, /* Current value of queue group minimum 3214 guarantee buffers in use in bytes. */ 3215 bcmCosqStatEgressQgroupBytesCurrent = 64, /* Current value of queue group shared 3216 buffers in use in bytes. */ 3217 bcmCosqStatEgressUCQueueMinBytesCurrent = 65, /* Current value of unicast queue 3218 minimum guarantee buffers in use in 3219 bytes. */ 3220 bcmCosqStatOBMLossless0EnqueuedPackets = 66, /* OBM Lossless Class 0 enqueued packets 3221 count. */ 3222 bcmCosqStatOBMLossless0EnqueuedBytes = 67, /* OBM Lossless Class 0 enqueued bytes 3223 count. */ 3224 bcmCosqStatOBMLossless1EnqueuedPackets = 68, /* OBM Lossless Class 1 enqueued packets 3225 count. */ 3226 bcmCosqStatOBMLossless1EnqueuedBytes = 69, /* OBM Lossless Class 1 enqueued bytes 3227 count. */ 3228 bcmCosqStatOBMLossyHighPriEnqueuedPackets = 70, /* OBM high priority enqueued packets 3229 count. */ 3230 bcmCosqStatOBMLossyHighPriEnqueuedBytes = 71, /* OBM high priority enqueued bytes 3231 count. */ 3232 bcmCosqStatOBMLossyLowPriEnqueuedPackets = 72, /* OBM low priority enqueued packets 3233 count. */ 3234 bcmCosqStatOBMLossyLowPriEnqueuedBytes = 73, /* OBM low priority enqueued bytes 3235 count. */ 3236 bcmCosqStatOBMExpressEnqueuedPackets = 74, /* OBM express enqueued packets count. */ 3237 bcmCosqStatOBMExpressEnqueuedBytes = 75, /* OBM express enqueued bytes count. */ 3238 bcmCosqStatOBMExpressDroppedPackets = 76, /* OBM express dropped packets count. */ 3239 bcmCosqStatOBMExpressDroppedBytes = 77, /* OBM express dropped bytes count. */ 3240 bcmCosqStatHdrmPoolDroppedPackets = 78, /* Number of packets dropped per 3241 Headroom Pool */ 3242 bcmCosqStatSourcePortDroppedPackets = 79, /* Number of packets dropped per Source 3243 Port */ 3244 bcmCosqStatEgressCongestionDroppedPackets = 80, /* Number of packets dropped by Egress 3245 admission excuding the WRED drops */ 3246 bcmCosqStatRQETotalDroppedPackets = 81, /* Total packets dropped per RQE queue */ 3247 bcmCosqStatRQETotalDroppedBytes = 82, /* Total bytes dropped per RQE queue */ 3248 bcmCosqStatRQEGreenDroppedPackets = 83, /* Green packets dropped per RQE queue */ 3249 bcmCosqStatRQEYellowDroppedPackets = 84, /* Yellow packets dropped per RQE queue */ 3250 bcmCosqStatOBMLossyBufferBytes = 85, /* Current buffer usage for obm Lossy 3251 traffic class */ 3252 bcmCosqStatOBMLossless0BufferBytes = 86, /* Current buffer usage for obm 3253 Lossless0 traffic class */ 3254 bcmCosqStatOBMLossless1BufferBytes = 87, /* Current buffer usage for obm 3255 Lossless1 traffic class */ 3256 bcmCosqStatRQERedDroppedPackets = 88, /* Red packets dropped per RQE queue */ 3257 bcmCosqStatDiscardUCDroppedPackets = 89, /* Per port per queue WRED dropped 3258 packets. */ 3259 bcmCosqStatTotalDiscardDroppedPackets = 90, /* Total WRED dropped packets. */ 3260 bcmCosqStatAdtAlpha0AdmittedLowPriPackets = 91, /* Low priority packets of the selected 3261 egress pool that are admitted using 3262 limit_alpha 0 */ 3263 bcmCosqStatAdtAlpha1AdmittedLowPriPackets = 92, /* Low priority packets of the selected 3264 egress pool that are admitted using 3265 limit_alpha 1 */ 3266 bcmCosqStatAdtAlpha2AdmittedLowPriPackets = 93, /* Low priority packets of the selected 3267 egress pool that are admitted using 3268 limit_alpha 2 */ 3269 bcmCosqStatAdtAlpha3AdmittedLowPriPackets = 94, /* Low priority packets of the selected 3270 egress pool that are admitted using 3271 limit_alpha 3 */ 3272 bcmCosqStatAdtAlpha4AdmittedLowPriPackets = 95, /* Low priority packets of the selected 3273 egress pool that are admitted using 3274 limit_alpha 4 */ 3275 bcmCosqStatAdtAlpha5AdmittedLowPriPackets = 96, /* Low priority packets of the selected 3276 egress pool that are admitted using 3277 limit_alpha 5 */ 3278 bcmCosqStatAdtAlpha6AdmittedLowPriPackets = 97, /* Low priority packets of the selected 3279 egress pool that are admitted using 3280 limit_alpha 6 */ 3281 bcmCosqStatAdtAlpha7AdmittedLowPriPackets = 98, /* Low priority packets of the selected 3282 egress pool that are admitted using 3283 limit_alpha 7 */ 3284 bcmCosqStatAdtAlpha8AdmittedLowPriPackets = 99, /* Low priority packets of the selected 3285 egress pool that are admitted using 3286 limit_alpha 8 */ 3287 bcmCosqStatAdtAlpha9AdmittedLowPriPackets = 100, /* Low priority packets of the selected 3288 egress pool that are admitted using 3289 limit_alpha 9 */ 3290 bcmCosqStatAdtAlpha10AdmittedLowPriPackets = 101, /* Low priority packets of the selected 3291 egress pool that are admitted using 3292 limit_alpha 10 */ 3293 bcmCosqStatEgressPoolAdtAdmittedHighPriBytes = 102, /* High priority bytes admitted of an 3294 egress service pool */ 3295 bcmCosqStatDebugSaf0Packets = 103, /* Debug counter 0 to track the number 3296 of SAF (Store-and-Forwarding) packets 3297 of a traffic flow forwarded from an 3298 ITM */ 3299 bcmCosqStatDebugSaf1Packets = 104, /* Debug counter 1 to track the number 3300 of SAF (Store-and-Forwarding) packets 3301 of a traffic flow forwarded from an 3302 ITM */ 3303 bcmCosqStatDebugSaf2Packets = 105, /* Debug counter 2 to track the number 3304 of SAF (Store-and-Forwarding) packets 3305 of a traffic flow forwarded from an 3306 ITM */ 3307 bcmCosqStatDebugSaf3Packets = 106, /* Debug counter 3 to track the number 3308 of SAF (Store-and-Forwarding) packets 3309 of a traffic flow forwarded from an 3310 ITM */ 3311 bcmCosqStatDebugSaf4Packets = 107, /* Debug counter 4 to track the number 3312 of SAF (Store-and-Forwarding) packets 3313 of a traffic flow forwarded from an 3314 ITM */ 3315 bcmCosqStatDebugSaf5Packets = 108, /* Debug counter 5 to track the number 3316 of SAF (Store-and-Forwarding) packets 3317 of a traffic flow forwarded from an 3318 ITM */ 3319 bcmCosqStatDebugSaf6Packets = 109, /* Debug counter 6 to track the number 3320 of SAF (Store-and-Forwarding) packets 3321 of a traffic flow forwarded from an 3322 ITM */ 3323 bcmCosqStatDebugSaf7Packets = 110, /* Debug counter 7 to track the number 3324 of SAF (Store-and-Forwarding) packets 3325 of a traffic flow forwarded from an 3326 ITM */ 3327 bcmCosqStatDebugCt0Packets = 111, /* Debug counter 0 to track the number 3328 of CT (Cut-Through)) packets of a 3329 traffic flow forwarded from an ITM */ 3330 bcmCosqStatDebugCt1Packets = 112, /* Debug counter 1 to track the number 3331 of CT (Cut-Through)) packets of a 3332 traffic flow forwarded from an ITM */ 3333 bcmCosqStatDebugCt2Packets = 113, /* Debug counter 2 to track the number 3334 of CT (Cut-Through)) packets of a 3335 traffic flow forwarded from an ITM */ 3336 bcmCosqStatDebugCt3Packets = 114, /* Debug counter 3 to track the number 3337 of CT (Cut-Through)) packets of a 3338 traffic flow forwarded from an ITM */ 3339 bcmCosqStatDebugCt4Packets = 115, /* Debug counter 4 to track the number 3340 of CT (Cut-Through)) packets of a 3341 traffic flow forwarded from an ITM */ 3342 bcmCosqStatDebugCt5Packets = 116, /* Debug counter 5 to track the number 3343 of CT (Cut-Through)) packets of a 3344 traffic flow forwarded from an ITM */ 3345 bcmCosqStatDebugCt6Packets = 117, /* Debug counter 6 to track the number 3346 of CT (Cut-Through)) packets of a 3347 traffic flow forwarded from an ITM */ 3348 bcmCosqStatDebugCt7Packets = 118, /* Debug counter 7 to track the number 3349 of CT (Cut-Through)) packets of a 3350 traffic flow forwarded from an ITM */ 3351 bcmCosqStatEgressPoolSharedBytesCurrent = 119, /* Current value of buffers used in each 3352 service pool in bytes. */ 3353 bcmCosqStatEgressPortUCPacketsCurrent = 120, /* Current unicast packet count per port 3354 for all SPs in bytes. */ 3355 bcmCosqStatEgressPortMCPacketsCurrent = 121, /* Current multicast packet count per 3356 port for all SPs in bytes. */ 3357 bcmCosqStatEgressPoolSharedUCBytesCurrent = 122, /* Current value of egress service pool 3358 shared buffer in use by UC in bytes. */ 3359 bcmCosqStatEgressPoolSharedMCBytesCurrent = 123, /* Current value of egress service pool 3360 shared buffer in use by MC in bytes. */ 3361 bcmCosqStatHeadroomPoolBytesCurrent = 124, /* Current value of headroom pool in use 3362 all Priority Groups in bytes. */ 3363 bcmCosqStatIngressPoolSharedBytesCurrent = 125, /* Current value of ingress service pool 3364 shared buffer in use by all the ports 3365 in bytes. */ 3366 bcmCosqStatRQEQueueMinBytesCurrent = 126, /* Current minimum guarantee usage per 3367 RQE queue in bytes. */ 3368 bcmCosqStatRQEQueueSharedBytesCurrent = 127, /* Current shared usage per RQE queue in 3369 bytes. */ 3370 bcmCosqStatRQEQueueTotalBytesCurrent = 128, /* Current total usage per RQE queue in 3371 bytes. */ 3372 bcmCosqStatRQEPoolSharedBytesCurrent = 129, /* Current value of RQE pool in use by 3373 all RQE queues in bytes. */ 3374 bcmCosqStatSourcePortDroppedBytes = 130, /* Number of bytes dropped per Source 3375 Port */ 3376 bcmCosqStatMaxCount = 131 /* this should be the last one. */ 3377 } bcm_cosq_stat_t; 3378 3379 #ifndef BCM_HIDE_DISPATCHABLE 3380 3381 /* Retrieve/set various MMU statistics based on stat type */ 3382 extern int bcm_cosq_stat_get( 3383 int unit, 3384 bcm_gport_t gport, 3385 bcm_cos_queue_t cosq, 3386 bcm_cosq_stat_t stat, 3387 uint64 *value); 3388 3389 /* Retrieve/set various MMU statistics based on stat type */ 3390 extern int bcm_cosq_stat_get32( 3391 int unit, 3392 bcm_gport_t gport, 3393 bcm_cos_queue_t cosq, 3394 bcm_cosq_stat_t stat, 3395 uint32 *value); 3396 3397 /* Force an immediate counter update and retrieve various MMU statistics. */ 3398 extern int bcm_cosq_stat_sync_get( 3399 int unit, 3400 bcm_gport_t gport, 3401 bcm_cos_queue_t cosq, 3402 bcm_cosq_stat_t stat, 3403 uint64 *value); 3404 3405 /* 3406 * Force an immediate counter update and retrieve multiple MMU 3407 * statistics. 3408 */ 3409 extern int bcm_cosq_stat_sync_multi_get( 3410 int unit, 3411 bcm_gport_t gport, 3412 bcm_cos_queue_t cosq, 3413 int nstat, 3414 bcm_cosq_stat_t *stat_arr, 3415 uint64 *value_arr); 3416 3417 /* 3418 * Force an immediate counter update and retrieve multiple MMU 3419 * statistics. 3420 */ 3421 extern int bcm_cosq_stat_sync_multi_get32( 3422 int unit, 3423 bcm_gport_t gport, 3424 bcm_cos_queue_t cosq, 3425 int nstat, 3426 bcm_cosq_stat_t *stat_arr, 3427 uint32 *value_arr); 3428 3429 /* Force an immediate counter update and retrieve various MMU statistics. */ 3430 extern int bcm_cosq_stat_sync_get32( 3431 int unit, 3432 bcm_gport_t gport, 3433 bcm_cos_queue_t cosq, 3434 bcm_cosq_stat_t stat, 3435 uint32 *value); 3436 3437 /* Retrieve/set various MMU statistics based on stat type */ 3438 extern int bcm_cosq_stat_set( 3439 int unit, 3440 bcm_gport_t gport, 3441 bcm_cos_queue_t cosq, 3442 bcm_cosq_stat_t stat, 3443 uint64 value); 3444 3445 /* Retrieve/set various MMU statistics based on stat type */ 3446 extern int bcm_cosq_stat_set32( 3447 int unit, 3448 bcm_gport_t gport, 3449 bcm_cos_queue_t cosq, 3450 bcm_cosq_stat_t stat, 3451 uint32 value); 3452 3453 #endif /* BCM_HIDE_DISPATCHABLE */ 3454 3455 /* parameters for VOQ gport */ 3456 typedef struct bcm_cosq_congestion_info_s { 3457 bcm_module_t fabric_modid; /* Fabric module ID. */ 3458 bcm_port_t fabric_port; /* Fabric module ID. */ 3459 bcm_module_t dest_modid; /* destination module ID. */ 3460 bcm_port_t dest_port; /* destination port ID. */ 3461 } bcm_cosq_congestion_info_t; 3462 3463 /* Initialize a CoSQ congestion information structure. */ 3464 extern void bcm_cosq_congestion_info_t_init( 3465 bcm_cosq_congestion_info_t *config); 3466 3467 #ifndef BCM_HIDE_DISPATCHABLE 3468 3469 /* Set/Get properties for the queue gport. */ 3470 extern int bcm_cosq_gport_congestion_config_set( 3471 int unit, 3472 bcm_gport_t gport, 3473 bcm_cos_queue_t cosq, 3474 bcm_cosq_congestion_info_t *config); 3475 3476 /* Set/Get properties for the queue gport. */ 3477 extern int bcm_cosq_gport_congestion_config_get( 3478 int unit, 3479 bcm_gport_t gport, 3480 bcm_cos_queue_t cosq, 3481 bcm_cosq_congestion_info_t *config); 3482 3483 #endif /* BCM_HIDE_DISPATCHABLE */ 3484 3485 typedef struct bcm_cos_pon_link_sla_s { 3486 int option; /* option flag(force report, etc). */ 3487 int polling_level; /* polling level 0 - 7. */ 3488 uint32 tdm_rate; /* TDM rate in kbps unit */ 3489 uint32 tdm_grant_length; /* TDM grant length in bytes */ 3490 } bcm_cos_pon_link_sla_t; 3491 3492 #ifndef BCM_HIDE_DISPATCHABLE 3493 3494 /* Set/Get EPON Link SLA Misc. parameters. */ 3495 extern int bcm_cosq_gport_pon_link_sla_set( 3496 int unit, 3497 bcm_gport_t gport, 3498 bcm_cos_pon_link_sla_t *link_sla); 3499 3500 /* Set/Get EPON Link SLA Misc. parameters. */ 3501 extern int bcm_cosq_gport_pon_link_sla_get( 3502 int unit, 3503 bcm_gport_t gport, 3504 bcm_cos_pon_link_sla_t *link_sla); 3505 3506 #endif /* BCM_HIDE_DISPATCHABLE */ 3507 3508 /* Attribute flags for resource identifier. */ 3509 #define BCM_COSQ_DEVICE 0x10000 /* device resource */ 3510 #define BCM_COSQ_DEVICE_EGRESS_POOL 0x20000 /* device egress service 3511 pool. */ 3512 #define BCM_COSQ_DEVICE_INGRESS_POOL 0x40000 /* device ingress service 3513 pool. */ 3514 #define BCM_COSQ_PORT_POOL 0x80000 /* port service pool. */ 3515 #define BCM_COSQ_PRIGROUP 0x100000 /* priority group. */ 3516 #define BCM_COSQ_HEADROOM 0x200000 /* headroom. */ 3517 #define BCM_COSQ_QUEUE 0x400000 /* headroom. */ 3518 #define BCM_COSQ_STAT_CLEAR 0x800000 /* perform with clear-on-read */ 3519 3520 /* BST Tracing statistics resources type eumerations. */ 3521 typedef enum bcm_bst_stat_id_e { 3522 bcmBstStatIdInvalid = -1, /* Invalid BST Id and used for sync all 3523 the Hardware stats to the Software 3524 copy */ 3525 bcmBstStatIdDevice = 0, /* Per device BST tracing resource */ 3526 bcmBstStatIdEgrPool = 1, /* Per Egress Pool BST tracing resource */ 3527 bcmBstStatIdEgrMCastPool = 2, /* Per Egress Pool BST tracing 3528 resource(Multicast) */ 3529 bcmBstStatIdIngPool = 3, /* Per Ingress Pool BST tracing resource */ 3530 bcmBstStatIdPortPool = 4, /* Per Port Pool BST tracing resource */ 3531 bcmBstStatIdPriGroupShared = 5, /* Per Shared Priority Group Pool BST 3532 tracing resource */ 3533 bcmBstStatIdPriGroupHeadroom = 6, /* Per Priority Group Headroom BST 3534 tracing resource */ 3535 bcmBstStatIdUcast = 7, /* BST Tracing resource for unicast */ 3536 bcmBstStatIdMcast = 8, /* BST Tracing resource for multicast */ 3537 bcmBstStatIdHeadroomPool = 9, /* BST Tracing the Headroom Pool Usage 3538 Count */ 3539 bcmBstStatIdEgrPortPoolSharedUcast = 10, /* Per Port Pool unicast BST Tracing 3540 resource */ 3541 bcmBstStatIdEgrPortPoolSharedMcast = 11, /* Per Port Pool multicast BST Tracing 3542 resource */ 3543 bcmBstStatIdQueueTotal = 12, /* Per Queue total use counts for all 3544 packets */ 3545 bcmBstStatIdRQEQueue = 13, /* BST Tracing resource for RQE queue */ 3546 bcmBstStatIdRQEPool = 14, /* BST Tracing resource for RQE pool */ 3547 bcmBstStatIdUCQueueGroup = 15, /* BST Tracing resource for unicast 3548 queue group */ 3549 bcmBstStatIdMaxCount = 16 /* Must be the last. Not a usable value. */ 3550 } bcm_bst_stat_id_t; 3551 3552 typedef struct bcm_cosq_bst_profile_s { 3553 uint32 byte; 3554 } bcm_cosq_bst_profile_t; 3555 3556 /* Initialize a CoSQ BST profile structure. */ 3557 extern void bcm_cosq_bst_profile_t_init( 3558 bcm_cosq_bst_profile_t *profile); 3559 3560 #ifndef BCM_HIDE_DISPATCHABLE 3561 3562 /* Set/Get the BST profile for CosQ objects */ 3563 extern int bcm_cosq_bst_profile_set( 3564 int unit, 3565 bcm_gport_t gport, 3566 bcm_cos_queue_t cosq, 3567 bcm_bst_stat_id_t bid, 3568 bcm_cosq_bst_profile_t *profile); 3569 3570 /* Set/Get the BST profile for CosQ objects */ 3571 extern int bcm_cosq_bst_profile_get( 3572 int unit, 3573 bcm_gport_t gport, 3574 bcm_cos_queue_t cosq, 3575 bcm_bst_stat_id_t bid, 3576 bcm_cosq_bst_profile_t *profile); 3577 3578 /* Set/Get the BST profile for CosQ objects */ 3579 extern int bcm_cosq_bst_multi_profile_set( 3580 int unit, 3581 bcm_gport_t gport, 3582 bcm_cos_queue_t cosq, 3583 bcm_bst_stat_id_t bid, 3584 int array_size, 3585 bcm_cosq_bst_profile_t *profile_array); 3586 3587 /* Set/Get the BST profile for CosQ objects */ 3588 extern int bcm_cosq_bst_multi_profile_get( 3589 int unit, 3590 bcm_gport_t gport, 3591 bcm_cos_queue_t cosq, 3592 bcm_bst_stat_id_t bid, 3593 int array_size, 3594 bcm_cosq_bst_profile_t *profile_array, 3595 int *count); 3596 3597 /* Sync the HW stats value to SW copy for all or given BST resource. */ 3598 extern int bcm_cosq_bst_stat_sync( 3599 int unit, 3600 bcm_bst_stat_id_t bid); 3601 3602 #endif /* BCM_HIDE_DISPATCHABLE */ 3603 3604 #define BCM_COSQ_WEIGHT_DISCRETE_WEIGHT_LEVEL0 -1 /* weight associated with 3605 level 0 of scheduler 3606 element having 3607 discrete weight 3608 attribute. */ 3609 #define BCM_COSQ_WEIGHT_DISCRETE_WEIGHT_LEVEL1 -2 /* weight associated with 3610 level 1 of scheduler 3611 element having 3612 discrete weight 3613 attribute. */ 3614 #define BCM_COSQ_WEIGHT_DISCRETE_WEIGHT_LEVEL2 -3 /* weight associated with 3615 level 2 of scheduler 3616 element having 3617 discrete weight 3618 attribute. */ 3619 #define BCM_COSQ_WEIGHT_DISCRETE_WEIGHT_LEVEL3 -4 /* weight associated with 3620 level 3 of scheduler 3621 element having 3622 discrete weight 3623 attribute. */ 3624 3625 /* Various types of cosq classifiers */ 3626 typedef struct bcm_cosq_classifier_s { 3627 uint32 flags; /* BCM_COSQ_CLASSIFIER_xxx flags */ 3628 bcm_vlan_t vlan; /* VLAN */ 3629 bcm_mac_t mac; /* MAC address */ 3630 bcm_vrf_t vrf; /* Virtual Router Instance */ 3631 bcm_ip_t ip_addr; /* IPv4 address */ 3632 bcm_ip6_t ip6_addr; /* IPv6 address */ 3633 bcm_gport_t gport; /* GPORT ID */ 3634 uint32 vfi_index; /* VFI index */ 3635 bcm_if_t egress_if; /* Egress object interface */ 3636 } bcm_cosq_classifier_t; 3637 3638 /* Flags indicating classifier type */ 3639 #define BCM_COSQ_CLASSIFIER_WITH_ID 0x00000001 /* Classifier ID */ 3640 #define BCM_COSQ_CLASSIFIER_VLAN 0x00000002 /* Classifier consists of 3641 VLAN */ 3642 #define BCM_COSQ_CLASSIFIER_L2 0x00000004 /* Classifier consists of 3643 VLAN and MAC address */ 3644 #define BCM_COSQ_CLASSIFIER_L3 0x00000008 /* Classifier consists of VRF 3645 and IP address */ 3646 #define BCM_COSQ_CLASSIFIER_IP6 0x00000010 /* The IP address in L3 3647 classifier is IPv6 */ 3648 #define BCM_COSQ_CLASSIFIER_GPORT 0x00000020 /* Classifier consists of 3649 GPORT */ 3650 #define BCM_COSQ_CLASSIFIER_FIELD 0x00000040 /* Classifier used in a field 3651 processor rule. */ 3652 #define BCM_COSQ_CLASSIFIER_VFI 0x00000080 /* Classifier consists of VFI 3653 index */ 3654 #define BCM_COSQ_CLASSIFIER_L3_EGRESS 0x00000100 /* Classifier consists of L3 3655 egress object */ 3656 #define BCM_COSQ_CLASSIFIER_NO_INT_PRI 0x00000200 /* Classifier used without 3657 internal priority */ 3658 3659 /* Initialize a bcm_cosq_classifier_t structure. */ 3660 extern void bcm_cosq_classifier_t_init( 3661 bcm_cosq_classifier_t *classifier); 3662 3663 #ifndef BCM_HIDE_DISPATCHABLE 3664 3665 /* Create a queue classifier. */ 3666 extern int bcm_cosq_classifier_create( 3667 int unit, 3668 bcm_cosq_classifier_t *classifier, 3669 int *classifier_id); 3670 3671 /* Destroy a queue classifier. */ 3672 extern int bcm_cosq_classifier_destroy( 3673 int unit, 3674 int classifier_id); 3675 3676 /* Get information about a queue classifier. */ 3677 extern int bcm_cosq_classifier_get( 3678 int unit, 3679 int classifier_id, 3680 bcm_cosq_classifier_t *classifier); 3681 3682 /* Set a classifier's queue mapping. */ 3683 extern int bcm_cosq_classifier_mapping_set( 3684 int unit, 3685 bcm_gport_t port, 3686 int classifier_id, 3687 bcm_gport_t queue_group, 3688 bcm_cos_t priority, 3689 bcm_cos_queue_t cosq); 3690 3691 /* Set multiple queue mappings for a classifier. */ 3692 extern int bcm_cosq_classifier_mapping_multi_set( 3693 int unit, 3694 bcm_gport_t port, 3695 int classifier_id, 3696 bcm_gport_t queue_group, 3697 int array_count, 3698 bcm_cos_t *priority_array, 3699 bcm_cos_queue_t *cosq_array); 3700 3701 /* Get a classifier's queue mapping. */ 3702 extern int bcm_cosq_classifier_mapping_get( 3703 int unit, 3704 bcm_gport_t port, 3705 int classifier_id, 3706 bcm_gport_t *queue_group, 3707 bcm_cos_t priority, 3708 bcm_cos_queue_t *cosq); 3709 3710 /* Get multiple queue mappings for a classifier. */ 3711 extern int bcm_cosq_classifier_mapping_multi_get( 3712 int unit, 3713 bcm_gport_t port, 3714 int classifier_id, 3715 bcm_gport_t *queue_group, 3716 int array_max, 3717 bcm_cos_t *priority_array, 3718 bcm_cos_queue_t *cosq_array, 3719 int *array_count); 3720 3721 /* Clear a classifier's queue mapping. */ 3722 extern int bcm_cosq_classifier_mapping_clear( 3723 int unit, 3724 bcm_gport_t port, 3725 int classifier_id); 3726 3727 /* Gets the classifier id for the given profile. */ 3728 extern int bcm_cosq_classifier_id_get( 3729 int unit, 3730 bcm_cosq_classifier_t *classifier, 3731 int array_count, 3732 bcm_cos_t *priority_array, 3733 bcm_cos_queue_t *cosq_array, 3734 int *classifier_id); 3735 3736 #endif /* BCM_HIDE_DISPATCHABLE */ 3737 3738 /* Config parameters for Priority flow control */ 3739 typedef struct bcm_cosq_qcn_config_s { 3740 int size; /* Set point for queue. In Bytes. */ 3741 int weight; /* Weight to be given to change in queue 3742 length. */ 3743 int nbr_samples; /* Number of valid samples. */ 3744 int sample_bytes[BCM_COS_COUNT]; 3745 int max_feedback; /* Maximum value of congestion feedback. */ 3746 int quantization; /* Quantization value. */ 3747 int randomize_sample_threshold; /* Random sample threshold - true/false. */ 3748 } bcm_cosq_qcn_config_t; 3749 3750 #ifndef BCM_HIDE_DISPATCHABLE 3751 3752 /* Set the configuration of a congestion managed queue parameters */ 3753 extern int bcm_cosq_qcn_config_set( 3754 int unit, 3755 bcm_gport_t port, 3756 bcm_cos_queue_t cosq, 3757 uint32 flags, 3758 bcm_cosq_qcn_config_t *config); 3759 3760 /* Set the configuration of a congestion managed queue parameters */ 3761 extern int bcm_cosq_qcn_config_get( 3762 int unit, 3763 bcm_gport_t port, 3764 bcm_cos_queue_t cosq, 3765 uint32 flags, 3766 bcm_cosq_qcn_config_t *config); 3767 3768 /* Set the credit worth size per module-ID */ 3769 extern int bcm_cosq_dest_credit_size_set( 3770 int unit, 3771 bcm_module_t dest_modid, 3772 uint32 credit_size); 3773 3774 /* Set the credit worth size per module-ID */ 3775 extern int bcm_cosq_dest_credit_size_get( 3776 int unit, 3777 bcm_module_t dest_modid, 3778 uint32 *credit_size); 3779 3780 /* To enable/disable Rx of packets on the specified CPU cosq. */ 3781 extern int bcm_cosq_cpu_cosq_enable_set( 3782 int unit, 3783 bcm_cos_queue_t cosq, 3784 int enable); 3785 3786 /* Get status of RX for a given CPU queue */ 3787 extern int bcm_cosq_cpu_cosq_enable_get( 3788 int unit, 3789 bcm_cos_queue_t cosq, 3790 int *enable); 3791 3792 #endif /* BCM_HIDE_DISPATCHABLE */ 3793 3794 /* Alpha value for dynamic threshold */ 3795 typedef enum bcm_cosq_control_drop_limit_alpha_value_e { 3796 bcmCosqControlDropLimitAlpha_1_64 = 0, /* Use 1/64 as the alpha value for 3797 dynamic threshold */ 3798 bcmCosqControlDropLimitAlpha_1_32 = 1, /* Use 1/32 as the alpha value for 3799 dynamic threshold */ 3800 bcmCosqControlDropLimitAlpha_1_16 = 2, /* Use 1/16 as the alpha value for 3801 dynamic threshold */ 3802 bcmCosqControlDropLimitAlpha_1_8 = 3, /* Use 1/8 as the alpha value for 3803 dynamic threshold */ 3804 bcmCosqControlDropLimitAlpha_1_4 = 4, /* Use 1/4 as the alpha value for 3805 dynamic threshold */ 3806 bcmCosqControlDropLimitAlpha_1_2 = 5, /* Use 1/2 as the alpha value for 3807 dynamic threshold */ 3808 bcmCosqControlDropLimitAlpha_1 = 6, /* Use 1 as the alpha value for dynamic 3809 threshold */ 3810 bcmCosqControlDropLimitAlpha_2 = 7, /* Use 2 as the alpha value for dynamic 3811 threshold */ 3812 bcmCosqControlDropLimitAlpha_4 = 8, /* Use 4 as the alpha value for dynamic 3813 threshold */ 3814 bcmCosqControlDropLimitAlpha_1_128 = 9, /* Use 1/128 as the alpha value for 3815 dynamic threshold */ 3816 bcmCosqControlDropLimitAlpha_8 = 10, /* Use 8 as the alpha value for dynamic 3817 threshold */ 3818 bcmCosqControlDropLimitAlphaCount = 11 /* Must be the last entry! */ 3819 } bcm_cosq_control_drop_limit_alpha_value_t; 3820 3821 #ifndef BCM_HIDE_DISPATCHABLE 3822 3823 /* Clear the current statistic/count of specified BST profile */ 3824 extern int bcm_cosq_bst_stat_clear( 3825 int unit, 3826 bcm_gport_t gport, 3827 bcm_cos_queue_t cosq, 3828 bcm_bst_stat_id_t bid); 3829 3830 /* Clear the current statistic/count of specified BST profile */ 3831 extern int bcm_cosq_bst_stat_extended_clear( 3832 int unit, 3833 bcm_cosq_object_id_t *id, 3834 bcm_bst_stat_id_t bid); 3835 3836 /* Get the current statistic/count of specified BST profile */ 3837 extern int bcm_cosq_bst_stat_get( 3838 int unit, 3839 bcm_gport_t gport, 3840 bcm_cos_queue_t cosq, 3841 bcm_bst_stat_id_t bid, 3842 uint32 options, 3843 uint64 *value); 3844 3845 /* Get the current statistic/count of specified BST profile */ 3846 extern int bcm_cosq_bst_stat_get32( 3847 int unit, 3848 bcm_gport_t gport, 3849 bcm_cos_queue_t cosq, 3850 bcm_bst_stat_id_t bid, 3851 uint32 options, 3852 uint32 *value); 3853 3854 /* Get the current statistic/count of specified BST profile */ 3855 extern int bcm_cosq_bst_stat_extended_get( 3856 int unit, 3857 bcm_cosq_object_id_t *id, 3858 bcm_bst_stat_id_t bid, 3859 uint32 options, 3860 uint64 *value); 3861 3862 /* Get the current statistic/count of specified BST profile */ 3863 extern int bcm_cosq_bst_stat_extended_get32( 3864 int unit, 3865 bcm_cosq_object_id_t *id, 3866 bcm_bst_stat_id_t bid, 3867 uint32 options, 3868 uint32 *value); 3869 3870 /* Get the current statistic/count of multiple specified BST profile */ 3871 extern int bcm_cosq_bst_stat_multi_get( 3872 int unit, 3873 bcm_gport_t gport, 3874 bcm_cos_queue_t cosq, 3875 uint32 options, 3876 int max_values, 3877 bcm_bst_stat_id_t *id_list, 3878 uint64 *values); 3879 3880 /* Get the current statistic/count of multiple specified BST profile */ 3881 extern int bcm_cosq_bst_stat_multi_get32( 3882 int unit, 3883 bcm_gport_t gport, 3884 bcm_cos_queue_t cosq, 3885 uint32 options, 3886 int max_values, 3887 bcm_bst_stat_id_t *id_list, 3888 uint32 *values); 3889 3890 #endif /* BCM_HIDE_DISPATCHABLE */ 3891 3892 /* Service pool types. */ 3893 typedef enum bcm_cosq_service_pool_type_e { 3894 bcmCosqServicePoolPortColorAware = 0, /* Port service pool level color aware */ 3895 bcmCosqServicePoolColorAware = 1, /* Pool level color aware */ 3896 bcmCosqServicePoolQueueCongestionAware = 2, /* Pool level queue congeston status 3897 aware */ 3898 bcmCosqServicePoolTypeCount = 3 /* Must be the last entry! */ 3899 } bcm_cosq_service_pool_type_t; 3900 3901 /* This structure has everything about service pool. */ 3902 typedef struct bcm_cosq_service_pool_s { 3903 bcm_cosq_service_pool_type_t type; /* Service pool type. */ 3904 int enabled; /* Enable or disable. */ 3905 } bcm_cosq_service_pool_t; 3906 3907 #ifndef BCM_HIDE_DISPATCHABLE 3908 3909 /* 3910 * To set/get enable or disable status of service pool for a given pool 3911 * id 3912 */ 3913 extern int bcm_cosq_service_pool_set( 3914 int unit, 3915 bcm_service_pool_id_t id, 3916 bcm_cosq_service_pool_t cosq_service_pool); 3917 3918 /* 3919 * To set/get enable or disable status of service pool for a given pool 3920 * id 3921 */ 3922 extern int bcm_cosq_service_pool_get( 3923 int unit, 3924 bcm_service_pool_id_t id, 3925 bcm_cosq_service_pool_t *cosq_service_pool); 3926 3927 #endif /* BCM_HIDE_DISPATCHABLE */ 3928 3929 /* Initialize a COSQ service pool structure. */ 3930 extern void bcm_cosq_service_pool_t_init( 3931 bcm_cosq_service_pool_t *service_pool); 3932 3933 #ifndef BCM_HIDE_DISPATCHABLE 3934 3935 /* Reattach the output of a GPORT to the input of a scheduler GPORT. */ 3936 extern int bcm_cosq_gport_reattach( 3937 int unit, 3938 bcm_gport_t sched_port, 3939 bcm_gport_t input_port, 3940 bcm_cos_queue_t cosq); 3941 3942 /* Maps a gport to a profile */ 3943 extern int bcm_cosq_profile_mapping_set( 3944 int unit, 3945 bcm_gport_t gport_to_map, 3946 bcm_cos_queue_t cosq, 3947 uint32 flags, 3948 bcm_switch_profile_mapping_t *profile_mapping); 3949 3950 extern int bcm_cosq_profile_mapping_get( 3951 int unit, 3952 bcm_gport_t gport_to_map, 3953 bcm_cos_queue_t cosq, 3954 uint32 flags, 3955 bcm_switch_profile_mapping_t *profile_mapping); 3956 3957 #endif /* BCM_HIDE_DISPATCHABLE */ 3958 3959 /* Range configuration type. */ 3960 typedef enum bcm_cosq_control_range_type_e { 3961 bcmCosqRangeMulticastQueue = 0, /* Multicast QID range configuration. */ 3962 bcmCosqRangeShaperQueue = 1, /* FIC QID shaping range configuration. */ 3963 bcmCosqRangeFabricQueue = 2, /* FIC QID range configuration. */ 3964 bcmCosqRecycleQueue = 3, /* Recycle QID range configuration. */ 3965 bcmCosqWatchdogQueue = 4, /* Watchdog QID range configuration. */ 3966 bcmCosq1Plus1PortProtection = 5, /* One plus one port protection: 3967 configuring which DPs participate are 3968 used. */ 3969 bcmCosqThresholdDramMixDbuff = 6, /* How many OCB buffers can be given to 3970 dram-mix queues. */ 3971 bcmCosqOcbCommittedMulticast_1 = 7, /* A range of MC IDs that are guaranteed 3972 to use OCB buffers If available. 3973 Range number 1. */ 3974 bcmCosqOcbCommittedMulticast_2 = 8, /* A range of MC IDs that are guaranteed 3975 to use OCB buffers If available. 3976 Range number 2. */ 3977 bcmCosqOcbEligibleMulticast_1 = 9, /* A range of MC IDs that are allowed to 3978 use OCB buffers If available. Range 3979 number 1. */ 3980 bcmCosqOcbEligibleMulticast_2 = 10, /* A range of MC IDs that are allowed to 3981 use OCB buffers If available. Range 3982 number 2. */ 3983 bcmCosqStatIfQueues = 11, /* A range of queues that produce 3984 statistics reports when working in 3985 queue size mode. */ 3986 bcmCosqStatIfScrubberQueues = 12, /* A range of queues that produce 3987 statistics scrubber reports when 3988 working in queue size mode. */ 3989 bcmCosqRangeLowRateVoqConnector = 13 /* Low range low rate VOQ connectors. */ 3990 } bcm_cosq_control_range_type_t; 3991 3992 /* Range configuration. */ 3993 typedef struct bcm_cosq_range_s { 3994 uint8 is_enabled; /* Enable range ccnfiguration. */ 3995 int range_start; /* Minimum size. */ 3996 int range_end; /* Maximus size. */ 3997 } bcm_cosq_range_t; 3998 3999 #ifndef BCM_HIDE_DISPATCHABLE 4000 4001 /* Set/Get a range configuration. */ 4002 extern int bcm_cosq_control_range_set( 4003 int unit, 4004 bcm_gport_t port, 4005 uint32 flags, 4006 bcm_cosq_control_range_type_t type, 4007 bcm_cosq_range_t *range); 4008 4009 /* Set/Get a range configuration. */ 4010 extern int bcm_cosq_control_range_get( 4011 int unit, 4012 bcm_gport_t port, 4013 uint32 flags, 4014 bcm_cosq_control_range_type_t type, 4015 bcm_cosq_range_t *range); 4016 4017 #endif /* BCM_HIDE_DISPATCHABLE */ 4018 4019 /* resource allocation related flags. */ 4020 #define BCM_COSQ_RSRC_ALLOC_COLOR_BLIND 0x0001 4021 4022 /* Type of resource. */ 4023 typedef enum bcm_cosq_resource_e { 4024 bcmReservationResourceBufferDescriptors = 0, /* Resource reservation of buffer 4025 descriptors. */ 4026 bcmResourceOcbBuffers = 1, /* OCB resource in buffers. */ 4027 bcmReservationResourceOcbBuffers = bcmResourceOcbBuffers, /* OCB resource reservation in buffers. */ 4028 bcmReservationResourceBufferDescriptorBuffers = 2, /* Resource reservation of buffer 4029 descriptor buffers. */ 4030 bcmResourceBytes = 3, /* Resource in bytes. */ 4031 bcmReservationResourceBytes = bcmResourceBytes, /* Resource reservation in bytes. */ 4032 bcmResourceOcbBytes = 4, /* OCB resource in bytes. */ 4033 bcmResourceOcbPacketDescriptors = 5, /* OCB Resource in packet descriptors. */ 4034 bcmResourceOcbPacketDescriptorsBuffers = 6, 4035 bcmResourceDramBundleDescriptorsBuffers = 7 4036 } bcm_cosq_resource_t; 4037 4038 /* Backward compatibility. */ 4039 typedef bcm_cosq_resource_t bcm_cosq_allocation_resource_t; 4040 4041 /* An entity for which we allocate. */ 4042 typedef struct bcm_cosq_allocation_entity_s { 4043 bcm_gport_t gport; /* VSQ for which reservation will be done. */ 4044 bcm_color_t color; /* drop precedence. */ 4045 uint8 pool_id; /* pool for which to reserve, used for src port VSQs. */ 4046 uint8 is_ocb_only; /* PG type (OCB-only/DRAM-mix) for which to reserve, 4047 used for src port VSQs. */ 4048 } bcm_cosq_allocation_entity_t; 4049 4050 /* Resource amounts used for allocation. */ 4051 typedef struct bcm_cosq_resource_amounts_s { 4052 uint32 flags; 4053 uint32 reserved; /* reserved amount of the resource. */ 4054 uint32 max_shared_pool; /* maximum amount of the resource in the 4055 shared pool. */ 4056 bcm_cosq_fadt_threshold_t shared_pool_fadt; /* FADT threshold on the amount of the 4057 resource in the shared pool. */ 4058 uint32 max_headroom; /* maximum amount of the resource in the 4059 lossless headroom. */ 4060 uint32 nominal_headroom; /* nominal amount of the resource in the 4061 lossless headroom. */ 4062 } bcm_cosq_resource_amounts_t; 4063 4064 #ifndef BCM_HIDE_DISPATCHABLE 4065 4066 /* Set/Get the resource allocation for a target/entity */ 4067 extern int bcm_cosq_resource_allocation_set( 4068 int unit, 4069 uint32 flags, 4070 bcm_cosq_resource_t resource, 4071 bcm_cosq_allocation_entity_t *target, 4072 bcm_cosq_resource_amounts_t *amounts); 4073 4074 /* Set/Get the resource allocation for a target/entity */ 4075 extern int bcm_cosq_resource_allocation_get( 4076 int unit, 4077 uint32 flags, 4078 bcm_cosq_resource_t resource, 4079 bcm_cosq_allocation_entity_t *target, 4080 bcm_cosq_resource_amounts_t *amounts); 4081 4082 #endif /* BCM_HIDE_DISPATCHABLE */ 4083 4084 /* Struct for configuring a slow factor. */ 4085 typedef struct bcm_cosq_slow_level_s { 4086 int core; /* 0, 1, BCM_CORE_ALL */ 4087 int profile; 4088 uint32 level; 4089 uint32 flags; 4090 } bcm_cosq_slow_level_t; 4091 4092 typedef struct bcm_cosq_slow_profile_attributes_s { 4093 uint32 max_rate; 4094 } bcm_cosq_slow_profile_attributes_t; 4095 4096 #ifndef BCM_HIDE_DISPATCHABLE 4097 4098 /* Set/Get the slow factor per profile. */ 4099 extern int bcm_cosq_slow_profile_set( 4100 int unit, 4101 bcm_cosq_slow_level_t *slow_level, 4102 bcm_cosq_slow_profile_attributes_t *attr); 4103 4104 /* Set/Get the slow factor per profile. */ 4105 extern int bcm_cosq_slow_profile_get( 4106 int unit, 4107 bcm_cosq_slow_level_t *slow_level, 4108 bcm_cosq_slow_profile_attributes_t *attr); 4109 4110 #endif /* BCM_HIDE_DISPATCHABLE */ 4111 4112 /* Total number of PFC controlled COSqs and scheduling nodes on a port. */ 4113 #define BCM_COSQ_PFC_GPORT_COUNT 26 4114 4115 /* PFC class to COSq / scheduling node mapping structure. */ 4116 typedef struct bcm_cosq_pfc_class_mapping_s { 4117 int class_id; /* PFC class. */ 4118 bcm_gport_t gport_list[BCM_COSQ_PFC_GPORT_COUNT]; /* gport group (COSqs or scheduling 4119 nodes) that mapped to a PFC class. */ 4120 } bcm_cosq_pfc_class_mapping_t; 4121 4122 /* Initialize a COSq PFC class mapping structure. */ 4123 extern void bcm_cosq_pfc_class_mapping_t_init( 4124 bcm_cosq_pfc_class_mapping_t *mapping); 4125 4126 #ifndef BCM_HIDE_DISPATCHABLE 4127 4128 /* 4129 * Get / set mapping of PFC class to COSQs and / or scheduling nodes for 4130 * a port. 4131 */ 4132 extern int bcm_cosq_pfc_class_mapping_set( 4133 int unit, 4134 bcm_gport_t port, 4135 int array_count, 4136 bcm_cosq_pfc_class_mapping_t *mapping_array); 4137 4138 /* 4139 * Get / set mapping of PFC class to COSQs and / or scheduling nodes for 4140 * a port. 4141 */ 4142 extern int bcm_cosq_pfc_class_mapping_get( 4143 int unit, 4144 bcm_gport_t port, 4145 int array_max, 4146 bcm_cosq_pfc_class_mapping_t *mapping_array, 4147 int *array_count); 4148 4149 #endif /* BCM_HIDE_DISPATCHABLE */ 4150 4151 /* Total number of SAFC controlled COSqs and scheduling nodes on a port. */ 4152 #define BCM_COSQ_SAFC_GPORT_COUNT 20 4153 4154 #define BCM_COSQ_INGRESS_PORT_DROP_FLAGS_THRESHOLD_PRECENT (1<<0) 4155 4156 #define BCM_COSQ_INGRESS_PORT_DROP_ETH_MAP_KEY(pcp, dei) ( ( ((pcp << _SHR_PORT_PRD_ETH_DEI_KEY_SIZE) | dei) & (_SHR_PORT_PRD_ETH_KEY_MASK) ) | _SHR_PORT_PRD_ETH_MAP_INDICATION ) 4157 #define BCM_COSQ_INGRESS_PORT_DROP_TM_MAP_KEY(tc, dp) ( ( ((tc << _SHR_PORT_PRD_TM_DP_KEY_SIZE) | dp) & (_SHR_PORT_PRD_TM_KEY_MASK) ) | _SHR_PORT_PRD_TM_MAP_INDICATION ) 4158 #define BCM_COSQ_INGRESS_PORT_DROP_IP_MAP_KEY(dscp) ( ((dscp) & _SHR_PORT_PRD_IP_KEY_MASK) | _SHR_PORT_PRD_IP_MAP_INDICATION ) 4159 #define BCM_COSQ_INGRESS_PORT_DROP_MPLS_MAP_KEY(exp) ( ((exp) & _SHR_PORT_PRD_MPLS_KEY_MASK) | _SHR_PORT_PRD_MPLS_MAP_INDICATION ) 4160 4161 /* SAFC class to COSq / scheduling node mapping structure. */ 4162 typedef struct bcm_cosq_safc_class_mapping_s { 4163 int class_id; /* SAFC class. */ 4164 bcm_gport_t gport_list[BCM_COSQ_SAFC_GPORT_COUNT]; /* gport group (COSqs or scheduling 4165 nodes) that mapped to a SAFC class. */ 4166 } bcm_cosq_safc_class_mapping_t; 4167 4168 /* Initialize a SAFC class mapping structure. */ 4169 extern void bcm_cosq_safc_class_mapping_t_init( 4170 bcm_cosq_safc_class_mapping_t *mapping); 4171 4172 #ifndef BCM_HIDE_DISPATCHABLE 4173 4174 /* 4175 * Get / set mapping of SAFC class to COSQs and / or scheduling nodes for 4176 * a port. 4177 */ 4178 extern int bcm_cosq_safc_class_mapping_set( 4179 int unit, 4180 bcm_gport_t port, 4181 int array_count, 4182 bcm_cosq_safc_class_mapping_t *mapping_array); 4183 4184 /* 4185 * Get / set mapping of SAFC class to COSQs and / or scheduling nodes for 4186 * a port. 4187 */ 4188 extern int bcm_cosq_safc_class_mapping_get( 4189 int unit, 4190 bcm_gport_t port, 4191 int array_max, 4192 bcm_cosq_safc_class_mapping_t *mapping_array, 4193 int *array_count); 4194 4195 #endif /* BCM_HIDE_DISPATCHABLE */ 4196 4197 /* queue deadlock recovery state */ 4198 typedef enum bcm_cosq_pfc_deadlock_recovery_event_e { 4199 bcmCosqPfcDeadlockRecoveryEventBegin = 0, /* queue deadlock recovery begin */ 4200 bcmCosqPfcDeadlockRecoveryEventEnd = 1, /* queue deadlock recovery end */ 4201 bcmCosqPfcDeadlockRecoveryEventCount = 2 /* queue deadlock recovery count num */ 4202 } bcm_cosq_pfc_deadlock_recovery_event_t; 4203 4204 typedef int (*bcm_cosq_pfc_deadlock_recovery_event_cb_t)( 4205 int unit, 4206 bcm_port_t port, 4207 bcm_cos_queue_t cosq, 4208 bcm_cosq_pfc_deadlock_recovery_event_t recovery_state, 4209 void *userdata); 4210 4211 /* PFC Deadlock config structure for a given Priority. */ 4212 typedef struct bcm_cosq_pfc_deadlock_config_s { 4213 uint32 detection_timer; /* PFC Deadlock Detection Timer. */ 4214 uint32 recovery_timer; /* PFC Deadlock Recovery Timer. */ 4215 } bcm_cosq_pfc_deadlock_config_t; 4216 4217 /* PFC Deadlock config structure for UC Queue Gport. */ 4218 typedef struct bcm_cosq_pfc_deadlock_queue_config_s { 4219 int enable; /* PFC Deadlock config for a Queue. */ 4220 } bcm_cosq_pfc_deadlock_queue_config_t; 4221 4222 /* PFC Deadlock config structure for a given Priority. */ 4223 typedef struct bcm_cosq_pfc_deadlock_info_s { 4224 bcm_pbmp_t enabled_pbmp; /* Bitmap of ports enabled for a given priority. */ 4225 bcm_pbmp_t deadlock_pbmp; /* Bitmap of ports currently in deadlock status 4226 for a given priority. */ 4227 } bcm_cosq_pfc_deadlock_info_t; 4228 4229 /* Initialize a COSq PFC deadlock config structure. */ 4230 extern void bcm_cosq_pfc_deadlock_config_t_init( 4231 bcm_cosq_pfc_deadlock_config_t *config); 4232 4233 /* Initialize a COSq PFC deadlock queue config structure. */ 4234 extern void bcm_cosq_pfc_deadlock_queue_config_t_init( 4235 bcm_cosq_pfc_deadlock_queue_config_t *q_config); 4236 4237 /* Initialize a COSq PFC deadlock info structure. */ 4238 extern void bcm_cosq_pfc_deadlock_info_t_init( 4239 bcm_cosq_pfc_deadlock_info_t *pfc_deadlock_info); 4240 4241 #ifndef BCM_HIDE_DISPATCHABLE 4242 4243 /* Start/Exit PFC Deadlock recovery process */ 4244 extern int bcm_cosq_pfc_deadlock_recovery_start( 4245 int unit, 4246 bcm_port_t port, 4247 bcm_cos_t cosq); 4248 4249 /* Start/Exit PFC Deadlock recovery process */ 4250 extern int bcm_cosq_pfc_deadlock_recovery_exit( 4251 int unit, 4252 bcm_port_t port, 4253 bcm_cos_t cosq); 4254 4255 /* Set/Get config for the given priority for the PFC Deadlock feature */ 4256 extern int bcm_cosq_pfc_deadlock_config_set( 4257 int unit, 4258 int priority, 4259 bcm_cosq_pfc_deadlock_config_t *config); 4260 4261 /* Set/Get config for the given priority for the PFC Deadlock feature */ 4262 extern int bcm_cosq_pfc_deadlock_config_get( 4263 int unit, 4264 int priority, 4265 bcm_cosq_pfc_deadlock_config_t *config); 4266 4267 /* Get bitmap of Enabled(Admin) and Current Deadlock ports status */ 4268 extern int bcm_cosq_pfc_deadlock_info_get( 4269 int unit, 4270 int priority, 4271 bcm_cosq_pfc_deadlock_info_t *pfc_deadlock_info); 4272 4273 /* 4274 * Set/Get Config status for the given UC Queue Gport for the PFC 4275 * Deadlock feature 4276 */ 4277 extern int bcm_cosq_pfc_deadlock_queue_config_set( 4278 int unit, 4279 bcm_gport_t gport, 4280 bcm_cosq_pfc_deadlock_queue_config_t *q_config); 4281 4282 /* 4283 * Set/Get Config status for the given UC Queue Gport for the PFC 4284 * Deadlock feature 4285 */ 4286 extern int bcm_cosq_pfc_deadlock_queue_config_get( 4287 int unit, 4288 bcm_gport_t gport, 4289 bcm_cosq_pfc_deadlock_queue_config_t *q_config); 4290 4291 /* Get the current Deadlock status for the given UC Queue Gport. */ 4292 extern int bcm_cosq_pfc_deadlock_queue_status_get( 4293 int unit, 4294 bcm_gport_t gport, 4295 uint8 *deadlock_status); 4296 4297 /* 4298 * Register/Unregister pfc deadlock recovery callback in PFC deadlock 4299 * feature 4300 */ 4301 extern int bcm_cosq_pfc_deadlock_recovery_event_register( 4302 int unit, 4303 bcm_cosq_pfc_deadlock_recovery_event_cb_t callback, 4304 void *userdata); 4305 4306 /* 4307 * Register/Unregister pfc deadlock recovery callback in PFC deadlock 4308 * feature 4309 */ 4310 extern int bcm_cosq_pfc_deadlock_recovery_event_unregister( 4311 int unit, 4312 bcm_cosq_pfc_deadlock_recovery_event_cb_t callback, 4313 void *userdata); 4314 4315 /* Configure the stat types for counters */ 4316 extern int bcm_cosq_stat_config_set( 4317 int unit, 4318 int stat_count, 4319 bcm_cosq_stat_t *stat_array); 4320 4321 /* Configure the stat types for counters */ 4322 extern int bcm_cosq_stat_config_get( 4323 int unit, 4324 int stat_count, 4325 bcm_cosq_stat_t *stat_array); 4326 4327 #endif /* BCM_HIDE_DISPATCHABLE */ 4328 4329 /* Cosq Direction */ 4330 typedef enum bcm_cosq_dir_e { 4331 bcmCosqIngress = 0, /* Ingress Port */ 4332 bcmCosqEgress = 1, /* Egress Port */ 4333 bcmCosqDirectionMaxCount = 2 4334 } bcm_cosq_dir_t; 4335 4336 #ifndef BCM_HIDE_DISPATCHABLE 4337 4338 /* Get buffer id associated with a port. */ 4339 extern int bcm_cosq_buffer_id_multi_get( 4340 int unit, 4341 bcm_gport_t gport, 4342 bcm_cos_queue_t cosq, 4343 bcm_cosq_dir_t direction, 4344 int array_max, 4345 bcm_cosq_buffer_id_t *buf_id_array, 4346 int *array_count); 4347 4348 #endif /* BCM_HIDE_DISPATCHABLE */ 4349 4350 /* Parameter for bcmCosqControlAlternateStoreForward */ 4351 typedef enum bcm_cosq_asf_mode_e { 4352 bcmCosqAsfModeDisabled = 0, /* No cut-through, i.e. 4353 store-and-forward mode */ 4354 bcmCosqAsfModeStoreAndForward = bcmCosqAsfModeDisabled, /* Store-and-forward mode */ 4355 bcmCosqAsfModeAlternateStoreForward = 1, /* Alternate-store-forward (cut-through) 4356 mode */ 4357 bcmCosqAsfModeCount = 2 /* Must be last. Not a usable value */ 4358 } bcm_cosq_asf_mode_t; 4359 4360 #if defined(INCLUDE_TCB) 4361 /* TCB Scope type */ 4362 typedef enum bcm_cosq_tcb_scope_e { 4363 bcmCosqTcbScopeUcastQueue = 0, /* Set scope to a unicast queue */ 4364 bcmCosqTcbScopeIngressPort = 1, /* Set scope to ingress port */ 4365 bcmCosqTcbScopeEgressPort = 2, /* Set scope to egress port */ 4366 bcmCosqTcbScopeIngressPipe = 3, /* Set scope to ingress pipe */ 4367 bcmCosqTcbScopeEgressPipe = 4, /* Set scope to egress pipe */ 4368 bcmCosqTcbScopeMaxCount = 5 4369 } bcm_cosq_tcb_scope_t; 4370 #endif 4371 4372 #if defined(INCLUDE_TCB) 4373 /* TCB Config Structure. */ 4374 typedef struct bcm_cosq_tcb_config_s { 4375 bcm_cosq_tcb_scope_t scope_type; /* TCB monitor scope type */ 4376 bcm_gport_t gport; /* TCB monitor entity, can be a Unicast 4377 queue gport or a physical port gport */ 4378 bcm_cos_queue_t cosq; /* Reserved field */ 4379 uint32 trigger_reason; /* Define the event which could trigger 4380 the capture */ 4381 uint32 pre_freeze_capture_num; /* Define the capture number after TCB 4382 enter freeze status */ 4383 uint32 pre_freeze_capture_time; /* Define the capture time after TCB 4384 enter freeze status. Unit is usec */ 4385 uint32 post_sample_probability; /* The sample probability in 4386 post-trigger phase. Step is 1/16, 4387 valid configure range is 1 to 16, 1 4388 means 1/16 sample, 16 means sample 4389 all */ 4390 uint32 pre_sample_probability; /* The sample probability in pre-trigger 4391 phase. Step is 1/16, valid configure 4392 range is 1 to 16, 1 means 1/16 4393 sample, 16 means sample all */ 4394 int pipe_id; /* Pipe id */ 4395 } bcm_cosq_tcb_config_t; 4396 #endif 4397 4398 #if defined(INCLUDE_TCB) 4399 /* Initialize a tcb config structure. */ 4400 extern void bcm_cosq_tcb_config_t_init( 4401 bcm_cosq_tcb_config_t *config); 4402 #endif 4403 4404 #ifndef BCM_HIDE_DISPATCHABLE 4405 4406 #if defined(INCLUDE_TCB) 4407 /* Set/Get the tcb configuration. */ 4408 extern int bcm_cosq_tcb_config_set( 4409 int unit, 4410 bcm_cosq_buffer_id_t buffer_id, 4411 bcm_cosq_tcb_config_t *config); 4412 #endif 4413 4414 #if defined(INCLUDE_TCB) 4415 /* Set/Get the tcb configuration. */ 4416 extern int bcm_cosq_tcb_config_get( 4417 int unit, 4418 bcm_cosq_buffer_id_t buffer_id, 4419 bcm_cosq_tcb_config_t *config); 4420 #endif 4421 4422 #endif /* BCM_HIDE_DISPATCHABLE */ 4423 4424 #if defined(INCLUDE_TCB) 4425 /* TCB threshold profile. */ 4426 typedef struct bcm_cosq_tcb_threshold_profile_s { 4427 uint32 start_threshold_bytes; /* The start threshold above which queue 4428 start the capture */ 4429 uint32 stop_threshold_bytes; /* The stop threshold below which queue stop 4430 the capture */ 4431 } bcm_cosq_tcb_threshold_profile_t; 4432 #endif 4433 4434 #if defined(INCLUDE_TCB) 4435 /* Initialize a tcb threshold profile structure. */ 4436 extern void bcm_cosq_tcb_threshold_profile_t_init( 4437 bcm_cosq_tcb_threshold_profile_t *threshold); 4438 #endif 4439 4440 #ifndef BCM_HIDE_DISPATCHABLE 4441 4442 #if defined(INCLUDE_TCB) 4443 /* Create tcb threshold profile. */ 4444 extern int bcm_cosq_tcb_threshold_profile_create( 4445 int unit, 4446 int flags, 4447 bcm_cosq_buffer_id_t buffer_id, 4448 bcm_cosq_tcb_threshold_profile_t *threshold, 4449 int *profile_index); 4450 #endif 4451 4452 #if defined(INCLUDE_TCB) 4453 /* Get a tcb threshold profile. */ 4454 extern int bcm_cosq_tcb_threshold_profile_get( 4455 int unit, 4456 bcm_cosq_buffer_id_t buffer_id, 4457 int profile_index, 4458 bcm_cosq_tcb_threshold_profile_t *threshold); 4459 #endif 4460 4461 #if defined(INCLUDE_TCB) 4462 /* Destroy a tcb threshold profile. */ 4463 extern int bcm_cosq_tcb_threshold_profile_destroy( 4464 int unit, 4465 bcm_cosq_buffer_id_t buffer_id, 4466 int profile_index); 4467 #endif 4468 4469 #if defined(INCLUDE_TCB) 4470 /* Set/Get threshold profile for UCQ. */ 4471 extern int bcm_cosq_tcb_gport_threshold_mapping_set( 4472 int unit, 4473 bcm_cosq_object_id_t *id, 4474 int profile_index); 4475 #endif 4476 4477 #if defined(INCLUDE_TCB) 4478 /* Set/Get threshold profile for UCQ. */ 4479 extern int bcm_cosq_tcb_gport_threshold_mapping_get( 4480 int unit, 4481 bcm_cosq_object_id_t *id, 4482 int *profile_index); 4483 #endif 4484 4485 #endif /* BCM_HIDE_DISPATCHABLE */ 4486 4487 #if defined(INCLUDE_TCB) 4488 #define BCM_COSQ_TCB_MAX_BUF_SIZE 80 /* TCB buffer record size */ 4489 #endif 4490 4491 #if defined(INCLUDE_TCB) 4492 /* TCB Pkt Record Structure. */ 4493 typedef struct bcm_cosq_tcb_buffer_s { 4494 uint64 timestamp; /* timestamp */ 4495 bcm_gport_t ingress_gport; /* ingress port gport. */ 4496 bcm_gport_t egress_gport; /* egress port gport. */ 4497 bcm_gport_t queue; /* Egress UC queue gport */ 4498 uint32 queue_size; /* Queue depth, unit is bytes */ 4499 uint32 service_pool_size; /* Service pool depth, unit is bytes */ 4500 uint8 buf_data[BCM_COSQ_TCB_MAX_BUF_SIZE]; /* The first 80 bytes of captured packet */ 4501 } bcm_cosq_tcb_buffer_t; 4502 #endif 4503 4504 #ifndef BCM_HIDE_DISPATCHABLE 4505 4506 #if defined(INCLUDE_TCB) 4507 /* Get packet records in TCB buffer. */ 4508 extern int bcm_cosq_tcb_buffer_multi_get( 4509 int unit, 4510 bcm_cosq_buffer_id_t buffer_id, 4511 int array_max, 4512 bcm_cosq_tcb_buffer_t *buffer_array, 4513 int *array_count); 4514 #endif 4515 4516 #endif /* BCM_HIDE_DISPATCHABLE */ 4517 4518 #if defined(INCLUDE_TCB) 4519 /* TCB Drop Event Record Structure. */ 4520 typedef struct bcm_cosq_tcb_event_s { 4521 uint64 timestamp; /* timestamp */ 4522 bcm_gport_t ingress_gport; /* ingress port gport. */ 4523 bcm_gport_t egress_gport; /* egress port gport. */ 4524 bcm_gport_t queue; /* Egress UC queue gport */ 4525 uint32 queue_size; /* Queue depth, unit is bytes */ 4526 uint32 service_pool_size; /* Service pool depth, unit is bytes */ 4527 uint32 drop_reason; /* Drop reason vector */ 4528 bcm_color_t color; /* Packet color */ 4529 } bcm_cosq_tcb_event_t; 4530 #endif 4531 4532 #ifndef BCM_HIDE_DISPATCHABLE 4533 4534 #if defined(INCLUDE_TCB) 4535 /* Get drop event records in TCB buffer. */ 4536 extern int bcm_cosq_tcb_event_multi_get( 4537 int unit, 4538 bcm_cosq_buffer_id_t buffer_id, 4539 int array_max, 4540 bcm_cosq_tcb_event_t *event_array, 4541 int *array_count, 4542 int *overflow_count); 4543 #endif 4544 4545 #endif /* BCM_HIDE_DISPATCHABLE */ 4546 4547 #if defined(INCLUDE_TCB) 4548 /* TCB control type */ 4549 typedef enum bcm_cosq_tcb_control_e { 4550 bcmCosqTcbControlEnable = 0, /* Enable or disable TCB instance */ 4551 bcmCosqTcbControlFreeze = 1, /* Freeze or restart TCB instance */ 4552 bcmCosqTcbControlMaxCount = 2 4553 } bcm_cosq_tcb_control_t; 4554 #endif 4555 4556 #ifndef BCM_HIDE_DISPATCHABLE 4557 4558 #if defined(INCLUDE_TCB) 4559 /* Set/get TCB working status. */ 4560 extern int bcm_cosq_tcb_control_set( 4561 int unit, 4562 bcm_cosq_buffer_id_t buffer_id, 4563 bcm_cosq_tcb_control_t type, 4564 int arg); 4565 #endif 4566 4567 #if defined(INCLUDE_TCB) 4568 /* Set/get TCB working status. */ 4569 extern int bcm_cosq_tcb_control_get( 4570 int unit, 4571 int buffer_id, 4572 bcm_cosq_tcb_control_t type, 4573 int *arg); 4574 #endif 4575 4576 #endif /* BCM_HIDE_DISPATCHABLE */ 4577 4578 /* Callback function type for tcb event handling. */ 4579 #if defined(INCLUDE_TCB) 4580 typedef void (*bcm_cosq_tcb_callback_t)( 4581 int unit, 4582 bcm_cosq_buffer_id_t buffer_id, 4583 void *user_data); 4584 #endif 4585 4586 #ifndef BCM_HIDE_DISPATCHABLE 4587 4588 #if defined(INCLUDE_TCB) 4589 /* 4590 * Register/unregister a callback function to be called when TCB buffer 4591 * enter freeze status. 4592 */ 4593 extern int bcm_cosq_tcb_cb_register( 4594 int unit, 4595 bcm_cosq_tcb_callback_t fn, 4596 void *user_data); 4597 #endif 4598 4599 #if defined(INCLUDE_TCB) 4600 /* 4601 * Register/unregister a callback function to be called when TCB buffer 4602 * enter freeze status. 4603 */ 4604 extern int bcm_cosq_tcb_cb_unregister( 4605 int unit, 4606 bcm_cosq_tcb_callback_t fn); 4607 #endif 4608 4609 #endif /* BCM_HIDE_DISPATCHABLE */ 4610 4611 #if defined(INCLUDE_TCB) 4612 /* TCB Threshold profile configure flags */ 4613 #define BCM_COSQ_TCB_THRESHOLD_PROFILE_WITH_ID 0x0001 /* TCB threshold profile 4614 configure with a 4615 profile index */ 4616 #define BCM_COSQ_TCB_THRESHOLD_PROFILE_REPLACE 0x0002 /* TCB threshold profile 4617 replace, must be used 4618 with 4619 COSQ_TCB_THRESHOLD_PROFILE_WITH_ID */ 4620 #endif 4621 4622 #if defined(INCLUDE_TCB) 4623 /* TCB Track Trigger Vector */ 4624 #define BCM_COSQ_TCB_INGRESS_ADMIN_DROP 0x0001 /* Ingress admission drop can 4625 cause a trigger */ 4626 #define BCM_COSQ_TCB_EGRESS_ADMIN_DROP 0x0002 /* Egress admission drop can 4627 cause a trigger */ 4628 #define BCM_COSQ_TCB_WRED_DROP 0x0004 /* Weighted random drop can 4629 cause a trigger */ 4630 #define BCM_COSQ_TCB_CFAP_DROP 0x0008 /* Cell free allocations pool 4631 drop can cause a trigger */ 4632 #endif 4633 4634 #define BCM_COSQ_INVALID_BUF_ID -1 /* Invalid Buffer ID */ 4635 4636 /* cosq_pkt_size_adjust_source */ 4637 typedef enum bcm_cosq_pkt_size_adjust_source_e { 4638 bcmCosqPktSizeAdjustSourceScheduler = 0, /* source is Scheduler */ 4639 bcmCosqPktSizeAdjustSourceCrpsInPP = 1, /* source is CRPS in PP */ 4640 bcmCosqPktSizeAdjustSourceCrpsInTM = 2, /* source is CRPS in TM */ 4641 bcmCosqPktSizeAdjustSourceStatReportIn = 3, /* source is Stat Report In */ 4642 bcmCosqPktSizeAdjustSourceStatReportOut = 4, /* source is Stat Report out */ 4643 bcmCosqPktSizeAdjustSourceGlobal = 5 /* For Scheduler and CRPS */ 4644 } bcm_cosq_pkt_size_adjust_source_t; 4645 4646 /* cosq ingress port drop priority maps */ 4647 typedef enum bcm_cosq_ingress_port_drop_map_e { 4648 bcmCosqIngressPortDropTmTcDpPriorityTable = 0, 4649 bcmCosqIngressPortDropIpDscpToPriorityTable = 1, 4650 bcmCosqIngressPortDropEthPcpDeiToPriorityTable = 2, 4651 bcmCosqIngressPortDropMplsExpToPriorityTable = 3 4652 } bcm_cosq_ingress_port_drop_map_t; 4653 4654 /* cosq ingress congestion resource statistics type */ 4655 typedef enum bcm_cosq_icgm_resource_stat_type_e { 4656 bcmCosqICgmMinFreeBDB = 0, /* Minimum free BDB watermark */ 4657 bcmCosqICgmMinFreeOcbBuffers = 1, /* Minimum free OCB buffers watermark */ 4658 bcmCosqICgmMinFreeMiniMcBuffers = 2, /* Minimum free Mini-Multicast buffers 4659 watermark */ 4660 bcmCosqICgmMinFreeFullMcBuffers = 3, /* Minimum free Full-Multicast buffers 4661 watermark */ 4662 bcmCosqICgmMinFreeVoqDramBDB = 4, /* Minimum free VOQ DRAM BDB watermark */ 4663 bcmCosqICgmMinFreeVoqOcbBDB = 5, /* Minimum free VOQ OCB BDB watermark */ 4664 bcmCosqICgmMinFreeSramBuffers = 6, /* Minimum free SRAM buffers watermark */ 4665 bcmCosqICgmMinFreeSramPDB = 7, /* Minimum free SRAM PDB watermark */ 4666 bcmCosqICgmCurrSharedBytes = 8, /* Current bytes size in shared space */ 4667 bcmCosqICgmCurrSharedOcbBuffers = 9, /* Current OCB-Buffers size in shared 4668 space */ 4669 bcmCosqICgmCurrSharedOcbPDs = 10, /* Current OCB-PDs size in shared space */ 4670 bcmCosqICgmCurrGrntdBytes = 11, /* Current bytes size in guaranteed 4671 space */ 4672 bcmCosqICgmCurrGrntdOcbBuffers = 12, /* Current OCB-Buffers size in 4673 guaranteed space */ 4674 bcmCosqICgmCurrGrntdOcbPDs = 13, /* Current OCB-PDs size in guaranteed 4675 space */ 4676 bcmCosqICgmCurrHdrmBytes = 14, /* Current bytes size in headroom space */ 4677 bcmCosqICgmCurrHdrmOcbBuffers = 15, /* Current OCB-Buffers size in headroom 4678 space */ 4679 bcmCosqICgmCurrHdrmOcbPDs = 16, /* Current OCB-PDs size in headroom 4680 space */ 4681 bcmCosqICgmMaxSharedBytes = 17 /* Maximal bytes size in shared space */ 4682 } bcm_cosq_icgm_resource_stat_type_t; 4683 4684 /* cosq_pkt_size_adjust_source_info structure */ 4685 typedef struct bcm_cosq_pkt_size_adjust_source_info_s { 4686 bcm_cosq_pkt_size_adjust_source_t source_type; /* compensation source */ 4687 uint32 source_id; /* command id: 0,1 */ 4688 } bcm_cosq_pkt_size_adjust_source_info_t; 4689 4690 /* cosq_pkt_size_adjust_info structure */ 4691 typedef struct bcm_cosq_pkt_size_adjust_info_s { 4692 uint32 flags; /* flags */ 4693 bcm_gport_t gport; /* gport value */ 4694 bcm_cos_queue_t cosq; /* bcm_cos_queue_t */ 4695 bcm_cosq_pkt_size_adjust_source_info_t source_info; /* adjust source */ 4696 } bcm_cosq_pkt_size_adjust_info_t; 4697 4698 /* cosq_icgm_resource_stat_key structure */ 4699 typedef struct bcm_cosq_icgm_resource_stat_key_s { 4700 bcm_gport_t gport; /* gport value */ 4701 uint32 flags; /* flags */ 4702 bcm_cosq_icgm_resource_stat_type_t stat_type; /* statistics type */ 4703 } bcm_cosq_icgm_resource_stat_key_t; 4704 4705 /* 4706 * This structure contain the latency data that was measured in the 4707 * ingress for a packet 4708 */ 4709 typedef struct bcm_cosq_max_latency_pkts_s { 4710 bcm_gport_t dest_gport; /* will return modport gport */ 4711 bcm_cos_queue_t cosq; /* cosq */ 4712 uint64 latency; /* latency measured */ 4713 uint32 latency_flow; /* latency flow */ 4714 uint32 is_mc; /* is MC */ 4715 } bcm_cosq_max_latency_pkts_t; 4716 4717 #ifndef BCM_HIDE_DISPATCHABLE 4718 4719 /* get cosq ingress congestion resource statistics */ 4720 extern int bcm_cosq_icgm_resource_stat_get( 4721 int unit, 4722 bcm_cosq_icgm_resource_stat_key_t *stat_key, 4723 uint64 *value); 4724 4725 /* 4726 * The purpose of this API is to configure a delta value for a source or 4727 * enable/disable a certain compensation type. 4728 */ 4729 extern int bcm_cosq_gport_pkt_size_adjust_set( 4730 int unit, 4731 bcm_cosq_pkt_size_adjust_info_t *adjust_info, 4732 int delta); 4733 4734 /* 4735 * The purpose of this API is to get the delta value configured for a 4736 * certain compensation type 4737 */ 4738 extern int bcm_cosq_gport_pkt_size_adjust_get( 4739 int unit, 4740 bcm_cosq_pkt_size_adjust_info_t *adjust_info, 4741 int *delta); 4742 4743 /* Scheduler final delta mapping API */ 4744 extern int bcm_cosq_pkt_size_adjust_delta_map_set( 4745 int unit, 4746 int delta, 4747 int final_delta); 4748 4749 /* get the final delta mapping */ 4750 extern int bcm_cosq_pkt_size_adjust_delta_map_get( 4751 int unit, 4752 int delta, 4753 int *final_delta); 4754 4755 #endif /* BCM_HIDE_DISPATCHABLE */ 4756 4757 /* cosq ingress port drop enable modes */ 4758 typedef enum bcm_cosq_ingress_port_drop_enable_mode_e { 4759 bcmCosqIngressPortDropDisable = 0, 4760 bcmCosqIngressPortDropEnableHardStage = 1, 4761 bcmCosqIngressPortDropEnableHardAndSoftStage = 2 4762 } bcm_cosq_ingress_port_drop_enable_mode_t; 4763 4764 #ifndef BCM_HIDE_DISPATCHABLE 4765 4766 /* set/get enable/disable cosq ingress port drop */ 4767 extern int bcm_cosq_ingress_port_drop_enable_set( 4768 int unit, 4769 bcm_port_t port, 4770 uint32 flags, 4771 int enable_mode); 4772 4773 /* set/get enable/disable cosq ingress port drop */ 4774 extern int bcm_cosq_ingress_port_drop_enable_get( 4775 int unit, 4776 bcm_port_t port, 4777 uint32 flags, 4778 int *enable_mode); 4779 4780 /* set/get cosq ingress port drop thresholds */ 4781 extern int bcm_cosq_ingress_port_drop_threshold_set( 4782 int unit, 4783 bcm_port_t port, 4784 uint32 flags, 4785 int priority, 4786 uint32 value); 4787 4788 /* set/get cosq ingress port drop thresholds */ 4789 extern int bcm_cosq_ingress_port_drop_threshold_get( 4790 int unit, 4791 bcm_port_t port, 4792 uint32 flags, 4793 int priority, 4794 uint32 *value); 4795 4796 #endif /* BCM_HIDE_DISPATCHABLE */ 4797 4798 /* 4799 * Definitions used to select priority in API 4800 * bcm_cosq_ingress_port_drop_map_set() 4801 */ 4802 #define BCM_COSQ_INGRESS_PORT_DROP_PRIORITY_0 0 /* user defined priority 4803 - 0 */ 4804 #define BCM_COSQ_INGRESS_PORT_DROP_PRIORITY_1 1 /* user defined priority 4805 - 1 */ 4806 #define BCM_COSQ_INGRESS_PORT_DROP_PRIORITY_2 2 /* user defined priority 4807 - 2 */ 4808 #define BCM_COSQ_INGRESS_PORT_DROP_PRIORITY_3 3 /* user defined priority 4809 - 3 */ 4810 #define BCM_COSQ_INGRESS_PORT_DROP_PRIORITY_TDM 15 /* user defined priority 4811 - TDM */ 4812 4813 #ifndef BCM_HIDE_DISPATCHABLE 4814 4815 /* set/get cosq ingress port drop map value */ 4816 extern int bcm_cosq_ingress_port_drop_map_set( 4817 int unit, 4818 bcm_port_t port, 4819 uint32 flags, 4820 bcm_cosq_ingress_port_drop_map_t map, 4821 uint32 key, 4822 int priority); 4823 4824 /* set/get cosq ingress port drop map value */ 4825 extern int bcm_cosq_ingress_port_drop_map_get( 4826 int unit, 4827 bcm_port_t port, 4828 uint32 flags, 4829 bcm_cosq_ingress_port_drop_map_t map, 4830 uint32 key, 4831 int *priority); 4832 4833 /* get cosq ingress congestion resource statistics */ 4834 extern int bcm_cosq_max_latency_pkts_get( 4835 int unit, 4836 bcm_gport_t gport, 4837 uint32 flags, 4838 int max_count, 4839 bcm_cosq_max_latency_pkts_t *max_latency_pkts, 4840 int *actual_count); 4841 4842 #endif /* BCM_HIDE_DISPATCHABLE */ 4843 4844 /* 4845 * User defined properties to be recgnized as control frames by the 4846 * ingress port drop. 4847 */ 4848 typedef struct bcm_cosq_ingress_drop_control_frame_config_s { 4849 uint64 mac_da_val; /* MAC DA to recognize as Control Plane 4850 packet */ 4851 uint64 mac_da_mask; /* MAC DA mask */ 4852 uint32 ether_type_code; /* Eth type to recognize as Control Plane 4853 packet */ 4854 uint32 ether_type_code_mask; /* Eth type code mask */ 4855 } bcm_cosq_ingress_drop_control_frame_config_t; 4856 4857 /* Initialize a CoSQ ingress drop control frame configuration structure. */ 4858 extern void bcm_cosq_ingress_drop_control_frame_config_t_init( 4859 bcm_cosq_ingress_drop_control_frame_config_t *config); 4860 4861 #ifndef BCM_HIDE_DISPATCHABLE 4862 4863 /* set cosq ingress port drop control frame properties. */ 4864 extern int bcm_cosq_ingress_port_drop_control_frame_set( 4865 int unit, 4866 bcm_port_t port, 4867 uint32 flags, 4868 uint32 control_frame_index, 4869 bcm_cosq_ingress_drop_control_frame_config_t *control_frame_config); 4870 4871 /* get cosq ingress port drop control frame properties. */ 4872 extern int bcm_cosq_ingress_port_drop_control_frame_get( 4873 int unit, 4874 bcm_port_t port, 4875 uint32 flags, 4876 uint32 control_frame_index, 4877 bcm_cosq_ingress_drop_control_frame_config_t *control_frame_config); 4878 4879 /* 4880 * configure cosq ingress port drop configurable Ether type to Ether type 4881 * code. 4882 */ 4883 extern int bcm_cosq_ingress_port_drop_custom_ether_type_set( 4884 int unit, 4885 bcm_port_t port, 4886 uint32 flags, 4887 uint32 ether_type_code, 4888 uint32 ether_type_val); 4889 4890 /* 4891 * configure cosq ingress port drop configurable Ether type to Ether type 4892 * code. 4893 */ 4894 extern int bcm_cosq_ingress_port_drop_custom_ether_type_get( 4895 int unit, 4896 bcm_port_t port, 4897 uint32 flags, 4898 uint32 ether_type_code, 4899 uint32 *ether_type_val); 4900 4901 /* configure cosq ingress port drop default priority. */ 4902 extern int bcm_cosq_ingress_port_drop_default_priority_set( 4903 int unit, 4904 bcm_port_t port, 4905 uint32 flags, 4906 uint32 default_priority); 4907 4908 /* configure cosq ingress port drop default priority. */ 4909 extern int bcm_cosq_ingress_port_drop_default_priority_get( 4910 int unit, 4911 bcm_port_t port, 4912 uint32 flags, 4913 uint32 *default_priority); 4914 4915 #endif /* BCM_HIDE_DISPATCHABLE */ 4916 4917 /* Cosq ingress port drop max number of fields used to build a flex key. */ 4918 #define BCM_COSQ_INGRESS_PORT_DROP_MAX_FLEX_KEY_FIELDS 4 4919 4920 /* 4921 * Cosq ingress port drop unique information used when building a flex 4922 * key. 4923 */ 4924 typedef struct bcm_cosq_ingress_drop_flex_key_construct_id_s { 4925 bcm_port_t port; /* port */ 4926 uint32 ether_type_code; /* Ether type code. Key is constructed per ether 4927 type. */ 4928 } bcm_cosq_ingress_drop_flex_key_construct_id_t; 4929 4930 /* Initialize a CoSQ ingress drop flex key construct id structure. */ 4931 extern void bcm_cosq_ingress_drop_flex_key_construct_id_t_init( 4932 bcm_cosq_ingress_drop_flex_key_construct_id_t *config); 4933 4934 typedef enum bcm_cosq_ingress_port_drop_flex_key_base_e { 4935 bcmCosqIngressPortDropFlexKeyBasePacketStart = 0, 4936 bcmCosqIngressPortDropFlexKeyBaseEndOfEthHeader = 1, 4937 bcmCosqIngressPortDropFlexKeyBaseEndOfHeaderAfterEthHeader = 2 4938 } bcm_cosq_ingress_port_drop_flex_key_base_t; 4939 4940 /* Cosq ingress port drop flex key construction information. */ 4941 typedef struct bcm_cosq_ingress_drop_flex_key_construct_s { 4942 uint32 array_size; /* number of elements in the offset 4943 array */ 4944 uint32 offset_array[BCM_COSQ_INGRESS_PORT_DROP_MAX_FLEX_KEY_FIELDS]; /* array of offsets from which the flex 4945 key will be created */ 4946 bcm_cosq_ingress_port_drop_flex_key_base_t offset_base; /* The offset array to compose the key 4947 can start from several base points: 4948 start of packet, end of eth header, 4949 end of header after eth header. */ 4950 uint32 ether_type_header_size; /* When the key is composed for a 4951 configurable ether type (ether type 4952 code 1-6), and the offset base is end 4953 of header after eth header, the size 4954 of the header after the eth must be 4955 provided (in bytes). In all other 4956 cases this value is expected to be 4957 -1. */ 4958 } bcm_cosq_ingress_drop_flex_key_construct_t; 4959 4960 /* Initialize a CoSQ ingress drop flex key construct structure. */ 4961 extern void bcm_cosq_ingress_drop_flex_key_construct_t_init( 4962 bcm_cosq_ingress_drop_flex_key_construct_t *config); 4963 4964 #ifndef BCM_HIDE_DISPATCHABLE 4965 4966 /* set/get cosq ingress port drop flex key construct properties. */ 4967 extern int bcm_cosq_ingress_port_drop_flex_key_construct_set( 4968 int unit, 4969 bcm_cosq_ingress_drop_flex_key_construct_id_t *key_id, 4970 uint32 flags, 4971 bcm_cosq_ingress_drop_flex_key_construct_t *flex_key_config); 4972 4973 /* set/get cosq ingress port drop flex key construct properties. */ 4974 extern int bcm_cosq_ingress_port_drop_flex_key_construct_get( 4975 int unit, 4976 bcm_cosq_ingress_drop_flex_key_construct_id_t *key_id, 4977 uint32 flags, 4978 bcm_cosq_ingress_drop_flex_key_construct_t *flex_key_config); 4979 4980 #endif /* BCM_HIDE_DISPATCHABLE */ 4981 4982 /* Cosq ingress port drop flex key information. */ 4983 typedef struct bcm_cosq_ingress_drop_flex_key_s { 4984 uint32 value; /* flex key value */ 4985 uint32 mask; /* flex key mask */ 4986 } bcm_cosq_ingress_drop_flex_key_t; 4987 4988 /* Initialize a CoSQ ingress drop flex key structure. */ 4989 extern void bcm_cosq_ingress_drop_flex_key_t_init( 4990 bcm_cosq_ingress_drop_flex_key_t *config); 4991 4992 /* Cosq ingress port drop flex key entry information. */ 4993 typedef struct bcm_cosq_ingress_drop_flex_key_entry_s { 4994 bcm_cosq_ingress_drop_flex_key_t ether_code; /* ether code information for the flex 4995 key entry */ 4996 uint32 num_key_fields; /* number of elements in the key_fields 4997 array */ 4998 bcm_cosq_ingress_drop_flex_key_t key_fields[BCM_COSQ_INGRESS_PORT_DROP_MAX_FLEX_KEY_FIELDS]; /* key fields array to build the flex 4999 key entry */ 5000 uint32 priority; /* priority to associate with the flex 5001 key entry */ 5002 } bcm_cosq_ingress_drop_flex_key_entry_t; 5003 5004 /* Initialize a CoSQ ingress drop flex key entry structure. */ 5005 extern void bcm_cosq_ingress_drop_flex_key_entry_t_init( 5006 bcm_cosq_ingress_drop_flex_key_entry_t *config); 5007 5008 #ifndef BCM_HIDE_DISPATCHABLE 5009 5010 /* set/get cosq ingress port drop flex key entry. */ 5011 extern int bcm_cosq_ingress_port_drop_flex_key_entry_set( 5012 int unit, 5013 bcm_port_t port, 5014 uint32 flags, 5015 uint32 key_index, 5016 bcm_cosq_ingress_drop_flex_key_entry_t *flex_key_info); 5017 5018 /* set/get cosq ingress port drop flex key entry. */ 5019 extern int bcm_cosq_ingress_port_drop_flex_key_entry_get( 5020 int unit, 5021 bcm_port_t port, 5022 uint32 flags, 5023 uint32 key_index, 5024 bcm_cosq_ingress_drop_flex_key_entry_t *flex_key_info); 5025 5026 #endif /* BCM_HIDE_DISPATCHABLE */ 5027 5028 /* Type of FADT threshold. */ 5029 typedef enum bcm_cosq_gport_fadt_threshold_type_e { 5030 bcmCosqFadtDramBound = 0, /* DRAM bound settings. */ 5031 bcmCosqFadtDramBoundRecoveryFailure = 1, /* DRAM recovery failure settings. */ 5032 bcmCosqFadtCongestionNotification = 2 /* Congestion notification settings */ 5033 } bcm_cosq_gport_fadt_threshold_type_t; 5034 5035 /* Complementary information for FADT threshold. */ 5036 typedef struct bcm_cosq_fadt_info_s { 5037 bcm_gport_t gport; /* target gport */ 5038 bcm_cos_queue_t cosq; /* target cosq */ 5039 bcm_cosq_gport_fadt_threshold_type_t thresh_type; /* threshold type */ 5040 bcm_cosq_resource_t resource_type; /* resource type */ 5041 } bcm_cosq_fadt_info_t; 5042 5043 #ifndef BCM_HIDE_DISPATCHABLE 5044 5045 /* set/get FADT threshold parameters. */ 5046 extern int bcm_cosq_gport_fadt_threshold_set( 5047 int unit, 5048 uint32 flags, 5049 bcm_cosq_fadt_info_t *fadt_info, 5050 bcm_cosq_fadt_threshold_t *threshold); 5051 5052 /* set/get FADT threshold parameters. */ 5053 extern int bcm_cosq_gport_fadt_threshold_get( 5054 int unit, 5055 uint32 flags, 5056 bcm_cosq_fadt_info_t *fadt_info, 5057 bcm_cosq_fadt_threshold_t *threshold); 5058 5059 #endif /* BCM_HIDE_DISPATCHABLE */ 5060 5061 /* Init function to the structure "bcm_cosq_fadt_info_t". */ 5062 extern void bcm_cosq_fadt_info_t_init( 5063 bcm_cosq_fadt_info_t *info); 5064 5065 /* Flags for bcm_cosq_pfc_config_set */ 5066 #define BCM_COSQ_PFC_BYTES 0x00000001 /* Threshold in bytes */ 5067 #define BCM_COSQ_PFC_OCB 0x00000002 /* Threshold for OCB (SRAM) 5068 resources */ 5069 #define BCM_COSQ_PFC_PACKET_DESC 0x00000004 /* Threshold in packet 5070 descriptors */ 5071 #define BCM_COSQ_PFC_BUFFERS 0x00000008 /* Threshold in buffers */ 5072 #define BCM_COSQ_PFC_USE_FADT_PARAMS 0x00000010 /* Use FADT parameters */ 5073 #define BCM_COSQ_PFC_POOL_0 0x00000020 /* Apply on pool 0 */ 5074 #define BCM_COSQ_PFC_POOL_1 0x00000040 /* Apply on pool 1 */ 5075 5076 /* TAS control type */ 5077 typedef enum bcm_cosq_tas_control_e { 5078 bcmCosqTASControlTASEnable = 0, /* Enable the TAS. */ 5079 bcmCosqTASControlUsePTPTime = 1, /* PTP time is used for TAS synchronous 5080 operation. */ 5081 bcmCosqTASControlInitGateState = 2, /* Gate state when TAS is disabled. Or 5082 the init gate state in the *Restart* 5083 process. */ 5084 bcmCosqTASControlErrGateState = 3, /* Gate state when error condition 5085 occurs during an old cycle is 5086 running. */ 5087 bcmCosqTASControlGatePurgeEnable = 4, /* Purge express packet when gate is 5088 closed. */ 5089 bcmCosqTASControlGateControlTickInterval = 5, /* Gate control ticks interval in ns. */ 5090 bcmCosqTASControlTASPTPLock = 6, /* Indicate the PTP time is locked or 5091 out of sync. This type is on system 5092 basis. */ 5093 bcmCosqTASCountrolCount = 7 /* This should be the last one. */ 5094 } bcm_cosq_tas_control_t; 5095 5096 #ifndef BCM_HIDE_DISPATCHABLE 5097 5098 /* Set/get TAS control configurations. */ 5099 extern int bcm_cosq_tas_control_set( 5100 int unit, 5101 bcm_gport_t port, 5102 bcm_cosq_tas_control_t type, 5103 int arg); 5104 5105 /* Set/get TAS control configurations. */ 5106 extern int bcm_cosq_tas_control_get( 5107 int unit, 5108 bcm_gport_t port, 5109 bcm_cosq_tas_control_t type, 5110 int *arg); 5111 5112 #endif /* BCM_HIDE_DISPATCHABLE */ 5113 5114 /* TAS status type */ 5115 typedef enum bcm_cosq_tas_status_e { 5116 bcmCosqTASStatusGateQueueState = 0, /* The current gate state of each 5117 traffic class queue. The value 5118 represents all queues' gate state 5119 bitmap, each bit indicates to each 5120 queue. */ 5121 bcmCosqTASStatusGateStateSet = 1, /* Reflect which control gate source is 5122 selected. The value = 0 indicates the 5123 gate state is from INIT GATE STATE 5124 settings, value = 1 indicates the 5125 gate state is from active control 5126 list table, value = 2 indicates the 5127 gate state is from ERR GATE STATE 5128 settings */ 5129 bcmCosqTASStatusTickGranularity = 2, /* The granularity of the calendar 5130 table time clock in ns. */ 5131 bcmCosqTASStatusMaxCalendarEntries = 3, /* The max entries could be support in 5132 calendar table. */ 5133 bcmCosqTASStatusCount = 4 /* This should be the last one. */ 5134 } bcm_cosq_tas_status_t; 5135 5136 #ifndef BCM_HIDE_DISPATCHABLE 5137 5138 /* Get the TAS status */ 5139 extern int bcm_cosq_tas_status_get( 5140 int unit, 5141 bcm_gport_t port, 5142 bcm_cosq_tas_status_t type, 5143 int *arg); 5144 5145 #endif /* BCM_HIDE_DISPATCHABLE */ 5146 5147 /* Cosq event type */ 5148 typedef enum bcm_cosq_event_type_e { 5149 bcmCosqEventTASProfileChange = 0, /* TAS: the profile change is completed. */ 5150 bcmCosqEventTASECCErr = 1, /* TAS: uncorrectable ECC error in 5151 profile calendar table. */ 5152 bcmCosqEventTASNextCycleTimeErr = 2, /* TAS: next cycle start time has 5153 passed. */ 5154 bcmCosqEventTASBaseTimeErr = 3, /* TAS: base time for the new profile 5155 has passed. */ 5156 bcmCosqEventTASProfilePtrErr = 4, /* TAS: index to the profile calendar 5157 table is overrun. */ 5158 bcmCosqEventTASPTPOutOfSyncErr = 5, /* TAS: IEEE1588 PTP time is out of 5159 sync. */ 5160 bcmCosqEventCount = 6 /* This should be the last one. */ 5161 } bcm_cosq_event_type_t; 5162 5163 typedef struct bcm_cosq_event_types_s { 5164 SHR_BITDCL w[_SHR_BITDCLSIZE(bcmCosqEventCount)]; 5165 } bcm_cosq_event_types_t; 5166 5167 /* Callback function type for COSQ event handling */ 5168 typedef int (*bcm_cosq_event_cb)( 5169 int unit, 5170 bcm_cosq_event_type_t event_type, 5171 bcm_gport_t port, 5172 bcm_cos_queue_t cosq, 5173 void *user_data); 5174 5175 #define BCM_COSQ_EVENT_TYPE_SET(_event_types, _event_type) SHR_BITSET(((_event_types).w), (_event_type)) 5176 5177 #define BCM_COSQ_EVENT_TYPE_GET(_event_types, _event_type) SHR_BITGET(((_event_types).w), (_event_type)) 5178 5179 #define BCM_COSQ_EVENT_TYPE_CLEAR(_event_types, _event_type) SHR_BITCLR(((_event_types).w), (_event_type)) 5180 5181 #define BCM_COSQ_EVENT_TYPE_SET_ALL(_event_types) SHR_BITSET_RANGE(((_event_types).w), 0, bcmCosqEventCount) 5182 5183 #define BCM_COSQ_EVENT_TYPE_CLEAR_ALL(_event_types) SHR_BITCLR_RANGE(((_event_types).w), 0, bcmCosqEventCount) 5184 5185 #ifndef BCM_HIDE_DISPATCHABLE 5186 5187 /* Register/unregister a callback to handle the Cosq events */ 5188 extern int bcm_cosq_event_register( 5189 int unit, 5190 bcm_cosq_event_types_t event_types, 5191 bcm_gport_t port, 5192 bcm_cos_queue_t cosq, 5193 bcm_cosq_event_cb cb, 5194 void *user_data); 5195 5196 /* Register/unregister a callback to handle the Cosq events */ 5197 extern int bcm_cosq_event_unregister( 5198 int unit, 5199 bcm_cosq_event_types_t event_types, 5200 bcm_gport_t port, 5201 bcm_cos_queue_t cosq, 5202 bcm_cosq_event_cb cb); 5203 5204 #endif /* BCM_HIDE_DISPATCHABLE */ 5205 5206 /* TAS profile id type */ 5207 typedef int bcm_cosq_tas_profile_id_t; 5208 5209 /* The value used to assigned in flags field on bcm_cosq_tas_entry_t */ 5210 #define BCM_COSQ_TAS_ENTRY_F_PREEMPT 0x00000001 /* Request to hold the 5211 preempt traffic */ 5212 5213 /* 5214 * The encoded value used to assigned in ticks field on 5215 * bcm_cosq_tas_entry_t 5216 */ 5217 #define BCM_COSQ_TAS_ENTRY_TICKS_STAY (-1) /* Specify to stay in 5218 this entry forever in 5219 non PTP_MODE or until 5220 the next cycle in 5221 PTP_MODE. */ 5222 #define BCM_COSQ_TAS_ENTRY_TICKS_GO_FIRST (0) /* Specify to jump to the 5223 first entry. The state 5224 of this entry will be 5225 ignored. */ 5226 5227 /* The TAS entry data structure */ 5228 typedef struct bcm_cosq_tas_entry_s { 5229 uint32 ticks; /* The scheduling interval in ticks. The tick interval is 5230 defined in bcmCosqTASControlGateControlTickInterval. */ 5231 uint32 state; /* Specify gate state for each traffic class queue in 5232 bitmap. (1 bit per queue) */ 5233 uint32 flags; /* Defined in BCM_COSQ_TAS_ENTRY_F_XXX */ 5234 } bcm_cosq_tas_entry_t; 5235 5236 /* The maximum TAS calendar table size. */ 5237 #define BCM_COSQ_MAX_TAS_CALENDAR_TABLE_SIZE (128) 5238 5239 /* The TAS profile data structure */ 5240 typedef struct bcm_cosq_tas_profile_s { 5241 int num_entries; /* Specify the number of entries in the 5242 calendar table. */ 5243 bcm_cosq_tas_entry_t entries[BCM_COSQ_MAX_TAS_CALENDAR_TABLE_SIZE]; /* Specify the interval, gate states, 5244 attribute entry sets in the calendar 5245 table. */ 5246 bcm_ptp_timestamp_t ptp_base_time; /* Specify base time in PTP time. */ 5247 uint32 ptp_cycle_time; /* Specify cycle time in ns. */ 5248 uint32 ptp_max_cycle_extension; /* Specify max cycle extension time in 5249 ns. Maximum time allowed for a cycle 5250 to be extended before profile change. */ 5251 } bcm_cosq_tas_profile_t; 5252 5253 /* Initialize the bcm_cosq_tas_profile_t structure */ 5254 extern void bcm_cosq_tas_profile_t_init( 5255 bcm_cosq_tas_profile_t *profile); 5256 5257 #ifndef BCM_HIDE_DISPATCHABLE 5258 5259 /* Create the TAS profile */ 5260 extern int bcm_cosq_tas_profile_create( 5261 int unit, 5262 bcm_gport_t port, 5263 bcm_cosq_tas_profile_t *profile, 5264 bcm_cosq_tas_profile_id_t *pid); 5265 5266 /* Destroy the TAS profile */ 5267 extern int bcm_cosq_tas_profile_destroy( 5268 int unit, 5269 bcm_gport_t port, 5270 bcm_cosq_tas_profile_id_t pid); 5271 5272 /* Destroy TAS profile. */ 5273 extern int bcm_cosq_tas_profile_destroy_all( 5274 int unit, 5275 bcm_gport_t port); 5276 5277 /* Get/set TAS profile information */ 5278 extern int bcm_cosq_tas_profile_set( 5279 int unit, 5280 bcm_gport_t port, 5281 bcm_cosq_tas_profile_id_t pid, 5282 bcm_cosq_tas_profile_t *profile); 5283 5284 /* Get/set TAS profile information */ 5285 extern int bcm_cosq_tas_profile_get( 5286 int unit, 5287 bcm_gport_t port, 5288 bcm_cosq_tas_profile_id_t pid, 5289 bcm_cosq_tas_profile_t *profile); 5290 5291 /* Commit the TAS profile */ 5292 extern int bcm_cosq_tas_profile_commit( 5293 int unit, 5294 bcm_gport_t port, 5295 bcm_cosq_tas_profile_id_t pid); 5296 5297 #endif /* BCM_HIDE_DISPATCHABLE */ 5298 5299 /* TAS profile traverse callback */ 5300 typedef int (*bcm_cosq_tas_profile_traverse_cb)( 5301 int unit, 5302 bcm_gport_t port, 5303 bcm_cosq_tas_profile_id_t pid, 5304 void *user_data); 5305 5306 #ifndef BCM_HIDE_DISPATCHABLE 5307 5308 /* Traverse the TAS profile */ 5309 extern int bcm_cosq_tas_profile_traverse( 5310 int unit, 5311 bcm_gport_t port, 5312 bcm_cosq_tas_profile_traverse_cb cb, 5313 void *user_data); 5314 5315 #endif /* BCM_HIDE_DISPATCHABLE */ 5316 5317 /* TAS profile state */ 5318 typedef enum bcm_cosq_tas_profile_state_e { 5319 bcmCosqTASProfileInit = 0, /* the state after profile created. */ 5320 bcmCosqTASProfileCommitted = 1, /* the state after profile committed but not 5321 yet written to HW table */ 5322 bcmCosqTASProfilePending = 2, /* the state after profile is set to 5323 hardware but not yet effective */ 5324 bcmCosqTASProfileActive = 3, /* the state indicate the profile is 5325 effective */ 5326 bcmCosqTASProfileExpired = 4, /* The profile is no longer effective. */ 5327 bcmCosqTASProfileError = 5, /* the state indicate the profile is error 5328 when any error event happens */ 5329 bcmCosTASProfileCount = 6 /* This should be the last one. */ 5330 } bcm_cosq_tas_profile_state_t; 5331 5332 /* The TAS profile status structure */ 5333 typedef struct bcm_cosq_tas_profile_status_s { 5334 bcm_cosq_tas_profile_state_t profile_state; /* profile state */ 5335 bcm_ptp_timestamp_t config_change_time; /* The actual config change time */ 5336 int num_entries; /* The actual number of entries in 5337 hardware calendar table. */ 5338 bcm_cosq_tas_entry_t entries[BCM_COSQ_MAX_TAS_CALENDAR_TABLE_SIZE]; /* The actual entries in hardware 5339 calendar table. */ 5340 } bcm_cosq_tas_profile_status_t; 5341 5342 /* Initialize the bcm_cosq_tas_profile_status_t structure */ 5343 extern void bcm_cosq_tas_profile_status_t_init( 5344 bcm_cosq_tas_profile_status_t *profile_status); 5345 5346 #ifndef BCM_HIDE_DISPATCHABLE 5347 5348 /* Get the TAS profile status */ 5349 extern int bcm_cosq_tas_profile_status_get( 5350 int unit, 5351 bcm_gport_t port, 5352 bcm_cosq_tas_profile_id_t pid, 5353 bcm_cosq_tas_profile_status_t *status); 5354 5355 #endif /* BCM_HIDE_DISPATCHABLE */ 5356 5357 /* flags for sysport to ingress queue mapping set/get */ 5358 #define BCM_COSQ_SYSPORT_INGRESS_QUEUE_UNMAP 0x00000001 /* unmap flag */ 5359 #define BCM_COSQ_SYSPORT_INGRESS_QUEUE_CORE_FROM_GPORT 0x00000002 /* take local core from 5360 ingress queue gport. 5361 supported only for get 5362 function */ 5363 5364 #ifndef BCM_HIDE_DISPATCHABLE 5365 5366 /* 5367 * bcm_cosq_sysport_ingress_queue_map_get and 5368 * bcm_cosq_sysport_ingress_queue_map_set 5369 */ 5370 extern int bcm_cosq_sysport_ingress_queue_map_set( 5371 int unit, 5372 uint32 flags, 5373 bcm_gport_t sysport, 5374 bcm_gport_t ingress_queue); 5375 5376 /* 5377 * bcm_cosq_sysport_ingress_queue_map_get and 5378 * bcm_cosq_sysport_ingress_queue_map_set 5379 */ 5380 extern int bcm_cosq_sysport_ingress_queue_map_get( 5381 int unit, 5382 uint32 flags, 5383 bcm_gport_t sysport, 5384 bcm_gport_t *ingress_queue); 5385 5386 #endif /* BCM_HIDE_DISPATCHABLE */ 5387 5388 /* strucutre holds the key parameters for the object mapping API. */ 5389 typedef struct bcm_cosq_obj_map_key_s { 5390 bcm_gport_t gport; 5391 } bcm_cosq_obj_map_key_t; 5392 5393 #ifndef BCM_HIDE_DISPATCHABLE 5394 5395 /* API for mapping gport (queue) into object_stat_id. */ 5396 extern int bcm_cosq_stat_obj_map_set( 5397 int unit, 5398 int flags, 5399 bcm_cosq_obj_map_key_t *key, 5400 uint32 object_stat_id); 5401 5402 /* Get the object_stat_id mapping for a given gport queue */ 5403 extern int bcm_cosq_stat_obj_map_get( 5404 int unit, 5405 int flags, 5406 bcm_cosq_obj_map_key_t *key, 5407 uint32 *object_stat_id); 5408 5409 #endif /* BCM_HIDE_DISPATCHABLE */ 5410 5411 /* 5412 * Strucutre hold the key parameters for cosq statistics configuration 5413 * API. 5414 */ 5415 typedef struct bcm_cosq_stat_info_key_s { 5416 int command_id; 5417 } bcm_cosq_stat_info_key_t; 5418 5419 /* 5420 * Strucutre gather the cosq parameters in order to generate the counter 5421 * pointer toward the counter processor. 5422 */ 5423 typedef struct bcm_cosq_stat_info_s { 5424 int enable_mapping; /* Enable/disable using the object stat id 5425 mapping table when generate the counter 5426 pointer */ 5427 int num_queues_per_entry; /* Defines how many consecutive VOQs are counted 5428 in one counter set. */ 5429 uint32 queue_first; /* Start range of VOQs which will be counted. */ 5430 uint32 queue_last; /* End range of VOQs which will be counted. */ 5431 } bcm_cosq_stat_info_t; 5432 5433 #ifndef BCM_HIDE_DISPATCHABLE 5434 5435 /* 5436 * API configure cosq statistics parameters per command_id, in order to 5437 * generate the counter pointer toward the counter processor. 5438 */ 5439 extern int bcm_cosq_stat_info_set( 5440 int unit, 5441 int flags, 5442 bcm_cosq_stat_info_key_t *key, 5443 bcm_cosq_stat_info_t *config); 5444 5445 /* Get cosq statistics parameters for given command_id */ 5446 extern int bcm_cosq_stat_info_get( 5447 int unit, 5448 int flags, 5449 bcm_cosq_stat_info_key_t *key, 5450 bcm_cosq_stat_info_t *config); 5451 5452 #endif /* BCM_HIDE_DISPATCHABLE */ 5453 5454 typedef struct bcm_cosq_static_threshold_s { 5455 int thresh_set; /* On threshold. */ 5456 int thresh_clear; /* Off threshold -- if not hyst, clear = set. */ 5457 } bcm_cosq_static_threshold_t; 5458 5459 typedef enum bcm_cosq_ingress_forward_priority_e { 5460 bcmCosqIngrFwdPriorityNone = -1, 5461 bcmCosqIngrFwdPriorityLow = 0, 5462 bcmCosqIngrFwdPriorityHigh = 1 5463 } bcm_cosq_ingress_forward_priority_t; 5464 5465 typedef enum bcm_cosq_forward_decision_type_e { 5466 bcmCosqFwdTypeFwd = 0, 5467 bcmCosqFwdTypeSnoop = 1, 5468 bcmCosqFwdTypeMirror = 2, 5469 bcmCosqFwdTypeStatSample = 3 5470 } bcm_cosq_forward_decision_type_t; 5471 5472 typedef uint32 bcm_cosq_threshold_index_t; 5473 5474 /* Threshold Action type */ 5475 typedef enum bcm_cosq_threshold_action_type_e { 5476 bcmCosqThreshActionDrop = 0, /* Drop threshold */ 5477 bcmCosqThreshActionFc = 1, /* FC threshold */ 5478 bcmCosqThreshActionMarkCongestion = 2 /* ECN threshold */ 5479 } bcm_cosq_threshold_action_type_t; 5480 5481 /* Complementary information for static threshold. */ 5482 typedef struct bcm_cosq_static_threshold_info_s { 5483 bcm_gport_t gport; /* Target gport. */ 5484 bcm_cosq_threshold_index_t index; 5485 bcm_cosq_threshold_action_type_t threshold_action; 5486 bcm_cosq_resource_t resource_type; /* Resource type. */ 5487 int is_free_resource; /* If true - test free resources, 5488 otherwise - test occupied resources. */ 5489 } bcm_cosq_static_threshold_info_t; 5490 5491 #ifndef BCM_HIDE_DISPATCHABLE 5492 5493 /* Set static threshold parameters. */ 5494 extern int bcm_cosq_gport_static_threshold_set( 5495 int unit, 5496 uint32 flags, 5497 bcm_cosq_static_threshold_info_t *thresh_info, 5498 bcm_cosq_static_threshold_t *threshold); 5499 5500 /* get static threshold parameters. */ 5501 extern int bcm_cosq_gport_static_threshold_get( 5502 int unit, 5503 uint32 flags, 5504 bcm_cosq_static_threshold_info_t *thresh_info, 5505 bcm_cosq_static_threshold_t *threshold); 5506 5507 #endif /* BCM_HIDE_DISPATCHABLE */ 5508 5509 /* Index creation macros. */ 5510 #define BCM_COSQ_TH_INDEX_DP_SET(dp) _SHR_COSQ_TH_INDEX_DP_SET(dp) 5511 #define BCM_COSQ_TH_INDEX_TC_SET(tc) _SHR_COSQ_TH_INDEX_TC_SET(tc) 5512 #define BCM_COSQ_TH_INDEX_POOL_DP_SET(pool_id, dp) _SHR_COSQ_TH_INDEX_POOL_DP_SET(pool_id, dp) 5513 #define BCM_COSQ_TH_INDEX_CAST_PRIO_FWDACT_SET(cast, priority, forward_action) _SHR_COSQ_TH_INDEX_CAST_PRIO_FWDACT_SET(cast, priority, forward_action) 5514 #define BCM_COSQ_TH_INDEX_PRIO_SET(prio) _SHR_COSQ_TH_INDEX_PRIO_SET(prio) 5515 #define BCM_COSQ_TH_INDEX_POOL_PRIO_SET(prio, pool_id) _SHR_COSQ_TH_INDEX_POOL_PRIO_SET(prio, pool_id) 5516 #define BCM_COSQ_TH_INDEX_INVALID -1 /* Invalid index for the 5517 thresh_info in 5518 bcm_cosq_gport_static_threshold_set */ 5519 5520 #ifndef BCM_HIDE_DISPATCHABLE 5521 5522 /* Get / set mapping of PFC priority to Priority Group for a profile. */ 5523 extern int bcm_cosq_priority_group_pfc_priority_mapping_profile_set( 5524 int unit, 5525 int profile_id, 5526 int array_count, 5527 int *pg_array); 5528 5529 #endif /* BCM_HIDE_DISPATCHABLE */ 5530 5531 /* Per PFC-rx priority config. */ 5532 typedef struct bcm_cosq_pfc_class_map_config_s { 5533 uint8 pfc_enable; /* Enable/disable PFC rx, 1: enable, 0: disable */ 5534 uint8 pfc_optimized; /* PFC optimized flag, 1: optimized, 0: otherwise */ 5535 uint32 cos_list_bmp; /* COS list bitmap */ 5536 } bcm_cosq_pfc_class_map_config_t; 5537 5538 typedef struct bcm_cosq_ingress_port_drop_mpls_special_label_config_s { 5539 uint32 label_value; /* Special label value (0-15) */ 5540 uint32 priority; /* Priority to take when the special label is 5541 recognized. */ 5542 uint32 is_tdm; /* TDM indication to set when the special label is 5543 recognized. */ 5544 } bcm_cosq_ingress_port_drop_mpls_special_label_config_t; 5545 5546 #ifndef BCM_HIDE_DISPATCHABLE 5547 5548 /* Get / set mapping of PFC priority to Priority Group for a profile. */ 5549 extern int bcm_cosq_priority_group_pfc_priority_mapping_profile_get( 5550 int unit, 5551 int profile_id, 5552 int array_max, 5553 int *pg_array, 5554 int *array_count); 5555 5556 /* 5557 * Get / set PFC class configurations (e.g. PFC priority to COSQ mapping) 5558 * for a profile. 5559 */ 5560 extern int bcm_cosq_pfc_class_config_profile_set( 5561 int unit, 5562 int profile_id, 5563 int count, 5564 bcm_cosq_pfc_class_map_config_t *config_array); 5565 5566 /* 5567 * This API allows the user to save MPLS special label properties. If an 5568 * MPLS label on a packet is recognized as one of these special labels, 5569 * priority and TDM indication will be taken from the special label 5570 * properties. 5571 */ 5572 extern int bcm_cosq_ingress_port_drop_mpls_special_label_set( 5573 int unit, 5574 bcm_port_t port, 5575 uint32 flags, 5576 uint32 label_index, 5577 bcm_cosq_ingress_port_drop_mpls_special_label_config_t *label_config); 5578 5579 /* 5580 * Get / set PFC class configurations (e.g. PFC priority to COSQ mapping) 5581 * for a profile. 5582 */ 5583 extern int bcm_cosq_pfc_class_config_profile_get( 5584 int unit, 5585 int profile_id, 5586 int max_count, 5587 bcm_cosq_pfc_class_map_config_t *config_array, 5588 int *count); 5589 5590 /* 5591 * This API allows the user to save MPLS special label properties. If an 5592 * MPLS label on a packet is recognized as one of these special labels, 5593 * priority and TDM indication will be taken from the special label 5594 * properties. 5595 */ 5596 extern int bcm_cosq_ingress_port_drop_mpls_special_label_get( 5597 int unit, 5598 bcm_port_t port, 5599 uint32 flags, 5600 uint32 label_index, 5601 bcm_cosq_ingress_port_drop_mpls_special_label_config_t *label_config); 5602 5603 #endif /* BCM_HIDE_DISPATCHABLE */ 5604 5605 /* Initialize a PFC class mapping configuration structure. */ 5606 extern void bcm_cosq_pfc_class_map_config_t_init( 5607 bcm_cosq_pfc_class_map_config_t *config); 5608 5609 extern void bcm_cosq_ingress_port_drop_mpls_special_label_config_t_init( 5610 bcm_cosq_ingress_port_drop_mpls_special_label_config_t *config); 5611 5612 /* MMU Profile Type */ 5613 typedef enum bcm_cosq_profile_type_e { 5614 bcmCosqProfilePFCAndQueueHierarchy = 0, /* Profile for setting Queue Scheduler 5615 Hierarchy and PFC 5616 optimized classes */ 5617 bcmCosqProfilePGProperties = 1, /* Profile for Priority Group to Pool 5618 Mapping */ 5619 bcmCosqProfileIntPriToPGMap = 2, /* Profile for mapping Internal priority 5620 to PG for UC/MC 5621 packets */ 5622 bcmCosqProfileOobfcEgressQueueMap = 3, /* Profile for Enabling/Disabling MMU 5623 queue reporting and 5624 mapping queue to bit 5625 positions in OOB message */ 5626 bcmCosqProfileCount = 4 /* This should be the last one */ 5627 } bcm_cosq_profile_type_t; 5628 5629 #ifndef BCM_HIDE_DISPATCHABLE 5630 5631 /* Set/get Profile mapped to port for a given profile type */ 5632 extern int bcm_cosq_port_profile_set( 5633 int unit, 5634 bcm_port_t port, 5635 bcm_cosq_profile_type_t profile_type, 5636 int profile_id); 5637 5638 /* Set/get Profile mapped to port for a given profile type */ 5639 extern int bcm_cosq_port_profile_get( 5640 int unit, 5641 bcm_port_t port, 5642 bcm_cosq_profile_type_t profile_type, 5643 int *profile_id); 5644 5645 #endif /* BCM_HIDE_DISPATCHABLE */ 5646 5647 /* MMU Dynamic Type to indicate modifiability during run time */ 5648 typedef enum bcm_cosq_dynamic_setting_type_e { 5649 bcmCosqDynamicTypeFixed = 0, /* MMU settings that cannot be changed 5650 dynamically */ 5651 bcmCosqDynamicTypeFlexible = 1, /* MMU settings that can be changed 5652 dynamically with no restrictions */ 5653 bcmCosqDynamicTypeConditional = 2 /* MMU settings that can be changed as 5654 long as the corresponding 5655 egress port/ports 5656 dont have any traffic in MMU */ 5657 } bcm_cosq_dynamic_setting_type_t; 5658 5659 #ifndef BCM_HIDE_DISPATCHABLE 5660 5661 /* 5662 * Check if a specific property's proile can be modified while there is 5663 * traffic in 5664 * ports mapping to the profile. 5665 */ 5666 extern int bcm_cosq_profile_property_dynamic_get( 5667 int unit, 5668 bcm_cosq_profile_type_t profile_type, 5669 bcm_cosq_dynamic_setting_type_t *dynamic); 5670 5671 /* Check if a specific property's proile is mapped to any port. */ 5672 extern int bcm_cosq_profile_info_inuse_get( 5673 int unit, 5674 bcm_cosq_profile_type_t profile_type, 5675 int profile_id, 5676 int *in_use); 5677 5678 /* Get the list of ports mapped to a profile. */ 5679 extern int bcm_cosq_profile_info_portlist_get( 5680 int unit, 5681 bcm_cosq_profile_type_t profile_type, 5682 int profile_id, 5683 int max_port_count, 5684 bcm_port_t *port_list, 5685 int *port_count); 5686 5687 #endif /* BCM_HIDE_DISPATCHABLE */ 5688 5689 /* Specify the type of mapping for profile */ 5690 typedef enum bcm_cosq_priority_group_mapping_profile_type_e { 5691 bcmCosqInputPriPriorityGroupUcMapping = 0, 5692 bcmCosqInputPriPriorityGroupMcMapping = 1, 5693 bcmCosqPriorityGroupServicePoolMapping = 2, 5694 bcmCosqPriorityGroupHeadroomPoolMapping = 3 5695 } bcm_cosq_priority_group_mapping_profile_type_t; 5696 5697 /* Microburst information */ 5698 typedef struct bcm_cosq_burst_output_s { 5699 uint64 sequence_num; /* This is a running global number identifying 5700 each burst reported to the host */ 5701 uint64 gport_sequence_num; /* Total number of bursts observed on gport */ 5702 uint64 traffic_start_time; /* Traffic start time on gport */ 5703 uint64 burst_start_time; /* Start time of the burst on gport */ 5704 uint64 burst_end_time; /* End time of the burst on gport */ 5705 uint64 burst_duration; /* Burst duration on gport */ 5706 uint64 drop_count; /* Number of bytes dropped since pervious burst 5707 report on this gport */ 5708 uint64 rx_count; /* Number of bytes received since pervious burst 5709 report on this gport */ 5710 bcm_gport_t gport_num; /* User requested gport to be monitored */ 5711 uint32 reserved; /* User reserved for furture case */ 5712 } bcm_cosq_burst_output_t; 5713 5714 /* 5715 * Enable to collect actual scan interval information from BTE burst 5716 * monitor application. 5717 */ 5718 #define BCM_BURST_MONITOR_SCAN_INTERVAL_COLLECTION (1 << 0) /* Enable to collect 5719 actual scan interval 5720 information from BTE 5721 burst monitor 5722 application. */ 5723 5724 /* Queue congestion monitor Interest Factor computation weights. */ 5725 typedef enum bcm_cosq_burst_monitor_weight_e { 5726 bcmCosqBurstMonitorWeightFlowMaxRxBytes = 0, /* (w1) Maximum of any flow Rx bytes 5727 weight */ 5728 bcmCosqBurstMonitorWeightFlowSumRxBytes = 1, /* (w2) Sum of all flows Rx bytes weight */ 5729 bcmCosqBurstMonitorWeightQueueMaxBufBytes = 2, /* (w3) Maximum usage of any queue 5730 buffer utilization weight */ 5731 bcmCosqBurstMonitorWeightQueueSumBufBytes = 3, /* (w4) Sum of all queues buffer 5732 utilization weight */ 5733 bcmCosqBurstMonitorWeightQueueMaxDropBytes = 4, /* (w5) Maximum of any queues drop bytes 5734 weight */ 5735 bcmCosqBurstMonitorWeightQueueSumDropBytes = 5, /* (w6) Sum of all queues drop bytes 5736 weight */ 5737 bcmCosqBurstMonitorWeightQueueMaxRxBytes = 6, /* (w7) Maximum of any queues Rx bytes 5738 weight */ 5739 bcmCosqBurstMonitorWeightQueueSumRxBytes = 7, /* (w8) Sum of all queues Rx bytes 5740 weight */ 5741 bcmCosqBurstMonitorWeightMaxTMUtil = 8, /* (w9) Maximum XPE Utilization weight */ 5742 bcmCosqBurstMonitorWeightAvgTMUtil = 9, /* (w10) Average XPE utilization weight */ 5743 bcmCosqBurstMonitorWeightRandomNum = 10, /* (w11) random integer weight */ 5744 bcmCosqBurstMonitorWeightViewID = 11, /* (w12) Flow view id weight */ 5745 bcmCosqBurstMonitorWeightMaxViewID = 12, /* (w13) Maximum value of flow view id */ 5746 bcmCosqBurstMonitorWeightViewIDThreshold = 13, /* (w14) Threshold value of flow view id */ 5747 bcmCosqBurstMonitorWeightFlowMaxRxPackets = 14, /* (w15) Maximum of any flow Rx packets 5748 weight */ 5749 bcmCosqBurstMonitorWeightFlowSumRxPackets = 15, /* (w16) Sum of all flows Rx packets 5750 weight */ 5751 bcmCosqBurstMonitorWeightQueueMaxDropPackets = 16, /* (w17) Maximum of any queues drop 5752 packets weight */ 5753 bcmCosqBurstMonitorWeightQueueSumDropPackets = 17, /* (w18) Sum of all queues drop packets 5754 weight */ 5755 bcmCosqBurstMonitorWeightQueueMaxRxPackets = 18, /* (w19) Maximum of any queues received 5756 packets weight */ 5757 bcmCosqBurstMonitorWeightQueueSumRxPackets = 19, /* (w20) Sum of all queues received 5758 packets weight */ 5759 bcmCosqBurstMonitorWeightQueueMaxTxBytes = 20, /* (w21) Maximum of any queues Tx bytes 5760 weight */ 5761 bcmCosqBurstMonitorWeightQueueSumTxBytes = 21, /* (w22) Sum of all queues Tx bytes 5762 weight */ 5763 bcmCosqBurstMonitorWeightQueueMaxTxPackets = 22, /* (w23) Maximum of any queues Tx 5764 packets weight */ 5765 bcmCosqBurstMonitorWeightQueueSumTxPackets = 23, /* (w24) Sum of all queues Tx packets 5766 weight */ 5767 bcmCosqBurstMonitorWeightCount = 24 5768 } bcm_cosq_burst_monitor_weight_t; 5769 5770 /* 5771 * Queue congestion monitor export trigger info. Calculate InterestFactor 5772 * of each view and export to collector. 5773 */ 5774 typedef struct bcm_cosq_burst_monitor_export_trigger_s { 5775 uint64 export_threshold; /* Export threshold */ 5776 uint8 weights[bcmCosqBurstMonitorWeightCount]; /* InterestFactor computation weights. */ 5777 } bcm_cosq_burst_monitor_export_trigger_t; 5778 5779 /* Queue congestion monitor flow view Configuration. */ 5780 typedef struct bcm_cosq_burst_monitor_flow_view_info_s { 5781 bcm_cosq_burst_monitor_export_trigger_t export_param; /* Queue congestion monitor export 5782 trigger Info */ 5783 uint64 start_timer_usecs; /* Start time of Queue congestion 5784 monitor */ 5785 uint64 age_timer_usecs; /* Replace existing flow view in host 5786 memory based on age timer */ 5787 uint32 scan_interval_usecs; /* sample/scan Interval */ 5788 uint32 age_threshold; /* Aging persistent flows if sum of all 5789 sampled rx_byte_count values goes 5790 below threshold */ 5791 uint32 num_samples; /* Number of samples captured per view */ 5792 uint32 num_flows; /* Number of flows captured per view */ 5793 uint32 num_flows_clear; /* Clears configured number of flows 5794 with low Rx byte count from total 5795 number of flows, to allow new flows 5796 learning */ 5797 uint32 flags; /* Options that can be passed via flags 5798 parameter during flow view 5799 configuration. */ 5800 } bcm_cosq_burst_monitor_flow_view_info_t; 5801 5802 /* 5803 * Options that can be passed via options parameter during configuration 5804 * set. 5805 */ 5806 #define BCM_QCM_CONFIG_UPDATE (1 << 0) /* Add/Modify configuration to 5807 transfer Queue congestion monitor 5808 information. */ 5809 #define BCM_QCM_CONFIG_CLEAR (1 << 1) /* Clear configuration information. */ 5810 5811 /* 5812 * Options that can be passed via flags parameter during flow view stats 5813 * data get. 5814 */ 5815 #define BCM_QCM_FLOW_VIEW_STATS_DATA_SORT (1 << 0) /* Queue congestion 5816 monitor flow view 5817 stats information in 5818 sorted order. */ 5819 5820 #ifndef BCM_HIDE_DISPATCHABLE 5821 5822 /* Initialize Queue congestion monitoring */ 5823 extern int bcm_cosq_burst_monitor_init( 5824 int unit); 5825 5826 /* Shut Down Queue congestion monitoring */ 5827 extern int bcm_cosq_burst_monitor_detach( 5828 int unit); 5829 5830 /* Set Queue congestion monitoring flow view configuration. */ 5831 extern int bcm_cosq_burst_monitor_flow_view_config_set( 5832 int unit, 5833 uint32 options, 5834 bcm_cosq_burst_monitor_flow_view_info_t *flow_view_data); 5835 5836 /* Get Queue congestion monitoring flow view configuration. */ 5837 extern int bcm_cosq_burst_monitor_flow_view_config_get( 5838 int unit, 5839 bcm_cosq_burst_monitor_flow_view_info_t *flow_view_data); 5840 5841 /* Queue congestion monitoring clear flow view data. */ 5842 extern int bcm_cosq_burst_monitor_flow_view_data_clear( 5843 int unit); 5844 5845 /* 5846 * Customer app provides the buffer address and size to the QCM App. QCM 5847 * App writes the processed flow view information into this buffer. 5848 */ 5849 extern int bcm_cosq_burst_monitor_flow_view_data_get( 5850 int unit, 5851 uint32 usr_mem_size, 5852 uint8 *usr_mem_addr); 5853 5854 /* 5855 * Customer app provides the buffer address and size to the QCM App. This 5856 * is a one time config and no dynamic change in the address or the size 5857 * is permitted. QCM App writes the processed information into this 5858 * buffer in a circular fashion and expect customer application to read 5859 * periodically. 5860 */ 5861 extern int bcm_cosq_burst_monitor_dma_config_set( 5862 int unit, 5863 uint32 host_mem_size, 5864 uint32 **host_mem_addr); 5865 5866 /* 5867 * Customer provided array of gports that are to be monitored by the QCM 5868 * App. 5869 */ 5870 extern int bcm_cosq_burst_monitor_set( 5871 int unit, 5872 int num_gports, 5873 bcm_gport_t *gport_list); 5874 5875 /* Get array gports that are being monitored by the QCM App. */ 5876 extern int bcm_cosq_burst_monitor_get( 5877 int unit, 5878 int max_gports, 5879 bcm_gport_t *gport_list, 5880 int *num_gports); 5881 5882 /* 5883 * Gets the host memory size and address of micro burst data provided by 5884 * the QCM App 5885 */ 5886 extern int bcm_cosq_burst_monitor_dma_config_get( 5887 int unit, 5888 uint32 *host_mem_size, 5889 uint32 **host_mem_addr); 5890 5891 /* Get current QCM FW time. */ 5892 extern int bcm_cosq_burst_monitor_get_current_time( 5893 int unit, 5894 uint64 *time_usecs); 5895 5896 /* Get flow views summary data. */ 5897 extern int bcm_cosq_burst_monitor_view_summary_get( 5898 int unit, 5899 uint32 mem_size, 5900 uint8 *mem_addr, 5901 int max_num_views, 5902 int *num_views); 5903 5904 /* Get flow view stats data */ 5905 extern int bcm_cosq_burst_monitor_flow_view_stats_get( 5906 int unit, 5907 uint32 mem_size, 5908 uint8 *mem_addr, 5909 int max_num_flows, 5910 int view_id, 5911 uint32 flags, 5912 int *num_flows); 5913 5914 /* Get/Set a profile for the various mappings */ 5915 extern int bcm_cosq_priority_group_mapping_profile_set( 5916 int unit, 5917 int profile_index, 5918 bcm_cosq_priority_group_mapping_profile_type_t type, 5919 int array_count, 5920 int *arg); 5921 5922 /* Get/Set a profile for the various mappings */ 5923 extern int bcm_cosq_priority_group_mapping_profile_get( 5924 int unit, 5925 int profile_index, 5926 bcm_cosq_priority_group_mapping_profile_type_t type, 5927 int array_max, 5928 int *arg, 5929 int *array_count); 5930 5931 #endif /* BCM_HIDE_DISPATCHABLE */ 5932 5933 /* Specify the type of service pool override */ 5934 typedef enum bcm_cosq_service_pool_override_type_e { 5935 bcmCosqServicePoolOverrideCpu = 0, 5936 bcmCosqServicePoolOverrideMcPkt = 1, 5937 bcmCosqServicePoolOverrideMirror = 2 5938 } bcm_cosq_service_pool_override_type_t; 5939 5940 #ifndef BCM_HIDE_DISPATCHABLE 5941 5942 /* Enable or disable service pool override */ 5943 extern int bcm_cosq_service_pool_override_set( 5944 int unit, 5945 bcm_cosq_service_pool_override_type_t type, 5946 bcm_service_pool_id_t service_pool, 5947 int enable); 5948 5949 /* Enable or disable service pool override */ 5950 extern int bcm_cosq_service_pool_override_get( 5951 int unit, 5952 bcm_cosq_service_pool_override_type_t type, 5953 bcm_service_pool_id_t *service_pool, 5954 int *enable); 5955 5956 #endif /* BCM_HIDE_DISPATCHABLE */ 5957 5958 /* Specify per port per Priority Group property */ 5959 typedef enum bcm_cosq_port_prigroup_control_e { 5960 bcmCosqPriorityGroupLossless = 0, 5961 bcmCosqPauseEnable = 1 5962 } bcm_cosq_port_prigroup_control_t; 5963 5964 #ifndef BCM_HIDE_DISPATCHABLE 5965 5966 /* Setup per port per priority group properties */ 5967 extern int bcm_cosq_port_priority_group_property_set( 5968 int unit, 5969 bcm_port_t port, 5970 int priority_group_id, 5971 bcm_cosq_port_prigroup_control_t type, 5972 int arg); 5973 5974 /* Setup per port per priority group properties */ 5975 extern int bcm_cosq_port_priority_group_property_get( 5976 int unit, 5977 bcm_port_t port, 5978 int priority_group_id, 5979 bcm_cosq_port_prigroup_control_t type, 5980 int *arg); 5981 5982 /* Check if a cosq_control_type property can be changed dynamically */ 5983 extern int bcm_cosq_control_dynamic_get( 5984 int unit, 5985 bcm_cosq_control_t type, 5986 bcm_cosq_dynamic_setting_type_t *dynamic); 5987 5988 #endif /* BCM_HIDE_DISPATCHABLE */ 5989 5990 /* Cosq to queue mapping for scheduler */ 5991 typedef struct bcm_cosq_mapping_s { 5992 bcm_cos_queue_t cosq; /* Cos value */ 5993 int num_ucq; /* Number of unicast queues. Valid values are 0-2 */ 5994 int num_mcq; /* Number of multicast queues. Valid values are 0-1 */ 5995 int strict_priority; /* Schedudling priority is strict. 0: Not strict, 1: 5996 strict */ 5997 int fc_is_uc_only; /* Flow control is set for uc only packets */ 5998 } bcm_cosq_mapping_t; 5999 6000 /* Initializes the bcm_cosq_mapping_t structure */ 6001 extern void bcm_cosq_mapping_t_init( 6002 bcm_cosq_mapping_t *control); 6003 6004 #ifndef BCM_HIDE_DISPATCHABLE 6005 6006 /* Setup cosq to mmu queue mapping profiles */ 6007 extern int bcm_cosq_schedq_mapping_set( 6008 int unit, 6009 int profile_index, 6010 int size, 6011 bcm_cosq_mapping_t *cosq_mapping_arr); 6012 6013 /* Setup cosq to mmu queue mapping profiles */ 6014 extern int bcm_cosq_schedq_mapping_get( 6015 int unit, 6016 int profile_index, 6017 int array_max, 6018 bcm_cosq_mapping_t *cosq_mapping_arr, 6019 int *size); 6020 6021 #endif /* BCM_HIDE_DISPATCHABLE */ 6022 6023 /* OBM traffic classes */ 6024 typedef enum bcm_obm_traffic_class_e { 6025 bcmObmClassLossyLow = 0, 6026 bcmObmClassLossyHigh = 1, 6027 bcmObmClassLossless0 = 2, 6028 bcmObmClassLossless1 = 3 6029 } bcm_obm_traffic_class_t; 6030 6031 /* OBM lookup priority type */ 6032 typedef enum bcm_obm_lookup_priority_type_e { 6033 bcmObmPriorityTypeVLAN = 0, 6034 bcmObmPriorityTypeDSCP = 1, 6035 bcmObmPriorityTypeUntagged = 2 6036 } bcm_obm_lookup_priority_type_t; 6037 6038 #ifndef BCM_HIDE_DISPATCHABLE 6039 6040 /* Set/get OBM traffic class mapped to different prioity for a port. */ 6041 extern int bcm_obm_port_pri_traffic_class_mapping_set( 6042 int unit, 6043 bcm_port_t port, 6044 bcm_obm_lookup_priority_type_t piority_type, 6045 int priority, 6046 bcm_obm_traffic_class_t obm_tc); 6047 6048 /* Set/get OBM traffic class mapped to different prioity for a port. */ 6049 extern int bcm_obm_port_pri_traffic_class_mapping_get( 6050 int unit, 6051 bcm_port_t port, 6052 bcm_obm_lookup_priority_type_t piority_type, 6053 int priority, 6054 bcm_obm_traffic_class_t *obm_tc); 6055 6056 #endif /* BCM_HIDE_DISPATCHABLE */ 6057 6058 /* OBM traffic class for max watermark mode selection */ 6059 typedef enum bcm_obm_max_watermark_mode_e { 6060 bcmObmMaxUsageModeAllTraffic = 0, 6061 bcmObmMaxUsageModeLossy = 1, 6062 bcmObmMaxUsageModeLossless0 = 2, 6063 bcmObmMaxUsageModeLossless1 = 3 6064 } bcm_obm_max_watermark_mode_t; 6065 6066 #ifndef BCM_HIDE_DISPATCHABLE 6067 6068 /* Set/get max watermark mode for a given port. */ 6069 extern int bcm_obm_port_max_usage_mode_get( 6070 int unit, 6071 bcm_port_t port, 6072 bcm_obm_max_watermark_mode_t *obm_wm_mode); 6073 6074 /* Set/get max watermark mode for a given port. */ 6075 extern int bcm_obm_port_max_usage_mode_set( 6076 int unit, 6077 bcm_port_t port, 6078 bcm_obm_max_watermark_mode_t obm_wm_mode); 6079 6080 /* Set/get PFC priorities mapped to OBM traffic class for a port. */ 6081 extern int bcm_obm_traffic_class_pfc_priority_mapping_set( 6082 int unit, 6083 bcm_port_t port, 6084 bcm_obm_traffic_class_t obm_traffic_class, 6085 int max_pri_count, 6086 int *priority_list); 6087 6088 /* Set/get PFC priorities mapped to OBM traffic class for a port. */ 6089 extern int bcm_obm_traffic_class_pfc_priority_mapping_get( 6090 int unit, 6091 bcm_port_t port, 6092 bcm_obm_traffic_class_t obm_traffic_class, 6093 int max_pri_count, 6094 int *priority_list, 6095 int *pri_count); 6096 6097 #endif /* BCM_HIDE_DISPATCHABLE */ 6098 6099 /* PFC deadlock timer interval selection. */ 6100 typedef enum bcm_cosq_pfc_deadlock_timer_interval_e { 6101 bcmCosqPFCDeadlockTimerInterval1MiliSecond = 0, 6102 bcmCosqPFCDeadlockTimerInterval10MiliSecond = 1, 6103 bcmCosqPFCDeadlockTimerInterval100MiliSecond = 2, 6104 bcmCosqPFCDeadlockTimerIntervalCount = 3 6105 } bcm_cosq_pfc_deadlock_timer_interval_t; 6106 6107 /* PFC deadlock control type selection. */ 6108 typedef enum bcm_cosq_pfc_deadlock_control_e { 6109 bcmCosqPFCDeadlockDetectionAndRecoveryEnable = 0, 6110 bcmCosqPFCDeadlockRecoveryOccurrences = 1, 6111 bcmCosqPFCDeadlockDetectionTimer = 2, 6112 bcmCosqPFCDeadlockRecoveryTimer = 3, 6113 bcmCosqPFCDeadlockTimerGranularity = 4, 6114 bcmCosqPFCDeadlockControlTypeCount = 5 6115 } bcm_cosq_pfc_deadlock_control_t; 6116 6117 /* Bandwidth fabric adjust key info */ 6118 typedef struct bcm_cosq_bandwidth_fabric_adjust_key_s { 6119 bcm_core_t core; /* core id */ 6120 int num_links; /* Number of links/serdes. */ 6121 int rci_level; /* Route congestion indication. */ 6122 } bcm_cosq_bandwidth_fabric_adjust_key_t; 6123 6124 #ifndef BCM_HIDE_DISPATCHABLE 6125 6126 /* 6127 * Set/retrieve bandwidth fabric adjust entry (DRM table), Each link has 6128 * entries corresponding to all the rci levels. 6129 */ 6130 extern int bcm_cosq_bandwidth_fabric_adjust_set( 6131 int unit, 6132 uint32 flags, 6133 bcm_cosq_bandwidth_fabric_adjust_key_t *key, 6134 uint32 bandwidth); 6135 6136 /* 6137 * Get bandwidth fabric adjust entry (DRM table), Each link has entries 6138 * corresponding to all the rci levels. 6139 */ 6140 extern int bcm_cosq_bandwidth_fabric_adjust_get( 6141 int unit, 6142 uint32 flags, 6143 bcm_cosq_bandwidth_fabric_adjust_key_t *key, 6144 uint32 *bandwidth); 6145 6146 /* 6147 * Set / Get config for the given (PFC priority, port) for the PFC 6148 * Deadlock feature 6149 */ 6150 extern int bcm_cosq_pfc_deadlock_control_set( 6151 int unit, 6152 bcm_port_t port, 6153 int pfc_priority, 6154 bcm_cosq_pfc_deadlock_control_t type, 6155 int arg); 6156 6157 /* 6158 * Set / Get config for the given (PFC priority, port) for the PFC 6159 * Deadlock feature 6160 */ 6161 extern int bcm_cosq_pfc_deadlock_control_get( 6162 int unit, 6163 bcm_port_t port, 6164 int pfc_priority, 6165 bcm_cosq_pfc_deadlock_control_t type, 6166 int *arg); 6167 6168 #endif /* BCM_HIDE_DISPATCHABLE */ 6169 6170 /* Obm interrupt types */ 6171 typedef enum bcm_obm_interrupt_type_e { 6172 bcmObmInterruptTypeExpressOverflow = 0, /* Enable obm interrupt for express 6173 traffic overflow . */ 6174 bcmObmInterruptTypeExpressDrop = 1, /* Enable obm interrupt for express 6175 traffic drop . */ 6176 bcmObmInterruptTypePreemptOverflow = 2, /* Enable obm interrupt for preempt 6177 traffic overflow. */ 6178 bcmObmInterruptTypePreemptDrop = 3 /* Enable obm interrupt for preempt 6179 traffic drop. */ 6180 } bcm_obm_interrupt_type_t; 6181 6182 #define BCM_COSQ_PFC_DEADLOCK_WIRED_COS 0x10000000 /* Map internal priority 6183 config to wired cos */ 6184 #define BCM_COSQ_PFC_DEADLOCK_WIRELESS_COS 0x20000000 /* Map internal priority 6185 config to wireless cos */ 6186 #define BCM_COSQ_PFC_DEADLOCK_TRANSIT_COS 0x40000000 /* Map internal priority 6187 config to transit cos */ 6188 6189 /* Cosq gport info */ 6190 typedef struct bcm_cosq_gport_level_info_s { 6191 int parent_port_type; /* Indicates whether the given cosq gport is a 6192 member of the scheduling hierarchy belonging to a 6193 uplink or downlink port. */ 6194 int level; /* Cosq gport's scheduler level L0/L1/L2. */ 6195 } bcm_cosq_gport_level_info_t; 6196 6197 /* Initialize a COSq gport info structure. */ 6198 extern void bcm_cosq_gport_level_info_t_init( 6199 bcm_cosq_gport_level_info_t *info); 6200 6201 #ifndef BCM_HIDE_DISPATCHABLE 6202 6203 /* Retrieve cosq gport info. */ 6204 extern int bcm_cosq_gport_info_get( 6205 int unit, 6206 bcm_gport_t gport, 6207 bcm_cosq_gport_level_info_t *info); 6208 6209 #endif /* BCM_HIDE_DISPATCHABLE */ 6210 6211 /* 6212 * Defines uplink or downlink, stacking port type. It indicates whether 6213 * the given cosq gport is a member of the scheduling hierarchy belonging 6214 * to a uplink, stacking or downlink port 6215 */ 6216 #define BCM_COSQ_DOWNLINK_GPORT 0x0 6217 #define BCM_COSQ_UPLINK_GPORT 0x1 6218 #define BCM_COSQ_STACKING_GPORT 0x2 6219 6220 /* Obm interrupt info passed to the customer callback */ 6221 typedef struct bcm_obm_interrupt_info_s { 6222 int port; /* Port on which the obm interrupt has 6223 occured */ 6224 bcm_obm_interrupt_type_t interrupt_type; /* Interrupt type. */ 6225 } bcm_obm_interrupt_info_t; 6226 6227 typedef void (*bcm_obm_callback_fn)( 6228 int unit, 6229 bcm_obm_interrupt_info_t *obm_info, 6230 void *userdata); 6231 6232 #ifndef BCM_HIDE_DISPATCHABLE 6233 6234 /* 6235 * This is used by the application to register/unregister the callback 6236 * routine that needs to be called 6237 * when we encounter the OBM drop/overflow interrupts. 6238 */ 6239 extern int bcm_obm_cb_unregister( 6240 int unit, 6241 bcm_obm_callback_fn fn, 6242 void *user_data); 6243 6244 /* Retrieve the number of PFC optimized groups supported for a port. */ 6245 extern int bcm_cosq_port_optimized_pfc_group_num_get( 6246 int unit, 6247 bcm_port_t port, 6248 int *arg); 6249 6250 /* 6251 * This is used by the application to register/unregister the callback 6252 * routine that needs to be called 6253 * when we encounter the OBM drop/overflow interrupts. 6254 */ 6255 extern int bcm_obm_cb_register( 6256 int unit, 6257 bcm_obm_callback_fn fn, 6258 void *user_data); 6259 6260 #endif /* BCM_HIDE_DISPATCHABLE */ 6261 6262 /* Scheduler element type */ 6263 typedef enum bcm_cosq_scheduler_gport_type_e { 6264 bcmCosqSchedulerGportTypeClass4Sp = 0, /* CL mode 1 -- 4 strict priorities */ 6265 bcmCosqSchedulerGportTypeClass3SpWfq = 1, /* CL mode 2 -- 3 strict priorities, 6266 last WFQ(2) */ 6267 bcmCosqSchedulerGportTypeClassWfq2Sp = 2, /* CL mode 3 -- 2 strict priorities, 6268 first WFQ(3) or WFQ(1:63) */ 6269 bcmCosqSchedulerGportTypeClass2SpWfq = 3, /* CL mode 4 -- 2 strict priorities, 6270 last WFQ(3) or WFQ(1:63) */ 6271 bcmCosqSchedulerGportTypeClass1SpWfq = 4, /* CL mode 5 -- 1 strict priority WFQ(4) 6272 or WFQ(1:253) */ 6273 bcmCosqSchedulerGportTypeHrSingleWfq = 5, /* HR with single WFQ */ 6274 bcmCosqSchedulerGportTypeHrDualWfq = 6, /* HR with Dual WFQ */ 6275 bcmCosqSchedulerGportTypeHrEnhanced = 7, /* Enhanced HR */ 6276 bcmCosqSchedulerGportTypeFq = 8 /* FQ */ 6277 } bcm_cosq_scheduler_gport_type_t; 6278 6279 /* Scheduler element mode */ 6280 typedef enum bcm_cosq_scheduler_gport_mode_e { 6281 bcmCosqSchedulerGportModeSimple = 0, /* Simple element */ 6282 bcmCosqSchedulerGportModeComposite = 1, /* Composite element */ 6283 bcmCosqSchedulerGportModeEnhancedClLowPrioFQ = 2, /* Enhanced CL with FQ at low priority */ 6284 bcmCosqSchedulerGportModeEnhancedClHighPrioFQ = 3, /* Enhanced CL with FQ at high priority */ 6285 bcmCosqSchedulerGportModeSharedDual = 4, /* Shared shaper with 2 elements */ 6286 bcmCosqSchedulerGportModeSharedQuad = 5, /* Shared shaper with 4 elements */ 6287 bcmCosqSchedulerGportModeSharedOcta = 6 /* Shared shaper with 8 elements */ 6288 } bcm_cosq_scheduler_gport_mode_t; 6289 6290 /* CL WFQ mode */ 6291 typedef enum bcm_cosq_scheduler_gport_cl_wfq_mode_e { 6292 bcmCosqSchedulerGportClWfqModeNone = 0, /* Not relevant */ 6293 bcmCosqSchedulerGportClWfqModeDiscrete = 1, /* Discrete per flow */ 6294 bcmCosqSchedulerGportClWfqModeClass = 2, /* Discrete per class */ 6295 bcmCosqSchedulerGportClWfqModeIndependent = 3, /* Independent mode */ 6296 bcmCosqSchedulerGportClWfqModeIndependentProportional = 4 /* Independent proportional mode */ 6297 } bcm_cosq_scheduler_gport_cl_wfq_mode_t; 6298 6299 #define BCM_COSQ_SCHEDULER_GPORT_WITH_ID 0x00000001 /* Allocate with id */ 6300 #define BCM_COSQ_SCHEDULER_GPORT_REPLACE 0x00000002 /* Replace existing 6301 element */ 6302 #define BCM_COSQ_SCHEDULER_GPORT_FMQ_RESERVE 0x00000004 /* Reserve HR to be used 6303 for FMQ */ 6304 6305 /* Scheduling element parameters */ 6306 typedef struct bcm_cosq_scheduler_gport_params_s { 6307 bcm_core_t core; /* core id */ 6308 bcm_cosq_scheduler_gport_type_t type; /* type of scheduling element */ 6309 bcm_cosq_scheduler_gport_mode_t mode; /* Mode of scheduling element */ 6310 bcm_cosq_scheduler_gport_cl_wfq_mode_t cl_wfq_mode; /* CL WFQ mode. */ 6311 } bcm_cosq_scheduler_gport_params_t; 6312 6313 #ifndef BCM_HIDE_DISPATCHABLE 6314 6315 /* Create scheduling element */ 6316 extern int bcm_cosq_scheduler_gport_add( 6317 int unit, 6318 uint32 flags, 6319 bcm_cosq_scheduler_gport_params_t *params, 6320 bcm_gport_t *gport); 6321 6322 /* Set PFC deadlock related configurations. */ 6323 extern int bcm_cosq_scheduler_gport_get( 6324 int unit, 6325 uint32 flags, 6326 bcm_gport_t gport, 6327 bcm_cosq_scheduler_gport_params_t *params); 6328 6329 #endif /* BCM_HIDE_DISPATCHABLE */ 6330 6331 #define BCM_COSQ_LATENCY_END_TO_END 0x1 /* refer to end to end 6332 latency */ 6333 #define BCM_COSQ_LATENCY_PROFILE_WITH_ID 0x2 /* create latency profile 6334 with id */ 6335 #define BCM_COSQ_LATENCY_PROFILE_ID_EXTENSION 0x4 /* allow to create 6336 latency profile belong 6337 to the extension 6338 profiles range */ 6339 #define BCM_COSQ_LATENCY_PROFILE_BY_FLOW 0x8 /* create latency flow 6340 profile */ 6341 #define BCM_COSQ_LATENCY_END_TO_END_AQM 0x10 /* create end to end AQM 6342 profile */ 6343 6344 #ifndef BCM_HIDE_DISPATCHABLE 6345 6346 /* API create new latency profile. */ 6347 extern int bcm_cosq_latency_profile_create( 6348 int unit, 6349 int flags, 6350 bcm_gport_t *profile_gport); 6351 6352 /* API destroy new latency profile */ 6353 extern int bcm_cosq_latency_profile_destroy( 6354 int unit, 6355 int flags, 6356 bcm_gport_t profile_gport); 6357 6358 #endif /* BCM_HIDE_DISPATCHABLE */ 6359 6360 /* Cosq packet size and distribution percentage */ 6361 typedef struct bcm_cosq_pkt_size_dist_s { 6362 int pkt_size; /* Packet size */ 6363 int dist_perc; /* Percentage distribution of packet size */ 6364 } bcm_cosq_pkt_size_dist_t; 6365 6366 #ifndef BCM_HIDE_DISPATCHABLE 6367 6368 /* 6369 * Setup Port PriorityGroup headroom value based on cable length and 6370 * packet distribution. 6371 */ 6372 extern int bcm_cosq_port_prigrp_hdrm_set( 6373 int unit, 6374 bcm_port_t port, 6375 uint32 pri_bmp, 6376 int cable_len, 6377 int arr_size, 6378 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 6379 6380 /* 6381 * Calculate and set Headroom Pool limit based on number of lossless 6382 * classes and 6383 * packet distribution. 6384 */ 6385 extern int bcm_cosq_hdrm_pool_limit_set( 6386 int unit, 6387 int hdrm_pool, 6388 int num_lossless_class, 6389 int arr_size, 6390 bcm_cosq_pkt_size_dist_t *pkt_dist_array); 6391 6392 #endif /* BCM_HIDE_DISPATCHABLE */ 6393 6394 #define BCM_COSQ_GENERIC_KEY_COLOR_SET(key, color) _SHR_COSQ_GENERIC_KEY_COLOR_SET(key,color) 6395 #define BCM_COSQ_GENERIC_KEY_COLOR_GET(key) _SHR_COSQ_GENERIC_KEY_COLOR_GET(key) 6396 #define BCM_COSQ_GENERIC_KEY_LAT_BIN_COLOR_SET(key, bin, color) _SHR_COSQ_GENERIC_KEY_LAT_BIN_COLOR_SET(key, bin, color) 6397 #define BCM_COSQ_GENERIC_KEY_LAT_BIN_COLOR_BIN_GET(key) _SHR_COSQ_GENERIC_KEY_LAT_BIN_COLOR_BIN_GET(key) 6398 #define BCM_COSQ_GENERIC_KEY_LAT_BIN_COLOR_COLOR_GET(key) _SHR_COSQ_GENERIC_KEY_LAT_BIN_COLOR_COLOR_GET(key) 6399 6400 /* For Generic controls. */ 6401 typedef enum bcm_cosq_generic_control_e { 6402 bcmCosqGenericControlLatencyVoqRejectEnable = 0, /* Generic control latency. */ 6403 bcmCosqGenericControlLatencyVoqRejectProb = 1, /* Generic control latency reject. */ 6404 bcmCosqGenericControlLatencyVoqRejectMinThreshold = 2 /* Generic control latency reject 6405 threshold. */ 6406 } bcm_cosq_generic_control_t; 6407 6408 /* mods for bcm_cosq_control_set API, bcmCosqControlLatencyTrack type. */ 6409 typedef enum bcm_cosq_control_track_mode_e { 6410 bcmCosqControlLatencyTrackModInvalid = -1, 6411 bcmCosqControlLatencyTrackModFirst = 0, 6412 bcmCosqControlLatencyTrackFlowId = bcmCosqControlLatencyTrackModFirst, 6413 bcmCosqControlLatencyTrackOutPort = 1, 6414 bcmCosqControlLatencyTrackOutPoreTc = 2, 6415 bcmCosqControlLatencyTrackOutPortTcMc = 3, 6416 bcmCosqControlLatencyTrackModSize = 4 6417 } bcm_cosq_control_track_mode_t; 6418 6419 #ifndef BCM_HIDE_DISPATCHABLE 6420 6421 /* Configuring/retrieving Ingress / egress Generic Control */ 6422 extern int bcm_cosq_generic_control_set( 6423 int unit, 6424 uint32 flags, 6425 bcm_gport_t gport, 6426 uint32 key, 6427 bcm_cosq_generic_control_t type, 6428 uint32 arg); 6429 6430 /* Configuring/retrieving Ingress / egress Generic Control */ 6431 extern int bcm_cosq_generic_control_get( 6432 int unit, 6433 uint32 flags, 6434 bcm_gport_t gport, 6435 uint32 key, 6436 bcm_cosq_generic_control_t type, 6437 uint32 *arg); 6438 6439 #endif /* BCM_HIDE_DISPATCHABLE */ 6440 6441 /* mirror on drop types */ 6442 typedef enum bcm_cosq_mirror_on_drop_type_e { 6443 bcmCosqMirrorOnDropTypeGlobal = 0, /* global type */ 6444 bcmCosqMirrorOnDropTypeVoq = 1, /* voq type */ 6445 bcmCosqMirrorOnDropTypePort = 2, /* port type */ 6446 bcmCosqMirrorOnDropTypePG = 3 /* pg type */ 6447 } bcm_cosq_mirror_on_drop_type_t; 6448 6449 /* Drop group info */ 6450 typedef struct bcm_cosq_mirror_on_drop_group_info_s { 6451 bcm_cosq_drop_reason_t reasons_array[bcmCosqDropReasonRejectCount]; /* drop reasons array */ 6452 int drop_reasons_count; /* actual amount of drop reasons */ 6453 bcm_cosq_mirror_on_drop_type_t type; /* type of group */ 6454 } bcm_cosq_mirror_on_drop_group_info_t; 6455 6456 #ifndef BCM_HIDE_DISPATCHABLE 6457 6458 /* Set/get mirror on drop group info. */ 6459 extern int bcm_cosq_mirror_on_drop_group_set( 6460 int unit, 6461 uint32 flags, 6462 int group_id, 6463 bcm_cosq_mirror_on_drop_group_info_t *group_info); 6464 6465 /* Set/get mirror on drop group info. */ 6466 extern int bcm_cosq_mirror_on_drop_group_get( 6467 int unit, 6468 uint32 flags, 6469 int group_id, 6470 bcm_cosq_mirror_on_drop_group_info_t *group_info); 6471 6472 #endif /* BCM_HIDE_DISPATCHABLE */ 6473 6474 /* Weights for calculating Egress Rate. */ 6475 #define BCM_COSQ_RATE_WEIGHT_FULL 0 /* rate is composed fully of 6476 measurement of the current 6477 interval. */ 6478 #define BCM_COSQ_RATE_WEIGHT_HALF 1 /* rate is composed 1/2 of 6479 current interval 6480 measurement and 1/2 of 6481 previously measured rate. */ 6482 #define BCM_COSQ_RATE_WEIGHT_QUARTER 2 /* rate is composed 3/4 of 6483 current interval 6484 measurement and 3/4 of 6485 previously measured rate. */ 6486 #define BCM_COSQ_RATE_WEIGHT_EIGHTH 3 /* rate is composed 1/8 of 6487 current interval 6488 measurement and 7/8 of 6489 previously measured rate. */ 6490 6491 /* Queue offset mapping key */ 6492 typedef struct bcm_cosq_queue_offset_mapping_key_s { 6493 int tc; /* incoming TC */ 6494 int dp; /* packet DP */ 6495 } bcm_cosq_queue_offset_mapping_key_t; 6496 6497 /* Queue offset */ 6498 typedef struct bcm_cosq_queue_offset_s { 6499 bcm_cos_queue_t cosq; /* queue offset */ 6500 } bcm_cosq_queue_offset_t; 6501 6502 extern void bcm_cosq_queue_offset_mapping_key_t_init( 6503 bcm_cosq_queue_offset_mapping_key_t *key); 6504 6505 #ifndef BCM_HIDE_DISPATCHABLE 6506 6507 /* Map gport to queue offset for specified keys */ 6508 extern int bcm_cosq_gport_queue_offset_mapping_set( 6509 int unit, 6510 uint32 flags, 6511 bcm_gport_t gport, 6512 int count, 6513 bcm_cosq_queue_offset_mapping_key_t *key_array, 6514 bcm_cosq_queue_offset_t *offset_array); 6515 6516 /* Get gport to queue offset mapping for specified keys */ 6517 extern int bcm_cosq_gport_queue_offset_mapping_get( 6518 int unit, 6519 uint32 flags, 6520 bcm_gport_t gport, 6521 int count, 6522 bcm_cosq_queue_offset_mapping_key_t *key_array, 6523 bcm_cosq_queue_offset_t *offset_array); 6524 6525 /* Set/Get EBST enable status. */ 6526 extern int bcm_cosq_ebst_enable_set( 6527 int unit, 6528 int enable); 6529 6530 /* Set/Get EBST enable status. */ 6531 extern int bcm_cosq_ebst_enable_get( 6532 int unit, 6533 int *enable); 6534 6535 #endif /* BCM_HIDE_DISPATCHABLE */ 6536 6537 /* EBST scan mode type eumerations. */ 6538 typedef enum bcm_cosq_ebst_scan_mode_e { 6539 bcmCosqEbstScanModeQueue = 0, /* Queue mode */ 6540 bcmCosqEbstScanModeUCPortPool = 1, /* Unicast port service pool mode */ 6541 bcmCosqEbstScanModeMCPortPool = 2, /* Multicast port service pool mode */ 6542 bcmCosqEbstScanModeCount = 3 /* Must be the last. Not a usable value */ 6543 } bcm_cosq_ebst_scan_mode_t; 6544 6545 /* EBST scan mode type eumerations. */ 6546 typedef enum bcm_cosq_ebst_control_e { 6547 bcmCosqEbstControlScanEnable = 0, /* 1 : Start EBST scan. 0 : Stop EBST 6548 scan */ 6549 bcmCosqEbstControlScanMode = 1, /* EBST scan mode, 6550 bcm_cosq_ebst_scan_mode_t */ 6551 bcmCosqEbstControlScanInterval = 2, /* Value in time interval (unit 1us) 6552 defining the frequency of an EBST 6553 scan round */ 6554 bcmCosqEbstControlScanThreshold = 3, /* Scan threshold. The scan process will 6555 start if the number of available 6556 entries in the EBST FIFO is greater 6557 than this preconfigured scan 6558 threshold. */ 6559 bcmCosqEbstControlCount = 4 /* Must be the last. Not a usable value */ 6560 } bcm_cosq_ebst_control_t; 6561 6562 #ifndef BCM_HIDE_DISPATCHABLE 6563 6564 /* Set/Get EBST scan interval, scan mode and enable mode. */ 6565 extern int bcm_cosq_ebst_control_set( 6566 int unit, 6567 bcm_cosq_ebst_control_t type, 6568 int arg); 6569 6570 /* Set/Get EBST scan interval, scan mode and enable mode. */ 6571 extern int bcm_cosq_ebst_control_get( 6572 int unit, 6573 bcm_cosq_ebst_control_t type, 6574 int *arg); 6575 6576 #endif /* BCM_HIDE_DISPATCHABLE */ 6577 6578 /* Start and stop thresholds of an event BST (EBST) profile */ 6579 typedef struct bcm_cosq_ebst_threshold_profile_s { 6580 uint32 start_bytes; /* Start threshold value in bytes */ 6581 uint32 stop_bytes; /* Stop threshold value in bytes */ 6582 } bcm_cosq_ebst_threshold_profile_t; 6583 6584 /* Initialize a EBST threshold profile structure. */ 6585 extern void bcm_cosq_ebst_threshold_profile_t_init( 6586 bcm_cosq_ebst_threshold_profile_t *profile); 6587 6588 #ifndef BCM_HIDE_DISPATCHABLE 6589 6590 /* Set/Get a EBST threshold profile for a given BST stat Id. */ 6591 extern int bcm_cosq_ebst_threshold_profile_set( 6592 int unit, 6593 bcm_cosq_object_id_t *object_id, 6594 bcm_bst_stat_id_t bid, 6595 bcm_cosq_ebst_threshold_profile_t *profile); 6596 6597 /* Set/Get a EBST threshold profile for a given BST stat Id. */ 6598 extern int bcm_cosq_ebst_threshold_profile_get( 6599 int unit, 6600 bcm_cosq_object_id_t *object_id, 6601 bcm_bst_stat_id_t bid, 6602 bcm_cosq_ebst_threshold_profile_t *profile); 6603 6604 #endif /* BCM_HIDE_DISPATCHABLE */ 6605 6606 /* Flags for EBST monitor setting */ 6607 #define BCM_COSQ_EBST_MONITOR_ENABLE_VALID 0x00000001 /* Used to enable EBST 6608 monitoring */ 6609 #define BCM_COSQ_EBST_MONITOR_ENTRY_NUM_VALID 0x00000002 /* Used to set number 6610 entries */ 6611 6612 /* EBST monitor info structure */ 6613 typedef struct bcm_cosq_ebst_monitor_s { 6614 uint32 flags; /* Monitor flag */ 6615 int enable; /* Enable EBST monitoring */ 6616 int entry_num; /* Number entries reserved in each EBST data buffer */ 6617 } bcm_cosq_ebst_monitor_t; 6618 6619 /* Initialize a port or queue EBST monitor info structure. */ 6620 extern void bcm_cosq_ebst_monitor_t_init( 6621 bcm_cosq_ebst_monitor_t *monitor); 6622 6623 #ifndef BCM_HIDE_DISPATCHABLE 6624 6625 /* Set/Get monitor info for a given BST stat Id. */ 6626 extern int bcm_cosq_ebst_monitor_set( 6627 int unit, 6628 bcm_cosq_object_id_t *object_id, 6629 bcm_bst_stat_id_t bid, 6630 bcm_cosq_ebst_monitor_t *monitor); 6631 6632 /* Set/Get monitor info for a given BST stat Id. */ 6633 extern int bcm_cosq_ebst_monitor_get( 6634 int unit, 6635 bcm_cosq_object_id_t *object_id, 6636 bcm_bst_stat_id_t bid, 6637 bcm_cosq_ebst_monitor_t *monitor); 6638 6639 #endif /* BCM_HIDE_DISPATCHABLE */ 6640 6641 /* EBST data buffer info structure */ 6642 typedef struct bcm_cosq_ebst_data_stat_info_s { 6643 int entry_max; /* Max number entries of EBST data buffer */ 6644 int entry_free; /* Available number entries of EBST data buffer */ 6645 } bcm_cosq_ebst_data_stat_info_t; 6646 6647 /* Initialize EBST data buffer info structure. */ 6648 extern void bcm_cosq_ebst_data_stat_info_t_init( 6649 bcm_cosq_ebst_data_stat_info_t *info); 6650 6651 #ifndef BCM_HIDE_DISPATCHABLE 6652 6653 /* 6654 * Get max number entries and available number entries of EBST data 6655 * buffer. 6656 */ 6657 extern int bcm_cosq_ebst_data_stat_info_get( 6658 int unit, 6659 bcm_cosq_object_id_t *object_id, 6660 bcm_cosq_ebst_data_stat_info_t *info); 6661 6662 #endif /* BCM_HIDE_DISPATCHABLE */ 6663 6664 /* Color packets drop state enumerations. */ 6665 typedef enum bcm_cosq_color_packet_drop_state_e { 6666 bcmCosqColorPktAccept = 0, /* Accept packets */ 6667 bcmCosqColorPktDrop = 1 /* Drop packets */ 6668 } bcm_cosq_color_packet_drop_state_t; 6669 6670 /* EBST data buffer info structure */ 6671 typedef struct bcm_cosq_ebst_data_entry_s { 6672 uint64 timestamp; /* Timestamp */ 6673 uint32 bytes; /* Buffer occupancy level in bytes */ 6674 bcm_cosq_color_packet_drop_state_t green_drop_state; /* Green packet drop state */ 6675 bcm_cosq_color_packet_drop_state_t yellow_drop_state; /* Yellow packet drop state */ 6676 bcm_cosq_color_packet_drop_state_t red_drop_state; /* Red packet drop state */ 6677 } bcm_cosq_ebst_data_entry_t; 6678 6679 #ifndef BCM_HIDE_DISPATCHABLE 6680 6681 /* Get EBST stat for a given stat Id. */ 6682 extern int bcm_cosq_ebst_data_get( 6683 int unit, 6684 bcm_cosq_object_id_t *object_id, 6685 bcm_bst_stat_id_t bid, 6686 int array_size, 6687 bcm_cosq_ebst_data_entry_t *entry_array, 6688 int *count); 6689 6690 #endif /* BCM_HIDE_DISPATCHABLE */ 6691 6692 /* Valid fields. */ 6693 #define BCM_COSQ_MOD_CONTROL_ENABLE_VALID 0x00000001 /* Enable valid. */ 6694 #define BCM_COSQ_MOD_CONTROL_POOL_LIMIT_VALID 0x00000002 /* Pool_limit valid. */ 6695 6696 /* Cosq mirror-on-drop control structure. */ 6697 typedef struct bcm_cosq_mod_control_s { 6698 uint32 valid_flags; /* Control flags to indicate which flag is valid. */ 6699 uint8 enable; /* Mirror enable/disable. */ 6700 uint32 pool_limit; /* Pool limit in bytes. */ 6701 } bcm_cosq_mod_control_t; 6702 6703 /* Initialize a mirror-on-drop control structure. */ 6704 extern void bcm_cosq_mod_control_t_init( 6705 bcm_cosq_mod_control_t *control); 6706 6707 #ifndef BCM_HIDE_DISPATCHABLE 6708 6709 /* Set/Get mirror-on-drop control. */ 6710 extern int bcm_cosq_mod_control_set( 6711 int unit, 6712 bcm_cosq_mod_control_t *control); 6713 6714 /* Set/Get mirror-on-drop control. */ 6715 extern int bcm_cosq_mod_control_get( 6716 int unit, 6717 bcm_cosq_mod_control_t *control); 6718 6719 #endif /* BCM_HIDE_DISPATCHABLE */ 6720 6721 /* Mirror-on-drop profile structure. */ 6722 typedef struct bcm_cosq_mod_profile_s { 6723 uint16 percent_0_25; /* Sampling probability when current filled cells in 6724 mirror-on-drop buffer are less than 25% of 6725 maximum cell number. A 16-bit random number is 6726 compared against this value and if the random 6727 number is less than this value, then the packet 6728 is sampled. */ 6729 uint16 percent_25_50; /* Sampling probability when current filled cells in 6730 mirror-on-drop buffer are between 25% and 50% of 6731 maximum cell number. */ 6732 uint16 percent_50_75; /* Sampling probability when current filled cells in 6733 mirror-on-drop buffer are between 50% and 75% of 6734 maximum cell number. */ 6735 uint16 percent_75_100; /* Sampling probability when current filled cells in 6736 mirror-on-drop buffer are greater than 75% of 6737 maximum cell number. */ 6738 uint8 enable; /* MOD enable/disable. */ 6739 } bcm_cosq_mod_profile_t; 6740 6741 /* Initialize a mirror-on-drop profile structure. */ 6742 extern void bcm_cosq_mod_profile_t_init( 6743 bcm_cosq_mod_profile_t *profile); 6744 6745 /* Cosq mirror-on-drop profile options flags. */ 6746 #define BCM_COSQ_MOD_PROFILE_OPTIONS_WITH_ID 0x00000001 /* Create mirror-on-drop 6747 profile with id. */ 6748 6749 #ifndef BCM_HIDE_DISPATCHABLE 6750 6751 /* Create/Destroy a mirror-on-drop profile. */ 6752 extern int bcm_cosq_mod_profile_create( 6753 int unit, 6754 uint32 options, 6755 int *profile_id); 6756 6757 /* Create/Destroy a mirror-on-drop profile. */ 6758 extern int bcm_cosq_mod_profile_destroy( 6759 int unit, 6760 int profile_id); 6761 6762 /* Set/Get the mirror-on-drop profile entry with given profile id. */ 6763 extern int bcm_cosq_mod_profile_set( 6764 int unit, 6765 int profile_id, 6766 bcm_cosq_mod_profile_t *profile); 6767 6768 /* Set/Get the mirror-on-drop profile entry with given profile id. */ 6769 extern int bcm_cosq_mod_profile_get( 6770 int unit, 6771 int profile_id, 6772 bcm_cosq_mod_profile_t *profile); 6773 6774 #endif /* BCM_HIDE_DISPATCHABLE */ 6775 6776 /* Cosq mirror-on-drop statistics. */ 6777 typedef enum bcm_cosq_mod_stat_e { 6778 bcmCosqModStatDroppedPackets = 0, /* Number of mirror-on-drop eligible 6779 packets that are sampled but failed 6780 to be mirrored. */ 6781 bcmCosqModStatEnqueuedPackets = 1, /* Number of mirror-on-drop eligible 6782 packets that are sampled and mirrored 6783 to queue. */ 6784 bcmCosqModStatPoolBytesCurrent = 2, /* Current value of buffer usage of 6785 mirror-on-drop pool. */ 6786 bcmCosqModStatPoolBytesPeak = 3, /* Peak value of buffer usage of 6787 mirror-on-drop pool. */ 6788 bcmCosqModStatDestQueueBytesCurrent = 4, /* Current value of buffer usage of 6789 mirror-on-drop destination queue. */ 6790 bcmCosqModStatMaxCount = 5 /* This should be the last one. */ 6791 } bcm_cosq_mod_stat_t; 6792 6793 #ifndef BCM_HIDE_DISPATCHABLE 6794 6795 /* Set/Get statistics counter for a statistics object. */ 6796 extern int bcm_cosq_mod_stat_set( 6797 int unit, 6798 bcm_cosq_object_id_t *id, 6799 bcm_cosq_mod_stat_t stat, 6800 uint64 value); 6801 6802 /* Set/Get statistics counter for a statistics object. */ 6803 extern int bcm_cosq_mod_stat_get( 6804 int unit, 6805 bcm_cosq_object_id_t *id, 6806 bcm_cosq_mod_stat_t stat, 6807 uint64 *value); 6808 6809 #endif /* BCM_HIDE_DISPATCHABLE */ 6810 6811 /* Types of congestion element. */ 6812 typedef enum bcm_cosq_inst_congestion_info_type_e { 6813 bcmCosqInstCongestionInfoTypePgVsq = 0, /* Info type PgVsq */ 6814 bcmCosqInstCongestionInfoTypeLlfcVsq = 1, /* Info type LlfcVsq */ 6815 bcmCosqInstCongestionInfoTypeVoq = 2 /* Info Type Voq */ 6816 } bcm_cosq_inst_congestion_info_type_t; 6817 6818 /* Congestion instrumentation key attributes */ 6819 typedef struct bcm_cosq_inst_congestion_info_key_s { 6820 bcm_cosq_inst_congestion_info_type_t type; /* type of congestion */ 6821 bcm_core_t core_id; /* core id */ 6822 } bcm_cosq_inst_congestion_info_key_t; 6823 6824 /* Congestion instrumentation output attributes */ 6825 typedef struct bcm_cosq_inst_congestion_info_data_s { 6826 int valid; /* Indication whether congestion info is 6827 valid */ 6828 bcm_cosq_resource_t resource; /* Type of congested resource */ 6829 int pool_id; /* Relevant only for llfc vsq type */ 6830 uint32 id; /* Id of congested element */ 6831 } bcm_cosq_inst_congestion_info_data_t; 6832 6833 #ifndef BCM_HIDE_DISPATCHABLE 6834 6835 /* Get next congestion element data. */ 6836 extern int bcm_cosq_inst_congestion_info_get( 6837 int unit, 6838 uint32 flags, 6839 bcm_cosq_inst_congestion_info_key_t *key, 6840 bcm_cosq_inst_congestion_info_data_t *data); 6841 6842 #endif /* BCM_HIDE_DISPATCHABLE */ 6843 6844 /* Congestion/Flow control types. */ 6845 typedef enum bcm_cosq_subport_congestion_type_e { 6846 bcmCosqSubportCongestionTypeNone = 0, 6847 bcmCosqSubportCongestionTypePause = 1, 6848 bcmCosqSubportCongestionTypePfc = 2, 6849 bcmCosqSubportCongestionTypeE2ecc = 3 6850 } bcm_cosq_subport_congestion_type_t; 6851 6852 /* Subport congestion config information structure. */ 6853 typedef struct bcm_cosq_subport_congestion_config_s { 6854 int subport_speed; /* Speed of the subport. */ 6855 int cos_to_pfc_map_profile_id; /* Index of the mapping in 6856 CH_PRIO2COS_PROFILE. */ 6857 uint32 status; /* 0 disable 1 enable. */ 6858 } bcm_cosq_subport_congestion_config_t; 6859 6860 /* Initialize a subport congestion config structure. */ 6861 extern void bcm_cosq_subport_congestion_config_t_init( 6862 bcm_cosq_subport_congestion_config_t *mapping); 6863 6864 #ifndef BCM_HIDE_DISPATCHABLE 6865 6866 /* 6867 * Configure the reception of congestion control (PAUSE, PFC and E2ECC) 6868 * on subport level 6869 */ 6870 extern int bcm_cosq_subport_congestion_config_set( 6871 int unit, 6872 bcm_gport_t gport, 6873 bcm_cosq_subport_congestion_type_t congestion_type, 6874 bcm_cosq_subport_congestion_config_t *congestion_config); 6875 6876 /* 6877 * Get the configured congestion control (PAUSE, PFC and E2ECC) info on 6878 * subport level 6879 */ 6880 extern int bcm_cosq_subport_congestion_config_get( 6881 int unit, 6882 bcm_gport_t gport, 6883 bcm_cosq_subport_congestion_type_t congestion_type, 6884 bcm_cosq_subport_congestion_config_t *congestion_config); 6885 6886 #endif /* BCM_HIDE_DISPATCHABLE */ 6887 6888 /* Total number of PFC controlled COSqs(L1 nodes) under each sub port. */ 6889 #define BCM_COSQ_SUBPORT_COS_COUNT 8 6890 6891 /* PFC class to subport COSq(L1 nodes) mapping structure. */ 6892 typedef struct bcm_subport_cos_to_pfc_pri_map_s { 6893 int cos_to_pfc_pri_low[BCM_COSQ_SUBPORT_COS_COUNT]; /* List of COSq(L1 nodes) that mapped to 6894 a Low priority PFC class. */ 6895 int cos_to_pfc_pri_high[BCM_COSQ_SUBPORT_COS_COUNT]; /* List of COSq(L1 nodes) that mapped to 6896 a High priority PFC class. */ 6897 } bcm_subport_cos_to_pfc_pri_map_t; 6898 6899 /* Initialize a subport COSq PFC class mapping structure. */ 6900 extern void bcm_subport_cos_to_pfc_pri_map_t_init( 6901 bcm_subport_cos_to_pfc_pri_map_t *cos_to_pfc_map); 6902 6903 #ifndef BCM_HIDE_DISPATCHABLE 6904 6905 /* 6906 * Set mapping of PFC class (LO and HIGH) to COSQs L1 nodes under a 6907 * subport. 6908 */ 6909 extern int bcm_cosq_subport_pfc_class_mapping_set( 6910 int unit, 6911 bcm_gport_t subport_gport, 6912 bcm_subport_cos_to_pfc_pri_map_t *cos_to_pfc_map, 6913 int *cos_to_pfc_map_profile_id); 6914 6915 /* 6916 * Get mapping of PFC class (LO and HIGH) to COSQs L1 nodes under a 6917 * subport. 6918 */ 6919 extern int bcm_cosq_subport_pfc_class_mapping_get( 6920 int unit, 6921 bcm_gport_t gport, 6922 bcm_subport_cos_to_pfc_pri_map_t *cos_to_pfc_map); 6923 6924 #endif /* BCM_HIDE_DISPATCHABLE */ 6925 6926 /* PFC deadlock recovery mode */ 6927 typedef enum bcm_cosq_pfc_dd_recovery_mode_e { 6928 bcmCosqPfcDdRecoveryModeTimer = 0, 6929 bcmCosqPfcDdRecoveryModePFCState = 1, 6930 bcmCosqPfcDdRecoveryModeMax = 2 6931 } bcm_cosq_pfc_dd_recovery_mode_t; 6932 6933 #ifndef BCM_HIDE_DISPATCHABLE 6934 6935 /* Set recovery moide in PFC deadlock */ 6936 extern int bcm_cosq_pfc_dd_recovery_mode_set( 6937 int unit, 6938 bcm_port_t port, 6939 bcm_cosq_pfc_dd_recovery_mode_t recovery_mode); 6940 6941 /* Get recovery moide in PFC deadlock */ 6942 extern int bcm_cosq_pfc_dd_recovery_mode_get( 6943 int unit, 6944 bcm_port_t port, 6945 bcm_cosq_pfc_dd_recovery_mode_t *recovery_mode); 6946 6947 #endif /* BCM_HIDE_DISPATCHABLE */ 6948 6949 /* Match attributes for MMU debug counter */ 6950 #define BCM_COSQ_DEBUG_STAT_MATCH_SRC_PORT 0x00000001 /* Select source port as 6951 a match attribute */ 6952 #define BCM_COSQ_DEBUG_STAT_MATCH_SRC_PIPE 0x00000002 /* Select source pipe as 6953 a match attribute. 6954 Source pipe number 6955 will be deduced from 6956 src_port */ 6957 #define BCM_COSQ_DEBUG_STAT_MATCH_DST_PORT 0x00000004 /* Select destination 6958 port as a match 6959 attribute */ 6960 #define BCM_COSQ_DEBUG_STAT_MATCH_DST_PIPE 0x00000008 /* Select destination 6961 pipe as a match 6962 attribute. Destination 6963 pipe number will be 6964 deduced from dst_port */ 6965 #define BCM_COSQ_DEBUG_STAT_MATCH_QUEUE 0x00000010 /* Select queue as a 6966 match attribute. UC/MC 6967 queue type will be 6968 deduced from queue 6969 number */ 6970 #define BCM_COSQ_DEBUG_STAT_MATCH_PRIORITY_GROUP 0x00000020 /* Select priority group 6971 as a match attribute */ 6972 6973 /* MMU debug counter match criteria */ 6974 typedef struct bcm_cosq_debug_stat_match_s { 6975 uint32 match_flags; /* Flags to indicate which packet attributes are 6976 selected as match for a certain MMU debug counter */ 6977 bcm_port_t src_port; /* Source port */ 6978 bcm_port_t dst_port; /* Destination port */ 6979 bcm_cos_queue_t cosq; /* Queue ID */ 6980 int priority_group_id; /* Priority group id */ 6981 } bcm_cosq_debug_stat_match_t; 6982 6983 /* Initialize MMU debug counter match structure */ 6984 extern void bcm_cosq_debug_stat_match_t_init( 6985 bcm_cosq_debug_stat_match_t *match); 6986 6987 #ifndef BCM_HIDE_DISPATCHABLE 6988 6989 /* Get MMU debug counter match configuration */ 6990 extern int bcm_cosq_debug_stat_match_get( 6991 int unit, 6992 bcm_port_t port, 6993 bcm_cosq_stat_t stat, 6994 bcm_cosq_debug_stat_match_t *match); 6995 6996 /* Set MMU debug counter match configuration */ 6997 extern int bcm_cosq_debug_stat_match_set( 6998 int unit, 6999 bcm_port_t port, 7000 bcm_cosq_stat_t stat, 7001 bcm_cosq_debug_stat_match_t *match); 7002 7003 #endif /* BCM_HIDE_DISPATCHABLE */ 7004 7005 #endif /* __BCM_COSQ_H__ */