RDMA/uverbs: Use uverbs_attr_bundle to pass udata for ioctl()
Have the core code initialize the driver_udata if the method has a udata description. This is done using the same create_udata the handler was supposed to call. This makes ioctl consistent with the write and write_ex paths. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:
parent
3a6532c9af
commit
07f05f40d9
@ -131,6 +131,7 @@ struct uverbs_api_ioctl_method {
|
||||
u8 use_stack:1;
|
||||
u8 driver_method:1;
|
||||
u8 disabled:1;
|
||||
u8 has_udata:1;
|
||||
u8 key_bitmap_len;
|
||||
u8 destroy_bkey;
|
||||
};
|
||||
|
@ -435,6 +435,9 @@ static int ib_uverbs_run_method(struct bundle_priv *pbundle,
|
||||
pbundle->method_elm->key_bitmap_len)))
|
||||
return -EINVAL;
|
||||
|
||||
if (pbundle->method_elm->has_udata)
|
||||
create_udata(&pbundle->bundle, &pbundle->bundle.driver_udata);
|
||||
|
||||
if (destroy_bkey != UVERBS_API_ATTR_BKEY_LEN) {
|
||||
struct uverbs_obj_attr *destroy_attr =
|
||||
&pbundle->bundle.attrs[destroy_bkey].obj_attr;
|
||||
|
@ -64,7 +64,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
|
||||
uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_CQ_HANDLE),
|
||||
typeof(*obj), uobject);
|
||||
struct ib_device *ib_dev = obj->uobject.context->device;
|
||||
struct ib_udata uhw;
|
||||
int ret;
|
||||
u64 user_handle;
|
||||
struct ib_cq_init_attr attr = {};
|
||||
@ -111,10 +110,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
|
||||
INIT_LIST_HEAD(&obj->comp_list);
|
||||
INIT_LIST_HEAD(&obj->async_list);
|
||||
|
||||
/* Temporary, only until drivers get the new uverbs_attr_bundle */
|
||||
create_udata(attrs, &uhw);
|
||||
|
||||
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_event_file;
|
||||
|
@ -381,6 +381,9 @@ uapi_finalize_ioctl_method(struct uverbs_api *uapi,
|
||||
if (elm->spec.mandatory)
|
||||
__set_bit(attr_bkey, method_elm->attr_mandatory);
|
||||
|
||||
if (elm->spec.is_udata)
|
||||
method_elm->has_udata = true;
|
||||
|
||||
if (type == UVERBS_ATTR_TYPE_IDR ||
|
||||
type == UVERBS_ATTR_TYPE_FD) {
|
||||
u8 access = elm->spec.u.obj.access;
|
||||
|
@ -79,6 +79,8 @@ struct uverbs_attr_spec {
|
||||
*/
|
||||
u8 alloc_and_copy:1;
|
||||
u8 mandatory:1;
|
||||
/* True if this is from UVERBS_ATTR_UHW */
|
||||
u8 is_udata:1;
|
||||
|
||||
union {
|
||||
struct {
|
||||
@ -598,10 +600,12 @@ struct uapi_definition {
|
||||
#define UVERBS_ATTR_UHW() \
|
||||
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \
|
||||
UVERBS_ATTR_MIN_SIZE(0), \
|
||||
UA_OPTIONAL), \
|
||||
UA_OPTIONAL, \
|
||||
.is_udata = 1), \
|
||||
UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \
|
||||
UVERBS_ATTR_MIN_SIZE(0), \
|
||||
UA_OPTIONAL)
|
||||
UA_OPTIONAL, \
|
||||
.is_udata = 1)
|
||||
|
||||
/* =================================================
|
||||
* Parsing infrastructure
|
||||
|
Loading…
Reference in New Issue
Block a user