From patchwork Tue Feb 2 18:50:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majd Dibbiny X-Patchwork-Id: 8194131 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D667BEEE5 for ; Tue, 2 Feb 2016 18:51:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E1E3202C8 for ; Tue, 2 Feb 2016 18:51:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95F84202B8 for ; Tue, 2 Feb 2016 18:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755456AbcBBSvf (ORCPT ); Tue, 2 Feb 2016 13:51:35 -0500 Received: from [193.47.165.129] ([193.47.165.129]:49991 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S965388AbcBBSv2 (ORCPT ); Tue, 2 Feb 2016 13:51:28 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from majd@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Feb 2016 20:51:04 +0200 Received: from vnc21.mtl.labs.mlnx (vnc21.mtl.labs.mlnx [10.7.2.21]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u12Ip40Y029333; Tue, 2 Feb 2016 20:51:04 +0200 From: Majd Dibbiny To: yishaih@mellanox.com Cc: linux-rdma@vger.kernel.org, matanb@mellanox.com, talal@mellanox.com, majd@mellanox.com, cl@linux.com, Haggai Abramovsky Subject: [PATCH libmlx5 5/7] Work with CQE version 1 Date: Tue, 2 Feb 2016 20:50:59 +0200 Message-Id: <1454439061-929-6-git-send-email-majd@mellanox.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1454439061-929-1-git-send-email-majd@mellanox.com> References: <1454439061-929-1-git-send-email-majd@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Haggai Abramovsky From now on, if the kernel supports CQE version 1, the library will choose to work with it. Reviewed-by:: Yishai Hadas Signed-off-by: Haggai Abramovsky Signed-off-by: Majd Dibbiny --- src/mlx5-abi.h | 13 +++++++++++-- src/mlx5.c | 4 ++++ src/mlx5.h | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mlx5-abi.h b/src/mlx5-abi.h index 4b21a17..6427cca 100644 --- a/src/mlx5-abi.h +++ b/src/mlx5-abi.h @@ -55,7 +55,11 @@ struct mlx5_alloc_ucontext { __u32 total_num_uuars; __u32 num_low_latency_uuars; __u32 flags; - __u32 reserved; + __u32 comp_mask; + __u8 cqe_version; + __u8 reserved0; + __u16 reserved1; + __u32 reserved2; }; struct mlx5_alloc_ucontext_resp { @@ -70,7 +74,12 @@ struct mlx5_alloc_ucontext_resp { __u32 max_recv_wr; __u32 max_srq_recv_wr; __u16 num_ports; - __u16 reserved; + __u16 reserved1; + __u32 comp_mask; + __u32 response_length; + __u8 cqe_version; + __u8 reserved2; + __u16 reserved3; }; struct mlx5_alloc_pd_resp { diff --git a/src/mlx5.c b/src/mlx5.c index b942815..0469a78 100644 --- a/src/mlx5.c +++ b/src/mlx5.c @@ -590,8 +590,11 @@ static int mlx5_init_context(struct verbs_device *vdev, } memset(&req, 0, sizeof(req)); + memset(&resp, 0, sizeof(resp)); + req.total_num_uuars = tot_uuars; req.num_low_latency_uuars = low_lat_uuars; + req.cqe_version = MLX5_CQE_VERSION_V1; if (ibv_cmd_get_context(&context->ibv_ctx, &req.ibv_req, sizeof req, &resp.ibv_resp, sizeof resp)) goto err_free_bf; @@ -608,6 +611,7 @@ static int mlx5_init_context(struct verbs_device *vdev, context->max_recv_wr = resp.max_recv_wr; context->max_srq_recv_wr = resp.max_srq_recv_wr; + context->cqe_version = resp.cqe_version; if (context->cqe_version) { if (context->cqe_version == 1) mlx5_ctx_ops.poll_cq = mlx5_poll_cq_v1; diff --git a/src/mlx5.h b/src/mlx5.h index cda7c71..6b982c4 100644 --- a/src/mlx5.h +++ b/src/mlx5.h @@ -120,6 +120,11 @@ enum { MLX5_MMAP_GET_CONTIGUOUS_PAGES_CMD = 1 }; +enum { + MLX5_CQE_VERSION_V0 = 0, + MLX5_CQE_VERSION_V1 = 1, +}; + #define MLX5_CQ_PREFIX "MLX_CQ" #define MLX5_QP_PREFIX "MLX_QP" #define MLX5_MR_PREFIX "MLX_MR"