Skip to content

Commit

Permalink
RDMA/qedr: Add support for user mode XRC-SRQ's
Browse files Browse the repository at this point in the history
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/20200722102339.30104-1-ybason@marvell.com
Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: Yuval Basson <ybason@marvell.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Yuval Basson authored and jgunthorpe committed Sep 16, 2020
1 parent 9e054b1 commit 06e8d1d
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 92 deletions.
19 changes: 19 additions & 0 deletions drivers/infiniband/hw/qedr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ static int qedr_iw_register_device(struct qedr_dev *dev)
}

static const struct ib_device_ops qedr_roce_dev_ops = {
.alloc_xrcd = qedr_alloc_xrcd,
.dealloc_xrcd = qedr_dealloc_xrcd,
.get_port_immutable = qedr_roce_port_immutable,
.query_pkey = qedr_query_pkey,
};
Expand All @@ -186,6 +188,10 @@ static void qedr_roce_register_device(struct qedr_dev *dev)
dev->ibdev.node_type = RDMA_NODE_IB_CA;

ib_set_device_ops(&dev->ibdev, &qedr_roce_dev_ops);

dev->ibdev.uverbs_cmd_mask |= QEDR_UVERBS(OPEN_XRCD) |
QEDR_UVERBS(CLOSE_XRCD) |
QEDR_UVERBS(CREATE_XSRQ);
}

static const struct ib_device_ops qedr_dev_ops = {
Expand Down Expand Up @@ -232,6 +238,7 @@ static const struct ib_device_ops qedr_dev_ops = {
INIT_RDMA_OBJ_SIZE(ib_cq, qedr_cq, ibcq),
INIT_RDMA_OBJ_SIZE(ib_pd, qedr_pd, ibpd),
INIT_RDMA_OBJ_SIZE(ib_srq, qedr_srq, ibsrq),
INIT_RDMA_OBJ_SIZE(ib_xrcd, qedr_xrcd, ibxrcd),
INIT_RDMA_OBJ_SIZE(ib_ucontext, qedr_ucontext, ibucontext),
};

Expand Down Expand Up @@ -705,6 +712,18 @@ static void qedr_affiliated_event(void *context, u8 e_code, void *fw_handle)
event.event = IB_EVENT_SRQ_ERR;
event_type = EVENT_TYPE_SRQ;
break;
case ROCE_ASYNC_EVENT_XRC_DOMAIN_ERR:
event.event = IB_EVENT_QP_ACCESS_ERR;
event_type = EVENT_TYPE_QP;
break;
case ROCE_ASYNC_EVENT_INVALID_XRCETH_ERR:
event.event = IB_EVENT_QP_ACCESS_ERR;
event_type = EVENT_TYPE_QP;
break;
case ROCE_ASYNC_EVENT_XRC_SRQ_CATASTROPHIC_ERR:
event.event = IB_EVENT_CQ_ERR;
event_type = EVENT_TYPE_CQ;
break;
default:
DP_ERR(dev, "unsupported event %d on handle=%llx\n",
e_code, roce_handle64);
Expand Down
33 changes: 33 additions & 0 deletions drivers/infiniband/hw/qedr/qedr.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ struct qedr_pd {
struct qedr_ucontext *uctx;
};

struct qedr_xrcd {
struct ib_xrcd ibxrcd;
u16 xrcd_id;
};

struct qedr_qp_hwq_info {
/* WQE Elements */
struct qed_chain pbl;
Expand Down Expand Up @@ -361,6 +366,7 @@ struct qedr_srq {
struct ib_umem *prod_umem;
u16 srq_id;
u32 srq_limit;
bool is_xrc;
/* lock to protect srq recv post */
spinlock_t lock;
};
Expand Down Expand Up @@ -573,6 +579,11 @@ static inline struct qedr_pd *get_qedr_pd(struct ib_pd *ibpd)
return container_of(ibpd, struct qedr_pd, ibpd);
}

static inline struct qedr_xrcd *get_qedr_xrcd(struct ib_xrcd *ibxrcd)
{
return container_of(ibxrcd, struct qedr_xrcd, ibxrcd);
}

static inline struct qedr_cq *get_qedr_cq(struct ib_cq *ibcq)
{
return container_of(ibcq, struct qedr_cq, ibcq);
Expand All @@ -598,6 +609,28 @@ static inline struct qedr_srq *get_qedr_srq(struct ib_srq *ibsrq)
return container_of(ibsrq, struct qedr_srq, ibsrq);
}

static inline bool qedr_qp_has_srq(struct qedr_qp *qp)
{
return qp->srq;
}

static inline bool qedr_qp_has_sq(struct qedr_qp *qp)
{
if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_TGT)
return 0;

return 1;
}

static inline bool qedr_qp_has_rq(struct qedr_qp *qp)
{
if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_INI ||
qp->qp_type == IB_QPT_XRC_TGT || qedr_qp_has_srq(qp))
return 0;

return 1;
}

static inline struct qedr_user_mmap_entry *
get_qedr_mmap_entry(struct rdma_user_mmap_entry *rdma_entry)
{
Expand Down
Loading

0 comments on commit 06e8d1d

Please sign in to comment.