From effbaa0bb7be1e27fcbea575d5fec30aec9b4d30 Mon Sep 17 00:00:00 2001 From: Ran Zhou Date: Thu, 22 Feb 2024 15:55:25 +0800 Subject: [PATCH] Backport from community to support dumping rdma SRQ resource Signed-off-by: Ran Zhou --- ...t-to-dump-SRQ-resource-in-raw-format.patch | 86 +++++++++++++++++++ backport-rdma-Update-uapi-headers.patch | 32 +++++++ iproute.spec | 11 ++- 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch create mode 100644 backport-rdma-Update-uapi-headers.patch diff --git a/backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch b/backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch new file mode 100644 index 0000000..1d06090 --- /dev/null +++ b/backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch @@ -0,0 +1,86 @@ +From 222e1bd6b448a1aa660ff65d398bd80d880d94c7 Mon Sep 17 00:00:00 2001 +From: wenglianfa +Date: Tue, 10 Oct 2023 15:55:26 +0800 +Subject: [PATCH 2/2] 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 +Reviewed-by: Leon Romanovsky +Signed-off-by: David Ahern +--- + 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 5d8f384..af59c3d 100644 +--- a/rdma/res-srq.c ++++ b/rdma/res-srq.c +@@ -166,6 +166,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) + { +@@ -251,7 +265,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) +@@ -279,7 +294,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 58fa6ad..ee9697f 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 + diff --git a/backport-rdma-Update-uapi-headers.patch b/backport-rdma-Update-uapi-headers.patch new file mode 100644 index 0000000..207ece4 --- /dev/null +++ b/backport-rdma-Update-uapi-headers.patch @@ -0,0 +1,32 @@ +From b687aae3834512713335122031fd93f5b3f8b21b Mon Sep 17 00:00:00 2001 +From: Junxian Huang +Date: Tue, 10 Oct 2023 15:55:25 +0800 +Subject: [PATCH 1/2] rdma: Update uapi headers + +Update rdma_netlink.h file upto kernel commit aebf8145e11a +("RDMA/core: Add support to dump SRQ resource in RAW format") + +Signed-off-by: wenglianfa +Signed-off-by: Junxian Huang +Reviewed-by: Leon Romanovsky +Signed-off-by: David Ahern +--- + rdma/include/uapi/rdma/rdma_netlink.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h +index 37f583e..9f30839 100644 +--- a/rdma/include/uapi/rdma/rdma_netlink.h ++++ b/rdma/include/uapi/rdma/rdma_netlink.h +@@ -293,6 +293,8 @@ enum rdma_nldev_command { + + RDMA_NLDEV_CMD_RES_MR_GET_RAW, + ++ RDMA_NLDEV_CMD_RES_SRQ_GET_RAW, ++ + RDMA_NLDEV_CMD_RES_CTX_GET, /* can dump */ + + RDMA_NLDEV_CMD_RES_SRQ_GET, /* can dump */ +-- +2.25.1 + diff --git a/iproute.spec b/iproute.spec index 0b1796f..1cd4b3e 100644 --- a/iproute.spec +++ b/iproute.spec @@ -2,7 +2,7 @@ Name: iproute Version: 5.15.0 Epoch: 1 -Release: 18 +Release: 19 Summary: Linux network configuration utilities License: GPLv2+ and Public Domain URL: https://kernel.org/pub/linux/utils/net/iproute2/ @@ -59,6 +59,9 @@ Patch6042: backport-ss-Fix-socket-type-check-in-packet_show_line.patch Patch6043: backport-ss-print-unix-socket-ports-as-unsigned-int-inode.patch Patch6044: backport-utils-fix-get_integer-logic.patch +Patch6045: backport-rdma-Update-uapi-headers.patch +Patch6046: backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch + Patch9000: feature-iproute-add-support-for-ipvlan-l2e-mode.patch Patch9001: bugfix-iproute2-cancel-some-test-cases.patch Patch9002: feature-iproute2-supports-to-parse-UB-device-and-related-display-of-vf-address.patch @@ -138,6 +141,12 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %{_mandir}/* %changelog +* Thu Feb 22 2024 Ran Zhou - 1:5.15.0-19 +- Type:feature +- ID:NA +- SUG:NA +- DESC:Add support to dump rdma SRQ resource in raw format + * Fri Jan 12 2024 liubo - 1:5.15.0-18 - Type:bugfix - ID:NA -- Gitee