From patchwork Tue Mar 20 21:18: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: 10297951 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 C7E7160349 for ; Tue, 20 Mar 2018 21:19:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8F282969A for ; Tue, 20 Mar 2018 21:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD19F2969F; Tue, 20 Mar 2018 21:19:13 +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 249A62969A for ; Tue, 20 Mar 2018 21:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbeCTVTL (ORCPT ); Tue, 20 Mar 2018 17:19:11 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35338 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbeCTVTF (ORCPT ); Tue, 20 Mar 2018 17:19:05 -0400 Received: by mail-wr0-f196.google.com with SMTP id 80so2091491wrb.2 for ; Tue, 20 Mar 2018 14:19:05 -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=mzRIaV6NLxKSUGGuo93ur4xECp+1I4TzrIfmtGn0Sfo=; b=UWa4gNr5LrIhrlsUeUjiYnSTxZNS30zPdkeuUnh2dIEa5UJTT49zhr5/AKsyg8L9V5 3pw8IxiSCiQet9iIOZEtup85bvBJ3ji0vnRZsRSFYVvRKm2/ZL60V1jNDqEx9jVoOfKC uDPqycB58oTnD52A4ZQhx1CapFxsO7iOwaBOeQJkYveffDMafMeMCSPlgpG/EUj44nU2 5OBlzbvWXV6Nm2QzHbWUHL0qG0Q+iSdZLz/XDni9pc6QIXX7AQcOKVAv8VWLQIsxe2fG +netW0oWRGS3c5fICRc2ueM0SQgSahVa/X8iaRD43AEEsJ0kneXQZIdFscvMG4hMpBRh u7Iw== 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=mzRIaV6NLxKSUGGuo93ur4xECp+1I4TzrIfmtGn0Sfo=; b=ubccrA2bK0jj+NKfdPYrCg/Vs0DJQxkLIf0HlefOqeum3D95c0PWb9+iIdJVcOM5s7 W27z2mxltqtwDAeE7OWqfwgYJttMXgWpp80k0dihG6ZItAQ1X9Wm6kTMRhNn+7Icemg/ TsY7kpb0ERCakVlIIUAzw6O7qNKJl83uwr9JLxME3mPzpMZgLSFoPhajjD/WLmKH/Ny+ uA5m552pZAJAWmbG5y341WJjXaiGqCuyG4PIDrqwdAnPenZCy/VGYNQpwaD1OTJcxgJa 35/NNOidFRrsFlSEDgvdufHJWH8L7Qm7Vpzgf0LDXQ9OW5w0tot94PXffG32c4PjUdWI kwxA== X-Gm-Message-State: AElRT7FKPT1XSYOIdaAAADW2kNzroBehn22IN+8mFd0RxD/HYwbQrTCO gAfXv2+VyJVWjHJjcrbjOMTmbljIITo= X-Google-Smtp-Source: AG47ELs07J79e9pszB5e5IkpSZU/JMAQ9MMln3Kg+kuYbyGtrlNmaVdh8mn5Xidqg+pz7w4Ueu1Xug== X-Received: by 10.223.195.124 with SMTP id e57mr13389547wrg.135.1521580744188; Tue, 20 Mar 2018 14:19:04 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id o11sm2777020wrg.91.2018.03.20.14.18.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 14:18:59 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eyOen-0002eN-03; Tue, 20 Mar 2018 15:18:57 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Yishai Hadas Subject: [PATCH rdma-core 03/20] mlx4: Use kernel uapi headers Date: Tue, 20 Mar 2018 15:18:33 -0600 Message-Id: <20180320211850.10090-4-jgg@ziepe.ca> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180320211850.10090-1-jgg@ziepe.ca> References: <20180320211850.10090-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 The remaining copied enum constants are replaced with their versions from the kernel headers, and the duplicate structs are dropped. Duplicate structs were fixed with this script: $ sed -i \ -e 's/struct[ \t]mlx4_create_qp_drv_ex\([ \t,]\)/struct mlx4_ib_create_qp\1/g' \ -e 's/struct[ \t]mlx4_create_qp_drv_ex_rss\([ \t,]\)/struct mlx4_ib_create_qp_rss\1/g' \ -e 's/struct[ \t]mlx4_rss_caps\([ \t,]\)/struct mlx4_ib_rss_caps\1/g' \ -e 's/struct[ \t]mlx4_drv_create_wq\([ \t,]\)/struct mlx4_ib_create_wq\1/g' \ `git ls-files` Signed-off-by: Jason Gunthorpe --- providers/mlx4/mlx4-abi.h | 57 +++++------------------------------------------ providers/mlx4/mlx4.c | 2 +- providers/mlx4/verbs.c | 12 +++++----- 3 files changed, 12 insertions(+), 59 deletions(-) diff --git a/providers/mlx4/mlx4-abi.h b/providers/mlx4/mlx4-abi.h index 47fd83db685d79..33453abb43b082 100644 --- a/providers/mlx4/mlx4-abi.h +++ b/providers/mlx4/mlx4-abi.h @@ -34,16 +34,13 @@ #define MLX4_ABI_H #include +#include #define MLX4_UVERBS_MIN_ABI_VERSION 2 #define MLX4_UVERBS_MAX_ABI_VERSION 4 #define MLX4_UVERBS_NO_DEV_CAPS_ABI_VERSION 3 -enum { - MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 -}; - struct mlx4_alloc_ucontext_resp_v3 { struct ib_uverbs_get_context_resp ibv_resp; __u32 qp_tab_size; @@ -51,10 +48,6 @@ struct mlx4_alloc_ucontext_resp_v3 { __u16 bf_regs_per_page; }; -enum mlx4_query_dev_ex_resp_mask { - MLX4_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0, -}; - struct mlx4_alloc_ucontext_resp { struct ib_uverbs_get_context_resp ibv_resp; __u32 dev_caps; @@ -99,20 +92,6 @@ struct mlx4_resize_cq { __u64 buf_addr; }; -struct mlx4_rss_caps { - __u64 rx_hash_fields_mask; /* enum ibv_rx_hash_fields */ - __u8 rx_hash_function; /* enum ibv_rx_hash_function_flags */ - __u8 reserved[7]; -}; - -struct mlx4_ib_tso_caps { - __u32 max_tso; /* Maximum tso payload size in bytes */ - /* Corresponding bit will be set if qp type from - * 'enum ib_qp_type' is supported. - */ - __u32 supported_qpts; -}; - struct mlx4_query_device_ex_resp { struct ib_uverbs_ex_query_device_resp ibv_resp; __u32 comp_mask; @@ -121,7 +100,7 @@ struct mlx4_query_device_ex_resp { __u32 max_inl_recv_sz; /* Explicitly align the response to u64 */ __u32 reserved; - struct mlx4_rss_caps rss_caps; /* vendor data channel */ + struct mlx4_ib_rss_caps rss_caps; /* vendor data channel */ struct mlx4_ib_tso_caps tso_caps; }; @@ -158,49 +137,23 @@ struct mlx4_create_qp { __u32 inl_recv_sz; }; -struct mlx4_create_qp_drv_ex_rss { - __u64 hash_fields_mask; /* enum ibv_rx_hash_fields */ - __u8 hash_function; /* enum ibv_rx_hash_function_flags */ - __u8 reserved[7]; - __u8 hash_key[40]; - __u32 comp_mask; - __u32 reserved1; -}; - struct mlx4_create_qp_ex_rss { struct ibv_create_qp_ex ibv_cmd; - struct mlx4_create_qp_drv_ex_rss drv_ex; -}; - -struct mlx4_create_qp_drv_ex { - __u64 buf_addr; - __u64 db_addr; - __u8 log_sq_bb_count; - __u8 log_sq_stride; - __u8 sq_no_prefetch; /* was reserved in ABI 2 */ - __u8 reserved[5]; + struct mlx4_ib_create_qp_rss drv_ex; }; struct mlx4_create_qp_ex { struct ibv_create_qp_ex ibv_cmd; - struct mlx4_create_qp_drv_ex drv_ex; + struct mlx4_ib_create_qp drv_ex; }; struct mlx4_create_qp_resp_ex { struct ib_uverbs_ex_create_qp_resp ibv_resp; }; -struct mlx4_drv_create_wq { - __u64 buf_addr; - __u64 db_addr; - __u8 log_range_size; - __u8 reserved[3]; - __u32 comp_mask; -}; - struct mlx4_create_wq { struct ibv_create_wq ibv_cmd; - struct mlx4_drv_create_wq drv; + struct mlx4_ib_create_wq drv; }; struct mlx4_modify_wq { diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c index 1b9be1148928fe..9652762099699f 100644 --- a/providers/mlx4/mlx4.c +++ b/providers/mlx4/mlx4.c @@ -200,7 +200,7 @@ static struct verbs_context *mlx4_alloc_context(struct ibv_device *ibdev, context->num_qps = resp.qp_tab_size; bf_reg_size = resp.bf_reg_size; - if (resp.dev_caps & MLX4_USER_DEV_CAP_64B_CQE) + if (resp.dev_caps & MLX4_USER_DEV_CAP_LARGE_CQE) context->cqe_size = resp.cqe_size; else context->cqe_size = sizeof (struct mlx4_cqe); diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c index 9d8d3403bb6394..034f7c4381e9b1 100644 --- a/providers/mlx4/verbs.c +++ b/providers/mlx4/verbs.c @@ -92,7 +92,7 @@ int mlx4_query_device_ex(struct ibv_context *context, attr->tso_caps.max_tso = resp.tso_caps.max_tso; attr->tso_caps.supported_qpts = resp.tso_caps.supported_qpts; - if (resp.comp_mask & MLX4_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET) { + if (resp.comp_mask & MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET) { mctx->core_clock.offset = resp.hca_core_clock_offset; mctx->core_clock.offset_valid = 1; } @@ -767,17 +767,17 @@ static int mlx4_cmd_create_qp_ex_rss(struct ibv_context *context, int ret; if (attr->rx_hash_conf.rx_hash_key_len != - sizeof(cmd_ex.drv_ex.hash_key)) { + sizeof(cmd_ex.drv_ex.rx_hash_key)) { errno = ENOTSUP; return errno; } - cmd_ex.drv_ex.hash_fields_mask = + cmd_ex.drv_ex.rx_hash_fields_mask = attr->rx_hash_conf.rx_hash_fields_mask; - cmd_ex.drv_ex.hash_function = + cmd_ex.drv_ex.rx_hash_function = attr->rx_hash_conf.rx_hash_function; - memcpy(cmd_ex.drv_ex.hash_key, attr->rx_hash_conf.rx_hash_key, - sizeof(cmd_ex.drv_ex.hash_key)); + memcpy(cmd_ex.drv_ex.rx_hash_key, attr->rx_hash_conf.rx_hash_key, + sizeof(cmd_ex.drv_ex.rx_hash_key)); ret = ibv_cmd_create_qp_ex2(context, &qp->verbs_qp, sizeof(qp->verbs_qp), attr,