From: Jason Gunthorpe <jgg@xxxxxxxxxxxx> Create consistency with all the other ways to invoke write(). Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> --- libibverbs/cmd.c | 24 +++++++++++++++--------- libibverbs/cmd_write.h | 26 -------------------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 4679ea673d2cba..a824202e7dbd5f 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1853,13 +1853,15 @@ int ibv_cmd_create_flow(struct ibv_qp *qp, int ibv_cmd_destroy_flow(struct ibv_flow *flow_id) { - DECLARE_LEGACY_CORE_BUFS_EX(IB_USER_VERBS_EX_CMD_DESTROY_FLOW); + struct ibv_destroy_flow req; int ret; - *req = (struct ib_uverbs_destroy_flow){ + req.core_payload = (struct ib_uverbs_destroy_flow){ .flow_handle = flow_id->handle, }; - ret = execute_write_ex(flow_id->context, req); + ret = execute_cmd_write_ex_req(flow_id->context, + IB_USER_VERBS_EX_CMD_DESTROY_FLOW, &req, + sizeof(req)); if (verbs_is_destroy_err(&ret)) return ret; @@ -1947,14 +1949,16 @@ int ibv_cmd_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *attr, int ibv_cmd_destroy_wq(struct ibv_wq *wq) { - DECLARE_LEGACY_CORE_BUFS_EX(IB_USER_VERBS_EX_CMD_DESTROY_WQ); + struct ibv_destroy_wq req; + struct ib_uverbs_ex_destroy_wq_resp resp; int ret; - *req = (struct ib_uverbs_ex_destroy_wq){ + req.core_payload = (struct ib_uverbs_ex_destroy_wq){ .wq_handle = wq->handle, }; - ret = execute_write_ex(wq->context, req); + ret = execute_cmd_write_ex(wq->context, IB_USER_VERBS_EX_CMD_DESTROY_WQ, + &req, sizeof(req), &resp, sizeof(resp)); if (verbs_is_destroy_err(&ret)) return ret; @@ -2015,13 +2019,15 @@ int ibv_cmd_create_rwq_ind_table(struct ibv_context *context, int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table) { - DECLARE_LEGACY_CORE_BUFS_EX(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL); + struct ibv_destroy_rwq_ind_table req; int ret; - *req = (struct ib_uverbs_ex_destroy_rwq_ind_table){ + req.core_payload = (struct ib_uverbs_ex_destroy_rwq_ind_table){ .ind_tbl_handle = rwq_ind_table->ind_tbl_handle, }; - ret = execute_write_ex(rwq_ind_table->context, req); + ret = execute_cmd_write_ex_req(rwq_ind_table->context, + IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, + &req, sizeof(req)); if (verbs_is_destroy_err(&ret)) return ret; diff --git a/libibverbs/cmd_write.h b/libibverbs/cmd_write.h index a585b4acd660ad..88ff66600bc118 100644 --- a/libibverbs/cmd_write.h +++ b/libibverbs/cmd_write.h @@ -157,32 +157,6 @@ int _execute_write_raw_ex(struct ibv_context *ctx, struct ex_hdr *req); #define execute_write_bufs_ex(ctx, req) \ _execute_write_raw_ex(ctx, get_req_hdr_ex(req)) -/* For users with no possible UHW bufs. */ -#define DECLARE_LEGACY_CORE_BUFS_EX(_enum) \ - IBV_ABI_REQ(_enum) __req_onstack; \ - IBV_KABI_RESP(_enum) resp; \ - IBV_KABI_REQ(_enum) *const req = ({ \ - __req_onstack.hdr.hdr.command = \ - IB_USER_VERBS_CMD_FLAG_EXTENDED | _enum; \ - __req_onstack.hdr.hdr.in_words = \ - (sizeof(__req_onstack) - sizeof(struct ex_hdr)) / 8; \ - __req_onstack.hdr.hdr.out_words = sizeof(resp) / 8; \ - __req_onstack.hdr.ex_hdr.cmd_hdr_reserved = 0; \ - __req_onstack.hdr.ex_hdr.provider_in_words = 0; \ - __req_onstack.hdr.ex_hdr.provider_out_words = 0; \ - __req_onstack.hdr.ex_hdr.response = \ - (sizeof(resp) == 0) ? 0 : ioctl_ptr_to_u64(&resp); \ - &__req_onstack.core_payload; \ - }) - -/* - * For users with no UHW bufs. To be used in conjunction with - * DECLARE_LEGACY_CORE_BUFS. req points to the core payload (with headroom for - * the header). - */ -#define execute_write_ex(ctx, req) \ - _execute_write_raw_ex(ctx, get_req_hdr_ex(req)) - /* * For write() only commands that have fixed core structures and may take uhw * driver data. The last arguments are the same ones passed into the typical -- 2.19.1