1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Intel Corporation 3 */ 4 5 #ifndef _TELEMETRY_DATA_H_ 6 #define _TELEMETRY_DATA_H_ 7 8 #include <inttypes.h> 9 #include "rte_telemetry.h" 10 11 enum tel_container_types { 12 RTE_TEL_NULL, /** null, used as error value */ 13 RTE_TEL_STRING, /** basic string type, no included data */ 14 RTE_TEL_DICT, /** name-value pairs, of individual value type */ 15 RTE_TEL_ARRAY_STRING, /** array of string values only */ 16 RTE_TEL_ARRAY_INT, /** array of signed, 32-bit int values */ 17 RTE_TEL_ARRAY_U64, /** array of unsigned 64-bit int values */ 18 RTE_TEL_ARRAY_CONTAINER, /** array of container structs */ 19 }; 20 21 struct container { 22 struct rte_tel_data *data; 23 int keep; 24 }; 25 26 /* each type here must have an equivalent enum in the value types enum in 27 * telemetry.h and an array type defined above, and have appropriate 28 * type assignment in the RTE_TEL_data_start_array() function 29 */ 30 union tel_value { 31 char sval[RTE_TEL_MAX_STRING_LEN]; 32 int ival; 33 uint64_t u64val; 34 struct container container; 35 }; 36 37 struct tel_dict_entry { 38 char name[RTE_TEL_MAX_STRING_LEN]; 39 enum rte_tel_value_type type; 40 union tel_value value; 41 }; 42 43 struct rte_tel_data { 44 enum tel_container_types type; 45 unsigned int data_len; /* for array or object, how many items */ 46 union { 47 char str[RTE_TEL_MAX_SINGLE_STRING_LEN]; 48 struct tel_dict_entry dict[RTE_TEL_MAX_DICT_ENTRIES]; 49 union tel_value array[RTE_TEL_MAX_ARRAY_ENTRIES]; 50 } data; /* data container */ 51 }; 52 53 #endif 54