1 Star 0 Fork 40

LuWu/iproute

forked from src-openEuler/iproute 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
zzry 提交于 2024-02-26 13:51 . Add support to dump rdma SRQ resource
From 07bfa4482d49cc87a7b7c810c99397b9e8f794f6 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Tue, 10 Oct 2023 15:55:26 +0800
Subject: [PATCH] rdma: Add support to dump SRQ resource in raw format
Add support to dump SRQ resource in raw format.
This patch relies on the corresponding kernel commit aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")
Example:
$ rdma res show srq -r
dev hns3 149000...
$ rdma res show srq -j -r
[{"ifindex":0,"ifname":"hns3","data":[149,0,0,...]}]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
---
rdma/res-srq.c | 20 ++++++++++++++++++--
rdma/res.h | 2 ++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 186ae281..cf9209d7 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -162,6 +162,20 @@ out:
return -EINVAL;
}
+static int res_srq_line_raw(struct rd *rd, const char *name, int idx,
+ struct nlattr **nla_line)
+{
+ if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+ return MNL_CB_ERROR;
+
+ open_json_object(NULL);
+ print_dev(rd, idx, name);
+ print_raw_data(rd, nla_line);
+ newline(rd);
+
+ return MNL_CB_OK;
+}
+
static int res_srq_line(struct rd *rd, const char *name, int idx,
struct nlattr **nla_line)
{
@@ -248,7 +262,8 @@ int res_srq_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
- return res_srq_line(rd, name, idx, tb);
+ return (rd->show_raw) ? res_srq_line_raw(rd, name, idx, tb) :
+ res_srq_line(rd, name, idx, tb);
}
int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -276,7 +291,8 @@ int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
if (ret != MNL_CB_OK)
break;
- ret = res_srq_line(rd, name, idx, nla_line);
+ ret = (rd->show_raw) ? res_srq_line_raw(rd, name, idx, nla_line) :
+ res_srq_line(rd, name, idx, nla_line);
if (ret != MNL_CB_OK)
break;
}
diff --git a/rdma/res.h b/rdma/res.h
index 70e51acd..e880c28b 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -39,6 +39,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
return RDMA_NLDEV_CMD_RES_CQ_GET_RAW;
case RDMA_NLDEV_CMD_RES_MR_GET:
return RDMA_NLDEV_CMD_RES_MR_GET_RAW;
+ case RDMA_NLDEV_CMD_RES_SRQ_GET:
+ return RDMA_NLDEV_CMD_RES_SRQ_GET_RAW;
default:
return command;
}
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Lu__Wu/iproute.git
git@gitee.com:Lu__Wu/iproute.git
Lu__Wu
iproute
iproute
master

搜索帮助