From patchwork Thu Jan 14 17:12:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majd Dibbiny X-Patchwork-Id: 8034161 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 978DDBEEE5 for ; Thu, 14 Jan 2016 17:14:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FD3D20499 for ; Thu, 14 Jan 2016 17:14:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1B42204AE for ; Thu, 14 Jan 2016 17:14:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755766AbcANRN6 (ORCPT ); Thu, 14 Jan 2016 12:13:58 -0500 Received: from [193.47.165.129] ([193.47.165.129]:55658 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755713AbcANRNz (ORCPT ); Thu, 14 Jan 2016 12:13:55 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from majd@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 Jan 2016 19:13:30 +0200 Received: from dev-l-vrt-202-005.mtl.labs.mlnx (dev-l-vrt-202-005.mtl.labs.mlnx [10.134.202.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u0EHDO98022719; Thu, 14 Jan 2016 19:13:30 +0200 From: Majd Dibbiny To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, achiad@mellanox.com, matanb@mellanox.com, talal@mellanox.com, leon@mellanox.com, Haggai Abramovsky Subject: [PATCH v1 03/13] IB/mlx5: Expose CQE version to user-space Date: Thu, 14 Jan 2016 19:12:58 +0200 Message-Id: <1452791588-19895-4-git-send-email-majd@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1452791588-19895-1-git-send-email-majd@mellanox.com> References: <1452791588-19895-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=-6.9 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 Per user context, work with CQE version that both the user-space and the kernel support. Report this CQE version via the response of the alloc_ucontext command. Signed-off-by: Haggai Abramovsky Reviewed-by: Matan Barak --- drivers/infiniband/hw/mlx5/main.c | 15 +++++++++++---- drivers/infiniband/hw/mlx5/user.h | 8 +++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index b02bf8d..c874c09 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -868,7 +868,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, if (req.total_num_uuars == 0) return ERR_PTR(-EINVAL); - if (req.comp_mask) + if (req.comp_mask || req.reserved0 || req.reserved1 || req.reserved2) return ERR_PTR(-EOPNOTSUPP); if (reqlen > sizeof(req) && @@ -891,6 +891,9 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, resp.max_send_wqebb = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); resp.max_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); resp.max_srq_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); + resp.cqe_version = min_t(__u8, + (__u8)MLX5_CAP_GEN(dev->mdev, cqe_version), + req.max_cqe_version); resp.response_length = min(offsetof(typeof(resp), response_length) + sizeof(resp.response_length), udata->outlen); @@ -944,8 +947,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, resp.tot_uuars = req.total_num_uuars; resp.num_ports = MLX5_CAP_GEN(dev->mdev, num_ports); - if (field_avail(typeof(resp), reserved2, udata->outlen)) - resp.response_length += sizeof(resp.reserved2); + if (field_avail(typeof(resp), cqe_version, udata->outlen)) + resp.response_length += sizeof(resp.cqe_version); if (field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) { resp.comp_mask |= @@ -953,7 +956,9 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, resp.hca_core_clock_offset = offsetof(struct mlx5_init_seg, internal_timer_h) % PAGE_SIZE; - resp.response_length += sizeof(resp.hca_core_clock_offset); + resp.response_length += sizeof(resp.hca_core_clock_offset) + + sizeof(resp.reserved2) + + sizeof(resp.reserved3); } err = ib_copy_to_udata(udata, &resp, resp.response_length); @@ -964,6 +969,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, uuari->num_low_latency_uuars = req.num_low_latency_uuars; uuari->uars = uars; uuari->num_uars = num_uars; + context->cqe_version = resp.cqe_version; + return &context->ibucontext; out_uars: diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h index 5bf0935..41f0525 100644 --- a/drivers/infiniband/hw/mlx5/user.h +++ b/drivers/infiniband/hw/mlx5/user.h @@ -69,6 +69,10 @@ struct mlx5_ib_alloc_ucontext_req_v2 { __u32 num_low_latency_uuars; __u32 flags; __u32 comp_mask; + __u8 max_cqe_version; + __u8 reserved0; + __u16 reserved1; + __u32 reserved2; }; enum mlx5_ib_alloc_ucontext_resp_mask { @@ -89,7 +93,9 @@ struct mlx5_ib_alloc_ucontext_resp { __u16 reserved1; __u32 comp_mask; __u32 response_length; - __u32 reserved2; + __u8 cqe_version; + __u8 reserved2; + __u16 reserved3; __u64 hca_core_clock_offset; };