mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 07:30:06 -04:00
RDMA/mana_ib: Create and destroy RC QP
Implement HW requests to create and destroy an RC QP. An RC QP may have 5 queues. Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com> Link: https://lore.kernel.org/r/1716366242-558-2-git-send-email-kotaranov@linux.microsoft.com Reviewed-by: Long Li <longli@microsoft.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
committed by
Leon Romanovsky
parent
38c02d813a
commit
53657a0419
@@ -888,3 +888,62 @@ int mana_ib_gd_destroy_cq(struct mana_ib_dev *mdev, struct mana_ib_cq *cq)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mana_ib_gd_create_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp,
|
||||
struct ib_qp_init_attr *attr, u32 doorbell, u64 flags)
|
||||
{
|
||||
struct mana_ib_cq *send_cq = container_of(qp->ibqp.send_cq, struct mana_ib_cq, ibcq);
|
||||
struct mana_ib_cq *recv_cq = container_of(qp->ibqp.recv_cq, struct mana_ib_cq, ibcq);
|
||||
struct mana_ib_pd *pd = container_of(qp->ibqp.pd, struct mana_ib_pd, ibpd);
|
||||
struct gdma_context *gc = mdev_to_gc(mdev);
|
||||
struct mana_rnic_create_qp_resp resp = {};
|
||||
struct mana_rnic_create_qp_req req = {};
|
||||
int err, i;
|
||||
|
||||
mana_gd_init_req_hdr(&req.hdr, MANA_IB_CREATE_RC_QP, sizeof(req), sizeof(resp));
|
||||
req.hdr.dev_id = gc->mana_ib.dev_id;
|
||||
req.adapter = mdev->adapter_handle;
|
||||
req.pd_handle = pd->pd_handle;
|
||||
req.send_cq_handle = send_cq->cq_handle;
|
||||
req.recv_cq_handle = recv_cq->cq_handle;
|
||||
for (i = 0; i < MANA_RC_QUEUE_TYPE_MAX; i++)
|
||||
req.dma_region[i] = qp->rc_qp.queues[i].gdma_region;
|
||||
req.doorbell_page = doorbell;
|
||||
req.max_send_wr = attr->cap.max_send_wr;
|
||||
req.max_recv_wr = attr->cap.max_recv_wr;
|
||||
req.max_send_sge = attr->cap.max_send_sge;
|
||||
req.max_recv_sge = attr->cap.max_recv_sge;
|
||||
req.flags = flags;
|
||||
|
||||
err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
|
||||
if (err) {
|
||||
ibdev_err(&mdev->ib_dev, "Failed to create rc qp err %d", err);
|
||||
return err;
|
||||
}
|
||||
qp->qp_handle = resp.rc_qp_handle;
|
||||
for (i = 0; i < MANA_RC_QUEUE_TYPE_MAX; i++) {
|
||||
qp->rc_qp.queues[i].id = resp.queue_ids[i];
|
||||
/* The GDMA regions are now owned by the RNIC QP handle */
|
||||
qp->rc_qp.queues[i].gdma_region = GDMA_INVALID_DMA_REGION;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mana_ib_gd_destroy_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp)
|
||||
{
|
||||
struct mana_rnic_destroy_rc_qp_resp resp = {0};
|
||||
struct mana_rnic_destroy_rc_qp_req req = {0};
|
||||
struct gdma_context *gc = mdev_to_gc(mdev);
|
||||
int err;
|
||||
|
||||
mana_gd_init_req_hdr(&req.hdr, MANA_IB_DESTROY_RC_QP, sizeof(req), sizeof(resp));
|
||||
req.hdr.dev_id = gc->mana_ib.dev_id;
|
||||
req.adapter = mdev->adapter_handle;
|
||||
req.rc_qp_handle = qp->qp_handle;
|
||||
err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
|
||||
if (err) {
|
||||
ibdev_err(&mdev->ib_dev, "Failed to destroy rc qp err %d", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,11 +95,27 @@ struct mana_ib_cq {
|
||||
mana_handle_t cq_handle;
|
||||
};
|
||||
|
||||
enum mana_rc_queue_type {
|
||||
MANA_RC_SEND_QUEUE_REQUESTER = 0,
|
||||
MANA_RC_SEND_QUEUE_RESPONDER,
|
||||
MANA_RC_SEND_QUEUE_FMR,
|
||||
MANA_RC_RECV_QUEUE_REQUESTER,
|
||||
MANA_RC_RECV_QUEUE_RESPONDER,
|
||||
MANA_RC_QUEUE_TYPE_MAX,
|
||||
};
|
||||
|
||||
struct mana_ib_rc_qp {
|
||||
struct mana_ib_queue queues[MANA_RC_QUEUE_TYPE_MAX];
|
||||
};
|
||||
|
||||
struct mana_ib_qp {
|
||||
struct ib_qp ibqp;
|
||||
|
||||
mana_handle_t qp_handle;
|
||||
struct mana_ib_queue raw_sq;
|
||||
union {
|
||||
struct mana_ib_queue raw_sq;
|
||||
struct mana_ib_rc_qp rc_qp;
|
||||
};
|
||||
|
||||
/* The port on the IB device, starting with 1 */
|
||||
u32 port;
|
||||
@@ -122,6 +138,8 @@ enum mana_ib_command_code {
|
||||
MANA_IB_CONFIG_MAC_ADDR = 0x30005,
|
||||
MANA_IB_CREATE_CQ = 0x30008,
|
||||
MANA_IB_DESTROY_CQ = 0x30009,
|
||||
MANA_IB_CREATE_RC_QP = 0x3000a,
|
||||
MANA_IB_DESTROY_RC_QP = 0x3000b,
|
||||
};
|
||||
|
||||
struct mana_ib_query_adapter_caps_req {
|
||||
@@ -230,6 +248,40 @@ struct mana_rnic_destroy_cq_resp {
|
||||
struct gdma_resp_hdr hdr;
|
||||
}; /* HW Data */
|
||||
|
||||
struct mana_rnic_create_qp_req {
|
||||
struct gdma_req_hdr hdr;
|
||||
mana_handle_t adapter;
|
||||
mana_handle_t pd_handle;
|
||||
mana_handle_t send_cq_handle;
|
||||
mana_handle_t recv_cq_handle;
|
||||
u64 dma_region[MANA_RC_QUEUE_TYPE_MAX];
|
||||
u64 deprecated[2];
|
||||
u64 flags;
|
||||
u32 doorbell_page;
|
||||
u32 max_send_wr;
|
||||
u32 max_recv_wr;
|
||||
u32 max_send_sge;
|
||||
u32 max_recv_sge;
|
||||
u32 reserved;
|
||||
}; /* HW Data */
|
||||
|
||||
struct mana_rnic_create_qp_resp {
|
||||
struct gdma_resp_hdr hdr;
|
||||
mana_handle_t rc_qp_handle;
|
||||
u32 queue_ids[MANA_RC_QUEUE_TYPE_MAX];
|
||||
u32 reserved;
|
||||
}; /* HW Data*/
|
||||
|
||||
struct mana_rnic_destroy_rc_qp_req {
|
||||
struct gdma_req_hdr hdr;
|
||||
mana_handle_t adapter;
|
||||
mana_handle_t rc_qp_handle;
|
||||
}; /* HW Data */
|
||||
|
||||
struct mana_rnic_destroy_rc_qp_resp {
|
||||
struct gdma_resp_hdr hdr;
|
||||
}; /* HW Data */
|
||||
|
||||
static inline struct gdma_context *mdev_to_gc(struct mana_ib_dev *mdev)
|
||||
{
|
||||
return mdev->gdma_dev->gdma_context;
|
||||
@@ -354,4 +406,8 @@ int mana_ib_gd_config_mac(struct mana_ib_dev *mdev, enum mana_ib_addr_op op, u8
|
||||
int mana_ib_gd_create_cq(struct mana_ib_dev *mdev, struct mana_ib_cq *cq, u32 doorbell);
|
||||
|
||||
int mana_ib_gd_destroy_cq(struct mana_ib_dev *mdev, struct mana_ib_cq *cq);
|
||||
|
||||
int mana_ib_gd_create_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp,
|
||||
struct ib_qp_init_attr *attr, u32 doorbell, u64 flags);
|
||||
int mana_ib_gd_destroy_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user