From: Matan Barak <matanb@xxxxxxxxxxxx> 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 ioctl layer in the kernel. This attribute is embedded in methods, like any other attributes we currently have. We align the user-space code with the respected changes in the kernel. Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx> Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- kernel-headers/rdma/rdma_user_ioctl_cmds.h | 8 +++++++- libibverbs/cmd_ioctl.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel-headers/rdma/rdma_user_ioctl_cmds.h b/kernel-headers/rdma/rdma_user_ioctl_cmds.h index 40063cf..1da5a1e 100644 --- a/kernel-headers/rdma/rdma_user_ioctl_cmds.h +++ b/kernel-headers/rdma/rdma_user_ioctl_cmds.h @@ -55,7 +55,13 @@ struct ib_uverbs_attr { __u16 attr_id; /* command specific type attribute */ __u16 len; /* only for pointers */ __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */ - __u16 reserved; + union { + struct { + __u8 elem_id; + __u8 reserved; + } enum_data; + __u16 reserved; + } attr_data; __aligned_u64 data; /* ptr to command, inline data or idr/fd */ }; diff --git a/libibverbs/cmd_ioctl.h b/libibverbs/cmd_ioctl.h index 2b6d12a..94814c1 100644 --- a/libibverbs/cmd_ioctl.h +++ b/libibverbs/cmd_ioctl.h @@ -346,4 +346,16 @@ static inline size_t __check_divide(size_t val, unsigned int div) return val / div; } +static inline struct ib_uverbs_attr * +fill_attr_in_enum(struct ibv_command_buffer *cmd, uint16_t attr_id, + uint8_t elem_id, const void *data, size_t len) +{ + struct ib_uverbs_attr *attr; + + attr = fill_attr_in(cmd, attr_id, data, len); + attr->attr_data.enum_data.elem_id = elem_id; + + return attr; +} + #endif -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html