From patchwork Tue May 1 16:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10374151 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 8F7966053D for ; Tue, 1 May 2018 16:02:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FD0E28426 for ; Tue, 1 May 2018 16:02:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 749B928992; Tue, 1 May 2018 16:02:15 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 0A1DF28426 for ; Tue, 1 May 2018 16:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018AbeEAQCO (ORCPT ); Tue, 1 May 2018 12:02:14 -0400 Received: from mail-bl2nam02on0067.outbound.protection.outlook.com ([104.47.38.67]:18902 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755990AbeEAQCJ (ORCPT ); Tue, 1 May 2018 12:02:09 -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=QLJxDsPN9w/4hkjla0JG40kP7oDaL+u0owFC5F6+z8w=; b=eA0IvBwTJLs3c7SCjajDHitoKgfpEAJwjNOaDXAZRcL3+tfWY+GFVXkchpqbJjvSm4LlM0mEfPuvsh3/MKth0NN/QPoxxbkiyPIWzJiPpfeTu0u1beoy7NIfh5lPdY1ChqG7PCuSBiTTi4mLXaNUMWmBKgR9BrL76gSrL3iZTyI= Received: from DM5PR07CA0081.namprd07.prod.outlook.com (2603:10b6:4:ad::46) by BN6PR07MB3169.namprd07.prod.outlook.com (2603:10b6:404:a6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Tue, 1 May 2018 16:02:05 +0000 Received: from BY2FFO11FD008.protection.gbl (2a01:111:f400:7c0c::188) by DM5PR07CA0081.outlook.office365.com (2603:10b6:4:ad::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.715.18 via Frontend Transport; Tue, 1 May 2018 16:02:04 +0000 Authentication-Results: spf=pass (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=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 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 BY2FFO11FD008.mail.protection.outlook.com (10.1.14.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.696.11 via Frontend Transport; Tue, 1 May 2018 16:02:04 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Tue, 1 May 2018 09:02:00 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id w41G1uc6027982; Tue, 1 May 2018 09:01:56 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w41G1uM4027981; Tue, 1 May 2018 09:01:56 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 08/12] qla2xxx: Use predefined get_datalen_for_atio() inline function Date: Tue, 1 May 2018 09:01:50 -0700 Message-ID: <20180501160154.27915-9-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180501160154.27915-1-himanshu.madhani@cavium.com> References: <20180501160154.27915-1-himanshu.madhani@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)(39380400002)(39850400004)(376002)(396003)(346002)(2980300002)(438002)(189003)(199004)(1076002)(356003)(2906002)(305945005)(86362001)(50466002)(26005)(6666003)(51416003)(69596002)(106466001)(80596001)(76176011)(50226002)(48376002)(72206003)(4326008)(5660300001)(59450400001)(8936002)(87636003)(8676002)(81166006)(81156014)(478600001)(316002)(11346002)(36756003)(476003)(336012)(110136005)(2616005)(44832011)(446003)(16586007)(486006)(186003)(42186006)(47776003)(106002)(54906003)(126002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3169; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD008; 1:AsguO0EVpgn8auhnMz5EJ0Sbrr21qdUpNadYFlQMgwPMgY0arFgQCoXupPk2DfPDt0TCvlCQkTKDzIBKLiubhIqHruWM8TodHv0WtcL7ojfPho7pkUYDu9UCzVqpidmZ X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:BN6PR07MB3169; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3169; 3:lNZEckRffpDfpafaZdJSQgQPu1w0DsJ0JkQNNTIYOpgnqn6zXQXVum4UV6GulrYpW3vK0BoGuThLmWoshQyJynkMhYWX0x84c+Wae+eNXxPjsd1opincRLHcjEIvMLajcHxWiStCmOpvf2Fk7QzhUi44wXJnJPZOGeFAzCErI4gCis9KfQtPXHWm+SY/a81FPS6facsLCAx7W17b25aSQeme+MaZU1BDftvW01pPVH2PhQx7swEiduCjt00PXhmMZ40F6f2qazwL12G7AE/HdddGgS5LWJDBEg9zg0Q5UmmI89NbBANPmRdSHuqpDfLwzjqrXJ12keg9sQB+VBZ6lQ==; 25:z/KmXgTdcNNX5fGMz+0+o7eMspwf/vak4M2N1KdxdixilHXOKgSvL2EebJfd/URss8JlhK38dadIEPCkPZOleXVMEeHLy/qhBkSbBEKGBGGdAq41jGBn1VqDDHxPz/gjhqXefSL5cdMKGcGFj4B2NqZc8OcNegCY0NEVW1JhMiPc7+JL/M/PUG3hMOV+z88TFYggHYZ2ivrno/mIENcaoG8RAV818fmcNVjuo2j/YjQ0uJlUIYf/ibTG0TsRxp6ESuVS9iVVDxTyH7ofK7Tdpoyy9f87ENK6Y3fjENrj2dKo0w3hUvjArGH/PcDEMU1qjoOCV2TeC1vB1BEKRAdD5Q==; 31:L3l9RkN8a/d/TEPyyep5cDPMGf6Tsftk05XMwjmMxhKYU0OgF6J1nyFParusdRvfxNZ/uWpKgphvU5fUzfRgYoQJZdaI2XbQjPXrtuOzhjrG1lF/DjUXO/m7AcRV9UeAOeDj1llKTyHIG3i4VjGTWZ/Ef05Z9kPHW3BGNf7xXNGpkzMOlBXYDtOr08qjAqJW278rN68J1SKX+823GhgPK1bnYcWCzEpOAHOz0dy8SFk= X-MS-TrafficTypeDiagnostic: BN6PR07MB3169: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3169; 20:Ur3O+JGq0l4l+6aV/eTbYrVmJg7dtTN0qI29/rVo5/ZyQPgMap0F+aXkAu9MyZemjDNwhJYyGNEYv9dutMfPqUBCXGOPj2u1488oMQLiaIsv++f+7nRuIW711dtR8KJQJP0tZSD+m8dsNoCZTZ/+v641UH6LRm2ENa6SBbMEpReifcYSSnibBtPcYgJ8lN9qillbtFvxb2mtQmHWP42iRRMGL7aOeMh2LR5Vb8+IHEALJHTEpICrem/UV6gNCw3be2hkB36fsU1H/9X7rqwaWCmHC4ZrTww4kEz5j7Gy9RH6ev0JL2lQpQZjTBxlLz1/P/hPWedwgpEDG2zdjBvmGAtKi5MTy+5UnfzIenE7R/RBkBHc4Ef5hCMqvaxLfT4iiPgy1xDkfZAlE7Bae1YtfsVXhNwVlMWPa7FZG56UbWxkdgFe5kSLnj9xtlBo9MJ65Ziu2uSCvI1ESZZar/eyeeP0R3qM26TAX2ZEFk8Rj9HJ+xUgQrU6bl5BuhMgs8W3; 4:FvF4pmynio6f2pV0pqlYaYj58FgtyS8yXr3p9fMnxQZORhDIIzCN/avfM0s24Tt6HYHHqwKMOwFEcVGIts2Z4dsd3rnr8REX2ji/UhYnslnQCDCe6oDNsYPPmYau1Btcln4Pz66wvLjrBk0GvuGS5URbS1dzVYgaMNAC1En78W4NV+SEVTR36Kplj50MmbL0aeHPZon/CYt4LGv3AGK6UlW369MMRnjKTX1NfR1MSA8fYk85gJxFO+RNiSnJmQOfm1UgIASglRpI7fzndrKuZA== 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)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93004095)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:BN6PR07MB3169; BCL:0; PCL:0; RULEID:; SRVR:BN6PR07M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PdFTTSWDghb?= =?us-ascii?Q?Tbq/RKTkZzJAweF8xhx387x6vQu0JIPhVVDjKfOIo0cWwnDCgY1GytNcO7gi?= =?us-ascii?Q?bSEsrEfPvGI2a7i0Vz0MIpXHzedRrRUPeYr3GdHBya6XSl7Vo6na/uf2OPrV?= =?us-ascii?Q?sld5XXWSTJ93q6w7cACIo5SQDAOOzY+XEc+Hz2EWbB7QZjEysLDulQc+H+3R?= =?us-ascii?Q?pf8T2zcXqo6QzS7E5zvs/4ssJh/7gz4e1QntRXPc6Obq9zYylJtnaFzmi6BO?= =?us-ascii?Q?iNLpx6agBhwrZYwQsqRTwstUoJsr4x3JuTR1mOVq69/5hojfdDeP3NEApP8+?= =?us-ascii?Q?eC2U57kDM7Oe6OE3shk8dcDpQFj0SCg?= X-Microsoft-Antispam-Message-Info: esDYQUVsDquLcAU/jDqUfxSOaJa4HlfjmuKoKJPqI+zmC0T1DcTKmk1rASHmpoMuAdES2jwW6jgfFSIanpz6fkPSggfKB26ZrXMwpApn0oFiW/sQgqPpH0+dEqxYUoXOTKgSr77CO1T1heRS/lhvB8+1ZY1BfsBLZDR5MUd1IH1qkTZA/sQOQQ5Qr40hHgE6 X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3169; 6:AfeAlpm5bL87HJl04a3N9XG0UE0/V1Sy68mbaaWKudr7GL4omYCfmdZ8B0JS9nnVF5O7cFgZc7fmwZscWycRtnkVErYkJjCuExr8SQPxH91GiiO8LawaR2qtY2DzpSdAZJVTHPORhK0nSdRYH9baNJv77bj0Qb8PXConujUves5PnouuhJ88s3wIcMk+8H37BXaGOfzLNeFopepQahVRn/pWnOtszJ9V+GvD5E/cGJKqtCxnqPgACIw4zXVgGzs49PCs4b7emMGhthe+YCKh1vYlBzq1DJDlYh1dP9/2cG41oHJZwkxTD+8WG4u7ng2+k1Xi519ZtiMyiEUoJ//wT0vqvImcJ0lNM4osKGKonEygVx2zJguYWRdYZdSZyDdSGUqG9D9hr//M3D88IetPkUphQVJ2eypHMfKat03LXlemYhNoYu3caGUEUUEizhRoXljyD6UbX5ssTQoNYF6omg==; 5:nmX1DBds7fNWkEcX0McPPTfdaA5jFhADx4iM+tfU8H+OBsl14AUzpUsJ0R/7D/CzRc7tWcPM6rMiWFXX61K+QOkoqp0gvImO5Z0i2uknwRTAz9I3oszPWemMgCK2+bgczOyxZunmcJ/hIMTyNXf+9D/bIjQ00Qfw1cptu9gMbKo=; 24:gQ63thspQAJ7bo0tW2PNuXghmOrRFQ579ghonDtd/i1rYTuuhLd5PxnUmxA3Qn5ch9vVRmD5BkWwq7/86yX6YLS0bvBgXJPmyfrKFqClTF8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3169; 7:lw3Vxr9iSibZX/ory8q+jPacvPcYuIe0Nm7MOaLPzjFxg9h3v8aiD4/HwK9AgbvVwGBwCRDnukLpTNwH1Ohw1DT2lcpKMJNaINg2llW+npraqFEXKD8UNOsZ9Gr0R28/UApjWO9nS2bNngiI85OOQ7Te6LDY6NzOfwqFxi06hFMeB5RJyUudqn04u0vL+3TpwxLGFAidiqaOm7hxsS9y0j0lDDgIvP0pvEKPWIKU8hdSzZXBRq5LDTE4HiQ0pT1m X-MS-Office365-Filtering-Correlation-Id: fcc53768-1290-4d59-fe5b-08d5af7ce22d X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2018 16:02:04.6079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcc53768-1290-4d59-fe5b-08d5af7ce22d 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: BN6PR07MB3169 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran o Uses predefine inline function to access add_cdb_len field in ATIO. o Return SS_RESIDUAL_UNDER status when sending BUSY Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 5e81b64c8ef5..a77703f655ed 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3550,13 +3550,6 @@ static int __qlt_send_term_exchange(struct qla_qpair *qpair, temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); ctio24->u.status1.ox_id = cpu_to_le16(temp); - /* Most likely, it isn't needed */ - ctio24->u.status1.residual = get_unaligned((uint32_t *) - &atio->u.isp24.fcp_cmnd.add_cdb[ - atio->u.isp24.fcp_cmnd.add_cdb_len]); - if (ctio24->u.status1.residual != 0) - ctio24->u.status1.scsi_status |= SS_RESIDUAL_UNDER; - /* Memory Barrier */ wmb(); if (qpair->reqq_start_iocbs) @@ -4051,9 +4044,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) fcp_task_attr = qlt_get_fcp_task_attr(vha, atio->u.isp24.fcp_cmnd.task_attr); - data_length = be32_to_cpu(get_unaligned((uint32_t *) - &atio->u.isp24.fcp_cmnd.add_cdb[ - atio->u.isp24.fcp_cmnd.add_cdb_len])); + data_length = get_datalen_for_atio(atio); ret = ha->tgt.tgt_ops->handle_cmd(vha, cmd, cdb, data_length, fcp_task_attr, data_dir, bidi); @@ -5187,6 +5178,12 @@ static int __qlt_send_busy(struct qla_qpair *qpair, */ ctio24->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); ctio24->u.status1.scsi_status = cpu_to_le16(status); + + ctio24->u.status1.residual = get_datalen_for_atio(atio); + + if (ctio24->u.status1.residual != 0) + ctio24->u.status1.scsi_status |= SS_RESIDUAL_UNDER; + /* Memory Barrier */ wmb(); if (qpair->reqq_start_iocbs)