From patchwork Wed Oct 8 00:41:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jay Kallickal X-Patchwork-Id: 5050811 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 585329F295 for ; Wed, 8 Oct 2014 00:50:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 519DF201FA for ; Wed, 8 Oct 2014 00:50:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DE69201C8 for ; Wed, 8 Oct 2014 00:50:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755445AbaJHAuL (ORCPT ); Tue, 7 Oct 2014 20:50:11 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:38066 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755431AbaJHAuK (ORCPT ); Tue, 7 Oct 2014 20:50:10 -0400 Received: by mail-pd0-f182.google.com with SMTP id y10so5845285pdj.41 for ; Tue, 07 Oct 2014 17:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=peu/fOz0K+AJJ4hiq27gxIUvZjSqFWu5SquYfSshbEk=; b=r5bDfKl9oPOb58RJn3XOWcGpjfdsvjwOFXQlyD+rXIvUyWPB7dtosepGy4Th7FzJbr NQydiDwDYK3Pyo2qic+5CuplwJjszmEQNNFdc/VmJ87iIcvja8VDK3gB63e0e92fDnuz V6DDUIbn9P7SyRV5Oqa6Q8dJ/gLubtGT/jiXEFmwQ50wvg4Kz2k0hOEKOuyBpsESu+sD 99HDer9N9BU45AJRHikGxBc6BnFTKhFW/6cM/CjBXBbr2YZsXUpWo5+Y/Ckup4mjUz2N 7pUgYBZhiqSjjQ9ofi1lGXQ0kflB+4Aj641dvwWxRbj4oBF6E7kkLi69BMWo7WHhrdCP 523w== X-Received: by 10.70.12.65 with SMTP id w1mr7069573pdb.3.1412729409857; Tue, 07 Oct 2014 17:50:09 -0700 (PDT) Received: from virtualboximagescom-VirtualBox-14.04 (c-24-4-110-253.hsd1.ca.comcast.net. [24.4.110.253]) by mx.google.com with ESMTPSA id hz1sm16939989pbb.75.2014.10.07.17.50.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 17:50:09 -0700 (PDT) From: Jay Kallickal X-Google-Original-From: Jay Kallickal To: linux-scsi@vger.kernel.org, michaelc@cs.wisc.edu, linux-rdma@vger.kernel.org Cc: Jayamohan Kallickal , Minh Tran , Jayamohan Kallickal Subject: [PATCH 1/1] IB/iser: Remove hard coded values for cqe and send_wr Date: Tue, 7 Oct 2014 20:41:28 -0400 Message-Id: <1412728888-13100-1-git-send-email-jkallickal@emulex.com> X-Mailer: git-send-email 1.8.5.3 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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: Jayamohan Kallickal This patch allows the underlying hardware to choose values other than hard coded max values for cqe and send_wr while preventing them from exceeding max supported values. Signed-off-by: Minh Tran Signed-off-by: Jayamohan Kallickal --- drivers/infiniband/ulp/iser/iser_verbs.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 32849f2..7cdb297 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c @@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device *device) { struct iser_cq_desc *cq_desc; struct ib_device_attr *dev_attr = &device->dev_attr; - int ret, i, j; + int ret, i, j, max_cqe; ret = ib_query_device(device->ib_device, dev_attr); if (ret) { @@ -120,18 +120,24 @@ static int iser_create_device_ib_res(struct iser_device *device) cq_desc[i].device = device; cq_desc[i].cq_index = i; + max_cqe = (dev_attr->max_cqe < ISER_MAX_RX_CQ_LEN) ? + dev_attr->max_cqe : ISER_MAX_RX_CQ_LEN; + device->rx_cq[i] = ib_create_cq(device->ib_device, iser_cq_callback, iser_cq_event_callback, (void *)&cq_desc[i], - ISER_MAX_RX_CQ_LEN, i); + max_cqe, i); if (IS_ERR(device->rx_cq[i])) goto cq_err; + max_cqe = (dev_attr->max_cqe < ISER_MAX_TX_CQ_LEN) ? + dev_attr->max_cqe : ISER_MAX_TX_CQ_LEN; + device->tx_cq[i] = ib_create_cq(device->ib_device, NULL, iser_cq_event_callback, (void *)&cq_desc[i], - ISER_MAX_TX_CQ_LEN, i); + max_cqe, i); if (IS_ERR(device->tx_cq[i])) goto cq_err; @@ -439,6 +445,7 @@ void iser_free_fastreg_pool(struct iser_conn *ib_conn) static int iser_create_ib_conn_res(struct iser_conn *ib_conn) { struct iser_device *device; + struct ib_device_attr *dev_attr; struct ib_qp_init_attr init_attr; int ret = -ENOMEM; int index, min_index = 0; @@ -459,6 +466,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn) mutex_unlock(&ig.connlist_mutex); iser_info("cq index %d used for ib_conn %p\n", min_index, ib_conn); + dev_attr = &device->dev_attr; init_attr.event_handler = iser_qp_event_callback; init_attr.qp_context = (void *)ib_conn; init_attr.send_cq = device->tx_cq[min_index]; @@ -472,7 +480,9 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn) init_attr.cap.max_send_wr = ISER_QP_SIG_MAX_REQ_DTOS; init_attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN; } else { - init_attr.cap.max_send_wr = ISER_QP_MAX_REQ_DTOS; + init_attr.cap.max_send_wr = + (dev_attr->max_qp_wr < ISER_QP_MAX_REQ_DTOS) ? + dev_attr->max_qp_wr : ISER_QP_MAX_REQ_DTOS; } ret = rdma_create_qp(ib_conn->cma_id, device->pd, &init_attr);