From patchwork Tue Jan 5 14:23:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7955331 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0E782BEEE5 for ; Tue, 5 Jan 2016 14:23:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C68D20384 for ; Tue, 5 Jan 2016 14:23:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E4312037E for ; Tue, 5 Jan 2016 14:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbcAEOXw (ORCPT ); Tue, 5 Jan 2016 09:23:52 -0500 Received: from mail-by2on0082.outbound.protection.outlook.com ([207.46.100.82]:28672 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751445AbcAEOXv (ORCPT ); Tue, 5 Jan 2016 09:23:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mzz7w66kwBj3gZ+QrzKiFuRHpAOJTV09xfMhXNe9KIQ=; b=Jq0RzX8+mHPQ9RpHvx/TNejyuv1CndPf+MiLfWGhO7hVjcNXi4LodGyfzckz/nDfxEiT79zCUil3GS8grmYyikhY5B2Tz36a5ggcCXqovYI7hTxfeOIcHMZN4Hu+kUYPbYvKH3l+e31okXkTBqsSYJ/DL4xr1hXlWuaqk7Vkftc= Received: from BLUPR02CA043.namprd02.prod.outlook.com (10.160.23.161) by BN1PR0201MB0818.namprd02.prod.outlook.com (10.160.170.150) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:23:48 +0000 Received: from BN1AFFO11OLC003.protection.gbl (2a01:111:f400:7c10::187) by BLUPR02CA043.outlook.office365.com (2a01:111:e400:8ad::33) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:23:48 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BN1AFFO11OLC003.mail.protection.outlook.com (10.58.53.74) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:23:47 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id 2E.99.20094.3F1DB865; Tue, 5 Jan 2016 06:23:47 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Tue, 5 Jan 2016 06:23:47 -0800 X-AuditID: ac160a68-f79196d000004e7e-ec-568bd1f3c42d Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id E6.FD.08831.1F1DB865; Tue, 5 Jan 2016 06:23:46 -0800 (PST) Subject: [PATCH 07/15] IB/srpt: Simplify channel state management To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD1F1.5050107@sandisk.com> Date: Tue, 5 Jan 2016 15:23:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <568BD0FC.70207@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsWyRoxnke7ni91hBrOfc1i8PP+B1WLl6qNM Fs8O9bI4MHvsvtnA5vF+31U2j8+b5AKYo7hsUlJzMstSi/TtErgy7k3fzFLQLFkxc9Yu1gbG kyJdjBwcEgImEp82c3YxcgKZYhIX7q1n62Lk4hASOMEocebPFSYIZzujxOfmX0wQVSYSR2/N gUpsZpR42/SFBSQhLOAo0b7vOzOILSKgJrHp1SJ2kA1CAhoS77ZmgYSZBeIl1n16wwhiswkY SXx7PxOslVdAS+L5metg81kEVCRuLfwPNkZUIELix4YljBA1ghInZz4Bq+cU0JT437oLbDwz kL1+lz7EeHmJ7W/nMIOcJiGwjFWiaddWsDlCAuoSJ5fMZ5rAKDILyahZCO2zkLQvYGRexSiW m5lTnJueWmBoqFecmJeSWZytl5yfu4kRHAlcGTsYt04yP8QowMGoxMPL8bIrTIg1say4MvcQ owQHs5II7+sj3WFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEea1b1MKEBNITS1KzU1MLUotgskwc nFINjAcviwgJz57+Xc2u5N5x51juBVcXcc5+5HdMYdGk0rcXHZR3u/HeEd8wV5gl+8vPJ9zr 82v8bfVmnr/EnLNthZjzstC469+cG1V8r/qqSKotebJrllm9c/rf1mj1GymbM3aVvXFc4dxi tKKy9bDsJduag9dXrHd7KrIsYse6AocEC9mv/DoBfkosxRmJhlrMRcWJADCiIEyAAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsXCtZEjRffTxe4wg0lfTS1env/AarFy9VEm i2eHelkcmD1232xg83i/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZ96ZvZilolqyYOWsXawPj SZEuRk4OCQETiaO35jBB2GISF+6tZ+ti5OIQEtjIKHHu+1NmkISwgKNE+77vYLaIgJrEpleL 2LsYOYCKNCTebc0CMZkF4iXudoKNYRMwkvj2fiYLiM0roCXx/Mx1sDiLgIrErYX/waaICkRI /NiwhBGiRlDi5MwnYPWcApoS/1t3sYPYzALqEn/mXWKGsOUltr+dwzyBkX8WkpZZSMpmISlb wMi8ilEsNzOnODc9s8DQUK84MS8lszhbLzk/dxMjOBw5I3cwPp1ofoiRiYNTqoFRwIp/wf15 0w5prNrGeLWri3fCe4d1lvPSytb1ztcu5RBZM+/sbcMPEc9K1OrUGJ+t3PnfIttyymaBG6Hs jrO3XagJiGTY5NgV5ZB5bc2S5AtOH6e/+LhF4vemVrW5B1S8XLr4F0b83KG7JEB1jeyiS0/Z tCVCQ9p3nMq3OWc+JePHzjfiok/OK7EUZyQaajEXFScCADlZI8f3AQAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC003; 1:lA7WnAWJiN7ACA8q0KWWIzOmu/ftivY9D3OJFTKaf7KSseeac0x6UjmeyOSLCCzMppDrB7lmZF5ragWT1PrPExXita/LqYXnv4jZxukxvPHyNngghf1amfkBHr06bIEILrpbAkp1PLacunWspnM4r8rk/qF2jd+kmNTD0l6VnYFG08chtmCts+2dqiLtKj83gpNaPDm5DQQRdimWM3aTQZH3rAGF65oZlcUTxp4izHgYVzdgy+N+reEmoBDbLyLZFCa6XblNzXK+Jvr+jdqzFifTXPqGtEREycjd2vcz7ulZJgEsiewWpXmnmR9XSRAOp/PiY/sjk9uh+KA5HsyNDIveCXOyFY3uZVPy3Ux1QH7IEYUxpukCeS0tQAdw8LEU X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(64126003)(86362001)(54356999)(4001350100001)(106466001)(50986999)(77096005)(76176999)(83506001)(92566002)(50466002)(81156007)(87266999)(5001960100002)(36756003)(230700001)(97736004)(87936001)(2950100001)(23676002)(4326007)(5008740100001)(59896002)(69596002)(189998001)(33656002)(19580395003)(229853001)(110136002)(19580405001)(80316001)(47776003)(1220700001)(65806001)(65956001)(586003)(11100500001)(1096002)(65816999); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0818; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 2:FSnecKA3atxLfn8Yw7pXKNcsIgPsgXnum5w2AKKzgBcggj+RS5jTAFPj/Tmzj60puUP0Ysm42Eo4oYe6mzDQckWfZDeRcruqBKE7uxtcmQjsTyEOuWNYgyMGciflvzqNLjzCukzr5riGJg5F3TLBSg==; 3:utrHeHC8LL0SGvTbh0mjkwU+D3kZA3PMtQo+RrwcjjPr24zUQx1k6TbsZl9Sf01hSGYrJlrXBuIRy59M1kWIAnTAJcXNRCo+PzFjp9vgVOdPUXEzoS8UzXQjs0Tdrm+vMJ9U8Cpd9ib5Ko4s03+JINV4WEJJ9ybfJ1JrII2uRVA3330/VexME+MB6WlMSajheLkIaE8rqPPV/0DHJ2qAaUD01ZWELxIWBwvD5zPpf4Rp6vK/uKtMZL+TN4Fi2NaXIecBG0x8EmEbBwogiMuKJQ==; 25:10kFHmIrciwI+cNJ7OKMYCBuPP/eC1fqX8Q1sZBz+oLf4u5O/Iv62yArkRm5NKOr1wiTHmWjmwu6CshQU89zSvdtr2GJ5wE3aPvvhoDlKayfDe154S+sr4dMk8iDBwSGTWtIENAM2SUMfILr8jjRopv9Xj4X3QD4b+7zOZFhrpC/9sxKbyxt+sesTV9X9H1N4eyvV6yh40vIxxsNfQKKjckW6oFGthoum6E7D2VKf3AfSaKRNEAeam7u7uXlFcZwa+8BWTSS1wJywKvggJbq7g== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BN1PR0201MB0818; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 20:PHX6nmfwddH5G3SV1QbCMGEdFUPnjSsXxUYyHsyTeKUU6VW+oad/q/JwZ+OLHVnYdFdlV9W/Yl8Jpjq0x3mzeyUWxgqABvCWsErMAZr/KvWDwc4VYxrgS+f+WIGHgOhGbDQZQG+MpfjXConuCTem7swULM/axJWQIK1lZYr5055XQllh+okn5lK7xkocpn42aKsfxihAborGfou9LftIdYow+9piWDM1BejRJuvn/QcQ4n8pKaApoJxUFweOlV6HJZoYYAiFYKvWF1KQLLGUVmkQtjRM8oc0hdnK7qGL0JvJMq2WEU+VQ6ncmVZxpeDFmX5e6F3aijXnJ9xSW2IlwZ/MC3hypWMbDTNeX4t9stnDgEVcPsJQs8c7ogwbvJuI+NqlixC1T56dlmQwkQ9EvnrIRajGCN747rALj1P04sbFdH3v7MGLpxBzv6ShZLrnsB9BoHXUY3ul5M19USZ48CWt6avw4W7CIxPKQXoTz8PGIEZcXZnjGayHNbWnXbpO; 4:VCx3ToexhrdY501wjOi7unr2HLyG7sIKfvXVQFak7DwnhD4UjEzTakWyAx+1XHwMjd59roRozOPJoo/6kCYsSoIaABLsNq3Us2r/BGc6+bTlHTOmxJ8h6XoxPQ1i3QwKSmVvHNQORSx1dxelc+n+xPtB1bT8Gn8WbKTtMuINWxoELjK4p+Zlr2rN3/ZLp12J4giEHvF6mhhzU9Tf3qYJzugobC8gKhBj+EAOUGaEQpGRi8U9niOeBBtaoqCnAvbAB2dKiiRSH4BumFAOue5Tuqgg05pGobBT2jNvjA2QGpil3i8fJnQkiKaEjdusvfdtHFtAw+HAdXapUyqSm9hUrKhUUU92ABj6bCnglS1P4f8vXHBmm6Hm4qj6epPz1zYTwQSmQiGd8DGqakPQboOvnW1FlCS5g6GNttiG yTGqVEdmj4SAjo8Td+PCQsDkKQpe X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046); SRVR:BN1PR0201MB0818; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0818; X-Forefront-PRVS: 0812095267 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjFQUjAyMDFNQjA4MTg7MjM6aU5KRWk4b3o1RTUwcTVqRGp6UUNVMnc5?= =?utf-8?B?amRIR2tZMnZLVmt2U3RIUEpndTFhYkkwMFB3Rkh5R3hzNTNwSjd3bnppaU16?= =?utf-8?B?ZU9OWlFWODFBeHFqN1Q4TmJqSVF3b3NoRHpYQ2dlZFI1ZVowckptbGJlZ1pQ?= =?utf-8?B?M2w2cnBOcUNEN3BDNW1mb1M3UFRGbTh4VmR0cTd3alFKRjN3SW84V1g4UTZU?= =?utf-8?B?ZHZaWEJXTnRmQS9wSTFXYUtVMk84T3JZK01nTjJoNm5tUEZNUys5QlVLOUtT?= =?utf-8?B?U3NRNnJBbk5BSFgrMXpnNzFxMHJ3d1NlUEM0bGRLWlBtc0dOVXZRZ0tFVW1p?= =?utf-8?B?SzdxZ2Fvc0hOMVh3MjVZWmRPMEk2cmt5SEtic0JEM0lpczZVN1RBVWtQMHln?= =?utf-8?B?OW5zMEpsYWtWTnFKaWpjZW83L24rbFo4QzFYWVlBMWRYOElwS1pJSmJscWxB?= =?utf-8?B?dXF3V2I4emsyRG1TTWxmVXVmSGZ2VThZWG02Z0NrNFpUR1d6L3EzeU1USTVD?= =?utf-8?B?djVyZnV6NTZhbkdjL2MrSFBtN0tHeHd0bTRJOEF0VXFBM3FmVnRWdCtFMEpR?= =?utf-8?B?bTJHNjY1bWF0R2N0SHdHZnc4NlhleGREMkRvMnFJMHNITUdSVGxyanJ1d2U1?= =?utf-8?B?cHhudGtSYndYUTF3YkROaHpMWER2WFMvREEvc2RRMCtOZnh6eVlwa2JCUTR6?= =?utf-8?B?R0wveHgrZHZvY3ozVXIwN1J0V09kblpqZkFldk5EelZWdHRjendqc0xBU1Ba?= =?utf-8?B?MWlNeTBrN080c1VEbGhYeUsyQ0dPK1g1eEltZnhteWhkR2ZlNXJtdHJKVG5h?= =?utf-8?B?aXVKUnIwN1dwVGtvZy80YXZQRHl6bmVjWC8wZnpob2dRRjVBaCtpQzZxeDla?= =?utf-8?B?L3J5MDU5L3FKc3ltenZRdjZoYVFjU2dtSk05elZUU3c4dzMxL2RuRlJLcHIw?= =?utf-8?B?bGpPangwWWh6WmYrNytNUFpqMnVkZjUyTDI0ZWsybDRJek5GSXlQeVJ4OE5X?= =?utf-8?B?R0dpekZ1V1JJUkttTnNyQndYL2VGQUoxZ2JnNUE0bjJrdm5oRFZ1Q0lCTWRq?= =?utf-8?B?T0oxaVlqTHB2WGFETFMvdU9rRmg0RXhEUjQzWUhOYTE2Q3ZYbzBWT1NtSFEx?= =?utf-8?B?WjJ4TnNMTFFIbjEyV25paWloYzBhSlhTblExTHdvR29UTkVxVjRoRVBCeUQ1?= =?utf-8?B?aDB5L3NoWXpRckNBRFZhZyttVXhCNVpHZytnNE5RRWF1VmJZVmR3OHM0bUE1?= =?utf-8?B?QmgxbVNnVzBWTU1hSUJ2ZFNVSk1jWDFsK2Zyc2IxcjVqZ3JZbXRkWk5OY09y?= =?utf-8?B?ZGtjRnVKcGdjSVdJazJadVlkaGx6dzFSNm5ML1VYT0RQZ01ZWVBWaDhGSm9R?= =?utf-8?B?eDdTTzJuYTErM0tNQmtqUmFjZnpZZjk5RFZaQUR5aDNPYkxPS3ZUMVllN0VZ?= =?utf-8?B?N2lsbEJtSWNWeFc4T3dkdUNJdkljMHQzWUdiYzVNSitTNDExWkpoNUtpbWs4?= =?utf-8?B?NjcxNGNQMmMvbFkvbXBOZmgyWEJ3K3NHNUUwVmxkRnBkUUpPMUorNERRNlBt?= =?utf-8?Q?N0B?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 5:4Eei3OYkyN7jRQjoF8xoFXmgkfFTqmjkvSJoNQEjEPP80ArpZ+toT2P7YoOHIwRWb0h/+/dI2tk02a1e/teiymSwAP6ihjvDvq56i3MYAFUgQvuKha9KXDrWYq9xFXgawdNqxtsGjKIXLYj9j+Y2Qw==; 24:FE9AnPVJFyHz5RXAu3iFdgL3aHLzRND0xy5kQItN6YMxrDr174p2uqM6EDZ+8JxQm8FpGk9LinECJG9QteCJcamPTAhBODoC0HPpJgTr+CU=; 20:MFNQULqQ0xiQ0J+9ymt8nnx71bd7qkjbxjkuwBhz7n6jwGv3afuzG7xMa9DOKgMgirpvaq7Y/Ieme24P+Y7zD6oqZdZ8zhStpYHdVjAiVf78We9wPz9ke0Xqkck8DoD0A3l8CB1J7WqKZ9vpin353rhag33Lnsf4GqI2JQ3ZckHmML49uLa/ts/KV+YhtaQ+NjG9Ll9iRkx0FyCLoLJs9875YLPBviGf2DD0quUF5XbKlbZDKSLBzrmOR0RicETr SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:23:47.5673 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0818 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only allowed channel state changes are those that change the channel state into a state with a higher numerical value. This allows to merge the functions srpt_set_ch_state() and srpt_test_and_set_ch_state() into a single function. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 42 +++++++++-------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 9cb1a14..a27414d 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -96,37 +96,21 @@ static int srpt_queue_status(struct se_cmd *cmd); static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc); static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc); -static enum rdma_ch_state -srpt_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state new_state) +static bool srpt_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state new) { unsigned long flags; enum rdma_ch_state prev; + bool changed = false; spin_lock_irqsave(&ch->spinlock, flags); prev = ch->state; - ch->state = new_state; - spin_unlock_irqrestore(&ch->spinlock, flags); - return prev; -} - -/** - * srpt_test_and_set_ch_state() - Test and set the channel state. - * - * Returns true if and only if the channel state has been set to the new state. - */ -static bool -srpt_test_and_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state old, - enum rdma_ch_state new) -{ - unsigned long flags; - enum rdma_ch_state prev; - - spin_lock_irqsave(&ch->spinlock, flags); - prev = ch->state; - if (prev == old) + if (new > prev) { ch->state = new; + changed = true; + } spin_unlock_irqrestore(&ch->spinlock, flags); - return prev == old; + + return changed; } /** @@ -199,8 +183,7 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch) ib_cm_notify(ch->cm_id, event->event); break; case IB_EVENT_QP_LAST_WQE_REACHED: - if (srpt_test_and_set_ch_state(ch, CH_DRAINING, - CH_RELEASING)) + if (srpt_set_ch_state(ch, CH_RELEASING)) srpt_release_channel(ch); else pr_debug("%s: state %d - ignored LAST_WQE.\n", @@ -1946,12 +1929,7 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id) spin_lock_irq(&sdev->spinlock); list_for_each_entry(ch, &sdev->rch_list, list) { if (ch->cm_id == cm_id) { - do_reset = srpt_test_and_set_ch_state(ch, - CH_CONNECTING, CH_DRAINING) || - srpt_test_and_set_ch_state(ch, - CH_LIVE, CH_DRAINING) || - srpt_test_and_set_ch_state(ch, - CH_DISCONNECTING, CH_DRAINING); + do_reset = srpt_set_ch_state(ch, CH_DRAINING); break; } } @@ -2368,7 +2346,7 @@ static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id) ch = srpt_find_channel(cm_id->context, cm_id); BUG_ON(!ch); - if (srpt_test_and_set_ch_state(ch, CH_CONNECTING, CH_LIVE)) { + if (srpt_set_ch_state(ch, CH_LIVE)) { struct srpt_recv_ioctx *ioctx, *ioctx_tmp; ret = srpt_ch_qp_rts(ch, ch->qp);