From patchwork Thu Nov 22 23:24:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10694975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E5AD13B5 for ; Thu, 22 Nov 2018 23:24:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1BA12BF0F for ; Thu, 22 Nov 2018 23:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E608C2C2F0; Thu, 22 Nov 2018 23:24:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 711D22BF0F for ; Thu, 22 Nov 2018 23:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407879AbeKWKGE (ORCPT ); Fri, 23 Nov 2018 05:06:04 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:32982 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389637AbeKWKGE (ORCPT ); Fri, 23 Nov 2018 05:06:04 -0500 Received: by mail-pf1-f193.google.com with SMTP id c123so1797257pfb.0 for ; Thu, 22 Nov 2018 15:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c/bwxF/BAuF+3s7oqIGh60IYXquCwd4ZbG1fzFP5T28=; b=Vf0TSo1JL8Jspj32wUuBILlPAD3x0kewOMOJkNp/YM9XX0jp95/3ceJAka5Yny62YR CFEAQoo0+sfiZnxS98q0v8U9TvRR5ZeVk9Mi3Tuyi94IHlOtEhFietLbdzksT4hcS7Zr PGUwxiHpJtMRAJjn9FnHNSca5ipgbmMWyxWaeev9GCxNbT5AVuStpw8QJN125bk5YhRH +9spOXUbnTEd6S3fNAyn8sFcNChwU5QBJ8XeCaU8vLtN2T0y7+Rtl9ZSwB7RzrgzjKoE sPUZrIVSkThgH/3vvoiCTopnHzCXuSQGT1A+ZfosIMxL9V4nsq0VbnXxSEsSdS7HEFEn oExw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c/bwxF/BAuF+3s7oqIGh60IYXquCwd4ZbG1fzFP5T28=; b=KflUU9RuQ4dNEwobEcmoxHZt47sjhXI323E71ghbXmUOV9TIPQzetowKPKb5SRh1ng xt3+jC8nXNsVV/OnMeATKuux11P5LpgvJZUooN6LVw6+ROet3GRItX+5nTpecC07fo/z EFz9LBPn19IJDgA0bZ7WfFqsmHg8d6S9kBfHjzbI8+GOE/asdR1R6dkEFJOj0kXEtDU+ spD+xfK7/pfmNBUybmcjMu1n/88Tle9VzqIsNujt98kIOyvAvzXHBQfjtGzP3ARbHby0 nlMEU38YmxyXpouqmL3NtFvFOoeyzjziHYx22kMoO+B/FpwyfHsBOVrjSBYEuGi5+bnw StyQ== X-Gm-Message-State: AA+aEWbNFJf7gBI0fnfaWAQoYAuI8b6RKK9zCNJz0o5/8EiPQ1IwBb/f c4qQE8wkT8qdOSN8QgYRH23ogjfts/g= X-Google-Smtp-Source: AFSGD/VLtCPadUhI99MiuAcVJzJPpLzIltZBs2bcbgTT793lCuOnyCCwFOSex4sXDnfndxeRPcw/Qw== X-Received: by 2002:a63:2744:: with SMTP id n65mr11689032pgn.65.1542929060812; Thu, 22 Nov 2018 15:24:20 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id g14-v6sm50303520pfg.98.2018.11.22.15.24.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Nov 2018 15:24:19 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gPyKY-0007tB-KG; Thu, 22 Nov 2018 16:24:18 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 09/10] verbs: Replace execute_write_ex with execute_cmd_ex/_resp Date: Thu, 22 Nov 2018 16:24:15 -0700 Message-Id: <20181122232416.30132-10-jgg@ziepe.ca> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181122232416.30132-1-jgg@ziepe.ca> References: <20181122232416.30132-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Create consistency with all the other ways to invoke write(). Signed-off-by: Jason Gunthorpe --- 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