1 Star 0 Fork 76

mds.lanruo/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0181-dmadev-support-telemetry-dump-dmadev.patch 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
From a36114ed036f8c4976dfe3d47f0ee29c9f214fc5 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 21 Oct 2022 15:36:57 +0800
Subject: [PATCH 181/189] dmadev: support telemetry dump dmadev
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch supports telemetry dump dmadev.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
lib/dmadev/rte_dmadev.c | 43 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..ea1cb815b4 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -985,6 +985,45 @@ dmadev_handle_dev_stats(const char *cmd __rte_unused,
return 0;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
+static int
+dmadev_handle_dev_dump(const char *cmd __rte_unused,
+ const char *params,
+ struct rte_tel_data *d)
+{
+ char *buf, *end_param;
+ int dev_id, ret;
+ FILE *f;
+
+ if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+ return -EINVAL;
+
+ dev_id = strtoul(params, &end_param, 0);
+ if (*end_param != '\0')
+ RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring");
+
+ 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_dma_dump(dev_id, f);
+ fclose(f);
+ if (ret == 0) {
+ rte_tel_data_start_dict(d);
+ rte_tel_data_string(d, buf);
+ }
+
+ free(buf);
+ return ret;
+}
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
RTE_INIT(dmadev_init_telemetry)
{
rte_telemetry_register_cmd("/dmadev/list", dmadev_handle_dev_list,
@@ -993,4 +1032,8 @@ RTE_INIT(dmadev_init_telemetry)
"Returns information for a dmadev. Parameters: int dev_id");
rte_telemetry_register_cmd("/dmadev/stats", dmadev_handle_dev_stats,
"Returns the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (Optional if only one vchannel)");
+#ifndef RTE_EXEC_ENV_WINDOWS
+ rte_telemetry_register_cmd("/dmadev/dump", dmadev_handle_dev_dump,
+ "Returns dump information for a dmadev. Parameters: int dev_id");
+#endif
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdslanruo/dpdk.git
git@gitee.com:mdslanruo/dpdk.git
mdslanruo
dpdk
dpdk
master

搜索帮助