From patchwork Wed Oct 11 17:27:29 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: 10000135 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 C920E60216 for ; Wed, 11 Oct 2017 17:27:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B019328AEB for ; Wed, 11 Oct 2017 17:27:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A524628AF0; Wed, 11 Oct 2017 17:27:38 +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 4B2CB28AEB for ; Wed, 11 Oct 2017 17:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752091AbdJKR1f (ORCPT ); Wed, 11 Oct 2017 13:27:35 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:33295 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbdJKR1c (ORCPT ); Wed, 11 Oct 2017 13:27:32 -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=1507742853; x=1539278853; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=PWRoMfAlrsBVVqKOmNJf4Sws3Bs+tXA9kbYQx3ZDRbk=; b=E3KZ+kPAgaJ0AxV+09UH4VsvaGykD7mW6SRRPwAKEelrAtrxgJT7q5Wb Ul/KNYHClpRLXgl4xmN20PoAjuHu+rKVtovZtH58kXrnosvOfoFzu5WTM 5E1EcmSqme71bLySwBYyTQTv1sdHsk79voEDKVwV/uWFMG4VVpdlKJnrN EvMhaUA2qh1xYwOgRFyBVpgPSFz2e0exckKiv108taafm1UKBliLxk4RI gnKsFG3E04BVNEIAhtueExS6ZTJqCY460ihzd0d4hEF05YGtEbHFcuulE AlnNVhtT+V2VI31pJ64CHaXmQ6FH5fIfhoPZ9ytw0yc4bN/+Tp8Aulh1q A==; X-IronPort-AV: E=Sophos;i="5.43,362,1503331200"; d="scan'208";a="57885442" 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:32 +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:30 -0700 From: Bart Van Assche To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH v2 8/8] IB/srp: Make CM timeout dependent on subnet timeout Date: Wed, 11 Oct 2017 10:27:29 -0700 Message-Id: <20171011172729.16984-9-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 For small networks it is safe to reduce the subnet timeout from its default value (18 for opensm) to 16. Make the SRP CM timeout dependent on the subnet timeout such that decreasing the subnet timeout also causes SRP failover and failback to occur faster. Signed-off-by: Bart Van Assche Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srp/ib_srp.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 463c3ed440eb..972d4b3c5223 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -711,6 +711,23 @@ static int srp_lookup_path(struct srp_rdma_ch *ch) return ret; } +static u8 srp_get_subnet_timeout(struct srp_host *host) +{ + struct ib_port_attr attr; + int ret; + u8 subnet_timeout = 18; + + ret = ib_query_port(host->srp_dev->dev, host->port, &attr); + if (ret == 0) + subnet_timeout = attr.subnet_timeout; + + if (unlikely(subnet_timeout < 15)) + pr_warn("%s: subnet timeout %d may cause SRP login to fail.\n", + dev_name(&host->srp_dev->dev->dev), subnet_timeout); + + return subnet_timeout; +} + static int srp_send_req(struct srp_rdma_ch *ch, bool multich) { struct srp_target_port *target = ch->target; @@ -719,6 +736,9 @@ static int srp_send_req(struct srp_rdma_ch *ch, bool multich) struct srp_login_req priv; } *req = NULL; int status; + u8 subnet_timeout; + + subnet_timeout = srp_get_subnet_timeout(target->srp_host); req = kzalloc(sizeof *req, GFP_KERNEL); if (!req) @@ -741,8 +761,8 @@ static int srp_send_req(struct srp_rdma_ch *ch, bool multich) * module parameters if anyone cared about setting them. */ req->param.responder_resources = 4; - req->param.remote_cm_response_timeout = 20; - req->param.local_cm_response_timeout = 20; + req->param.remote_cm_response_timeout = subnet_timeout + 2; + req->param.local_cm_response_timeout = subnet_timeout + 2; req->param.retry_count = target->tl_retry_count; req->param.rnr_retry_count = 7; req->param.max_cm_retries = 15;