Skip to contentSkip to conversation

RDMA/efa: Add support for MR relaxed ordering

PATCH In review Yonatan Nachum 3 participants 7 messages Aug 24 – Sep 22

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

v2 cover RDMA/efa: Add support for MR relaxed ordering

Changelog:
v2:
* Remove the relaxed ordering device capability.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for MR relaxed ordering access flag, allowing userspace to create PCIe relaxed ordering MRs.

Dana Malachi (2):
RDMA/efa: Use device ABI MR permissions instead of verbs flags RDMA/efa: Pass relaxed ordering flag to device

 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 9 ++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 8 ++++++--
 drivers/infiniband/hw/efa/efa_verbs.c           | 5 ++++-
 4 files changed, 21 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH v2 1/2 RDMA/efa: Use device ABI MR permissions instead of verbs flags

From: Dana Malachi <[email protected]>

Set MR permissions explicitly using device interface definitions rather than copying raw verbs access flags. This is needed for the next commit, to allow access flag bits that are not in the permissions field.

---
 drivers/infiniband/hw/efa/efa_com_cmd.c | 7 ++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h | 7 +++++--
 drivers/infiniband/hw/efa/efa_verbs.c   | 4 +++-
 3 files changed, 14 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_com_cmd.c +6 -1
index 1b00f16b8ea8..aac0e936601a 100644
@@ -237,7 +237,12 @@ int efa_com_register_mr(struct efa_com_dev *edev,
 	EFA_SET(&mr_cmd.flags, EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT,
 		params->page_shift);
 	mr_cmd.iova = params->iova;
-	mr_cmd.permissions = params->permissions;
+	if (params->permissions.local_write)
+		EFA_SET(&mr_cmd.permissions, EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE, 1);
+	if (params->permissions.remote_write)
+		EFA_SET(&mr_cmd.permissions, EFA_ADMIN_REG_MR_CMD_REMOTE_WRITE_ENABLE, 1);
+	if (params->permissions.remote_read)
+		EFA_SET(&mr_cmd.permissions, EFA_ADMIN_REG_MR_CMD_REMOTE_READ_ENABLE, 1);
 
 	if (params->inline_pbl) {
 		memcpy(mr_cmd.pbl.inline_pbl_array,
drivers/infiniband/hw/efa/efa_com_cmd.h +5 -2
index bca722f021ea..7b0399811cfd 100644
@@ -204,8 +204,11 @@ struct efa_com_reg_mr_params {
 	 * address mapping
 	 */
 	u8 page_shift;
-	/* see permissions field of struct efa_admin_reg_mr_cmd */
-	u8 permissions;
+	struct {
+		u8 local_write : 1;
+		u8 remote_write : 1;
+		u8 remote_read : 1;
+	} permissions;
 	u8 inline_pbl;
 	u8 indirect;
 };
drivers/infiniband/hw/efa/efa_verbs.c +3 -1
index 2d28d68efe77..635687275350 100644
@@ -1676,7 +1676,9 @@ static int efa_register_mr(struct ib_pd *ibpd, struct efa_mr *mr, u64 start,
 	params.pd = to_epd(ibpd)->pdn;
 	params.iova = virt_addr;
 	params.mr_length_in_bytes = length;
-	params.permissions = access_flags;
+	params.permissions.local_write = !!(access_flags & IB_ACCESS_LOCAL_WRITE);
+	params.permissions.remote_write = !!(access_flags & IB_ACCESS_REMOTE_WRITE);
+	params.permissions.remote_read = !!(access_flags & IB_ACCESS_REMOTE_READ);
 
 	pg_sz = ib_umem_find_best_pgsz(mr->umem,
 				       dev->dev_attr.page_size_cap,
Signature · 1 line
2.50.1
#2 lore raw

PATCH v2 2/2 RDMA/efa: Pass relaxed ordering flag to device

In reply to Yonatan Nachum

From: Dana Malachi <[email protected]>

Accept the relaxed ordering access flag during memory region registration and forward it to the device firmware via the admin command path.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 2 ++
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 1 +
 4 files changed, 7 insertions(+), 2 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +3 -2
index ab830764e3b4..30a38e633bfd 100644
@@ -358,7 +358,8 @@ struct efa_admin_reg_mr_cmd {
 	 * 5:0 : phys_page_size_shift - page size is (1 <<
 	 *    phys_page_size_shift). Page size is used for
 	 *    building the Virtual to Physical address mapping
-	 * 6 : reserved - MBZ
+	 * 6 : relaxed_ordering_enable - Enable PCIe relaxed
+	 *    ordering for this memory region
 	 * 7 : mem_addr_phy_mode_en - Enable bit for physical
 	 *    memory registration (no translation), can be used
 	 *    only by privileged clients. If set, PBL must
@@ -1203,6 +1204,7 @@ struct efa_admin_modify_event_counter_resp {
 
 /* reg_mr_cmd */
 #define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK      GENMASK(5, 0)
+#define EFA_ADMIN_REG_MR_CMD_RELAXED_ORDERING_ENABLE_MASK   BIT(6)
 #define EFA_ADMIN_REG_MR_CMD_MEM_ADDR_PHY_MODE_EN_MASK      BIT(7)
 #define EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE_MASK        BIT(0)
 #define EFA_ADMIN_REG_MR_CMD_REMOTE_WRITE_ENABLE_MASK       BIT(1)
@@ -1231,7 +1233,6 @@ struct efa_admin_modify_event_counter_resp {
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_WRITE_MASK  BIT(3)
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_UNSOLICITED_WRITE_RECV_MASK BIT(4)
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_EVENT_COUNTERS_MASK BIT(5)
-#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_SQ_64_BIT_REQ_ID_SHIFT 10
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_SQ_64_BIT_REQ_ID_MASK BIT(10)
 
 /* feature_queue_attr_desc_2 */
drivers/infiniband/hw/efa/efa_com_cmd.c +2 -0
index aac0e936601a..07bfcb093df8 100644
@@ -236,6 +236,8 @@ int efa_com_register_mr(struct efa_com_dev *edev,
 	mr_cmd.mr_length = params->mr_length_in_bytes;
 	EFA_SET(&mr_cmd.flags, EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT,
 		params->page_shift);
+	if (params->relaxed_ordering)
+		EFA_SET(&mr_cmd.flags, EFA_ADMIN_REG_MR_CMD_RELAXED_ORDERING_ENABLE, 1);
 	mr_cmd.iova = params->iova;
 	if (params->permissions.local_write)
 		EFA_SET(&mr_cmd.permissions, EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE, 1);
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index 7b0399811cfd..524407f36d43 100644
@@ -209,6 +209,7 @@ struct efa_com_reg_mr_params {
 		u8 remote_write : 1;
 		u8 remote_read : 1;
 	} permissions;
+	u8 relaxed_ordering;
 	u8 inline_pbl;
 	u8 indirect;
 };
drivers/infiniband/hw/efa/efa_verbs.c +1 -0
index 635687275350..9e4435401a4c 100644
@@ -1679,6 +1679,7 @@ static int efa_register_mr(struct ib_pd *ibpd, struct efa_mr *mr, u64 start,
 	params.permissions.local_write = !!(access_flags & IB_ACCESS_LOCAL_WRITE);
 	params.permissions.remote_write = !!(access_flags & IB_ACCESS_REMOTE_WRITE);
 	params.permissions.remote_read = !!(access_flags & IB_ACCESS_REMOTE_READ);
+	params.relaxed_ordering = !!(access_flags & IB_ACCESS_RELAXED_ORDERING);
 
 	pg_sz = ib_umem_find_best_pgsz(mr->umem,
 				       dev->dev_attr.page_size_cap,
Signature · 1 line
2.50.1
#3 lore raw
In reply to Yonatan Nachum
Quoted 13 lines · Yonatan Nachum

Changelog:
v2:
* Remove the relaxed ordering device capability.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for MR relaxed ordering access flag, allowing userspace to create PCIe relaxed ordering MRs.

Dana Malachi (2):
RDMA/efa: Use device ABI MR permissions instead of verbs flags RDMA/efa: Pass relaxed ordering flag to device

Quoted 9 lines
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 9 ++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 8 ++++++--
 drivers/infiniband/hw/efa/efa_verbs.c           | 5 ++++-
 4 files changed, 21 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.1

Hi, kind reminder for this series.
I reviewed the Sashiko comments and no changes are needed.

Thanks.

#4 lore raw
Quoted 20 lines · Yonatan Nachum
Quoted 19 lines · Yonatan Nachum

Changelog:
v2:
* Remove the relaxed ordering device capability.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for MR relaxed ordering access flag, allowing userspace to create PCIe relaxed ordering MRs.

Dana Malachi (2):
RDMA/efa: Use device ABI MR permissions instead of verbs flags RDMA/efa: Pass relaxed ordering flag to device

 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 9 ++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 8 ++++++--
 drivers/infiniband/hw/efa/efa_verbs.c           | 5 ++++-
 4 files changed, 21 insertions(+), 6 deletions(-)
Quoted 6 lines
Quoted 3 lines
Signature · 1 line
2.50.1

Hi, kind reminder for this series.
I reviewed the Sashiko comments and no changes are needed.

It is always good to know, even three weeks after the review was performed by Sashiko.

Please refrain from sending new features during the merge window, as we mostly ignore submissions during that period.

Thanks

Quoted 2 lines

Thanks.

maintainer
#5 lore raw

On Tue, Sep 15, 2026 at 02:09:09PM +0300, Leon Romanovsky wrote:w3esq23

Quoted 28 lines · Yonatan Nachum
Quoted 20 lines · Yonatan Nachum
Quoted 19 lines

Changelog:
v2:
* Remove the relaxed ordering device capability.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for MR relaxed ordering access flag, allowing userspace to create PCIe relaxed ordering MRs.

Dana Malachi (2):
RDMA/efa: Use device ABI MR permissions instead of verbs flags RDMA/efa: Pass relaxed ordering flag to device

 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 9 ++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 8 ++++++--
 drivers/infiniband/hw/efa/efa_verbs.c           | 5 ++++-
 4 files changed, 21 insertions(+), 6 deletions(-)
Quoted 6 lines
Quoted 3 lines
Signature · 1 line
2.50.1

Hi, kind reminder for this series.
I reviewed the Sashiko comments and no changes are needed.

Quoted 7 lines

It is always good to know, even three weeks after the review was performed by Sashiko.

Please refrain from sending new features during the merge window, as we mostly ignore submissions during that period.

Thanks

Leon, do you want us to resend it?

#6 lore raw
Quoted 33 lines · Michael Margolin

On Tue, Sep 15, 2026 at 02:09:09PM +0300, Leon Romanovsky wrote:w3esq23

Quoted 31 lines · Yonatan Nachum
Quoted 20 lines · Yonatan Nachum
Quoted 19 lines

Changelog:
v2:
* Remove the relaxed ordering device capability.
v1: https://lore.kernel.org/all/[email protected]/

-------------------------------------------------------------------------
Add support for MR relaxed ordering access flag, allowing userspace to create PCIe relaxed ordering MRs.

Dana Malachi (2):
RDMA/efa: Use device ABI MR permissions instead of verbs flags RDMA/efa: Pass relaxed ordering flag to device

 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 5 +++--
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 9 ++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 8 ++++++--
 drivers/infiniband/hw/efa/efa_verbs.c           | 5 ++++-
 4 files changed, 21 insertions(+), 6 deletions(-)
Quoted 6 lines
Quoted 3 lines
Signature · 1 line
2.50.1

Hi, kind reminder for this series.
I reviewed the Sashiko comments and no changes are needed.

It is always good to know, even three weeks after the review was performed by Sashiko.

Quoted 6 lines
Quoted 4 lines

Please refrain from sending new features during the merge window, as we mostly ignore submissions during that period.

Thanks

Leon, do you want us to resend it?

Yes, please.

Thanks

Quoted 1 line