|
@@ -3497,10 +3497,12 @@ static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
|
|
|
|
|
|
obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object, uobject);
|
|
|
atomic_inc(&obj->uxrcd->refcnt);
|
|
|
+ }
|
|
|
|
|
|
- attr.ext.xrc.cq = uobj_get_obj_read(cq, cmd->cq_handle,
|
|
|
- file->ucontext);
|
|
|
- if (!attr.ext.xrc.cq) {
|
|
|
+ if (ib_srq_has_cq(cmd->srq_type)) {
|
|
|
+ attr.ext.cq = uobj_get_obj_read(cq, cmd->cq_handle,
|
|
|
+ file->ucontext);
|
|
|
+ if (!attr.ext.cq) {
|
|
|
ret = -EINVAL;
|
|
|
goto err_put_xrcd;
|
|
|
}
|
|
@@ -3535,10 +3537,13 @@ static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
|
|
|
srq->event_handler = attr.event_handler;
|
|
|
srq->srq_context = attr.srq_context;
|
|
|
|
|
|
+ if (ib_srq_has_cq(cmd->srq_type)) {
|
|
|
+ srq->ext.cq = attr.ext.cq;
|
|
|
+ atomic_inc(&attr.ext.cq->usecnt);
|
|
|
+ }
|
|
|
+
|
|
|
if (cmd->srq_type == IB_SRQT_XRC) {
|
|
|
- srq->ext.xrc.cq = attr.ext.xrc.cq;
|
|
|
srq->ext.xrc.xrcd = attr.ext.xrc.xrcd;
|
|
|
- atomic_inc(&attr.ext.xrc.cq->usecnt);
|
|
|
atomic_inc(&attr.ext.xrc.xrcd->usecnt);
|
|
|
}
|
|
|
|
|
@@ -3561,10 +3566,12 @@ static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
|
|
|
goto err_copy;
|
|
|
}
|
|
|
|
|
|
- if (cmd->srq_type == IB_SRQT_XRC) {
|
|
|
+ if (cmd->srq_type == IB_SRQT_XRC)
|
|
|
uobj_put_read(xrcd_uobj);
|
|
|
- uobj_put_obj_read(attr.ext.xrc.cq);
|
|
|
- }
|
|
|
+
|
|
|
+ if (ib_srq_has_cq(cmd->srq_type))
|
|
|
+ uobj_put_obj_read(attr.ext.cq);
|
|
|
+
|
|
|
uobj_put_obj_read(pd);
|
|
|
uobj_alloc_commit(&obj->uevent.uobject);
|
|
|
|
|
@@ -3577,8 +3584,8 @@ err_put:
|
|
|
uobj_put_obj_read(pd);
|
|
|
|
|
|
err_put_cq:
|
|
|
- if (cmd->srq_type == IB_SRQT_XRC)
|
|
|
- uobj_put_obj_read(attr.ext.xrc.cq);
|
|
|
+ if (ib_srq_has_cq(cmd->srq_type))
|
|
|
+ uobj_put_obj_read(attr.ext.cq);
|
|
|
|
|
|
err_put_xrcd:
|
|
|
if (cmd->srq_type == IB_SRQT_XRC) {
|