Commit 669dac1e authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/uverbs: Add structure size info to write commands

We need the structure sizes to compute the location of the udata in the
core code. Annotate the sizes into the new macro language.

This is generated largely by script and checked by comparing against the
similar list in rdma-core.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 15a1b4be
...@@ -142,6 +142,10 @@ struct uverbs_api_write_method { ...@@ -142,6 +142,10 @@ struct uverbs_api_write_method {
struct ib_udata *ucore, struct ib_udata *uhw); struct ib_udata *ucore, struct ib_udata *uhw);
u8 disabled:1; u8 disabled:1;
u8 is_ex:1; u8 is_ex:1;
u8 has_udata:1;
u8 has_resp:1;
u8 req_size;
u8 resp_size;
}; };
struct uverbs_api_attr { struct uverbs_api_attr {
......
...@@ -4052,186 +4052,379 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs, ...@@ -4052,186 +4052,379 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs,
return ret; return ret;
} }
/*
* Describe the input structs for write(). Some write methods have an input
* only struct, most have an input and output. If the struct has an output then
* the 'response' u64 must be the first field in the request structure.
*
* If udata is present then both the request and response structs have a
* trailing driver_data flex array. In this case the size of the base struct
* cannot be changed.
*/
#define offsetof_after(_struct, _member) \
(offsetof(_struct, _member) + sizeof(((_struct *)NULL)->_member))
#define UAPI_DEF_WRITE_IO(req, resp) \
.write.has_resp = 1 + \
BUILD_BUG_ON_ZERO(offsetof(req, response) != 0) + \
BUILD_BUG_ON_ZERO(sizeof(((req *)0)->response) != \
sizeof(u64)), \
.write.req_size = sizeof(req), .write.resp_size = sizeof(resp)
#define UAPI_DEF_WRITE_I(req) .write.req_size = sizeof(req)
#define UAPI_DEF_WRITE_UDATA_IO(req, resp) \
UAPI_DEF_WRITE_IO(req, resp), \
.write.has_udata = \
1 + \
BUILD_BUG_ON_ZERO(offsetof(req, driver_data) != \
sizeof(req)) + \
BUILD_BUG_ON_ZERO(offsetof(resp, driver_data) != \
sizeof(resp))
#define UAPI_DEF_WRITE_UDATA_I(req) \
UAPI_DEF_WRITE_I(req), \
.write.has_udata = \
1 + BUILD_BUG_ON_ZERO(offsetof(req, driver_data) != \
sizeof(req))
/*
* The _EX versions are for use with WRITE_EX and allow the last struct member
* to be specified. Buffers that do not include that member will be rejected.
*/
#define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member) \
.write.has_resp = 1, \
.write.req_size = offsetof_after(req, req_last_member), \
.write.resp_size = offsetof_after(resp, resp_last_member)
#define UAPI_DEF_WRITE_I_EX(req, req_last_member) \
.write.req_size = offsetof_after(req, req_last_member)
const struct uapi_definition uverbs_def_write_intf[] = { const struct uapi_definition uverbs_def_write_intf[] = {
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_AH, UVERBS_OBJECT_AH,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_AH, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_AH,
ib_uverbs_create_ah, ib_uverbs_create_ah,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_ah,
struct ib_uverbs_create_ah_resp),
UAPI_DEF_METHOD_NEEDS_FN(create_ah)), UAPI_DEF_METHOD_NEEDS_FN(create_ah)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DESTROY_AH, DECLARE_UVERBS_WRITE(
ib_uverbs_destroy_ah, IB_USER_VERBS_CMD_DESTROY_AH,
UAPI_DEF_METHOD_NEEDS_FN(destroy_ah))), ib_uverbs_destroy_ah,
UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah),
UAPI_DEF_METHOD_NEEDS_FN(destroy_ah))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_COMP_CHANNEL, UVERBS_OBJECT_COMP_CHANNEL,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, DECLARE_UVERBS_WRITE(
ib_uverbs_create_comp_channel)), IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
ib_uverbs_create_comp_channel,
UAPI_DEF_WRITE_IO(
struct ib_uverbs_create_comp_channel,
struct ib_uverbs_create_comp_channel_resp))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_CQ, UVERBS_OBJECT_CQ,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_CQ, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_CQ,
ib_uverbs_create_cq, ib_uverbs_create_cq,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_cq,
struct ib_uverbs_create_cq_resp),
UAPI_DEF_METHOD_NEEDS_FN(create_cq)), UAPI_DEF_METHOD_NEEDS_FN(create_cq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DESTROY_CQ, DECLARE_UVERBS_WRITE(
ib_uverbs_destroy_cq, IB_USER_VERBS_CMD_DESTROY_CQ,
UAPI_DEF_METHOD_NEEDS_FN(destroy_cq)), ib_uverbs_destroy_cq,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_POLL_CQ, UAPI_DEF_WRITE_IO(struct ib_uverbs_destroy_cq,
ib_uverbs_poll_cq, struct ib_uverbs_destroy_cq_resp),
UAPI_DEF_METHOD_NEEDS_FN(poll_cq)), UAPI_DEF_METHOD_NEEDS_FN(destroy_cq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, DECLARE_UVERBS_WRITE(
ib_uverbs_req_notify_cq, IB_USER_VERBS_CMD_POLL_CQ,
UAPI_DEF_METHOD_NEEDS_FN(req_notify_cq)), ib_uverbs_poll_cq,
UAPI_DEF_WRITE_IO(struct ib_uverbs_poll_cq,
struct ib_uverbs_poll_cq_resp),
UAPI_DEF_METHOD_NEEDS_FN(poll_cq)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
ib_uverbs_req_notify_cq,
UAPI_DEF_WRITE_I(struct ib_uverbs_req_notify_cq),
UAPI_DEF_METHOD_NEEDS_FN(req_notify_cq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_RESIZE_CQ, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_RESIZE_CQ,
ib_uverbs_resize_cq, ib_uverbs_resize_cq,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_resize_cq,
struct ib_uverbs_resize_cq_resp),
UAPI_DEF_METHOD_NEEDS_FN(resize_cq)), UAPI_DEF_METHOD_NEEDS_FN(resize_cq)),
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_CREATE_CQ, DECLARE_UVERBS_WRITE_EX(
ib_uverbs_ex_create_cq, IB_USER_VERBS_EX_CMD_CREATE_CQ,
UAPI_DEF_METHOD_NEEDS_FN(create_cq)), ib_uverbs_ex_create_cq,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_MODIFY_CQ, UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_ex_create_cq,
ib_uverbs_ex_modify_cq, reserved,
UAPI_DEF_METHOD_NEEDS_FN(create_cq))), struct ib_uverbs_ex_create_cq_resp,
response_length),
UAPI_DEF_METHOD_NEEDS_FN(create_cq)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_MODIFY_CQ,
ib_uverbs_ex_modify_cq,
UAPI_DEF_WRITE_I(struct ib_uverbs_ex_modify_cq),
UAPI_DEF_METHOD_NEEDS_FN(create_cq))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_DEVICE, UVERBS_OBJECT_DEVICE,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_GET_CONTEXT, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_GET_CONTEXT,
ib_uverbs_get_context), ib_uverbs_get_context,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_QUERY_DEVICE, UAPI_DEF_WRITE_UDATA_IO(
ib_uverbs_query_device), struct ib_uverbs_get_context,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_QUERY_PORT, struct ib_uverbs_get_context_resp)),
ib_uverbs_query_port, DECLARE_UVERBS_WRITE(
UAPI_DEF_METHOD_NEEDS_FN(query_port)), IB_USER_VERBS_CMD_QUERY_DEVICE,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_QUERY_DEVICE, ib_uverbs_query_device,
ib_uverbs_ex_query_device, UAPI_DEF_WRITE_IO(struct ib_uverbs_query_device,
UAPI_DEF_METHOD_NEEDS_FN(query_device)), struct ib_uverbs_query_device_resp)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_QUERY_PORT,
ib_uverbs_query_port,
UAPI_DEF_WRITE_IO(struct ib_uverbs_query_port,
struct ib_uverbs_query_port_resp),
UAPI_DEF_METHOD_NEEDS_FN(query_port)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_QUERY_DEVICE,
ib_uverbs_ex_query_device,
UAPI_DEF_WRITE_IO_EX(
struct ib_uverbs_ex_query_device,
reserved,
struct ib_uverbs_ex_query_device_resp,
response_length),
UAPI_DEF_METHOD_NEEDS_FN(query_device)),
UAPI_DEF_OBJ_NEEDS_FN(alloc_ucontext), UAPI_DEF_OBJ_NEEDS_FN(alloc_ucontext),
UAPI_DEF_OBJ_NEEDS_FN(dealloc_ucontext)), UAPI_DEF_OBJ_NEEDS_FN(dealloc_ucontext)),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_FLOW, UVERBS_OBJECT_FLOW,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_CREATE_FLOW, DECLARE_UVERBS_WRITE_EX(
ib_uverbs_ex_create_flow, IB_USER_VERBS_EX_CMD_CREATE_FLOW,
UAPI_DEF_METHOD_NEEDS_FN(create_flow)), ib_uverbs_ex_create_flow,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_DESTROY_FLOW, UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_create_flow,
ib_uverbs_ex_destroy_flow, flow_attr,
UAPI_DEF_METHOD_NEEDS_FN(destroy_flow))), struct ib_uverbs_create_flow_resp,
flow_handle),
UAPI_DEF_METHOD_NEEDS_FN(create_flow)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
ib_uverbs_ex_destroy_flow,
UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_flow),
UAPI_DEF_METHOD_NEEDS_FN(destroy_flow))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_MR, UVERBS_OBJECT_MR,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DEREG_MR, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DEREG_MR,
ib_uverbs_dereg_mr, ib_uverbs_dereg_mr,
UAPI_DEF_WRITE_I(struct ib_uverbs_dereg_mr),
UAPI_DEF_METHOD_NEEDS_FN(dereg_mr)), UAPI_DEF_METHOD_NEEDS_FN(dereg_mr)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_REG_MR, DECLARE_UVERBS_WRITE(
ib_uverbs_reg_mr, IB_USER_VERBS_CMD_REG_MR,
UAPI_DEF_METHOD_NEEDS_FN(reg_user_mr)), ib_uverbs_reg_mr,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_REREG_MR, UAPI_DEF_WRITE_UDATA_IO(struct ib_uverbs_reg_mr,
ib_uverbs_rereg_mr, struct ib_uverbs_reg_mr_resp),
UAPI_DEF_METHOD_NEEDS_FN(rereg_user_mr))), UAPI_DEF_METHOD_NEEDS_FN(reg_user_mr)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_REREG_MR,
ib_uverbs_rereg_mr,
UAPI_DEF_WRITE_UDATA_IO(struct ib_uverbs_rereg_mr,
struct ib_uverbs_rereg_mr_resp),
UAPI_DEF_METHOD_NEEDS_FN(rereg_user_mr))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_MW, UVERBS_OBJECT_MW,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_ALLOC_MW, DECLARE_UVERBS_WRITE(
ib_uverbs_alloc_mw, IB_USER_VERBS_CMD_ALLOC_MW,
UAPI_DEF_METHOD_NEEDS_FN(alloc_mw)), ib_uverbs_alloc_mw,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DEALLOC_MW, UAPI_DEF_WRITE_UDATA_IO(struct ib_uverbs_alloc_mw,
ib_uverbs_dealloc_mw, struct ib_uverbs_alloc_mw_resp),
UAPI_DEF_METHOD_NEEDS_FN(dealloc_mw))), UAPI_DEF_METHOD_NEEDS_FN(alloc_mw)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_DEALLOC_MW,
ib_uverbs_dealloc_mw,
UAPI_DEF_WRITE_I(struct ib_uverbs_dealloc_mw),
UAPI_DEF_METHOD_NEEDS_FN(dealloc_mw))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_PD, UVERBS_OBJECT_PD,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_ALLOC_PD, DECLARE_UVERBS_WRITE(
ib_uverbs_alloc_pd, IB_USER_VERBS_CMD_ALLOC_PD,
UAPI_DEF_METHOD_NEEDS_FN(alloc_pd)), ib_uverbs_alloc_pd,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DEALLOC_PD, UAPI_DEF_WRITE_UDATA_IO(struct ib_uverbs_alloc_pd,
ib_uverbs_dealloc_pd, struct ib_uverbs_alloc_pd_resp),
UAPI_DEF_METHOD_NEEDS_FN(dealloc_pd))), UAPI_DEF_METHOD_NEEDS_FN(alloc_pd)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_DEALLOC_PD,
ib_uverbs_dealloc_pd,
UAPI_DEF_WRITE_I(struct ib_uverbs_dealloc_pd),
UAPI_DEF_METHOD_NEEDS_FN(dealloc_pd))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_QP, UVERBS_OBJECT_QP,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_ATTACH_MCAST, DECLARE_UVERBS_WRITE(
ib_uverbs_attach_mcast, IB_USER_VERBS_CMD_ATTACH_MCAST,
UAPI_DEF_METHOD_NEEDS_FN(attach_mcast), ib_uverbs_attach_mcast,
UAPI_DEF_METHOD_NEEDS_FN(detach_mcast)), UAPI_DEF_WRITE_I(struct ib_uverbs_attach_mcast),
UAPI_DEF_METHOD_NEEDS_FN(attach_mcast),
UAPI_DEF_METHOD_NEEDS_FN(detach_mcast)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_QP, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_QP,
ib_uverbs_create_qp, ib_uverbs_create_qp,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_qp,
struct ib_uverbs_create_qp_resp),
UAPI_DEF_METHOD_NEEDS_FN(create_qp)), UAPI_DEF_METHOD_NEEDS_FN(create_qp)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DESTROY_QP, DECLARE_UVERBS_WRITE(
ib_uverbs_destroy_qp, IB_USER_VERBS_CMD_DESTROY_QP,
UAPI_DEF_METHOD_NEEDS_FN(destroy_qp)), ib_uverbs_destroy_qp,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DETACH_MCAST, UAPI_DEF_WRITE_IO(struct ib_uverbs_destroy_qp,
ib_uverbs_detach_mcast, struct ib_uverbs_destroy_qp_resp),
UAPI_DEF_METHOD_NEEDS_FN(detach_mcast)), UAPI_DEF_METHOD_NEEDS_FN(destroy_qp)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_MODIFY_QP, DECLARE_UVERBS_WRITE(
ib_uverbs_modify_qp, IB_USER_VERBS_CMD_DETACH_MCAST,
UAPI_DEF_METHOD_NEEDS_FN(modify_qp)), ib_uverbs_detach_mcast,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_POST_RECV, UAPI_DEF_WRITE_I(struct ib_uverbs_detach_mcast),
ib_uverbs_post_recv, UAPI_DEF_METHOD_NEEDS_FN(detach_mcast)),
UAPI_DEF_METHOD_NEEDS_FN(post_recv)), DECLARE_UVERBS_WRITE(
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_POST_SEND, IB_USER_VERBS_CMD_MODIFY_QP,
ib_uverbs_post_send, ib_uverbs_modify_qp,
UAPI_DEF_METHOD_NEEDS_FN(post_send)), UAPI_DEF_WRITE_I(struct ib_uverbs_modify_qp),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_QUERY_QP, UAPI_DEF_METHOD_NEEDS_FN(modify_qp)),
ib_uverbs_query_qp, DECLARE_UVERBS_WRITE(
UAPI_DEF_METHOD_NEEDS_FN(query_qp)), IB_USER_VERBS_CMD_POST_RECV,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_CREATE_QP, ib_uverbs_post_recv,
ib_uverbs_ex_create_qp, UAPI_DEF_WRITE_IO(struct ib_uverbs_post_recv,
UAPI_DEF_METHOD_NEEDS_FN(create_qp)), struct ib_uverbs_post_recv_resp),
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_MODIFY_QP, UAPI_DEF_METHOD_NEEDS_FN(post_recv)),
ib_uverbs_ex_modify_qp, DECLARE_UVERBS_WRITE(
UAPI_DEF_METHOD_NEEDS_FN(modify_qp))), IB_USER_VERBS_CMD_POST_SEND,
ib_uverbs_post_send,
UAPI_DEF_WRITE_IO(struct ib_uverbs_post_send,
struct ib_uverbs_post_send_resp),
UAPI_DEF_METHOD_NEEDS_FN(post_send)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_QUERY_QP,
ib_uverbs_query_qp,
UAPI_DEF_WRITE_IO(struct ib_uverbs_query_qp,
struct ib_uverbs_query_qp_resp),
UAPI_DEF_METHOD_NEEDS_FN(query_qp)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_CREATE_QP,
ib_uverbs_ex_create_qp,
UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_ex_create_qp,
comp_mask,
struct ib_uverbs_ex_create_qp_resp,
response_length),
UAPI_DEF_METHOD_NEEDS_FN(create_qp)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_MODIFY_QP,
ib_uverbs_ex_modify_qp,
UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_ex_modify_qp,
base,
struct ib_uverbs_ex_modify_qp_resp,
response_length),
UAPI_DEF_METHOD_NEEDS_FN(modify_qp))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_RWQ_IND_TBL, UVERBS_OBJECT_RWQ_IND_TBL,
DECLARE_UVERBS_WRITE_EX( DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
ib_uverbs_ex_create_rwq_ind_table, ib_uverbs_ex_create_rwq_ind_table,
UAPI_DEF_WRITE_IO_EX(
struct ib_uverbs_ex_create_rwq_ind_table,
log_ind_tbl_size,
struct ib_uverbs_ex_create_rwq_ind_table_resp,
ind_tbl_num),
UAPI_DEF_METHOD_NEEDS_FN(create_rwq_ind_table)), UAPI_DEF_METHOD_NEEDS_FN(create_rwq_ind_table)),
DECLARE_UVERBS_WRITE_EX( DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL,
ib_uverbs_ex_destroy_rwq_ind_table, ib_uverbs_ex_destroy_rwq_ind_table,
UAPI_DEF_WRITE_I(
struct ib_uverbs_ex_destroy_rwq_ind_table),
UAPI_DEF_METHOD_NEEDS_FN(destroy_rwq_ind_table))), UAPI_DEF_METHOD_NEEDS_FN(destroy_rwq_ind_table))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_WQ, UVERBS_OBJECT_WQ,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_CREATE_WQ, DECLARE_UVERBS_WRITE_EX(
ib_uverbs_ex_create_wq, IB_USER_VERBS_EX_CMD_CREATE_WQ,
UAPI_DEF_METHOD_NEEDS_FN(create_wq)), ib_uverbs_ex_create_wq,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_DESTROY_WQ, UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_ex_create_wq,
ib_uverbs_ex_destroy_wq, max_sge,
UAPI_DEF_METHOD_NEEDS_FN(destroy_wq)), struct ib_uverbs_ex_create_wq_resp,
DECLARE_UVERBS_WRITE_EX(IB_USER_VERBS_EX_CMD_MODIFY_WQ, wqn),
ib_uverbs_ex_modify_wq, UAPI_DEF_METHOD_NEEDS_FN(create_wq)),
UAPI_DEF_METHOD_NEEDS_FN(modify_wq))), DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_DESTROY_WQ,
ib_uverbs_ex_destroy_wq,
UAPI_DEF_WRITE_IO_EX(struct ib_uverbs_ex_destroy_wq,
wq_handle,
struct ib_uverbs_ex_destroy_wq_resp,
reserved),
UAPI_DEF_METHOD_NEEDS_FN(destroy_wq)),
DECLARE_UVERBS_WRITE_EX(
IB_USER_VERBS_EX_CMD_MODIFY_WQ,
ib_uverbs_ex_modify_wq,
UAPI_DEF_WRITE_I_EX(struct ib_uverbs_ex_modify_wq,
curr_wq_state),
UAPI_DEF_METHOD_NEEDS_FN(modify_wq))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_SRQ, UVERBS_OBJECT_SRQ,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_SRQ, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_SRQ,
ib_uverbs_create_srq, ib_uverbs_create_srq,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_srq,
struct ib_uverbs_create_srq_resp),
UAPI_DEF_METHOD_NEEDS_FN(create_srq)), UAPI_DEF_METHOD_NEEDS_FN(create_srq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_XSRQ, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CREATE_XSRQ,
ib_uverbs_create_xsrq, ib_uverbs_create_xsrq,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_xsrq,
struct ib_uverbs_create_srq_resp),
UAPI_DEF_METHOD_NEEDS_FN(create_srq)), UAPI_DEF_METHOD_NEEDS_FN(create_srq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_DESTROY_SRQ, DECLARE_UVERBS_WRITE(
ib_uverbs_destroy_srq, IB_USER_VERBS_CMD_DESTROY_SRQ,
UAPI_DEF_METHOD_NEEDS_FN(destroy_srq)), ib_uverbs_destroy_srq,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_MODIFY_SRQ, UAPI_DEF_WRITE_IO(struct ib_uverbs_destroy_srq,
ib_uverbs_modify_srq, struct ib_uverbs_destroy_srq_resp),
UAPI_DEF_METHOD_NEEDS_FN(modify_srq)), UAPI_DEF_METHOD_NEEDS_FN(destroy_srq)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_POST_SRQ_RECV, DECLARE_UVERBS_WRITE(
ib_uverbs_post_srq_recv, IB_USER_VERBS_CMD_MODIFY_SRQ,
UAPI_DEF_METHOD_NEEDS_FN(post_srq_recv)), ib_uverbs_modify_srq,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_QUERY_SRQ, UAPI_DEF_WRITE_UDATA_I(struct ib_uverbs_modify_srq),
ib_uverbs_query_srq, UAPI_DEF_METHOD_NEEDS_FN(modify_srq)),
UAPI_DEF_METHOD_NEEDS_FN(query_srq))), DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_POST_SRQ_RECV,
ib_uverbs_post_srq_recv,
UAPI_DEF_WRITE_IO(struct ib_uverbs_post_srq_recv,
struct ib_uverbs_post_srq_recv_resp),
UAPI_DEF_METHOD_NEEDS_FN(post_srq_recv)),
DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_QUERY_SRQ,
ib_uverbs_query_srq,
UAPI_DEF_WRITE_IO(struct ib_uverbs_query_srq,
struct ib_uverbs_query_srq_resp),
UAPI_DEF_METHOD_NEEDS_FN(query_srq))),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_XRCD, UVERBS_OBJECT_XRCD,
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_CLOSE_XRCD, DECLARE_UVERBS_WRITE(
ib_uverbs_close_xrcd, IB_USER_VERBS_CMD_CLOSE_XRCD,
UAPI_DEF_METHOD_NEEDS_FN(dealloc_xrcd)), ib_uverbs_close_xrcd,
UAPI_DEF_WRITE_I(struct ib_uverbs_close_xrcd),
UAPI_DEF_METHOD_NEEDS_FN(dealloc_xrcd)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_OPEN_QP, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_OPEN_QP,
ib_uverbs_open_qp), ib_uverbs_open_qp,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_open_qp,
struct ib_uverbs_create_qp_resp)),
DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_OPEN_XRCD, DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_OPEN_XRCD,
ib_uverbs_open_xrcd, ib_uverbs_open_xrcd,
UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_open_xrcd,
struct ib_uverbs_open_xrcd_resp),
UAPI_DEF_METHOD_NEEDS_FN(alloc_xrcd))), UAPI_DEF_METHOD_NEEDS_FN(alloc_xrcd))),
{}, {},
......
...@@ -96,6 +96,13 @@ static int uapi_create_write(struct uverbs_api *uapi, ...@@ -96,6 +96,13 @@ static int uapi_create_write(struct uverbs_api *uapi,
BIT_ULL(def->write.command_num)); BIT_ULL(def->write.command_num));
} }
if (!def->write.is_ex && def->func_write) {
method_elm->has_udata = def->write.has_udata;
method_elm->has_resp = def->write.has_resp;
method_elm->req_size = def->write.req_size;
method_elm->resp_size = def->write.resp_size;
}
*cur_method_key = method_key; *cur_method_key = method_key;
return 0; return 0;
} }
......
...@@ -360,8 +360,12 @@ struct uapi_definition { ...@@ -360,8 +360,12 @@ struct uapi_definition {
u16 object_id; u16 object_id;
} object_start; } object_start;
struct { struct {
u8 is_ex;
u16 command_num; u16 command_num;
u8 is_ex:1;
u8 has_udata:1;
u8 has_resp:1;
u8 req_size;
u8 resp_size;
} write; } write;
}; };
...@@ -388,22 +392,24 @@ struct uapi_definition { ...@@ -388,22 +392,24 @@ struct uapi_definition {
##__VA_ARGS__ ##__VA_ARGS__
/* Use in a var_args of DECLARE_UVERBS_OBJECT */ /* Use in a var_args of DECLARE_UVERBS_OBJECT */
#define DECLARE_UVERBS_WRITE(_command_num, _func, ...) \ #define DECLARE_UVERBS_WRITE(_command_num, _func, _cmd_desc, ...) \
{ \ { \
.kind = UAPI_DEF_WRITE, \ .kind = UAPI_DEF_WRITE, \
.scope = UAPI_SCOPE_OBJECT, \ .scope = UAPI_SCOPE_OBJECT, \
.write = { .is_ex = 0, .command_num = _command_num }, \ .write = { .is_ex = 0, .command_num = _command_num }, \
.func_write = _func, \ .func_write = _func, \
_cmd_desc, \
}, \ }, \
##__VA_ARGS__ ##__VA_ARGS__
/* Use in a var_args of DECLARE_UVERBS_OBJECT */ /* Use in a var_args of DECLARE_UVERBS_OBJECT */
#define DECLARE_UVERBS_WRITE_EX(_command_num, _func, ...) \ #define DECLARE_UVERBS_WRITE_EX(_command_num, _func, _cmd_desc, ...) \
{ \ { \
.kind = UAPI_DEF_WRITE, \ .kind = UAPI_DEF_WRITE, \
.scope = UAPI_SCOPE_OBJECT, \ .scope = UAPI_SCOPE_OBJECT, \
.write = { .is_ex = 1, .command_num = _command_num }, \ .write = { .is_ex = 1, .command_num = _command_num }, \
.func_write_ex = _func, \ .func_write_ex = _func, \
_cmd_desc, \
}, \ }, \
##__VA_ARGS__ ##__VA_ARGS__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment