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

pstats.h (3662B)


      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_PSTATS_H
     10 #define _BCM_PSTATS_H
     11 
     12 #if defined(INCLUDE_PSTATS)
     13 #include <soc/defs.h>
     14 #include <soc/types.h>
     15 
     16 typedef int (*_bcm_pstats_session_create_f)(int, int, int,
     17                                             bcm_pstats_session_element_t*,
     18                                             bcm_pstats_session_id_t*);
     19 typedef int (*_bcm_pstats_session_destroy_f)(int, bcm_pstats_session_id_t);
     20 typedef int (*_bcm_pstats_session_get_f)(int, bcm_pstats_session_id_t,
     21                                          int,
     22                                          bcm_pstats_session_element_t*,
     23                                          int*);
     24 typedef int (*_bcm_pstats_data_sync_f)(int);
     25 typedef int (*_bcm_pstats_session_data_get_f)(int, bcm_pstats_session_id_t,
     26                                               int,
     27                                               bcm_pstats_timestamp_t*,
     28                                               int,
     29                                               bcm_pstats_data_t*, int*);
     30 typedef int (*_bcm_pstats_session_data_clear_f)(int, bcm_pstats_session_id_t);
     31 
     32 #ifdef BCM_WARM_BOOT_SUPPORT
     33 typedef int (*_bcm_pstats_scache_size_get_f)(int, uint32*);
     34 typedef int (*_bcm_pstats_reinit_f)(int, uint8**);
     35 typedef int (*_bcm_pstats_sync_f)(int, uint8**);
     36 #endif
     37 typedef int (*_bcm_pstats_session_traverse_f)(int, bcm_pstats_session_traverse_cb,
     38                                               void*);
     39 
     40 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
     41 typedef void (*_bcm_pstats_sw_dump_f)(int);
     42 #endif
     43 
     44 typedef struct _bcm_pstats_unit_driver_s {
     45     sal_mutex_t                             pstats_lock;
     46     _bcm_pstats_session_create_f            session_create;
     47     _bcm_pstats_session_destroy_f           session_destroy;
     48     _bcm_pstats_session_get_f               session_get;
     49     _bcm_pstats_data_sync_f                 data_sync;
     50     _bcm_pstats_session_data_get_f          session_data_get;
     51     _bcm_pstats_session_data_clear_f        session_data_clear;
     52 
     53 #ifdef BCM_WARM_BOOT_SUPPORT
     54     _bcm_pstats_scache_size_get_f           scache_size_get;
     55     _bcm_pstats_reinit_f                    pstats_reinit;
     56     _bcm_pstats_sync_f                      pstats_sync;
     57 #endif
     58     _bcm_pstats_session_traverse_f          session_traverse;
     59 
     60 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
     61     _bcm_pstats_sw_dump_f                   pstats_sw_dump;
     62 #endif
     63 } _bcm_pstats_unit_driver_t;
     64 
     65 extern _bcm_pstats_unit_driver_t *_bcm_pstats_unit_driver[BCM_MAX_NUM_UNITS];
     66 #define _BCM_PSTATS_UNIT_DRIVER(u) _bcm_pstats_unit_driver[(u)]
     67 
     68 #define PSTATS_LOCK(u)\
     69         do {\
     70             if (_BCM_PSTATS_UNIT_DRIVER(u)->pstats_lock){\
     71                 sal_mutex_take(_BCM_PSTATS_UNIT_DRIVER(u)->pstats_lock,\
     72                                sal_mutex_FOREVER);\
     73             }\
     74         }while(0)
     75 #define PSTATS_UNLOCK(u)\
     76         do {\
     77             if (_BCM_PSTATS_UNIT_DRIVER(u)->pstats_lock){\
     78                 sal_mutex_give(_BCM_PSTATS_UNIT_DRIVER(u)->pstats_lock);\
     79             }\
     80         }while(0)
     81 
     82 extern int _bcm_pstats_init(int unit);
     83 extern void _bcm_pstats_deinit(int unit);
     84 
     85 #ifdef BCM_WARM_BOOT_SUPPORT
     86 extern int _bcm_esw_pstats_scache_size_get(int unit, uint32 *scache_size);
     87 extern int _bcm_esw_pstats_reinit(int unit, uint8 **scache_ptr);
     88 extern int _bcm_esw_pstats_sync(int unit, uint8 **scache_ptr);
     89 #endif
     90 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
     91 extern void _bcm_esw_pstats_sw_dump(int unit);
     92 #endif
     93 
     94 #endif /* INCLUDE_PSTATS */
     95 #endif /* _BCM_PSTATS_H */