public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <jgg@ziepe.ca>, <leon@kernel.org>, <brett.creeley@amd.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <allen.hubbe@amd.com>, <nikhil.agarwal@amd.com>,
	<linux-rdma@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Abhijit Gangurde <abhijit.gangurde@amd.com>
Subject: [PATCH 3/3] RDMA/ionic: Support QP transport mode selection in create and modify
Date: Thu, 30 Apr 2026 18:09:31 +0530	[thread overview]
Message-ID: <20260430123931.3256130-4-abhijit.gangurde@amd.com> (raw)
In-Reply-To: <20260430123931.3256130-1-abhijit.gangurde@amd.com>

Allow userspace to specify the QP transport mode and number of
reorder completion queue paths during QP creation and modification.

Extend ionic_qp_req with transport_mode, num_rcq_paths, and
ionic_flags fields. The transport mode selects the firmware QP type,
ionic_flags are forwarded in the upper bits of priv_flags during
QP creation, and num_rcq_paths is passed to firmware during QP
modify.

Co-developed-by: Allen Hubbe <allen.hubbe@amd.com>
Signed-off-by: Allen Hubbe <allen.hubbe@amd.com>
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
 .../infiniband/hw/ionic/ionic_controlpath.c    | 16 +++++++++++-----
 drivers/infiniband/hw/ionic/ionic_fw.h         | 18 +++++++++++++++---
 drivers/infiniband/hw/ionic/ionic_ibdev.h      |  1 +
 include/uapi/rdma/ionic-abi.h                  |  5 ++++-
 4 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c
index 6bb645713d6b..5a6d4036ea98 100644
--- a/drivers/infiniband/hw/ionic/ionic_controlpath.c
+++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c
@@ -1326,7 +1326,9 @@ static int ionic_create_qp_cmd(struct ionic_ibdev *dev,
 			       struct ionic_qp *qp,
 			       struct ionic_tbl_buf *sq_buf,
 			       struct ionic_tbl_buf *rq_buf,
-			       struct ib_qp_init_attr *attr)
+			       struct ib_qp_init_attr *attr,
+			       u32 ionic_flags,
+			       enum ionic_qp_transport_mode transport_mode)
 {
 	const u16 dbid = ionic_obj_dbid(dev, pd->ibpd.uobject);
 	const u32 flags = to_ionic_qp_flags(0, 0,
@@ -1342,8 +1344,9 @@ static int ionic_create_qp_cmd(struct ionic_ibdev *dev,
 			.len = cpu_to_le16(IONIC_ADMIN_CREATE_QP_IN_V1_LEN),
 			.cmd.create_qp = {
 				.pd_id = cpu_to_le32(pd->pdid),
-				.priv_flags = cpu_to_be32(flags),
-				.type_state = to_ionic_qp_type(attr->qp_type),
+				.priv_flags = cpu_to_be32(flags |
+						(ionic_flags & IONIC_QP_USER_FLAGS_MASK)),
+				.type_state = to_ionic_qp_type(attr->qp_type, transport_mode),
 				.dbid_flags = cpu_to_le16(dbid),
 				.id_ver = cpu_to_le32(qp->qpid),
 			}
@@ -1412,6 +1415,7 @@ static int ionic_modify_qp_cmd(struct ionic_ibdev *dev,
 					  (attr->rnr_retry << 4)),
 				.rnr_timer = attr->min_rnr_timer,
 				.retry_timeout = attr->timeout,
+				.mrc_num_paths = qp->num_rcq_paths,
 				.type_state = state,
 				.id_ver = cpu_to_le32(qp->qpid),
 			}
@@ -2156,7 +2160,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,
 	int rc;
 
 	if (udata) {
-		rc = ib_copy_validate_udata_in(udata, req, rsvd);
+		rc = ib_copy_validate_udata_in(udata, req, ionic_flags);
 		if (rc)
 			return rc;
 	} else {
@@ -2203,6 +2207,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,
 
 	qp->sig_all = attr->sq_sig_type == IB_SIGNAL_ALL_WR;
 	qp->has_ah = attr->qp_type == IB_QPT_RC;
+	qp->num_rcq_paths = req.num_rcq_paths;
 
 	if (qp->has_ah) {
 		qp->hdr = kzalloc_obj(*qp->hdr);
@@ -2239,7 +2244,8 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,
 	rc = ionic_create_qp_cmd(dev, pd,
 				 to_ionic_vcq_cq(attr->send_cq, qp->udma_idx),
 				 to_ionic_vcq_cq(attr->recv_cq, qp->udma_idx),
-				 qp, &sq_buf, &rq_buf, attr);
+				 qp, &sq_buf, &rq_buf, attr, req.ionic_flags,
+				 req.transport_mode);
 	if (rc)
 		goto err_cmd;
 
diff --git a/drivers/infiniband/hw/ionic/ionic_fw.h b/drivers/infiniband/hw/ionic/ionic_fw.h
index adfbb89d856c..3a31cd9073ca 100644
--- a/drivers/infiniband/hw/ionic/ionic_fw.h
+++ b/drivers/infiniband/hw/ionic/ionic_fw.h
@@ -105,6 +105,8 @@ enum ionic_qp_flags {
 	IONIC_QPF_SQ_CMB		= BIT(13),
 	IONIC_QPF_RQ_CMB		= BIT(14),
 	IONIC_QPF_PRIVILEGED		= BIT(15),
+
+	IONIC_QP_USER_FLAGS_MASK	= GENMASK(31, 16),
 };
 
 static inline int from_ionic_qp_flags(int flags)
@@ -218,6 +220,11 @@ static inline int ionic_to_ib_status(int sts)
 	}
 }
 
+enum ionic_qp_transport_mode {
+	IONIC_QPT_TRANSPORT_ROCE_V2 = BIT(0),
+	IONIC_QPT_TRANSPORT_MRC = BIT(1),
+};
+
 /* admin queue qp type */
 enum ionic_qp_type {
 	IONIC_QPT_RC,
@@ -228,16 +235,21 @@ enum ionic_qp_type {
 	IONIC_QPT_XRC_INI,
 	IONIC_QPT_XRC_TGT,
 	IONIC_QPT_XRC_SRQ,
+	IONIC_QPT_MRC,
 };
 
-static inline int to_ionic_qp_type(enum ib_qp_type type)
+static inline int to_ionic_qp_type(enum ib_qp_type type,
+				   enum ionic_qp_transport_mode tm)
 {
 	switch (type) {
 	case IB_QPT_GSI:
 	case IB_QPT_UD:
 		return IONIC_QPT_UD;
 	case IB_QPT_RC:
-		return IONIC_QPT_RC;
+		if (tm == IONIC_QPT_TRANSPORT_MRC)
+			return IONIC_QPT_MRC;
+		else
+			return IONIC_QPT_RC;
 	case IB_QPT_UC:
 		return IONIC_QPT_UC;
 	case IB_QPT_XRC_INI:
@@ -808,7 +820,7 @@ struct ionic_admin_mod_qp {
 	__le32		ah_id_len;
 	__u8		en_pcp;
 	__u8		ip_dscp;
-	__u8		rsvd2;
+	__u8		mrc_num_paths;
 	__u8		type_state;
 	union {
 		struct {
diff --git a/drivers/infiniband/hw/ionic/ionic_ibdev.h b/drivers/infiniband/hw/ionic/ionic_ibdev.h
index 63828240d659..24a7f93e1f00 100644
--- a/drivers/infiniband/hw/ionic/ionic_ibdev.h
+++ b/drivers/infiniband/hw/ionic/ionic_ibdev.h
@@ -253,6 +253,7 @@ struct ionic_qp {
 	u8			has_sq:1;
 	u8			has_rq:1;
 	u8			sig_all:1;
+	u8			num_rcq_paths;
 
 	struct list_head	qp_list_counter;
 
diff --git a/include/uapi/rdma/ionic-abi.h b/include/uapi/rdma/ionic-abi.h
index fb0d13094c12..bd02e4541d85 100644
--- a/include/uapi/rdma/ionic-abi.h
+++ b/include/uapi/rdma/ionic-abi.h
@@ -85,7 +85,10 @@ struct ionic_qp_req {
 	__u8 sq_cmb;
 	__u8 rq_cmb;
 	__u8 udma_mask;
-	__u8 rsvd[3];
+	__u8 num_rcq_paths;
+	__u8 transport_mode;
+	__u8 rsvd;
+	__u32 ionic_flags;
 };
 
 struct ionic_qp_resp {
-- 
2.43.0


      parent reply	other threads:[~2026-04-30 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 12:39 [PATCH 0/3] Add Reorder Completion Queue (RCQ) support Abhijit Gangurde
2026-04-30 12:39 ` [PATCH 1/3] net: ionic: Fetch default QP transport mode and RCQ capabilities from firmware Abhijit Gangurde
2026-04-30 12:39 ` [PATCH 2/3] RDMA/ionic: Expose QP transport mode and RCQ sign bit to userspace Abhijit Gangurde
2026-04-30 12:39 ` Abhijit Gangurde [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=20260430123931.3256130-4-abhijit.gangurde@amd.com \
    --to=abhijit.gangurde@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=pabeni@redhat.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