From patchwork Thu Dec 28 20:33:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10B8760318 for ; Thu, 28 Dec 2017 20:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 028282AD58 for ; Thu, 28 Dec 2017 20:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB7DE2B3EB; Thu, 28 Dec 2017 20:34: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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 3F2F22AD58 for ; Thu, 28 Dec 2017 20:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754771AbdL1UeR (ORCPT ); Thu, 28 Dec 2017 15:34:17 -0500 Received: from mail-dm3nam03on0056.outbound.protection.outlook.com ([104.47.41.56]:29094 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755185AbdL1UeJ (ORCPT ); Thu, 28 Dec 2017 15:34:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Q7yod8zaZ26x6LfKMTATi+ppDaGi07fF/uQYVCguHxg=; b=dG152fwNaTWsVVtsE/oRmuc7dW6v2IPRo3ESNFMzOWLxDlzG6gvvqWeNyr7XasZRnFuLIS+wPS3X0ydhFJRcW88ZJ/VF6CML7JTWa2eXX3XrkdBsnzcUxAJKm83T7OaE4Th5OnYFeHMEqIxXmovwvoy5sK1qOO2Ikv/twoGUHoc= Received: from SN4PR0701CA0023.namprd07.prod.outlook.com (10.161.192.161) by BY2PR0701MB1944.namprd07.prod.outlook.com (10.163.155.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 28 Dec 2017 20:34:05 +0000 Received: from BN1BFFO11FD006.protection.gbl (2a01:111:f400:7c10::1:149) by SN4PR0701CA0023.outlook.office365.com (2603:10b6:803:28::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:05 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1BFFO11FD006.mail.protection.outlook.com (10.58.144.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:33:44 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Thu, 28 Dec 2017 12:33:49 -0800 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 vBSKXl3B002823; Thu, 28 Dec 2017 12:33:47 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXleF002822; Thu, 28 Dec 2017 12:33:47 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 08/37] qla2xxx: Move work element processing out of DPC thread Date: Thu, 28 Dec 2017 12:33:16 -0800 Message-ID: <20171228203345.2702-9-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(396003)(39850400004)(346002)(39380400002)(2980300002)(448002)(199004)(189003)(50466002)(86362001)(69596002)(80596001)(106466001)(51416003)(47776003)(48376002)(6666003)(36756003)(356003)(81166006)(305945005)(316002)(8936002)(575784001)(5660300001)(16586007)(1076002)(42186006)(2950100002)(54906003)(110136005)(87636003)(478600001)(4326008)(72206003)(2906002)(76176011)(50226002)(81156014)(85326001)(8676002)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1944; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD006; 1:y76zCgpCwnPmwBZquz97T6ke/na/cOOLMw9kh4heUbfyqdTzZaJ3d/64D9gFXFcKlgaVQn1S2dINElboTcezaOsG62lRYupv5Q4BITw6pYY1ybZz47cvFUvPKOa43OK/ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c0b9a11-58b5-4454-4e94-08d54e324a8b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR0701MB1944; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 3:R62MtbXkQq5fs6/6gjNynjAJeJj4l5y5pFLoHD9m5WoFxBGpiODl1k5kXrpYYPL/2JKZv6lcrvrXSbrlLQRsdOI3vGiq2wzeiJdtlJdv1WKmRSP66NYTuMqZk+GX5MyGbHvc2tcqpIqnkmHJlGMNIw46aROaEFoUGsiVtIfqwEcgV8ecif1kLsYva/L8lini3q9WFG1i5q2AQ09hy2OefIbVxXZJhJ3Ur+sLpX8kucqGZSRvxWbU6Zb0idswfOvCWxAkIkqnizFJtDxvpvhnhHToXqWmtAzUv3l1S2zTa75WUzdsnIgCOMVanelwTXfjLy7PYTkyNbIkSRRe8zxURA==; 25:X91uEbaooX+d088Bp5ZcZz/ewaNGFT+g6aJaxZlqYthgq7D0Co3cLHOk3e28DacBwoQ2zCOQ2ERWqHGqMLLwwCQAswyPJ+/70kaBoiDcYf8d2XDdwLTdCe8VXXvnAtFe38JzUDQIq8BOB6b0wm59wjbtNkYvCurM7opl4VAai+DJ4ac3ZhLuyuujT3aSiz7QMpO8nrfh09vbTqOpWDDuRXsGXEZj5Hbq8s8XcOLQFZHP6cDROHmiQf28QPTZIuFCZTUZT5SAXZ462+UEGOnUEEt5ibykKwNKm1JjZSB9js0PnGo/d6R1fKJ4T54RcmHvdOXK8LQnNC9bPMwn1KJnOA==; 31:DaMWf4qTcgmpz+pKDzQzlz66jFazw5wBhX8ESRiUKGrW1YCO00rqPSLA3iS13flBQDfNRhMpdevxBM4LWQ9P1PfYU/YMJGB9JE4cindbDrWIsbhtt08UJDqxkm+q0cqL0PxNkj9WqhWPzJIGVJpu+AFvhV/KPx3n5iC+lxablheus8garubcU8XMi5PaQEdANCLoERwNE8+ZNq/fCa1SyIBVj4829THOtxv8cJjA+k4= X-MS-TrafficTypeDiagnostic: BY2PR0701MB1944: X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 20:AAY4n0mpq0QOxMbcSSzgd3X8Qauo27+f7zldix8GkesDnsqXCBrMxcFGeAxJ+2WPsCroo9F5cmjWW5nG6SiJQdY+DirJUDV7X7hfPaa1MYxy5WaoiALSdCLiI7b9g387T7eOFji1UxE9Jr0gspkP7yWoawQcC/HxfndWEdh514ZNJiN1fh1mOYl8Hx08T38Earb4/4RCqfmgpQZp9u3viAtrvwQzgm40IeOdbFChoeUc4y9LiCSITCrrQHMBXrrcfJeJePz/22GJGicdtjA+29Frq2YltPabRq7El0P42FeZw0qFnC11fcdXSd9mwwVXUTgv6jMkRCjRUx0iPP+movMJS/dDlLQp5yXVf8+SXqQCHThvMdGEfTTm2QLCsdviINnetmC6J24zoUO/tucGuiujkkW/kl4GYKW1s9AZ4p/Aeqe0KVOrf1PmFJCAe5y8mY3Dk/Jv9TVyDXXGVobaDUQx2KJnTlJCHVYLz5SRPz4MqTM/7HyO8FEOAzPOjZor; 4:8/MtRZu7bN2WlO0GdjMHq+XB1h76mqHjATcNGxrTA+B5Fk0v1zB+RPrs0UqHikuftFv9iwxg3SYx6t3qBPEBrwHnvTz+r1lgeAoeu1tbmvdP/1unIRvs6f8NMpSTlsuJ55MwCCmmEMLRKzx+HlDlg6KyJ5Ud+nSzPbcMNga6qM+5Xbrw9VTcUQsgxvpgJsOpm2cARjztHwD/8/4swvig8ncsdSP8XE8u21ulXfqCUgbBYOg45xaRXCZ3pQpoVmx88JH1Ojf8qHNOBw4Nn1IWQw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6041268)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:BY2PR0701MB1944; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0701MB1944; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1944; 23:4fnrQ0j2tQFrExE+Raz/A3Qq+4SqrSps6sdQNgM?= =?us-ascii?Q?ohDEvWKtNSoiqP0Ir1qToHXcLAMJdg54Rmv4FCxacHhAB9WpQrYqrofbtFdm?= =?us-ascii?Q?IJC58CWkEJO8s+/Sn+JyFxXbvKKMgGYKdrkE+QaK+qnxGiyqx5PuF3ushLpU?= =?us-ascii?Q?Qv8IOzBYZQiBNurTo05Qd67hk5PQihFwx3NEq88cBneISeWBwSEv30Sn7HgN?= =?us-ascii?Q?PNx4/ucJV1q+l1VrYecuukmtVPs7qDTEUCbyLEb9nFaOutHFxBz82zAmdjwl?= =?us-ascii?Q?gC1zcj9/oCTyz4EpzT2Gew7+a57qHjTVteqyAHsla0yVkgtHWP+eMjYuG0Pt?= =?us-ascii?Q?sYORHOcSYrfbAQUUZM/rvQRce80FFYyYPPRAXtlHcktiAu6M8XTO3XdmPNVp?= =?us-ascii?Q?m9SCbghm6Emz+uRAMbMP+xQJYS5wXT4hHO9RrDkvSOr5tdI0JE7lH1KIcn/p?= =?us-ascii?Q?uWzxEZgfqNsQ76Rl9zK+qh+H+XWGcygRFDTNbY1doSqggWglekRbws85SFMS?= =?us-ascii?Q?LnCyx6S99/9wB3h3FTCww4O2UH/YlWcX9O3RZfZiOCtaYhESCPcZu7Epeef9?= =?us-ascii?Q?l1a9pqxKZxD/ELJoi/qutgzLUYPBXTylCAGmWnfnhUMlB/gg+d4r+8DE3Mpn?= =?us-ascii?Q?mdjEY/Xjt8vJeNNZ7s68KDJ9nOAg/dYnziAnyUjksPYVGWX+vEZZZiswjrXT?= =?us-ascii?Q?VHVSYeojqc0UcclLsSJpOt0RzIAVp2sClH+ihq4jbUEF1IXmcOfQOldncTyx?= =?us-ascii?Q?z6BwfEuWkpTS5RUZMjxu0PeeD0l5Cz277IgDo4FZaq76nQ2tPtzFhylJYdiX?= =?us-ascii?Q?++qMhfyUKtfiPZM/DjT8WBlTgM8Hz/4PU8zYNEAwfvp+9sNgiwJucrRev+Za?= =?us-ascii?Q?vigBLALUjKKBwrJpswLCy2FiNw0fffERHjshP0/CVsnSUll9RrD7rBTxPkBP?= =?us-ascii?Q?waQ6r03XblooYD32R2Ie8QBn8CsCRgfarV5wNortwo4kKOwwewFCR/QORvXt?= =?us-ascii?Q?1Fpi36LwjI6v7OB1CN2BNmwmfkQP/Wtx0iq5SDbNZDhgTjg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 6:eR+T168ID+wKhkspYNidDSPHl4ouQuq81fyqQg0yIzFczbcHIUDOMfs0wSYmRZnfPZoSiVM48wx51XhLC8KiFLcrWoiXskl0ffUB77pdN7MZiqg98qmTDL9jnTQel9pif8+f1chqu0rT1wCOyX4fqF9G8fXFlWr7JzCaWGmCiDiWBHlFOtQlXL6MRFSjgM0wApbNYhKDedDQKgJP79Mq09by7EAO9juwt0KEsIPB5rBU+P0xFHanhI3cknL8z4hvBUjhAsOpxD3JlYDNlX3SM7M1AirBmxXecN9Tow1jmn/zDLpUNPYJS+2W4H4HtisQqtn1/sJ5ToN5gVgJd73bPcynQHSKHe2CGhdK9X6HIRA=; 5:Bdhe8+Bk4AJ0qhfSGG7YNdyC9Jp3gw/FFPkiqOUhVVfsLIz7tYW5UvLR9s7uxMLniB39tNT8NQF/7T0Z5cUni1b0mHlDxXzgYGnBYbuLt90dBeBtjKaLINjMtXRsfUHaqCKRqqQgU7kVUakzMgR2Hpkh0jvbGMOfJhimaEcsD5s=; 24:fgI4J8oM3s/QQPbfW4a7rBE9C7UUb3XduoAbgiDi/0DdFz+ZFO+8pTfOAr2SwVvlSEXR3chp4SYv+R5krSPiH/Ks+8SW0yBU5SAZx0j2qVI=; 7:NeMj/pbxlpFI2G31zFHo5yNeHaUaIun4vlGgHcNbNxDgKewGPnYsvevPCTs1RpElVSQunf6AT08r4lxJib60Dx2u20i5r0nT2XqgGUykc2wZ92FVzv47OrMef/i/1ZXzqWWy/9uHx8mxAwvLCBuFuutKQ03fB7OGcrNZrxFk0HPRO5in8CLeFuD4rNTEQfW85POYMH40zi0M7gYev4R3Yuhz3ICufXD7pxw91fsYO6h4jh9o8/4vCtQhu72HO9/L SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:33:44.5336 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c0b9a11-58b5-4454-4e94-08d54e324a8b X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB1944 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 DPC thread can stall during switch scan due to slow switch response. This will stall other work element that needs attention. Moving work element processing and relogin logic out of DPC thread and into its own work queue. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 6 ++-- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 1 + drivers/scsi/qla2xxx/qla_mid.c | 6 +--- drivers/scsi/qla2xxx/qla_os.c | 76 +++++++++++++++++++++++++++++++---------- 5 files changed, 63 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index ca2ad477a4df..92dbba47d3cf 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3139,6 +3139,7 @@ enum qla_work_type { QLA_EVT_UPD_FCPORT, QLA_EVT_GNL, QLA_EVT_NACK, + QLA_EVT_RELOGIN, }; @@ -3447,10 +3448,6 @@ struct qlt_hw_data { #define LEAK_EXCHG_THRESH_HOLD_PERCENT 75 /* 75 percent */ -#define QLA_EARLY_LINKUP(_ha) \ - ((_ha->flags.n2n_ae || _ha->flags.lip_ae) && \ - _ha->flags.fw_started && !_ha->flags.fw_init_done) - /* * Qlogic host adapter specific data structure. */ @@ -4155,6 +4152,7 @@ typedef struct scsi_qla_host { #define SET_ZIO_THRESHOLD_NEEDED 28 #define DETECT_SFP_CHANGE 29 #define N2N_LOGIN_NEEDED 30 +#define IOCB_WORK_ACTIVE 31 unsigned long pci_flags; #define PFLG_DISCONNECTED 0 /* PCI device removed */ diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index fa115c7433e5..cf1f1a3baf21 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -203,6 +203,7 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *, uint16_t *); int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_async_abort_cmd(srb_t *); +int qla24xx_post_relogin_work(struct scsi_qla_host *vha); /* * Global Functions in qla_mid.c source file. diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 93d0077ba388..728c66f34666 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -898,6 +898,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea) __func__, fcport->port_name, fcport->last_rscn_gen, fcport->rscn_gen, fcport->last_login_gen, fcport->login_gen); + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return; } else if (ea->sp->gen1 != fcport->rscn_gen) { ql_dbg(ql_dbg_disc, vha, 0x20d4, "%s %d %8phC post gidpn\n", diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index e6f3d2d62c61..966ff0f1bed4 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -319,8 +319,6 @@ qla2x00_do_dpc_vp(scsi_qla_host_t *vha) ql_dbg(ql_dbg_dpc + ql_dbg_verbose, vha, 0x4012, "Entering %s vp_flags: 0x%lx.\n", __func__, vha->vp_flags); - qla2x00_do_work(vha); - /* Check if Fw is ready to configure VP first */ if (test_bit(VP_CONFIG_OK, &base_vha->vp_flags)) { if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) { @@ -354,9 +352,7 @@ qla2x00_do_dpc_vp(scsi_qla_host_t *vha) ql_dbg(ql_dbg_dpc, vha, 0x4018, "Relogin needed scheduled.\n"); - qla2x00_relogin(vha); - ql_dbg(ql_dbg_dpc, vha, 0x4019, - "Relogin needed end.\n"); + qla24xx_post_relogin_work(vha); } } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 2e4bfb7aabf7..e1761bd552fe 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2698,14 +2698,22 @@ static void qla2x00_iocb_work_fn(struct work_struct *work) { struct scsi_qla_host *vha = container_of(work, struct scsi_qla_host, iocb_work); - int cnt = 0; + struct qla_hw_data *ha = vha->hw; + struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); + int i = 20; + unsigned long flags; + + if (test_bit(UNLOADING, &base_vha->dpc_flags)) + return; - while (!list_empty(&vha->work_list)) { + while (!list_empty(&vha->work_list) && i > 0) { qla2x00_do_work(vha); - cnt++; - if (cnt > 10) - break; + i--; } + + spin_lock_irqsave(&vha->work_lock, flags); + clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); + spin_unlock_irqrestore(&vha->work_lock, flags); } /* @@ -3203,7 +3211,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) host->can_queue, base_vha->req, base_vha->mgmt_svr_loop_id, host->sg_tablesize); - ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); + ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); if (ha->mqenable) { bool mq = false; @@ -4555,6 +4563,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(&vha->gnl.fcports); INIT_LIST_HEAD(&vha->nvme_rport_list); INIT_LIST_HEAD(&vha->gpnid_list); + INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); spin_lock_init(&vha->work_lock); spin_lock_init(&vha->cmd_list_lock); @@ -4607,15 +4616,18 @@ int qla2x00_post_work(struct scsi_qla_host *vha, struct qla_work_evt *e) { unsigned long flags; + bool q = false; spin_lock_irqsave(&vha->work_lock, flags); list_add_tail(&e->list, &vha->work_list); + + if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) + q = true; + spin_unlock_irqrestore(&vha->work_lock, flags); - if (QLA_EARLY_LINKUP(vha->hw)) - schedule_work(&vha->iocb_work); - else - qla2xxx_wake_dpc(vha); + if (q) + queue_work(vha->hw->wq, &vha->iocb_work); return QLA_SUCCESS; } @@ -4747,6 +4759,9 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) fcport->d_id = e->u.new_sess.id; if (pla) { fcport->fw_login_state = DSC_LS_PLOGI_PEND; + memcpy(fcport->node_name, + pla->iocb.u.isp24.u.plogi.node_name, + WWN_SIZE); qlt_plogi_ack_link(vha, pla, fcport, QLT_PLOGI_LINK_SAME_WWN); /* we took an extra ref_count to prevent PLOGI ACK when * fcport/sess has not been created. @@ -4897,6 +4912,9 @@ qla2x00_do_work(struct scsi_qla_host *vha) case QLA_EVT_GPNID_DONE: qla24xx_async_gpnid_done(vha, e->u.iosb.sp); break; + case QLA_EVT_RELOGIN: + qla2x00_relogin(vha); + break; case QLA_EVT_NEW_SESS: qla24xx_create_new_sess(vha, e); break; @@ -4928,6 +4946,20 @@ qla2x00_do_work(struct scsi_qla_host *vha) } } +int qla24xx_post_relogin_work(struct scsi_qla_host *vha) +{ + struct qla_work_evt *e; + + e = qla2x00_alloc_work(vha, QLA_EVT_RELOGIN); + + if (!e) { + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); + return QLA_FUNCTION_FAILED; + } + + return qla2x00_post_work(vha, e); +} + /* Relogins all the fcports of a vport * Context: dpc thread */ @@ -4983,6 +5015,9 @@ void qla2x00_relogin(struct scsi_qla_host *vha) if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; } + + ql_dbg(ql_dbg_disc, vha, 0x400e, + "Relogin end.\n"); } /* Schedule work on any of the dpc-workqueues */ @@ -5758,8 +5793,6 @@ qla2x00_do_dpc(void *data) if (test_bit(UNLOADING, &base_vha->dpc_flags)) break; - qla2x00_do_work(base_vha); - if (IS_P3P_TYPE(ha)) { if (IS_QLA8044(ha)) { if (test_and_clear_bit(ISP_UNRECOVERABLE, @@ -5947,11 +5980,9 @@ qla2x00_do_dpc(void *data) base_vha->relogin_jif = jiffies + HZ; clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); - ql_dbg(ql_dbg_dpc, base_vha, 0x400d, + ql_dbg(ql_dbg_disc, base_vha, 0x400d, "Relogin scheduled.\n"); - qla2x00_relogin(base_vha); - ql_dbg(ql_dbg_dpc, base_vha, 0x400e, - "Relogin end.\n"); + qla24xx_post_relogin_work(base_vha); } } loop_resync_check: @@ -6211,8 +6242,17 @@ qla2x00_timer(struct timer_list *t) } /* Process any deferred work. */ - if (!list_empty(&vha->work_list)) - start_dpc++; + if (!list_empty(&vha->work_list)) { + unsigned long flags; + bool q = false; + + spin_lock_irqsave(&vha->work_lock, flags); + if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) + q = true; + spin_unlock_irqrestore(&vha->work_lock, flags); + if (q) + queue_work(vha->hw->wq, &vha->iocb_work); + } /* * FC-NVME