From patchwork Tue Mar 21 17:42:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9637221 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 B3B9860327 for ; Tue, 21 Mar 2017 17:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABDA3279E0 for ; Tue, 21 Mar 2017 17:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0B6F28415; Tue, 21 Mar 2017 17:52:33 +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 0893127D45 for ; Tue, 21 Mar 2017 17:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757848AbdCURtn (ORCPT ); Tue, 21 Mar 2017 13:49:43 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48613 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757623AbdCURtM (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 v2LHgSfB005659; 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 v2LHgSkF001237; 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 v2LHgSbA001236; 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 2/5] mlx5: Report multi packet send WQE capability for mlx5 based hardware Date: Tue, 21 Mar 2017 19:42:07 +0200 Message-Id: <1490118130-1039-3-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 whether multi packet send WQE is supported or not through mlx5 direct verbs. Signed-off-by: Bodong Wang Reviewed-by: Yishai Hadas --- providers/mlx5/man/mlx5dv_query_device.3 | 1 + providers/mlx5/mlx5-abi.h | 2 ++ providers/mlx5/mlx5.c | 8 +++++++- providers/mlx5/mlx5.h | 5 +++++ providers/mlx5/mlx5dv.h | 3 ++- providers/mlx5/verbs.c | 3 +++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/providers/mlx5/man/mlx5dv_query_device.3 b/providers/mlx5/man/mlx5dv_query_device.3 index 1954714..b33a75b 100644 --- a/providers/mlx5/man/mlx5dv_query_device.3 +++ b/providers/mlx5/man/mlx5dv_query_device.3 @@ -35,6 +35,7 @@ enum mlx5dv_context_flags { * This flag indicates if CQE version 0 or 1 is needed. */ MLX5DV_CONTEXT_FLAGS_CQE_V1 = (1 << 0), + MLX5DV_CONTEXT_FLAGS_MPW = (1 << 1), /* Multi packet WQE is supported or not */ .in -8 }; .fi diff --git a/providers/mlx5/mlx5-abi.h b/providers/mlx5/mlx5-abi.h index dde46b9..3574594 100644 --- a/providers/mlx5/mlx5-abi.h +++ b/providers/mlx5/mlx5-abi.h @@ -277,6 +277,8 @@ struct mlx5_query_device_ex_resp { struct mlx5_rss_caps rss_caps; /* vendor data channel */ __u64 reserved_cqe_comp; struct mlx5_packet_pacing_caps packet_pacing_caps; + __u32 support_multi_pkt_send_wqe; + __u32 reserved; }; #endif /* MLX5_ABI_H */ diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index eeaf5ac..7af6a0a 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -612,13 +612,18 @@ static int mlx5_map_internal_clock(struct mlx5_device *mdev, int mlx5dv_query_device(struct ibv_context *ctx_in, struct mlx5dv_context *attrs_out) { + struct mlx5_context *mctx = to_mctx(ctx_in); + attrs_out->comp_mask = 0; attrs_out->version = 0; attrs_out->flags = 0; - if (to_mctx(ctx_in)->cqe_version == MLX5_CQE_VERSION_V1) + if (mctx->cqe_version == MLX5_CQE_VERSION_V1) attrs_out->flags |= MLX5DV_CONTEXT_FLAGS_CQE_V1; + if (mctx->vendor_cap_flags & MLX5_VENDOR_CAP_FLAGS_MPW) + attrs_out->flags |= MLX5DV_CONTEXT_FLAGS_MPW; + return 0; } @@ -827,6 +832,7 @@ static int mlx5_init_context(struct verbs_device *vdev, } context->cmds_supp_uhw = resp.cmds_supp_uhw; + context->vendor_cap_flags = 0; pthread_mutex_init(&context->qp_table_mutex, NULL); pthread_mutex_init(&context->srq_table_mutex, NULL); diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h index 57ed1a1..86f2438 100644 --- a/providers/mlx5/mlx5.h +++ b/providers/mlx5/mlx5.h @@ -180,6 +180,10 @@ enum { MLX5_USER_CMDS_SUPP_UHW_CREATE_AH = 1 << 1, }; +enum mlx5_vendor_cap_flags { + MLX5_VENDOR_CAP_FLAGS_MPW = 1 << 0, +}; + struct mlx5_resource { enum mlx5_rsc_type type; uint32_t rsn; @@ -258,6 +262,7 @@ struct mlx5_context { struct ibv_tso_caps cached_tso_caps; int cmds_supp_uhw; uint32_t uar_size; + uint64_t vendor_cap_flags; /* Use enum mlx5_vendor_cap_flags */ }; struct mlx5_bitmap { diff --git a/providers/mlx5/mlx5dv.h b/providers/mlx5/mlx5dv.h index 2e4995f..c09fad2 100644 --- a/providers/mlx5/mlx5dv.h +++ b/providers/mlx5/mlx5dv.h @@ -67,7 +67,8 @@ enum mlx5dv_context_flags { /* * This flag indicates if CQE version 0 or 1 is needed. */ - MLX5DV_CONTEXT_FLAGS_CQE_V1 = (1 << 0), + MLX5DV_CONTEXT_FLAGS_CQE_V1 = (1 << 0), + MLX5DV_CONTEXT_FLAGS_MPW = (1 << 1), }; /* diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index e233877..9d4a4d4 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -1923,6 +1923,9 @@ int mlx5_query_device_ex(struct ibv_context *context, attr->rss_caps.rx_hash_function = resp.rss_caps.rx_hash_function; attr->packet_pacing_caps = resp.packet_pacing_caps.caps; + if (resp.support_multi_pkt_send_wqe) + mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_MPW; + major = (raw_fw_ver >> 32) & 0xffff; minor = (raw_fw_ver >> 16) & 0xffff; sub_minor = raw_fw_ver & 0xffff;