From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,
<kevin.laatz@intel.com>, <bruce.richardson@intel.com>,
<andrew.rybchenko@oktetlabs.ru>, <jerinj@marvell.com>,
<sachin.saxena@oss.nxp.com>, <hemant.agrawal@nxp.com>,
<mb@smartsharesystems.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v4 4/4] ethdev: support telemetry private dump
Date: Tue, 13 Sep 2022 07:13:44 +0000 [thread overview]
Message-ID: <20220913071344.38612-5-fengchengwen@huawei.com> (raw)
In-Reply-To: <20220913071344.38612-1-fengchengwen@huawei.com>
This patch supports telemetry private dump a ethdev port.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
lib/ethdev/rte_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 1979dc0850..a19b1215be 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
@@ -5644,6 +5645,48 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused,
return 0;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
+static int
+eth_dev_handle_port_dump_priv(const char *cmd __rte_unused,
+ const char *params,
+ struct rte_tel_data *d)
+{
+ char *buf, *end_param;
+ int port_id, ret;
+ FILE *f;
+
+ if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+ return -EINVAL;
+
+ port_id = strtoul(params, &end_param, 0);
+ if (*end_param != '\0')
+ RTE_ETHDEV_LOG(NOTICE,
+ "Extra parameters passed to ethdev telemetry command, ignoring");
+ if (!rte_eth_dev_is_valid_port(port_id))
+ return -EINVAL;
+
+ buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN);
+ if (buf == NULL)
+ return -ENOMEM;
+
+ f = fmemopen(buf, RTE_TEL_MAX_SINGLE_STRING_LEN - 1, "w+");
+ if (f == NULL) {
+ free(buf);
+ return -EINVAL;
+ }
+
+ ret = rte_eth_dev_priv_dump(port_id, f);
+ fclose(f);
+ if (ret == 0) {
+ rte_tel_data_start_dict(d);
+ rte_tel_data_string(d, buf);
+ }
+
+ free(buf);
+ return 0;
+}
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
static int
eth_dev_handle_port_link_status(const char *cmd __rte_unused,
const char *params,
@@ -5927,6 +5970,10 @@ RTE_INIT(ethdev_init_telemetry)
"Returns the common stats for a port. Parameters: int port_id");
rte_telemetry_register_cmd("/ethdev/xstats", eth_dev_handle_port_xstats,
"Returns the extended stats for a port. Parameters: int port_id");
+#ifndef RTE_EXEC_ENV_WINDOWS
+ rte_telemetry_register_cmd("/ethdev/dump_priv", eth_dev_handle_port_dump_priv,
+ "Returns dump private information for a port. Parameters: int port_id");
+#endif
rte_telemetry_register_cmd("/ethdev/link_status",
eth_dev_handle_port_link_status,
"Returns the link status for a port. Parameters: int port_id");
--
2.17.1
next prev parent reply other threads:[~2022-09-13 7:20 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 7:39 [PATCH 0/5] support telemetry dump dev Chengwen Feng
2022-06-15 7:39 ` [PATCH 1/5] usertools: use non-strict when json-loads in telemetry Chengwen Feng
2022-06-15 13:54 ` Morten Brørup
2022-06-15 16:54 ` Bruce Richardson
2022-06-15 18:01 ` Morten Brørup
2022-06-15 20:09 ` Morten Brørup
2022-06-15 7:39 ` [PATCH 2/5] dmadev: support telemetry dump dmadev Chengwen Feng
2022-06-15 7:39 ` [PATCH 3/5] eventdev: support telemetry dump eventdev Chengwen Feng
2022-06-15 7:39 ` [PATCH 4/5] rawdev: support telemetry dump rawdev Chengwen Feng
2022-06-15 7:39 ` [PATCH 5/5] ethdev: support telemetry private dump Chengwen Feng
2022-06-15 20:15 ` [PATCH 0/5] support telemetry dump dev Morten Brørup
2022-06-16 8:19 ` Bruce Richardson
2022-06-16 9:00 ` Morten Brørup
2022-06-17 9:46 ` [PATCH v2 0/5] support telemetry dump Chengwen Feng
2022-06-17 9:46 ` [PATCH v2 1/5] telemetry: escape special char when tel string Chengwen Feng
2022-06-17 11:16 ` Morten Brørup
2022-06-17 11:25 ` Bruce Richardson
2022-06-17 17:05 ` Stephen Hemminger
2022-06-18 3:52 ` fengchengwen
2022-06-18 9:59 ` Morten Brørup
2022-06-22 7:57 ` Power, Ciara
2022-06-22 9:19 ` Bruce Richardson
2022-06-23 16:45 ` Bruce Richardson
2022-06-17 11:27 ` Bruce Richardson
2022-06-17 9:46 ` [PATCH v2 2/5] dmadev: support telemetry dump dmadev Chengwen Feng
2022-06-17 9:46 ` [PATCH v2 3/5] eventdev: support telemetry dump eventdev Chengwen Feng
2022-06-17 9:46 ` [PATCH v2 4/5] rawdev: support telemetry dump rawdev Chengwen Feng
2022-06-17 9:46 ` [PATCH v2 5/5] ethdev: support telemetry private dump Chengwen Feng
2022-09-13 2:44 ` [PATCH v3 0/4] support telemetry dump dev Chengwen Feng
2022-09-13 2:44 ` [PATCH v3 1/4] dmadev: support telemetry dump dmadev Chengwen Feng
2022-09-13 2:44 ` [PATCH v3 2/4] eventdev: support telemetry dump eventdev Chengwen Feng
2022-09-13 2:44 ` [PATCH v3 3/4] rawdev: support telemetry dump rawdev Chengwen Feng
2022-09-13 2:44 ` [PATCH v3 4/4] ethdev: support telemetry private dump Chengwen Feng
2022-09-13 7:13 ` [PATCH v4 0/4] support telemetry dump dev Chengwen Feng
2022-09-13 7:13 ` [PATCH v4 1/4] dmadev: support telemetry dump dmadev Chengwen Feng
2022-09-13 7:13 ` [PATCH v4 2/4] eventdev: support telemetry dump eventdev Chengwen Feng
2022-09-13 7:13 ` [PATCH v4 3/4] rawdev: support telemetry dump rawdev Chengwen Feng
2022-09-13 7:13 ` Chengwen Feng [this message]
2022-10-03 7:28 ` [PATCH v4 0/4] support telemetry dump dev David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220913071344.38612-5-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@xilinx.com \
--cc=hemant.agrawal@nxp.com \
--cc=jerinj@marvell.com \
--cc=kevin.laatz@intel.com \
--cc=mb@smartsharesystems.com \
--cc=sachin.saxena@oss.nxp.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).