From patchwork Tue Sep 4 21:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10587981 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 2AAAD920 for ; Tue, 4 Sep 2018 21:19:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19AB228F76 for ; Tue, 4 Sep 2018 21:19:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7D92A127; Tue, 4 Sep 2018 21:19:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 631B628F76 for ; Tue, 4 Sep 2018 21:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727442AbeIEBq3 (ORCPT ); Tue, 4 Sep 2018 21:46:29 -0400 Received: from mail-co1nam03on0069.outbound.protection.outlook.com ([104.47.40.69]:55520 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727174AbeIEBq3 (ORCPT ); Tue, 4 Sep 2018 21:46:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=78OCRIHthbvOrLLN4jL5ZORV+dcBkq/LyDJ/5H8YjqQ=; b=kFz0nEGN9HTM8me2oQjygCct0d32tezVR3jv8jPk1vUCogJDeh5zibcQe9ctEEVMIMv3vb3//Yd1bqUYg37geUGe8vg47o7F7M5XEak31mS33mLJKvn2tgzZ9JsYUXQW8yXX/KpcC1g59ShW12YmDOr6K6txRmhDoAfOLV2xfM0= Received: from DM5PR07CA0075.namprd07.prod.outlook.com (2603:10b6:4:ad::40) by DM6PR07MB4666.namprd07.prod.outlook.com (2603:10b6:5:a0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Tue, 4 Sep 2018 21:19:30 +0000 Received: from CO1NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::208) by DM5PR07CA0075.outlook.office365.com (2603:10b6:4:ad::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.14 via Frontend Transport; Tue, 4 Sep 2018 21:19:30 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by CO1NAM05FT049.mail.protection.outlook.com (10.152.96.164) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1143.1 via Frontend Transport; Tue, 4 Sep 2018 21:19:30 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Tue, 4 Sep 2018 14:19:20 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id w84LJMPs031978; Tue, 4 Sep 2018 14:19:22 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w84LJMpK031977; Tue, 4 Sep 2018 14:19:22 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/13] qla2xxx: Add logic to detect ABTS hang and response completion Date: Tue, 4 Sep 2018 14:19:12 -0700 Message-ID: <20180904211921.31927-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180904211921.31927-1-himanshu.madhani@cavium.com> References: <20180904211921.31927-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)(136003)(376002)(346002)(39860400002)(396003)(2980300002)(438002)(199004)(189003)(6666003)(336012)(5660300001)(16586007)(42186006)(316002)(11346002)(446003)(54906003)(80596001)(47776003)(50466002)(106002)(44832011)(8676002)(476003)(2616005)(126002)(110136005)(50226002)(486006)(48376002)(69596002)(8936002)(14444005)(36756003)(4326008)(106466001)(1076002)(305945005)(2906002)(86362001)(356003)(186003)(76176011)(81156014)(51416003)(72206003)(26005)(81166006)(87636003)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4666;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT049;1:UTPy+WkOxkdd9NZnduyDI1G9q9jqf6RDdu0+/s3uYj4yX/se5G6h6KAODz+9zKCz/x4wJ2FNdIiERgjMkx2+48OtYrYEDT/IBA6z6GFiYs86qrLhUbsaoQMjfBAsDjs2 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38c207d2-96ef-4f79-8f5a-08d612ac1a52 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR07MB4666; X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4666;3:bHcIdenFaWHd/v7oy88vivbzDUjC0ifd3M0jyoXPBRbRJJh3UxwZ79StUIwI5ZaQZImbZBMiTTHGYL2qwDZSfXMYfP37l0xLW6u54wHol69vx9Bc7sEWxQoO9zrFqd62YvbhP77rAUWw59+Gmod4D+y97AJEND9TZZYgVZqEgx57e7YzxaVWqqWnroG16Qc2myiiQKT4Pdt0MyczOD+CPQfXv7T3YfWdsxWjOxlXk9ZTF2+yPo65A/TTgzrsnaMhipoYUdpHUeN91q7WxT/kTdFKGhGfQae+BYtWwBbIt82j16JyrVwkTYR5/qJN4fyXwsc8UV5SjehKa3SSH+VSmRB/pyjrLyHRcG2WFk4miC4=;25:bpau+SQk17RZd/jeqgBIK98RDIjWPVh8jFTnEeUcsl+xcNTMiPicz+uA1cVpsTf/IMLN3gijjsd8pWhXnJC11t8xz3QOOc8zlnZetSIu73K2DtJdhQQEdTxwriT7UCbadB2zHmTKViDSQkPyjNRAlsBFXa7qdXu93/DxDRfDhhsH8q59JrwcIW3ACD21KWY8lffGAGe5qB8JVlSV4NsrnwVUjVU9NTwhqCstjEjpOpdEPR95gtbqZlLHBP/PkBLFoYQN9tPyltH5+1c/2YS9hxTAK/p8JUalti0y6j6EQwa1CoReLPqPvqi9HSyM2dtbNQuXTBM5m0AeasTVXCpTow== X-MS-TrafficTypeDiagnostic: DM6PR07MB4666: X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4666;31:haOqCYFMh9tGoDwsqxkIvB+Aaf+SDx7b2+T32eSTAhm0dlE5QLTCd6vLpAtpEkt82HUWWdNuTFNI0SUVSc/n9begiYpk+GnA09FMjx5LQC39ZBMLUtpYOjCmdd4LmuoKUKLONYFtZzoKwNbxOHM4J/FHqQ5Q3RFCDyJ5/MNdIkmvYoUnvjxH/o2YEXfRi+NGLt8yB9y5BQmOzHctbMVOOufPMZb0QiD98ZdgvEn1k2U=;20:F8wS15H4+azlmUmDLMnJeWuOjeOfqXWxIYKUPH0iKNfhJW7eO1smp21ZTBiRtykCRHm38WQi+ewUkwfLyORRS2ptlj9kO3+tsGeI8b8hD5/ZoZV1fGxQfCAFk6IZHY8pHrsfso0VG0SzyrzFGUDgRe8+TdQ9bUWZnBd5OKGwjgo+dpxWr3elYgFpoyOktPsddGRg1PNjeuzms33fBVsmgcAvGzXZYvIlodWPi/yAuTyCY/KU5G1IVHWtdLlzzsnmse18gmyxnQt1wPSxQ1YIwc4Q4yh7QePtR246LJqyFMX2vWznyFU8R4ohdjp+plq+6hXmRG+Ge1tacCH0kjQB1mUtcy4c6XftSN5dfaa9xggNJFpQm9KsNm2u4AgMePA9NjxSnX/N7wRdfhHpICkbGS6gUvqx2LSRDMrm4lFc1uL+cKLAhs+07GvPxevdx+afuIO0IKaGr1naWCgN9ezHutAnHALS02wc8Wt6leJ/v/5+JlrOEwlLXwQVo6ZTzBLw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93004095)(10201501046)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:DM6PR07MB4666;BCL:0;PCL:0;RULEID:;SRVR:DM6PR07MB4666; X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4666;4:ikQ+ateoeUcmd4hgBZ32evDt7tRwXZpWjXBIRaMhxtn4pPqjuAtyfyplBiSa6Jan86MM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SdCIMw1I2dJWAMuRk1i9LmCySMPcUxA2eOodNgdXjEJvUqJHhIFxXiOkRpRoUTmVMHF1ojaM6cNnG0zLAJEmPu4TIeT5FpEHellVwdx2CBh6XxkCKm96oVIIl4adyqxe2zENBJTASSJnjbkg==;5:9X5UvvUY7Lhj1V5NWINyI9OIQ7kW1DMgowgYhQzEPCCbnIZb7+8Mta81VNUsI8hDyGibL84uBghyz2kOkNieQxHcWDqnlunrGnqBpoOTKWveX8EFA6QXoiYPv8DpiZb7g/aeQ5/PFVVQcvX9T2Llvb2QqFrfXCwQm0NCc6XdalA=;7:ybqdNzChun2kgr6BCTc2sVnf0GAciEAYkH7auvA1891Soh2M5uQvC2oidtv1xDwkOkHSxL9GLQiQiCAi6AUEG5AvJTZ3onK2ZxKxp7WhKC7hFveqK2u2CkpJmZGrcDRUA6R3hnCIKTzTlTidn4YQU51zaqPzWP27hTKGatGzc2b/tNAf/s2HTLzAfVsj41gDVvlMzlnyoaxPO4GfJkLeZigrgBeYDE5XZU/yrdiS6bvOo7SpWUpz3q6Jk8JnKxDC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 21:19:30.2297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38c207d2-96ef-4f79-8f5a-08d612ac1a52 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: DM6PR07MB4666 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 ABTS error completion can trigger an exchange cleanup from the driver and another ABTS response will be generated. This retry of ABTS response can cause loop between driver trying to send ABTS and firmware returning error. This patch fixes this issue by adding logic to check for unresolved exchanges and clean up before ABTS is retried. This patch also addes the fix to use the same qpair as the ABTS completion for the terminatation of exchange as well as retry of ABTS response. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 3 ++ drivers/scsi/qla2xxx/qla_os.c | 1 + drivers/scsi/qla2xxx/qla_target.c | 72 ++++++++++++++++++++++++++++++++++----- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 16dd59bcd60a..8722abff7061 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3485,6 +3485,9 @@ struct qla_qpair { struct list_head qp_list_elem; /* vha->qp_list */ struct list_head hints_list; uint16_t cpuid; + uint16_t retry_term_cnt; + uint32_t retry_term_exchg_addr; + uint64_t retry_term_jiff; struct qla_tgt_counters tgt_counters; }; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 9628fe4a967f..f3787fc48533 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -391,6 +391,7 @@ static void qla_init_base_qpair(struct scsi_qla_host *vha, struct req_que *req, struct qla_hw_data *ha = vha->hw; rsp->qpair = ha->base_qpair; rsp->req = req; + ha->base_qpair->hw = ha; ha->base_qpair->req = req; ha->base_qpair->rsp = rsp; ha->base_qpair->vha = vha; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 3796525aec71..954d5fa1374c 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1800,15 +1800,15 @@ static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair, * ha->hardware_lock supposed to be held on entry. Might drop it, then reaquire */ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, - struct abts_resp_from_24xx_fw *entry) + struct qla_qpair *qpair, struct abts_resp_from_24xx_fw *entry) { struct ctio7_to_24xx *ctio; + u16 tmp; ql_dbg(ql_dbg_tgt, vha, 0xe007, "Sending retry TERM EXCH CTIO7 (ha=%p)\n", vha->hw); - ctio = (struct ctio7_to_24xx *)qla2x00_alloc_iocbs_ready( - vha->hw->base_qpair, NULL); + ctio = (struct ctio7_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, NULL); if (ctio == NULL) { ql_dbg(ql_dbg_tgt, vha, 0xe04b, "qla_target(%d): %s failed: unable to allocate " @@ -1831,16 +1831,21 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, ctio->initiator_id[1] = entry->fcp_hdr_le.d_id[1]; ctio->initiator_id[2] = entry->fcp_hdr_le.d_id[2]; ctio->exchange_addr = entry->exchange_addr_to_abort; - ctio->u.status1.flags = cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | - CTIO7_FLAGS_TERMINATE); + tmp = (CTIO7_FLAGS_STATUS_MODE_1 | CTIO7_FLAGS_TERMINATE); + if (qpair->retry_term_cnt & 1) + tmp |= (0x4 << 9); + ctio->u.status1.flags = cpu_to_le16(tmp); + ctio->u.status1.ox_id = cpu_to_le16(entry->fcp_hdr_le.ox_id); /* Memory Barrier */ wmb(); - qla2x00_start_iocbs(vha, vha->req); + if (qpair->reqq_start_iocbs) + qpair->reqq_start_iocbs(qpair); + else + qla2x00_start_iocbs(vha, qpair->req); - qlt_24xx_send_abts_resp(vha->hw->base_qpair, - (struct abts_recv_from_24xx *)entry, + qlt_24xx_send_abts_resp(qpair, (struct abts_recv_from_24xx *)entry, FCP_TMF_CMPL, true); } @@ -5667,6 +5672,52 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, tgt->atio_irq_cmd_count--; } +/* + * qpair lock is assume to be held + * rc = 0 : send terminate & abts respond + * rc != 0: do not send term & abts respond + */ +static int qlt_chk_unresolv_exchg(struct scsi_qla_host *vha, + struct qla_qpair *qpair, struct abts_resp_from_24xx_fw *entry) +{ + struct qla_hw_data *ha = vha->hw; + int rc = 0; + + /* + * Detect unresolved exchange. If the same ABTS is unable + * to terminate an existing command and the same ABTS loops + * between FW & Driver, then force FW dump. Under 1 jiff, + * we should see multiple loops. + */ + if (qpair->retry_term_exchg_addr == entry->exchange_addr_to_abort && + qpair->retry_term_jiff == jiffies) { + /* found existing exchange */ + qpair->retry_term_cnt++; + if (qpair->retry_term_cnt >= 5) { + rc = EIO; + qpair->retry_term_cnt = 0; + ql_log(ql_log_warn, vha, 0xffff, + "Unable to send ABTS Respond. Dumping firmware.\n"); + ql_dump_buffer(ql_dbg_tgt_mgt + ql_dbg_buffer, + vha, 0xffff, (uint8_t *)entry, sizeof(*entry)); + + if (qpair == ha->base_qpair) + ha->isp_ops->fw_dump(vha, 1); + else + ha->isp_ops->fw_dump(vha, 0); + + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } + } else if (qpair->retry_term_jiff != jiffies) { + qpair->retry_term_exchg_addr = entry->exchange_addr_to_abort; + qpair->retry_term_cnt = 0; + qpair->retry_term_jiff = jiffies; + } + + return rc; +} + /* ha->hardware_lock supposed to be held on entry */ /* called via callback from qla2xxx */ static void qlt_response_pkt(struct scsi_qla_host *vha, @@ -5824,8 +5875,11 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, * (re)terminate the exchange and retry * the abort response. */ + if (qlt_chk_unresolv_exchg(vha, + rsp->qpair, entry)) + break; qlt_24xx_retry_term_exchange(vha, - entry); + rsp->qpair, entry); } else ql_dbg(ql_dbg_tgt, vha, 0xe063, "qla_target(%d): ABTS_RESP_24XX "