When telemetry callback didn't set dict and return a non-negative
number, the telemetry will repeat to display the last result.

Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")
Cc: sta...@dpdk.org

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
 lib/telemetry/telemetry.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 8fbb4f3060..a6c84e3499 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -334,8 +334,10 @@ static void
 perform_command(telemetry_cb fn, const char *cmd, const char *param, int s)
 {
        struct rte_tel_data data;
+       int ret;
 
-       int ret = fn(cmd, param, &data);
+       rte_tel_data_start_dict(&data);
+       ret = fn(cmd, param, &data);
        if (ret < 0) {
                char out_buf[MAX_CMD_LEN + 10];
                int used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":null}",
-- 
2.17.1

Reply via email to