From patchwork Tue Mar 27 22:03:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10311791 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 5D3ED60386 for ; Tue, 27 Mar 2018 22:03:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F5E26E76 for ; Tue, 27 Mar 2018 22:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A99D29E13; 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 C9EA326E76 for ; Tue, 27 Mar 2018 22:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752401AbeC0WDu (ORCPT ); Tue, 27 Mar 2018 18:03:50 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51154 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbeC0WDs (ORCPT ); Tue, 27 Mar 2018 18:03:48 -0400 Received: by mail-it0-f67.google.com with SMTP id r19-v6so1183787itc.0 for ; Tue, 27 Mar 2018 15:03:48 -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=trYDirO7LaJ/jyW3/ruvTnvieCGik5oUG7yaSZfl9vk=; b=CMfEcON0O8CGjLvrT4nmBMjeZWP4SJtVz+fWnANspJnhzEdE3wnFIQdtjK8pYv5/Dw nNS7SzcRaXMEBRrEBR2G2ztqor1XIyu/awr4GvVeyNjbK6oCDqz5ZfmtTBkZ+NV7ANX2 UBJAph599so9n6T8HLWxw3AyJ05RiaMRoaF1hQcTtMMjopaewZ14VCYFWKD4ai5Y14/A fSWlsiFP0/a8sm3+Xjg1aeOA/zQ4rbaa6GxLYTTI7UtoXEt1ytLyM6kDA+EmqH9Y+HzP HGCVe4BEyNbvrVx4iK+IE/AyhY2nqMji963Djsrq/IbqZAu/9P3tRqlE9NhT9N1Qyk8U a1zQ== 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=trYDirO7LaJ/jyW3/ruvTnvieCGik5oUG7yaSZfl9vk=; b=JAbMZ0Z4HjCCak0mBRnrpTmyAR8WiXehfejOkYdisqh9ar9XK8dFzusV0wU5ose4eT Ek6ZiodmXojxg+KYsD5n/v0HXtmlfiOoyZcPjhzzoj4FGZBwJBeS9fEZSsbxLg2cqXHc Yuq/ZK0fkTS+TUEWVzpCAs1wB2YSOjfsI1ip2zw+l9NRjSXdTrfsdiLyI1btILPwijlh x8+5C11ob8ykqgxRNvYHiBEyO+yjP1vmSEeLpMUoZVCqGdIO58eoamMu7FffG/oA3I1C G5bTv98gKbzWe1hgOSPjMmHPqkg/JTuWsDJvvltVHDks+6R3ZHssKAZ9g7Gx9lbWhbvU FtdA== X-Gm-Message-State: AElRT7F3vF1a/FfaIlIWPaSKw55zPqbSEv2C9hLQVXRY3yYmWAfu998B KrRI4CEm9nVo2ZRAu9FysEE7QN9PmXc= X-Google-Smtp-Source: AIpwx48gdXB7B2HyB8s5CYA2WFC333MnHL1lWL/9C3w4Wlg4rvdXYpIIXGrq5f2ICtS7p2BGiiZf0A== X-Received: by 2002:a24:1c0e:: with SMTP id c14-v6mr1098038itc.106.1522188227704; Tue, 27 Mar 2018 15:03:47 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id h82sm1454912ioe.66.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-0004Od-F0; Tue, 27 Mar 2018 16:03:44 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Lijun Ou , "Wei Hu(Xavier)" , Yishai Hadas , Matan Barak Subject: [PATCH rdma-core 2/6] hns: Move hns to exclusively use the kernel uapi headers Date: Tue, 27 Mar 2018 16:03:32 -0600 Message-Id: <20180327220336.16668-3-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 Using the driver support macros we can now directly create the required driver structs automatically. Signed-off-by: Jason Gunthorpe --- kernel-headers/CMakeLists.txt | 1 + providers/hns/hns_roce_u_abi.h | 49 +++++++++------------------------------- providers/hns/hns_roce_u_verbs.c | 2 +- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt index e28ae68ee48b35..1c4662007a02a3 100644 --- a/kernel-headers/CMakeLists.txt +++ b/kernel-headers/CMakeLists.txt @@ -57,6 +57,7 @@ endfunction() rdma_kernel_provider_abi( rdma/bnxt_re-abi.h rdma/cxgb4-abi.h + rdma/hns-abi.h rdma/i40iw-abi.h rdma/ib_user_verbs.h rdma/mlx4-abi.h diff --git a/providers/hns/hns_roce_u_abi.h b/providers/hns/hns_roce_u_abi.h index a3742e2d91bcc2..3b646b6cd6d4ec 100644 --- a/providers/hns/hns_roce_u_abi.h +++ b/providers/hns/hns_roce_u_abi.h @@ -34,43 +34,16 @@ #define _HNS_ROCE_U_ABI_H #include +#include +#include + +DECLARE_DRV_CMD(hns_roce_alloc_pd, IB_USER_VERBS_CMD_ALLOC_PD, + empty, hns_roce_ib_alloc_pd_resp); +DECLARE_DRV_CMD(hns_roce_create_cq, IB_USER_VERBS_CMD_CREATE_CQ, + hns_roce_ib_create_cq, hns_roce_ib_create_cq_resp); +DECLARE_DRV_CMD(hns_roce_create_qp, IB_USER_VERBS_CMD_CREATE_QP, + hns_roce_ib_create_qp, hns_roce_ib_create_qp_resp); +DECLARE_DRV_CMD(hns_roce_alloc_ucontext, IB_USER_VERBS_CMD_GET_CONTEXT, + empty, hns_roce_ib_alloc_ucontext_resp); -struct hns_roce_alloc_ucontext_resp { - struct ib_uverbs_get_context_resp ibv_resp; - __u32 qp_tab_size; - __u32 reserved; -}; - -struct hns_roce_alloc_pd_resp { - struct ib_uverbs_alloc_pd_resp ibv_resp; - __u32 pdn; - __u32 reserved; -}; - -struct hns_roce_create_cq { - struct ibv_create_cq ibv_cmd; - __u64 buf_addr; - __u64 db_addr; -}; - -struct hns_roce_create_cq_resp { - struct ib_uverbs_create_cq_resp ibv_resp; - __u64 cqn; /* Only 32 bits used, 64 for compat */ - __u64 cap_flags; -}; - -struct hns_roce_create_qp { - struct ibv_create_qp ibv_cmd; - __u64 buf_addr; - __u64 db_addr; - __u8 log_sq_bb_count; - __u8 log_sq_stride; - __u8 sq_no_prefetch; - __u8 reserved[5]; -}; - -struct hns_roce_create_qp_resp { - struct ib_uverbs_create_qp_resp base; - __u64 cap_flags; -}; #endif /* _HNS_ROCE_U_ABI_H */ diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c index 24dbbceb58c263..2fc536782476d6 100644 --- a/providers/hns/hns_roce_u_verbs.c +++ b/providers/hns/hns_roce_u_verbs.c @@ -605,7 +605,7 @@ struct ibv_qp *hns_roce_u_create_qp(struct ibv_pd *pd, pthread_mutex_lock(&to_hr_ctx(pd->context)->qp_table_mutex); ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd.ibv_cmd, - sizeof(cmd), &resp.base, sizeof(resp)); + sizeof(cmd), &resp.ibv_resp, sizeof(resp)); if (ret) { fprintf(stderr, "ibv_cmd_create_qp failed!\n"); goto err_rq_db;