From patchwork Tue Apr 2 21:24:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882345 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 13F94922 for ; Tue, 2 Apr 2019 21:25:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF4A0288BA for ; Tue, 2 Apr 2019 21:25:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E06E1288D2; Tue, 2 Apr 2019 21:25: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 6BB97288BA for ; Tue, 2 Apr 2019 21:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfDBVZp (ORCPT ); Tue, 2 Apr 2019 17:25:45 -0400 Received: from mail-eopbgr730047.outbound.protection.outlook.com ([40.107.73.47]:14528 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726637AbfDBVZo (ORCPT ); Tue, 2 Apr 2019 17:25:44 -0400 Received: from BN8PR07CA0012.namprd07.prod.outlook.com (2603:10b6:408:ac::25) by SN6PR07MB5375.namprd07.prod.outlook.com (2603:10b6:805:74::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 21:25:42 +0000 Received: from CO1NAM05FT044.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::208) by BN8PR07CA0012.outlook.office365.com (2603:10b6:408:ac::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:25:41 +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 CO1NAM05FT044.mail.protection.outlook.com (10.152.96.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:25:41 +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; Tue, 2 Apr 2019 14:24:38 -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 x32LOc3i028508; Tue, 2 Apr 2019 14:24:38 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOcu9028507; Tue, 2 Apr 2019 14:24:38 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 01/15] qla2xxx: Set the SCSI command result before calling the command done Date: Tue, 2 Apr 2019 14:24:20 -0700 Message-ID: <20190402212434.28469-2-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139417418409;(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)(136003)(39860400002)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(106466001)(42186006)(51416003)(47776003)(8676002)(53936002)(50466002)(85426001)(2616005)(36756003)(80596001)(126002)(1076003)(81166006)(4326008)(69596002)(97736004)(476003)(486006)(48376002)(11346002)(446003)(81156014)(336012)(68736007)(54906003)(36906005)(110136005)(8936002)(498600001)(76176011)(50226002)(86362001)(305945005)(2906002)(6666004)(87636003)(316002)(356004)(5660300002)(26005)(26826003)(16586007)(105606002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5375;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: 6103fc50-407d-44ad-064f-08d6b7b1c246 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5375; X-MS-TrafficTypeDiagnostic: SN6PR07MB5375: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: AUoVFBkvrQ583H7XmcFa5a/iGTxJ5pguaJtY2WNHUyqkkx2bl5VgB/m42tLE1C1BcigXpyjkPTnR+8PkZ5NQZ1JSaxEqdMmmRZiFw21SjsMObpS+su6ki+fi4TgpG68t0MHYFVmywVpbEweOhQqG+iBB9k670C/iT3yi9Q9cLyQ6awFUmSlrg2N1YxwBQogUGiBRpoUCn3+MSLMRmL8NIKLRcVxVzLqbHkLPiGZG6Fcu+3h7NIZ7j9YVg5tyFvZTMFgYT81Atdi4E4pLhKRBVs31An4g2rhTKsgQ9ldzvjlIYOMb6/gBk6Y/JSz1W7Gs8m5GCGZi47bWsfU2litJPKsnzinlrDgUl9lS6y+qRsTM66JicdrjZzDEXE5qIeN90b270Ff7Op5Ez4Aesu76MFLLyzljWwxbhFz7V0YvdRo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:25:41.2934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6103fc50-407d-44ad-064f-08d6b7b1c246 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: SN6PR07MB5375 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 tries to address race condition between abort handler and completion handler. When scsi command result is set by both abort and completion handler, scsi_done() is only called after refcount on SRB structure goes to zero. The abort handler sets this result prematurely even when the refcount is non-zero value. Fix this by setting 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 cad93c34409b..dde13036b06a 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 Tue Apr 2 21:24:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882349 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 DCF72922 for ; Tue, 2 Apr 2019 21:25:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C782A288BA for ; Tue, 2 Apr 2019 21:25:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBD09288D2; Tue, 2 Apr 2019 21:25:49 +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 659A2288BA for ; Tue, 2 Apr 2019 21:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbfDBVZt (ORCPT ); Tue, 2 Apr 2019 17:25:49 -0400 Received: from mail-eopbgr800080.outbound.protection.outlook.com ([40.107.80.80]:38206 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726328AbfDBVZs (ORCPT ); Tue, 2 Apr 2019 17:25:48 -0400 Received: from BYAPR07CA0082.namprd07.prod.outlook.com (2603:10b6:a03:12b::23) 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; Tue, 2 Apr 2019 21:25:47 +0000 Received: from CO1NAM05FT036.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::202) by BYAPR07CA0082.outlook.office365.com (2603:10b6:a03:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:25:46 +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 CO1NAM05FT036.mail.protection.outlook.com (10.152.96.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:25:46 +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; Tue, 2 Apr 2019 14:24:41 -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 x32LOfLT028512; Tue, 2 Apr 2019 14:24:41 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOfJs028511; Tue, 2 Apr 2019 14:24:41 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 02/15] qla2xxx: Set the qpair in SRB to NULL when SRB is released Date: Tue, 2 Apr 2019 14:24:21 -0700 Message-ID: <20190402212434.28469-3-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139466702394;(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)(105606002)(486006)(126002)(53936002)(2616005)(1076003)(476003)(26826003)(76176011)(36906005)(446003)(85426001)(356004)(87636003)(6666004)(47776003)(26005)(48376002)(5660300002)(11346002)(2906002)(50466002)(4744005)(8676002)(81156014)(36756003)(106466001)(51416003)(305945005)(81166006)(8936002)(42186006)(336012)(54906003)(50226002)(80596001)(69596002)(110136005)(86362001)(316002)(68736007)(16586007)(4326008)(97736004)(498600001);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: 7d71e487-4c5a-4828-6bea-08d6b7b1c540 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2538; X-MS-TrafficTypeDiagnostic: CY1PR07MB2538: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: sujmChkfk4WDn3OjwunZdYm3VY5CVAlPsSBaEnEBRSCBTvdgicJFH/t5sM2mvx93aIttq0Sye4yXbaxVCyIdJu2Cpy4tAtOQacvMGSxqFiN4DYUwW4XucpEaoi/UpCM1i0OpuouRn5yP7Fuqjga/20c9kIgeZujkNzifNAiIYP/iJ0M29g3IfDB7nqxUTB4OqHrYjhj2Dx1gkW7xMYnHxjm4/6WgDaDOc9/YN/D72BFkSTBiz3E6W/1NgFERgza2n/fPLyKqSqBajUg3v48aD3e9YxFakDUWCcfr4+WNXc3l/4hNj5dtjLRDZ1I4D2p5mx/W0rtbFYo1d/Vn2Hd5fwfMt/RDbTQmO6mtA1RpxwHPklLSIVCpt0K1feyBUauxgB7Vf0a4yESuTLt+Ra/4mPrF9EjRnD/+93PS/Jz8eiU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:25:46.3049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d71e487-4c5a-4828-6bea-08d6b7b1c540 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: Giridhar Malavali This patch sets QPair pointer to NULL to prevent abort command racing ahead of normal command completion handling during scsi_done call. 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 Tue Apr 2 21:24:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882353 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 AAB5C17E0 for ; Tue, 2 Apr 2019 21:25:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96696288BA for ; Tue, 2 Apr 2019 21:25:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8ACBD288D2; Tue, 2 Apr 2019 21:25:56 +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 3AD53288BA for ; Tue, 2 Apr 2019 21:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbfDBVZ4 (ORCPT ); Tue, 2 Apr 2019 17:25:56 -0400 Received: from mail-eopbgr820052.outbound.protection.outlook.com ([40.107.82.52]:60982 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726328AbfDBVZz (ORCPT ); Tue, 2 Apr 2019 17:25:55 -0400 Received: from DM5PR07CA0084.namprd07.prod.outlook.com (2603:10b6:4:ad::49) by BN3PR07MB2529.namprd07.prod.outlook.com (2a01:111:e400:7bbf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 21:25:53 +0000 Received: from CO1NAM05FT038.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::208) by DM5PR07CA0084.outlook.office365.com (2603:10b6:4:ad::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:25: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 CO1NAM05FT038.mail.protection.outlook.com (10.152.96.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; Tue, 2 Apr 2019 21:25:52 +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; Tue, 2 Apr 2019 14:24:44 -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 x32LOiBH028516; Tue, 2 Apr 2019 14:24:44 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOiPn028515; Tue, 2 Apr 2019 14:24:44 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 03/15] qla2xxx: Reset the FCF_ASYNC_{SENT|ACTIVE} flags Date: Tue, 2 Apr 2019 14:24:22 -0700 Message-ID: <20190402212434.28469-4-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139528260310;(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)(39860400002)(136003)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(81156014)(68736007)(81166006)(305945005)(47776003)(8676002)(50226002)(85426001)(14444005)(336012)(2906002)(8936002)(105606002)(86362001)(4326008)(53936002)(446003)(106466001)(36756003)(356004)(6666004)(51416003)(80596001)(48376002)(50466002)(87636003)(76176011)(126002)(476003)(2616005)(69596002)(11346002)(498600001)(26826003)(26005)(1076003)(42186006)(16586007)(316002)(5660300002)(486006)(97736004)(54906003)(36906005)(110136005)(83133001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2529;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: ead80bb4-f3dd-4761-057f-08d6b7b1c8f7 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2529; X-MS-TrafficTypeDiagnostic: BN3PR07MB2529: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: x3E0N2rfeyG53apyGorqbcSA1g3wY0atjHLESdbScmvcq+CgS57NVqvDN8InH1f+VmRVjb00UsB/GM4bx6XKRpLzc4ODZwpxFdpLVsQw9NI9IhNhEFCwRQmf7tv7BQ/nYes2doiI3dC/bAeI5XdvWl3R1q8oSAZ3u50zAIxIh4Tv2840xtqMDEi/kNv4AFTIAn0Di+g2BodTY7MHWt4nK5N0KZuOs1LDUVL4s7zuDArCdH/7ypD5ZrJNZKTZ1E60r7j2AubY9inBgaSuSQHWC/7jVAnMK+DLeIVjkBGVhE7QlnUxS93nBXJH1+6ARtxQdFy6dppfsG92pWkQ0vDBUcXJ9If4WZiPtd6ukmVct8a+8qf3dwovOng0TuCx18ugZuDpEBHcRg1I7+oh1bRCoaUbRQK1ud4gpUf/yT2JE/k= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:25:52.5298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ead80bb4-f3dd-4761-057f-08d6b7b1c8f7 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: BN3PR07MB2529 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 Driver maintains state machine for processig and completing switch commands. This patch resets FCF_ASYNC_{SENT|ACTIVE} flag to indicate if the previous command is active or sent, in order for next GPSC command to advance the state machine. 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 Tue Apr 2 21:24:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882351 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 42A5817E0 for ; Tue, 2 Apr 2019 21:25:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CF00288BA for ; Tue, 2 Apr 2019 21:25:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 213A7288D2; Tue, 2 Apr 2019 21:25:55 +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 BCFED288BA for ; Tue, 2 Apr 2019 21:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbfDBVZy (ORCPT ); Tue, 2 Apr 2019 17:25:54 -0400 Received: from mail-eopbgr710071.outbound.protection.outlook.com ([40.107.71.71]:3636 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726328AbfDBVZy (ORCPT ); Tue, 2 Apr 2019 17:25:54 -0400 Received: from DM5PR07CA0050.namprd07.prod.outlook.com (2603:10b6:4:ad::15) 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.1750.20; Tue, 2 Apr 2019 21:25:52 +0000 Received: from CO1NAM05FT038.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::205) by DM5PR07CA0050.outlook.office365.com (2603:10b6:4:ad::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:25:51 +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 CO1NAM05FT038.mail.protection.outlook.com (10.152.96.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; Tue, 2 Apr 2019 21:25: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; Tue, 2 Apr 2019 14:24:48 -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 x32LOliD028520; Tue, 2 Apr 2019 14:24:47 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOlBd028519; Tue, 2 Apr 2019 14:24:47 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 04/15] qla2xxx: Increase the max_sgl_segments to 1024 Date: Tue, 2 Apr 2019 14:24:23 -0700 Message-ID: <20190402212434.28469-5-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139517241420;(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)(346002)(396003)(136003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(2616005)(5660300002)(105606002)(446003)(486006)(126002)(476003)(11346002)(50466002)(86362001)(53936002)(4326008)(48376002)(76176011)(81166006)(2906002)(81156014)(97736004)(8676002)(14444005)(47776003)(16586007)(42186006)(54906003)(85426001)(50226002)(110136005)(51416003)(80596001)(87636003)(498600001)(26826003)(316002)(305945005)(68736007)(8936002)(6666004)(356004)(1076003)(336012)(106466001)(36756003)(4744005)(26005)(69596002)(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: f107840b-2f6c-41cc-966c-08d6b7b1c843 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5376; X-MS-TrafficTypeDiagnostic: SN6PR07MB5376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: Lr8zMFZXXdkEQ9WYLkbBWs7D+REtZOz1Mhl/8oWRf7aQhRf3Z8kx02c/CpXpA9jzWi1AYle1PbIuXqry5ZQThgCwes5zoD/DjVIoiTdGdbSp4bBSZYD8Pn5vdT36SNnIgcyINZQonTmbFuJjWl3fVFLRTWXksnqi4ydWX2Fhmot1jt1XGLpovSPjxMWt2C+adQiQ6szyHM7v7DUxsx46vMFO8z1lF8N9Uw8uuCKlwovJq/8IR0vmygCWZbfwDQwLt/Midt3MwecSZwvdJt7QVUG82+GTe3SgDzmfLi0BQHnCYX9UtwowK2xafCgMj6vq/KxJHQ81gW2ye89coYWzFUJ60WljGJpZjIsa8hGnn0KKkJ9i39p7txoURjShcG9xi005sHqZ6X8UCsMZxQQBxB8kSoIeoOuedXcSQbtJm3Y= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:25:51.3628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f107840b-2f6c-41cc-966c-08d6b7b1c843 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 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 Tue Apr 2 21:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882355 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 5086C922 for ; Tue, 2 Apr 2019 21:25:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BD4A288BA for ; Tue, 2 Apr 2019 21:25:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3058F288D2; Tue, 2 Apr 2019 21:25:59 +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 D83A5288BA for ; Tue, 2 Apr 2019 21:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfDBVZ6 (ORCPT ); Tue, 2 Apr 2019 17:25:58 -0400 Received: from mail-eopbgr710071.outbound.protection.outlook.com ([40.107.71.71]:55607 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726656AbfDBVZ6 (ORCPT ); Tue, 2 Apr 2019 17:25:58 -0400 Received: from BN8PR07CA0034.namprd07.prod.outlook.com (2603:10b6:408:ac::47) 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.1750.22; Tue, 2 Apr 2019 21:25:57 +0000 Received: from CO1NAM05FT020.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::204) by BN8PR07CA0034.outlook.office365.com (2603:10b6:408:ac::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:25: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 CO1NAM05FT020.mail.protection.outlook.com (10.152.96.128) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:25:56 +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; Tue, 2 Apr 2019 14:24:51 -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 x32LOo5V028524; Tue, 2 Apr 2019 14:24:50 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOooX028523; Tue, 2 Apr 2019 14:24:50 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 05/15] qla2xxx: Disable T10-DIF feature with FC-NVMe during probe Date: Tue, 2 Apr 2019 14:24:24 -0700 Message-ID: <20190402212434.28469-6-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139566029048;(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)(376002)(39860400002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(36756003)(5660300002)(486006)(6666004)(356004)(126002)(446003)(11346002)(476003)(42186006)(76176011)(16586007)(2616005)(80596001)(498600001)(26826003)(110136005)(54906003)(36906005)(87636003)(51416003)(14444005)(316002)(69596002)(336012)(26005)(86362001)(68736007)(53936002)(47776003)(50226002)(8936002)(8676002)(305945005)(4326008)(105606002)(2906002)(85426001)(81166006)(81156014)(50466002)(48376002)(1076003)(97736004)(106466001)(4744005);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: 8344bcb7-ecca-460b-2651-08d6b7b1cb30 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2537; X-MS-TrafficTypeDiagnostic: CY1PR07MB2537: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: Qec335X2GtVnfCWDH1LoQGj1ByGQxRj9criUTJWVYx0Y0GlgWNqZq1SxRENQY6hkz1VfsOmMxi1rqMD79KQCPe8ZD2PVV5d53CWthHt0JvqZtKqXnBbRRzjt9ordlFEeR71DyHZimbUZ3HdbOYWAAfSL/kgEc5pe8EZW0ttn4pgh8yWItz1cN53ceMEPxsUpzOIvOuWIUO2o/E/JKgLaktul0GwS5L5BiCBQ9YE5eoNr8oc9lvKs482nDCqeutRCYuctJil2Bjpnu3a4bRnrFHdrZGCMHGB7RltbCWL8cI8aKXALWJrtqNu8gwhjLDOKNz6bIknc9FbyJMEI4r4Bq7UvNGcyzzf3PRFxbXMnbx9ZaKahPsrxMRqRRyUmFxZ9JXOKQiAjOUEYR0MNIUTZIF0BZa8y3bv8Q76orJMPA/4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:25:56.2646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8344bcb7-ecca-460b-2651-08d6b7b1cb30 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 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 dde13036b06a..04c2309a6369 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 Tue Apr 2 21:24:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882357 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 D358F17E0 for ; Tue, 2 Apr 2019 21:26:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC79C288BA for ; Tue, 2 Apr 2019 21:26:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B102D288D2; Tue, 2 Apr 2019 21:26: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 5EA03288BA for ; Tue, 2 Apr 2019 21:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbfDBV0F (ORCPT ); Tue, 2 Apr 2019 17:26:05 -0400 Received: from mail-eopbgr710057.outbound.protection.outlook.com ([40.107.71.57]:47930 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726083AbfDBV0E (ORCPT ); Tue, 2 Apr 2019 17:26:04 -0400 Received: from CO2PR07CA0073.namprd07.prod.outlook.com (2603:10b6:100::41) by BN3PR07MB2529.namprd07.prod.outlook.com (2a01:111:e400:7bbf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 21:26:02 +0000 Received: from CO1NAM05FT056.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::206) by CO2PR07CA0073.outlook.office365.com (2603:10b6:100::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22 via Frontend Transport; Tue, 2 Apr 2019 21:26: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 CO1NAM05FT056.mail.protection.outlook.com (10.152.96.172) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:01 +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; Tue, 2 Apr 2019 14:24:54 -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 x32LOsj1028528; Tue, 2 Apr 2019 14:24:54 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOsGn028527; Tue, 2 Apr 2019 14:24:54 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 06/15] qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines. Date: Tue, 2 Apr 2019 14:24:25 -0700 Message-ID: <20190402212434.28469-7-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139617515773;(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)(39860400002)(136003)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(81156014)(68736007)(81166006)(305945005)(47776003)(8676002)(50226002)(85426001)(336012)(2906002)(8936002)(105606002)(86362001)(4326008)(53936002)(446003)(106466001)(36756003)(356004)(6666004)(51416003)(80596001)(48376002)(50466002)(87636003)(76176011)(126002)(476003)(2616005)(69596002)(11346002)(498600001)(26826003)(26005)(1076003)(42186006)(16586007)(316002)(5660300002)(486006)(97736004)(54906003)(36906005)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2529;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: 23e87eee-565f-43ac-5c15-08d6b7b1ce3b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2529; X-MS-TrafficTypeDiagnostic: BN3PR07MB2529: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: i1oTymHwFlkzfOn6Dftcp81Oy6JTNoabC4IWB6VAFyjJHhoRgdEiUEqTDrVioFGEtXGe4/MfqRDhasKO5ETOye6MvQ1QFpdjQq56Bt2zrV+X2Mp3xsF4w7n1pG7UPI8d4jUd25lksLCyA/fHUk7kw/zqWjoSYzbInpRU2D32mktvEhbPiqgfPO+o2akIVuliLvG1LQlc1qAHhZaeoEYTI7brZeOu/cj93SLm6qACUv5pKnBmzOX9PRyado7DbMuR2lMR87Knc2y76WC2Ve63Pic6PHonD5coISfAWBJ04xO5qqNmAqequE00n3w+m4DTNGEXTeU8E3wQfpwmrcgt8Dg20VPn+e5saF0Ail7rEWnA6rvAnBpKzbwQ5/mYtOrp502dibllbPTmZ3l3XnwU+Mca2Hl4/HfT/4XBBAXci98= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:01.3692 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23e87eee-565f-43ac-5c15-08d6b7b1ce3b 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: BN3PR07MB2529 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 Tue Apr 2 21:24:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882359 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 51C3417E0 for ; Tue, 2 Apr 2019 21:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1B5288BA for ; Tue, 2 Apr 2019 21:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E927288D2; Tue, 2 Apr 2019 21:26: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 BD2A2288BA for ; Tue, 2 Apr 2019 21:26:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726409AbfDBV0K (ORCPT ); Tue, 2 Apr 2019 17:26:10 -0400 Received: from mail-eopbgr790047.outbound.protection.outlook.com ([40.107.79.47]:47244 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726083AbfDBV0K (ORCPT ); Tue, 2 Apr 2019 17:26:10 -0400 Received: from DM5PR07CA0067.namprd07.prod.outlook.com (2603:10b6:4:ad::32) by SN6PR07MB5375.namprd07.prod.outlook.com (2603:10b6:805:74::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 21:26:08 +0000 Received: from CO1NAM05FT028.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::207) by DM5PR07CA0067.outlook.office365.com (2603:10b6:4:ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:26:07 +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 CO1NAM05FT028.mail.protection.outlook.com (10.152.96.138) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:07 +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; Tue, 2 Apr 2019 14:24:57 -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 x32LOv6g028532; Tue, 2 Apr 2019 14:24:57 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LOv43028531; Tue, 2 Apr 2019 14:24:57 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 07/15] qla2xxx: Further limit FLASH region write access from SysFS Date: Tue, 2 Apr 2019 14:24:26 -0700 Message-ID: <20190402212434.28469-8-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139678191296;(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)(136003)(39860400002)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(106466001)(42186006)(51416003)(47776003)(8676002)(53936002)(50466002)(85426001)(2616005)(36756003)(80596001)(126002)(1076003)(81166006)(4326008)(69596002)(97736004)(476003)(486006)(48376002)(11346002)(446003)(81156014)(336012)(68736007)(54906003)(36906005)(110136005)(8936002)(498600001)(14444005)(76176011)(50226002)(86362001)(305945005)(2906002)(6666004)(87636003)(316002)(356004)(5660300002)(26005)(26826003)(16586007)(105606002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5375;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: 0ec9de6a-68df-4683-f06c-08d6b7b1d1e6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5375; X-MS-TrafficTypeDiagnostic: SN6PR07MB5375: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: HlhUwk+LKh/XW5ywha5Byfwjvs0N0yjLjZfuH1uHbtaMTU4tbWZ79YnhJbbCVz7EiHAqrF/g+308Kb+JoEQMswBQbR9nSAAsuFHrbdA5i5mD4aTx+tARPIQZLZQ6nQ7wZQ2dIA68XazBCFUxKo9Qs4eOEBDDQGD6NTWyuR9kAdOmcgtbPjXSlBTKBMzhNy+/yns/YPZIUIJHX0R8KuVrHnSJi9h5aAFtuVLzUYTedLWeGT7UwuDBHP1QyNM9wdxWue7bfj5XBXvpDbouwEMvMJV3gMbc54I/oPYNSX/e2Rk/1vhkQ7GkRUt7zSOgApCEmHUbeDHAWY6cuNeXF9zt1bfyAqai2BC6rz2qrBdqgQYZxkksFQyzJW6sx47CzmCXAcaLo1f/4J1JgcebI0PmIrwCfjuRELYsY0maJNRpL2Q= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:07.5248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ec9de6a-68df-4683-f06c-08d6b7b1d1e6 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: SN6PR07MB5375 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 Tue Apr 2 21:24:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882375 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 1E6E3922 for ; Tue, 2 Apr 2019 21:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05655288BA for ; Tue, 2 Apr 2019 21:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED7FB288D2; Tue, 2 Apr 2019 21:26:49 +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 66452288BA for ; Tue, 2 Apr 2019 21:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbfDBV0t (ORCPT ); Tue, 2 Apr 2019 17:26:49 -0400 Received: from mail-eopbgr800049.outbound.protection.outlook.com ([40.107.80.49]:37408 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726329AbfDBV0s (ORCPT ); Tue, 2 Apr 2019 17:26:48 -0400 Received: from DM5PR07CA0067.namprd07.prod.outlook.com (2603:10b6:4:ad::32) by BN7PR07MB5362.namprd07.prod.outlook.com (2603:10b6:408:2e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 21:26:07 +0000 Received: from CO1NAM05FT028.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::207) by DM5PR07CA0067.outlook.office365.com (2603:10b6:4:ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:26: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 CO1NAM05FT028.mail.protection.outlook.com (10.152.96.138) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26: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; Tue, 2 Apr 2019 14:25:00 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x32LP0wb028536; Tue, 2 Apr 2019 14:25:00 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LP0HF028535; Tue, 2 Apr 2019 14:25:00 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 08/15] qla2xxx: Fix fw dump corruption Date: Tue, 2 Apr 2019 14:24:27 -0700 Message-ID: <20190402212434.28469-9-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139668063212;(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)(376002)(346002)(39860400002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(498600001)(105606002)(50226002)(336012)(486006)(446003)(53936002)(11346002)(305945005)(1076003)(50466002)(6666004)(2616005)(14444005)(85426001)(8676002)(26005)(476003)(76176011)(51416003)(5660300002)(356004)(36906005)(87636003)(47776003)(80596001)(2906002)(16586007)(36756003)(106466001)(26826003)(81166006)(48376002)(81156014)(68736007)(8936002)(110136005)(316002)(54906003)(42186006)(86362001)(126002)(69596002)(4326008)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5362;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: 3b6dbdf1-04a0-4a03-f1ab-08d6b7b1d140 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5362; X-MS-TrafficTypeDiagnostic: BN7PR07MB5362: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: rmRTCwp0nSbu7RpQs8Uv/ojURHtypC8HKJNdLOAveBPsjo3TZvQBdaKOOWc2FAj0Vf5gxs9/6OPy0qDzuVfjSrjWrFEH3mKjbF7E/rpPrq0bSjiGg9RxPdyStsVF+wOqlfRsR9Opk2kQ46G2N0jABC+PE11/Asy6ioLV81unqfrBtdHyaMNI/r5e57MDZ35ee4kwECobd8en+plfOvILQkXMhHv3upq307fd+1QuEaXwlhcj5HyjSVexzijvBKKQhg5olS1SAYpkZztV5X+PqUudnO8WOKHf/lw5m2eG+E4lpccac+ACuxsBMATvccB6a2IlaBd9+MsBE3o66VZLbFuZNZBhqKAs5Oek0UdU8tMILKJAtkr8iIGMjilNE3sT3VJ3E1eClXbK+HVDBd5gGWi5GmNmpgSuOrdhsv7clhU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:06.3869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b6dbdf1-04a0-4a03-f1ab-08d6b7b1d140 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: BN7PR07MB5362 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 3b81a2aed5ed..57ee2d979efe 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 Tue Apr 2 21:24:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882363 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 98152922 for ; Tue, 2 Apr 2019 21:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83D7E288BA for ; Tue, 2 Apr 2019 21:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 785FA288D2; Tue, 2 Apr 2019 21:26:18 +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 D5634288BA for ; Tue, 2 Apr 2019 21:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbfDBV0R (ORCPT ); Tue, 2 Apr 2019 17:26:17 -0400 Received: from mail-eopbgr720067.outbound.protection.outlook.com ([40.107.72.67]:61520 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV0Q (ORCPT ); Tue, 2 Apr 2019 17:26:16 -0400 Received: from DM5PR07CA0048.namprd07.prod.outlook.com (2603:10b6:3:16::34) by DM5PR07MB4024.namprd07.prod.outlook.com (2603:10b6:4:b2::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 2 Apr 2019 21:26:13 +0000 Received: from CO1NAM05FT022.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::203) by DM5PR07CA0048.outlook.office365.com (2603:10b6:3:16::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:26:13 +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 CO1NAM05FT022.mail.protection.outlook.com (10.152.96.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:12 +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; Tue, 2 Apr 2019 14:25:03 -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 x32LP3hx028540; Tue, 2 Apr 2019 14:25:03 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LP3Dn028539; Tue, 2 Apr 2019 14:25:03 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 09/15] qla2xxx: Use mutex protection during qla2x00_sysfs_read_fw_dump() Date: Tue, 2 Apr 2019 14:24:28 -0700 Message-ID: <20190402212434.28469-10-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139730472418;(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)(376002)(136003)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(1076003)(336012)(85426001)(126002)(14444005)(76176011)(2616005)(476003)(50466002)(11346002)(486006)(5660300002)(26826003)(48376002)(356004)(81156014)(305945005)(81166006)(47776003)(97736004)(6666004)(16586007)(2906002)(36756003)(36906005)(69596002)(68736007)(86362001)(51416003)(4326008)(80596001)(53936002)(498600001)(26005)(8676002)(87636003)(110136005)(54906003)(446003)(50226002)(105606002)(106466001)(316002)(8936002)(42186006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB4024;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: dbdf211c-9b6b-4f89-88c7-08d6b7b1d504 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB4024; X-MS-TrafficTypeDiagnostic: DM5PR07MB4024: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: V8WNRr1fQvtjJcUReVNvRGBtzou34uSIuifjUJL4AiTXTmnbBPBOC0gQ4IEf2NE9fZCXrTIDRqYIq3AFKdU5jm7bWwS6GRREFd3HdrniZtnIliDTnCbFBPyJZkckdVrMdb6b40oX5x4RN49FnCK8F8TbnWQYL12fjDsxOGmnhTQz/G1Gi1pIzpyUHEWJth++JjnpE6YU/FCBeWelgxOKWwaSEPAEUxheULUjXGcGJUrNea1Lcr/mnz+RKJt3J0BUkwsHvNL050DBkFWTf4S/7h0JOsSepFFn3WL60KjS5X6SbM0FUZ3rlqNsliUvYNJ5Dz897r8LKJaE8sivPiwa3p48PGaglS89THWbVhph+mDlf5sTedu4mgSJlCdtY//Sgbb3np10LEvtiqwkuOvyWnUxJbm5GcnYbDZTiEXpPSM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:12.7520 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbdf211c-9b6b-4f89-88c7-08d6b7b1d504 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: DM5PR07MB4024 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 57ee2d979efe..ab212b4853a1 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 Tue Apr 2 21:24:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882361 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 8FF10922 for ; Tue, 2 Apr 2019 21:26:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AF01288BA for ; Tue, 2 Apr 2019 21:26:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F50B288D2; Tue, 2 Apr 2019 21:26:17 +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 1E0AB288BA for ; Tue, 2 Apr 2019 21:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfDBV0Q (ORCPT ); Tue, 2 Apr 2019 17:26:16 -0400 Received: from mail-eopbgr710083.outbound.protection.outlook.com ([40.107.71.83]:8734 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725990AbfDBV0Q (ORCPT ); Tue, 2 Apr 2019 17:26:16 -0400 Received: from DM5PR07CA0047.namprd07.prod.outlook.com (2603:10b6:3:16::33) by BN3PR07MB2529.namprd07.prod.outlook.com (2a01:111:e400:7bbf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 21:26:12 +0000 Received: from CO1NAM05FT022.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::207) by DM5PR07CA0047.outlook.office365.com (2603:10b6:3:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.18 via Frontend Transport; Tue, 2 Apr 2019 21:26: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 CO1NAM05FT022.mail.protection.outlook.com (10.152.96.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:11 +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; Tue, 2 Apr 2019 14:25:06 -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 x32LP6gm028544; Tue, 2 Apr 2019 14:25:06 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LP6iC028543; Tue, 2 Apr 2019 14:25:06 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 10/15] qla2xxx: Cleanup fcport memory to prevent leak Date: Tue, 2 Apr 2019 14:24:29 -0700 Message-ID: <20190402212434.28469-11-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139717850726;(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)(39860400002)(136003)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(81156014)(68736007)(81166006)(305945005)(47776003)(8676002)(50226002)(85426001)(336012)(2906002)(8936002)(105606002)(86362001)(4326008)(53936002)(446003)(106466001)(36756003)(356004)(6666004)(51416003)(80596001)(48376002)(50466002)(87636003)(76176011)(126002)(476003)(2616005)(69596002)(11346002)(498600001)(26826003)(26005)(1076003)(42186006)(16586007)(316002)(5660300002)(486006)(97736004)(54906003)(36906005)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2529;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: 4835f7e2-09f8-4bbb-ddf8-08d6b7b1d42e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2529; X-MS-TrafficTypeDiagnostic: BN3PR07MB2529: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: bntH4x+ca0/Wwv9I1og8OK847Svhcg5N+XDZzBBThQYdakoMOPmySFGG3wo1fKvLP6hMm9gURyu+DHuOgLPdloU+RkyguPfdQjWlH3IdBTcozZCGB252UOQ9JpgJQJBFPcTeYUxZNHXi4cDK5oCkNikKAvCl9p8WJV2zLj/IqTSNjlavdunakManr6cGMhc8PoSUGrxg9iEHywTKsvoogt0u82r8QyRYO1YVS8/VvYbYoRmg/rne1mzaJdLzgeHnXX4mhLdnQC/MIACbPiuctqyBuXMiF4TyDSdMgXNPodrKlqP2dHgu5xH2x6iE2bxon09gVqydoxhy8QJHDhcWb/d6c7bqq8UippAvZ3MzrjrUrlM60w5J3E7x+ttfpPNBCz+ZBumQoI2GOwdx5E9zVygFOh8PUxE1wibk9onQINk= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:11.3567 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4835f7e2-09f8-4bbb-ddf8-08d6b7b1d42e 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: BN3PR07MB2529 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 ab212b4853a1..7bdf1e45d891 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 04c2309a6369..09e0e9d04205 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 Tue Apr 2 21:24:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882367 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 49FFE17E0 for ; Tue, 2 Apr 2019 21:26:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F5B288BA for ; Tue, 2 Apr 2019 21:26:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A8E6288D2; Tue, 2 Apr 2019 21:26:21 +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 C730B288BA for ; Tue, 2 Apr 2019 21:26:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbfDBV0U (ORCPT ); Tue, 2 Apr 2019 17:26:20 -0400 Received: from mail-eopbgr780089.outbound.protection.outlook.com ([40.107.78.89]:39592 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726412AbfDBV0U (ORCPT ); Tue, 2 Apr 2019 17:26:20 -0400 Received: from DM6PR07CA0028.namprd07.prod.outlook.com (2603:10b6:5:94::41) by SN6PR07MB5373.namprd07.prod.outlook.com (2603:10b6:805:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Tue, 2 Apr 2019 21:26:17 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::200) by DM6PR07CA0028.outlook.office365.com (2603:10b6:5:94::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:26:17 +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 CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:17 +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; Tue, 2 Apr 2019 14:25:10 -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 x32LP9lW028548; Tue, 2 Apr 2019 14:25:09 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LP9sB028547; Tue, 2 Apr 2019 14:25:09 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 11/15] qla2xxx: Set remote port devloss timeout to 0 Date: Tue, 2 Apr 2019 14:24:30 -0700 Message-ID: <20190402212434.28469-12-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139776406292;(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)(376002)(346002)(136003)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(85426001)(316002)(356004)(6666004)(106466001)(105606002)(476003)(36756003)(446003)(336012)(2616005)(69596002)(2906002)(1076003)(11346002)(8936002)(26005)(97736004)(86362001)(80596001)(81156014)(305945005)(50226002)(53936002)(81166006)(87636003)(51416003)(126002)(4326008)(47776003)(76176011)(36906005)(498600001)(54906003)(16586007)(42186006)(486006)(8676002)(48376002)(110136005)(68736007)(26826003)(50466002)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5373;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: c99e00a9-b8c8-416b-94f7-08d6b7b1d7c1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5373; X-MS-TrafficTypeDiagnostic: SN6PR07MB5373: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: 9qCbym94NpOvjKp51esSoB3xJcSpxeIeDNg2yZqETtF4foUnfCK7pKRyH6XebPa9j0udpvqLwI3fUSHNRsR3pIAhjB5rijFeRNXHj5X1V11n01cvRqtTluL+JLADDrw3AT2PBAJNg/BN0zbii/PVzhwxY9oqvoCGPfieYunRznDAd8x9pgKtSKgpOfC/lWDseXom8xlA4F8rSNzadUqP1X/NyLIDeIptW7kfZajqUwA8xxjlx5E/JGmflht6EAMbaRhPZn2KF3TjxlknE9toKGHVGpwpieDfJU0svMYApijeAOSodLy6QQ79DdMblBTtHKulz9QzhlyepNh5WHPeq0X4prCfpMnsJivzqk+ditH98IkCoHj9LFr1nNTfnCutjg0sMRGsmy9xlfYs7EzBIxnOUEeYVEn70mM+lEEfFqU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:17.3464 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c99e00a9-b8c8-416b-94f7-08d6b7b1d7c1 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: SN6PR07MB5373 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 Tue Apr 2 21:24:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882369 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 8ACE5922 for ; Tue, 2 Apr 2019 21:26:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75EC7288BA for ; Tue, 2 Apr 2019 21:26:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A418288D2; Tue, 2 Apr 2019 21:26:23 +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 0D766288BA for ; Tue, 2 Apr 2019 21:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbfDBV0W (ORCPT ); Tue, 2 Apr 2019 17:26:22 -0400 Received: from mail-eopbgr680087.outbound.protection.outlook.com ([40.107.68.87]:34465 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV0U (ORCPT ); Tue, 2 Apr 2019 17:26:20 -0400 Received: from DM6PR07CA0028.namprd07.prod.outlook.com (2603:10b6:5:94::41) by DM6PR07MB5372.namprd07.prod.outlook.com (2603:10b6:5:44::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.19; Tue, 2 Apr 2019 21:26:18 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::200) by DM6PR07CA0028.outlook.office365.com (2603:10b6:5:94::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:26:18 +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 CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:18 +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; Tue, 2 Apr 2019 14:25:10 -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 x32LPADx028552; Tue, 2 Apr 2019 14:25:10 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LPALs028551; Tue, 2 Apr 2019 14:25:10 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 12/15] qla2xxx: Cleanup redundant qla2x00_abort_all_cmds during unload Date: Tue, 2 Apr 2019 14:24:31 -0700 Message-ID: <20190402212434.28469-13-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139785002988;(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)(376002)(346002)(39860400002)(136003)(396003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(97736004)(16586007)(446003)(80596001)(36906005)(54906003)(1076003)(105606002)(336012)(42186006)(8676002)(11346002)(81156014)(81166006)(53936002)(316002)(110136005)(498600001)(476003)(2616005)(87636003)(8936002)(126002)(5660300002)(2906002)(36756003)(50226002)(76176011)(48376002)(4326008)(486006)(26826003)(86362001)(14444005)(356004)(6666004)(305945005)(68736007)(51416003)(47776003)(106466001)(26005)(85426001)(4744005)(50466002)(69596002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB5372;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: 54ac8e24-f33c-43eb-c17a-08d6b7b1d844 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB5372; X-MS-TrafficTypeDiagnostic: DM6PR07MB5372: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: gPYCIKAwxjTSULQWdfCJBuzSRQhyngOyS+xpIcyLddwBGpVZfbjTpVFPl0O1BOcRbSeSZbrzn00BnGKjLfYFUcBLOooy8dlTKPVjuHUC84JeWx2kGkHzbqSe1SIh3uLnAiMKer1hlsaJTqkOTgcUqcYa17cQIz7pLFmYUFoelEdVzXDKaomXUgy3YFpkiP6bpJtw5Z7RwF0auKzqGmaRN/Vf9GhOUDkdiRSSk/M4+tvFaOgo/e4KBTGVVac4eartnpbQw+Dfc/Bhe2tbvCC3Oa6ZSYQN5XSBrjbD11lnEJ9/yHfF1Iu0/n26Ts/BF748LPBX0wGghYJM+AK+NvslXT/eycla21xP/0etFL9SNeyyBd9VCURR/Mst17V5ERorhe0wnUZz4z4uEiZ5n4TxiIKULwYOy8wdgmx4j7aOHys= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:18.2060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54ac8e24-f33c-43eb-c17a-08d6b7b1d844 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: DM6PR07MB5372 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 09e0e9d04205..0c9d2cc5fcc9 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 Tue Apr 2 21:24:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882365 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 6DED517E0 for ; Tue, 2 Apr 2019 21:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58219288BA for ; Tue, 2 Apr 2019 21:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CEEB288D2; Tue, 2 Apr 2019 21:26:20 +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 DC0F5288BA for ; Tue, 2 Apr 2019 21:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfDBV0T (ORCPT ); Tue, 2 Apr 2019 17:26:19 -0400 Received: from mail-eopbgr750050.outbound.protection.outlook.com ([40.107.75.50]:60190 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV0T (ORCPT ); Tue, 2 Apr 2019 17:26:19 -0400 Received: from DM6PR07CA0014.namprd07.prod.outlook.com (2603:10b6:5:94::27) by BN7PR07MB5363.namprd07.prod.outlook.com (2603:10b6:408:2e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Tue, 2 Apr 2019 21:26:16 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::201) by DM6PR07CA0014.outlook.office365.com (2603:10b6:5:94::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:26:16 +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 CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:16 +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; Tue, 2 Apr 2019 14:25:13 -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 x32LPDSt028556; Tue, 2 Apr 2019 14:25:13 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LPDNG028555; Tue, 2 Apr 2019 14:25:13 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 13/15] qla2xxx: Fix driver unload when FC-NVMe LUNs are connected Date: Tue, 2 Apr 2019 14:24:32 -0700 Message-ID: <20190402212434.28469-14-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139766538702;(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)(396003)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(26826003)(47776003)(85426001)(48376002)(4326008)(316002)(498600001)(76176011)(54906003)(42186006)(36906005)(68736007)(87636003)(336012)(476003)(5660300002)(26005)(86362001)(51416003)(16586007)(486006)(2906002)(356004)(8676002)(305945005)(126002)(2616005)(8936002)(50466002)(81166006)(81156014)(110136005)(97736004)(11346002)(53936002)(36756003)(6666004)(80596001)(1076003)(50226002)(106466001)(105606002)(69596002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5363;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: d84c650e-b1f8-4874-d622-08d6b7b1d723 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5363; X-MS-TrafficTypeDiagnostic: BN7PR07MB5363: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: StrymkoGM6x/YJX5MsGNEUbf327b1Gj3bYAsRYPm5mfWMfKY+/tap4RiwiieZwq30DJM66ptAVxza9e8JSv7pd6GUW/eYlyhiozTHqyypASMVG3Nd5Um6yJ/yTa1HNi+cPyAG8nZj9ZLfDYHvj/n6sVrrGM0Cl29qnmY+pON8pggfafyiG2ZYZO6rFZBwjgudUPbP1GyV2lTEJoYBqsK8nmDHGgINK6mLCyxUPSH+Mrf1P1huA1+LTUm8fq2hjkDj1+TzKwnzo271PqKSLUa69zb10YugEVQ3dlZiNLobUKF8tu7p5wgteEn76vMEkpEosJKcFGzTxnk5C1J4VVw1rETevPi4+JlejKahbLQAaHugk6Kh5fCxqP9Kr7EFnfwmZ033gtRadJeq+aXKfSs0EwznAweCRt87ILETNogerA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:16.3116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d84c650e-b1f8-4874-d622-08d6b7b1d723 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: BN7PR07MB5363 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 0c9d2cc5fcc9..a702f90740d0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -6742,8 +6742,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 Tue Apr 2 21:24:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882371 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 46C5417E0 for ; Tue, 2 Apr 2019 21:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EF2C288BA for ; Tue, 2 Apr 2019 21:26:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E238288D2; Tue, 2 Apr 2019 21:26: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 83661288BA for ; Tue, 2 Apr 2019 21:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726682AbfDBV0Z (ORCPT ); Tue, 2 Apr 2019 17:26:25 -0400 Received: from mail-eopbgr710053.outbound.protection.outlook.com ([40.107.71.53]:4664 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV0Z (ORCPT ); Tue, 2 Apr 2019 17:26:25 -0400 Received: from BN8PR07CA0002.namprd07.prod.outlook.com (2603:10b6:408:ac::15) by MW2PR07MB4027.namprd07.prod.outlook.com (2603:10b6:907:6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Tue, 2 Apr 2019 21:26:22 +0000 Received: from CO1NAM05FT064.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::205) by BN8PR07CA0002.outlook.office365.com (2603:10b6:408:ac::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:26:22 +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 CO1NAM05FT064.mail.protection.outlook.com (10.152.96.182) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:21 +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; Tue, 2 Apr 2019 14:25:16 -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 x32LPG1R028560; Tue, 2 Apr 2019 14:25:16 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LPGZO028559; Tue, 2 Apr 2019 14:25:16 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 14/15] qla2xxx: Change abort wait_loop from msleep to wait_event_timeout Date: Tue, 2 Apr 2019 14:24:33 -0700 Message-ID: <20190402212434.28469-15-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139817414285;(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)(199004)(189003)(81156014)(47776003)(11346002)(76176011)(476003)(36756003)(68736007)(498600001)(8676002)(97736004)(26826003)(2616005)(5660300002)(446003)(2906002)(8936002)(50466002)(305945005)(81166006)(85426001)(336012)(14444005)(486006)(53936002)(110136005)(1076003)(356004)(16586007)(26005)(51416003)(126002)(50226002)(86362001)(6666004)(4326008)(54906003)(316002)(105606002)(36906005)(106466001)(87636003)(80596001)(69596002)(42186006)(48376002);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR07MB4027;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: 3741c47d-db93-421f-fbd3-08d6b7b1da2b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:MW2PR07MB4027; X-MS-TrafficTypeDiagnostic: MW2PR07MB4027: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: Pa8mit7LiMHHgBArLdRs4VYDYjDlkWijrXzeXvghg0uxm0Kz+mucnxurpPQuzpvcvSfs5DaQU6tuwqiPj6soEDQqdbAbgrZztaFmmjtxBv2JONix+7u1mT4BUHmsJvZ8jL1ABQoMQ1tNTN5n1ooSObkz6tqgKELabzkur+vn+aBag/PBpUpI9utIT+lZ2Pt9pqLRvHnBYZvgZsCUcHelkn3NTAWiIvLRz3Vihw7e2M6wUUoNjCk16I24VJapageHybSHdHSmqW9updgzoEurkh+eMfIVw84T5PZxJyp5WsEwRzMRdKRqInwhqojVzXn5BH7SKeDldzkY7eVg1wsopH60TGdMsxWx6KaTyEmd75C8bkG2Lsdza3K151GqXg3GmdFa96+c63L58sr1213qKmpFIHIhxdqbf3ENO22xl7w= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:21.3411 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3741c47d-db93-421f-fbd3-08d6b7b1da2b 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: MW2PR07MB4027 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 a702f90740d0..b8ec7eb142f6 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 Tue Apr 2 21:24:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882373 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 566CE17E0 for ; Tue, 2 Apr 2019 21:26:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41AAB288BA for ; Tue, 2 Apr 2019 21:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34C4D288D2; Tue, 2 Apr 2019 21:26:29 +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 D4E3C288BA for ; Tue, 2 Apr 2019 21:26:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfDBV02 (ORCPT ); Tue, 2 Apr 2019 17:26:28 -0400 Received: from mail-eopbgr820042.outbound.protection.outlook.com ([40.107.82.42]:26432 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV02 (ORCPT ); Tue, 2 Apr 2019 17:26:28 -0400 Received: from DM5PR07CA0067.namprd07.prod.outlook.com (2603:10b6:4:ad::32) by BN3PR07MB2529.namprd07.prod.outlook.com (2a01:111:e400:7bbf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Tue, 2 Apr 2019 21:26:26 +0000 Received: from CO1NAM05FT028.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::201) by DM5PR07CA0067.outlook.office365.com (2603:10b6:4:ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16 via Frontend Transport; Tue, 2 Apr 2019 21:26:26 +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 CO1NAM05FT028.mail.protection.outlook.com (10.152.96.138) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:26 +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; Tue, 2 Apr 2019 14:25:19 -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 x32LPJZp028564; Tue, 2 Apr 2019 14:25:19 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LPJ9N028563; Tue, 2 Apr 2019 14:25:19 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 15/15] qla2xxx: Update driver version to 10.01.00.16-k Date: Tue, 2 Apr 2019 14:24:34 -0700 Message-ID: <20190402212434.28469-16-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139865662990;(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)(39860400002)(136003)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(81156014)(68736007)(81166006)(305945005)(47776003)(8676002)(50226002)(85426001)(14444005)(336012)(2906002)(8936002)(105606002)(86362001)(4326008)(53936002)(446003)(106466001)(36756003)(356004)(6666004)(51416003)(80596001)(48376002)(50466002)(87636003)(76176011)(126002)(476003)(2616005)(69596002)(11346002)(498600001)(26826003)(26005)(4744005)(1076003)(42186006)(16586007)(316002)(5660300002)(486006)(97736004)(54906003)(36906005)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2529;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: b95df399-6fe7-4224-87a1-08d6b7b1dd13 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2529; X-MS-TrafficTypeDiagnostic: BN3PR07MB2529: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: 6xh4QCwBKb8Ls0LOXKrk4m2OnLeNyqAsYeCiuefoCr55HSxucnAcv13Kn6vNay/2bGCk5F2BxTgMs9bQSt9TsVtWXD9hWwmO46Fg7c5Uv0CDQfpvEHuJHRv+Rbh7bSkka72hfztD6YHHDklAv5Rw9C1k05R0oezBsS1Mnm8id4J6yBucj3pRbaVzD7v2P8E202CW0O8MOrpupHJc8+r8QMum4xUTKGpyIkXabXCh+S/2foR2VmPu975V0w8QYDcrPsqY/e2c1SebddSESqDOjFOzbGDTs/1fax961Cu8/8wcWu9RXibdz2gRZktDpEwu8GAICSX0Se+3DnOUCawsv6E3gdmqHF5bmB0kNRQccwDsJwHEu5WE7TjfTUPZp0ywi5Nv+WGNH2yTUi7y6mjd+jxLsPIRDAI3buIp8lra6Mw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:26.2720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b95df399-6fe7-4224-87a1-08d6b7b1dd13 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: BN3PR07MB2529 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