From patchwork Fri Feb 24 21:37:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9591213 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 6EA0B601AE for ; Fri, 24 Feb 2017 21:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D42D2895A for ; Fri, 24 Feb 2017 21:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5200828965; Fri, 24 Feb 2017 21:37:57 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 87B852895B for ; Fri, 24 Feb 2017 21:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751304AbdBXVhz (ORCPT ); Fri, 24 Feb 2017 16:37:55 -0500 Received: from mail-sn1nam01on0044.outbound.protection.outlook.com ([104.47.32.44]:52174 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751287AbdBXVhv (ORCPT ); Fri, 24 Feb 2017 16:37:51 -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=nx2TE2Xjyaw39eLsK5OTM3K3K01Cj0CD6U/yz5JL2m4=; b=aiAWywAOyhXHp+B3MdryVmXSUuU1xUVkzatdiioRbNdKMX5wYQX0sVtqNjnxedb+wftiPJSpq6G8AEbpbmcacRxtK+u9IYE4wKzErYuoX62gHpJK1Ul4IY362aD55pVTJeXCI9ezsIX7GwpRByNnqka3CF79nhWR/ufUGUECDAY= Received: from CO2PR07CA0031.namprd07.prod.outlook.com (10.141.194.169) by DM2PR07MB639.namprd07.prod.outlook.com (10.141.178.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Fri, 24 Feb 2017 21:37:49 +0000 Received: from BY2FFO11FD004.protection.gbl (2a01:111:f400:7c0c::133) by CO2PR07CA0031.outlook.office365.com (2a01:111:e400:1414::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12 via Frontend Transport; Fri, 24 Feb 2017 21:37:49 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; linux-iscsi.org; dkim=none (message not signed) header.d=none; linux-iscsi.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11FD004.mail.protection.outlook.com (10.1.14.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.919.10 via Frontend Transport; Fri, 24 Feb 2017 21:37:48 +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.309.2; Fri, 24 Feb 2017 13:37:44 -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 v1OLbi8x003828; Fri, 24 Feb 2017 13:37:44 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v1OLbiOZ003827; Fri, 24 Feb 2017 13:37:44 -0800 From: Himanshu Madhani To: , , CC: , , Subject: [PATCH v3 01/14] qla2xxx: Fix delayed response to command for loop mode/direct connect. Date: Fri, 24 Feb 2017 13:37:30 -0800 Message-ID: <1487972263-3795-2-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487972263-3795-1-git-send-email-himanshu.madhani@cavium.com> References: <1487972263-3795-1-git-send-email-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)(6009001)(7916002)(39450400003)(2980300002)(428002)(189002)(199003)(92566002)(101416001)(36756003)(189998001)(50466002)(48376002)(50986999)(76176999)(1691005)(106466001)(105586002)(2950100002)(42186005)(107886003)(38730400002)(4720700003)(8676002)(86362001)(2906002)(2201001)(47776003)(5660300001)(33646002)(8936002)(81156014)(81166006)(575784001)(50226002)(5003940100001)(8656002)(54906002)(356003)(305945005)(80596001)(4326007)(626004)(69596002)(6666003)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB639; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD004; 1:LnCGu3TNYFuOVh0pFzpQqmv6PNLQFX+nKyM9z38sfo/XLkCiTvoPlIpnys50UpEyjSI8TQpMw87G5510WCA2sCO0DAE1eUIPPMNobZQbqitgoP9SPK2qOgttN+Vam9uaO/nAW/DreAgfeRGU0ge+d2+d5FjsJIZB+drR2Ju+rg/9hl/RvBqHYXvKJT70ElA+/ss39ae9Sm8wJMaotSALgoEb3PEPw13qrZspuL/mATPT4/jkSCkGkjwlwo16IVWo8+OCFNsRqnCHnVHbRi2+1FVQO7++WAiTXQ6g2qysYSjRRRugwleSPXM0gnS24zKxPdTkc5PAVtaiMhYEmHQfGqDzMq4M2deo5qoRubt7l7KIvxcxBO1Dk2fkG15kepCZ5ysv+CXxgtE5BulqPI3gGznF8MS7VBRhSXFgcUcJa+cRp3cjFS80mkK3kvgr2UtlTH/4cr+qcA5gPIonhtZdnx9MWIe34lG08p3UtVX2Vs1iMcM7xrGg5wMDesJRsmbxk2dp70ve9U1aAO22JqADIejeEfpLhrNgyL7UQAifj4w= X-MS-Office365-Filtering-Correlation-Id: 870bb227-aa92-465d-1555-08d45cfd60ca X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR07MB639; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB639; 3:PWxKnutmHn6UegS1alaJR/STwdbRf3+LG5Sag/gb/U2bgBbnEofDV9O9US5y9LATnATAOMv+rIlIoqKoSVQaUu6i5MRLbUQPXpMEUL4JRhqDtDkz9xhLn+AXdA9JED2PIVw0cAYqLV/kmi4H36xpHcXLK3uSnN4mCPLKusFCnXGqdavFzIFlJHJFmJAP0cZfG+mMN8riPxgXG+4URt0/7wQx1rCaR8n4oUxC/yySmJqQLPBQaOjT6zUf8LBjJXONedszXxRo/mmIRUNMh16fe0IdzOpprZyGgPlkhbKxuA8F5yDTryPduJQaE6HPIE5XzQMfnHP/ejybz5oAs67fk/MzgWHQjPnY5WB2IJ2jeAX5uEeNWsReakeS5IovNKel; 25:ZJe+I6Sp7mMXwX+lckKXCDwX0wiT+ibHqvZCsfMVoEsH9VAoSFG8kT4Cax41fCTVipxGWis9d9J/zbX2XZwUJ02O63Fd7eBWw+yoa8PltyFWH2QBHHqr+8bY0zK6edu2KzOi/Dk/zyoUgyHBQmbItf+8QNrt6OzXhas33FFZ2B8H9ST1x+jqrXkCEMm2mrxppEh3Yz0b8sldtMQBY0xgwPYBcHA1V+SQ5dPf7aQmyNpeZZnXMA5jVcsg4aj3iH1q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PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13017025)(13018025)(13023025)(13024025)(8121501046)(5005006)(13015025)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(20161123555025)(6072148); SRVR:DM2PR07MB639; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB639; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB639; 4:HGRF606178cR3Ui7bXLhdOh6ddmTiN3bOV/tWkHjcCa0HyBPvGUZ3U1HNOVh3cZqhjAjwd4gQRfdnGsI9kOgxTv0gDIcvj1FJj12xy4L/gCBofMa3QmN0g/jslWL5VAskAL/R9FJIIMKYi2ssG4aewvf8nejMl1I4R49x60SnUk7movZ1CPko+OBJwcQZa75qCax+H/o3uaXP3RXwvdqBpt5r3F3evNsiga79MNb4sL39qO2S/yBZmM86nhMxrd62MDhSgvyPfS81NpuXeA/WQBaDCbTxbrmpXLcbOk//JggOKi0md67PsPFO7q3bgFfu1HpyigwV1Bcvxnwazwr3tqowNrazEQvyao99U0XITfEJu2tPXbeoG98/bVwgDk8E6cT2TZlSKsWpHafIgSFSjVWs/cOlcTXmdwILA+MiVrwd+s6IUuGdIqRkwR0yDBfbnefL7VEQIDXKLZ78+rZ54uKon9B1W+e7Qe+v6DAjmpZCYaJF3Ii1htPSaCZot3YS6Ktk7Qoz2BMRE239BiIii1BAHe0qjNAmi5iPLJ9W60jEPmCVSH0lnUIDCjHhgrdbx/uS9SV/f/uF4Q7lhYdwZMDpDGZpr3r13AmGoEksbUzFJnU+wcDtRu6JzPtGew85bFBwbQ7nqrb3cjDXgeaL2pIvE0G9ZogiJJoJL2PshDpAfKFNyddzwOJX8ErPVl873GaBxSxLIWhwajE5SCr37bgTXXl159emU92hfWD9WNKHxUli4RU/QAKyLglu2P+ X-Forefront-PRVS: 0228DDDDD7 X-Microsoft-Exchange-Diagnostics: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Output: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB639; 7:H7HboRK26vNRO4YVf7Umi7Hi6JSVIfiwS81iGpCIZp1hdCSMvZC/d698uNAy/1m6MToo/CQgo6onIrckejXQhrqdACgtP9s7vWJM3uJmDlODCDYsyKNmax6Ka5oK+zFnRX4O2lNv09siL6zOc6kerINfPEd6GZZlZLzPN4ckDUB/nWpLNkPa4FByNfWx9n7ZqmZt20zugxfQ3kocXKFo/8+yPKZR0liRlrWyeEs56dRT5YxL3Us2KD6uur10E5GgmubS4BcKUHEFHJTEq10bxMX2TU1/ipYkG0Z94i5MO5tX7L7p6z85IK5GmrOyNthsgp3DPJEyOYp7izHbsvKo7w== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2017 21:37:48.4236 (UTC) 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: DM2PR07MB639 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran Current driver wait for FW to be in the ready state before processing in-coming commands. For Arbitrated Loop or Point-to- Point (not switch), FW Ready state can take a while. FW will transition to ready state after all Nports have been logged in. In the mean time, certain initiators have completed the login and starts IO. Driver needs to start processing all queues if FW is already started. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 12 ++++++++++-- drivers/scsi/qla2xxx/qla_init.c | 12 ++++++++++++ drivers/scsi/qla2xxx/qla_isr.c | 14 +++++++++++++- drivers/scsi/qla2xxx/qla_mbx.c | 6 +++--- drivers/scsi/qla2xxx/qla_os.c | 22 +++++++++++++++++++++- drivers/scsi/qla2xxx/qla_target.c | 38 +++++++++++++++++++++++++------------- 6 files changed, 84 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 625d438..c264ced 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3290,6 +3290,10 @@ 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. */ @@ -3339,7 +3343,11 @@ struct qla_hw_data { uint32_t fawwpn_enabled:1; uint32_t exlogins_enabled:1; uint32_t exchoffld_enabled:1; - /* 35 bits */ + + uint32_t lip_ae:1; + uint32_t n2n_ae:1; + uint32_t fw_started:1; + uint32_t fw_init_done:1; } flags; /* This spinlock is used to protect "io transactions", you must @@ -3432,7 +3440,6 @@ struct qla_hw_data { #define P2P_LOOP 3 uint8_t interrupts_on; uint32_t isp_abort_cnt; - #define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532 #define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432 #define PCI_DEVICE_ID_QLOGIC_ISP8001 0x8001 @@ -3913,6 +3920,7 @@ struct qla_tgt_counters { struct list_head vp_fcports; /* list of fcports */ struct list_head work_list; spinlock_t work_lock; + struct work_struct iocb_work; /* Commonly used flags and state information. */ struct Scsi_Host *host; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index ac579fc..6b0ec11 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3212,6 +3212,7 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, struct event_arg *ea) } else { ql_dbg(ql_dbg_init, vha, 0x00d3, "Init Firmware -- success.\n"); + ha->flags.fw_started = 1; } return (rval); @@ -4036,6 +4037,7 @@ static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t *vha, nvram_t *nv) atomic_set(&vha->loop_state, LOOP_READY); ql_dbg(ql_dbg_disc, vha, 0x2069, "LOOP READY.\n"); + ha->flags.fw_init_done = 1; /* * Process any ATIO queue entries that came in @@ -5526,6 +5528,11 @@ int qla2x00_perform_loop_resync(scsi_qla_host_t *ha) if (!(IS_P3P_TYPE(ha))) ha->isp_ops->reset_chip(vha); + ha->flags.n2n_ae = 0; + ha->flags.lip_ae = 0; + ha->current_topology = 0; + ha->flags.fw_started = 0; + ha->flags.fw_init_done = 0; ha->chip_reset++; atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); @@ -6802,6 +6809,8 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) return; if (!ha->fw_major_version) return; + if (!ha->flags.fw_started) + return; ret = qla2x00_stop_firmware(vha); for (retries = 5; ret != QLA_SUCCESS && ret != QLA_FUNCTION_TIMEOUT && @@ -6815,6 +6824,9 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) "Attempting retry of stop-firmware command.\n"); ret = qla2x00_stop_firmware(vha); } + + ha->flags.fw_started = 0; + ha->flags.fw_init_done = 0; } int diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 352cfb6..a5faf37 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -708,6 +708,8 @@ static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, "mbx7=%xh.\n", mb[1], mb[2], mb[3], mbx); ha->isp_ops->fw_dump(vha, 1); + ha->flags.fw_init_done = 0; + ha->flags.fw_started = 0; if (IS_FWI2_CAPABLE(ha)) { if (mb[1] == 0 && mb[2] == 0) { @@ -761,6 +763,9 @@ static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, break; case MBA_LIP_OCCURRED: /* Loop Initialization Procedure */ + ha->flags.lip_ae = 1; + ha->flags.n2n_ae = 0; + ql_dbg(ql_dbg_async, vha, 0x5009, "LIP occurred (%x).\n", mb[1]); @@ -797,6 +802,10 @@ static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, break; case MBA_LOOP_DOWN: /* Loop Down Event */ + ha->flags.n2n_ae = 0; + ha->flags.lip_ae = 0; + ha->current_topology = 0; + mbx = (IS_QLA81XX(ha) || IS_QLA8031(ha)) ? RD_REG_WORD(®24->mailbox4) : 0; mbx = (IS_P3P_TYPE(ha)) ? RD_REG_WORD(®82->mailbox_out[4]) @@ -866,6 +875,9 @@ static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, /* case MBA_DCBX_COMPLETE: */ case MBA_POINT_TO_POINT: /* Point-to-Point */ + ha->flags.lip_ae = 0; + ha->flags.n2n_ae = 1; + if (IS_QLA2100(ha)) break; @@ -2693,7 +2705,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, struct sts_entry_24xx *pkt; struct qla_hw_data *ha = vha->hw; - if (!vha->flags.online) + if (!ha->flags.fw_started) return; while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 35079f4..db6bd92 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3612,11 +3612,11 @@ struct tsk_mgmt_cmd { if (rptid_entry->format == 0) { /* loop */ - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b7, + ql_dbg(ql_dbg_async, vha, 0x10b7, "Format 0 : Number of VPs setup %d, number of " "VPs acquired %d.\n", rptid_entry->vp_setup, rptid_entry->vp_acquired); - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b8, + ql_dbg(ql_dbg_async, vha, 0x10b8, "Primary port id %02x%02x%02x.\n", rptid_entry->port_id[2], rptid_entry->port_id[1], rptid_entry->port_id[0]); @@ -3631,7 +3631,7 @@ struct tsk_mgmt_cmd { } else if (rptid_entry->format == 1) { /* fabric */ - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b9, + ql_dbg(ql_dbg_async, vha, 0x10b9, "Format 1: VP[%d] enabled - status %d - with " "port id %02x%02x%02x.\n", rptid_entry->vp_idx, rptid_entry->vp_status, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index bbf1ad95..312972b 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2564,6 +2564,21 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) return atomic_read(&vha->loop_state) == LOOP_READY; } +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; + + while (!list_empty(&vha->work_list)) { + qla2x00_do_work(vha); + cnt++; + if (cnt > 10) + break; + } + schedule_work(&vha->iocb_work); +} + /* * PCI driver interface */ @@ -3082,6 +3097,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) */ qla2xxx_wake_dpc(base_vha); + INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) { @@ -4323,7 +4339,11 @@ struct qla_work_evt * spin_lock_irqsave(&vha->work_lock, flags); list_add_tail(&e->list, &vha->work_list); spin_unlock_irqrestore(&vha->work_lock, flags); - qla2xxx_wake_dpc(vha); + + if (QLA_EARLY_LINKUP(vha->hw)) + schedule_work(&vha->iocb_work); + else + qla2xxx_wake_dpc(vha); return QLA_SUCCESS; } diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 45f5077..d7fc9db 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -613,6 +613,7 @@ int qla24xx_async_notify_ack(scsi_qla_host_t *vha, fc_port_t *fcport, break; case SRB_NACK_PRLI: fcport->fw_login_state = DSC_LS_PRLI_PEND; + fcport->deleted = 0; c = "PRLI"; break; case SRB_NACK_LOGO: @@ -1551,6 +1552,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha, request_t *pkt; struct nack_to_isp *nack; + if (!ha->flags.fw_started) + return; + ql_dbg(ql_dbg_tgt, vha, 0xe004, "Sending NOTIFY_ACK (ha=%p)\n", ha); /* Send marker if required */ @@ -2906,7 +2910,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, else vha->tgt_counters.core_qla_que_buf++; - if (!vha->flags.online || cmd->reset_count != ha->chip_reset) { + if (!ha->flags.fw_started || cmd->reset_count != ha->chip_reset) { /* * Either the port is not online or this request was from * previous life, just abort the processing. @@ -3047,7 +3051,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) spin_lock_irqsave(&ha->hardware_lock, flags); - if (!vha->flags.online || (cmd->reset_count != ha->chip_reset) || + if (!ha->flags.fw_started || (cmd->reset_count != ha->chip_reset) || (cmd->sess && cmd->sess->deleted)) { /* * Either the port is not online or this request was from @@ -3251,7 +3255,7 @@ static int __qlt_send_term_imm_notif(struct scsi_qla_host *vha, ql_dbg(ql_dbg_tgt_tmr, vha, 0xe01c, "Sending TERM ELS CTIO (ha=%p)\n", ha); - pkt = (request_t *)qla2x00_alloc_iocbs_ready(vha, NULL); + pkt = (request_t *)qla2x00_alloc_iocbs(vha, NULL); if (pkt == NULL) { ql_dbg(ql_dbg_tgt, vha, 0xe080, "qla_target(%d): %s failed: unable to allocate " @@ -4584,7 +4588,8 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, } if (sess != NULL) { - if (sess->fw_login_state == DSC_LS_PLOGI_PEND) { + if (sess->fw_login_state != DSC_LS_PLOGI_PEND && + sess->fw_login_state != DSC_LS_PLOGI_COMP) { /* * Impatient initiator sent PRLI before last * PLOGI could finish. Will force him to re-try, @@ -4623,15 +4628,23 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, /* Make session global (not used in fabric mode) */ if (ha->current_topology != ISP_CFG_F) { - set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); - set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); - qla2xxx_wake_dpc(vha); + if (sess) { + ql_dbg(ql_dbg_disc, vha, 0xffff, + "%s %d %8phC post nack\n", + __func__, __LINE__, sess->port_name); + qla24xx_post_nack_work(vha, sess, iocb, + SRB_NACK_PRLI); + res = 0; + } else { + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } } else { if (sess) { ql_dbg(ql_dbg_disc, vha, 0xffff, - "%s %d %8phC post nack\n", - __func__, __LINE__, sess->port_name); - + "%s %d %8phC post nack\n", + __func__, __LINE__, sess->port_name); qla24xx_post_nack_work(vha, sess, iocb, SRB_NACK_PRLI); res = 0; @@ -4639,7 +4652,6 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, } break; - case ELS_TPRLO: if (le16_to_cpu(iocb->u.isp24.flags) & NOTIFY24XX_FLAGS_GLOBAL_TPRLO) { @@ -5103,7 +5115,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, unsigned long flags; if (unlikely(tgt == NULL)) { - ql_dbg(ql_dbg_io, vha, 0x3064, + ql_dbg(ql_dbg_tgt, vha, 0x3064, "ATIO pkt, but no tgt (ha %p)", ha); return; } @@ -6234,7 +6246,7 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) struct atio_from_isp *pkt; int cnt, i; - if (!vha->flags.online) + if (!ha->flags.fw_started) return; while ((ha->tgt.atio_ring_ptr->signature != ATIO_PROCESSED) ||