From: Konstantin Taranov <kotaranov@linux.microsoft.com>
To: kotaranov@microsoft.com, longli@microsoft.com, jgg@ziepe.ca,
leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH rdma-next 3/3] RDMA/mana_ib: fixed send wqe size support for RC QPs
Date: Fri, 7 Aug 2026 06:51:32 -0700 [thread overview]
Message-ID: <20260807135132.1618382-4-kotaranov@linux.microsoft.com> (raw)
In-Reply-To: <20260807135132.1618382-1-kotaranov@linux.microsoft.com>
From: Konstantin Taranov <kotaranov@microsoft.com>
Support fixed-size send WQEs for RC QPs when requested by userspace.
Calculate the WQE size from the maximum send SGE count and the 32-byte
inline OOB size, round it up to a power of two, and pass the size to
hardware in basic units.
When supported by the adapter, also enable placing the message sequence
number in the WQE. Preserve the existing variable-size WQE behavior when
userspace does not request fixed-size WQEs.
Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
---
drivers/infiniband/hw/mana/main.c | 3 +++
drivers/infiniband/hw/mana/mana_ib.h | 5 ++++-
drivers/infiniband/hw/mana/qp.c | 14 ++++++++++++++
include/net/mana/gdma.h | 1 +
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c
index 9d043f48e2729..57c6d9faaa81b 100644
--- a/drivers/infiniband/hw/mana/main.c
+++ b/drivers/infiniband/hw/mana/main.c
@@ -1060,6 +1060,9 @@ int mana_ib_gd_create_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp,
req.max_recv_sge = attr->cap.max_recv_sge;
req.flags = flags;
+ if (flags & MANA_RC_FLAG_FIXED_SIZE_WQE)
+ req.wqe_size_in_bu = qp->rc_qp.wqe_size_in_bu;
+
err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
if (err)
return err;
diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h
index 547ddf9ddfea5..828ca75fd6845 100644
--- a/drivers/infiniband/hw/mana/mana_ib.h
+++ b/drivers/infiniband/hw/mana/mana_ib.h
@@ -180,6 +180,7 @@ enum mana_rc_queue_type {
struct mana_ib_rc_qp {
struct mana_ib_queue queues[MANA_RC_QUEUE_TYPE_MAX];
+ u32 wqe_size_in_bu;
};
enum mana_uc_queue_type {
@@ -262,6 +263,7 @@ enum mana_ib_adapter_features {
MANA_IB_FEATURE_CLIENT_ERROR_CQE_SUPPORT = BIT(4),
MANA_IB_FEATURE_DEV_COUNTERS_SUPPORT = BIT(5),
MANA_IB_FEATURE_MULTI_PORTS_SUPPORT = BIT(6),
+ MANA_IB_FEATURE_MSN_IN_WQE_SUPPORT = BIT(7),
};
struct mana_ib_query_adapter_caps_resp {
@@ -391,7 +393,8 @@ struct mana_rnic_create_qp_req {
u32 max_recv_wr;
u32 max_send_sge;
u32 max_recv_sge;
- u32 reserved;
+ u8 wqe_size_in_bu;
+ u8 reserved[3];
}; /* HW Data */
struct mana_rnic_create_qp_resp {
diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
index c6821ae5fac1c..29bfee9ac997f 100644
--- a/drivers/infiniband/hw/mana/qp.c
+++ b/drivers/infiniband/hw/mana/qp.c
@@ -422,6 +422,11 @@ static u32 mana_ib_wqe_size(u32 sge, u32 oob_size)
return ALIGN(wqe_size, GDMA_WQE_BU_SIZE);
}
+static u32 mana_ib_fixed_wqe_size(u32 sge, u32 oob_size)
+{
+ return roundup_pow_of_two(mana_ib_wqe_size(sge, oob_size));
+}
+
static u32 mana_ib_queue_size(struct ib_qp_init_attr *attr, u32 queue_type)
{
u32 queue_size;
@@ -576,6 +581,15 @@ static int mana_ib_create_rc_qp(struct ib_qp *ibqp, struct ib_pd *ibpd,
j++;
}
+ if (ucmd.comp_mask & MANA_IB_RC_QP_FIXED_WQE) {
+ u32 wqe_size = mana_ib_fixed_wqe_size(attr->cap.max_send_sge,
+ INLINE_OOB_EXTRA_LARGE_SIZE);
+ flags |= MANA_RC_FLAG_FIXED_SIZE_WQE;
+ if (mdev->adapter_caps.feature_flags & MANA_IB_FEATURE_MSN_IN_WQE_SUPPORT)
+ flags |= MANA_RC_FLAG_MSN_IN_WQE;
+ qp->rc_qp.wqe_size_in_bu = wqe_size / GDMA_WQE_BU_SIZE;
+ }
+
err = mana_ib_gd_create_rc_qp(mdev, qp, attr, doorbell, flags);
if (err) {
ibdev_err(&mdev->ib_dev, "Failed to create rc qp %d\n", err);
diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h
index de17c9bba04b7..f3601ca78d02f 100644
--- a/include/net/mana/gdma.h
+++ b/include/net/mana/gdma.h
@@ -522,6 +522,7 @@ struct gdma_wqe {
#define INLINE_OOB_SMALL_SIZE 8
#define INLINE_OOB_LARGE_SIZE 24
+#define INLINE_OOB_EXTRA_LARGE_SIZE 32
#define MANA_MAX_TX_WQE_SGL_ENTRIES 30
--
2.43.0
prev parent reply other threads:[~2026-08-07 13:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 13:51 [PATCH rdma-next 0/3] RDMA/mana_ib: Extend MANA RC QP support for UAPI Konstantin Taranov
2026-08-07 13:51 ` [PATCH rdma-next 1/3] RDMA/mana_ib: Extend RC QP udata request and response Konstantin Taranov
2026-08-07 13:51 ` [PATCH rdma-next 2/3] RDMA/mana_ib: MMQ creation for RC QPs Konstantin Taranov
2026-08-07 13:51 ` Konstantin Taranov [this message]
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=20260807135132.1618382-4-kotaranov@linux.microsoft.com \
--to=kotaranov@linux.microsoft.com \
--cc=jgg@ziepe.ca \
--cc=kotaranov@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
/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