From patchwork Wed Oct 11 17:27:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10000133 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 2E80A60216 for ; Wed, 11 Oct 2017 17:27:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1666428AEB for ; Wed, 11 Oct 2017 17:27:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B67728AF0; Wed, 11 Oct 2017 17:27:36 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK 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 A221E28AEB for ; Wed, 11 Oct 2017 17:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbdJKR1c (ORCPT ); Wed, 11 Oct 2017 13:27:32 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:4887 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751892AbdJKR1a (ORCPT ); Wed, 11 Oct 2017 13:27:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1507742852; x=1539278852; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=j7TLOywNUIgla1ODh/JKFis+xYyufxQy6ojcWRwiTp8=; b=Jd6MyN2eq9yxIlIFwI549cAA+ztGuLxgcJ9U1M5MKhCweYfetF7UUzy4 uGez7yyTlBjOYQ1b5g+66kmbgIpe/X9zn5DpgxqZ+MJP1TLN8ULUesXC7 oq3zrITwIbArIRHJEr4svL+xYvZEGRPkUiJzAHPkH45wq6q5d6zbmaSqz QzCYChmyB117vWVDK3TIsqUutE3UG6yNaHXzDijagfmf4VFMB3rPIinpL rptdIQAqdgs75jVprAJ4fY3jhdMJPqQ8tIj7vv7LGND1rKVFtTdsGdF5V UrDzO4HdQT6KfEFQr4jpw+CO6lqzte+gluURhlFB/178tVGN4QW2U0Mi8 Q==; X-IronPort-AV: E=Sophos;i="5.43,362,1503331200"; d="scan'208";a="57885426" Received: from sjappemgw11.hgst.com (HELO sjappemgw12.hgst.com) ([199.255.44.62]) by ob1.hgst.iphmx.com with ESMTP; 12 Oct 2017 01:27:31 +0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.172.152]) by sjappemgw12.hgst.com with ESMTP; 11 Oct 2017 10:27:29 -0700 From: Bart Van Assche To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH v2 2/8] IB/srpt: Limit the send and receive queue sizes to what the HCA supports Date: Wed, 11 Oct 2017 10:27:23 -0700 Message-Id: <20171011172729.16984-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171011172729.16984-1-bart.vanassche@wdc.com> References: <20171011172729.16984-1-bart.vanassche@wdc.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 Additionally, correct the comment about ch->rq_size. Signed-off-by: Bart Van Assche Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 95178b4e3565..76370e39857d 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1650,7 +1650,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) * both both, as RDMA contexts will also post completions for the * RDMA READ case. */ - qp_init->cap.max_send_wr = srp_sq_size / 2; + qp_init->cap.max_send_wr = min(srp_sq_size / 2, attrs->max_qp_wr + 0U); qp_init->cap.max_rdma_ctxs = srp_sq_size / 2; qp_init->cap.max_send_sge = min(attrs->max_sge, SRPT_MAX_SG_PER_WQE); qp_init->port_num = ch->sport->port; @@ -1953,10 +1953,11 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ch->cm_id = cm_id; cm_id->context = ch; /* - * Avoid QUEUE_FULL conditions by limiting the number of buffers used - * for the SRP protocol to the command queue size. + * ch->rq_size should be at least as large as the initiator queue + * depth to avoid that the initiator driver has to report QUEUE_FULL + * to the SCSI mid-layer. */ - ch->rq_size = SRPT_RQ_SIZE; + ch->rq_size = min(SRPT_RQ_SIZE, sdev->device->attrs.max_qp_wr); spin_lock_init(&ch->spinlock); ch->state = CH_CONNECTING; INIT_LIST_HEAD(&ch->cmd_wait_list);