From patchwork Thu Mar 23 13:55:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9641131 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 83DD86020B for ; Thu, 23 Mar 2017 13:55:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74A6E2766D for ; Thu, 23 Mar 2017 13:55:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6994E27B81; Thu, 23 Mar 2017 13:55:52 +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 A231A2793B for ; Thu, 23 Mar 2017 13:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964979AbdCWNzr (ORCPT ); Thu, 23 Mar 2017 09:55:47 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:53999 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964974AbdCWNzr (ORCPT ); Thu, 23 Mar 2017 09:55:47 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Mar 2017 15:55:40 +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 v2NDteNx008286; Thu, 23 Mar 2017 15:55:40 +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 v2NDteG0008805; Thu, 23 Mar 2017 15:55:40 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v2NDtelR008804; Thu, 23 Mar 2017 15:55:40 +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 V2 rdma-core 2/6] mlx5: Report multi packet send WQE capability for mlx5 based hardware Date: Thu, 23 Mar 2017 15:55:25 +0200 Message-Id: <1490277329-8738-3-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1490277329-8738-1-git-send-email-yishaih@mellanox.com> References: <1490277329-8738-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 aba1631..cea9e46 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -1924,6 +1924,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;