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

bst.h (21762B)


      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-2019 Broadcom Inc. All rights reserved.
      7  */
      8 
      9 #ifndef _BCM_BST_H
     10 #define _BCM_BST_H
     11 
     12 #include <soc/defs.h>
     13 #include <soc/types.h>
     14 #include <bcm/cosq.h>
     15 
     16 #ifdef BCM_TOMAHAWK3_SUPPORT
     17 #define _BCM_MAX_PIPES              8
     18 #define _BCM_MAX_THD_REGS           8
     19 #define _BCM_MAX_PROFILES           8
     20 #define _BCM_MAX_PROFILE_REGS       4
     21 #define _BCM_MAX_REGS_PER_PROFILE   2
     22 #define _BCM_BST_MAX_FIELDS         8
     23 #else
     24 #define _BCM_MAX_PIPES              4
     25 #define _BCM_MAX_XPES               4
     26 #define _BCM_MAX_THD_REGS           8
     27 #define _BCM_MAX_PROFILES           4
     28 #define _BCM_MAX_PROFILE_REGS       4
     29 #define _BCM_MAX_REGS_PER_PROFILE   2
     30 #endif
     31 
     32 typedef enum {
     33     _bcmResourceDevice  = 0,
     34     _bcmResourceEgrPool,
     35     _bcmResourceEgrMCastPool,
     36     _bcmResourceIngPool,
     37     _bcmResourcePortPool,
     38     _bcmResourcePriGroupShared,
     39     _bcmResourcePriGroupHeadroom,
     40     _bcmResourceUcast,
     41     _bcmResourceMcast,
     42     _bcmResourceHeadroomPool,
     43     _bcmResourceEgrPortPoolSharedUcast,
     44     _bcmResourceEgrPortPoolSharedMcast,
     45     _bcmResourceBstStatIdQueueTotal,
     46     _bcmResourceRQEQueue,
     47     _bcmResourceRQEPool,
     48     _bcmResourceUCQueueGroup,
     49     _bcmResourceMaxCount
     50 } _bcm_bst_resource_t;
     51 
     52 typedef enum _bcm_bst_cb_ret_e {
     53     _BCM_BST_RV_OK  = 0,
     54     _BCM_BST_RV_RETRY,
     55     _BCM_BST_RV_ERROR
     56 } _bcm_bst_cb_ret_t;
     57 
     58 typedef enum _bcm_bst_snapshot_mode_e {
     59     _BCM_BST_SNAPSHOT_THDO,
     60     _BCM_BST_SNAPSHOT_THDI,
     61     _BCM_BST_SNAPSHOT_CFAP,
     62     _BCM_BST_SNAPSHOT_COUNT
     63 } _bcm_bst_snapshot_mode_t;
     64 
     65 typedef enum _bcm_bst_thread_oper_e {
     66     _bcmBstThreadOperExternal = 0, /* External Operation to Start/Kill
     67                                     * the BST Thread. */
     68     _bcmBstThreadOperInternal = 1  /* Internal Operation to Pause/Resume
     69                                     * the BST Thread */
     70 } _bcm_bst_thread_oper_t;
     71 
     72 /*
     73  * _bcm_bst_device_index_resolve callback is used if device
     74  * bst API uses the common implementation. This callback queries
     75  * the device implementation to resolve the gport, cosq to
     76  * bst resource, along with the index ranges. also device implementation
     77  * can return a reason code retry to call tresolve again if the
     78  * indexes are not contiguous or to map multiple resources.
     79  */
     80 typedef _bcm_bst_cb_ret_t (*_bcm_bst_device_index_resolve)(int unit,
     81                                          bcm_gport_t gport, bcm_cos_queue_t cosq,
     82                                          bcm_bst_stat_id_t bid,
     83                                          int *pipe, int *from_hw_index, 
     84                                          int *to_hw_index, int *rcb_data, 
     85                                          void **user_data, int *bcm_rv);
     86 
     87 typedef int (*_bcm_bst_device_index_map)(int unit,
     88             bcm_bst_stat_id_t bid, int port, int index, bcm_gport_t *gport, bcm_cos_t *cosq);
     89 
     90 typedef struct _bcm_bst_device_handlers_s {
     91     _bcm_bst_device_index_resolve resolve_index;
     92     _bcm_bst_device_index_map     reverse_resolve_index;
     93 } _bcm_bst_device_handlers_t;
     94 
     95 extern int _bcm_bst_attach(int unit, _bcm_bst_device_handlers_t *cbs);
     96 
     97 extern int _bcm_bst_detach(int unit);
     98 
     99 extern int
    100 _bcm_bst_cmn_profile_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    101                          int xpe, bcm_bst_stat_id_t bid, 
    102                          bcm_cosq_bst_profile_t *profile);
    103 
    104 extern int
    105 _bcm_bst_cmn_profile_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    106                          int xpe, bcm_bst_stat_id_t bid, 
    107                          bcm_cosq_bst_profile_t *profile);
    108 
    109 extern int _bcm_bst_cmn_control_set(int unit, bcm_switch_control_t type, int arg);
    110 
    111 extern int _bcm_bst_cmn_control_get(int unit, bcm_switch_control_t type, int *arg);
    112 
    113 extern int
    114 _bcm_bst_cmn_stat_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    115                       bcm_cosq_buffer_id_t buffer_id, bcm_bst_stat_id_t bid,
    116                       uint32 options, uint64 *pvalue);
    117 
    118 extern int _bcm_bst_cmn_stat_sync(int unit, bcm_bst_stat_id_t bid);
    119 
    120 extern int 
    121 _bcm_bst_cmn_stat_multi_get(int unit, bcm_gport_t port, bcm_cos_queue_t cosq,
    122                             uint32 options, int max_values,
    123                             bcm_bst_stat_id_t *id_list, uint64 *pvalues);
    124 extern int 
    125 _bcm_bst_cmn_stat_clear(int unit, bcm_gport_t port, bcm_cos_queue_t cosq, 
    126                         bcm_bst_stat_id_t bid);
    127 
    128 #define BST_OP_GET  0x1
    129 #define BST_OP_SET  0x2
    130 #define BST_OP_THD  0x4
    131 /* cfg/stat on different xpes are same */
    132 #define BCM_BST_DUP_XPE     -1
    133 /* cfg/stat on different xpes could be different */
    134 #define BCM_BST_MLT_XPE     -2
    135 
    136 typedef struct _bcm_bst_resource_info_s {
    137     int         valid;
    138     uint32      flags;
    139     soc_pbmp_t  pbmp;
    140     soc_mem_t   stat_mem[_BCM_MAX_PIPES];
    141     soc_reg_t   stat_reg[_BCM_MAX_PIPES];
    142     soc_field_t stat_field;
    143 #ifdef BCM_TOMAHAWK3_SUPPORT
    144     soc_field_t stat_fields[_BCM_BST_MAX_FIELDS];
    145     int         num_field;
    146     soc_field_t thd_fields[_BCM_BST_MAX_FIELDS];
    147     int         num_profile_reg;
    148 #endif
    149     int         threshold_adj;
    150     int         threshold_gran; /* Granularity of cells */
    151     soc_mem_t   threshold_mem[_BCM_MAX_PIPES];
    152     soc_mem_t   threshold_reg[_BCM_MAX_THD_REGS];
    153     soc_field_t threshold_field;
    154 
    155     soc_mem_t   profile_mem;
    156     soc_mem_t   profile_reg[_BCM_MAX_PROFILE_REGS];
    157     soc_field_t profile_field;
    158 
    159     soc_profile_reg_t  iprofile_r[_BCM_MAX_PROFILES];
    160     soc_profile_reg_t  *profile_r[_BCM_MAX_PROFILES];
    161     soc_profile_mem_t  iprofile_m;
    162     soc_profile_mem_t  *profile_m;
    163 
    164     int                 index_min;
    165     int                 index_max;
    166 
    167     uint32              *p_stat;
    168     uint32              *p_threshold;
    169     int                 num_instance; /* total instances of this resource */
    170     int                 num_stat_pp;
    171 } _bcm_bst_resource_info_t;
    172 
    173 typedef struct _bcm_bst_tbl_ctrl {
    174     soc_block_t blk;
    175     uint32 tindex;
    176     uint32 entries;
    177     uint8 *buff;
    178     uint32 size;
    179 } _bcm_bst_tbl_ctrl_t;
    180 
    181 typedef struct _bcm_bst_tbl_desc {
    182     soc_mem_t mem;
    183     soc_reg_t reg;
    184     uint32 flags;
    185     int acc_type;
    186     uint32 blk;
    187     uint32 addr;
    188     uint32 width;
    189     uint32 entries;
    190     uint32 shift;
    191 } _bcm_bst_tbl_desc_t;
    192 
    193 typedef int (*_bcm_bst_byte_to_cell)(int unit, uint32 byte);
    194 
    195 typedef int (*_bcm_bst_cell_to_byte)(int unit, uint32 cell);
    196 
    197 typedef int (*_bcm_bst_control_set)(int unit, bcm_switch_control_t type,
    198                                     int arg, _bcm_bst_thread_oper_t operation);
    199 typedef int (*_bcm_bst_control_get)(int unit, bcm_switch_control_t type,
    200                                     int *arg);
    201 
    202 typedef int (*_bcm_bst_pre_sync_cb)(int unit, bcm_bst_stat_id_t bid,
    203              int *sync_val);
    204 typedef int (*_bcm_bst_post_sync_cb)(int unit, bcm_bst_stat_id_t bid,
    205              int sync_val);
    206 
    207 typedef int (*_bcm_bst_intr_to_resources_cb)(int unit, uint32 *flags);
    208 typedef int (*_bcm_bst_hw_trigger_set)(int unit, bcm_bst_stat_id_t bid);
    209 typedef int (*_bcm_bst_hw_trigger_reset)(int unit, bcm_bst_stat_id_t bid);
    210 typedef int (*_bcm_bst_hw_intr_cb)(int unit);
    211 typedef int (*_bcm_bst_hw_sbusdma_desc_init)(int unit);
    212 typedef int (*_bcm_bst_hw_sbusdma_desc_deinit)(int unit);
    213 typedef int (*_bcm_bst_hw_sbusdma_desc_sync)(int unit);
    214 typedef int (*_bcm_bst_intr_enable_set)(int unit, int enable);
    215 typedef int (*_bcm_bst_hw_stat_snapshot)(int unit, bcm_bst_stat_id_t bid,
    216                                          int port, int index);
    217 typedef int (*_bcm_bst_hw_stat_clear_t)(int unit,
    218                                         _bcm_bst_resource_info_t *resInfo,
    219                                         bcm_bst_stat_id_t bid, int port,
    220                                         int index);
    221 typedef int (*_bcm_bst_port_mmu_inst_map_t)(int unit, bcm_bst_stat_id_t bid,
    222                                             bcm_gport_t gport,
    223                                             uint32 *mmu_inst_map);
    224 typedef int (*_bcm_bst_cmn_io_op_t)(int unit, int op, int pipe, int hw_index,
    225                                     bcm_bst_stat_id_t bid, soc_mem_t mem,
    226                                     soc_reg_t reg, soc_field_t field,
    227                                     uint32 *resval);
    228 typedef int (*_bcm_bst_profile_init)(int unit);
    229 typedef int (*_bcm_bst_thd_get)(int unit, int pipe, int xpe, int hw_index, 
    230                 bcm_bst_stat_id_t bid, bcm_cosq_bst_profile_t *profile);
    231 typedef int (*_bcm_bst_thd_set)(int unit, int pipe, int xpe, int hw_index, 
    232                 bcm_bst_stat_id_t bid, bcm_cosq_bst_profile_t *profile, 
    233                 uint32 *p_profile);
    234 
    235 #define _BCM_BST_SYNC_F_ENABLE          0x1 /* Flag to Pause/Run the thread */
    236 #define _BCM_BST_SYNC_F_THREAD_VALID    0x2 /* Flag for existence of thread */
    237 
    238 typedef struct _bcm_bst_cmn_unit_info_s {
    239     uint32                          max_bytes;
    240     _bcm_bst_byte_to_cell           to_cell;
    241     _bcm_bst_cell_to_byte           to_byte;
    242     _bcm_bst_control_set            control_set;
    243     _bcm_bst_control_get            control_get;
    244     _bcm_bst_resource_info_t        resource_tbl[bcmBstStatIdMaxCount];
    245     _bcm_bst_device_handlers_t      handlers;
    246     _bcm_bst_pre_sync_cb            pre_sync;
    247     _bcm_bst_post_sync_cb           post_sync;
    248     _bcm_bst_intr_to_resources_cb   intr_to_resources;
    249     _bcm_bst_hw_trigger_set         hw_trigger_set;
    250     _bcm_bst_hw_trigger_reset       hw_trigger_reset;
    251     _bcm_bst_hw_intr_cb             hw_intr_cb;
    252     _bcm_bst_hw_sbusdma_desc_init   hw_sbusdma_desc_init;
    253     _bcm_bst_hw_sbusdma_desc_deinit hw_sbusdma_desc_deinit;
    254     _bcm_bst_hw_sbusdma_desc_sync   hw_sbusdma_desc_sync;
    255     _bcm_bst_intr_enable_set        intr_enable_set;
    256     _bcm_bst_hw_stat_snapshot       hw_stat_snapshot;
    257     _bcm_bst_hw_stat_clear_t        hw_stat_clear;
    258     _bcm_bst_port_mmu_inst_map_t    port_to_mmu_inst_map; /* Maps a pipe for
    259                                                            * given resource to
    260                                                            * MMU instances */
    261     _bcm_bst_cmn_io_op_t            bst_cmn_io_op;
    262     _bcm_bst_profile_init           profile_init;
    263     _bcm_bst_thd_get                thd_get;
    264     _bcm_bst_thd_set                thd_set;
    265 
    266     sal_sem_t                       bst_trigger;
    267     sal_sem_t                       bst_thread;
    268     int                             sync_flags;
    269     sal_thread_t                    bst_thread_id;
    270     int                             interval;
    271     sal_mutex_t                     bst_reslock;
    272     int                             mode;
    273     /*
    274      * mode = 0, 1 SHARED and 8 HEADROOM
    275      * mode = 1, 8 SHARED and 1 HEADROOM 
    276      */
    277     int                             track_mode;
    278     int                             snapshot_mode;
    279     int                             hw_cor_in_max_use_count;
    280     int                             bst_tbl_size;
    281     int                             bst_tbl_num;
    282     uint8                           *bst_tbl_buf;
    283     _bcm_bst_tbl_desc_t             *bst_tbl_desc;
    284 #ifdef BCM_TOMAHAWK3_SUPPORT
    285     int                             bst_tracking_enable;
    286 #endif
    287 } _bcm_bst_cmn_unit_info_t;
    288 
    289 extern _bcm_bst_cmn_unit_info_t *_bcm_bst_unit_info[BCM_MAX_NUM_UNITS];
    290 
    291 #define _BCM_UNIT_BST_INFO(u) _bcm_bst_unit_info[(u)]
    292 
    293 #define _BCM_BST_RESOURCE(u,r) (&((_bcm_bst_unit_info[(u)])->resource_tbl[(r)]))
    294 
    295 extern sbusdma_desc_handle_t bst_tbl_handles[BCM_MAX_NUM_UNITS];
    296 #define _BCM_UNIT_TBL_HANDLE(u) bst_tbl_handles[(u)]
    297 
    298 extern _bcm_bst_tbl_ctrl_t **bst_tbl_ctrl[BCM_MAX_NUM_UNITS];
    299 #define _BCM_UNIT_TBL_CTRL(u) bst_tbl_ctrl[(u)]
    300 
    301 #define _BCM_BST_RESOURCE_VALID(pr)     (pr)->valid
    302 
    303 #define _BCM_BST_STAT_THRESHOLD_INFO_INIT(pe)        \
    304     do {                                             \
    305         int i = 0;                                   \
    306         for (i = 0; i < _BCM_MAX_PIPES; i++) {       \
    307             (pe)->stat_mem[i] = (INVALIDm);          \
    308             (pe)->stat_reg[i] = (INVALIDr);          \
    309             (pe)->threshold_mem[i] = (INVALIDm);     \
    310         }                                            \
    311         for (i = 0; i < _BCM_MAX_THD_REGS; i++) {    \
    312             (pe)->threshold_reg[i] = (INVALIDr);     \
    313         }                                            \
    314         (pe)->stat_field = (INVALIDf);               \
    315         (pe)->threshold_field = (INVALIDf);          \
    316         (pe)->threshold_gran = (1);                  \
    317     } while(0);
    318 
    319 #ifdef BCM_TOMAHAWK3_SUPPORT
    320 #define _BCM_BST_STAT_FIELD_INFO(pe, sf, i)\
    321             (pe)->stat_fields[(i)] = (sf);\
    322             ((pe)->num_field)++;
    323 
    324 #define _BCM_BST_THD_FIELD_INFO(pe, tf, i)\
    325             (pe)->thd_fields[(i)] = (tf);
    326 #endif
    327 #define _BCM_BST_STAT_INFO(pe,smem,sreg,sf)     \
    328             (pe)->stat_mem[0] = (smem);         \
    329             (pe)->stat_reg[0] = (sreg);         \
    330             (pe)->stat_mem[1] = INVALIDm;       \
    331             (pe)->stat_reg[1] = INVALIDr;       \
    332             (pe)->stat_field = (sf);
    333 
    334 #define _BCM_BST_STAT_INFO2(pe,smem1,smem2,sreg1,sreg2,sf)     \
    335             (pe)->stat_mem[0] = (smem1);         \
    336             (pe)->stat_reg[0] = (sreg1);         \
    337             (pe)->stat_mem[1] = (smem2);         \
    338             (pe)->stat_reg[1] = (sreg2);         \
    339             (pe)->stat_field = (sf);
    340 
    341 #define _BCM_BST_STAT_INFO_N(pe,smem,sreg,sf,n) \
    342             (pe)->stat_mem[n] = (smem);         \
    343             (pe)->stat_reg[n] = (sreg);         \
    344             (pe)->stat_field = (sf);
    345 
    346 #define _BCM_BST_THRESHOLD_INFO(pe,pmem,preg,pf,gran)       \
    347             (pe)->threshold_mem[0] = (pmem);                \
    348             (pe)->threshold_reg[0] = (preg);                \
    349             (pe)->threshold_mem[1] = INVALIDm;              \
    350             (pe)->threshold_reg[1] = INVALIDr;              \
    351             (pe)->threshold_field = (pf);                   \
    352             (pe)->threshold_gran = (gran);
    353 
    354 #define _BCM_BST_THRESHOLD_INFO2(pe,pmem1,pmem2,preg1,preg2,pf,gran) \
    355             (pe)->threshold_mem[0] = (pmem1);                        \
    356             (pe)->threshold_reg[0] = (preg1);                        \
    357             (pe)->threshold_mem[1] = (pmem2);                        \
    358             (pe)->threshold_reg[1] = (preg2);                        \
    359             (pe)->threshold_field = (pf);                            \
    360             (pe)->threshold_gran = (gran);
    361 
    362 #define _BCM_BST_THRESHOLD_INFO_N(pe,pmem,preg,pf,gran,n)       \
    363             (pe)->threshold_mem[n%_BCM_MAX_PIPES] = (pmem);     \
    364             (pe)->threshold_reg[n]  = (preg);                   \
    365             (pe)->threshold_gran    = (gran);                   \
    366             (pe)->threshold_field   = (pf);
    367 
    368 #define _BCM_BST_PROFILE_INFO(pe,pmem,preg,pf)       \
    369             (pe)->profile_mem    = (pmem);           \
    370             (pe)->profile_reg[0] = (preg);           \
    371             (pe)->profile_field  = (pf);
    372 
    373 #define _BCM_BST_PROFILE_INFO_N(pe,pmem,preg,pf,n)   \
    374             (pe)->profile_mem    = (pmem);           \
    375             (pe)->profile_reg[n] = (preg);           \
    376             (pe)->profile_field  = (pf);
    377 
    378 #define _BCM_BST_CMN_RES_F_PROFILEID    0x01
    379 #define _BCM_BST_CMN_RES_F_PIPED        0x02
    380 /* Following flags for Resource Classification (Dev/Ing/Egr) */
    381 #define _BCM_BST_CMN_RES_F_RES_DEV      0x04
    382 #define _BCM_BST_CMN_RES_F_RES_ING      0x08
    383 #define _BCM_BST_CMN_RES_F_RES_EGR      0x10
    384 /* Following flags for special bst process */
    385 #define _BCM_BST_CMN_RES_F_PORTED       0x20
    386 
    387 #define _BCM_BST_RESOURCE_FLAG_SET(pe,rflags)        \
    388             (pe)->flags = (rflags);                  \
    389             (pe)->valid = 1;
    390 
    391 #define _BCM_BST_RESOURCE_STAT_INIT(pres, num, rname)                       \
    392     do {                                                                    \
    393         if ((pres)->p_stat == NULL) {                                       \
    394             (pres)->p_stat = sal_alloc((num)*sizeof(uint32), (rname));      \
    395             if ((pres)->p_stat == NULL) {                                   \
    396                 return (BCM_E_MEMORY);                                      \
    397             }                                                               \
    398         }                                                                   \
    399         sal_memset((pres)->p_stat, 0, sizeof(uint32)*(num));                \
    400         (pres)->num_stat_pp = (num);                                        \
    401     } while (0);
    402 
    403 #define _BCM_BST_RESOURCE_THRESHOLD_INIT(pres, num, rname)                  \
    404     do {                                                                    \
    405         if ((pres)->p_threshold == NULL) {                                  \
    406             (pres)->p_threshold = sal_alloc((num)*sizeof(uint32), (rname)); \
    407             if ((pres)->p_threshold == NULL) {                              \
    408                 return (BCM_E_PARAM);                                       \
    409             }                                                               \
    410         }                                                                   \
    411         sal_memset((pres)->p_threshold, 0, (num)*sizeof(uint32));           \
    412     } while (0);
    413 
    414 #define _BCM_BST_RESOURCE_PBMP_SET(pe,pbm)      (pe)->pbmp = (pbm)
    415 
    416 #define _BCM_BST_RESOURCE_MIN       bcmBstStatIdDevice
    417 #define _BCM_BST_RESOURCE_MAX       bcmBstStatIdMaxCount
    418 
    419 #define _BCM_BST_RESOURCE_ITER(bi, bid)             \
    420         for (bid = _BCM_BST_RESOURCE_MIN;           \
    421              bid < _BCM_BST_RESOURCE_MAX; bid++)
    422 
    423 #define _BCM_BST_SYNC_ENABLED(bi)   \
    424         (((bi)->sync_flags & _BCM_BST_SYNC_F_ENABLE) ? 1 : 0)
    425 
    426 #define _BCM_BST_SYNC_THREAD_VALID(bi)   \
    427         (((bi)->sync_flags & _BCM_BST_SYNC_F_THREAD_VALID) ? 1 : 0)
    428 
    429 #define _BCM_BST_SYNC_THREAD_ENABLE_SET(u,status)        \
    430     if (status == 1) {                               \
    431         _bcm_bst_unit_info[(u)]->sync_flags |= _BCM_BST_SYNC_F_ENABLE; \
    432     } else { \
    433         _bcm_bst_unit_info[(u)]->sync_flags &= ~_BCM_BST_SYNC_F_ENABLE; \
    434     }
    435     
    436 /* Set BST threshold to Max High(0x1ffff) when BST function is disabled */
    437 #define BST_THRESHOLD_MAX_HIGH       0x1ffff
    438 #define BST_THRESHOLD_INVALID       0xffffffff
    439 
    440 extern int _bcm_bst_sync_thread_start(int unit);
    441 extern int _bcm_bst_sync_thread_stop(int unit);
    442 extern int _bst_intr_enable_set(int unit, int enable);
    443 extern int _bcm_bst_hw_event_cb(int unit);
    444 extern int _bst_intr_status_reset(int unit);
    445 extern int _bcm_bst_sync_hw_trigger(int unit, bcm_bst_stat_id_t bid,
    446                                     int port, int index);
    447 extern int _bcm_bst_sync_hw_snapshot(int unit, bcm_bst_stat_id_t bid,
    448                                      int port, int index);
    449 extern int _bcm_bst_hw_stat_clear(int unit,
    450                                   _bcm_bst_resource_info_t *resInfo,
    451                                   bcm_bst_stat_id_t bid, int port, int index);
    452 extern int soc_bst_sbusdma_desc_setup(int unit);
    453 extern int soc_bst_sbusdma_desc_free(int unit);
    454 extern int soc_bst_hw_sbusdma_desc_sync(int unit);
    455 
    456 
    457 #if defined(BCM_TOMAHAWK_SUPPORT)
    458 #define _BCM_BST_TH_CPU_QUEUE_START 330
    459 #define _BCM_BST_TH_IS_CPU_QUEUE(q) \
    460             (330 <= q && q <= 377)
    461 
    462 extern int bcm_bst_th_init(int unit);
    463 #endif /* BCM_TOMAHAWK_SUPPORT */
    464 #ifdef BCM_HELIX5_SUPPORT
    465 extern int bcm_bst_hx5_init(int unit);
    466 #endif /* BCM_HELIX5_SUPPORT */
    467 #if defined(BCM_TRIDENT3_SUPPORT)
    468 extern int bcm_bst_td3_init(int unit);
    469 #endif /* BCM_TRIDENT3_SUPPORT */
    470 #if defined(BCM_TOMAHAWK3_SUPPORT)
    471 extern int bcm_bst_th3_init(int unit);
    472 extern _bcm_bst_cb_ret_t
    473 bcm_bst_th3_index_resolve(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    474                           bcm_bst_stat_id_t bid, int *pipe, int *start_hw_index,
    475                           int *end_hw_index, int *rcb_data, void **cb_data, int *bcm_rv);
    476 
    477 int bcm_th3_cosq_headroom_pool_get(int unit, bcm_gport_t gport,
    478                                                  int priority, int *pool_id);
    479 
    480 int
    481 bcm_th3_cosq_ing_service_pool_get(int unit, bcm_port_t port,
    482                                                  int pg, int *pool_id);
    483 int bcm_th3_cosq_bst_stat_clear(int unit, bcm_gport_t gport,
    484                                bcm_cos_queue_t cosq, bcm_cosq_buffer_id_t buffer,
    485                                bcm_bst_stat_id_t bid);
    486 
    487 
    488 int
    489 bcm_th3_cosq_bst_stat_get(
    490     int unit,
    491     bcm_gport_t gport,
    492     bcm_cos_queue_t cosq,
    493     bcm_cosq_buffer_id_t buffer,
    494     bcm_bst_stat_id_t bid,
    495     uint32 options,
    496     uint64 *pvalue);
    497 
    498 int
    499 bcm_th3_cosq_bst_stat_multi_get(int unit,
    500                                bcm_gport_t gport,
    501                                bcm_cos_queue_t cosq,
    502                                uint32 options,
    503                                int max_values,
    504                                bcm_bst_stat_id_t *id_list,
    505                                uint64 *pvalues);
    506 int
    507 bcm_bst_th3_sw_stat_clear(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    508                        bcm_cosq_buffer_id_t buffer, bcm_bst_stat_id_t bid);
    509 int
    510 bcm_bst_th3_hw_stat_clear(int unit, _bcm_bst_resource_info_t *resInfo,
    511                 bcm_bst_stat_id_t bid, bcm_cosq_buffer_id_t buffer,
    512                                                     int port, int index,
    513                                                     int cosq);
    514 
    515 extern int
    516 _bcm_th3_bst_cmn_profile_set (int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    517         int buffer, bcm_bst_stat_id_t bid, bcm_cosq_bst_profile_t *profile);
    518 
    519 extern int
    520 _bcm_th3_bst_cmn_profile_get (int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    521         int buffer, bcm_bst_stat_id_t bid, bcm_cosq_bst_profile_t *profile);
    522 
    523 extern int
    524 _bcm_th3_cosq_bst_map_resource_to_gport_cos(int unit,
    525     bcm_bst_stat_id_t bid, int port, int index, bcm_gport_t *gport,
    526     bcm_cos_t *cosq);
    527  
    528 
    529 #endif /* BCM_TOMAHAWK3_SUPPORT */
    530 
    531 #endif /* _BCM_BST_H */
    532