From patchwork Wed Mar 21 12:32:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 10299395 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 4CBE5602B3 for ; Wed, 21 Mar 2018 12:33:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F9AF2913E for ; Wed, 21 Mar 2018 12:33:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3431229799; Wed, 21 Mar 2018 12:33:28 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 9AAB42913E for ; Wed, 21 Mar 2018 12:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbeCUMd0 (ORCPT ); Wed, 21 Mar 2018 08:33:26 -0400 Received: from mail-cys01nam02on0068.outbound.protection.outlook.com ([104.47.37.68]:3503 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751688AbeCUMdZ (ORCPT ); Wed, 21 Mar 2018 08:33:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1OwcneL1VlCwhCdroNTvv9iyNsi1bG7dvwCzagUQKNI=; b=l1gJGoq5xVfB8AmJlaG9xExwVZ9u/4VggB7/z4pv8JYYvi5B2CE7CmwPbQg1mCbCR29HzodJgrj3jPtN+kMhcJjLANAovfzzzmWqLGkFBvGEV/pValr9oAaMMbWVsBJqW9fB5KlGkq7d37xRU/NWPfQiJyhg+Uhg3MZ9hSVUWMM= Received: from CO2PR07CA0060.namprd07.prod.outlook.com (10.174.192.28) by BY2PR0701MB2085.namprd07.prod.outlook.com (10.163.156.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Wed, 21 Mar 2018 12:33:22 +0000 Received: from BN1BFFO11FD021.protection.gbl (2a01:111:f400:7c10::1:181) by CO2PR07CA0060.outlook.office365.com (2603:10b6:100::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.609.10 via Frontend Transport; Wed, 21 Mar 2018 12:33:21 +0000 Authentication-Results: spf=fail (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: Fail (protection.outlook.com: domain of cavium.com does not designate 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1BFFO11FD021.mail.protection.outlook.com (10.58.144.84) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.527.18 via Frontend Transport; Wed, 21 Mar 2018 12:33:20 +0000 Received: from lb-tlvb-michal.il.qlogic.com.com (10.185.6.89) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Wed, 21 Mar 2018 05:33:18 -0700 From: Michal Kalderon To: , , CC: , , Michal Kalderon , Ariel Elior Subject: [PATCH v2 for-rc 1/3] RDMA/qedr: fix QP's ack timeout configuration Date: Wed, 21 Mar 2018 14:32:46 +0200 Message-ID: <1521635568-30143-2-git-send-email-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1521635568-30143-1-git-send-email-Michal.Kalderon@cavium.com> References: <1521635568-30143-1-git-send-email-Michal.Kalderon@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(396003)(39380400002)(39860400002)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(8936002)(4326008)(86362001)(69596002)(77096007)(26005)(8676002)(110136005)(356003)(2201001)(48376002)(54906003)(81156014)(81166006)(305945005)(50226002)(85426001)(336012)(104016004)(106466001)(50466002)(36756003)(107886003)(316002)(2906002)(51416003)(105606002)(5660300001)(76176011)(186003)(2950100002)(6666003)(47776003)(16586007)(72206003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB2085; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD021; 1:O9wZppIwiq+oTsVGl5EzPh2YZ8LtYIM+AicUPG34QikI3++OJGF3AeVUSHzURScdXy/ZXGsY4bKV/BPl7m9bZjxUvIHVJYZBum0Lm7ewzNe5NBxQDX17qhW1h4uEqruw X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f8d9f1e-380b-44c9-71e2-08d58f27ee91 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:BY2PR0701MB2085; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB2085; 3:H63aC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HyxAWqpvK6GCawBn+eTXXyeORAHJESBja6AUWiL7YtWnKD6/yeMz571fK6QAfIfgR6FtY1XtSsKziu8sV9tGM8wdsFGftPfqRicQqUpcdFAxsaoiHSmaYnmXG463xulvTSUvxXbt/ZMTQZPCg3yALVeZbOI37ONqw/mDhk/tnV97cnb6JVUQpV9ponsHtAf2VywRuZPGiCSs2T3iHGZfsHvZHapja4eYnMeEQ2/77T60eRwBQHg922sOwdQQEhCQ/evYUqdjbKVwFex0JakKA5a06qcA1LOFEJ91s29JhqfjFZ0I2H1Tz/Xf8u+gQTKFdFBKyRWCZqsEcaAGTzM1fEt6pQYUEmO0pGurkLMomL52g/MeKXwAbIRtZ6jMw1SIcS8kA5P/m/6eBrLOoCg1U1IdrKsnN7XI2g5YJL01oaC0t53q98K0UNv96sJ3IcqwlRl6OMK+N/K+9mnWzHJFWO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501322)(52105095)(10201501046)(3002001)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BY2PR0701MB2085; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0701MB2085; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB2085; 4:xvqV/MruxBNTZ2wcDX+VliiHntGaYqpL3wB+GmymbpRqGDsUYyYmPjf7UrFCwVbUv6Tkra3I/JD1WDIuV6eHiaerOdYWupjluJN+JlBFcymy1MKwz/yTFcluNg/8QV+QZEA4P/0+kAwiN8T/zE5aCWnsff0Xy3eJKoqiqmvQqAj2IMV3YlFICKArOXZozbmlEqcW9QBm7WL5IeFuHs/s2QiwQ1j+Fl13P4ntKDutlyQIALU5712ZcRF9ivCv/q9ivO3QxfxyelBevbOaBNgegw== X-Forefront-PRVS: 0618E4E7E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB2085; 23:FgPaKWD5u89QRn+unOsxkASIgdCfuMDSALSP/LQ?= =?us-ascii?Q?tU+ZVvaebTMEecyW9+rx04AY+kZwZrAqbpxT87hHMWRmj5ZjbcRb/5o44laH?= =?us-ascii?Q?SwWgdON3WqWGBNsPzkASlo5w1suaD6AILkopY99Plg9b5Dy2IJZmTA/RJGBl?= =?us-ascii?Q?yhT+/6E1ap78tNWRkMcXfPWmJ1lLFxqmgg9eKuKHIpfFa+0j6vCO5+x52mcK?= =?us-ascii?Q?EjT9+itMmAqQVgRbYUwjWkYdTMr799KppZOtWVGQ+YCkayAex9jtwfTZCSxq?= =?us-ascii?Q?2PhkiW3YnTcnBfPT5ziJLmmbNuoJ/zfRyUDm8DPxHjFkc5Z2uZnOLsIOoD85?= =?us-ascii?Q?BbH9h+20qManDKffbDmUqM4JrBAKEH6q+TRKwxd0tajYXpJ8xu+cb/+UjTFn?= =?us-ascii?Q?KPNtMpGmUR3aqrpCVT+t230pDQHRYSY4YKlObBUAPrmTxzBaJCJPnNJeD5KH?= =?us-ascii?Q?xZFzGEAqR7pZC7A0/VQ7vQNRrm+SCzgtVtGAdWNqx6weYgZ0LEAS7Il8lG3h?= =?us-ascii?Q?gp6ENld/Gt7RNluSC95pDo5N1reN4llSO7hVCkEPtwpQiCqF/1E2AA2s3Jr0?= =?us-ascii?Q?8Gb52RA0x26KR3GDtbwZDBHWOYO8KAg2sTxSw4Swx3PkuFjlsy2MGTdKwZzA?= =?us-ascii?Q?aEbwaR8GnYLIAQOiw/+edaCTkVrJEVwFgmR72JAtSIo93bfC9rp3Li9wOozN?= =?us-ascii?Q?seCO3K5TqTCXMDQsWMow87Dn4scvCv0bLA7Bc6yB2lus9MU6Dei6miP8tEEq?= =?us-ascii?Q?/JWQP7grGnvqj2k+2cdXWMu2+R4Z15ck7DqdMG/8KKwQRHfmSgi6kyGTiFdV?= =?us-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fHWauj1R1vuebY30tLMV2+6iOtq9lTNb4OXvGpX1OGPK36/GBznkz3TARhd892MhyF+topSRKsO0MmpYzP0AbUSBrI=; 24:vbhx2zQVwlau6/x8fJ6L2gnvCwOoRe1PcTrDQhJawN+XfRLuDM00fYdL9QnHP2/g/LYAcNxwTfpWNvCW6nmqzm4G/FrfbpOa7e7GtF0WBfY=; 7:Lkw7muX1lXd2LSkdvt+tyo5mx5IDiWaDNy/28+mPKcGB4atYLDey6UmkOeUz6utjQ6a90bmG2PzlVCAwgvuj92C3hFJMcqS+kkhGRnDCd8xyA5HhY6lDrKey1emQj4lM6yYJnSCrPDNpLOL1ogSiMspr5AtLyz/s3RG3nbpPJqvi7JJrpAFpeMWqHTLEHK0S3L2WU8mKQIp+dyCIs1zmAZkKlt/Uusy0W91U2kJ0lTalL2TH4Dx5W3s1H0+KuJyf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2018 12:33:20.7586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8d9f1e-380b-44c9-71e2-08d58f27ee91 X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB2085 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 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 --- drivers/infiniband/hw/qedr/verbs.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 875b172..716fae0 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -2086,18 +2086,23 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 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);