From patchwork Sun Nov 15 11:30:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haggai Abramonvsky X-Patchwork-Id: 7618731 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 62050BF90C for ; Sun, 15 Nov 2015 11:31:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E90B205DB for ; Sun, 15 Nov 2015 11:31:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8ADC3205DA for ; Sun, 15 Nov 2015 11:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751095AbbKOLbx (ORCPT ); Sun, 15 Nov 2015 06:31:53 -0500 Received: from [193.47.165.129] ([193.47.165.129]:43622 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751288AbbKOLbk (ORCPT ); Sun, 15 Nov 2015 06:31:40 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from hagaya@mellanox.com) with ESMTPS (AES256-SHA encrypted); 15 Nov 2015 13:31:14 +0200 Received: from dev-l-vrt-198-005.mtl.labs.mlnx (dev-l-vrt-198-005.mtl.labs.mlnx [10.134.198.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id tAFBVEFg030353; Sun, 15 Nov 2015 13:31:14 +0200 Received: from dev-l-vrt-198-005.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-198-005.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id tAFBVEHm026773; Sun, 15 Nov 2015 13:31:14 +0200 Received: (from hagaya@localhost) by dev-l-vrt-198-005.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id tAFBVEQX026772; Sun, 15 Nov 2015 13:31:14 +0200 From: Hagay Abramovsky To: Eli Cohen Cc: linux-rdma@vger.kernel.org, Haggai Abramonvsky Subject: [PATCH libmlx5 v1 5/5] libmlx5: Work with CQE version 1 Date: Sun, 15 Nov 2015 13:30:59 +0200 Message-Id: <1447587059-26725-6-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1447587059-26725-1-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> References: <1447587059-26725-1-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> 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.5 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 Abramonvsky From now on, if the kernel supports CQE version 1, the library will choose to work with it. Change-Id: I22aff64a5f98dde8cb1b6d771424df52ac5d682b Signed-off-by: Haggai Abramovsky --- src/mlx5.c | 3 +++ src/verbs.c | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mlx5.c b/src/mlx5.c index 2ef5759..5e9b61c 100644 --- a/src/mlx5.c +++ b/src/mlx5.c @@ -582,6 +582,8 @@ 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; if (ibv_cmd_get_context(&context->ibv_ctx, &req.ibv_req, sizeof req, @@ -600,6 +602,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/verbs.c b/src/verbs.c index 7d13ed2..92f273d 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -909,8 +909,7 @@ static int init_attr_v2(struct ibv_context *context, struct mlx5_qp *qp, cmd.rq_wqe_shift = qp->rq.wqe_shift; cmd.uidx = usr_idx; err = ibv_cmd_create_qp_ex2(context, &qp->verbs_qp, sizeof(qp->verbs_qp), - attr, &cmd.ibv_cmd, sizeof(cmd.ibv_cmd), - offsetof(struct mlx5_create_qp_ex, uidx), + attr, &cmd.ibv_cmd, sizeof(cmd.ibv_cmd), sizeof(cmd), &resp.ibv_resp, sizeof(resp.ibv_resp), sizeof(resp)); if (!err) @@ -944,8 +943,7 @@ static int init_attr_v1(struct ibv_context *context, struct mlx5_qp *qp, cmd.uidx = usr_idx; err = ibv_cmd_create_qp_ex(context, &qp->verbs_qp, sizeof(qp->verbs_qp), - attr, &cmd.ibv_cmd, - offsetof(struct mlx5_create_qp, uidx), + attr, &cmd.ibv_cmd, sizeof(cmd), &resp.ibv_resp, sizeof(resp)); if (!err) *uuar_index = resp.uuar_index; @@ -1423,8 +1421,7 @@ mlx5_create_xrc_srq(struct ibv_context *context, } err = ibv_cmd_create_srq_ex(context, &msrq->vsrq, sizeof(msrq->vsrq), - attr, &cmd.ibv_cmd, - offsetof(struct mlx5_create_srq_ex, uidx), + attr, &cmd.ibv_cmd, sizeof(cmd), &resp.ibv_resp, sizeof(resp)); if (err) goto err_free_uidx;