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