Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2318944imm; Mon, 28 May 2018 06:01:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo7vacSIKA2hQctkWBR1MLuyouc0p201/OSMpYsADsppGVbVult/bThBi6eACFt4MYpuohP X-Received: by 2002:a17:902:a711:: with SMTP id w17-v6mr13631299plq.292.1527512493692; Mon, 28 May 2018 06:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527512493; cv=none; d=google.com; s=arc-20160816; b=kg4mPF1MnAzuqa/IXZgZLaLifZ3HNPCduorKUpLyjCsZbW7iFZG8uzs7C0Q9wc0e1z 7s3O/q7E9z7K3lfNcOXL8vk4cCjmJ2Zh+in5iTEWNjqcW7ekGv1kxGUG9JhvKx5ql+mP /jWBFbH6DhwNOuELKCXSAnEI6idGDy7LKmqB26wSZtJsqospEsx40QjNNuaW03zenNKh Tq1EhXdH2bSYoFoGT9FJgsUOWQxOYTSJRtIbxKEAO7/XJ5QvlcpYzWFBB8n1tS7lUSrF Rlg2pf656i2joY1jRvSjCJ7hag+2Cc0RcVDkmQahEWrrrsmQ/3fLEZuIg0y23Urlnpma Hkzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oRDmBdMCBoLKWE56klIt+aH916gnfgn14w0z+twQjzY=; b=ZDzAxOEw4NWgxEdAnakO1LW12gt+Unpd/b3LF7aM6G9SwpNh79hydbOQqjBMXymcfM Ig9t4CW+1k6kMUHMdBFFfxM3Sx+dOEzxBpH/GeX/ao4leW0762SDoY0R9gAkAO8mb2zH TuwKiCfU2LGfWPFLzBSy7/LIGNBIZc4/5VdesqXpvY8XN20r+4DxLY3+WoxyS7Te7pdu bAyn+5wQiRMX7vHO3pxcoG1vtXC52cjc1wOrlaxDXcW1VSsw5T8HWtedN54rsuZKu2RL T0mNXizo24cLDFLTu3RL2J7ChkoV94kPsZKWaYZO7sif0Nl/JXQrOF4Potmb1eI38Un9 xphA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KpZwoq+y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si8374409pgu.6.2018.05.28.06.01.16; Mon, 28 May 2018 06:01:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KpZwoq+y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164267AbeE1NAe (ORCPT + 99 others); Mon, 28 May 2018 09:00:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:42850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164178AbeE1Kxq (ORCPT ); Mon, 28 May 2018 06:53:46 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4EBBC2075C; Mon, 28 May 2018 10:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504825; bh=RCR2FSYwX9MjiBMY+V8xbyEdPzB0/SmXVQmzTLTpxMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpZwoq+ydyTex8OAEMq6Ogw8H3/EIcGnL3rPwyu7LTLjnGinrcaCGzPSdiFpkOpw8 Pmp3KdFK//0bzr86/63OU/NmCz2VFRRhIXg2fvEMYehyvlhRv+cQqvH+nKGieEnWoG ZnZ9ODQjEffCEisp8WYXQOjeSdMcMsjD5mY4vVtw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Kalderon , Ariel Elior , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 276/496] RDMA/qedr: fix QPs ack timeout configuration Date: Mon, 28 May 2018 12:01:01 +0200 Message-Id: <20180528100331.476294738@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Kalderon, Michal" [ Upstream commit c3594f22302cca5e924e47ec1cc8edd265708f41 ] QPs that were configured with ack timeout value lower than 1 msec will not implement re-transmission timeout. This means that if a packet / ACK were dropped, the QP will not retransmit this packet. This can lead to an application hang. Fixes: cecbcddf6 ("qedr: Add support for QP verbs") Signed-off-by: Michal Kalderon Signed-off-by: Ariel Elior Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/qedr/verbs.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -1903,18 +1903,23 @@ int qedr_modify_qp(struct ib_qp *ibqp, s SET_FIELD(qp_params.modify_flags, QED_ROCE_MODIFY_QP_VALID_ACK_TIMEOUT, 1); - qp_params.ack_timeout = attr->timeout; - if (attr->timeout) { - u32 temp; - - temp = 4096 * (1UL << attr->timeout) / 1000 / 1000; - /* FW requires [msec] */ - qp_params.ack_timeout = temp; - } else { - /* Infinite */ + /* The received timeout value is an exponent used like this: + * "12.7.34 LOCAL ACK TIMEOUT + * Value representing the transport (ACK) timeout for use by + * the remote, expressed as: 4.096 * 2^timeout [usec]" + * The FW expects timeout in msec so we need to divide the usec + * result by 1000. We'll approximate 1000~2^10, and 4.096 ~ 2^2, + * so we get: 2^2 * 2^timeout / 2^10 = 2^(timeout - 8). + * The value of zero means infinite so we use a 'max_t' to make + * sure that sub 1 msec values will be configured as 1 msec. + */ + if (attr->timeout) + qp_params.ack_timeout = + 1 << max_t(int, attr->timeout - 8, 0); + else qp_params.ack_timeout = 0; - } } + if (attr_mask & IB_QP_RETRY_CNT) { SET_FIELD(qp_params.modify_flags, QED_ROCE_MODIFY_QP_VALID_RETRY_CNT, 1);