Skip to content

Commit 06e8d1d

Browse files
Yuval Bassonjgunthorpe
Yuval Basson
authored andcommitted
RDMA/qedr: Add support for user mode XRC-SRQ's
Implement the XRC specific verbs. The additional QP type introduced new logic to the rest of the verbs that now require distinguishing whether a QP has an "RQ" or an "SQ" or both. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: Yuval Basson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 9e054b1 commit 06e8d1d

File tree

4 files changed

+254
-92
lines changed

4 files changed

+254
-92
lines changed

drivers/infiniband/hw/qedr/main.c

+19
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ static int qedr_iw_register_device(struct qedr_dev *dev)
177177
}
178178

179179
static const struct ib_device_ops qedr_roce_dev_ops = {
180+
.alloc_xrcd = qedr_alloc_xrcd,
181+
.dealloc_xrcd = qedr_dealloc_xrcd,
180182
.get_port_immutable = qedr_roce_port_immutable,
181183
.query_pkey = qedr_query_pkey,
182184
};
@@ -186,6 +188,10 @@ static void qedr_roce_register_device(struct qedr_dev *dev)
186188
dev->ibdev.node_type = RDMA_NODE_IB_CA;
187189

188190
ib_set_device_ops(&dev->ibdev, &qedr_roce_dev_ops);
191+
192+
dev->ibdev.uverbs_cmd_mask |= QEDR_UVERBS(OPEN_XRCD) |
193+
QEDR_UVERBS(CLOSE_XRCD) |
194+
QEDR_UVERBS(CREATE_XSRQ);
189195
}
190196

191197
static const struct ib_device_ops qedr_dev_ops = {
@@ -232,6 +238,7 @@ static const struct ib_device_ops qedr_dev_ops = {
232238
INIT_RDMA_OBJ_SIZE(ib_cq, qedr_cq, ibcq),
233239
INIT_RDMA_OBJ_SIZE(ib_pd, qedr_pd, ibpd),
234240
INIT_RDMA_OBJ_SIZE(ib_srq, qedr_srq, ibsrq),
241+
INIT_RDMA_OBJ_SIZE(ib_xrcd, qedr_xrcd, ibxrcd),
235242
INIT_RDMA_OBJ_SIZE(ib_ucontext, qedr_ucontext, ibucontext),
236243
};
237244

@@ -705,6 +712,18 @@ static void qedr_affiliated_event(void *context, u8 e_code, void *fw_handle)
705712
event.event = IB_EVENT_SRQ_ERR;
706713
event_type = EVENT_TYPE_SRQ;
707714
break;
715+
case ROCE_ASYNC_EVENT_XRC_DOMAIN_ERR:
716+
event.event = IB_EVENT_QP_ACCESS_ERR;
717+
event_type = EVENT_TYPE_QP;
718+
break;
719+
case ROCE_ASYNC_EVENT_INVALID_XRCETH_ERR:
720+
event.event = IB_EVENT_QP_ACCESS_ERR;
721+
event_type = EVENT_TYPE_QP;
722+
break;
723+
case ROCE_ASYNC_EVENT_XRC_SRQ_CATASTROPHIC_ERR:
724+
event.event = IB_EVENT_CQ_ERR;
725+
event_type = EVENT_TYPE_CQ;
726+
break;
708727
default:
709728
DP_ERR(dev, "unsupported event %d on handle=%llx\n",
710729
e_code, roce_handle64);

drivers/infiniband/hw/qedr/qedr.h

+33
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ struct qedr_pd {
310310
struct qedr_ucontext *uctx;
311311
};
312312

313+
struct qedr_xrcd {
314+
struct ib_xrcd ibxrcd;
315+
u16 xrcd_id;
316+
};
317+
313318
struct qedr_qp_hwq_info {
314319
/* WQE Elements */
315320
struct qed_chain pbl;
@@ -361,6 +366,7 @@ struct qedr_srq {
361366
struct ib_umem *prod_umem;
362367
u16 srq_id;
363368
u32 srq_limit;
369+
bool is_xrc;
364370
/* lock to protect srq recv post */
365371
spinlock_t lock;
366372
};
@@ -573,6 +579,11 @@ static inline struct qedr_pd *get_qedr_pd(struct ib_pd *ibpd)
573579
return container_of(ibpd, struct qedr_pd, ibpd);
574580
}
575581

582+
static inline struct qedr_xrcd *get_qedr_xrcd(struct ib_xrcd *ibxrcd)
583+
{
584+
return container_of(ibxrcd, struct qedr_xrcd, ibxrcd);
585+
}
586+
576587
static inline struct qedr_cq *get_qedr_cq(struct ib_cq *ibcq)
577588
{
578589
return container_of(ibcq, struct qedr_cq, ibcq);
@@ -598,6 +609,28 @@ static inline struct qedr_srq *get_qedr_srq(struct ib_srq *ibsrq)
598609
return container_of(ibsrq, struct qedr_srq, ibsrq);
599610
}
600611

612+
static inline bool qedr_qp_has_srq(struct qedr_qp *qp)
613+
{
614+
return qp->srq;
615+
}
616+
617+
static inline bool qedr_qp_has_sq(struct qedr_qp *qp)
618+
{
619+
if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_TGT)
620+
return 0;
621+
622+
return 1;
623+
}
624+
625+
static inline bool qedr_qp_has_rq(struct qedr_qp *qp)
626+
{
627+
if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_INI ||
628+
qp->qp_type == IB_QPT_XRC_TGT || qedr_qp_has_srq(qp))
629+
return 0;
630+
631+
return 1;
632+
}
633+
601634
static inline struct qedr_user_mmap_entry *
602635
get_qedr_mmap_entry(struct rdma_user_mmap_entry *rdma_entry)
603636
{

0 commit comments

Comments
 (0)