]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
rdma: Expose whether RDMA monitoring is supported
authorChiara Meiohas <cmeiohas@nvidia.com>
Tue, 12 Nov 2024 09:57:59 +0000 (11:57 +0200)
committerDavid Ahern <dsahern@kernel.org>
Sat, 16 Nov 2024 04:38:00 +0000 (04:38 +0000)
Extend the "rdma sys" command to display whether RDMA
monitoring is supported.

Example output for kernel where monitoring is supported:
$ rdma sys show
netns shared privileged-qkey off monitor on copy-on-fork on

Example output for kernel where monitoring is not supported:
$ rdma sys show
netns shared privileged-qkey off monitor off copy-on-fork on

Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
man/man8/rdma-system.8
rdma/sys.c
rdma/utils.c

index 554938eb8f1be5c265f7ec91fb060beb47b23203..5373027a223ca7ab86bd3a692654c5635b072618 100644 (file)
@@ -38,8 +38,8 @@ rdma-system \- RDMA subsystem configuration
 .SS rdma system set - set RDMA subsystem network namespace mode or
 privileged qkey mode
 
-.SS rdma system show - display RDMA subsystem network namespace mode and
-privileged qkey state
+.SS rdma system show - display RDMA subsystem network namespace mode,
+privileged qkey state and whether RDMA monitoring is supported.
 
 .PP
 .I "NEWMODE"
@@ -66,8 +66,8 @@ controlled QKEY or not.
 .PP
 rdma system show
 .RS 4
-Shows the state of RDMA subsystem network namespace mode on the system and
-the state of privileged qkey parameter.
+Shows the state of RDMA subsystem network namespace mode on the system,
+the state of privileged qkey parameter and whether RDMA monitor is supported.
 .RE
 .PP
 rdma system set netns exclusive
@@ -100,6 +100,7 @@ is *not* allowed to specify a controlled QKEY.
 .BR rdma (8),
 .BR rdma-link (8),
 .BR rdma-resource (8),
+.BR rdma-monitor (8),
 .BR network_namespaces (7),
 .BR namespaces (7),
 .br
index 7dbe4409482043fcd01322ca15d28d19ea5a7fcd..9f538e41f99761c5f38e1cb67ce74c7c6c184954 100644 (file)
@@ -20,6 +20,7 @@ static const char *netns_modes_str[] = {
 static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
 {
        struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {};
+       uint8_t mon_mode = 0;
        bool cof = false;
 
        mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
@@ -48,6 +49,10 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
 
        }
 
+       if (tb[RDMA_NLDEV_SYS_ATTR_MONITOR_MODE])
+               mon_mode = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_MONITOR_MODE]);
+       print_on_off(PRINT_ANY, "monitor", "monitor %s ", mon_mode);
+
        if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])
                cof = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]);
 
@@ -77,6 +82,7 @@ static int sys_show(struct rd *rd)
                { NULL,                 sys_show_no_args},
                { "netns",              sys_show_no_args},
                { "privileged-qkey",    sys_show_no_args},
+               { "monitor",            sys_show_no_args},
                { 0 }
        };
 
index bc104e0f1aa3b5f67a0c2eb3c2df47f16ea08bb3..07cb0224747ed3ccd267cee2b874fa80346835f0 100644 (file)
@@ -478,6 +478,7 @@ static const enum mnl_attr_data_type nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
        [RDMA_NLDEV_ATTR_DEV_TYPE] = MNL_TYPE_U8,
        [RDMA_NLDEV_ATTR_PARENT_NAME] = MNL_TYPE_STRING,
        [RDMA_NLDEV_ATTR_EVENT_TYPE] = MNL_TYPE_U8,
+       [RDMA_NLDEV_SYS_ATTR_MONITOR_MODE] = MNL_TYPE_U8,
 };
 
 static int rd_attr_check(const struct nlattr *attr, int *typep)