Skip to contentSkip to conversation

Introduce FRMR pools

PATCH In review Chiara Meiohas 5 participants 15 messages Mar 30 – May 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Introduce FRMR pools

From Michael:

This series adds support for managing Fast Registration Memory Region (FRMR) pools in rdma tool, enabling users to monitor and configure FRMR pool behavior.

FRMR pools are used to cache and reuse Fast Registration Memory Region handles to improve performance by avoiding the overhead of repeated memory region creation and destruction. This series introduces commands to view FRMR pool statistics and configure pool parameters such as aging time and pinned handle count.

The 'show' command allows users to display FRMR pools created on devices, their properties, and usage statistics. Each pool is identified by a unique key (hex-encoded properties) for easy reference in subsequent operations.

The aging 'set' command allows users to modify the aging time parameter, which controls how long unused FRMR handles remain in the pool before being released.

The pinned 'set' command allows users to configure the number of pinned handles in a pool. Pinned handles are exempt from aging and remain permanently available for reuse, which is useful for workloads with predictable memory region usage patterns.

Command usage and examples are included in the commits and man pages.

These patches are complimentary to the kernel patches:
https://lore.kernel.org/linux-rdma/[email protected]/

--
v1->v2:
- frmr_pool_key: Replaced packed union with plain struct
- moved to colon-separated fields output format for pool keys instead of hex strings
- Fix commented types of AGING_PERIOD and PINNED
- Add res_frmr_pools_idx_parse_cb stub

Michael Guralnik (4):
rdma: Update headers
rdma: Add resource FRMR pools show command
rdma: Add FRMR pools set aging command
rdma: Add FRMR pools set pinned command

 man/man8/rdma-resource.8              |  51 +++-
 rdma/Makefile                         |   2 +-
 rdma/include/uapi/rdma/rdma_netlink.h |  22 ++
 rdma/res-frmr-pools.c                 | 352 ++++++++++++++++++++++++++
 rdma/res.c                            |  19 +-
 rdma/res.h                            |  20 ++
 6 files changed, 463 insertions(+), 3 deletions(-)
 create mode 100644 rdma/res-frmr-pools.c
Signature · 1 line
2.38.1
#1 lore raw

PATCH v2 1/4 rdma: Update headers

From: Michael Guralnik <[email protected]>

Update rdma_netlink.h file up to kernel commit dbd0472fd7a5 ("RDMA/nldev: Expose kernel-internal FRMR pools in netlink")

---
 rdma/include/uapi/rdma/rdma_netlink.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
rdma/include/uapi/rdma/rdma_netlink.h +22 -0
index ec8c19ca..8709e558 100644
@@ -308,6 +308,10 @@ enum rdma_nldev_command {
 
 	RDMA_NLDEV_CMD_MONITOR,
 
+	RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET, /* can dump */
+
+	RDMA_NLDEV_CMD_RES_FRMR_POOLS_SET,
+
 	RDMA_NLDEV_NUM_OPS
 };
 
@@ -582,6 +586,24 @@ enum rdma_nldev_attr {
 	RDMA_NLDEV_SYS_ATTR_MONITOR_MODE,	/* u8 */
 
 	RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENABLED,	/* u8 */
+
+	/*
+	 * FRMR Pools attributes
+	 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOLS,			/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_ENTRY,		/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY,		/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ATS,		/* u8 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ACCESS_FLAGS,	/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_VENDOR_KEY,	/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_NUM_DMA_BLOCKS, /* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_QUEUE_HANDLES,	/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_MAX_IN_USE,	/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_IN_USE,		/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_AGING_PERIOD,	/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_PINNED,		/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */
+
 	/*
 	 * Always the end
 	 */
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH v2 iproute2-next 1/4] rdma: Update headers

Quoted 8 lines · On Mon, 30 Mar 2026 20:31:15 +0300 Chiara Meiohas <[email protected]> wrote:

From: Michael Guralnik <[email protected]>

Update rdma_netlink.h file up to kernel commit dbd0472fd7a5 ("RDMA/nldev: Expose kernel-internal FRMR pools in netlink")

The upstream macro names changed, the iproute2 build is broken after current headers sync.

In file included from res.c:7:
res.h: In function ‘_res_frmr_pools’:
res.h:203:26: error: ‘RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET’ undeclared (first use in this function); did you mean ‘RDMA_NLDEV_CMD_FRMR_POOLS_GET’?
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~
res.h:203:26: note: each undeclared identifier is reported only once for each function it appears in
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~

#3 lore raw

Re: [PATCH v2 iproute2-next 1/4] rdma: Update headers

Quoted 25 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 30 Mar 2026 20:31:15 +0300 Chiara Meiohas <[email protected]> wrote:

From: Michael Guralnik <[email protected]>

Update rdma_netlink.h file up to kernel commit dbd0472fd7a5 ("RDMA/nldev: Expose kernel-internal FRMR pools in netlink")

The upstream macro names changed, the iproute2 build is broken after current headers sync.

In file included from res.c:7:
res.h: In function ‘_res_frmr_pools’:
res.h:203:26: error: ‘RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET’ undeclared (first use in this function); did you mean ‘RDMA_NLDEV_CMD_FRMR_POOLS_GET’?
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~
res.h:203:26: note: each undeclared identifier is reported only once for each function it appears in
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

Quoted 4 lines
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~

Looks like the merged API does not have the _RES part of the uapi:

kernel vs iproute2:

@@ -590,19 +590,19 @@
/*
* FRMR Pools attributes
*/
- RDMA_NLDEV_ATTR_FRMR_POOLS, /* nested table */
- RDMA_NLDEV_ATTR_FRMR_POOL_ENTRY, /* nested table */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY, /* nested table */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY_ATS, /* u8 */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY_ACCESS_FLAGS, /* u32 */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY_VENDOR_KEY, /* u64 */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY_NUM_DMA_BLOCKS, /* u64 */
- RDMA_NLDEV_ATTR_FRMR_POOL_QUEUE_HANDLES, /* u32 */
- RDMA_NLDEV_ATTR_FRMR_POOL_MAX_IN_USE, /* u64 */
- RDMA_NLDEV_ATTR_FRMR_POOL_IN_USE, /* u64 */
- RDMA_NLDEV_ATTR_FRMR_POOLS_AGING_PERIOD, /* u32 */
- RDMA_NLDEV_ATTR_FRMR_POOL_PINNED_HANDLES, /* u32 */
- RDMA_NLDEV_ATTR_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOLS, /* nested table */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_ENTRY, /* nested table */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY, /* nested table */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ATS, /* u8 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ACCESS_FLAGS, /* u32 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_VENDOR_KEY, /* u64 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_NUM_DMA_BLOCKS, /* u64 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_QUEUE_HANDLES, /* u32 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_MAX_IN_USE, /* u64 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_IN_USE, /* u64 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_AGING_PERIOD, /* u32 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_PINNED, /* u32 */
+ RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */

/*

#4 lore raw

Re: [PATCH v2 iproute2-next 1/4] rdma: Update headers

Quoted 56 lines · David Ahern
Quoted 24 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 30 Mar 2026 20:31:15 +0300 Chiara Meiohas <[email protected]> wrote:

From: Michael Guralnik <[email protected]>

Update rdma_netlink.h file up to kernel commit dbd0472fd7a5 ("RDMA/nldev: Expose kernel-internal FRMR pools in netlink")

The upstream macro names changed, the iproute2 build is broken after current headers sync.

In file included from res.c:7:
res.h: In function ‘_res_frmr_pools’:
res.h:203:26: error: ‘RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET’ undeclared (first use in this function); did you mean ‘RDMA_NLDEV_CMD_FRMR_POOLS_GET’?
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~
res.h:203:26: note: each undeclared identifier is reported only once for each function it appears in
203 | RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,

Quoted 4 lines
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

res.h:56:44: note: in definition of macro ‘RES_FUNC’
56 | _command = res_get_command(command, rd); \
| ^~~~~~~

Looks like the merged API does not have the _RES part of the uapi:

kernel vs iproute2:

(quoted diff) +5 -13
@@ -590,19 +590,19 @@
 	/*
 	 * FRMR Pools attributes
 	 */
-	RDMA_NLDEV_ATTR_FRMR_POOLS,		/* nested table */
-	RDMA_NLDEV_ATTR_FRMR_POOL_ENTRY,	/* nested table */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY,		/* nested table */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY_ATS,	/* u8 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY_ACCESS_FLAGS,	/* u32 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY_VENDOR_KEY,	/* u64 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY_NUM_DMA_BLOCKS,	/* u64 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_QUEUE_HANDLES,	/* u32 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_MAX_IN_USE,	/* u64 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_IN_USE,	/* u64 */
-	RDMA_NLDEV_ATTR_FRMR_POOLS_AGING_PERIOD,	/* u32 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_PINNED_HANDLES,	/* u32 */
-	RDMA_NLDEV_ATTR_FRMR_POOL_KEY_KERNEL_VENDOR_KEY,	/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOLS,			/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_ENTRY,		/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY,		/* nested table */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ATS,		/* u8 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_ACCESS_FLAGS,	/* u32 */

Review line 607

Quoted 10 lines
(quoted diff) +8 -0
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_VENDOR_KEY,	/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_NUM_DMA_BLOCKS, /* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_QUEUE_HANDLES,	/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_MAX_IN_USE,	/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_IN_USE,		/* u64 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_AGING_PERIOD,	/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_PINNED,		/* u32 */
+	RDMA_NLDEV_ATTR_RES_FRMR_POOL_KEY_KERNEL_VENDOR_KEY, /* u64 */
 
 	/*

Thanks for catching this.

We will prepare a sync patch to align the names with the kernel and send it shortly.

Best regards,

Chiara

#5 lore raw

Re: [PATCH v2 iproute2-next 1/4] rdma: Update headers

Quoted 2 lines · Chiara Meiohas

We will prepare a sync patch to align the names with the kernel and send it shortly.

what happened to this request? I see that Stephen had to post a patch (not yet applied) to address this problem:

https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

We allow rdma to have separate uapi headers for convenience. Responses to mistakes need to be timely.

#6 lore raw

Re: [PATCH v2 iproute2-next 1/4] rdma: Update headers

Quoted 10 lines · David Ahern
Quoted 2 lines · Chiara Meiohas

We will prepare a sync patch to align the names with the kernel and send it shortly.

what happened to this request? I see that Stephen had to post a patch (not yet applied) to address this problem:

https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

We allow rdma to have separate uapi headers for convenience. Responses to mistakes need to be timely.

Hi David,

My apologies for the delay; I will make sure these mistakes are handled

more promptly in the future.

I have sent our version to the mailing list, as I was not sure how you

would prefer to proceed given the overlap.

https://lore.kernel.org/linux-rdma/[email protected]/

Thanks,

Chiara

#7 lore raw

PATCH v2 2/4 rdma: Add resource FRMR pools show command

In reply to Chiara Meiohas

From: Michael Guralnik <[email protected]>

Allow users to see the FRMR pools that were created on the devices, their properties and their usage statistics.
The set of properties of each pool are encoded as a colon-separated list of hexadecimal fields (vendor_key:num_dma_blocks:access_flags:ats) to simplify referencing a specific pool in 'set' commands.

Sample output:

$rdma resource show frmr_pools
dev rocep8s0f0 key 0:1000:0:0 queue 0 in_use 0 max_in_use 200 dev rocep8s0f0 key 0:800:0:0 queue 0 in_use 0 max_in_use 200 dev rocep8s0f0 key 0:400:0:0 queue 0 in_use 0 max_in_use 200

$rdma resource show frmr_pools -d
dev rocep8s0f0 key 0:1000:0:0 ats 0 access_flags 0 vendor_key 0 num_dma_blocks 4096 queue 0 in_use 0 max_in_use 200 dev rocep8s0f0 key 0:800:0:0 ats 0 access_flags 0 vendor_key 0 num_dma_blocks 2048 queue 0 in_use 0 max_in_use 200 dev rocep8s0f0 key 0:400:0:0 ats 0 access_flags 0 vendor_key 0 num_dma_blocks 1024 queue 0 in_use 0 max_in_use 200

$rdma resource show frmr_pools num_dma_blocks 2048 dev rocep8s0f0 key 0:800:0:0 queue 0 in_use 0 max_in_use 200

---
 man/man8/rdma-resource.8 |   8 +-
 rdma/Makefile            |   2 +-
 rdma/res-frmr-pools.c    | 174 +++++++++++++++++++++++++++++++++++++++
 rdma/res.c               |   5 +-
 rdma/res.h               |  18 ++++
 5 files changed, 204 insertions(+), 3 deletions(-)
 create mode 100644 rdma/res-frmr-pools.c
man/man8/rdma-resource.8 +7 -1
index 61bec471..4e2ba39a 100644
@@ -13,7 +13,8 @@ rdma-resource \- rdma resource configuration
 
 .ti -8
 .IR RESOURCE " := { "
-.BR cm_id " | " cq " | " mr " | " pd " | " qp " | " ctx " | " srq " }"
+.BR cm_id " | " cq " | " mr " | " pd " | " qp " | " ctx " | " srq " | "
+.BR frmr_pools " }"
 .sp
 
 .ti -8
@@ -113,6 +114,11 @@ rdma resource show srq lqpn 5-7
 Show SRQs that the QPs with lqpn 5-7 are associated with.
 .RE
 .PP
+rdma resource show frmr_pools ats 1
+.RS
+Show FRMR pools that have ats attribute set.
+.RE
+.PP
 
 .SH SEE ALSO
 .BR rdma (8),
rdma/Makefile +1 -1
index ed3c1c1c..66fe53f9 100644
@@ -5,7 +5,7 @@ CFLAGS += -I./include/uapi/
 
 RDMA_OBJ = rdma.o utils.o dev.o link.o res.o res-pd.o res-mr.o res-cq.o \
 	   res-cmid.o res-qp.o sys.o stat.o stat-mr.o res-ctx.o res-srq.o \
-	   monitor.o
+	   monitor.o res-frmr-pools.o
 
 TARGETS += rdma
 
rdma/res-frmr-pools.c new file +174 -0

174 lines not on this page · raw message

rdma/res.c +4 -1
index 7e7de042..f1f13d74 100644
@@ -11,7 +11,7 @@ static int res_help(struct rd *rd)
 {
 	pr_out("Usage: %s resource\n", rd->filename);
 	pr_out("          resource show [DEV]\n");
-	pr_out("          resource show [qp|cm_id|pd|mr|cq|ctx|srq]\n");
+	pr_out("          resource show [qp|cm_id|pd|mr|cq|ctx|srq|frmr_pools]\n");
 	pr_out("          resource show qp link [DEV/PORT]\n");
 	pr_out("          resource show qp link [DEV/PORT] [FILTER-NAME FILTER-VALUE]\n");
 	pr_out("          resource show cm_id link [DEV/PORT]\n");
@@ -26,6 +26,8 @@ static int res_help(struct rd *rd)
 	pr_out("          resource show ctx dev [DEV] [FILTER-NAME FILTER-VALUE]\n");
 	pr_out("          resource show srq dev [DEV]\n");
 	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");
 	return 0;
 }
 
@@ -237,6 +239,7 @@ static int res_show(struct rd *rd)
 		{ "pd",		res_pd		},
 		{ "ctx",	res_ctx		},
 		{ "srq",	res_srq		},
+		{ "frmr_pools",	res_frmr_pools	},
 		{ 0 }
 	};
 
rdma/res.h +18 -0
index fd09ce7d..30edb8f8 100644
@@ -26,6 +26,8 @@ int res_ctx_parse_cb(const struct nlmsghdr *nlh, void *data);
 int res_ctx_idx_parse_cb(const struct nlmsghdr *nlh, void *data);
 int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data);
 int res_srq_idx_parse_cb(const struct nlmsghdr *nlh, void *data);
+int res_frmr_pools_parse_cb(const struct nlmsghdr *nlh, void *data);
+int res_frmr_pools_idx_parse_cb(const struct nlmsghdr *nlh, void *data);
 
 static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
 {
@@ -185,6 +187,22 @@ struct filters srq_valid_filters[MAX_NUMBER_OF_FILTERS] = {
 RES_FUNC(res_srq, RDMA_NLDEV_CMD_RES_SRQ_GET, srq_valid_filters, true,
 	 RDMA_NLDEV_ATTR_RES_SRQN);
 
+
+static const
+struct filters frmr_pools_valid_filters[MAX_NUMBER_OF_FILTERS] = {
+	{ .name = "dev", .is_number = false },
+	{ .name = "ats", .is_number = true },
+	{ .name = "access_flags", .is_number = true },
+	{ .name = "vendor_key", .is_number = true },
+	{ .name = "num_dma_blocks", .is_number = true },
+	{ .name = "queue", .is_number = true },
+	{ .name = "in_use", .is_number = true },
+	{ .name = "max_in_use", .is_number = true },
+};
+
+RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,
+	 frmr_pools_valid_filters, true, 0);
+
 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);
Signature · 1 line
2.38.1
#8 lore raw

PATCH v2 3/4 rdma: Add FRMR pools set aging command

In reply to Chiara Meiohas

From: Michael Guralnik <[email protected]>

Add support for configuring the aging period of FRMR pools. The aging mechanism frees unused FRMR handles that have not been in use for the specified period.

Usage:
rdma resource set frmr_pools dev DEV aging AGING_PERIOD

---
 man/man8/rdma-resource.8 | 22 +++++++++++++++
 rdma/res-frmr-pools.c    | 59 ++++++++++++++++++++++++++++++++++++++++
 rdma/res.c               | 13 +++++++++
 rdma/res.h               |  1 +
 4 files changed, 95 insertions(+)
man/man8/rdma-resource.8 +22 -0
index 4e2ba39a..a6dc33f3 100644
@@ -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),
rdma/res-frmr-pools.c +59 -0

62 lines not on this page · raw message

rdma/res.c +13 -0
index f1f13d74..63d8386a 100644
@@ -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 }
rdma/res.h +1 -0
index 30edb8f8..dffbdb52 100644
@@ -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);
Signature · 1 line
2.38.1
#9 lore raw

PATCH v2 4/4 rdma: Add FRMR pools set pinned command

In reply to Chiara Meiohas

From: Michael Guralnik <[email protected]>

Add an option to set the amount of pinned handles to FRMR pool. Pinned handles are not affected by aging and stay available for reuse in the FRMR pool.

The pool is identified by a colon-separated key of hexadecimal fields (vendor_key:num_dma_blocks:access_flags:ats) as shown in the 'show' command output.

Usage:
Set 250 pinned handles to FRMR pool with key 0:800:0:0 on device rocep8s0f0
$rdma resource set frmr_pools dev rocep8s0f0 pinned 0:800:0:0 250

---
 man/man8/rdma-resource.8 |  21 +++++++
 rdma/res-frmr-pools.c    | 121 ++++++++++++++++++++++++++++++++++++++-
 rdma/res.c               |   1 +
 rdma/res.h               |   1 +
 4 files changed, 143 insertions(+), 1 deletion(-)
man/man8/rdma-resource.8 +21 -0
index a6dc33f3..1138cd23 100644
@@ -33,6 +33,14 @@ rdma-resource \- rdma resource configuration
 .BR aging
 .IR AGING_PERIOD
 
+.ti -8
+.B rdma resource set frmr_pools
+.BR dev
+.IR DEV
+.BR pinned
+.IR POOL_KEY
+.IR PINNED_VALUE
+
 .ti -8
 .B rdma resource help
 
@@ -54,6 +62,14 @@ If this argument is omitted all links are listed.
 .I "AGING_PERIOD"
 - specifies the aging period in seconds for unused FRMR handles. Handles unused for this period will be freed.
 
+.PP
+.I "POOL_KEY"
+- specifies the pool key that identifies a specific FRMR pool. The key is a colon-separated list of hexadecimal fields in the format vendor_key:num_dma_blocks:access_flags:ats.
+
+.PP
+.I "PINNED_VALUE"
+- specifies the pinned value for the FRMR pool. A non-zero value pins handles to the pool, preventing them from being freed by the aging mechanism.
+
 .SH "EXAMPLES"
 .PP
 rdma resource show
@@ -141,6 +157,11 @@ rdma resource set frmr_pools dev rocep8s0f0 aging 120
 Set the aging period for FRMR pools on device rocep8s0f0 to 120 seconds.
 .RE
 .PP
+rdma resource set frmr_pools dev rocep8s0f0 pinned 0:1000:0:0 25000
+.RS 4
+Pin 25000 handles to the FRMR pool identified by key 0:1000:0:0 on device rocep8s0f0 to prevent them from being freed.
+.RE
+.PP
 
 .SH SEE ALSO
 .BR rdma (8),
rdma/res-frmr-pools.c +120 -1

162 lines not on this page · raw message

rdma/res.c +1 -0
index 63d8386a..062f0007 100644
@@ -29,6 +29,7 @@ static int res_help(struct rd *rd)
 	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");
+	pr_out("          resource set frmr_pools dev DEV pinned POOL_KEY PINNED_VALUE\n");
 	return 0;
 }
 
rdma/res.h +1 -0
index dffbdb52..4758f2ea 100644
@@ -198,6 +198,7 @@ struct filters frmr_pools_valid_filters[MAX_NUMBER_OF_FILTERS] = {
 	{ .name = "queue", .is_number = true },
 	{ .name = "in_use", .is_number = true },
 	{ .name = "max_in_use", .is_number = true },
+	{ .name = "pinned", .is_number = true },
 };
 
 RES_FUNC(res_frmr_pools, RDMA_NLDEV_CMD_RES_FRMR_POOLS_GET,
Signature · 1 line
2.38.1
#10 lore raw
In reply to Chiara Meiohas
Quoted 26 lines · Chiara Meiohas

From Michael:

This series adds support for managing Fast Registration Memory Region (FRMR) pools in rdma tool, enabling users to monitor and configure FRMR pool behavior.

FRMR pools are used to cache and reuse Fast Registration Memory Region handles to improve performance by avoiding the overhead of repeated memory region creation and destruction. This series introduces commands to view FRMR pool statistics and configure pool parameters such as aging time and pinned handle count.

The 'show' command allows users to display FRMR pools created on devices, their properties, and usage statistics. Each pool is identified by a unique key (hex-encoded properties) for easy reference in subsequent operations.

The aging 'set' command allows users to modify the aging time parameter, which controls how long unused FRMR handles remain in the pool before being released.

The pinned 'set' command allows users to configure the number of pinned handles in a pool. Pinned handles are exempt from aging and remain permanently available for reuse, which is useful for workloads with predictable memory region usage patterns.

Quoted 5 lines

Command usage and examples are included in the commits and man pages.

These patches are complimentary to the kernel patches:
https://lore.kernel.org/linux-rdma/[email protected]/

applied after fixing up a few nits.

Please clone the ai review prompts from:
https://github.com/masoncl/review-prompts.git

Run the setup scripts and have ai review patches before sending. This should really be part of both kernel and iproute2 development workflow now.

#11 lore raw
Quoted 7 lines · David Ahern

applied after fixing up a few nits.

Please clone the ai review prompts from:
https://github.com/masoncl/review-prompts.git

Run the setup scripts and have ai review patches before sending. This should really be part of both kernel and iproute2 development workflow now.

Thanks for the note. Sorry I missed that — I’ll run those review prompts before sending the next patchset.

Chiara

#12 lore raw
In reply to David Ahern
Quoted 33 lines · On Sun, 5 Apr 2026 11:09:55 -0600 David Ahern <[email protected]> wrote:
Quoted 26 lines · Chiara Meiohas

From Michael:

This series adds support for managing Fast Registration Memory Region (FRMR) pools in rdma tool, enabling users to monitor and configure FRMR pool behavior.

FRMR pools are used to cache and reuse Fast Registration Memory Region handles to improve performance by avoiding the overhead of repeated memory region creation and destruction. This series introduces commands to view FRMR pool statistics and configure pool parameters such as aging time and pinned handle count.

The 'show' command allows users to display FRMR pools created on devices, their properties, and usage statistics. Each pool is identified by a unique key (hex-encoded properties) for easy reference in subsequent operations.

The aging 'set' command allows users to modify the aging time parameter, which controls how long unused FRMR handles remain in the pool before being released.

The pinned 'set' command allows users to configure the number of pinned handles in a pool. Pinned handles are exempt from aging and remain permanently available for reuse, which is useful for workloads with predictable memory region usage patterns.

Quoted 5 lines

Command usage and examples are included in the commits and man pages.

These patches are complimentary to the kernel patches:
https://lore.kernel.org/linux-rdma/[email protected]/

Quoted 7 lines

applied after fixing up a few nits.

Please clone the ai review prompts from:
https://github.com/masoncl/review-prompts.git

Run the setup scripts and have ai review patches before sending. This should really be part of both kernel and iproute2 development workflow now.

I rebased UAPI headers based on 7.1-rc1 and iproute2/rdma will not build. Looks like RDMA did not get merged in 7.1.

Will have to back it out if not going in 7.1

maintainer Reviewed-by Patrisious Haddad
#13 lore raw
Quoted 41 lines · Stephen Hemminger
Quoted 38 lines · On Sun, 5 Apr 2026 11:09:55 -0600 David Ahern <[email protected]> wrote:
Quoted 26 lines · Chiara Meiohas

From Michael:

This series adds support for managing Fast Registration Memory Region (FRMR) pools in rdma tool, enabling users to monitor and configure FRMR pool behavior.

FRMR pools are used to cache and reuse Fast Registration Memory Region handles to improve performance by avoiding the overhead of repeated memory region creation and destruction. This series introduces commands to view FRMR pool statistics and configure pool parameters such as aging time and pinned handle count.

The 'show' command allows users to display FRMR pools created on devices, their properties, and usage statistics. Each pool is identified by a unique key (hex-encoded properties) for easy reference in subsequent operations.

The aging 'set' command allows users to modify the aging time parameter, which controls how long unused FRMR handles remain in the pool before being released.

The pinned 'set' command allows users to configure the number of pinned handles in a pool. Pinned handles are exempt from aging and remain permanently available for reuse, which is useful for workloads with predictable memory region usage patterns.

Quoted 5 lines

Command usage and examples are included in the commits and man pages.

These patches are complimentary to the kernel patches:
https://lore.kernel.org/linux-rdma/[email protected]/

applied after fixing up a few nits.

Please clone the ai review prompts from:
https://github.com/masoncl/review-prompts.git

Quoted 7 lines
Quoted 2 lines

Run the setup scripts and have ai review patches before sending. This should really be part of both kernel and iproute2 development workflow now.

I rebased UAPI headers based on 7.1-rc1 and iproute2/rdma will not build. Looks like RDMA did not get merged in 7.1.

Will have to back it out if not going in 7.1

I see it here:

commit dbd0472fd7a5bdd0b86c21c36f8afa713baa7653

Author: Michael Guralnik <[email protected]>
Date:   Thu Feb 26 15:52:16 2026 +0200

RDMA/nldev: Expose kernel-internal FRMR pools in netlink

Allow netlink users, through the usage of driver-details netlink attribute, to get information about internal FRMR pools that use the kernel_vendor_key FRMR key member.

Did some part get missed?

Jason

#14 lore raw
In reply to Chiara Meiohas
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 6 lines · On Mon, 30 Mar 2026 20:31:14 +0300 you wrote:

From Michael:

This series adds support for managing Fast Registration Memory Region (FRMR) pools in rdma tool, enabling users to monitor and configure FRMR pool behavior.

Quoted 7 lines

FRMR pools are used to cache and reuse Fast Registration Memory Region handles to improve performance by avoiding the overhead of repeated memory region creation and destruction. This series introduces commands to view FRMR pool statistics and configure pool parameters such as aging time and pinned handle count.

[...]

Here is the summary with links:
- [v2,iproute2-next,1/4] rdma: Update headers

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=93368ee34528
  - [v2,iproute2-next,2/4] rdma: Add resource FRMR pools show command
    (no matching commit)
  - [v2,iproute2-next,3/4] rdma: Add FRMR pools set aging command
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=26c8bc1e6563

- [v2,iproute2-next,4/4] rdma: Add FRMR pools set pinned command (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html