From patchwork Wed Mar 14 13:02:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 10282089 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 53BF2602BD for ; Wed, 14 Mar 2018 13:03:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44ED328852 for ; Wed, 14 Mar 2018 13:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395082887A; Wed, 14 Mar 2018 13:03:12 +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 6C5D628852 for ; Wed, 14 Mar 2018 13:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbeCNNDJ (ORCPT ); Wed, 14 Mar 2018 09:03:09 -0400 Received: from mail-sn1nam02on0070.outbound.protection.outlook.com ([104.47.36.70]:11360 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751781AbeCNNDH (ORCPT ); Wed, 14 Mar 2018 09:03:07 -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=O5V33T8dfge/gS5kTtRDhm2/22K6Fy7fQspcBgA0pnY=; b=Xhv+ctSj5LwzbIbSql1wp1Gzai8QV81W2gHeNLUW+kYv4UO6Wbpy9HLYVIE95jtIgsym4l4rxFVt0gvc/BpKhRTElhfR00/chYgNrVTHk+1Xa5aAD/9EgKrtMV2Y0MwlBhnhc8yZuoh41unsGmaNnA9nppxBIf/qRP0krgd24J4= Received: from DM5PR07CA0083.namprd07.prod.outlook.com (2603:10b6:4:ad::48) by SN6PR07MB4222.namprd07.prod.outlook.com (2603:10b6:805:62::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Wed, 14 Mar 2018 13:03:05 +0000 Received: from BN1BFFO11FD017.protection.gbl (2a01:111:f400:7c10::1:110) by DM5PR07CA0083.outlook.office365.com (2603:10b6:4:ad::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.14 via Frontend Transport; Wed, 14 Mar 2018 13:03:05 +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 BN1BFFO11FD017.mail.protection.outlook.com (10.58.144.80) 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, 14 Mar 2018 13:03:04 +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, 14 Mar 2018 06:03:02 -0700 From: Michal Kalderon To: , , CC: , , Michal Kalderon , Ariel Elior Subject: [PATCH for-rc 1/3] RDMA/qedr: fix QP's ack timeout configuration Date: Wed, 14 Mar 2018 15:02:33 +0200 Message-ID: <1521032555-19708-2-git-send-email-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1521032555-19708-1-git-send-email-Michal.Kalderon@cavium.com> References: <1521032555-19708-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)(346002)(39860400002)(39380400002)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(51416003)(16586007)(50226002)(4326008)(478600001)(54906003)(356003)(2906002)(2950100002)(305945005)(110136005)(186003)(72206003)(316002)(48376002)(8676002)(106466001)(105606002)(69596002)(50466002)(81156014)(104016004)(81166006)(107886003)(5660300001)(36756003)(2201001)(76176011)(85426001)(26005)(77096007)(6666003)(86362001)(8936002)(336012)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4222; 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; BN1BFFO11FD017; 1:E+UxY+BIfrNfpOVpLdIzgZd92PtspRshzP2nY/uiRuuVZkMsSPigAzVCnmzluA2tH4vWU7B568BZO655tBcu2H9OWhblg0w5ER9dy0iutcyIRF3Pf3tMY8nGSSev4DrX X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88dcf6bf-b1b6-4b95-7853-08d589abed00 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:SN6PR07MB4222; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4222; 3:mM7Z90kLH75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ZteLISWYkO27NLS6ZJ5ZbEsNoTCMA8ppUDEa5/dtNR+cbQJyMrusW3DC4cD1wROuUV5wI1BMVFV2C5j06zSuZVkkzY/SBTfSvr9rBR/TxcZvWb/ti0Ypliw9v+v9fB7xOywD2S8UJWIBPtrDaq91BEWchb3U90/hyYEogYVsmkkak9xtL5eyjcULchEiP8LSoPdgyALUj5C7EL7LicnGpChfHRowcGfn2IV58ncgsDOYvdiVOwhlQLgxO/ZCjUIIFZ5Q4xAFHhUoKq2XKr3IWK7VE9Rv+7oOwvU3Pqbdx5SL4ckbx/tBUoukytUkK1uAyxqUkOpLA4zjrEA8+tL0W3GVAI2lLZSKXA+S1YW3T5rnIY8n05VyhaMNZr5uVSEcpcMHbQtcjsmSu2sSuRCMmWGmewLjCEM7Np4ntWb9r1Ey1XK8ycUXacJISFiwqUSc428 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)(3231221)(944501244)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN6PR07MB4222; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4222; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4222; 4:LnWIt2Rn+Zw7aLZKebILmE4V0q7mHhyvduHEooJIws1CdzOlBG4oWTUfD8PwIERyB9HqV3H0vbvAOFt/TB/ZIDtwfCm9UBmUeT6RVhF7OWnu+7Yf9BpcTORfSI8p3UtavcYXaPYTbDz/95me/lDIYMdDfkZ12oEPF+UECG+SjX9hoHvmqtzAULLrID21ajK0LspJ4LR4A4DEiKU64c8Yl0ePhY/FZWDitudii+0MF5H1MOjibTx4CDWK4NxcA+/fmoygW3qWa4AD5HcJOG8twQ== X-Forefront-PRVS: 0611A21987 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4222; 23:yXnu4NefxHkkhAPzEPVv9Tcv28QsBYKSvbeDOd15J?= =?us-ascii?Q?I0wmeBcFgD26zoU1UsqHToJDHWWyLniG5TUbMv5yCNsihUR4Ikm8jU/HlZ9d?= =?us-ascii?Q?SQUMjK6PYLhhZBc7gaFadR4AXmRj2XNXFDZUU2q4wZU1JF0NcUK07rTqruzM?= =?us-ascii?Q?wdjXQdMD3nszc3azfZTCO9bZJAsiwFybAszZ9PuOwYz0GYet2gIZnIgVWGSe?= =?us-ascii?Q?MOB1QyIBQN/6YhNhvEmUCXVuNGMXioBoQZSIieLWtE5tp9fA5+clAdf8iA9x?= =?us-ascii?Q?ieg4eWxkueAIwGi/UOiVICMMKzVL2yQsvMShXlvIVTJjaipk9Dmc5iXQx3ZB?= =?us-ascii?Q?efHcgVv1Bz4dsX2JtQ7sUrhYXhb6ZYabKYTtWz+7CUbvapHrB9yZgdl4Kv0m?= =?us-ascii?Q?+wbFWDYUPJU5mW1xRpjuUZgn4yGEUneLzGzp3IALMP6S59nkGBwJ++UkuT1d?= =?us-ascii?Q?IzIaokxW00mCptNqdQyClNPzM9G1EOXCqnJ11NbUYSjjbap0GdkuSFD182Nw?= =?us-ascii?Q?1Ek+EFvEyFHKyjN3bIzyMd8WLsrlV/NpJP1R0DPx5jRLFA8Hfdhb+xOhPRjO?= =?us-ascii?Q?IN8h2PwS737RK5d/pSbKroIPeEP8DpRSlxRFAISfFyGUiy7B9bTWny1qOT/P?= =?us-ascii?Q?MxQiBmzTpQfaO6MAHZrN+wsRbhiJXntPQj3kuXpUukgnR13TBx+mBn7ew9ey?= =?us-ascii?Q?aatjh8Ry+ZITnBOxnJDekO69KJacYUbd8neHBF4V0Hy7VUzLwxFP0KcyX8/R?= =?us-ascii?Q?PXEherHSeQHBnfwMmr2m02FDree2hXl0N6qe1ZJRrm4okomWoTv1IDOm0VgJ?= =?us-ascii?Q?c1QyQ8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ZgCnXvKm2HnBcV21jdCZ6YwQ9nhTAILGQyGeR8ePGPVALTP3stmAgsuXEnXBL4=; 24:mTUGgt4PyyB01eACQT2hR0iZiJDe4jhzuE83a0Xuita7gUIYJINwqdCd3c4iTo5cdhT0fiVIP6wBz/UhfY1n3d+RpkGPTrCRZobbadvHyQM=; 7:3eCsYMxGRlY+7DxvBPrHybRA003pqbkyRhVO+JkRl/aF7uyNSOwWQ0k8zXgU1Avz/0aNi4QkKUR5s7HnYxCc9TOs17ghiIWIAPPn5+w0Pd6HeD/5B8f7VdEioK2DWRk7FGXyxScA+eRFqdwHBew8B148QoTA3zGX4Yr3fLwQckOIgGNg9PBLVD9vxLZKTA1+Msdb7tskrQp3u+7DA/943ZA936depilBvmMyaUDicTFBXaOD9vODbUfWg1zL6GGH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2018 13:03:04.8005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88dcf6bf-b1b6-4b95-7853-08d589abed00 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: SN6PR07MB4222 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 should be configured with ack timeout values lower than 1 msec are actually configured with infinite timeout. 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);