OSDN Git Service

IB/uverbs: Add enum attribute type to ioctl() interface
authorMatan Barak <matanb@mellanox.com>
Wed, 28 Mar 2018 06:27:42 +0000 (09:27 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 4 Apr 2018 18:06:24 +0000 (12:06 -0600)
commit494c5580aa6721874a6d9d62dac1c94e83e79302
tree9ff70be924a4072e97f506565d8b74f58d440fa9
parent8c84660bb437fe8692e6a2b4e85023ccb874a520
IB/uverbs: Add enum attribute type to ioctl() interface

Methods sometimes need to get one attribute out of a group of
pre-defined attributes. This is an enum-like behavior. Since
this is a common requirement, we add a new ENUM attribute to the
generic uverbs ioctl() layer. This attribute is embedded in methods,
like any other attributes we currently have. ENUM attributes point to
an array of standard UVERBS_ATTR_PTR_IN. The user-space encodes the
enum's attribute id in the id field and the internal PTR_IN attr id in
the enum_data.elem_id field. This ENUM attribute could be shared by
several attributes and it can get UVERBS_ATTR_SPEC_F_MANDATORY flag,
stating this attribute must be supported by the kernel, like any other
attribute.

Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_ioctl.c
include/rdma/uverbs_ioctl.h
include/uapi/rdma/rdma_user_ioctl_cmds.h