From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67BE1A00C5; Mon, 19 Dec 2022 10:14:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EBA442D12; Mon, 19 Dec 2022 10:14:07 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1E8F140685 for ; Mon, 19 Dec 2022 10:14:04 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NbDWf73CGzJqbW; Mon, 19 Dec 2022 17:13:02 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Dec 2022 17:14:01 +0800 From: Chengwen Feng To: , , CC: , , , Subject: [PATCH v5 2/5] telemetry: fix repeated display when callback don't set dict Date: Mon, 19 Dec 2022 09:07:20 +0000 Message-ID: <20221219090723.29356-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221219090723.29356-1-fengchengwen@huawei.com> References: <20221219090723.29356-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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: stable@dpdk.org Signed-off-by: Chengwen Feng --- 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