Skip to contentSkip to conversation

RDMA/ionic: add DMA MR and v2 atomic WQE

PATCH Applied Abhijit Gangurde 3 participants 9 messages Nov 7 – Nov 16

Subsystems (5)
lore
Share & tools
lore

Abhijit Gangurde

author maintainer
#0 lore raw

cover RDMA/ionic: add DMA MR and v2 atomic WQE

Add a generic RDMA capability word to the LIF identity and use it to allocate a PD-scoped DMA memory region. Use the v2 atomic send WQE on RDMA version 2. Also fix the v1 atomic WQE so the operands are not overwritten by the common payload.

Net changes pull request:
The following changes since commit 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4:

Linux 7.4-rc1 (2026-11-01 13:26:31 -0800)

are available in the Git repository at:

https://github.com/abhijitG-xlnx/linux.git ionic-shared

for you to fetch changes up to e64b2ae81599ce9e17fab5e635b8fe22df09739b:

net: ionic: add an RDMA capability word to the LIF identity (2026-11-05 09:18:39 +0530)

Abhijit Gangurde (2):
net: ionic: add an RDMA capability word to the LIF identity RDMA/ionic: preserve atomic operands in the send WQE

Gregor Dick (2):
RDMA/ionic: allocate a PD-scoped DMA MR
RDMA/ionic: use the v2 atomic send WQE layout

 .../infiniband/hw/ionic/ionic_controlpath.c   | 38 +++++++++++++++++--
 drivers/infiniband/hw/ionic/ionic_datapath.c  | 17 +++++++--
 drivers/infiniband/hw/ionic/ionic_fw.h        | 31 +++++++++++++++
 drivers/infiniband/hw/ionic/ionic_ibdev.h     |  1 -
 drivers/infiniband/hw/ionic/ionic_lif_cfg.c   |  1 +
 drivers/infiniband/hw/ionic/ionic_lif_cfg.h   |  1 +
 .../net/ethernet/pensando/ionic/ionic_if.h    |  4 +-
 7 files changed, 83 insertions(+), 10 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/4 net: ionic: add an RDMA capability word to the LIF identity

Name the generic RDMA capability word in the LIF identity. The field replaces eight reserved bytes. The ethernet driver does not interpret it.

---
 drivers/net/ethernet/pensando/ionic/ionic_if.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_if.h +3 -1
index e911fad545d6..851bb618cff4 100644
@@ -579,6 +579,7 @@ enum ionic_lif_rdma_alloc_qid {
  *	@rdma.rsvd2:           Reserved byte(s)
  *	@rdma.alloc_qid_cap:   RDMA queue type QID allocation capability
  *	                       (bitmask of enum ionic_lif_rdma_alloc_qid)
+ *	@rdma.cap:             Generic capability bits
  *	@rdma.rsvd1:           Reserved byte(s)
  * @words:               word access to struct contents
  */
@@ -629,7 +630,8 @@ union ionic_lif_identity {
 			struct ionic_lif_logical_qtype srq_qtype;
 			u8 rsvd2[5];
 			u8 alloc_qid_cap;
-			u8 rsvd1[142];
+			__le64 cap;
+			u8 rsvd1[134];
 		} __packed rdma;
 	} __packed;
 	__le32 words[478];
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/4 RDMA/ionic: preserve atomic operands in the send WQE

In reply to Abhijit Gangurde

ionic_prep_common() writes the common length and scatter/gather element into the same body bytes as the atomic operands. Finish the atomic WQE with ionic_prep_base() instead.

Fixes b83c62055b6f ("RDMA/ionic: Register device ops for datapath")
---
 drivers/infiniband/hw/ionic/ionic_datapath.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/ionic/ionic_datapath.c +4 -1
index f1354dae089c..5b6f10256b49 100644
@@ -1054,7 +1054,10 @@ static int ionic_prep_atomic(struct ionic_qp *qp,
 	wqe->atomic.sge.len = cpu_to_be32(8);
 	wqe->atomic.sge.lkey = cpu_to_be32(wr->wr.sg_list[0].lkey);
 
-	return ionic_prep_common(qp, &wr->wr, meta, wqe);
+	meta->len = 8;
+	ionic_prep_base(qp, &wr->wr, meta, wqe);
+
+	return 0;
 }
 
 static int ionic_prep_inv(struct ionic_qp *qp,
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH 3/4 RDMA/ionic: allocate a PD-scoped DMA MR

In reply to Abhijit Gangurde

From: Gregor Dick <[email protected]>

ib_get_dma_mr() returns an rkey for an identity mapping of the whole address space, bound to the protection domain, with the requested access. CREATE_MR carries IONIC_MRF_DMA_MR and leaves the VA, length, and map_count at zero because firmware owns that mapping.

---
 .../infiniband/hw/ionic/ionic_controlpath.c   | 38 +++++++++++++++++--
 drivers/infiniband/hw/ionic/ionic_fw.h        | 16 ++++++++
 drivers/infiniband/hw/ionic/ionic_ibdev.h     |  1 -
 drivers/infiniband/hw/ionic/ionic_lif_cfg.c   |  1 +
 drivers/infiniband/hw/ionic/ionic_lif_cfg.h   |  1 +
 5 files changed, 52 insertions(+), 5 deletions(-)
drivers/infiniband/hw/ionic/ionic_controlpath.c +34 -4
index 8a0a1575a339..b7f878c79070 100644
@@ -910,20 +910,50 @@ static int ionic_destroy_mr_cmd(struct ionic_ibdev *dev, u32 mrid)
 
 struct ib_mr *ionic_get_dma_mr(struct ib_pd *ibpd, int access)
 {
+	struct ionic_ibdev *dev = to_ionic_ibdev(ibpd->device);
 	struct ionic_pd *pd = to_ionic_pd(ibpd);
 	struct ionic_mr *mr;
+	int rc;
 
 	mr = kzalloc_obj(*mr);
 	if (!mr)
 		return ERR_PTR(-ENOMEM);
 
-	mr->ibmr.lkey = IONIC_DMA_LKEY;
-	mr->ibmr.rkey = IONIC_DMA_RKEY;
-
-	if (pd)
+	if (!(dev->lif_cfg.cap & IONIC_GEN_CAP_DMA_MR)) {
+		mr->ibmr.lkey = IONIC_DMA_LKEY;
 		pd->flags |= IONIC_QPF_PRIVILEGED;
 
+		return &mr->ibmr;
+	}
+
+	rc = ionic_get_mrid(dev, &mr->mrid);
+	if (rc)
+		goto err_mrid;
+
+	mr->ibmr.lkey = mr->mrid;
+	mr->ibmr.rkey = mr->mrid;
+
+	/*
+	 * Identity map of the whole address space, bound to this pd.
+	 * Firmware owns that extent, so the VA, length, and map_count
+	 * stay zero.
+	 */
+	mr->flags = IONIC_MRF_DMA_MR | to_ionic_mr_flags(access);
+
+	rc = ionic_create_mr_cmd(dev, pd, mr, 0, 0);
+	if (rc)
+		goto err_cmd;
+
+	pd->flags |= IONIC_QPF_PRIVILEGED;
+
 	return &mr->ibmr;
+
+err_cmd:
+	ionic_put_mrid(dev, mr->mrid);
+err_mrid:
+	kfree(mr);
+
+	return ERR_PTR(rc);
 }
 
 struct ib_mr *ionic_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 length,
drivers/infiniband/hw/ionic/ionic_fw.h +16 -0
index b8e996d4b8b9..100138e4cae7 100644
@@ -11,6 +11,11 @@
 
 #define IONIC_EXP_DBELL_SZ		8
 
+/* ionic_lif_identity.rdma.cap bits */
+enum ionic_gen_cap_flags {
+	IONIC_GEN_CAP_DMA_MR = BIT(0),
+};
+
 enum ionic_mrid_bits {
 	IONIC_MRID_INDEX_SHIFT		= 8,
 };
@@ -47,6 +52,17 @@ enum ionic_mr_flags {
 	IONIC_MRF_PB			= BIT(7),
 	IONIC_MRF_ACCESS_MASK		= BIT(12) - 1,
 
+	/*
+	 * DMA_MR is an MR type selector, not an access permission. It
+	 * sits in an otherwise-unused bit inside the access-mask range
+	 * to_ionic_mr_flags() does not derive this bit from IB access
+	 * flags. Firmware tests it before decoding access bits and takes
+	 * a dedicated path.
+	 *
+	 * DMA_MR: identity map of the full address space, bound to a pd.
+	 */
+	IONIC_MRF_DMA_MR		= BIT(8),
+
 	/* bits that determine mr type */
 	IONIC_MRF_UKEY_EN		= BIT(13),
 	IONIC_MRF_IS_MW			= BIT(14),
drivers/infiniband/hw/ionic/ionic_ibdev.h +0 -1
index 127b79cdfc45..8e7e52c9f492 100644
@@ -44,7 +44,6 @@
 
 #define IONIC_ROCE_UDP_SPORT	28272
 #define IONIC_DMA_LKEY		0
-#define IONIC_DMA_RKEY		IONIC_DMA_LKEY
 
 #define IONIC_CMB_SUPPORTED \
 	(IONIC_CMB_ENABLE | IONIC_CMB_REQUIRE | IONIC_CMB_EXPDB | \
drivers/infiniband/hw/ionic/ionic_lif_cfg.c +1 -0
index 66cee57442e7..dcf54856603d 100644
@@ -95,6 +95,7 @@ void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg)
 	cfg->rq_expdb =
 	    !!(lif->qtype_info[IONIC_QTYPE_RXQ].features & IONIC_QIDENT_F_EXPDB);
 	cfg->alloc_qid_cap = ident->rdma.alloc_qid_cap;
+	cfg->cap = le64_to_cpu(ident->rdma.cap);
 }
 
 struct net_device *ionic_lif_netdev(struct ionic_lif *lif)
drivers/infiniband/hw/ionic/ionic_lif_cfg.h +1 -0
index bc14fc0921da..998785fef2f1 100644
@@ -26,6 +26,7 @@ struct ionic_lif_cfg {
 	void *phc_state;
 
 	u64 page_size_supported;
+	u64 cap;
 	u32 npts_per_lif;
 	u32 nmrs_per_lif;
 	u32 nahs_per_lif;
Signature · 1 line
2.43.0
#4 lore raw

Re: [for-next 3/4] RDMA/ionic: allocate a PD-scoped DMA MR

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] RDMA/ionic: build failure in ionic_fill_lif_cfg() due to missing rdma.cap --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] RDMA/ionic: build failure in ionic_fill_lif_cfg() due to missing rdma.cap
--

commit 71ee46b9e5e60e185b9553d17b2722a569d100ad
Author: Gregor Dick <[email protected]>

RDMA/ionic: allocate a PD-scoped DMA MR

This commit allocates a PD-scoped DMA MR via CREATE_MR with IONIC_MRF_DMA_MR when the firmware advertises IONIC_GEN_CAP_DMA_MR.

[ ... ]

drivers/infiniband/hw/ionic/ionic_lif_cfg.c void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg) · line 99

Quoted 10 lines
drivers/infiniband/hw/ionic/ionic_lif_cfg.c +1 -0
index 66cee57442e7a..dcf54856603d4 100644
@@ -95,6 +95,7 @@ void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg)
 	cfg->rq_expdb =
 	    !!(lif->qtype_info[IONIC_QTYPE_RXQ].features & IONIC_QIDENT_F_EXPDB);
 	cfg->alloc_qid_cap = ident->rdma.alloc_qid_cap;
+	cfg->cap = le64_to_cpu(ident->rdma.cap);
 }

[Severity: High]
Does this break the build when CONFIG_INFINIBAND_IONIC is enabled? The rdma struct inside union ionic_lif_identity in drivers/net/ethernet/pensando/ionic/ionic_if.h has no cap member.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#5 lore raw

Re: [for-next 3/4] RDMA/ionic: allocate a PD-scoped DMA MR

Quoted 16 lines · On 11/8/26 20:34, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] RDMA/ionic: build failure in ionic_fill_lif_cfg() due to missing rdma.cap
--

commit 71ee46b9e5e60e185b9553d17b2722a569d100ad
Author: Gregor Dick <[email protected]>

RDMA/ionic: allocate a PD-scoped DMA MR

This commit allocates a PD-scoped DMA MR via CREATE_MR with IONIC_MRF_DMA_MR when the firmware advertises IONIC_GEN_CAP_DMA_MR.

[ ... ]

Quoted 14 lines

drivers/infiniband/hw/ionic/ionic_lif_cfg.c void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg) · line 99

Quoted 10 lines
drivers/infiniband/hw/ionic/ionic_lif_cfg.c +1 -0
index 66cee57442e7a..dcf54856603d4 100644
@@ -95,6 +95,7 @@ void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg)
  	cfg->rq_expdb =
  	    !!(lif->qtype_info[IONIC_QTYPE_RXQ].features & IONIC_QIDENT_F_EXPDB);
  	cfg->alloc_qid_cap = ident->rdma.alloc_qid_cap;
+	cfg->cap = le64_to_cpu(ident->rdma.cap);
  }

[Severity: High]
Does this break the build when CONFIG_INFINIBAND_IONIC is enabled? The rdma struct inside union ionic_lif_identity in drivers/net/ethernet/pensando/ionic/ionic_if.h has no cap member.

Patch 1/4 adds __le64 cap to ionic_lif_identity.rdma (replacing reserved bytes). Patch 3/4 uses that field, so the build succeeds when the series is applied in order. This appears to be a series context false positive(?)

Abhijit

#6 lore raw

Re: [for-next 3/4] RDMA/ionic: allocate a PD-scoped DMA MR

Quoted 33 lines · Abhijit Gangurde
Quoted 16 lines · On 11/8/26 20:34, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] RDMA/ionic: build failure in ionic_fill_lif_cfg() due to missing rdma.cap
--

commit 71ee46b9e5e60e185b9553d17b2722a569d100ad
Author: Gregor Dick <[email protected]>

RDMA/ionic: allocate a PD-scoped DMA MR

This commit allocates a PD-scoped DMA MR via CREATE_MR with IONIC_MRF_DMA_MR when the firmware advertises IONIC_GEN_CAP_DMA_MR.

[ ... ]

Quoted 14 lines

drivers/infiniband/hw/ionic/ionic_lif_cfg.c void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg) · line 99

Quoted 10 lines
drivers/infiniband/hw/ionic/ionic_lif_cfg.c +1 -0
index 66cee57442e7a..dcf54856603d4 100644
@@ -95,6 +95,7 @@ void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg)
  	cfg->rq_expdb =
  	    !!(lif->qtype_info[IONIC_QTYPE_RXQ].features & IONIC_QIDENT_F_EXPDB);
  	cfg->alloc_qid_cap = ident->rdma.alloc_qid_cap;
+	cfg->cap = le64_to_cpu(ident->rdma.cap);
  }

[Severity: High]
Does this break the build when CONFIG_INFINIBAND_IONIC is enabled? The rdma struct inside union ionic_lif_identity in drivers/net/ethernet/pensando/ionic/ionic_if.h has no cap member.

Quoted 3 lines

Patch 1/4 adds __le64 cap to ionic_lif_identity.rdma (replacing reserved bytes). Patch 3/4 uses that field, so the build succeeds when the series is applied in order. This appears to be a series context false positive(?)

I don't know, maybe because net patch was involved.

Thanks

Quoted 4 lines

Abhijit

author maintainer
#7 lore raw

PATCH 4/4 RDMA/ionic: use the v2 atomic send WQE layout

In reply to Abhijit Gangurde

From: Gregor Dick <[email protected]>

Firmware with RDMA version 2 reads the atomic local operand from the v2 atomic body. The lkey follows compare_low, and the 8-byte local VA is at offset 32. Version 1 keeps the SGE layout. Select the body with the same RDMA version that already selects the atomic opcode.

---
 drivers/infiniband/hw/ionic/ionic_datapath.c | 12 +++++++++---
 drivers/infiniband/hw/ionic/ionic_fw.h       | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)
drivers/infiniband/hw/ionic/ionic_datapath.c +9 -3
index 5b6f10256b49..75f82c21cc03 100644
@@ -1050,9 +1050,15 @@ static int ionic_prep_atomic(struct ionic_qp *qp,
 	wqe->atomic.remote_rkey = cpu_to_be32(wr->rkey);
 
 	wqe->base.num_sge_key = 1;
-	wqe->atomic.sge.va = cpu_to_be64(wr->wr.sg_list[0].addr);
-	wqe->atomic.sge.len = cpu_to_be32(8);
-	wqe->atomic.sge.lkey = cpu_to_be32(wr->wr.sg_list[0].lkey);
+
+	if (dev->lif_cfg.rdma_version >= 2) {
+		wqe->atomic_v2.local_va = cpu_to_be64(wr->wr.sg_list[0].addr);
+		wqe->atomic_v2.lkey = cpu_to_be32(wr->wr.sg_list[0].lkey);
+	} else {
+		wqe->atomic.sge.va = cpu_to_be64(wr->wr.sg_list[0].addr);
+		wqe->atomic.sge.len = cpu_to_be32(8);
+		wqe->atomic.sge.lkey = cpu_to_be32(wr->wr.sg_list[0].lkey);
+	}
 
 	meta->len = 8;
 	ionic_prep_base(qp, &wr->wr, meta, wqe);
drivers/infiniband/hw/ionic/ionic_fw.h +15 -0
index 100138e4cae7..3f8b69e114a7 100644
@@ -495,6 +495,20 @@ struct ionic_v1_atomic_bdy {
 	struct ionic_sge		sge;
 };
 
+/* v2 atomic wqe body */
+struct ionic_v2_atomic_bdy {
+	__be32				remote_va_high;
+	__be32				remote_va_low;
+	__be32				remote_rkey;
+	__be32				swap_add_high;
+	__be32				swap_add_low;
+	__be32				compare_high;
+	__be32				compare_low;
+	__be32				lkey;
+	__be64				local_va;
+	__u8				rsvd_expdb[8];
+};
+
 /* v1 reg mr wqe body */
 struct ionic_v1_reg_mr_bdy {
 	__be64				va;
@@ -524,6 +538,7 @@ struct ionic_v1_wqe {
 		struct ionic_v1_recv_bdy	recv;
 		struct ionic_v1_common_bdy	common;
 		struct ionic_v1_atomic_bdy	atomic;
+		struct ionic_v2_atomic_bdy	atomic_v2;
 		struct ionic_v1_reg_mr_bdy	reg_mr;
 		struct ionic_v1_bind_mw_bdy	bind_mw;
 	};
Signature · 1 line
2.43.0
#8 lore raw
In reply to Abhijit Gangurde
Quoted 9 lines · Abhijit Gangurde

Add a generic RDMA capability word to the LIF identity and use it to allocate a PD-scoped DMA memory region. Use the v2 atomic send WQE on RDMA version 2. Also fix the v1 atomic WQE so the operands are not overwritten by the common payload.

Net changes pull request:
The following changes since commit 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4:

[...]

Applied, thanks!

[1/4] net: ionic: add an RDMA capability word to the LIF identity

      https://git.kernel.org/rdma/rdma/c/26493e277218e4
[2/4] RDMA/ionic: preserve atomic operands in the send WQE
      https://git.kernel.org/rdma/rdma/c/70c30baa7b3f04
[3/4] RDMA/ionic: allocate a PD-scoped DMA MR
      https://git.kernel.org/rdma/rdma/c/e83ddee506e24b
[4/4] RDMA/ionic: use the v2 atomic send WQE layout
      https://git.kernel.org/rdma/rdma/c/586be88310461a

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>