From patchwork Tue Jan 5 14:22:46 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: 7955311 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 0DCECBEEE5 for ; Tue, 5 Jan 2016 14:22:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 031D220384 for ; Tue, 5 Jan 2016 14:22:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D85772037E for ; Tue, 5 Jan 2016 14:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbcAEOWx (ORCPT ); Tue, 5 Jan 2016 09:22:53 -0500 Received: from mail-by2on0069.outbound.protection.outlook.com ([207.46.100.69]:39754 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751543AbcAEOWv (ORCPT ); Tue, 5 Jan 2016 09:22: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=dZ/qL99KPEDc+cuFvTFBVHFarGMgjItYNrqGZlIRMYM=; b=WmXqLSsADQNm705mCjbEi2xs7Lt92jQHudeD1y2/IEF0pvCPr9507Vo+AEVWmZP6VtVkhqTU24gTicHZX98G0E0uXEIjL+YG6bCBQOr8niiyDt1q/joiLFBUD9HeGk8OvRjUuO6HO1nhI6mbQnTL+hEfLrHG3QSnJC+b1shbOI0= Received: from BY2PR02CA0058.namprd02.prod.outlook.com (10.141.216.48) by BY2PR02MB300.namprd02.prod.outlook.com (10.141.140.26) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:22:50 +0000 Received: from BN1AFFO11FD020.protection.gbl (2a01:111:f400:7c10::198) by BY2PR02CA0058.outlook.office365.com (2a01:111:e400:2c40::48) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:22:50 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BN1AFFO11FD020.mail.protection.outlook.com (10.58.52.80) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:22:49 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 40.0E.02821.8B1DB865; Tue, 5 Jan 2016 06:22:48 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.248.2; Tue, 5 Jan 2016 06:22:48 -0800 X-AuditID: ac160a69-f797e6d000000b05-af-568bd1b8b0b5 Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 03.FD.08831.6B1DB865; Tue, 5 Jan 2016 06:22:47 -0800 (PST) Subject: [PATCH 05/15] IB/srpt: Use scsilun_to_int() To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD1B6.4090308@sandisk.com> Date: Tue, 5 Jan 2016 15:22:46 +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+NgFnrLLMWRmVeSWpSXmKPExsWyRoxnke6Oi91hBpeWsFm8PP+B1WLl6qNM Fs8O9bI4MHvsvtnA5vF+31U2j8+b5AKYo7hsUlJzMstSi/TtErgy9u1qYy7YpVLRMaeNuYGx V7aLkZNDQsBEYsfWE6wQtpjEhXvr2UBsIYETjBI3zgl0MXIB2dsZJc5/2ssE07C6fxELRGIz o8Sxlh3sIAlhoMTZvY/AikQE1CQ2vVoEFOcAKtKQeLc1CyTMLBAvse7TG0YQm03ASOLb+5ks IDavgJbE4UeXwY5gEVCRWHDjFliNqECExI8NSxghagQlTs58AlbPKaAp8b91F9h4ZiB7/S59 iPHyEtvfzmEGOU1CYBmrxMEF81ggnlGXOLlkPtMERpFZSEbNQmifhaR9ASPzKkax3Myc4tz0 1AJDI73ixLyUzOJsveT83E2M4EjgytzBuGKS+SFGAQ5GJR5ejpddYUKsiWXFlbmHGCU4mJVE eF8f6Q4T4k1JrKxKLcqPLyrNSS0+xCjNwaIkzmvdohYmJJCeWJKanZpakFoEk2Xi4JRqYJTd /vTJVG5hkd1ZnzKedeutFTi812bbhdLkzXM4P3nO+Mv0+72AwoY3bDEdVx1Yi71TOL7E3bq2 RNTlrUI779W9n4WtZA7Urj7BOvNVyBSTO/nvHBdMKnU8fi3rh+TaCZat3HnfH5hm/1cRku/s SH568sv8rov6HNl/vK2Lnmbs2xIkV2LW8VmJpTgj0VCLuag4EQBBN/NxgAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsXCtZEjRXf7xe4wg4sXDC1env/AarFy9VEm i2eHelkcmD1232xg83i/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZ+3a1MRfsUqnomNPG3MDY K9vFyMkhIWAisbp/EQuELSZx4d56ti5GLg4hgY2MEgt/7mMFSQgDFZ3d+4gJxBYRUJPY9GoR excjB1CRhsS7rVkgJrNAvMTdTrAKNgEjiW/vZ4KN5BXQkjj86DLYFBYBFYkFN24xgtiiAhES PzYsYYSoEZQ4OfMJWD2ngKbE/9Zd7CA2s4C6xJ95l5ghbHmJ7W/nME9g5J+FpGUWkrJZSMoW MDKvYhTLzcwpzk3PLDA01CtOzEvJLM7WS87P3cQIDkfOyB2MTyeaH2Jk4uCUamDULBHn406a prH2freWFfc7Tv7VzEeVhFfdns+SxG67wCrjcXZ4ZMsdVgmP98o88oLFm3fOvR3Leyr9fMte t6sbJ1zR+ha0Tkr40YaYi3vW2RsmHfvwknvt8tdfb8py3ZnX0iaVuP45n+WcqleN9SEyC36U XhKcmx359+ekGRf/T530Rlu8nfWXEktxRqKhFnNRcSIAB0+9GfcBAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD020; 1:+BA9hZfKD3YFos6k+1f9po+d5EjOxUTbOMUhajr9eOjiORIpr0eM8NyOo4qzhafjnvXSN51cRJUcodrEcsxoAduQoJpvSiJSfh9yZBdSHQ1rnThSJ9foIjY1IHhyHjno0rx8qP+u9sx2ggIKzJp2+3I7clqX2nNBaUWWSSEWjU23w2CWQ+qwuN7aF5KES7jiMeeCi2mVshbMeHjAkG9Y+AGUPFNLtSnCr9EregaZB26+ludNBjwnKeY3d4TWy8vc2jWv8vGfZhjOoRrF0CD1/W+5XoknLXAFW5jc2nHK2sAgxMjaXAZWPgzNNezI8O1Pm4gYkjllCkNKep2e8JLW9DjzWnsK2Z0+u3lhgOeJJVe+VYtcN1o9YHD7ObQIoZXX X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(4001350100001)(4326007)(87936001)(64126003)(189998001)(65806001)(33656002)(59896002)(11100500001)(230700001)(50466002)(81156007)(97736004)(110136002)(229853001)(77096005)(65956001)(47776003)(83506001)(5008740100001)(5001960100002)(586003)(50986999)(76176999)(1220700001)(54356999)(1096002)(92566002)(69596002)(106466001)(65816999)(36756003)(80316001)(86362001)(23676002)(19580405001)(2950100001)(19580395003)(87266999); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB300; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB300; 2:cy8xjZbcqBSnIkOLz2EkouS8weuEM2B6sp3n7oWEuaxgCjGHqshORMFfAwGp81EKy7VMABmerbaPIPKqw57Lbz8DKzfr/p3R5eYFREZUtGjHH0lRf/mFEr2mcSQhW3VjxsjAv5ySTK14/8e6Je0G0A==; 3:xFfnoFJ+mNIddVQwZigcp8yIs0Gw0+nCuNz6/elWwnHtesgKZvSWQquZDz1t0gQ6y/hRwL1hmAofSeTDJWXxlH35qQ+HpJkOA1VQtBI2Fp2OmwQC/bbqLyVkLI/C8o2sZ29NEq6y3DtvgoidtrmrsURpuFvL/tasvs+oqJ6jtTBkROv37Ulu/D3KWNyMptL7CydsQH70p+iNBeaGS3oZj2U+OH0HCAi8ELc67ebBbW7zECLs/1akl2yXH3E4rrIL4WXbgecDI1R8/lVxXyVdXA==; 25:7S3/KfsotoSLK9SGVNMSBBdtHzgigmsUV+PBhKRqe2t+QngTVFhD2302iQ8RFAptVINGf9OiDDqwP8qjHeSlHjAbdqp68ycPI/7Blnvz8jyihdtXwUTiNCqZYBEf1Mp+Wl9UOj81H8XTN8sZCL+CcIiiQH/4pKxr6H3RXf0W9kZtwkyL+J/IReNj0B5Bh0RiX6sjeOEjtxfNzRKF3CK0Z1dIAPgAwdqx01qK+v78xbolTbqIaNyjiapZ4l26pNGMTQp4YMujahetyOmicxUPlQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BY2PR02MB300; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB300; 20:hsCMh9lUDWcPJGuM+DzfJF2vE17o8ANIGJ7EjUyKc8uBd4+QhuNU44SDWFdK8LkeWkorE6DXo/BYZuQdQamx1/pjJoRdreZ5RvtNJFIujtYTxiocPFyri/yp7hYYINqPH0NFmXz29CZHZYpTEsRjwgP1VORobP1t0k8XEYW7WTWk8n32Au2WxFzPkCpXgZD22yJwiTfAG23zE3sPkwEJkCo+ZzyNdHjWFXFmCnLVKl45uUANVhWgldmxU7NjsWVzjM6SEFr8hKiEqP+l1Q7i0f0Qvd9LF6YCTu+LLzY8F3Lughu8j0wkorBJaUR+SI4RnegE/kYewaFRf2iWH0yq2HLdK/urZJr5c8UDjOYVd2puqfV1b7StEKPk06BR7LFsoc9xfg5yyOMGGGYA5ozG6fnf2gKE+7XbHBOPvrCYhxZFB5Y/FI7sHFObDMZ5msK3mOFGdGwibetuxn/O6HA6TQxY4yr0MXy1+qwfSSf3PfDj/ZKvT8Z0e8y+ZeDqxsT9; 4:bGxzvyeMK+Y6bh3+6GHMWJ6FDYftxSUMIwEGQOtj9/lpJNH6v3xjdsl0QhWAM3XfOHIvs8u4RrxaPDkiuCW8pvu3zfFnzJLgku2TRxqr5LetCxgYjPQJBXyvc2jUwegp/Ll5lj2RZikHMbFvklxS262Vw2ufMOEXQYwZw5eNO3muKXoNCBsP8gHBZdD9CexgfjUKaaFUf+Q2uB0D6MuTNESIc6k60Y0ORS14GDex3a5eolN5B0zEa+g/4QfNUPjiw2f0FGP5KRGNgQByNah43pQYmn6yr1p1dlJusRIcD5WrKYoV377ICCpB6T62Y6qm2CyxS6cBjFNyqVA9aZyOyTj5DIkzJ2TjtUMBGLJZ+eJoKen7Tu9w2b/YMvdQp2KjSMQMVit6l7nCHUcZulvXURMg2btzqEduf14j6p3 DWzxi/5xOha4EHJknBUYHx2Tr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:BY2PR02MB300; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB300; X-Forefront-PRVS: 0812095267 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjAyTUIzMDA7MjM6SS8rVnFLdk9qNUZTVHVpRG05aWNYRWd4V29W?= =?utf-8?B?YlJ2RzdOUzc4T2xkUTFrZWRlL21BV1c3eXUydnovVHphekQ3RERDRnV6eXZ1?= =?utf-8?B?blN4NVFzaWlZWEt1OGFwak1kS0psV0RxYjJ2YWt2cUNyTTR2ei9JVENIazAx?= =?utf-8?B?dlV4S1I5Wml6MkV6SHpMdVp2YkQzMENTMlUybFlxOXBZNUJYeEhtaE5reVNU?= =?utf-8?B?Wnk0cktZR1dkUUJqTTU0bWVCbEJGYmxTMFEzTkFFMFdnbCtTT3lKZXlSd2JH?= =?utf-8?B?R2JIK0Nrc29CbGVTZUh5dGRObDRTWktOMyswRWJ2OG4wMHZBQ2F1MGNPSHFq?= =?utf-8?B?MEpiRUQyNkRuQVA3REtobEdKS0hiWHY4VkZKYnhQa1BWY0dHZmdZMks5RFpH?= =?utf-8?B?dUxSaFdyTmFpNDVhZCtKTkVKWXhFUHBBc3lxbUl3VFkxRUFiU2NYaXVnd2dq?= =?utf-8?B?eFFaenNWcGRpclRnTFBlSG5DelVDMllGbWRicFNXS1BBRy9TdlFJRTVReFJl?= =?utf-8?B?ZUVDUEV6cGNJbVRZakN0TjFGT1h2M1BtU1VUanRYdGtSYy9WVkpGZzZiY0l4?= =?utf-8?B?Wit4RzF1V2lUeXFkWGl3Nys0a2ZHajBjdFdyVDcrYzdONTZBSzBCWWtIMndu?= =?utf-8?B?eXlVekt2d2N5NnAxSGNZUmNBOXVBVkI4S3pUeVJvQXF3elJvZFJCVWFXMFRE?= =?utf-8?B?ZnI3VVQzMUpLSTdETS90amgrWHYzS2lJdWYrYTVnTkh5ZXhFdTBQL0RKeDVO?= =?utf-8?B?TW9Bc1lDK0FObzZ0Y1FhVjQvNmFrWDRnL3NtZkdTYzJid2RSalM1eTJFQlRP?= =?utf-8?B?UFdoUTBURmRHYXVGOXNWcUtoTk1Xak9MTlArM1VhL0JWQU1GaVduYU1PVFNO?= =?utf-8?B?QWt1dEZsdHhXZUNUenRsV1BkT2pIQ3EyY29UUHU5SHU2S2RWcFFIT2MxeitO?= =?utf-8?B?a3hLYTJydTZhVUZYQ1VadlZ5VUdhRERpZ0tZYlZZTFNaTkpvRUdFUTkvOXph?= =?utf-8?B?NlZwVTAvR3VaRXJ2d3lXTXh3a0FTRU9XTFhMa3l2V29tdmtNZVdRdGxSQmJY?= =?utf-8?B?ZzBZOHFNTWZyeG56Njl4MEM2bWhoNVZPOUtEaGtmUjlqLzRWWXdvS1JoUk5X?= =?utf-8?B?WFZZYm1FdGRZbWR3VWN0YkZQa1loaHhhcHhhaFNvZEc4MkdNbExxNXUzMDNE?= =?utf-8?B?VnVwdkRubFBaN3ZDWStjSDNWdENnQzZtMS94eWhDT2pYVUlRYUhtY1BTcEVt?= =?utf-8?B?RjBVeGhWNmlnQzNJaVhRTThudGM0RzhOSE9LQnhhYWh4YmI3b0I1ejR3MVZS?= =?utf-8?B?TW9pbG12ZzdSUHI3VFhPRGpnL2QwQSt4NHhndDNEblJqNktxZnFkTXhYdWVo?= =?utf-8?B?blNwbXExSGJTT0ZDQUFrT0tXR0JvNTdld0hFM21SUnJ6U2VqZkZ2bTJpNjBq?= =?utf-8?B?Q0VqbktTSmw3TklHc1BiV3ROeG5USDFNMkNiS3crYlFwZjB4REVNVGlnV0JB?= =?utf-8?Q?ezSeYHDUZ1nuL8/8zqg50ytammE3KelFFVeO/e9OZlZ1H?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB300; 5:OdPsai8lW6pl1MIs9HM2XdXk9A3sHYZrXlWFd8/CtyZ0eEZwUa4AvRa4EdQ7MEhSzCiwEEwOw7qpjlRZ5L7HozZm5eYjEuxiHy/VHy6Oqfgqwvoc2z7GX06S2YnFDRp+sguTCSjn2pRoRaRw2UyvGA==; 24:Ikg7LzmnB6Dgw5aVlbb6AylOr/SXoB9aiRn0PhAkWF84IGN0IPcMtH++w5GJtV8l9bZVNZCXfhmu2ysOXUSt4r2bU/EyeQ72ZNMTAQIY3fg=; 20:EUZndx9LPIYYBjJC+GiIgV2fI2yNKbq6zF5fh0Al7PGUV/Ffq97GphnQKFeht2e6T0/kS35zPgiIy7XRphynivGmLWSxQvMCb7nHI4T7KUOFvG4HAKnMJqWaPBjo6+prslVtyrdXuL9i/dfNrCTcSkFcaDJUVVJbw3+c6z9xMwDmkBT9ijVMxu8YwUr2VoBjVL15PKgBfQGTE9DEe5MDjGwfkQi2mgtHTUtCJEyYVvEETlaHh6VHJR3n4mA2d9lr SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:22:49.4496 (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.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB300 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 Just like other target drivers, use scsilun_to_int() to unpack SCSI LUN numbers. This patch only changes the behavior of ib_srpt for LUN numbers >= 16384. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 92 +++-------------------------------- 1 file changed, 6 insertions(+), 86 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index fd94780..fc19203 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1488,80 +1488,6 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch, return resp_len; } -#define NO_SUCH_LUN ((uint64_t)-1LL) - -/* - * SCSI LUN addressing method. See also SAM-2 and the section about - * eight byte LUNs. - */ -enum scsi_lun_addr_method { - SCSI_LUN_ADDR_METHOD_PERIPHERAL = 0, - SCSI_LUN_ADDR_METHOD_FLAT = 1, - SCSI_LUN_ADDR_METHOD_LUN = 2, - SCSI_LUN_ADDR_METHOD_EXTENDED_LUN = 3, -}; - -/* - * srpt_unpack_lun() - Convert from network LUN to linear LUN. - * - * Convert an 2-byte, 4-byte, 6-byte or 8-byte LUN structure in network byte - * order (big endian) to a linear LUN. Supports three LUN addressing methods: - * peripheral, flat and logical unit. See also SAM-2, section 4.9.4 (page 40). - */ -static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) -{ - uint64_t res = NO_SUCH_LUN; - int addressing_method; - - if (unlikely(len < 2)) { - pr_err("Illegal LUN length %d, expected 2 bytes or more\n", - len); - goto out; - } - - switch (len) { - case 8: - if ((*((__be64 *)lun) & - cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) - goto out_err; - break; - case 4: - if (*((__be16 *)&lun[2]) != 0) - goto out_err; - break; - case 6: - if (*((__be32 *)&lun[2]) != 0) - goto out_err; - break; - case 2: - break; - default: - goto out_err; - } - - addressing_method = (*lun) >> 6; /* highest two bits of byte 0 */ - switch (addressing_method) { - case SCSI_LUN_ADDR_METHOD_PERIPHERAL: - case SCSI_LUN_ADDR_METHOD_FLAT: - case SCSI_LUN_ADDR_METHOD_LUN: - res = *(lun + 1) | (((*lun) & 0x3f) << 8); - break; - - case SCSI_LUN_ADDR_METHOD_EXTENDED_LUN: - default: - pr_err("Unimplemented LUN addressing method %u\n", - addressing_method); - break; - } - -out: - return res; - -out_err: - pr_err("Support for multi-level LUNs has not yet been implemented\n"); - goto out; -} - static int srpt_check_stop_free(struct se_cmd *cmd) { struct srpt_send_ioctx *ioctx = container_of(cmd, @@ -1579,7 +1505,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, { struct se_cmd *cmd; struct srp_cmd *srp_cmd; - uint64_t unpacked_lun; u64 data_len; enum dma_data_direction dir; sense_reason_t ret; @@ -1614,11 +1539,10 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, goto send_sense; } - unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_cmd->lun, - sizeof(srp_cmd->lun)); rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb, - &send_ioctx->sense_data[0], unpacked_lun, data_len, - TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); + &send_ioctx->sense_data[0], + scsilun_to_int(&srp_cmd->lun), data_len, + TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); if (rc != 0) { ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; goto send_sense; @@ -1704,7 +1628,6 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, struct srp_tsk_mgmt *srp_tsk; struct se_cmd *cmd; struct se_session *sess = ch->sess; - uint64_t unpacked_lun; uint32_t tag = 0; int tcm_tmr; int rc; @@ -1726,9 +1649,6 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; goto fail; } - unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun, - sizeof(srp_tsk->lun)); - if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) { rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag); if (rc < 0) { @@ -1738,9 +1658,9 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, } tag = srp_tsk->task_tag; } - rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun, - srp_tsk, tcm_tmr, GFP_KERNEL, tag, - TARGET_SCF_ACK_KREF); + rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, + scsilun_to_int(&srp_tsk->lun), srp_tsk, tcm_tmr, + GFP_KERNEL, tag, TARGET_SCF_ACK_KREF); if (rc != 0) { send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; goto fail;