openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

cosq.h (265257B)


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