struct ibv_create_qp *cmd, size_t cmd_size,
struct ibv_create_qp_resp *resp, size_t resp_size)
{
- struct ibv_context *context;
-
IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, resp, resp_size);
cmd->user_handle = (uintptr_t) qp;
-
- if (attr->qp_type == IBV_QPT_XRC_RECV) {
- context = attr->ext.xrc_recv.xrcd->context;
- cmd->pd_handle = attr->ext.xrc_recv.xrcd->handle;
- } else {
- context = pd->context;
- cmd->pd_handle = pd->handle;
- cmd->send_cq_handle = attr->send_cq->handle;
-
- if (attr->qp_type != IBV_QPT_XRC_SEND) {
- cmd->recv_cq_handle = attr->recv_cq->handle;
- cmd->srq_handle = attr->srq ? attr->srq->handle : 0;
- }
- }
-
+ cmd->pd_handle = pd->handle;
+ cmd->send_cq_handle = attr->send_cq->handle;
+ cmd->recv_cq_handle = attr->recv_cq->handle;
+ cmd->srq_handle = attr->srq ? attr->srq->handle : 0;
cmd->max_send_wr = attr->cap.max_send_wr;
cmd->max_recv_wr = attr->cap.max_recv_wr;
cmd->max_send_sge = attr->cap.max_send_sge;
cmd->is_srq = !!attr->srq;
cmd->reserved = 0;
- if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
+ if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
(void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
qp->handle = resp->qp_handle;
qp->qp_num = resp->qpn;
- qp->context = context;
+ qp->context = pd->context;
if (abi_ver > 3) {
attr->cap.max_recv_sge = resp->max_recv_sge;
}
default_symver(__ibv_ack_cq_events, ibv_ack_cq_events);
-/*
- * Existing apps may be using an older, smaller version of srq_init_attr.
- */
struct ibv_srq *__ibv_create_srq(struct ibv_pd *pd,
struct ibv_srq_init_attr *srq_init_attr)
{
- struct ibv_srq_init_attr attr;
- struct ibv_srq *srq;
-
- attr.srq_context = srq_init_attr->srq_context;
- attr.attr = srq_init_attr->attr;
- attr.srq_type = IBV_SRQT_BASIC;
-
- srq = ibv_create_xsrq(pd, &attr);
- if (srq)
- srq_init_attr->attr = attr.attr;
-
- return srq;
-}
-default_symver(__ibv_create_srq, ibv_create_srq);
-
-struct ibv_srq *__ibv_create_srq_ex(struct ibv_pd *pd,
- struct ibv_srq_init_attr_ex *srq_init_attr_ex)
-{
- struct verbs_context *vcontext;
struct ibv_srq *srq;
- vcontext = verbs_get_ctx(pd->context);
- if (!vcontext || !vcontext->create_srq_ex)
- return NULL;
-
- if (!pd->context->ops.create_srq ||
- (srq_init_attr->srq_type != IBV_SRQT_BASIC &&
- !ibv_get_ext_support(pd->context->device)))
+ if (!pd->context->ops.create_srq)
return NULL;
srq = pd->context->ops.create_srq(pd, srq_init_attr);
srq->events_completed = 0;
pthread_mutex_init(&srq->mutex, NULL);
pthread_cond_init(&srq->cond, NULL);
-
- if (srq_init_attr->srq_type == IBV_SRQT_XRC) {
- srq->ext.xrc.xrcd = srq_init_attr->ext.xrc.xrcd;
- srq->ext.xrc.cq = srq_init_attr->ext.xrc.cq;
- }
-
- if (ibv_get_ext_support(pd->context->device))
- srq->srq_type = srq_init_attr->srq_type;
}
return srq;
}
-default_symver(__ibv_create_xsrq, ibv_create_xsrq);
+default_symver(__ibv_create_srq, ibv_create_srq);
int __ibv_modify_srq(struct ibv_srq *srq,
struct ibv_srq_attr *srq_attr,
struct ibv_qp *__ibv_create_qp(struct ibv_pd *pd,
struct ibv_qp_init_attr *qp_init_attr)
{
- struct ibv_context *context;
- struct ibv_qp *qp;
+ struct ibv_qp *qp = pd->context->ops.create_qp(pd, qp_init_attr);
- context = pd ? pd->context : qp_init_attr->ext.xrc_recv.xrcd->context;
- qp = context->ops.create_qp(pd, qp_init_attr);
if (qp) {
qp->context = context;
qp->qp_context = qp_init_attr->qp_context;
-
- if (qp_init_attr->qp_type == IBV_QPT_XRC_RECV) {
- qp->pd = NULL;
- qp->send_cq = qp->recv_cq = NULL;
- qp->srq = NULL;
- qp->ext.xrc_recv.xrcd = qp_init_attr->ext.xrc_recv.xrcd;
- } else {
- if (qp_init_attr->qp_type == IBV_QPT_XRC_SEND) {
- qp->recv_cq = NULL;
- qp->srq = NULL;
- } else {
- qp->recv_cq = qp_init_attr->recv_cq;
- qp->srq = qp_init_attr->srq;
- }
-
- qp->pd = pd;
- qp->send_cq = qp_init_attr->send_cq;
- }
+ qp->pd = pd;
+ qp->send_cq = qp_init_attr->send_cq;
+ qp->recv_cq = qp_init_attr->recv_cq;
+ qp->srq = qp_init_attr->srq;
qp->qp_type = qp_init_attr->qp_type;
qp->state = IBV_QPS_RESET;