199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2020 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _TELEMETRY_DATA_H_ 699a2dd95SBruce Richardson #define _TELEMETRY_DATA_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson #include "rte_telemetry.h" 999a2dd95SBruce Richardson 1099a2dd95SBruce Richardson enum tel_container_types { 115a36d531SBruce Richardson TEL_NULL, /** null, used as error value */ 125a36d531SBruce Richardson TEL_STRING, /** basic string type, no included data */ 135a36d531SBruce Richardson TEL_DICT, /** name-value pairs, of individual value type */ 145a36d531SBruce Richardson TEL_ARRAY_STRING, /** array of string values only */ 155a36d531SBruce Richardson TEL_ARRAY_INT, /** array of signed, 32-bit int values */ 16cc4f33d9SBruce Richardson TEL_ARRAY_UINT, /** array of unsigned 64-bit int values */ 175a36d531SBruce Richardson TEL_ARRAY_CONTAINER, /** array of container structs */ 1899a2dd95SBruce Richardson }; 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson struct container { 2199a2dd95SBruce Richardson struct rte_tel_data *data; 2299a2dd95SBruce Richardson int keep; 2399a2dd95SBruce Richardson }; 2499a2dd95SBruce Richardson 2599a2dd95SBruce Richardson /* each type here must have an equivalent enum in the value types enum in 2699a2dd95SBruce Richardson * telemetry.h and an array type defined above, and have appropriate 2799a2dd95SBruce Richardson * type assignment in the RTE_TEL_data_start_array() function 2899a2dd95SBruce Richardson */ 2999a2dd95SBruce Richardson union tel_value { 3099a2dd95SBruce Richardson char sval[RTE_TEL_MAX_STRING_LEN]; 31*032a2904SBruce Richardson int64_t ival; 32cc4f33d9SBruce Richardson uint64_t uval; 3399a2dd95SBruce Richardson struct container container; 3499a2dd95SBruce Richardson }; 3599a2dd95SBruce Richardson 3699a2dd95SBruce Richardson struct tel_dict_entry { 3799a2dd95SBruce Richardson char name[RTE_TEL_MAX_STRING_LEN]; 3899a2dd95SBruce Richardson enum rte_tel_value_type type; 3999a2dd95SBruce Richardson union tel_value value; 4099a2dd95SBruce Richardson }; 4199a2dd95SBruce Richardson 4299a2dd95SBruce Richardson struct rte_tel_data { 4399a2dd95SBruce Richardson enum tel_container_types type; 4499a2dd95SBruce Richardson unsigned int data_len; /* for array or object, how many items */ 4599a2dd95SBruce Richardson union { 4699a2dd95SBruce Richardson char str[RTE_TEL_MAX_SINGLE_STRING_LEN]; 4799a2dd95SBruce Richardson struct tel_dict_entry dict[RTE_TEL_MAX_DICT_ENTRIES]; 4899a2dd95SBruce Richardson union tel_value array[RTE_TEL_MAX_ARRAY_ENTRIES]; 4999a2dd95SBruce Richardson } data; /* data container */ 5099a2dd95SBruce Richardson }; 5199a2dd95SBruce Richardson 5299a2dd95SBruce Richardson #endif 53