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

bfcmap_stat.h (2903B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #ifndef BFCMAP_STATS_H
      9 #define BFCMAP_STATS_H
     10 
     11 struct bfcmap_port_ctrl_s;
     12 struct bfcmap_dev_ctrl_s;
     13 struct bfcmap_api_table_s;
     14 struct bfcmap_counter_info_s;
     15 struct bfcmap_counter_cb_s;
     16 
     17 typedef struct bfcmap_counter_info_s {
     18     bfcmap_stat_t    stat;
     19     buint32_t           address;
     20     buint16_t           delta;
     21 
     22 #define BFCMAP_COUNTER_F_PORT           0x01
     23 #define BFCMAP_COUNTER_F_SECURE_CHAN    0x02
     24 #define BFCMAP_COUNTER_F_SECURE_ASSOC   0x04
     25 #define BFCMAP_COUNTER_F_FLOW           0x08
     26 
     27 #define BFCMAP_COUNTER_F_MEM            0x10
     28 #define BFCMAP_COUNTER_F_REG            0x20
     29 
     30 #define BFCMAP_COUNTER_F_SIZE32         0x100
     31 #define BFCMAP_COUNTER_F_SIZE64         0x200
     32 
     33 #define BFCMAP_COUNTER_F_SW             0x1000
     34     buint16_t  flags;
     35 } bfcmap_counter_info_t;
     36 
     37 #define BFCMAP_COUNTER_F_NOT_IMPLEMENTED    0x8000
     38 
     39 /*
     40  * The following structure contains helper functions which are provided
     41  * by the chip implementation to common counter framework to comute the
     42  * correct counter address.
     43  */
     44 typedef int (*counter_get_assoc_idx)(struct bfcmap_port_ctrl_s*, int assocId);
     45 typedef int (*counter_get_chan_idx)(struct bfcmap_port_ctrl_s*, int chanId);
     46 
     47 typedef struct bfcmap_counter_cb_s {
     48     int                     num_chan;
     49     counter_get_chan_idx    get_chan_idx;
     50     int                     num_assoc;
     51     counter_get_assoc_idx   get_assoc_idx;
     52     int      (*hw_clear_port_counter)(struct bfcmap_port_ctrl_s*);
     53     int      (*sw_clear_port_counter)(struct bfcmap_port_ctrl_s*);
     54     int      (*sw_get_counter)(struct bfcmap_port_ctrl_s*, bfcmap_counter_info_t*,
     55                                int, int, buint32_t*, buint64_t*);
     56     int      (*sw_set_counter)(struct bfcmap_port_ctrl_s*, bfcmap_counter_info_t*,
     57                                int, int, buint32_t*, buint64_t*);
     58 } bfcmap_counter_cb_t;
     59 
     60 
     61 extern int 
     62 bfcmap_int_stat_clear(struct bfcmap_port_ctrl_s *mpc);
     63 
     64 extern int 
     65 bfcmap_int_stat_get(struct bfcmap_port_ctrl_s *mpc, bfcmap_stat_t stat, 
     66                         int chanId, int assocId, buint64_t *val);
     67 
     68 extern int 
     69 bfcmap_int_stat_get32(struct bfcmap_port_ctrl_s *mpc, bfcmap_stat_t stat, 
     70                           int chanId, int assocId, buint32_t *val);
     71 
     72 extern int 
     73 bfcmap_int_stat_set(struct bfcmap_port_ctrl_s *mpc, bfcmap_stat_t stat, 
     74                             int chanId, int assocId,  buint64_t val);
     75 
     76 extern int 
     77 bfcmap_int_stat_set32(struct bfcmap_port_ctrl_s *mpc,bfcmap_stat_t stat, 
     78                              int chanId, int assocId, buint32_t val);
     79 
     80 extern bfcmap_counter_info_t *
     81 bfcmap_int_stat_tbl_create(struct bfcmap_dev_ctrl_s*, 
     82                                  bfcmap_counter_info_t *stats_tbl);
     83 
     84 #endif /* BFCMAP_STATS_H */
     85