From patchwork Fri Jan 29 23:13:06 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: 8168551 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 648499F96D for ; Fri, 29 Jan 2016 23:14:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5690B2039C for ; Fri, 29 Jan 2016 23:14:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39F5220398 for ; Fri, 29 Jan 2016 23:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753615AbcA2XOF (ORCPT ); Fri, 29 Jan 2016 18:14:05 -0500 Received: from mail-bn1on0077.outbound.protection.outlook.com ([157.56.110.77]:1408 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753469AbcA2XOD (ORCPT ); Fri, 29 Jan 2016 18:14:03 -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=ESmkFsrwgl+WAhEm2AgwhcqHQtXm3fVMLOHkqroo9PQ=; b=APNlHF1tZ5xPowJp7CF+eJZdtAGuyfxjsOuEzJ8R/L+AoR0hps956KpSfifHsDSdn7UPxuaiqDSHwKrwguGgJy8VynfpjFi9+ogzNRyMIO+O4zSi7SCIdBzrWC6TnaKWdNo+ES2HBTAFwy+6TWTczFqCIm+LOi3hw7RRF45dtn0= Received: from BLUPR02CA033.namprd02.prod.outlook.com (10.160.23.151) by BL2PR02MB291.namprd02.prod.outlook.com (10.141.90.148) with Microsoft SMTP Server (TLS) id 15.1.390.13; Fri, 29 Jan 2016 23:14:01 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:168) by BLUPR02CA033.outlook.office365.com (2a01:111:e400:8ad::23) with Microsoft SMTP Server (TLS) id 15.1.396.15 via Frontend Transport; Fri, 29 Jan 2016 23:14:01 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; 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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 23:14:00 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 8A.20.29304.832FBA65; Fri, 29 Jan 2016 15:14:00 -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; Fri, 29 Jan 2016 15:13:06 -0800 X-AuditID: ac160a68-f4bff70000007278-f3-56abf238c2e3 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 4E.47.02700.202FBA65; Fri, 29 Jan 2016 15:13:06 -0800 (PST) Subject: [PATCH v2 06/22] IB/srpt: Use scsilun_to_int() To: Doug Ledford References: <56ABF16E.7070006@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56ABF202.8010003@sandisk.com> Date: Fri, 29 Jan 2016 15:13:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56ABF16E.7070006@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnka7Fp9VhBjemSVtcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CV0fe7i7Xgi0rFki2b2BsYD8l2MXJySAiYSJxv/cnWxcjFISSwiVFi+4Y3UM4ORokv 35+xwVRduXmBBSIxh1Hifc8ssISwgLnEz8U7mEFsEQE1iU2vFrGD2EICWhLnLnxhB2lgFljF KLHp6nWwBJuAkcS39zNZQGxeoKKvf48BDeLgYBFQleh8mgMSFhWIkDjc2cUOUSIocXLmE7By TgFtiSWzQY7gAJqpKbF+lz5ImFlAXmL72znMIKskBPayStyYOI8R4gZ1iZNL5jNNYBSehWTU LIT2WUjaFzAyr2IUy83MKc5NTy0wNNQrTsxLySzO1kvOz93ECI4OrowdjFsnmR9iFOBgVOLh 9Vi2OkyINbGsuDL3EKMEB7OSCG/dC6AQb0piZVVqUX58UWlOavEhRmkOFiVxXusWtTAhgfTE ktTs1NSC1CKYLBMHp1QDo9PuvA6LvnvK1zh5Vx1dfXlq1qsn1tprHAyaTJlrY2Ju+eVWaJsa r7xit9rR/pSAmGEu/6533Fvs6p1UnOts3mikpT4+v3Al38JM1mkzpaqNZ914u82nWXa+c/46 7evb0+xc52zf6/Rp43TFv8aO5a8N2A5wyl/RK3nZrvJ9hVSs6AXtjvvGSizFGYmGWsxFxYkA BGhgv4oCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRZfp0+owg7e/hS0uPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4Nv0wk8f7fVfZPD5vkgtgjeKySUnNySxL LdK3S+DK6PvdxVrwRaViyZZN7A2Mh2S7GDk5JARMJK7cvMDSxcjFISQwi1Hi7qw2dpCEsIC5 xM/FO5hBbBEBNYlNrxaBxYUEtCTOXfjCDtLALLCKUeL3yg9sIAk2ASOJb+9nsoDYvEBFX/8e A4pzcLAIqEp0Ps0BCYsKREgc7uxihygRlDg58wlYOaeAtsSS2RfAbGYBdYk/8y4xQ9jyEtvf zmGewMg3C0nLLCRls5CULWBkXsUolpuZU5ybnllgaKhXnJiXklmcrZecn7uJERyinJE7GJ9O ND/EyMTBKdXA2L03z7VNT+hKyYXYHXKCFRNXZz5dK3xCeF51irLekn1aX20Zfy6qC7JZnfgz dsohm3TGMJ7J1/RvtrDeq3R+fk2iK5WdpVHs2vOuQ7J1cRl6e+eovapcJhGpalR0YG6W+TcO Bha+N68vlqW5HejzVXh1N1rSlv+nV0nn03X3fkzyZ3UyqLdRYinOSDTUYi4qTgQAGThwTgEC AAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:r7cpm2nR+aMVXxio9JCmEDCHgvxmxDx/698LOONh+qHGFlBVB2He9h4DSJA6iWjpGWGUrAQuNjYVw4hBn6ofzG5Fs22nZEHYeMQnmVh7f5IaM592vbcefmzQxznjH0LQmf/RThTBBmMcyqUzCNUbpQIKuMSCRJ6IQo499Wbc6TW0VB2yU32R1Mw/Byd45bLEu+syYbFbe+gBsKwTAH5UU3vGILE6kXMTCTtHIOuG4qXAU2gaDM0rJbfkPZGltK/kjJM4QcfTtZneWUBFzi8N/AEitva1ZhbDDCL6ISFO+/fOD0PbbhycrdbzQJpEAZ2/wT27ifJMhjdgQsX+szqKJ7jaluIrFxvVEljQHUAJpUPpMqOQuCSFOtnnS4jmkMfy/Fws/yRtacT8Mw4+TTpHsshTGZd06GEQ9ac+L1TWrcR3RmbriO/w/3TI/KQH1xJ6 X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(5001960100002)(86362001)(110136002)(1220700001)(1096002)(5008740100001)(230700001)(2950100001)(19580405001)(77096005)(229853001)(65816999)(47776003)(65806001)(50986999)(87266999)(76176999)(54356999)(586003)(106466001)(189998001)(65956001)(33656002)(4326007)(23676002)(50466002)(80316001)(4001350100001)(87936001)(92566002)(2906002)(83506001)(11100500001)(36756003)(64126003)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB291; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 2:o4BgtVp9NAkHsvCqfWVF1EmHgk1V01qNlKIIJoRftDpuhKmdCL6jzJvct37h5vDai2gxC2N5ZXIlQBgUE4R2gKGV9G1wTG9IJ1pJ0Xr5XweDy+NCP4GipGsGISHjj5FO845y2SE1EaSoZZzfR4x/hg==; 3:eYDGMPKsRNQYh0F4tmAnzx804IGqfxqroRrtOYn8LxYh3xA+T++63CXTzQBRJ3z/T9ews22TI90wWKlRUyMxPprqX4nN7HM2248de+5Ha9fmd+9549iZgzPlIWgUkP8HIbqs4SkNcy/mqN2SbPU69k+jRFmLY5wp9H/rDvxhaTXS5Wb+q05fFVKNz6yatF9cw2h11FvW4nnkLsLyqvl78G45NJnE9XVIl23mfRFvQN2xTIlSMH9ySX7b2BOO4xpJ+9VxIEwIcItPSfWYV7XtNA==; 25:vJ8fO+oTClyYlbNENmF7qHP62kCP2RzCm9dRT7u6ZadCp3IzFWrvqftw5FJeFLeHqIatfKor2h62tfAlm5pLiwlGyRYg1jta5JiVBB0uNygDwoXSTXErkagqc8UjeripvMJCJx5+bvvT/qIijCUWB3pO1DhA22GzWXD3CiajmmkuGNT9ZMWhkXVL6SYXGRNBaPQGb0DDDJTmoqHYaljtOAeh/gGPFAJwP0utnnJzkW5vHcmL5d2TnBs8TgUIC9SH X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB291; X-MS-Office365-Filtering-Correlation-Id: 6f355b36-fc32-4d4b-c093-08d32901dfa1 X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 20:SFFr6K0ZFZGThoJQXW0V6EPexO/lScENTR2ehd/RDRrjZRMEG4pp4JiZixsNDwCGUiEw7mjOlCMBvvugtMK82qbwaQw1MlOOgBsNWDb8a6A94mV3MEdhdSKVk4+/Z2eZ5uNRX3Xz+y+4F2EHP6PvU5nfAvyhvthh5SwnWT+sjOClRlBAzt4mr8Yupo3G6PL8CjoveGiUe74N303R/malDvmFOMX+sadOrCyjbV+ZroW/UVVtvZ6IUZJIT1J6syvFybKso3eh28gd61cOWWzXW+IWYMLIeWxa4mGwk66X1E55vorEAsmJxrGeaB/Ap6ICdS77w2Ff+FP/CGdxqaAayxnXIQOHr5PUFLpB0nSRbtVLEXI18c9LTwg9ERlNgIba9o1yIXXNN1SirO6lrjINMA+rJQejkYISTpvoG85xn2xG4gHshs/G+KayhhDcUVxZAEbiFN6yrJ7OhA4tjTXO3jy3MSHj2UWN/RLPtfjDPp2KSEhmCLIWyKMUi8/oy6Jj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13015025)(8121501046)(13017025)(13018025)(5005006)(13024025)(10201501046)(3002001); SRVR:BL2PR02MB291; BCL:0; PCL:0; RULEID:; SRVR:BL2PR02MB291; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 4:bssmdETQoJnqQCuFsqpMIfc7JlMeC5pVxfj+2GVhD2I+pvCVbydl/CCBKf2HlSP2A7ERGNStMAIapOjwK05jMfy4wcg2sknrF0UIjJ2zAH93ivpv5KsD05IDXDTyRBx77l+9JnohDV1L5eGar5LanFwLRPTgjCK5FT3sAGKDFQZ/sBlA0t4YEcQ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NDVlT1Z2dllpcjBn?= =?utf-8?Q?pWrsKtjaNorRsZpXedeqBdPNN9?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 5:RNoOw5R8dQiBzeUiTZlYhOnQfi3T8g2Cxy+bLzeotg8XOYFx7LsIyFwSeW/LzLtOsEs1iav+jFltxZTbB0HTn8NxSLWu407QLP/94UIrsXM1JuWHh4rGkFwENqdukYjLArvcaFC0CEjRYXrP2U6IAA==; 24:XsDpfj6LaVOBtj9GeE5TtUyjl2lzILEQzROjKzgInLTDMrW9BraIs++ZwlvvT8L3GZCYeUtV6DA+/PQ+NgiIbO9pHNr4UFaIFUmTAlLp6Ac=; 20:pyAxu5GoDUQ2yBjkWHkTFA77xAMHPxkFuy9GFPUDRAdjgC0Uzsg0ZTyyG8lo0dAINN04cLoIaGZxVr+QpW8NxC5SEpUEssvLXQ70TO64L7nNgqfRgkAmbTq73Eqh/u8hltLfTWxRL//GCgk6lh3vU4cRu3GT9HERqHpW6meU1bgaMN6g8xEI/qBc40UHWJEQF0DI+qSKditKJ314VKuhPe50uKTMuOaUnL1DRwssY79dQNenA5kq5Bzaoe3R5VP4 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 23:14:00.7537 (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: BL2PR02MB291 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 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 1fb8bb6..b38372b 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1494,80 +1494,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, @@ -1585,7 +1511,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; @@ -1620,11 +1545,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; @@ -1710,7 +1634,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; @@ -1732,9 +1655,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) { @@ -1744,9 +1664,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;