[PATCH 3/3] RDMA/ionic: Support QP transport mode selection in create and modify
From: Abhijit Gangurde
Date: Thu Apr 30 2026 - 08:44:57 EST
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@xxxxxxx>
Signed-off-by: Allen Hubbe <allen.hubbe@xxxxxxx>
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@xxxxxxx>
---
.../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