20 Star 0 Fork 64

openEuler-RISC-V / dpdk

forked from src-openEuler / dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0179-ethdev-support-telemetry-private-dump.patch 2.64 KB
一键复制 编辑 原始数据 按行查看 历史
From 9de9c8f454d4d1d87105700f626568f5f59e6985 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 21 Oct 2022 15:36:55 +0800
Subject: [PATCH 179/189] ethdev: support telemetry private dump
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 b95f501b51..df5a627cbe 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>
@@ -6272,6 +6273,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,
@@ -6571,6 +6614,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.23.0
1
https://gitee.com/openeuler-risc-v/dpdk.git
git@gitee.com:openeuler-risc-v/dpdk.git
openeuler-risc-v
dpdk
dpdk
master

搜索帮助