struct ib_uverbs_file *file = attrs->ufile;
struct ib_uverbs_get_context cmd;
struct ib_uverbs_get_context_resp resp;
- struct ib_udata udata;
struct ib_ucontext *ucontext;
struct file *filp;
struct ib_rdmacg_object cg_obj;
goto err;
}
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
if (ret)
goto err;
- ucontext = ib_dev->alloc_ucontext(ib_dev, &udata);
+ ucontext = ib_dev->alloc_ucontext(ib_dev, &attrs->driver_udata);
if (IS_ERR(ucontext)) {
ret = PTR_ERR(ucontext);
goto err_alloc;
{
struct ib_uverbs_alloc_pd cmd;
struct ib_uverbs_alloc_pd_resp resp;
- struct ib_udata udata;
struct ib_uobject *uobj;
struct ib_pd *pd;
int ret;
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
if (IS_ERR(uobj))
return PTR_ERR(uobj);
- pd = ib_dev->alloc_pd(ib_dev, uobj->context, &udata);
+ pd = ib_dev->alloc_pd(ib_dev, uobj->context, &attrs->driver_udata);
if (IS_ERR(pd)) {
ret = PTR_ERR(pd);
goto err;
struct ib_uverbs_device *ibudev = attrs->ufile->device;
struct ib_uverbs_open_xrcd cmd;
struct ib_uverbs_open_xrcd_resp resp;
- struct ib_udata udata;
struct ib_uxrcd_object *obj;
struct ib_xrcd *xrcd = NULL;
struct fd f = {NULL, 0};
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
}
if (!xrcd) {
- xrcd = ib_dev->alloc_xrcd(ib_dev, obj->uobject.context, &udata);
+ xrcd = ib_dev->alloc_xrcd(ib_dev, obj->uobject.context,
+ &attrs->driver_udata);
if (IS_ERR(xrcd)) {
ret = PTR_ERR(xrcd);
goto err;
{
struct ib_uverbs_reg_mr cmd;
struct ib_uverbs_reg_mr_resp resp;
- struct ib_udata udata;
struct ib_uobject *uobj;
struct ib_pd *pd;
struct ib_mr *mr;
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
}
mr = pd->device->reg_user_mr(pd, cmd.start, cmd.length, cmd.hca_va,
- cmd.access_flags, &udata);
+ cmd.access_flags, &attrs->driver_udata);
if (IS_ERR(mr)) {
ret = PTR_ERR(mr);
goto err_put;
{
struct ib_uverbs_rereg_mr cmd;
struct ib_uverbs_rereg_mr_resp resp;
- struct ib_udata udata;
struct ib_pd *pd = NULL;
struct ib_mr *mr;
struct ib_pd *old_pd;
if (copy_from_user(&cmd, buf, sizeof(cmd)))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
}
old_pd = mr->pd;
- ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start,
- cmd.length, cmd.hca_va,
- cmd.access_flags, pd, &udata);
+ ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start, cmd.length,
+ cmd.hca_va, cmd.access_flags, pd,
+ &attrs->driver_udata);
if (!ret) {
if (cmd.flags & IB_MR_REREG_PD) {
atomic_inc(&pd->usecnt);
struct ib_uobject *uobj;
struct ib_pd *pd;
struct ib_mw *mw;
- struct ib_udata udata;
int ret;
struct ib_device *ib_dev;
goto err_free;
}
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
- mw = pd->device->alloc_mw(pd, cmd.mw_type, &udata);
+ mw = pd->device->alloc_mw(pd, cmd.mw_type, &attrs->driver_udata);
if (IS_ERR(mw)) {
ret = PTR_ERR(mw);
goto err_put;
static struct ib_ucq_object *create_cq(struct uverbs_attr_bundle *attrs,
struct ib_udata *ucore,
- struct ib_udata *uhw,
struct ib_uverbs_ex_create_cq *cmd,
size_t cmd_sz,
int (*cb)(struct uverbs_attr_bundle *attrs,
struct ib_ucq_object *obj,
struct ib_uverbs_ex_create_cq_resp *resp,
- struct ib_udata *udata,
+ struct ib_udata *ucore,
void *context),
void *context)
{
if (cmd_sz > offsetof(typeof(*cmd), flags) + sizeof(cmd->flags))
attr.flags = cmd->flags;
- cq = ib_dev->create_cq(ib_dev, &attr, obj->uobject.context, uhw);
+ cq = ib_dev->create_cq(ib_dev, &attr, obj->uobject.context,
+ &attrs->driver_udata);
if (IS_ERR(cq)) {
ret = PTR_ERR(cq);
goto err_file;
struct ib_uverbs_ex_create_cq cmd_ex;
struct ib_uverbs_create_cq_resp resp;
struct ib_udata ucore;
- struct ib_udata uhw;
struct ib_ucq_object *obj;
if (out_len < sizeof(resp))
ib_uverbs_init_udata(&ucore, buf, u64_to_user_ptr(cmd.response),
sizeof(cmd), sizeof(resp));
- ib_uverbs_init_udata(&uhw, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
cmd_ex.comp_vector = cmd.comp_vector;
cmd_ex.comp_channel = cmd.comp_channel;
- obj = create_cq(attrs, &ucore, &uhw, &cmd_ex,
+ obj = create_cq(attrs, &ucore, &cmd_ex,
offsetof(typeof(cmd_ex), comp_channel) +
- sizeof(cmd.comp_channel), ib_uverbs_create_cq_cb,
- NULL);
+ sizeof(cmd.comp_channel),
+ ib_uverbs_create_cq_cb, NULL);
if (IS_ERR(obj))
return PTR_ERR(obj);
}
static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_create_cq_resp resp;
struct ib_uverbs_ex_create_cq cmd;
sizeof(resp.response_length)))
return -ENOSPC;
- obj = create_cq(attrs, ucore, uhw, &cmd,
- min(ucore->inlen, sizeof(cmd)),
+ obj = create_cq(attrs, ucore, &cmd, min(ucore->inlen, sizeof(cmd)),
ib_uverbs_ex_create_cq_cb, NULL);
return PTR_ERR_OR_ZERO(obj);
{
struct ib_uverbs_resize_cq cmd;
struct ib_uverbs_resize_cq_resp resp = {};
- struct ib_udata udata;
struct ib_cq *cq;
int ret = -EINVAL;
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
if (!cq)
return -EINVAL;
- ret = cq->device->resize_cq(cq, cmd.cqe, &udata);
+ ret = cq->device->resize_cq(cq, cmd.cqe, &attrs->driver_udata);
if (ret)
goto out;
static int create_qp(struct uverbs_attr_bundle *attrs,
struct ib_udata *ucore,
- struct ib_udata *uhw,
struct ib_uverbs_ex_create_qp *cmd,
size_t cmd_sz,
int (*cb)(struct uverbs_attr_bundle *attrs,
if (cmd->qp_type == IB_QPT_XRC_TGT)
qp = ib_create_qp(pd, &attr);
else
- qp = _ib_create_qp(device, pd, &attr, uhw,
+ qp = _ib_create_qp(device, pd, &attr, &attrs->driver_udata,
&obj->uevent.uobject);
if (IS_ERR(qp)) {
struct ib_uverbs_create_qp cmd;
struct ib_uverbs_ex_create_qp cmd_ex;
struct ib_udata ucore;
- struct ib_udata uhw;
ssize_t resp_size = sizeof(struct ib_uverbs_create_qp_resp);
int err;
ib_uverbs_init_udata(&ucore, buf, u64_to_user_ptr(cmd.response),
sizeof(cmd), resp_size);
- ib_uverbs_init_udata(&uhw, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + resp_size,
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - resp_size);
cmd_ex.qp_type = cmd.qp_type;
cmd_ex.is_srq = cmd.is_srq;
- err = create_qp(attrs, &ucore, &uhw, &cmd_ex,
- offsetof(typeof(cmd_ex), is_srq) +
- sizeof(cmd.is_srq), ib_uverbs_create_qp_cb,
- NULL);
+ err = create_qp(attrs, &ucore, &cmd_ex,
+ offsetof(typeof(cmd_ex), is_srq) + sizeof(cmd.is_srq),
+ ib_uverbs_create_qp_cb, NULL);
if (err)
return err;
}
static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_create_qp_resp resp;
struct ib_uverbs_ex_create_qp cmd = {0};
sizeof(resp.response_length)))
return -ENOSPC;
- err = create_qp(attrs, ucore, uhw, &cmd,
+ err = create_qp(attrs, ucore, &cmd,
min(ucore->inlen, sizeof(cmd)),
ib_uverbs_ex_create_qp_cb, NULL);
{
struct ib_uverbs_open_qp cmd;
struct ib_uverbs_create_qp_resp resp;
- struct ib_udata udata;
struct ib_uqp_object *obj;
struct ib_xrcd *xrcd;
struct ib_uobject *uninitialized_var(xrcd_uobj);
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
}
static int modify_qp(struct uverbs_attr_bundle *attrs,
- struct ib_uverbs_ex_modify_qp *cmd, struct ib_udata *udata)
+ struct ib_uverbs_ex_modify_qp *cmd)
{
struct ib_qp_attr *attr;
struct ib_qp *qp;
ret = ib_modify_qp_with_udata(qp, attr,
modify_qp_mask(qp->qp_type,
cmd->base.attr_mask),
- udata);
+ &attrs->driver_udata);
release_qp:
uobj_put_obj_read(qp);
const char __user *buf, int in_len, int out_len)
{
struct ib_uverbs_ex_modify_qp cmd = {};
- struct ib_udata udata;
if (copy_from_user(&cmd.base, buf, sizeof(cmd.base)))
return -EFAULT;
~((IB_USER_LEGACY_LAST_QP_ATTR_MASK << 1) - 1))
return -EOPNOTSUPP;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd.base), NULL,
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd.base), NULL,
in_len - sizeof(cmd.base) - sizeof(struct ib_uverbs_cmd_hdr),
out_len);
- return modify_qp(attrs, &cmd, &udata);
+ return modify_qp(attrs, &cmd);
}
static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_modify_qp cmd = {};
int ret;
return -EOPNOTSUPP;
}
- ret = modify_qp(attrs, &cmd, uhw);
+ ret = modify_qp(attrs, &cmd);
return ret;
}
struct ib_ah *ah;
struct rdma_ah_attr attr = {};
int ret;
- struct ib_udata udata;
struct ib_device *ib_dev;
if (out_len < sizeof resp)
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
rdma_ah_set_ah_flags(&attr, 0);
}
- ah = rdma_create_user_ah(pd, &attr, &udata);
+ ah = rdma_create_user_ah(pd, &attr, &attrs->driver_udata);
if (IS_ERR(ah)) {
ret = PTR_ERR(ah);
goto err_put;
}
static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_create_wq cmd = {};
struct ib_uverbs_ex_create_wq_resp resp = {};
obj->uevent.events_reported = 0;
INIT_LIST_HEAD(&obj->uevent.event_list);
- wq = pd->device->create_wq(pd, &wq_init_attr, uhw);
+ wq = pd->device->create_wq(pd, &wq_init_attr, &attrs->driver_udata);
if (IS_ERR(wq)) {
err = PTR_ERR(wq);
goto err_put_cq;
}
static int ib_uverbs_ex_destroy_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_destroy_wq cmd = {};
struct ib_uverbs_ex_destroy_wq_resp resp = {};
}
static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_modify_wq cmd = {};
struct ib_wq *wq;
wq_attr.flags = cmd.flags;
wq_attr.flags_mask = cmd.flags_mask;
}
- ret = wq->device->modify_wq(wq, &wq_attr, cmd.attr_mask, uhw);
+ ret = wq->device->modify_wq(wq, &wq_attr, cmd.attr_mask,
+ &attrs->driver_udata);
uobj_put_obj_read(wq);
return ret;
}
static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore,
- struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_create_rwq_ind_table cmd = {};
struct ib_uverbs_ex_create_rwq_ind_table_resp resp = {};
init_attr.log_ind_tbl_size = cmd.log_ind_tbl_size;
init_attr.ind_tbl = wqs;
- rwq_ind_tbl = ib_dev->create_rwq_ind_table(ib_dev, &init_attr, uhw);
+ rwq_ind_tbl = ib_dev->create_rwq_ind_table(ib_dev, &init_attr,
+ &attrs->driver_udata);
if (IS_ERR(rwq_ind_tbl)) {
err = PTR_ERR(rwq_ind_tbl);
}
static int ib_uverbs_ex_destroy_rwq_ind_table(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore,
- struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_destroy_rwq_ind_table cmd = {};
int ret;
}
static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore,
- struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_create_flow cmd;
struct ib_uverbs_create_flow_resp resp;
goto err_free;
}
- flow_id = qp->device->create_flow(qp, flow_attr,
- IB_FLOW_DOMAIN_USER, uhw);
+ flow_id = qp->device->create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER,
+ &attrs->driver_udata);
if (IS_ERR(flow_id)) {
err = PTR_ERR(flow_id);
}
static int ib_uverbs_ex_destroy_flow(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore,
- struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_destroy_flow cmd;
int ret;
struct ib_uverbs_create_srq cmd;
struct ib_uverbs_create_xsrq xcmd;
struct ib_uverbs_create_srq_resp resp;
- struct ib_udata udata;
if (out_len < sizeof resp)
return -ENOSPC;
xcmd.max_sge = cmd.max_sge;
xcmd.srq_limit = cmd.srq_limit;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
- return __uverbs_create_xsrq(attrs, &xcmd, &udata);
+ return __uverbs_create_xsrq(attrs, &xcmd, &attrs->driver_udata);
}
static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
{
struct ib_uverbs_create_xsrq cmd;
struct ib_uverbs_create_srq_resp resp;
- struct ib_udata udata;
if (out_len < sizeof resp)
return -ENOSPC;
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof(cmd),
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof(cmd),
u64_to_user_ptr(cmd.response) + sizeof(resp),
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
out_len - sizeof(resp));
- return __uverbs_create_xsrq(attrs, &cmd, &udata);
+ return __uverbs_create_xsrq(attrs, &cmd, &attrs->driver_udata);
}
static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs,
const char __user *buf, int in_len, int out_len)
{
struct ib_uverbs_modify_srq cmd;
- struct ib_udata udata;
struct ib_srq *srq;
struct ib_srq_attr attr;
int ret;
if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;
- ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
- out_len);
+ ib_uverbs_init_udata(&attrs->driver_udata, buf + sizeof cmd, NULL,
+ in_len - sizeof cmd, out_len);
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
if (!srq)
attr.max_wr = cmd.max_wr;
attr.srq_limit = cmd.srq_limit;
- ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask, &udata);
+ ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask,
+ &attrs->driver_udata);
uobj_put_obj_read(srq);
}
static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore,
- struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_query_device_resp resp = { {0} };
struct ib_uverbs_ex_query_device cmd;
if (ucore->outlen < resp.response_length)
return -ENOSPC;
- err = ib_dev->query_device(ib_dev, &attr, uhw);
+ err = ib_dev->query_device(ib_dev, &attr, &attrs->driver_udata);
if (err)
return err;
}
static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore, struct ib_udata *uhw)
+ struct ib_udata *ucore)
{
struct ib_uverbs_ex_modify_cq cmd = {};
struct ib_cq *cq;