telemetry.h (4686B)
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_TELEMETRY_H__ 11 #define __BCM_TELEMETRY_H__ 12 13 #include <bcm/types.h> 14 #include <bcm/collector.h> 15 16 #ifndef BCM_HIDE_DISPATCHABLE 17 18 /* Initializes telemetry module. */ 19 extern int bcm_telemetry_init( 20 int unit); 21 22 /* Detach telemetry module. */ 23 extern int bcm_telemetry_detach( 24 int unit); 25 26 #endif /* BCM_HIDE_DISPATCHABLE */ 27 28 /* Type of telemetry object stats to be collected */ 29 typedef enum bcm_telemetry_object_type_e { 30 bcmTelemetryObjectTypeNone = 0, /* No stats. */ 31 bcmTelemetryObjectTypeIntfIngress = 1, /* Interface Ingress stats. */ 32 bcmTelemetryObjectTypeIntfEgress = 2, /* Interface Egress stats. */ 33 bcmTelemetryObjectTypeIntfEgressQueue = 3, /* Interface Egress Queue stats. */ 34 bcmTelemetryObjectTypeIntfIngressError = 4, /* Interface Ingress stats. */ 35 bcmTelemetryObjectTypeIntMetaData = 5, /* Interface Egress Queue stats. */ 36 bcmTelemetryObjectTypeCount = 6 /* Last Value. Not Usable. */ 37 } bcm_telemetry_object_type_t; 38 39 /* Telemetry module defines. */ 40 #define BCM_TELEMETRY_PORT_NAME_SIZE 10 /* Port/Interface name size 41 of ProtoBuf Streaming 42 telemetry. */ 43 44 /* Telemetry application instance configuration information. */ 45 typedef struct bcm_telemetry_config_s { 46 bcm_telemetry_object_type_t object_type[bcmTelemetryObjectTypeCount]; /* Type of stats need to be collected. */ 47 uint32 component_id; /* Component Identification to be used 48 in export data to collector. */ 49 bcm_gport_t gport; /* port to be used to collect 50 statistics. */ 51 uint8 port_name[BCM_TELEMETRY_PORT_NAME_SIZE]; /* Port/Interface name associated with 52 port provided. */ 53 } bcm_telemetry_config_t; 54 55 #ifndef BCM_HIDE_DISPATCHABLE 56 57 /* Creates a telemetry instance. */ 58 extern int bcm_telemetry_config_set( 59 int unit, 60 int telemetry_instance, 61 int core, 62 int config_count, 63 bcm_telemetry_config_t *telemetry_config_list); 64 65 /* Fetches a telemetry instance whose instance ID is provided. */ 66 extern int bcm_telemetry_config_get( 67 int unit, 68 int telemetry_instance, 69 int core, 70 int max_count, 71 bcm_telemetry_config_t *telemetry_config_list, 72 int *config_count); 73 74 /* Configures a telemetry instance export information. */ 75 extern int bcm_telemetry_export_config_set( 76 int unit, 77 int telemetry_instance, 78 bcm_collector_t collector_id, 79 int export_profile_id); 80 81 /* Fetches a telemetry instance export information. */ 82 extern int bcm_telemetry_export_config_get( 83 int unit, 84 int telemetry_instance, 85 bcm_collector_t *collector_id, 86 int *export_profile_id); 87 88 /* Deletes a telemetry instance export information. */ 89 extern int bcm_telemetry_export_config_delete( 90 int unit, 91 int telemetry_instance, 92 bcm_collector_t collector_id, 93 int export_profile_id); 94 95 #endif /* BCM_HIDE_DISPATCHABLE */ 96 97 /* Initializes a telemetry config information structure. */ 98 extern void bcm_telemetry_config_t_init( 99 bcm_telemetry_config_t *telemetry_config); 100 101 #ifndef BCM_HIDE_DISPATCHABLE 102 103 /* Configures telemetry system ID information. */ 104 extern int bcm_telemetry_system_id_set( 105 int unit, 106 int system_id_len, 107 uint8 *system_id); 108 109 /* Fetches telemetry system ID information. */ 110 extern int bcm_telemetry_system_id_get( 111 int unit, 112 int max_system_id_len, 113 int *system_id_len, 114 uint8 *system_id); 115 116 #endif /* BCM_HIDE_DISPATCHABLE */ 117 118 /* Telemetry instance export statistics. */ 119 typedef struct bcm_telemetry_instance_export_stats_s { 120 uint64 tx_pkts; /* Number of pkts exported. */ 121 uint64 tx_pkt_fails; /* Number of pkts that failed to export. */ 122 } bcm_telemetry_instance_export_stats_t; 123 124 #ifndef BCM_HIDE_DISPATCHABLE 125 126 /* Get the telemetry instance export statistics. */ 127 extern int bcm_telemetry_instance_export_stats_get( 128 int unit, 129 int telemetry_instance, 130 bcm_collector_t collector_id, 131 bcm_telemetry_instance_export_stats_t *stats); 132 133 /* Set the telemetry instance export statistics. */ 134 extern int bcm_telemetry_instance_export_stats_set( 135 int unit, 136 int telemetry_instance, 137 bcm_collector_t collector_id, 138 bcm_telemetry_instance_export_stats_t *stats); 139 140 #endif /* BCM_HIDE_DISPATCHABLE */ 141 142 #endif /* __BCM_TELEMETRY_H__ */