From patchwork Tue Mar 21 17:42:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9637213 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 343F36020B for ; Tue, 21 Mar 2017 17:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ACCB2768C for ; Tue, 21 Mar 2017 17:51:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9A3283F3; Tue, 21 Mar 2017 17:51:24 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 6053C2768C for ; Tue, 21 Mar 2017 17:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757341AbdCURto (ORCPT ); Tue, 21 Mar 2017 13:49:44 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48612 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757369AbdCURtM (ORCPT ); Tue, 21 Mar 2017 13:49:12 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Mar 2017 19:42:28 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v2LHgS1A005677; Tue, 21 Mar 2017 19:42:28 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id v2LHgSOn001242; Tue, 21 Mar 2017 19:42:28 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v2LHgSOp001241; Tue, 21 Mar 2017 19:42:28 +0200 From: Yishai Hadas To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, yishaih@mellanox.com, bodong@mellanox.com, majd@mellanox.com, jgunthorpe@obsidianresearch.com Subject: [PATCH V1 rdma-core 3/5] mlx5: Report CQE compression capabilities through mlx5 direct verbs Date: Tue, 21 Mar 2017 19:42:08 +0200 Message-Id: <1490118130-1039-4-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1490118130-1039-1-git-send-email-yishaih@mellanox.com> References: <1490118130-1039-1-git-send-email-yishaih@mellanox.com> 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: Bodong Wang Report max number of compressed and aggregated CQEs in a single merged CQE and the formats of mini CQE supported for responder. Signed-off-by: Bodong Wang Reviewed-by: Yishai Hadas --- providers/mlx5/mlx5-abi.h | 3 ++- providers/mlx5/mlx5.c | 9 ++++++++- providers/mlx5/mlx5.h | 1 + providers/mlx5/mlx5dv.h | 17 +++++++++++++++++ providers/mlx5/verbs.c | 2 ++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/providers/mlx5/mlx5-abi.h b/providers/mlx5/mlx5-abi.h index 3574594..487de3a 100644 --- a/providers/mlx5/mlx5-abi.h +++ b/providers/mlx5/mlx5-abi.h @@ -35,6 +35,7 @@ #include #include +#include "mlx5dv.h" #define MLX5_UVERBS_MIN_ABI_VERSION 1 #define MLX5_UVERBS_MAX_ABI_VERSION 1 @@ -275,7 +276,7 @@ struct mlx5_query_device_ex_resp { __u32 response_length; struct ibv_tso_caps tso_caps; struct mlx5_rss_caps rss_caps; /* vendor data channel */ - __u64 reserved_cqe_comp; + struct mlx5dv_cqe_comp_caps cqe_comp_caps; struct mlx5_packet_pacing_caps packet_pacing_caps; __u32 support_multi_pkt_send_wqe; __u32 reserved; diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index 7af6a0a..edb6d35 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -613,8 +613,8 @@ int mlx5dv_query_device(struct ibv_context *ctx_in, struct mlx5dv_context *attrs_out) { struct mlx5_context *mctx = to_mctx(ctx_in); + uint64_t comp_mask_out = 0; - attrs_out->comp_mask = 0; attrs_out->version = 0; attrs_out->flags = 0; @@ -624,6 +624,13 @@ int mlx5dv_query_device(struct ibv_context *ctx_in, if (mctx->vendor_cap_flags & MLX5_VENDOR_CAP_FLAGS_MPW) attrs_out->flags |= MLX5DV_CONTEXT_FLAGS_MPW; + if (attrs_out->comp_mask & MLX5DV_CONTEXT_MASK_CQE_COMPRESION) { + attrs_out->cqe_comp_caps = mctx->cqe_comp_caps; + comp_mask_out |= MLX5DV_CONTEXT_MASK_CQE_COMPRESION; + } + + attrs_out->comp_mask = comp_mask_out; + return 0; } diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h index 86f2438..bb383d4 100644 --- a/providers/mlx5/mlx5.h +++ b/providers/mlx5/mlx5.h @@ -263,6 +263,7 @@ struct mlx5_context { int cmds_supp_uhw; uint32_t uar_size; uint64_t vendor_cap_flags; /* Use enum mlx5_vendor_cap_flags */ + struct mlx5dv_cqe_comp_caps cqe_comp_caps; }; struct mlx5_bitmap { diff --git a/providers/mlx5/mlx5dv.h b/providers/mlx5/mlx5dv.h index c09fad2..a2f7acf 100644 --- a/providers/mlx5/mlx5dv.h +++ b/providers/mlx5/mlx5dv.h @@ -54,6 +54,16 @@ enum { MLX5_SND_DBR = 1, }; +enum mlx5dv_context_comp_mask { + MLX5DV_CONTEXT_MASK_CQE_COMPRESION = 1 << 0, + MLX5DV_CONTEXT_MASK_RESERVED = 1 << 1, +}; + +struct mlx5dv_cqe_comp_caps { + uint32_t max_num; + uint32_t supported_format; /* enum mlx5dv_cqe_comp_res_format */ +}; + /* * Direct verbs device-specific attributes */ @@ -61,6 +71,7 @@ struct mlx5dv_context { uint8_t version; uint64_t flags; uint64_t comp_mask; + struct mlx5dv_cqe_comp_caps cqe_comp_caps; }; enum mlx5dv_context_flags { @@ -277,6 +288,12 @@ struct mlx5_cqe64 { uint8_t op_own; }; +enum mlx5dv_cqe_comp_res_format { + MLX5DV_CQE_RES_FORMAT_HASH = 1 << 0, + MLX5DV_CQE_RES_FORMAT_CSUM = 1 << 1, + MLX5DV_CQE_RES_FORMAT_RESERVED = 1 << 2, +}; + static MLX5DV_ALWAYS_INLINE uint8_t mlx5dv_get_cqe_owner(struct mlx5_cqe64 *cqe) { diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 9d4a4d4..1b24846 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -1926,6 +1926,8 @@ int mlx5_query_device_ex(struct ibv_context *context, if (resp.support_multi_pkt_send_wqe) mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_MPW; + mctx->cqe_comp_caps = resp.cqe_comp_caps; + major = (raw_fw_ver >> 32) & 0xffff; minor = (raw_fw_ver >> 16) & 0xffff; sub_minor = raw_fw_ver & 0xffff;