From patchwork Thu Mar 28 17:09:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A8F7186E for ; Thu, 28 Mar 2019 17:11:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1805E28E1A for ; Thu, 28 Mar 2019 17:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C90C28CD0; Thu, 28 Mar 2019 17:11:34 +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,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 F306F28EB3 for ; Thu, 28 Mar 2019 17:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727572AbfC1RLc (ORCPT ); Thu, 28 Mar 2019 13:11:32 -0400 Received: from mail-eopbgr760074.outbound.protection.outlook.com ([40.107.76.74]:61798 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725948AbfC1RLc (ORCPT ); Thu, 28 Mar 2019 13:11:32 -0400 Received: from DM6PR07CA0071.namprd07.prod.outlook.com (2603:10b6:5:74::48) by DM6PR07MB5371.namprd07.prod.outlook.com (2603:10b6:5:44::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Thu, 28 Mar 2019 17:11:29 +0000 Received: from BY2NAM05FT037.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::206) by DM6PR07CA0071.outlook.office365.com (2603:10b6:5:74::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Thu, 28 Mar 2019 17:11:29 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT037.mail.protection.outlook.com (10.152.100.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:29 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:20 -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 x2SHAJ7E026464; Thu, 28 Mar 2019 10:10:19 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAJcQ026463; Thu, 28 Mar 2019 10:10:19 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 01/15] qla2xxx: Set the SCSI command result before calling the command done Date: Thu, 28 Mar 2019 10:09:58 -0700 Message-ID: <20190328171012.26425-2-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982666896076334;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(376002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(97736004)(80596001)(305945005)(48376002)(105606002)(85426001)(69596002)(2616005)(4326008)(336012)(26005)(126002)(53936002)(87636003)(26826003)(51416003)(486006)(106466001)(11346002)(476003)(8936002)(36906005)(47776003)(8676002)(2906002)(50226002)(68736007)(42186006)(81166006)(356004)(6666004)(36756003)(316002)(16586007)(498600001)(4744005)(54906003)(110136005)(5660300002)(86362001)(446003)(50466002)(1076003)(81156014)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB5371;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a55d94cb-4cd9-4db9-f8dc-08d6b3a06b4f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB5371; X-MS-TrafficTypeDiagnostic: DM6PR07MB5371: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: beBFqM8FKADDey4YqSk6kH5yoDBBQ0cU3v3Uke3K2zBsdlB0uT8vcmOWl8xPNb/cMPsaU3tF900hRo0xFBYKbBo/DNcijteOfCbbnE1KkN9vWL9ZpJ97pQ75uLs70LxhFKEtrkZEwNak3w40qY3Xogkxz9MDNW8+UDCrIEkMokTNbIEgPj23aWESmYn7JYGA+CZpoxSKPL037fG4zMhq5pp+oiwDJS103CGrdotuyd3BaIUFU5ACfgbIhe9PFD5j8ZphKzXA5X45fYydmAZQ6VXUWhm4hC9nG+P+obggaUBJcnuUvofaZFEA8YGx5FJ/ag3xHAw1mU5atkIuHkPPRLoyFaU+hGW6RGL8aIXYe5l+q3h+MG6VpagzJG6MGNIdklQC465bBodp28c9dkhj69RLNfT4LY5Vl/QqtSJ+vv8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:29.3524 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a55d94cb-4cd9-4db9-f8dc-08d6b3a06b4f X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB5371 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: Giridhar Malavali This patch sets SCSI cmd->result before scsi_done() is called. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a58a2885fb70..34db83b6f932 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -765,8 +765,6 @@ qla2x00_sp_compl(void *ptr, int res) srb_t *sp = ptr; struct scsi_cmnd *cmd = GET_CMD_SP(sp); - cmd->result = res; - if (atomic_read(&sp->ref_count) == 0) { ql_dbg(ql_dbg_io, sp->vha, 0x3015, "SP reference-count to ZERO -- sp=%p cmd=%p.\n", @@ -779,6 +777,7 @@ qla2x00_sp_compl(void *ptr, int res) return; sp->free(sp); + cmd->result = res; cmd->scsi_done(cmd); } From patchwork Thu Mar 28 17:09:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB6F3186E for ; Thu, 28 Mar 2019 17:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97C2428CC7 for ; Thu, 28 Mar 2019 17:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 959C128EBB; Thu, 28 Mar 2019 17:11:32 +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,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 A253228CC7 for ; Thu, 28 Mar 2019 17:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727274AbfC1RLa (ORCPT ); Thu, 28 Mar 2019 13:11:30 -0400 Received: from mail-eopbgr760083.outbound.protection.outlook.com ([40.107.76.83]:52803 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725948AbfC1RL3 (ORCPT ); Thu, 28 Mar 2019 13:11:29 -0400 Received: from DM6PR07CA0047.namprd07.prod.outlook.com (2603:10b6:5:74::24) by MW2PR07MB4028.namprd07.prod.outlook.com (2603:10b6:907:6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Thu, 28 Mar 2019 17:11:27 +0000 Received: from BY2NAM05FT037.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by DM6PR07CA0047.outlook.office365.com (2603:10b6:5:74::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:27 +0000 Authentication-Results: spf=temperror (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=temperror action=none header.from=marvell.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of marvell.com: DNS Timeout) Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT037.mail.protection.outlook.com (10.152.100.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:25 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:23 -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 x2SHAM5k026468; Thu, 28 Mar 2019 10:10:22 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAMOC026467; Thu, 28 Mar 2019 10:10:22 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 02/15] qla2xxx: Set the qpair in SRB to NULL when SRB is released Date: Thu, 28 Mar 2019 10:09:59 -0700 Message-ID: <20190328171012.26425-3-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982666857724914;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(346002)(39860400002)(136003)(376002)(2980300002)(189003)(199004)(1076003)(36906005)(5660300002)(316002)(42186006)(97736004)(76176011)(51416003)(4744005)(105606002)(50466002)(106466001)(53936002)(36756003)(305945005)(4326008)(110136005)(54906003)(8676002)(81166006)(81156014)(48376002)(47776003)(69596002)(68736007)(63350400001)(6666004)(356004)(87636003)(63370400001)(8936002)(498600001)(26826003)(2906002)(16586007)(336012)(486006)(126002)(26005)(11346002)(476003)(2616005)(80596001)(50226002)(86362001)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR07MB4028;H:CAEXCH02.caveonetworks.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8bbd12b-7831-4bd6-9cf6-08d6b3a068fd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:MW2PR07MB4028; X-MS-TrafficTypeDiagnostic: MW2PR07MB4028: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: VD9l0XCj4T6DU40EmTc9r8/DTuCyxygI9YVgEmAkJgf0hf6wiDuhraUDZp5+FMsVle5AU4/84apyDx86mxKQZoq4ZvR1hLbTIE8telBUgd55dmfJIHGuieD1atxLhnIV3YLzRQLDlC2IIWJCeaOZ117D4zA1pSX3k0uVacmOcJ71KW6AarhDdwZlK/8qHzqzB4l+tYt+xqRK45syvf2yoLmeJ/61/U8+rea7VJI4afJsUGnvYiZI25NnX30eU+cGJ9ASzrFOhcZi2E7+Vbd3TGDdch8+qdqX2jHIE11B3XdVBpnT0nccX1fq3eCmTIY5o9prjmU0/k/dq1txtQBo7QLG7O0j35iwd6FI9rp/PJVA7W2E1VnHGjZXEezoFOqpb93hv89xzHSWyPulhvT5WfM+E+xXY2H9RcI9CUzL16E= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:25.4532 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8bbd12b-7831-4bd6-9cf6-08d6b3a068fd X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR07MB4028 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: Giridhar Malavali Set QPair to NULL Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_inline.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 512c3c37b447..07c3f45d4bd7 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -240,6 +240,7 @@ qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair, static inline void qla2xxx_rel_qpair_sp(struct qla_qpair *qpair, srb_t *sp) { + sp->qpair = NULL; mempool_free(sp, qpair->srb_mempool); QLA_QPAIR_MARK_NOT_BUSY(qpair); } From patchwork Thu Mar 28 17:10:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DA2413B5 for ; Thu, 28 Mar 2019 17:11:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF83428B49 for ; Thu, 28 Mar 2019 17:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3D8328EBA; Thu, 28 Mar 2019 17:11:34 +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,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 CD12C28AE7 for ; Thu, 28 Mar 2019 17:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbfC1RLd (ORCPT ); Thu, 28 Mar 2019 13:11:33 -0400 Received: from mail-eopbgr690051.outbound.protection.outlook.com ([40.107.69.51]:28194 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726692AbfC1RLd (ORCPT ); Thu, 28 Mar 2019 13:11:33 -0400 Received: from DM6PR07CA0071.namprd07.prod.outlook.com (2603:10b6:5:74::48) by BL0PR07MB4020.namprd07.prod.outlook.com (2603:10b6:207:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Thu, 28 Mar 2019 17:11:31 +0000 Received: from BY2NAM05FT037.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::206) by DM6PR07CA0071.outlook.office365.com (2603:10b6:5:74::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Thu, 28 Mar 2019 17:11:30 +0000 Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT037.mail.protection.outlook.com (10.152.100.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:30 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:26 -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 x2SHAQ0L026472; Thu, 28 Mar 2019 10:10:26 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAQru026471; Thu, 28 Mar 2019 10:10:26 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 03/15] qla2xxx: Reset the FCF_ASYNC_{SENT|ACTIVE} flags Date: Thu, 28 Mar 2019 10:10:00 -0700 Message-ID: <20190328171012.26425-4-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982666904543268;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(39860400002)(136003)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(81156014)(6666004)(126002)(476003)(336012)(6346003)(446003)(11346002)(81166006)(54906003)(16586007)(42186006)(356004)(305945005)(2616005)(110136005)(48376002)(80596001)(2906002)(486006)(47776003)(36906005)(26826003)(50466002)(97736004)(498600001)(8676002)(69596002)(87636003)(53936002)(36756003)(68736007)(316002)(1076003)(8936002)(26005)(5660300002)(76176011)(86362001)(50226002)(4744005)(51416003)(4326008)(106466001)(105606002)(83133001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR07MB4020;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c774b78e-98b4-432e-523c-08d6b3a06bd1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BL0PR07MB4020; X-MS-TrafficTypeDiagnostic: BL0PR07MB4020: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: /gnpByQZyMiXzw93eCd4EZdc5OQuTNa+vJ4yZIz/1+5SmFWfiwXMKcV4SaLUbt+GtLHlNWkUVd4uUw/J1TMmZXJSQUEoZ4YJyVLqzrT5eOLeb0dgRGYyqUtrphNYZdcZd6A8cvXHLviNlg0nF2qTQsZRe4afAoN2eU6iYIcsxPtnZ5FU8sj3pXu+Ve7xz5qg7SLmlsx/TF90qvcJh5ALyR/oqwqY47hoFlJvlSHPoY+9EJ1DUg1nQ/eI90hiqxxei5yawNU9ZrDaSE8dySL9cb6sxobCDATc7NXb9ujamMhO+vi5qmj3QoSNZeUQgTpB6cVRa/14FFFknX32DpRXAepNUOtnIS2W5WB8w6ZkHWnDqB4YNrycYGucS5WUg4hTXGY8W8N7crYbqla75mD3eN9uRZrsBm696UmTlj4EvzA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:30.2001 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c774b78e-98b4-432e-523c-08d6b3a06bd1 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB4020 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: Giridhar Malavali This patch resets FCF_ASYNC_SENT and FCF_ASYNC_ACTIVE flag after processing GPSC command. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 7493013fc2cc..479d69c7946c 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3033,6 +3033,8 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res) "Async done-%s res %x, WWPN %8phC \n", sp->name, res, fcport->port_name); + fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); + if (res == QLA_FUNCTION_TIMEOUT) return; @@ -4351,6 +4353,7 @@ int qla24xx_async_gnnid(scsi_qla_host_t *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); + fcport->flags &= ~FCF_ASYNC_SENT; done: return rval; } From patchwork Thu Mar 28 17:10:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E268213B5 for ; Thu, 28 Mar 2019 17:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C077528CC9 for ; Thu, 28 Mar 2019 17:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4C9228CD0; Thu, 28 Mar 2019 17:11:41 +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,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 4BC3F28D4B for ; Thu, 28 Mar 2019 17:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727677AbfC1RLk (ORCPT ); Thu, 28 Mar 2019 13:11:40 -0400 Received: from mail-eopbgr770071.outbound.protection.outlook.com ([40.107.77.71]:44991 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727182AbfC1RLj (ORCPT ); Thu, 28 Mar 2019 13:11:39 -0400 Received: from DM5PR07CA0098.namprd07.prod.outlook.com (2603:10b6:4:ae::27) by CY1PR07MB2537.namprd07.prod.outlook.com (2a01:111:e400:c636::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Thu, 28 Mar 2019 17:11:37 +0000 Received: from BY2NAM05FT027.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::208) by DM5PR07CA0098.outlook.office365.com (2603:10b6:4:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:36 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT027.mail.protection.outlook.com (10.152.100.164) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:35 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:30 -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 x2SHATP2026476; Thu, 28 Mar 2019 10:10:29 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHATlC026475; Thu, 28 Mar 2019 10:10:29 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/15] qla2xxx: Increase the max_sgl_segments to 1024 Date: Thu, 28 Mar 2019 10:10:01 -0700 Message-ID: <20190328171012.26425-5-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982666963825143;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(396003)(376002)(346002)(136003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(97736004)(336012)(8936002)(81166006)(51416003)(8676002)(47776003)(85426001)(81156014)(50226002)(2906002)(76176011)(1076003)(305945005)(69596002)(4744005)(80596001)(86362001)(26005)(68736007)(87636003)(498600001)(11346002)(2616005)(54906003)(6666004)(53936002)(356004)(4326008)(26826003)(5660300002)(126002)(16586007)(446003)(50466002)(316002)(105606002)(36756003)(476003)(42186006)(14444005)(110136005)(486006)(106466001)(48376002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2537;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eee9d6bc-c27a-4602-f8f9-08d6b3a06f58 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2537; X-MS-TrafficTypeDiagnostic: CY1PR07MB2537: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: 8CeDfWQ+j+1PfiBOOSmdcrkH2oDfd0E1e3yCPiF1WxrN3kRicJaRHaEkdurxqo4y1tSG8Nw3CRe5z7e8Pn/8EB82Uf1dB1Og3P390UcFVEiXIvzNSp0NLkBwwrp7kNtqQIduzlbLN4jRb402GYVInpreP9Q8qXfYGvghdqFRA9bGFts4Xis9Y3bc75XArdJ3JCg4d4xkJtwtYj3dSAhHt0NbHGxfXtplx2mrg2JiXvokjZBGelUIxfgpmsRskbU1YqpO53CDIt1Dir/Ee1Q4Ijrjdrk5erXrK9OPK4bo4dowuHZDYPXB+181lNvgmIV9PuDQtKXinWgKSPjEfCy2eCsatLwTEyI0LIQMKAUghk44WoAGoBTD+TCLfm9/vv/Fiimz+3fDnFMjjKz5NGGCY8CUGDF3ypikNm+xOgI2pWw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:35.7449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eee9d6bc-c27a-4602-f8f9-08d6b3a06f58 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2537 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: Giridhar Malavali This patch increases max_sgl_segments value to max supported which is 1024. Increase in max_sgl_segments will support larger IO size from driver. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 41c85da3ab32..cc2afc21a30d 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -573,7 +573,7 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = { .fcp_io = qla_nvme_post_cmd, .fcp_abort = qla_nvme_fcp_abort, .max_hw_queues = 8, - .max_sgl_segments = 128, + .max_sgl_segments = 1024, .max_dif_sgl_segments = 64, .dma_boundary = 0xFFFFFFFF, .local_priv_sz = 8, From patchwork Thu Mar 28 17:10:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13CDD13B5 for ; Thu, 28 Mar 2019 17:11:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E599E28DE1 for ; Thu, 28 Mar 2019 17:11:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E41B328EC1; Thu, 28 Mar 2019 17:11:50 +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,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 9236728DE1 for ; Thu, 28 Mar 2019 17:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbfC1RLu (ORCPT ); Thu, 28 Mar 2019 13:11:50 -0400 Received: from mail-eopbgr820054.outbound.protection.outlook.com ([40.107.82.54]:60384 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726242AbfC1RLu (ORCPT ); Thu, 28 Mar 2019 13:11:50 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by BN3PR07MB2530.namprd07.prod.outlook.com (2a01:111:e400:c5f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Thu, 28 Mar 2019 17:11:44 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:43 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:42 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:33 -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 x2SHAWeT026480; Thu, 28 Mar 2019 10:10:32 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAWN1026479; Thu, 28 Mar 2019 10:10:32 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 05/15] qla2xxx: Disable T10-DIF feature with FC-NVMe during probe Date: Thu, 28 Mar 2019 10:10:02 -0700 Message-ID: <20190328171012.26425-6-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667031567882;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(136003)(396003)(376002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(6666004)(47776003)(48376002)(498600001)(87636003)(106466001)(356004)(1076003)(4744005)(2906002)(14444005)(105606002)(86362001)(26826003)(5660300002)(53936002)(4326008)(2616005)(80596001)(76176011)(336012)(305945005)(69596002)(54906003)(316002)(42186006)(446003)(11346002)(16586007)(51416003)(110136005)(97736004)(85426001)(81156014)(81166006)(8936002)(36756003)(68736007)(50226002)(486006)(126002)(8676002)(476003)(26005)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2530;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7902df51-3ecc-478f-68f5-08d6b3a07363 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2530; X-MS-TrafficTypeDiagnostic: BN3PR07MB2530: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: ApidyMdUq8cvky03D7C48jMMhp1awS5lEh0Twpjy/JnVOqiwWfDlcX6eGqCl5lQXpdv//+OubXC378ybCCzvjhxUHORlCxnUmaQQSwSEHo6sMTVts3jGFLHnkfg6KkruHZAEfH+gL8tbFNz+5yfITp7Chn9dtzzv2BydASP2X1/RbZ1jFpomDe0vBe1svbbsbBLmvv6mRjEcHMzlN57vEshbqxsNVWgbPc9OH8vSuaVm4L6PZZzmG44PcaO6zhN0JbstFySxmVGKcORCQyhK7Rsuf64u3TLjGDjff+tp0nfCKLDr5vWEMwJaWxhw0eM2Z7SNc21lCTsg3TF59uXOeqNsp+2E6XcfVEsRGfnQ1U1VXm/EwnRJy0bj7KlFUC/j5DKL4dsqUcw2UqO32FcR7X8rgAwNwnjMFhR9e/M+yHc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:42.5413 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7902df51-3ecc-478f-68f5-08d6b3a07363 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2530 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: Giridhar Malavali With FC-NVMe enabled, driver does not support T10 DIF/DIX. This patch disabled T10-PI information when ql2xnvmeenable is set. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 34db83b6f932..0e5213f24e43 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2899,6 +2899,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) /* This may fail but that's ok */ pci_enable_pcie_error_reporting(pdev); + /* Turn off T10-DIF when FC-NVMe is enabled */ + if (ql2xnvmeenable) + ql2xenabledif = 0; + ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL); if (!ha) { ql_log_pci(ql_log_fatal, pdev, 0x0009, From patchwork Thu Mar 28 17:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5025513B5 for ; Thu, 28 Mar 2019 17:11:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D15928BEB for ; Thu, 28 Mar 2019 17:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 218A728ECE; Thu, 28 Mar 2019 17:11:45 +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,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 AE4C728BEB for ; Thu, 28 Mar 2019 17:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727251AbfC1RLo (ORCPT ); Thu, 28 Mar 2019 13:11:44 -0400 Received: from mail-eopbgr780058.outbound.protection.outlook.com ([40.107.78.58]:48046 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726242AbfC1RLo (ORCPT ); Thu, 28 Mar 2019 13:11:44 -0400 Received: from BYAPR07CA0055.namprd07.prod.outlook.com (2603:10b6:a03:60::32) by CO2PR07MB2534.namprd07.prod.outlook.com (2603:10b6:102:13::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Thu, 28 Mar 2019 17:11:42 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::205) by BYAPR07CA0055.outlook.office365.com (2603:10b6:a03:60::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.17 via Frontend Transport; Thu, 28 Mar 2019 17:11:42 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:40 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:36 -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 x2SHAZwA026484; Thu, 28 Mar 2019 10:10:35 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAZX8026483; Thu, 28 Mar 2019 10:10:35 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 06/15] qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines. Date: Thu, 28 Mar 2019 10:10:03 -0700 Message-ID: <20190328171012.26425-7-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667013659005;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(396003)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(85426001)(336012)(2616005)(486006)(11346002)(446003)(69596002)(80596001)(126002)(476003)(68736007)(50226002)(8936002)(97736004)(47776003)(36756003)(48376002)(50466002)(105606002)(106466001)(54906003)(110136005)(26826003)(87636003)(5660300002)(16586007)(498600001)(305945005)(81156014)(81166006)(8676002)(53936002)(76176011)(26005)(2906002)(42186006)(86362001)(6666004)(356004)(316002)(1076003)(4326008)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB2534;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de4ecf4a-55e6-4686-db0e-08d6b3a07244 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CO2PR07MB2534; X-MS-TrafficTypeDiagnostic: CO2PR07MB2534: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: T6+WyJhnz730XTWVZpk/WLK+/86ZHNkpPAWgRZeDBUaE2anwqaoAXmJUcDGkTcoDiJHwYwIiz+JRSwd9J5D85YG0CLBjt5J8blFicevBQXOyfQ87AqT3rE3y2dv3VAwDGbqxORn34A7yi2GAsrODcVJLybANFas6IgiokmSsJMhHdgFO2vHl5ssFY6+9ajZUfFHHhAM0oIjhvGXfnDOS3KiyqcpqjbYcUYt8mb3hHPxJ2w83ynS+rdmEn1shUCgqM1TZOJ/eZAeBbY5l0ewR0KlLGm2tUngoQGMQTIIZFhRhxVho8H4FULxsA1V8WOe+qgpFYwZbwUBUxtFDWTBgr3xvGlcEzvZE3hbR/nOrzw4NB18MjcCM/rkB/o/Aw8CV2DT1DOGPQ92kl3NAXgNOzD3rhhU17hBFmFjyJOXqNEA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:40.6693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de4ecf4a-55e6-4686-db0e-08d6b3a07244 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2534 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: Andrew Vasquez Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code") incorrectly set 'optrom_region_size' to 'start+size', which can overflow option-rom boundaries when 'start' is non-zero. Continue setting optrom_region_size to the proper adjusted value of 'size'. Fixes: e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code") Cc: stable@vger.kernel.org Signed-off-by: Andrew Vasquez Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 8687090193dc..93058379d3c8 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -376,7 +376,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, } ha->optrom_region_start = start; - ha->optrom_region_size = start + size; + ha->optrom_region_size = size; ha->optrom_state = QLA_SREADING; ha->optrom_buffer = vmalloc(ha->optrom_region_size); @@ -449,7 +449,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, } ha->optrom_region_start = start; - ha->optrom_region_size = start + size; + ha->optrom_region_size = size; ha->optrom_state = QLA_SWRITING; ha->optrom_buffer = vmalloc(ha->optrom_region_size); From patchwork Thu Mar 28 17:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4719186E for ; Thu, 28 Mar 2019 17:11:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E97E28EB0 for ; Thu, 28 Mar 2019 17:11:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D35D28EC1; Thu, 28 Mar 2019 17:11:53 +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,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 40DB128EB0 for ; Thu, 28 Mar 2019 17:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbfC1RLx (ORCPT ); Thu, 28 Mar 2019 13:11:53 -0400 Received: from mail-eopbgr690049.outbound.protection.outlook.com ([40.107.69.49]:18571 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726242AbfC1RLw (ORCPT ); Thu, 28 Mar 2019 13:11:52 -0400 Received: from BYAPR07CA0069.namprd07.prod.outlook.com (2603:10b6:a03:60::46) by BN7PR07MB5361.namprd07.prod.outlook.com (2603:10b6:408:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Thu, 28 Mar 2019 17:11:50 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::208) by BYAPR07CA0069.outlook.office365.com (2603:10b6:a03:60::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:50 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:49 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:39 -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 x2SHAcXi026488; Thu, 28 Mar 2019 10:10:38 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAcQT026487; Thu, 28 Mar 2019 10:10:38 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 07/15] qla2xxx: Further limit FLASH region write access from SysFS Date: Thu, 28 Mar 2019 10:10:04 -0700 Message-ID: <20190328171012.26425-8-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667103775569;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(136003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(105606002)(336012)(6666004)(54906003)(356004)(81166006)(4326008)(5660300002)(110136005)(81156014)(50466002)(48376002)(26005)(87636003)(51416003)(97736004)(80596001)(76176011)(42186006)(316002)(106466001)(16586007)(86362001)(69596002)(2906002)(486006)(476003)(85426001)(47776003)(68736007)(305945005)(14444005)(11346002)(2616005)(446003)(8936002)(50226002)(26826003)(8676002)(36756003)(498600001)(126002)(53936002)(1076003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5361;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 665cc53b-1e1c-4232-5d21-08d6b3a077b1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5361; X-MS-TrafficTypeDiagnostic: BN7PR07MB5361: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: F1KT91ChTk1hjLQmDKsvNSRG/szdW9j65/eq/lvjE5u0x6ZqXGdds3u/cGij8bRZv0NZqcoSbKrAJ4d5AS44zlI5/XYhzk2erckxoOb1MI15tns5hQg5Ue31y0q9eZXF4lqoFFFTrJhXw/Rj95wPClAPDGtQL1FZQx2tFaNydOlVOm8uowfFTZKvPIhpYrUGxgXd4BouBjgJxehDFjmD3h1g7e9nHzi/o8WfIdX1C1ujuuCa05UBYDYp88j9rIOxCWLkLIT7ZooBtxsyXo7ISA6WgcDsoGRn5fuhwi47gAf1Z4wSklWFdvbkLbo76lHDFqo+0/dgyliiuylctHZZihddZh0JNlWTmdx2ht+ghk1c3MQg3G6tzuV1mSKH5Z6O5alnoZfIt3wWZNy1aKjuXThXA3AP/pZyKXHzYf05fmE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:49.7570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 665cc53b-1e1c-4232-5d21-08d6b3a077b1 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB5361 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: Andrew Vasquez Recent ISPs have larger and more complex flash-write semantics (secure-access and signing). The BSG interfaces support these semantics for all ISPs and is exclusively used by QLogic user-space tools. Limit flash-write operations to ISPs <= 25xx. Signed-off-by: Andrew Vasquez Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 93058379d3c8..b2520e49971d 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -430,6 +430,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, * 0x000000 -> 0x07ffff -- Boot code. * 0x080000 -> 0x0fffff -- Firmware. * 0x120000 -> 0x12ffff -- VPD and HBA parameters. + * + * > ISP25xx type boards: + * + * None -- should go through BSG. */ valid = 0; if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0) @@ -437,9 +441,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, else if (start == (ha->flt_region_boot * 4) || start == (ha->flt_region_fw * 4)) valid = 1; - else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) - || IS_CNA_CAPABLE(ha) || IS_QLA2031(ha) - || IS_QLA27XX(ha) || IS_QLA28XX(ha)) + else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) valid = 1; if (!valid) { ql_log(ql_log_warn, vha, 0x7065, From patchwork Thu Mar 28 17:10:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0600E13B5 for ; Thu, 28 Mar 2019 17:12:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D669528CC9 for ; Thu, 28 Mar 2019 17:12:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAFB028E19; Thu, 28 Mar 2019 17:12:31 +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,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 4E7AF28CC9 for ; Thu, 28 Mar 2019 17:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbfC1RMb (ORCPT ); Thu, 28 Mar 2019 13:12:31 -0400 Received: from mail-eopbgr810081.outbound.protection.outlook.com ([40.107.81.81]:4320 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727274AbfC1RMa (ORCPT ); Thu, 28 Mar 2019 13:12:30 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by CY1PR07MB2538.namprd07.prod.outlook.com (2a01:111:e400:c636::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Thu, 28 Mar 2019 17:11:49 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:49 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:48 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:42 -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 x2SHAfab026492; Thu, 28 Mar 2019 10:10:41 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAfKU026491; Thu, 28 Mar 2019 10:10:41 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 08/15] qla2xxx: Fix fw dump corruption Date: Thu, 28 Mar 2019 10:10:05 -0700 Message-ID: <20190328171012.26425-9-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667088223119;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(396003)(39860400002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(76176011)(53936002)(126002)(36756003)(2616005)(486006)(476003)(498600001)(26826003)(6666004)(87636003)(446003)(85426001)(356004)(11346002)(305945005)(5660300002)(26005)(47776003)(80596001)(69596002)(2906002)(48376002)(50466002)(8676002)(81166006)(81156014)(51416003)(14444005)(106466001)(8936002)(50226002)(336012)(42186006)(316002)(86362001)(110136005)(68736007)(97736004)(54906003)(16586007)(4326008)(1076003)(105606002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2538;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 220d4fb6-0bfa-443a-0d65-08d6b3a076c4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2538; X-MS-TrafficTypeDiagnostic: CY1PR07MB2538: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: pcQFQ36kpPIRZLyR6sCXgY0j+HmJhKW8rCSMf2vqR70I3uZ52WIkkmmNH7f3kFmgbyDaUaDrDMag0srWWoC01003MCGL7BVb5wYgfC4BL+Ko6dW2vUvf18FLze8B/ZdRdgIoya6VLuWzgmECUPOwKWSYl/U0MiTyhqPWBQYzQgpThWXfGI99dlaeaLUXXUzUwYTdb9mqtw0A1fwV02fMZDc3kfqslK0v3q5cifWBWYIM+5uqIiriqBtLnSLaEgBhjLKZhqgncrrUnP8Vcael56x5go0ujHBx3yZqkIb+S/Rhom8xzicN1iAw5wmPSt+HNdbx7femTx4GmlLExx5aRz4ssc5qOO4uvz0FqACsfpKmmhWLEbWzsoXBJ/UMdjp7RuBr6NPYsFVZxB7bd7PzOwj0MxNQekhiF8OQzZK4Ysw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:48.2138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 220d4fb6-0bfa-443a-0d65-08d6b3a076c4 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2538 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 If fw dump buffer size change and there is an existing fw dump, then save the old dump in the newly allocated buffer. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 84 +++++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 2ec878afa18d..8d28ea9b0b73 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4046,6 +4046,7 @@ struct qla_hw_data { } fwdt[2]; struct qla2xxx_fw_dump *fw_dump; uint32_t fw_dump_len; + u32 fw_dump_alloc_len; bool fw_dumped; bool fw_dump_mpi; unsigned long fw_dump_cap_flags; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index c7815d5af2ec..d244479f2332 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3141,12 +3141,12 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) !IS_QLA28XX(ha)) mq_size = sizeof(struct qla2xxx_mq_chain); /* - * Allocate maximum buffer size for all queues. + * Allocate maximum buffer size for all queues - Q0. * Resizing must be done at end-of-dump processing. */ - mq_size += ha->max_req_queues * + mq_size += (ha->max_req_queues - 1) * (req->length * sizeof(request_t)); - mq_size += ha->max_rsp_queues * + mq_size += (ha->max_rsp_queues - 1) * (rsp->length * sizeof(response_t)); } if (ha->tgt.atio_ring) @@ -3221,42 +3221,62 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) ha->exlogin_size; allocate: - if (!ha->fw_dump_len || dump_size != ha->fw_dump_len) { + if (!ha->fw_dump_len || dump_size > ha->fw_dump_alloc_len) { + + ql_dbg(ql_dbg_init, vha, 0x00c5, + "%s dump_size %d fw_dump_len %d fw_dump_alloc_len %d\n", + __func__, dump_size, ha->fw_dump_len, + ha->fw_dump_alloc_len); + fw_dump = vmalloc(dump_size); if (!fw_dump) { ql_log(ql_log_warn, vha, 0x00c4, "Unable to allocate (%d KB) for firmware dump.\n", dump_size / 1024); } else { - if (ha->fw_dump) + if (ha->fw_dumped) { + memcpy(fw_dump, ha->fw_dump, ha->fw_dump_len); vfree(ha->fw_dump); - ha->fw_dump = fw_dump; - - ha->fw_dump_len = dump_size; - ql_dbg(ql_dbg_init, vha, 0x00c5, - "Allocated (%d KB) for firmware dump.\n", - dump_size / 1024); - - if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) - return; - - ha->fw_dump->signature[0] = 'Q'; - ha->fw_dump->signature[1] = 'L'; - ha->fw_dump->signature[2] = 'G'; - ha->fw_dump->signature[3] = 'C'; - ha->fw_dump->version = htonl(1); - - ha->fw_dump->fixed_size = htonl(fixed_size); - ha->fw_dump->mem_size = htonl(mem_size); - ha->fw_dump->req_q_size = htonl(req_q_size); - ha->fw_dump->rsp_q_size = htonl(rsp_q_size); - - ha->fw_dump->eft_size = htonl(eft_size); - ha->fw_dump->eft_addr_l = htonl(LSD(ha->eft_dma)); - ha->fw_dump->eft_addr_h = htonl(MSD(ha->eft_dma)); - - ha->fw_dump->header_size = - htonl(offsetof(struct qla2xxx_fw_dump, isp)); + ha->fw_dump = fw_dump; + ha->fw_dump_alloc_len = dump_size; + ql_dbg(ql_dbg_init, vha, 0x00c5, + "Re-Allocated (%d KB) and save firmware dump.\n", + dump_size / 1024); + } else { + if (ha->fw_dump) + vfree(ha->fw_dump); + ha->fw_dump = fw_dump; + + ha->fw_dump_len = ha->fw_dump_alloc_len = + dump_size; + ql_dbg(ql_dbg_init, vha, 0x00c5, + "Allocated (%d KB) for firmware dump.\n", + dump_size / 1024); + + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) + return; + + ha->fw_dump->signature[0] = 'Q'; + ha->fw_dump->signature[1] = 'L'; + ha->fw_dump->signature[2] = 'G'; + ha->fw_dump->signature[3] = 'C'; + ha->fw_dump->version = htonl(1); + + ha->fw_dump->fixed_size = htonl(fixed_size); + ha->fw_dump->mem_size = htonl(mem_size); + ha->fw_dump->req_q_size = htonl(req_q_size); + ha->fw_dump->rsp_q_size = htonl(rsp_q_size); + + ha->fw_dump->eft_size = htonl(eft_size); + ha->fw_dump->eft_addr_l = + htonl(LSD(ha->eft_dma)); + ha->fw_dump->eft_addr_h = + htonl(MSD(ha->eft_dma)); + + ha->fw_dump->header_size = + htonl(offsetof + (struct qla2xxx_fw_dump, isp)); + } } } } From patchwork Thu Mar 28 17:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C141313B5 for ; Thu, 28 Mar 2019 17:12:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EA8328CD0 for ; Thu, 28 Mar 2019 17:12:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D1DE28ECE; Thu, 28 Mar 2019 17:12:26 +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,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 01D6B28EDB for ; Thu, 28 Mar 2019 17:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726681AbfC1RMZ (ORCPT ); Thu, 28 Mar 2019 13:12:25 -0400 Received: from mail-eopbgr720058.outbound.protection.outlook.com ([40.107.72.58]:16203 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725849AbfC1RMZ (ORCPT ); Thu, 28 Mar 2019 13:12:25 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by CY1PR07MB2538.namprd07.prod.outlook.com (2a01:111:e400:c636::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Thu, 28 Mar 2019 17:11:52 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:11:52 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:51 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:45 -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 x2SHAjr5026496; Thu, 28 Mar 2019 10:10:45 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAjtq026495; Thu, 28 Mar 2019 10:10:45 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 09/15] qla2xxx: Use mutex protection during qla2x00_sysfs_read_fw_dump() Date: Thu, 28 Mar 2019 10:10:06 -0700 Message-ID: <20190328171012.26425-10-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667120078542;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(396003)(39860400002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(76176011)(53936002)(126002)(36756003)(2616005)(486006)(476003)(498600001)(26826003)(6666004)(87636003)(446003)(85426001)(356004)(11346002)(305945005)(5660300002)(26005)(47776003)(80596001)(69596002)(2906002)(48376002)(50466002)(8676002)(81166006)(81156014)(51416003)(14444005)(106466001)(8936002)(50226002)(336012)(42186006)(316002)(86362001)(110136005)(68736007)(97736004)(54906003)(16586007)(4326008)(1076003)(105606002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2538;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 587caa67-c5f8-4ff6-f9ae-08d6b3a078a9 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2538; X-MS-TrafficTypeDiagnostic: CY1PR07MB2538: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: WTg9joyLzNhMV+eVXExPCn8En8730iMLL4XAchz09jTySvXe7wiZDSmFHz5G7djTMffVcU54LWVo4mhuaggDiavKCFrOlcF4/Qxt/6t0AGacexEHngxiVUQlXMe09b+11sRB30skzHeuakYxoK/4bWUmgndVB1p4251QJLDoQfXL6gqet1KLW0w0WlU1uvz9Ox+kil4o487qNf0wRxiL0zHy1BN5Pf58S1JIbZPOZBrs18XXEt9cphcLVzGkDRh0ZhNbqXnwGrgLWBbEePB+rGk0ba5Oa/02bl9/ZsL2SHNyzDYTW2iIweKo6qBoIPgUGD9jJAlf97AF1XPubiHKWX/jslTl55CgI855v3SP8ieQvZStR6YZ1hvOk2SjTnycnclK3qRVHAsMcTsWjp/bPhvMMzt4uTyfqqq5HRwfwwo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:51.3903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 587caa67-c5f8-4ff6-f9ae-08d6b3a078a9 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2538 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 When user extract FW dump from driver, add mutex protection to prevent driver from freeing the FW dump buffer from freeing while the extraction is in progress. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 25 ++++++++++++++----------- drivers/scsi/qla2xxx/qla_init.c | 6 +++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index b2520e49971d..da64fe54f59e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -29,24 +29,27 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj, if (!(ha->fw_dump_reading || ha->mctp_dump_reading)) return 0; + mutex_lock(&ha->optrom_mutex); if (IS_P3P_TYPE(ha)) { if (off < ha->md_template_size) { rval = memory_read_from_buffer(buf, count, &off, ha->md_tmplt_hdr, ha->md_template_size); - return rval; + } else { + off -= ha->md_template_size; + rval = memory_read_from_buffer(buf, count, + &off, ha->md_dump, ha->md_dump_size); } - off -= ha->md_template_size; - rval = memory_read_from_buffer(buf, count, - &off, ha->md_dump, ha->md_dump_size); - return rval; - } else if (ha->mctp_dumped && ha->mctp_dump_reading) - return memory_read_from_buffer(buf, count, &off, ha->mctp_dump, + } else if (ha->mctp_dumped && ha->mctp_dump_reading) { + rval = memory_read_from_buffer(buf, count, &off, ha->mctp_dump, MCTP_DUMP_SIZE); - else if (ha->fw_dump_reading) - return memory_read_from_buffer(buf, count, &off, ha->fw_dump, + } else if (ha->fw_dump_reading) { + rval = memory_read_from_buffer(buf, count, &off, ha->fw_dump, ha->fw_dump_len); - else - return 0; + } else { + rval = 0; + } + mutex_unlock(&ha->optrom_mutex); + return rval; } static ssize_t diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index d244479f2332..8187791b5bd0 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3234,6 +3234,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) "Unable to allocate (%d KB) for firmware dump.\n", dump_size / 1024); } else { + mutex_lock(&ha->optrom_mutex); if (ha->fw_dumped) { memcpy(fw_dump, ha->fw_dump, ha->fw_dump_len); vfree(ha->fw_dump); @@ -3253,8 +3254,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) "Allocated (%d KB) for firmware dump.\n", dump_size / 1024); - if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { + mutex_unlock(&ha->optrom_mutex); return; + } ha->fw_dump->signature[0] = 'Q'; ha->fw_dump->signature[1] = 'L'; @@ -3277,6 +3280,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) htonl(offsetof (struct qla2xxx_fw_dump, isp)); } + mutex_unlock(&ha->optrom_mutex); } } } From patchwork Thu Mar 28 17:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8BBC13B5 for ; Thu, 28 Mar 2019 17:12:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6B3728CDF for ; Thu, 28 Mar 2019 17:12:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C511128ECB; Thu, 28 Mar 2019 17:12:01 +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,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 661A828CDF for ; Thu, 28 Mar 2019 17:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727622AbfC1RMA (ORCPT ); Thu, 28 Mar 2019 13:12:00 -0400 Received: from mail-eopbgr790074.outbound.protection.outlook.com ([40.107.79.74]:37424 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727621AbfC1RMA (ORCPT ); Thu, 28 Mar 2019 13:12:00 -0400 Received: from DM5PR07CA0033.namprd07.prod.outlook.com (2603:10b6:3:16::19) by CO2PR07MB2533.namprd07.prod.outlook.com (2603:10b6:102:17::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Thu, 28 Mar 2019 17:11:58 +0000 Received: from BY2NAM05FT014.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by DM5PR07CA0033.outlook.office365.com (2603:10b6:3:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17 via Frontend Transport; Thu, 28 Mar 2019 17:11:58 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT014.mail.protection.outlook.com (10.152.100.151) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:57 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:49 -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 x2SHAmD6026500; Thu, 28 Mar 2019 10:10:48 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAmCQ026499; Thu, 28 Mar 2019 10:10:48 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 10/15] qla2xxx: Cleanup fcport memory to prevent leak Date: Thu, 28 Mar 2019 10:10:07 -0700 Message-ID: <20190328171012.26425-11-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667180255734;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(346002)(136003)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(42186006)(36756003)(305945005)(85426001)(53936002)(106466001)(47776003)(316002)(105606002)(16586007)(2906002)(68736007)(80596001)(97736004)(69596002)(126002)(476003)(48376002)(26005)(50466002)(1076003)(6666004)(86362001)(5660300002)(446003)(336012)(486006)(2616005)(11346002)(87636003)(498600001)(81166006)(110136005)(50226002)(26826003)(4326008)(54906003)(8676002)(356004)(81156014)(51416003)(76176011)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB2533;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76e59e6d-e7db-4abd-5b9c-08d6b3a07c40 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CO2PR07MB2533; X-MS-TrafficTypeDiagnostic: CO2PR07MB2533: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: zPBm6teZKRTz2FQtfWuIdAE1yI5BewzUmUzAyE5KdS5X8saxDGJedc7XfTpBAoNyquJrO8v5FlIFC+SlNs4t/DxA0MqhzOS6Ss/YUI1vcpNAzkHWoSMUmJeLlpDrHZGAGD7epCFLWujS4jaarGqJGUY0o9mzLHYJQ6EslOtRSK4gqQCxNF0LP7hy+vns+eQPHHMxek2HAZZ6a5rapwuwMQZmki7jTv2Oo/OvuHEVsMb8X3vx+cIpVSdKPmZwjKo2tIkBRj90dWcgDQ37JJ9K7/wGTPpPgUjnk4UmCI0oeT1WYwPmC6wkUPNu74mwVuovM4KGMCeeoYhyzuRYzsl7xkR+YMa57JKpsr1YkRrL4XuowC2pLAxKN2NgSA/cegm/66VjezEjgz9bcrBr88hjuF1ZUpQD08OkfKhn1krbqvM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:57.4120 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76e59e6d-e7db-4abd-5b9c-08d6b3a07c40 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2533 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 cleanup fcport list and loopid in one place and iterate through for loop. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 2 ++ drivers/scsi/qla2xxx/qla_os.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 8187791b5bd0..fe1f5f1e6635 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4821,6 +4821,8 @@ qla2x00_free_fcport(fc_port_t *fcport) fcport->ct_desc.ct_sns = NULL; } + list_del(&fcport->list); + qla2x00_clear_loop_id(fcport); kfree(fcport); } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0e5213f24e43..71ff35646bfe 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3907,11 +3907,8 @@ void qla2x00_free_fcports(struct scsi_qla_host *vha) { fc_port_t *fcport, *tfcport; - list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) { - list_del(&fcport->list); - qla2x00_clear_loop_id(fcport); - kfree(fcport); - } + list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) + qla2x00_free_fcport(fcport); } static inline void From patchwork Thu Mar 28 17:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 205E7186E for ; Thu, 28 Mar 2019 17:12:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0E7D28BE7 for ; Thu, 28 Mar 2019 17:12:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5B4328CC9; Thu, 28 Mar 2019 17:12:00 +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,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 9003B28EB3 for ; Thu, 28 Mar 2019 17:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbfC1RMA (ORCPT ); Thu, 28 Mar 2019 13:12:00 -0400 Received: from mail-eopbgr680075.outbound.protection.outlook.com ([40.107.68.75]:7745 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726029AbfC1RL7 (ORCPT ); Thu, 28 Mar 2019 13:11:59 -0400 Received: from DM5PR07CA0033.namprd07.prod.outlook.com (2603:10b6:3:16::19) by SN1PR07MB4030.namprd07.prod.outlook.com (2603:10b6:802:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Thu, 28 Mar 2019 17:11:57 +0000 Received: from BY2NAM05FT014.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by DM5PR07CA0033.outlook.office365.com (2603:10b6:3:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17 via Frontend Transport; Thu, 28 Mar 2019 17:11:56 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT014.mail.protection.outlook.com (10.152.100.151) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:11:55 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:52 -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 x2SHApa5026504; Thu, 28 Mar 2019 10:10:51 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHApEo026503; Thu, 28 Mar 2019 10:10:51 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 11/15] qla2xxx: Set remote port devloss timeout to 0 Date: Thu, 28 Mar 2019 10:10:08 -0700 Message-ID: <20190328171012.26425-12-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667164152877;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(11346002)(336012)(476003)(126002)(486006)(105606002)(446003)(2616005)(1076003)(53936002)(6666004)(356004)(2906002)(106466001)(26005)(8676002)(81156014)(81166006)(4326008)(54906003)(86362001)(110136005)(305945005)(16586007)(316002)(51416003)(36756003)(76176011)(69596002)(47776003)(498600001)(50466002)(5660300002)(8936002)(48376002)(80596001)(50226002)(68736007)(42186006)(26826003)(87636003)(97736004)(85426001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB4030;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97c2c50c-86b4-4dbe-dd42-08d6b3a07b37 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN1PR07MB4030; X-MS-TrafficTypeDiagnostic: SN1PR07MB4030: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: xAQ8q9Bf+gKMV5POPWjOTXCwIU+PcspEf5xBeukznjGXg/8GD5JEeMlsPEtrErVxiFJ97CL44VJtFWW4J51J9YVcTDhj4QU1TMJapB20nUkeTlbnpOqKLf5xRbtSC46zx4RNr2DbLTOCj2o7eQn7Bo699uQHk9xHuIB2deLob2bBEdo4TF19Yb2vglGGMA8rzv9Ps+aHMVsZMH6d1LL9qC2iFL+ObUEM1nRrmHqTvGscWHsdh6mjPsGR7mkIetnnwAwh4o4ArezcDTpRI2D3UxT+WaelAJWUzlIXsL9qc7AGVglPlq+fsBSVcmNaruIdujru4yHQOfS1ru2N97kqg7+BDFF3Y2sK08v3BhXkqqrfasyZ8TxCnWpHnLOw7k3LQtFk4hf17PrRKVjUzHWDY2Ukn3recuUTO2V8icH9TTY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:11:55.6726 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97c2c50c-86b4-4dbe-dd42-08d6b3a07b37 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB4030 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: Giridhar Malavali This patch sets remote_port_devloss value to 0. This indicates to FC-NVMe transport that driver is unloading and transport should not retry. Fixes: e476fe8af5ff ("scsi: qla2xxx: Fix unload when NVMe devices are configured") Cc: stable@vger.kernel.org Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index cc2afc21a30d..46c14bfecd4e 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -615,7 +615,6 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) struct fc_port *fcport = container_of(work, struct fc_port, nvme_del_work); struct qla_nvme_rport *qla_rport, *trport; - scsi_qla_host_t *base_vha; if (!IS_ENABLED(CONFIG_NVME_FC)) return; @@ -623,23 +622,19 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) ql_log(ql_log_warn, NULL, 0x2112, "%s: unregister remoteport on %p\n",__func__, fcport); - base_vha = pci_get_drvdata(fcport->vha->hw->pdev); - if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) { - ql_dbg(ql_dbg_disc, fcport->vha, 0x2114, - "%s: Notify FC-NVMe transport, set devloss=0\n", - __func__); - - nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); - } - list_for_each_entry_safe(qla_rport, trport, &fcport->vha->nvme_rport_list, list) { if (qla_rport->fcport == fcport) { ql_log(ql_log_info, fcport->vha, 0x2113, "%s: fcport=%p\n", __func__, fcport); + nvme_fc_set_remoteport_devloss + (fcport->nvme_remote_port, 0); init_completion(&fcport->nvme_del_done); - nvme_fc_unregister_remoteport( - fcport->nvme_remote_port); + if (nvme_fc_unregister_remoteport + (fcport->nvme_remote_port)) + ql_log(ql_log_info, fcport->vha, 0x2114, + "%s: Failed to unregister nvme_remote_port\n", + __func__); wait_for_completion(&fcport->nvme_del_done); break; } From patchwork Thu Mar 28 17:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 255F0186E for ; Thu, 28 Mar 2019 17:12:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02A5028EC6 for ; Thu, 28 Mar 2019 17:12:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB71128EE3; Thu, 28 Mar 2019 17:12:05 +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,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 A418528ED5 for ; Thu, 28 Mar 2019 17:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbfC1RMF (ORCPT ); Thu, 28 Mar 2019 13:12:05 -0400 Received: from mail-eopbgr730058.outbound.protection.outlook.com ([40.107.73.58]:44448 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726281AbfC1RMF (ORCPT ); Thu, 28 Mar 2019 13:12:05 -0400 Received: from DM6PR07CA0044.namprd07.prod.outlook.com (2603:10b6:5:74::21) by BL0PR07MB4018.namprd07.prod.outlook.com (2603:10b6:207:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Thu, 28 Mar 2019 17:12:01 +0000 Received: from BY2NAM05FT037.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by DM6PR07CA0044.outlook.office365.com (2603:10b6:5:74::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:12:01 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT037.mail.protection.outlook.com (10.152.100.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:12:00 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:55 -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 x2SHAsmt026516; Thu, 28 Mar 2019 10:10:54 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAs7J026507; Thu, 28 Mar 2019 10:10:54 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 12/15] qla2xxx: Cleanup redundant qla2x00_abort_all_cmds during unload Date: Thu, 28 Mar 2019 10:10:09 -0700 Message-ID: <20190328171012.26425-13-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667213029122;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(396003)(136003)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(305945005)(48376002)(50466002)(5660300002)(4744005)(68736007)(1076003)(53936002)(47776003)(76176011)(51416003)(26005)(36756003)(87636003)(2906002)(446003)(80596001)(2616005)(85426001)(4326008)(126002)(26826003)(498600001)(54906003)(316002)(16586007)(11346002)(476003)(110136005)(336012)(106466001)(81166006)(86362001)(105606002)(8676002)(97736004)(50226002)(356004)(69596002)(6666004)(81156014)(8936002)(486006)(14444005)(42186006);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR07MB4018;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91c58dde-dffc-4445-70d2-08d6b3a07e34 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BL0PR07MB4018; X-MS-TrafficTypeDiagnostic: BL0PR07MB4018: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: hwwe7k+9Jt0HzVck6geAkvZlu2P1O/Db2oL9miIRMrnbf3Sh68QlftcYKhVEpMDfsdqoUOKxMQRtdl+qKlDpzAc/EXYY6Q4+izBfok0nzqLkPeWNaK6akT/d3UYcdzqcEL3NFebRB7uLrgc/NHGcyR7iGAub4Yq8JFKfm+Dm7J2B/CaxG+ekGBDshRxXM5AoMvT5iZG4W4QHTkFS5F21S6oHsKVXkTpe3//kNmUOYnZlQ+dwuEQk5jz944i6J0tKpppGRpTW6TBm0HQ5SXSwh8XDNtbqObqCrlHCTs6rEeKSBCwzuAiTMNCLx4fY5LUpj2QtkaASGvU91CYLv97eyTQTsN0qsK7K9vmwaPFqiMxBZZHl4Rd14LnRXlPTkGgz6zehzaEFGk2UT6mx7uCUPhHEsYBpLwLBftGDJic6jUk= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:12:00.6924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91c58dde-dffc-4445-70d2-08d6b3a07e34 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB4018 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: Anil Gurumurthy This patch removes redundant qla2x00_abort_all_cmds() during driver unload. Signed-off-by: Anil Gurumurthy Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 71ff35646bfe..69a8e5815e6d 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3817,8 +3817,6 @@ qla2x00_remove_one(struct pci_dev *pdev) qla2x00_delete_all_vps(ha, base_vha); - qla2x00_abort_all_cmds(base_vha, DID_NO_CONNECT << 16); - qla2x00_dfs_remove(base_vha); qla84xx_put_chip(base_vha); From patchwork Thu Mar 28 17:10:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43D7713B5 for ; Thu, 28 Mar 2019 17:12:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2080428BE7 for ; Thu, 28 Mar 2019 17:12:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ECFC28ECF; Thu, 28 Mar 2019 17:12: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=-7.9 required=2.0 tests=BAYES_00,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 0C3A728BE7 for ; Thu, 28 Mar 2019 17:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbfC1RMK (ORCPT ); Thu, 28 Mar 2019 13:12:10 -0400 Received: from mail-eopbgr710051.outbound.protection.outlook.com ([40.107.71.51]:64264 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726681AbfC1RMK (ORCPT ); Thu, 28 Mar 2019 13:12:10 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by SN6PR07MB5376.namprd07.prod.outlook.com (2603:10b6:805:74::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Thu, 28 Mar 2019 17:12:06 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:12:06 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:12:06 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:58 -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 x2SHAvU0026520; Thu, 28 Mar 2019 10:10:57 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAv3H026519; Thu, 28 Mar 2019 10:10:57 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 13/15] qla2xxx: Fix driver unload when FC-NVMe LUNs are connected Date: Thu, 28 Mar 2019 10:10:10 -0700 Message-ID: <20190328171012.26425-14-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667265694198;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(50226002)(42186006)(50466002)(5660300002)(8676002)(81156014)(47776003)(8936002)(76176011)(81166006)(68736007)(86362001)(97736004)(53936002)(1076003)(26005)(446003)(6666004)(11346002)(305945005)(85426001)(476003)(110136005)(498600001)(126002)(51416003)(4326008)(54906003)(48376002)(2616005)(36756003)(2906002)(106466001)(105606002)(80596001)(486006)(356004)(87636003)(26826003)(336012)(69596002)(16586007)(316002)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5376;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1111d589-4213-4b54-e4ab-08d6b3a08157 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5376; X-MS-TrafficTypeDiagnostic: SN6PR07MB5376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: 3uhTioqV29Ia6qzwGoLP5fAiyexgpPwyAf1R+69z+65GdJv7qc0Jm7mFNnQbmvAAj+pTPWfQMT31QF91INlrtWaIZAbtzAx0nPGM3iUW4BG6Rn4gJ0+mB94YWbvAOPOS/UaTdOldIhLsOb9CF6GXyqgwYRfoWxHOnomV2H3HNaPjR7b52gv9sB+na4WEw7z0idQBArKyZyYBk+ibLDluszK4hqcGbwHelbMTuZn0pnKFPwMWLXs54HlgDPPNcw8ohzkTdNYLBHaVK8wV7+qFRlv8eaxRi7rnAwgG3RD7F7YuI1NM8LzHXrveqEcHBQhtRIlFsVMl7RZb5ImnDm/3m37xLAmGRAqrwAro2HisqTRK1OOrMr5ziXLYAI9zyRo4HIkD8C3rD7EuuBmeWDe+WqJjyrJ2R5OZ35vNO1A1nZs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:12:06.3142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1111d589-4213-4b54-e4ab-08d6b3a08157 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5376 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: Giridhar Malavali This patch allows driver to unload using "modprobe -r" when FC-NVMe LUNs are connected. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 29 +++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_os.c | 6 ++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 46c14bfecd4e..1ca63e80a7fe 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -164,12 +164,13 @@ static void qla_nvme_sp_done(void *ptr, int res) if (!atomic_dec_and_test(&sp->ref_count)) return; - if (res == QLA_SUCCESS) - fd->status = 0; - else - fd->status = NVME_SC_INTERNAL; - - fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; + if (res == QLA_SUCCESS) { + fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; + } else { + fd->rcv_rsplen = 0; + fd->transferred_length = 0; + } + fd->status = 0; fd->done(fd); qla2xxx_rel_qpair_sp(sp->qpair, sp); @@ -193,6 +194,22 @@ static void qla_nvme_abort_work(struct work_struct *work) if (!ha->flags.fw_started && (fcport && fcport->deleted)) return; + if (ha->flags.host_shutting_down) { + ql_log(ql_log_info, sp->fcport->vha, 0xffff, + "%s Calling done on sp: %p, type: 0x%x, sp->ref_count: 0x%x\n", + __func__, sp, sp->type, atomic_read(&sp->ref_count)); + sp->done(sp, 0); + return; + } + + if (atomic_read(&sp->ref_count) == 0) { + WARN_ON(1); + ql_log(ql_log_info, fcport->vha, 0xffff, + "%s: command alredy aborted on sp: %p\n", + __func__, sp); + return; + } + rval = ha->isp_ops->abort_command(sp); ql_dbg(ql_dbg_io, fcport->vha, 0x212b, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 69a8e5815e6d..837860e1827b 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -6720,8 +6720,10 @@ qla2x00_timer(struct timer_list *t) * FC-NVME * see if the active AEN count has changed from what was last reported. */ - if (!vha->vp_idx && (atomic_read(&ha->nvme_active_aen_cnt) != - ha->nvme_last_rptd_aen) && ha->zio_mode == QLA_ZIO_MODE_6) { + if (!vha->vp_idx && + (atomic_read(&ha->nvme_active_aen_cnt) != ha->nvme_last_rptd_aen) && + ha->zio_mode == QLA_ZIO_MODE_6 && + !ha->flags.host_shutting_down) { ql_log(ql_log_info, vha, 0x3002, "nvme: Sched: Set ZIO exchange threshold to %d.\n", ha->nvme_last_rptd_aen); From patchwork Thu Mar 28 17:10:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B4D9186E for ; Thu, 28 Mar 2019 17:12:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B5F28EC6 for ; Thu, 28 Mar 2019 17:12:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12EB728EBB; Thu, 28 Mar 2019 17:12:11 +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,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 703DA28EC6 for ; Thu, 28 Mar 2019 17:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbfC1RMK (ORCPT ); Thu, 28 Mar 2019 13:12:10 -0400 Received: from mail-eopbgr740077.outbound.protection.outlook.com ([40.107.74.77]:21632 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726248AbfC1RMJ (ORCPT ); Thu, 28 Mar 2019 13:12:09 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by BN3PR07MB2530.namprd07.prod.outlook.com (2a01:111:e400:c5f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Thu, 28 Mar 2019 17:12:05 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:12:05 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:12:05 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:11:01 -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 x2SHB0k7026524; Thu, 28 Mar 2019 10:11:00 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHB0xO026523; Thu, 28 Mar 2019 10:11:00 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 14/15] qla2xxx: Change abort wait_loop from msleep to wait_event_timeout Date: Thu, 28 Mar 2019 10:10:11 -0700 Message-ID: <20190328171012.26425-15-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667256466833;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(136003)(396003)(376002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(6666004)(47776003)(48376002)(498600001)(87636003)(106466001)(356004)(1076003)(2906002)(14444005)(105606002)(86362001)(26826003)(5660300002)(53936002)(4326008)(2616005)(80596001)(76176011)(336012)(305945005)(69596002)(54906003)(316002)(42186006)(446003)(11346002)(36906005)(16586007)(51416003)(110136005)(97736004)(85426001)(81156014)(81166006)(8936002)(36756003)(68736007)(50226002)(486006)(126002)(8676002)(476003)(26005)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2530;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0745326c-fd7a-4eb1-3f61-08d6b3a080cb X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2530; X-MS-TrafficTypeDiagnostic: BN3PR07MB2530: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: x3dWwHGmvM8lQ5Od7q14Ydu5K05trpo5cycMf8tpjKqksXpSoQMLnq0Eda4SBPLJa95q3idl3OAuGdD5AAekzqCC+ljP3pSvYqb6I/cv3bdA+R9CnWQQL8to0K1sjo9LbBl+FyXuxeht4iaTLZ/R70ha4ScSbqXqqg3M3zZZ6vfSk4Nf9KbmHOULFS+FKrRLFC23HD9NNYAbEgSY3Rv6iNSuM/kmyT7YdiuetIaPHQt3Thc3Mi6qS1/AGlBX7p8MH8vkg43XEVoNJXbG6VNWBAuL7N5LJyT5aSDc0LFj4s9nAPKZXZ1ihPM2vXnLnf2eyRIlUMbtO/FNBbQWuNPcubCLqoA7U07hdrb2bWIcihZ7/Rub9v90AQsW4aQoela9gkb9u12H8adxmYiHVZ244CSrsgN+EL+GV/WTfWLdCv0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:12:05.3714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0745326c-fd7a-4eb1-3f61-08d6b3a080cb X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2530 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: Giridhar Malavali This patch converts driver wait time from using msleep to wair_event_timeout to prevent race condition. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_os.c | 83 +++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 8d28ea9b0b73..b7b0a3e0ecbc 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -546,6 +546,7 @@ typedef struct srb { int rc; int retry_count; struct completion comp; + wait_queue_head_t *cwaitq; union { struct srb_iocb iocb_cmd; struct bsg_job *bsg_job; @@ -4794,5 +4795,4 @@ struct sff_8247_a0 { #include "qla_gbl.h" #include "qla_dbg.h" #include "qla_inline.h" - #endif diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 837860e1827b..7fd1b6d5da9b 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -726,7 +726,7 @@ qla2x00_sp_free_dma(void *ptr) } if (!ctx) - goto end; + return; if (sp->flags & SRB_CRC_CTX_DSD_VALID) { /* List assured to be having elements */ @@ -751,12 +751,6 @@ qla2x00_sp_free_dma(void *ptr) ha->gbl_dsd_avail += ctx1->dsd_use_cnt; mempool_free(ctx1, ha->ctx_mempool); } - -end: - if (sp->type != SRB_NVME_CMD && sp->type != SRB_NVME_LS) { - CMD_SP(cmd) = NULL; - qla2x00_rel_sp(sp); - } } void @@ -764,6 +758,7 @@ qla2x00_sp_compl(void *ptr, int res) { srb_t *sp = ptr; struct scsi_cmnd *cmd = GET_CMD_SP(sp); + wait_queue_head_t *cwaitq = sp->cwaitq; if (atomic_read(&sp->ref_count) == 0) { ql_dbg(ql_dbg_io, sp->vha, 0x3015, @@ -778,7 +773,11 @@ qla2x00_sp_compl(void *ptr, int res) sp->free(sp); cmd->result = res; + CMD_SP(cmd) = NULL; cmd->scsi_done(cmd); + if (cwaitq) + wake_up(cwaitq); + qla2x00_rel_sp(sp); } void @@ -801,7 +800,7 @@ qla2xxx_qpair_sp_free_dma(void *ptr) } if (!ctx) - goto end; + return; if (sp->flags & SRB_CRC_CTX_DSD_VALID) { /* List assured to be having elements */ @@ -861,10 +860,6 @@ qla2xxx_qpair_sp_free_dma(void *ptr) } sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; } - -end: - CMD_SP(cmd) = NULL; - qla2xxx_rel_qpair_sp(sp->qpair, sp); } void @@ -872,8 +867,7 @@ qla2xxx_qpair_sp_compl(void *ptr, int res) { srb_t *sp = ptr; struct scsi_cmnd *cmd = GET_CMD_SP(sp); - - cmd->result = res; + wait_queue_head_t *cwaitq = sp->cwaitq; if (atomic_read(&sp->ref_count) == 0) { ql_dbg(ql_dbg_io, sp->fcport->vha, 0x3079, @@ -887,7 +881,12 @@ qla2xxx_qpair_sp_compl(void *ptr, int res) return; sp->free(sp); + cmd->result = res; + CMD_SP(cmd) = NULL; cmd->scsi_done(cmd); + if (cwaitq) + wake_up(cwaitq); + qla2xxx_rel_qpair_sp(sp->qpair, sp); } /* If we are SP1 here, we need to still take and release the host_lock as SP1 @@ -1377,7 +1376,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) vha->host_no, id, lun, sp, cmd, sp->handle); /* Get a reference to the sp and drop the lock.*/ - rval = ha->isp_ops->abort_command(sp); if (rval) { if (rval == QLA_FUNCTION_PARAMETER_ERROR) @@ -1394,37 +1392,46 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) } spin_lock_irqsave(qpair->qp_lock_ptr, flags); - /* - * Clear the slot in the oustanding_cmds array if we can't find the - * command to reclaim the resources. - */ - if (rval == QLA_FUNCTION_PARAMETER_ERROR) - vha->req->outstanding_cmds[sp->handle] = NULL; /* - * sp->done will do ref_count-- - * sp_get() took an extra count above + * Releasing of the SRB and associated command resources + * is managed through ref_count. + * Whether we need to wait for the abort completion or complete + * the abort handler should be based on the ref_count. */ - sp->done(sp, DID_RESET << 16); - - /* Did the command return during mailbox execution? */ - if (ret == FAILED && !CMD_SP(cmd)) - ret = SUCCESS; + if (atomic_read(&sp->ref_count) > 1) { + /* + * The command is not yet completed. We need to wait for either + * command completion or abort completion. + */ + DECLARE_WAIT_QUEUE_HEAD_ONSTACK(eh_waitq); + uint32_t ratov = ha->r_a_tov/10; - if (!CMD_SP(cmd)) - wait = 0; + /* Go ahead and release the extra ref_count obtained earlier */ + sp->done(sp, DID_RESET << 16); + sp->cwaitq = &eh_waitq; - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); - - /* Wait for the command to be returned. */ - if (wait) { - if (qla2x00_eh_wait_on_command(cmd) != QLA_SUCCESS) { - ql_log(ql_log_warn, vha, 0x8006, - "Abort handler timed out cmd=%p.\n", cmd); + if (!wait_event_lock_irq_timeout(eh_waitq, + CMD_SP(cmd) == NULL, *qpair->qp_lock_ptr, + msecs_to_jiffies(4 * ratov * 1000))) { + /* + * The abort got dropped, LOGO will be sent and the + * original command will be completed with CS_TIMEOUT + * completion + */ + ql_dbg(ql_dbg_taskm, vha, 0xffff, + "%s: Abort wait timer (4 * R_A_TOV[%d]) expired\n", + __func__, ha->r_a_tov); + sp->cwaitq = NULL; ret = FAILED; + goto end; } + } else { + /* Command completed while processing the abort */ + sp->done(sp, DID_RESET << 16); } - +end: + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); ql_log(ql_log_info, vha, 0x801c, "Abort command issued nexus=%ld:%d:%llu -- %d %x.\n", vha->host_no, id, lun, wait, ret); From patchwork Thu Mar 28 17:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6697F186E for ; Thu, 28 Mar 2019 17:12:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45DCD28CD0 for ; Thu, 28 Mar 2019 17:12:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4450128ECB; Thu, 28 Mar 2019 17:12:14 +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,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 3750E28CD0 for ; Thu, 28 Mar 2019 17:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727542AbfC1RMN (ORCPT ); Thu, 28 Mar 2019 13:12:13 -0400 Received: from mail-eopbgr690077.outbound.protection.outlook.com ([40.107.69.77]:47430 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726681AbfC1RMM (ORCPT ); Thu, 28 Mar 2019 13:12:12 -0400 Received: from DM6PR07CA0059.namprd07.prod.outlook.com (2603:10b6:5:74::36) by BN7PR07MB5361.namprd07.prod.outlook.com (2603:10b6:408:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Thu, 28 Mar 2019 17:12:11 +0000 Received: from BY2NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::205) by DM6PR07CA0059.outlook.office365.com (2603:10b6:5:74::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:12:11 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT017.mail.protection.outlook.com (10.152.100.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:12:10 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:11:01 -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 x2SHB1S3026528; Thu, 28 Mar 2019 10:11:01 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHB1BT026527; Thu, 28 Mar 2019 10:11:01 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 15/15] qla2xxx: Update driver version to 10.01.00.16-k Date: Thu, 28 Mar 2019 10:10:12 -0700 Message-ID: <20190328171012.26425-16-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667307043616;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(136003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(105606002)(336012)(6666004)(54906003)(356004)(36906005)(81166006)(4326008)(5660300002)(110136005)(81156014)(50466002)(48376002)(26005)(87636003)(51416003)(97736004)(80596001)(76176011)(42186006)(316002)(106466001)(16586007)(86362001)(69596002)(2906002)(486006)(476003)(85426001)(4744005)(47776003)(68736007)(305945005)(14444005)(11346002)(2616005)(446003)(8936002)(50226002)(26826003)(8676002)(36756003)(498600001)(126002)(53936002)(1076003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5361;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eed45764-a353-4fa3-eb93-08d6b3a083cd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5361; X-MS-TrafficTypeDiagnostic: BN7PR07MB5361: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: /tej3hNpBdtI8AzAg8vBrGK5noUfSOAQl6t9OVXHcwVJ0e88v7N8TcbJAwNDRBTSUv6wW2dvmuv4Circ0MM86X9aQCKh7hLblsiwDWAkvkcm1iJsJkhxInDHhu7/e3evgQ5SkIH3cMJ8/Pw2dc13WIbiRPCsk9mK0afkLvxLI92+en9PBvhNyXSqu2NXY9L09Q9gCFe3fsnffg95Ec27SPTRAvK9gw/XfaqnoFuBKi0YFXGY8cmlGdVOXjRrwKmPfW30EfqWW4q/r8jxEOkq+ASbNpi6h+moIzSJjTxytIuxVhGfePXd6Xcg1occ6DzUVEUIrtukE3pmxbwYetOX+eubf5f1isxkpq/O4SMJirfESAkX0LoznKdCtji/bzSGDy9XgfuHQCJC1/3fBy9IZlqcOndBfMsujGIKM6gf87g= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:12:10.4391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eed45764-a353-4fa3-eb93-08d6b3a083cd X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB5361 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 Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 0f8cca27c183..cd6bdf71e533 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -7,7 +7,7 @@ /* * Driver version */ -#define QLA2XXX_VERSION "10.01.00.15-k" +#define QLA2XXX_VERSION "10.01.00.16-k" #define QLA_DRIVER_MAJOR_VER 10 #define QLA_DRIVER_MINOR_VER 1