From: Chiara Meiohas <cmeiohas@nvidia.com>
To: <leon@kernel.org>, <dsahern@gmail.com>, <stephen@networkplumber.org>
Cc: <michaelgur@nvidia.com>, <jgg@nvidia.com>,
<linux-rdma@vger.kernel.org>, <netdev@vger.kernel.org>,
Patrisious Haddad <phaddad@nvidia.com>
Subject: [PATCH iproute2-next 3/4] rdma: Add FRMR pools set aging command
Date: Mon, 2 Mar 2026 17:51:59 +0200 [thread overview]
Message-ID: <20260302155200.2611098-4-cmeiohas@nvidia.com> (raw)
In-Reply-To: <20260302155200.2611098-1-cmeiohas@nvidia.com>
From: Michael Guralnik <michaelgur@nvidia.com>
Allow users to modify the aging time of FRMR pools.
Usage:
$rdma resource set frmr_pools dev rocep8s0f0 aging 120
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Reviewed-by: Patrisious Haddad <phaddad@nvidia.com>
---
man/man8/rdma-resource.8 | 22 +++++++++++++++
rdma/res-frmr-pools.c | 61 ++++++++++++++++++++++++++++++++++++++++
rdma/res.c | 13 +++++++++
rdma/res.h | 1 +
4 files changed, 97 insertions(+)
diff --git a/man/man8/rdma-resource.8 b/man/man8/rdma-resource.8
index 4e2ba39a..a6dc33f3 100644
--- a/man/man8/rdma-resource.8
+++ b/man/man8/rdma-resource.8
@@ -26,6 +26,13 @@ rdma-resource \- rdma resource configuration
.B rdma resource show
.RI "[ " DEV/PORT_INDEX " ]"
+.ti -8
+.B rdma resource set frmr_pools
+.BR dev
+.IR DEV
+.BR aging
+.IR AGING_PERIOD
+
.ti -8
.B rdma resource help
@@ -37,6 +44,16 @@ rdma-resource \- rdma resource configuration
- specifies the RDMA link to show.
If this argument is omitted all links are listed.
+.SS rdma resource set - configure resource related parameters
+
+.PP
+.I "DEV"
+- specifies the RDMA device to configure.
+
+.PP
+.I "AGING_PERIOD"
+- specifies the aging period in seconds for unused FRMR handles. Handles unused for this period will be freed.
+
.SH "EXAMPLES"
.PP
rdma resource show
@@ -119,6 +136,11 @@ rdma resource show frmr_pools ats 1
Show FRMR pools that have ats attribute set.
.RE
.PP
+rdma resource set frmr_pools dev rocep8s0f0 aging 120
+.RS 4
+Set the aging period for FRMR pools on device rocep8s0f0 to 120 seconds.
+.RE
+.PP
.SH SEE ALSO
.BR rdma (8),
diff --git a/rdma/res-frmr-pools.c b/rdma/res-frmr-pools.c
index 97d59705..29efb9cd 100644
--- a/rdma/res-frmr-pools.c
+++ b/rdma/res-frmr-pools.c
@@ -188,3 +188,64 @@ int res_frmr_pools_parse_cb(const struct nlmsghdr *nlh, void *data)
}
return ret;
}
+
+static int res_frmr_pools_one_set_aging(struct rd *rd)
+{
+ uint32_t aging_period;
+ uint32_t seq;
+ int ret;
+
+ if (rd_no_arg(rd)) {
+ pr_err("Please provide aging period value.\n");
+ return -EINVAL;
+ }
+
+ if (get_u32(&aging_period, rd_argv(rd), 10)) {
+ pr_err("Invalid aging period value: %s\n", rd_argv(rd));
+ return -EINVAL;
+ }
+
+ if (aging_period == 0) {
+ pr_err("Setting the aging period to zero is not supported.\n");
+ return -EINVAL;
+ }
+
+ rd_prepare_msg(rd, RDMA_NLDEV_CMD_RES_FRMR_POOLS_SET, &seq,
+ (NLM_F_REQUEST | NLM_F_ACK));
+ mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx);
+ mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_RES_FRMR_POOL_AGING_PERIOD,
+ aging_period);
+
+ ret = rd_sendrecv_msg(rd, seq);
+ return ret;
+}
+
+static int res_frmr_pools_one_set_help(struct rd *rd)
+{
+ pr_out("Usage: %s set frmr_pools dev DEV aging AGING_PERIOD\n",
+ rd->filename);
+ return 0;
+}
+
+static int res_frmr_pools_one_set(struct rd *rd)
+{
+ const struct rd_cmd cmds[] = {
+ { NULL, res_frmr_pools_one_set_help },
+ { "help", res_frmr_pools_one_set_help },
+ { "aging", res_frmr_pools_one_set_aging },
+ { 0 }
+ };
+
+ return rd_exec_cmd(rd, cmds, "resource set frmr_pools command");
+}
+
+int res_frmr_pools_set(struct rd *rd)
+{
+ int ret;
+
+ ret = rd_set_arg_to_devname(rd);
+ if (ret)
+ return ret;
+
+ return rd_exec_require_dev(rd, res_frmr_pools_one_set);
+}
diff --git a/rdma/res.c b/rdma/res.c
index f1f13d74..63d8386a 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -28,6 +28,7 @@ static int res_help(struct rd *rd)
pr_out(" resource show srq dev [DEV] [FILTER-NAME FILTER-VALUE]\n");
pr_out(" resource show frmr_pools dev [DEV]\n");
pr_out(" resource show frmr_pools dev [DEV] [FILTER-NAME FILTER-VALUE]\n");
+ pr_out(" resource set frmr_pools dev DEV aging AGING_PERIOD\n");
return 0;
}
@@ -252,11 +253,23 @@ static int res_show(struct rd *rd)
return rd_exec_cmd(rd, cmds, "parameter");
}
+static int res_set(struct rd *rd)
+{
+ const struct rd_cmd cmds[] = {
+ { NULL, res_help },
+ { "frmr_pools", res_frmr_pools_set },
+ { 0 }
+ };
+
+ return rd_exec_cmd(rd, cmds, "resource set command");
+}
+
int cmd_res(struct rd *rd)
{
const struct rd_cmd cmds[] = {
{ NULL, res_show },
{ "show", res_show },
+ { "set", res_set },
{ "list", res_show },
{ "help", res_help },
{ 0 }
diff --git a/rdma/res.h b/rdma/res.h
index 30edb8f8..dffbdb52 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -203,6 +203,7 @@ struct filters frmr_pools_valid_filters[MAX_NUMBER_OF_FILTERS] = {
RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,
frmr_pools_valid_filters, true, 0);
+int res_frmr_pools_set(struct rd *rd);
void print_dev(uint32_t idx, const char *name);
void print_link(uint32_t idx, const char *name, uint32_t port, struct nlattr **nla_line);
void print_key(const char *name, uint64_t val, struct nlattr *nlattr);
--
2.38.1
next prev parent reply other threads:[~2026-03-02 15:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 15:51 [PATCH iproute2-next 0/4] Introduce FRMR pools Chiara Meiohas
2026-03-02 15:51 ` [PATCH iproute2-next 1/4] rdma: Update headers Chiara Meiohas
2026-03-02 15:51 ` [PATCH iproute2-next 2/4] rdma: Add resource FRMR pools show command Chiara Meiohas
2026-03-07 1:45 ` David Ahern
2026-03-16 17:17 ` Michael Gur
2026-03-02 15:51 ` Chiara Meiohas [this message]
2026-03-02 15:52 ` [PATCH iproute2-next 4/4] rdma: Add FRMR pools set pinned command Chiara Meiohas
2026-03-07 0:16 ` [PATCH iproute2-next 0/4] Introduce FRMR pools David Ahern
2026-03-09 15:48 ` Chiara Meiohas
2026-03-07 1:45 ` David Ahern
2026-03-16 21:37 ` Michael Gur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260302155200.2611098-4-cmeiohas@nvidia.com \
--to=cmeiohas@nvidia.com \
--cc=dsahern@gmail.com \
--cc=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michaelgur@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=phaddad@nvidia.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox