pstats.h (4081B)
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_PSTATS_H__ 14 #define __BCM_PSTATS_H__ 15 16 #if defined(INCLUDE_PSTATS) 17 18 #include <bcm/types.h> 19 20 /* PSTATS time stamp structure. */ 21 typedef struct bcm_pstats_timestamp_s { 22 uint64 seconds; /* Seconds */ 23 uint32 nanoseconds; /* Nanoseconds */ 24 } bcm_pstats_timestamp_t; 25 26 /* Definition for session element type. */ 27 typedef enum bcm_pstats_session_element_type_e { 28 bcmPStatsSessionUnicastQueue = 1, 29 bcmPStatsSessionIngPool = 2, 30 bcmPStatsSessionEgrPool = 3, 31 bcmPStatsSessionTypeCount = 4 /* Max value defined for this enum */ 32 } bcm_pstats_session_element_type_t; 33 34 /* PSTATS session element structure. */ 35 typedef struct bcm_pstats_session_element_s { 36 bcm_pstats_session_element_type_t type; /* Session element type */ 37 bcm_gport_t gport; /* UC queue gport */ 38 bcm_cos_queue_t cosq; /* Cos queue */ 39 bcm_service_pool_id_t pool; /* Service Pool ID */ 40 } bcm_pstats_session_element_t; 41 42 #define BCM_PSTATS_BUFFER_COUNT 8 /* PSTATS buffer count */ 43 44 /* PSTATS use counts sturcture. */ 45 typedef struct bcm_pstats_data_s { 46 uint32 array_count; /* Number of elements in array */ 47 uint32 use_counts_array[BCM_PSTATS_BUFFER_COUNT]; /* PSTATS use counts array */ 48 } bcm_pstats_data_t; 49 50 #define BCM_PSTATS_OPTIONS_WITH_ID 0x00000001 /* With ID option creation */ 51 #define BCM_PSTATS_OPTIONS_REPLACE 0x00000002 /* Replace existing entry */ 52 53 #ifndef BCM_HIDE_DISPATCHABLE 54 55 /* PSTATS session create API */ 56 extern int bcm_pstats_session_create( 57 int unit, 58 int options, 59 int array_count, 60 bcm_pstats_session_element_t *element_array, 61 bcm_pstats_session_id_t *session_id); 62 63 /* PSTATS session destroy API */ 64 extern int bcm_pstats_session_destroy( 65 int unit, 66 bcm_pstats_session_id_t session_id); 67 68 /* PSTATS session get API */ 69 extern int bcm_pstats_session_get( 70 int unit, 71 bcm_pstats_session_id_t session_id, 72 int array_max, 73 bcm_pstats_session_element_t *element_array, 74 int *array_count); 75 76 /* PSTATS session sync API */ 77 extern int bcm_pstats_data_sync( 78 int unit); 79 80 /* PSTATS session data get API */ 81 extern int bcm_pstats_session_data_get( 82 int unit, 83 bcm_pstats_session_id_t session_id, 84 bcm_pstats_timestamp_t *timestamp, 85 int array_max, 86 bcm_pstats_data_t *data_array, 87 int *array_count); 88 89 /* PSTATS session data sync get API */ 90 extern int bcm_pstats_session_data_sync_get( 91 int unit, 92 bcm_pstats_session_id_t session_id, 93 bcm_pstats_timestamp_t *timestamp, 94 int array_max, 95 bcm_pstats_data_t *data_array, 96 int *array_count); 97 98 /* PSTATS session data clear API */ 99 extern int bcm_pstats_session_data_clear( 100 int unit, 101 bcm_pstats_session_id_t session_id); 102 103 #endif /* BCM_HIDE_DISPATCHABLE */ 104 105 /* bcm_pstats_session_traverse_cb */ 106 typedef int (*bcm_pstats_session_traverse_cb)( 107 int unit, 108 bcm_pstats_session_id_t session_id, 109 int array_count, 110 bcm_pstats_session_element_t *element_array, 111 void *user_data); 112 113 #ifndef BCM_HIDE_DISPATCHABLE 114 115 /* Traverse through the pstats sessions and run callback at each session. */ 116 extern int bcm_pstats_session_traverse( 117 int unit, 118 bcm_pstats_session_traverse_cb cb, 119 void *user_data); 120 121 #endif /* BCM_HIDE_DISPATCHABLE */ 122 123 /* Initizalize a PSTATS timestamp structure. */ 124 extern void bcm_pstats_timestamp_t_init( 125 bcm_pstats_timestamp_t *timestamp); 126 127 /* Initizalize a PSTATS session element structure. */ 128 extern void bcm_pstats_session_element_t_init( 129 bcm_pstats_session_element_t *element); 130 131 /* Initizalize a PSTATS data structure. */ 132 extern void bcm_pstats_data_t_init( 133 bcm_pstats_data_t *data); 134 135 #endif /* defined(INCLUDE_PSTATS) */ 136 137 #endif /* __BCM_PSTATS_H__ */