From patchwork Tue Mar 27 22:03:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10311793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0EA8F60386 for ; Tue, 27 Mar 2018 22:03:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB71A26E76 for ; Tue, 27 Mar 2018 22:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFED129E13; Tue, 27 Mar 2018 22:03:53 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6930C26E76 for ; Tue, 27 Mar 2018 22:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751070AbeC0WDv (ORCPT ); Tue, 27 Mar 2018 18:03:51 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:36432 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbeC0WDu (ORCPT ); Tue, 27 Mar 2018 18:03:50 -0400 Received: by mail-io0-f194.google.com with SMTP id o4so1107010iod.3 for ; Tue, 27 Mar 2018 15:03:49 -0700 (PDT) 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; bh=8Wj9iPGnLGngqjbvymedhrizlibnqW8cO1PHeq8z2pM=; b=b0UuL0K9p3F6RexaS8fP67R0RdobouzmUW+vrTDjibp5q1rb9UM90m+14W6oNvimhi QLfSCVNV++wrIZHHkIyITmCkVDO7vyLblxD4tFOKLG3ti5F15kswBpOMQS3WreTE53US iI5UrfP3ZKm8MuiG17x6hmP4OtOsqGLtLJxHIAkcdaOLiVbsEsvFreRLZQhsPuqTlhOZ Saj4RcufJUGT+QNfVBxOXmMEImWRpxrwBq94iWiG78YibcuoWFc2Uv4lmUDlQfR/Zv4U Ol+wpvwC2xwPSVDGi8JkK39ifZCLWXN+/YSt33ys+SB9r7tmTWspXqPEpXTM/3P0M5Rc gUjA== 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; bh=8Wj9iPGnLGngqjbvymedhrizlibnqW8cO1PHeq8z2pM=; b=WZ+mIzIMDMJyo0q4pdoXpSADxXrBNNtorBlRQ+iK7VJHkte4/pD78+EWGd4TJD9qGF yTPmmlbv4ghLKYP+N4amtHqm4l4jOa7Hp1hWFXZ7v8NxmHG1elSqxyPUsZd9viMVAS5/ Y4th6VCpn4dzQAWmB0PSiaXaGmdgK8RO/AEoc+SPPklBtzq291pqpeF6s4p0dax77EB+ pQdguvSnVO1rmOyqErhjyLRcqwnevheyIaS/ntdQsE77lOT4nV8EXlr3smWzlabk3CjV U7R096CS1FkQ5KLueSgyurHvPDrJ/yiXoZ1y9bLVLZ4MFNFgQHYE7wCAs0t9FQH5AMwA mU2Q== X-Gm-Message-State: AElRT7G7blDXBSnZ/3sl1ZclypyiyftmEFzy0qmhOs771y24v1179EqX 1H537XRHhR2eglk8UMSfGP/4iMP6ZBI= X-Google-Smtp-Source: AG47ELtwOQqNN7M9yEGe3m/HL6a4Awq2oGegnkF6Rp0JLba3rPsuMUeRAvLWnBodOIw9fXASI9KLwg== X-Received: by 10.107.81.3 with SMTP id f3mr44958344iob.284.1522188229268; Tue, 27 Mar 2018 15:03:49 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id p66-v6sm1716990ita.14.2018.03.27.15.03.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 15:03:45 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1f0wgy-0004Ok-GS; Tue, 27 Mar 2018 16:03:44 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Devesh Sharma Subject: [PATCH rdma-core 3/6] ocrdma: Use kernel uapi headers Date: Tue, 27 Mar 2018 16:03:33 -0600 Message-Id: <20180327220336.16668-4-jgg@ziepe.ca> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180327220336.16668-1-jgg@ziepe.ca> References: <20180327220336.16668-1-jgg@ziepe.ca> 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 There are a few constants that are shared, and the struct names all conflict, but otherwise fairly simple. Confusingly ocrdma has all kinds of non uapi stuff in its uapi header, not clear what that is about. Signed-off-by: Jason Gunthorpe --- providers/ocrdma/ocrdma_abi.h | 29 +++++++++++++---------------- providers/ocrdma/ocrdma_main.c | 4 ++-- providers/ocrdma/ocrdma_verbs.c | 18 +++++++++--------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/providers/ocrdma/ocrdma_abi.h b/providers/ocrdma/ocrdma_abi.h index f45707632a5a7f..b5ac0991abb331 100644 --- a/providers/ocrdma/ocrdma_abi.h +++ b/providers/ocrdma/ocrdma_abi.h @@ -37,6 +37,7 @@ #include #include +#include #define OCRDMA_ABI_VERSION 2 @@ -61,11 +62,11 @@ enum { /* solicited bit */ #define OCRDMA_DB_CQ_SOLICIT_SHIFT (31) /* bit 31 */ -struct ocrdma_get_context { +struct uocrdma_get_context { struct ibv_get_context cmd; }; -struct ocrdma_alloc_ucontext_resp { +struct uocrdma_alloc_ucontext_resp { struct ib_uverbs_get_context_resp ibv_resp; uint32_t dev_id; uint32_t wqe_size; @@ -79,12 +80,12 @@ struct ocrdma_alloc_ucontext_resp { uint64_t rsvd2; }; -struct ocrdma_alloc_pd_req { +struct uocrdma_alloc_pd_req { struct ibv_alloc_pd cmd; uint64_t rsvd; }; -struct ocrdma_alloc_pd_resp { +struct uocrdma_alloc_pd_resp { struct ib_uverbs_alloc_pd_resp ibv_resp; uint32_t id; uint32_t dpp_enabled; @@ -93,14 +94,13 @@ struct ocrdma_alloc_pd_resp { uint64_t rsvd; }; -struct ocrdma_create_cq_req { +struct uocrdma_create_cq_req { struct ibv_create_cq ibv_cmd; uint32_t dpp_cq; uint32_t rsvd; }; -#define MAX_CQ_PAGES 8 -struct ocrdma_create_cq_resp { +struct uocrdma_create_cq_resp { struct ib_uverbs_create_cq_resp ibv_resp; uint32_t cq_id; uint32_t size; @@ -114,15 +114,15 @@ struct ocrdma_create_cq_resp { uint64_t rsvd2; }; -struct ocrdma_reg_mr { +struct uocrdma_reg_mr { struct ibv_reg_mr ibv_cmd; }; -struct ocrdma_reg_mr_resp { +struct uocrdma_reg_mr_resp { struct ib_uverbs_reg_mr_resp ibv_resp; }; -struct ocrdma_create_qp_cmd { +struct uocrdma_create_qp_cmd { struct ibv_create_qp ibv_cmd; uint8_t enable_dpp_cq; uint8_t rsvd; @@ -130,10 +130,7 @@ struct ocrdma_create_qp_cmd { uint32_t rsvd1; /* pad */ }; -#define MAX_QP_PAGES 8 -#define MAX_UD_HDR_PAGES 8 - -struct ocrdma_create_qp_uresp { +struct uocrdma_create_qp_uresp { struct ib_uverbs_create_qp_resp ibv_resp; uint16_t qp_id; uint16_t sq_dbid; @@ -157,11 +154,11 @@ struct ocrdma_create_qp_uresp { uint64_t rsvd[11]; /* 8*8 + 4*4 + 8 */ }; -struct ocrdma_create_srq_cmd { +struct uocrdma_create_srq_cmd { struct ibv_create_srq ibv_cmd; }; -struct ocrdma_create_srq_resp { +struct uocrdma_create_srq_resp { struct ib_uverbs_create_srq_resp ibv_resp; uint16_t rq_dbid; uint16_t resv0; diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c index 76c3b30eaf9168..ee67f4d07d5139 100644 --- a/providers/ocrdma/ocrdma_main.c +++ b/providers/ocrdma/ocrdma_main.c @@ -109,8 +109,8 @@ static struct verbs_context *ocrdma_alloc_context(struct ibv_device *ibdev, int cmd_fd) { struct ocrdma_devctx *ctx; - struct ocrdma_get_context cmd; - struct ocrdma_alloc_ucontext_resp resp; + struct uocrdma_get_context cmd; + struct uocrdma_alloc_ucontext_resp resp; ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx, RDMA_DRIVER_OCRDMA); diff --git a/providers/ocrdma/ocrdma_verbs.c b/providers/ocrdma/ocrdma_verbs.c index dd7035ddc28d86..223ad9c690fd0a 100644 --- a/providers/ocrdma/ocrdma_verbs.c +++ b/providers/ocrdma/ocrdma_verbs.c @@ -133,8 +133,8 @@ static void ocrdma_free_ah_tbl_id(struct ocrdma_devctx *ctx, int idx) */ struct ibv_pd *ocrdma_alloc_pd(struct ibv_context *context) { - struct ocrdma_alloc_pd_req cmd; - struct ocrdma_alloc_pd_resp resp; + struct uocrdma_alloc_pd_req cmd; + struct uocrdma_alloc_pd_resp resp; struct ocrdma_pd *pd; uint64_t map_address = 0; @@ -191,7 +191,7 @@ struct ibv_mr *ocrdma_reg_mr(struct ibv_pd *pd, void *addr, { struct ocrdma_mr *mr; struct ibv_reg_mr cmd; - struct ocrdma_reg_mr_resp resp; + struct uocrdma_reg_mr_resp resp; uint64_t hca_va = (uintptr_t) addr; mr = malloc(sizeof *mr); @@ -230,8 +230,8 @@ static struct ibv_cq *ocrdma_create_cq_common(struct ibv_context *context, int comp_vector, int dpp_cq) { int status; - struct ocrdma_create_cq_req cmd; - struct ocrdma_create_cq_resp resp; + struct uocrdma_create_cq_req cmd; + struct uocrdma_create_cq_resp resp; struct ocrdma_cq *cq; struct ocrdma_device *dev = get_ocrdma_dev(context->device); void *map_addr; @@ -354,8 +354,8 @@ struct ibv_srq *ocrdma_create_srq(struct ibv_pd *pd, { int status = 0; struct ocrdma_srq *srq; - struct ocrdma_create_srq_cmd cmd; - struct ocrdma_create_srq_resp resp; + struct uocrdma_create_srq_cmd cmd; + struct uocrdma_create_srq_resp resp; void *map_addr; srq = calloc(1, sizeof *srq); @@ -464,8 +464,8 @@ struct ibv_qp *ocrdma_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attrs) { int status = 0; - struct ocrdma_create_qp_cmd cmd; - struct ocrdma_create_qp_uresp resp; + struct uocrdma_create_qp_cmd cmd; + struct uocrdma_create_qp_uresp resp; struct ocrdma_qp *qp; void *map_addr; #ifdef DPP_CQ_SUPPORT