* [PATCH iproute2-next v4] rdma: display resource limits in curr/max format
@ 2026-07-08 13:40 Tao Cui
2026-07-09 7:01 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Tao Cui @ 2026-07-08 13:40 UTC (permalink / raw)
To: dsahern, leonro; +Cc: linux-rdma, netdev, cui.tao, cuitao
From: Tao Cui <cuitao@kylinos.cn>
Parse the new RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX netlink attribute
to show resource limits alongside current counts in curr/max format:
Before: 0: mlx5_0: qp 123 cq 45 mr 200 pd 10
After: 0: mlx5_0: qp 123/131072 cq 45/65536 mr 200/1000000 pd 10/32768
JSON output provides both current and max fields per resource type
(e.g. "qp": 123, "qp-max": 131072). Backward compatible: no output
change when kernel lacks the new attribute.
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Link: https://lore.kernel.org/all/20260615003646.168704-1-cui.tao@linux.dev/
---
Changes in v4:
- Add Link to the kernel patch that introduces the new uapi attribute.
---
rdma/include/uapi/rdma/rdma_netlink.h | 5 +++++
rdma/res.c | 21 ++++++++++++++++++++-
rdma/utils.c | 1 +
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
index 4356ec4a..e5b8b065 100644
--- a/rdma/include/uapi/rdma/rdma_netlink.h
+++ b/rdma/include/uapi/rdma/rdma_netlink.h
@@ -604,6 +604,11 @@ enum rdma_nldev_attr {
RDMA_NLDEV_ATTR_FRMR_POOL_PINNED_HANDLES, /* u32 */
RDMA_NLDEV_ATTR_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */
+ /*
+ * Resource summary entry maximum value.
+ */
+ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX, /* u64 */
+
/*
* Always the end
*/
diff --git a/rdma/res.c b/rdma/res.c
index 062f0007..046935e2 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -55,7 +55,26 @@ static int res_print_summary(struct nlattr **tb)
name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
- res_print_u64(name, curr, nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
+ if (nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX]) {
+ uint64_t max;
+ char max_name[64];
+
+ max = mnl_attr_get_u64(
+ nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX]);
+ snprintf(max_name, sizeof(max_name), "%s-max", name);
+ print_u64(PRINT_JSON, name, NULL, curr);
+ print_u64(PRINT_JSON, max_name, NULL, max);
+ if (!is_json_context()) {
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%s %" PRIu64 "/%" PRIu64 " ",
+ name, curr, max);
+ pr_out("%s", buf);
+ }
+ } else {
+ res_print_u64(name, curr,
+ nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
+ }
}
return 0;
}
diff --git a/rdma/utils.c b/rdma/utils.c
index 87003b2c..90ea1c55 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -480,6 +480,7 @@ static const enum mnl_attr_data_type nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
[RDMA_NLDEV_ATTR_EVENT_TYPE] = MNL_TYPE_U8,
[RDMA_NLDEV_SYS_ATTR_MONITOR_MODE] = MNL_TYPE_U8,
[RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENABLED] = MNL_TYPE_U8,
+ [RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX] = MNL_TYPE_U64,
};
static int rd_attr_check(const struct nlattr *attr, int *typep)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH iproute2-next v4] rdma: display resource limits in curr/max format
2026-07-08 13:40 [PATCH iproute2-next v4] rdma: display resource limits in curr/max format Tao Cui
@ 2026-07-09 7:01 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-07-09 7:01 UTC (permalink / raw)
To: Tao Cui; +Cc: dsahern, linux-rdma, netdev, cuitao
On Wed, Jul 08, 2026 at 09:40:03PM +0800, Tao Cui wrote:
> From: Tao Cui <cuitao@kylinos.cn>
>
> Parse the new RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX netlink attribute
> to show resource limits alongside current counts in curr/max format:
>
> Before: 0: mlx5_0: qp 123 cq 45 mr 200 pd 10
> After: 0: mlx5_0: qp 123/131072 cq 45/65536 mr 200/1000000 pd 10/32768
>
> JSON output provides both current and max fields per resource type
> (e.g. "qp": 123, "qp-max": 131072). Backward compatible: no output
> change when kernel lacks the new attribute.
>
> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
> Link: https://lore.kernel.org/all/20260615003646.168704-1-cui.tao@linux.dev/
> ---
> Changes in v4:
> - Add Link to the kernel patch that introduces the new uapi attribute.
> ---
> rdma/include/uapi/rdma/rdma_netlink.h | 5 +++++
Please move changes to rdma_netlink.h into a separate commit using
the following format:
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/rdma/include/uapi/rdma?id=85860c7dce2ce742ef0c6879b5c5bcbcecaaf717
Thanks
> rdma/res.c | 21 ++++++++++++++++++++-
> rdma/utils.c | 1 +
> 3 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
> index 4356ec4a..e5b8b065 100644
> --- a/rdma/include/uapi/rdma/rdma_netlink.h
> +++ b/rdma/include/uapi/rdma/rdma_netlink.h
> @@ -604,6 +604,11 @@ enum rdma_nldev_attr {
> RDMA_NLDEV_ATTR_FRMR_POOL_PINNED_HANDLES, /* u32 */
> RDMA_NLDEV_ATTR_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */
>
> + /*
> + * Resource summary entry maximum value.
> + */
> + RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX, /* u64 */
> +
> /*
> * Always the end
> */
> diff --git a/rdma/res.c b/rdma/res.c
> index 062f0007..046935e2 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -55,7 +55,26 @@ static int res_print_summary(struct nlattr **tb)
>
> name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
> curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
> - res_print_u64(name, curr, nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
> + if (nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX]) {
> + uint64_t max;
> + char max_name[64];
> +
> + max = mnl_attr_get_u64(
> + nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX]);
> + snprintf(max_name, sizeof(max_name), "%s-max", name);
> + print_u64(PRINT_JSON, name, NULL, curr);
> + print_u64(PRINT_JSON, max_name, NULL, max);
> + if (!is_json_context()) {
> + char buf[64];
> +
> + snprintf(buf, sizeof(buf), "%s %" PRIu64 "/%" PRIu64 " ",
> + name, curr, max);
> + pr_out("%s", buf);
> + }
> + } else {
> + res_print_u64(name, curr,
> + nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
> + }
> }
> return 0;
> }
> diff --git a/rdma/utils.c b/rdma/utils.c
> index 87003b2c..90ea1c55 100644
> --- a/rdma/utils.c
> +++ b/rdma/utils.c
> @@ -480,6 +480,7 @@ static const enum mnl_attr_data_type nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
> [RDMA_NLDEV_ATTR_EVENT_TYPE] = MNL_TYPE_U8,
> [RDMA_NLDEV_SYS_ATTR_MONITOR_MODE] = MNL_TYPE_U8,
> [RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENABLED] = MNL_TYPE_U8,
> + [RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_MAX] = MNL_TYPE_U64,
> };
>
> static int rd_attr_check(const struct nlattr *attr, int *typep)
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-09 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 13:40 [PATCH iproute2-next v4] rdma: display resource limits in curr/max format Tao Cui
2026-07-09 7:01 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox