sum.h (3501B)
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 */ 9 10 #ifndef __BCM_SUM_H__ 11 #define __BCM_SUM_H__ 12 13 #include <bcm/types.h> 14 15 /* SUM counter types */ 16 typedef enum bcm_sum_type_e { 17 bcmSumTypeTxPktCnt = 0, /* SUM monitors Tx packet counters. */ 18 bcmSumTypeRxPktCnt = 1, /* SUM monitors Rx packet counters. */ 19 bcmSumTypeTxByteCnt = 2, /* SUM monitors Tx byte counters. */ 20 bcmSumTypeRxByteCnt = 3, /* SUM monitors Rx byte counters. */ 21 bcmSumTypeTxPktByteCnt = 4, /* SUM monitors Tx packet, Tx byte counters. */ 22 bcmSumTypeRxPktByteCnt = 5, /* SUM monitors Rx packet, Rx byte counters. */ 23 bcmSumTypeRxTxPktCnt = 6, /* SUM monitors Tx/Rx packet counters. */ 24 bcmSumTypeRxTxByteCnt = 7, /* SUM monitors Tx/Rx byte counters. */ 25 bcmSumTypeTxRxPktByteCnt = 8, /* SUM monitors all Tx packet, Tx byte, Rx 26 packet, Rx byte counters. */ 27 bcmSumTypeMax = 9 /* Maximum Counter Type. */ 28 } bcm_sum_type_t; 29 30 /* SUM stats information types */ 31 typedef enum bcm_sum_stat_type_e { 32 bcmSumPeakUsageInfo = 0, /* SUM Peak usage information. */ 33 bcmSumMinimumUsageInfo = 1, /* SUM Minimum usage information. */ 34 bcmSumUsageInfo = 2 /* SUM user requested number, of usage history. */ 35 } bcm_sum_stat_type_t; 36 37 /* SUM Configuration information. */ 38 typedef struct bcm_sum_config_s { 39 uint32 usec_sample_interval; /* sample data interval */ 40 uint32 max_history; /* maximum samples number of history */ 41 bcm_sum_type_t sum_type; /* sum type */ 42 } bcm_sum_config_t; 43 44 /* SUM stats data. */ 45 typedef struct bcm_sum_stat_info_s { 46 uint64 sequence_num; /* This is running global number update for 47 every entry for unique identification. */ 48 uint64 time_stamp; /* Sample time stamp. */ 49 uint64 tx_pkt_count; /* Tx packet count. */ 50 uint64 rx_pkt_count; /* Rx packet count. */ 51 uint64 tx_byte_count; /* Tx byte count. */ 52 uint64 rx_byte_count; /* Rx byte count. */ 53 bcm_sum_type_t sum_type; /* sum type */ 54 } bcm_sum_stat_info_t; 55 56 #ifndef BCM_HIDE_DISPATCHABLE 57 58 /* Initializes sum subsystem. */ 59 extern int bcm_sum_init( 60 int unit); 61 62 /* Detaches sum subsystem. */ 63 extern int bcm_sum_detach( 64 int unit); 65 66 #endif /* BCM_HIDE_DISPATCHABLE */ 67 68 /* Initialize a config information structure. */ 69 extern void bcm_sum_config_t_init( 70 bcm_sum_config_t *config_data); 71 72 /* Initialize SUM usage stats information structure */ 73 extern void bcm_sum_stat_info_t_init( 74 bcm_sum_stat_info_t *stat_data); 75 76 #ifndef BCM_HIDE_DISPATCHABLE 77 78 /* Set a Switch Utilization Monitor configuration information. */ 79 extern int bcm_sum_config_set( 80 int unit, 81 bcm_sum_config_t *config_data, 82 bcm_pbmp_t pbmp); 83 84 /* Get a Switch Utilization Monitor Configuration information. */ 85 extern int bcm_sum_config_get( 86 int unit, 87 bcm_sum_config_t *config_data, 88 bcm_pbmp_t *pbmp); 89 90 /* Get a Switch Utilization Monitor Statics information. */ 91 extern int bcm_sum_stat_get( 92 int unit, 93 uint32 max_samples, 94 bcm_sum_stat_info_t *stats_data, 95 uint32 *num_samples, 96 bcm_sum_stat_type_t stat_type, 97 uint32 usec_sample_period); 98 99 #endif /* BCM_HIDE_DISPATCHABLE */ 100 101 #endif /* __BCM_SUM_H__ */