From patchwork Tue Sep 29 10:21:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 287304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21630C4346E for ; Tue, 29 Sep 2020 10:22:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD0652076A for ; Tue, 29 Sep 2020 10:22:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="X5qZH5K5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725779AbgI2KWn (ORCPT ); Tue, 29 Sep 2020 06:22:43 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:53638 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KWn (ORCPT ); Tue, 29 Sep 2020 06:22:43 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAKSad004826 for ; Tue, 29 Sep 2020 03:22:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=f09+N/PXSCvI1ANa52PgREUMgEmsuY/UtLqJY54HblM=; b=X5qZH5K5qo6Kbp+QhaDpscd9dXQQd37KaFSbsQh+iK1TuV1uAQ2oO6RyHeeYYGfhuXWD wHURx+AxMmRLU317W8siHk3DY/aolK9ycLDQT7B+uRDAGGlC0Sgi653qjEgjWKye5pmF QAp7CQNeKBNg/N5H0e2pEf2EMPsDAsAfbZyIpniiUZM0Tt8KzmzsAQzIInUBBNd/43TW DrY4rVkuFNL0RVj4c9JyQ/3tcyAtH6TerzxOChiPVnIlzslh0J/kUQYczJDgO5h4ihKR 4auDFO/5hKCC36lm4gis1fqEsurCZyJEjfUoQMT1xR6h22iSBYd3ImYrlrBXemBV/5E+ hQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p5g0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:22:42 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:22:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:22:40 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 7EFBD3F703F; Tue, 29 Sep 2020 03:22:40 -0700 (PDT) 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 08TAMe0V032325; Tue, 29 Sep 2020 03:22:40 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TAMeRr032316; Tue, 29 Sep 2020 03:22:40 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 1/7] qla2xxx: Correct the check for sscanf return value Date: Tue, 29 Sep 2020 03:21:46 -0700 Message-ID: <20200929102152.32278-2-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Saurav Kashyap Since the version string is modified sscanf returns 4 instead of 6. Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_tmpl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 8dc82cfd38b2..591df89a4d13 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -906,8 +906,8 @@ qla27xx_driver_info(struct qla27xx_fwdt_template *tmp) uint8_t v[] = { 0, 0, 0, 0, 0, 0 }; WARN_ON_ONCE(sscanf(qla2x00_version_str, - "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu", - v+0, v+1, v+2, v+3, v+4, v+5) != 6); + "%hhu.%hhu.%hhu.%hhu", + v + 0, v + 1, v + 2, v + 3) != 4); tmp->driver_info[0] = cpu_to_le32( v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]); From patchwork Tue Sep 29 10:21:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BC79C4346E for ; Tue, 29 Sep 2020 10:23:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F0E4208FE for ; Tue, 29 Sep 2020 10:23:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="e3du6IDq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725779AbgI2KXG (ORCPT ); Tue, 29 Sep 2020 06:23:06 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:16226 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725372AbgI2KXG (ORCPT ); Tue, 29 Sep 2020 06:23:06 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAKwE4011369 for ; Tue, 29 Sep 2020 03:23:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=svh8l0gXt6PZ6a5OKN1nZQstK2owoOE/VfFCHS5NBlU=; b=e3du6IDqJVbTnJjgS2WRx3LFRuXla3pDoo2InFHgMjWBbhHev8RdzrsRdr26JWIIJpHy 3AE5541dDZ5FYBW2nCAzLyFmq29T+GYHOOtG5ESoKEE7rkHDDBnOo8N8cVDhUTadPA6s 0NCnfx9jrAMt04dGDvehzhRp6EsnZxlVssIHURwS5XbLUs/71Z/ISpp4PJNyZgCOeg/P T2j73jAdliHBPDDgfIOTYeESusHD+NmB6FJG6G/3d4/SinHYf6NONAKtcbWWkSuifHsj i/nm0vCR+qT5JtIUkH52ear8IFHIqWWyF/naOE6nS26XBBMa85N5CMvs+zBYlYWW2f7x eQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 33teembday-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:23:05 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:23:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:23:04 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id AC0A73F7040; Tue, 29 Sep 2020 03:23:04 -0700 (PDT) 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 08TAN4gx032329; Tue, 29 Sep 2020 03:23:04 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TAN4Qg032328; Tue, 29 Sep 2020 03:23:04 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 2/7] qla2xxx: Fix buffer-buffer credit extraction error Date: Tue, 29 Sep 2020 03:21:47 -0700 Message-ID: <20200929102152.32278-3-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran Current code uses wrong mailbox option to extract bbc from fw. This field is nested inside of Plogi payload. Extract bbc from PLOGI template payload. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 4 ++- drivers/scsi/qla2xxx/qla_init.c | 50 +++++++++++++++++---------------- drivers/scsi/qla2xxx/qla_iocb.c | 3 +- drivers/scsi/qla2xxx/qla_mbx.c | 39 ------------------------- drivers/scsi/qla2xxx/qla_os.c | 19 +++---------- 5 files changed, 34 insertions(+), 81 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index fa31301528bd..98814a9a8ea6 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3915,6 +3915,7 @@ struct qla_hw_data { /* Enabled in Driver */ uint32_t scm_enabled:1; uint32_t max_req_queue_warned:1; + uint32_t plogi_template_valid:1; } flags; uint16_t max_exchg; @@ -4263,7 +4264,8 @@ struct qla_hw_data { int exchoffld_count; /* n2n */ - struct els_plogi_payload plogi_els_payld; + struct fc_els_flogi plogi_els_payld; +#define LOGIN_TEMPLATE_SIZE (sizeof(struct fc_els_flogi) - 4) void *swl; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 980e39b8b3de..4659c8bc8c0d 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4981,6 +4981,29 @@ qla2x00_free_fcport(fc_port_t *fcport) kfree(fcport); } +static void qla_get_login_template(scsi_qla_host_t *vha) +{ + struct qla_hw_data *ha = vha->hw; + int rval; + u32 *bp, sz; + __be32 *q; + + memset(ha->init_cb, 0, ha->init_cb_size); + sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size); + rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, + ha->init_cb, sz); + if (rval != QLA_SUCCESS) { + ql_dbg(ql_dbg_init, vha, 0x00d1, + "PLOGI ELS param read fail.\n"); + return; + } + q = (__be32 *)&ha->plogi_els_payld.fl_csp; + + bp = (uint32_t *)ha->init_cb; + cpu_to_be32_array(q, bp, sz / 4); + ha->flags.plogi_template_valid = 1; +} + /* * qla2x00_configure_loop * Updates Fibre Channel Device Database with what is actually on loop. @@ -5024,6 +5047,7 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) clear_bit(RSCN_UPDATE, &vha->dpc_flags); qla2x00_get_data_rate(vha); + qla_get_login_template(vha); /* Determine what we need to do */ if ((ha->current_topology == ISP_CFG_FL || @@ -5108,32 +5132,11 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) static int qla2x00_configure_n2n_loop(scsi_qla_host_t *vha) { - struct qla_hw_data *ha = vha->hw; unsigned long flags; fc_port_t *fcport; - int rval; - - if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { - /* borrowing */ - u32 *bp, sz; - - memset(ha->init_cb, 0, ha->init_cb_size); - sz = min_t(int, sizeof(struct els_plogi_payload), - ha->init_cb_size); - rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, - ha->init_cb, sz); - if (rval == QLA_SUCCESS) { - __be32 *q = &ha->plogi_els_payld.data[0]; - bp = (uint32_t *)ha->init_cb; - cpu_to_be32_array(q, bp, sz / 4); - memcpy(bp, q, sizeof(ha->plogi_els_payld.data)); - } else { - ql_dbg(ql_dbg_init, vha, 0x00d1, - "PLOGI ELS param read fail.\n"); - goto skip_login; - } - } + if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); list_for_each_entry(fcport, &vha->vp_fcports, list) { if (fcport->n2n_flag) { @@ -5142,7 +5145,6 @@ static int qla2x00_configure_n2n_loop(scsi_qla_host_t *vha) } } -skip_login: spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_retry++; spin_unlock_irqrestore(&vha->work_lock, flags); diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 310db7e4e233..3202c9ca42f6 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -3013,8 +3013,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, memset(ptr, 0, sizeof(struct els_plogi_payload)); memset(resp_ptr, 0, sizeof(struct els_plogi_payload)); memcpy(elsio->u.els_plogi.els_plogi_pyld->data, - &ha->plogi_els_payld.data, - sizeof(elsio->u.els_plogi.els_plogi_pyld->data)); + &ha->plogi_els_payld.fl_csp, LOGIN_TEMPLATE_SIZE); elsio->u.els_plogi.els_cmd = els_opcode; elsio->u.els_plogi.els_plogi_pyld->opcode = els_opcode; diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 92166b86369a..d861d025bce1 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -4979,45 +4979,6 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha) return rval; } -int -qla24xx_get_buffer_credits(scsi_qla_host_t *vha, struct buffer_credit_24xx *bbc, - dma_addr_t bbc_dma) -{ - mbx_cmd_t mc; - mbx_cmd_t *mcp = &mc; - int rval; - - if (!IS_FWI2_CAPABLE(vha->hw)) - return QLA_FUNCTION_FAILED; - - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x118e, - "Entered %s.\n", __func__); - - mcp->mb[0] = MBC_GET_RNID_PARAMS; - mcp->mb[1] = RNID_BUFFER_CREDITS << 8; - mcp->mb[2] = MSW(LSD(bbc_dma)); - mcp->mb[3] = LSW(LSD(bbc_dma)); - mcp->mb[6] = MSW(MSD(bbc_dma)); - mcp->mb[7] = LSW(MSD(bbc_dma)); - mcp->mb[8] = sizeof(*bbc) / sizeof(*bbc->parameter); - mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; - mcp->in_mb = MBX_1|MBX_0; - mcp->buf_size = sizeof(*bbc); - mcp->flags = MBX_DMA_IN; - mcp->tov = MBX_TOV_SECONDS; - rval = qla2x00_mailbox_command(vha, mcp); - - if (rval != QLA_SUCCESS) { - ql_dbg(ql_dbg_mbx, vha, 0x118f, - "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); - } else { - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1190, - "Done %s.\n", __func__); - } - - return rval; -} - static int qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp) { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b943b2f1df6b..6c4dc8eff8b8 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5837,12 +5837,10 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, dma_addr_t rsp_els_dma; dma_addr_t rsp_payload_dma; dma_addr_t stat_dma; - dma_addr_t bbc_dma; dma_addr_t sfp_dma; struct els_entry_24xx *rsp_els = NULL; struct rdp_rsp_payload *rsp_payload = NULL; struct link_statistics *stat = NULL; - struct buffer_credit_24xx *bbc = NULL; uint8_t *sfp = NULL; uint16_t sfp_flags = 0; uint rsp_payload_length = sizeof(*rsp_payload); @@ -5886,9 +5884,6 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), &stat_dma, GFP_KERNEL); - bbc = dma_alloc_coherent(&ha->pdev->dev, sizeof(*bbc), - &bbc_dma, GFP_KERNEL); - /* Prepare Response IOCB */ rsp_els->entry_type = ELS_IOCB_TYPE; rsp_els->entry_count = 1; @@ -6042,13 +6037,10 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); - if (bbc) { - memset(bbc, 0, sizeof(*bbc)); - rval = qla24xx_get_buffer_credits(vha, bbc, bbc_dma); - if (!rval) { - rsp_payload->buffer_credit_desc.fcport_b2b = - cpu_to_be32(LSW(bbc->parameter[0])); - } + if (ha->flags.plogi_template_valid) { + uint32_t tmp = + be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); + rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); } if (rsp_payload_length < sizeof(*rsp_payload)) @@ -6226,9 +6218,6 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, } dealloc: - if (bbc) - dma_free_coherent(&ha->pdev->dev, sizeof(*bbc), - bbc, bbc_dma); if (stat) dma_free_coherent(&ha->pdev->dev, sizeof(*stat), stat, stat_dma); From patchwork Tue Sep 29 10:21:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 287303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEC86C4346E for ; Tue, 29 Sep 2020 10:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A101208FE for ; Tue, 29 Sep 2020 10:23:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="VowAp4e5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725826AbgI2KXb (ORCPT ); Tue, 29 Sep 2020 06:23:31 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:46596 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KXb (ORCPT ); Tue, 29 Sep 2020 06:23:31 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TALrSg005982 for ; Tue, 29 Sep 2020 03:23:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=n33VcpdG/yDAZCXJpa84CiLvt1EztZ7EKH6PWWKKzLc=; b=VowAp4e5XN05qz3s/0B8DAwaPmqJP1xlFl5xJSnupjfBfuw9px/AYD0P6A60oepNDh8x VbN1Y8rfERS/KJCnb3Bsh77I0C6fWLLUEUP+OcIrTkXB85Qb0sN82A+Ra3fUFg919X5G BxqJPzJ1zBpSgsVpGaOstCrPQeJFh2h+6GN/XBwbzyA+NsCJejYgV2K5Unkl67AVPVx7 ev7OszCDE7Cyxop4NE1HwVb0N0qfsRkc0M8ly0+aFkkMoXK3yQuPMA6o/SC6V3Hi+esL fcrmk/mtXXB/yiZWtg1EFnFMv3OVWL7GF+eJZuFCNJA/3rvKpdfPnrPuBQBdz6BeW3yf zw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p5g23-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:23:29 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:23:28 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:23:28 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id C72E93F703F; Tue, 29 Sep 2020 03:23:28 -0700 (PDT) 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 08TANSgt032341; Tue, 29 Sep 2020 03:23:28 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TANSoJ032332; Tue, 29 Sep 2020 03:23:28 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 3/7] qla2xxx: Fix MPI reset needed message Date: Tue, 29 Sep 2020 03:21:48 -0700 Message-ID: <20200929102152.32278-4-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi When printing the message: "MPI Heartbeat stop. MPI reset is not needed.." ..the wrong register was checked leading to always printing that MPI reset is not needed, even when it is needed. Fix the MPI reset message. Fixes: cbb01c2f2f630 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index bb3beaa77d39..27c2a89bd2ff 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -767,7 +767,7 @@ qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb) ql_log(ql_log_warn, vha, 0x02f0, "MPI Heartbeat stop. MPI reset is%s needed. " "MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n", - mb[0] & BIT_8 ? "" : " not", + mb[1] & BIT_8 ? "" : " not", mb[0], mb[1], mb[2], mb[3]); if ((mb[1] & BIT_8) == 0) From patchwork Tue Sep 29 10:21:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA615C4346E for ; Tue, 29 Sep 2020 10:23:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F345208FE for ; Tue, 29 Sep 2020 10:23:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="fIrvwbal" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727805AbgI2KX5 (ORCPT ); Tue, 29 Sep 2020 06:23:57 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:62274 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KX4 (ORCPT ); Tue, 29 Sep 2020 06:23:56 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAKSaf004826 for ; Tue, 29 Sep 2020 03:23:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=EqZXroTSL1k5H1I9d7jidjW6GNJDwpPsaX6Isac9Zbw=; b=fIrvwbalDkhUREmCbQBlbrQ5YnVWwtL9M8CPTJ30K9q7coqGIDRcLdPNvyB6buk5Tlx0 62xNk9oAtnBVU7u2KZgZsgPI4IcYQJSlB+KEHq8np4h7UM5kjUFhRBrwW/1SD9FwXFcK YqgBhSF0C5YGGW9IAaEM0zlg3HR7/+BYaGzJ19x3tZ+KBG5hW5evN1G7af6RpzSX1MGc XsGez7CQmTqHh/DkZYsOZhGGanxtIEVABIiRUKut8AdbBqFvxUHKwyzgKc8x3ylAD3x/ 3Jm7FnMVPmiZ6LausMKQJ+vsxhkuHzCLJLnDTwOrXLEo2yvapy0Oa8Z7ekwfUlprboTC vQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p5g3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:23:55 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:23:53 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:23:53 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:23:53 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id E38463F703F; Tue, 29 Sep 2020 03:23:52 -0700 (PDT) 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 08TANqWT032345; Tue, 29 Sep 2020 03:23:52 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TANqBI032344; Tue, 29 Sep 2020 03:23:52 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 4/7] qla2xxx: Fix reset of MPI firmware Date: Tue, 29 Sep 2020 03:21:49 -0700 Message-ID: <20200929102152.32278-5-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Normally, the MPI firmware is reset when an MPI dump is collected. If an unsaved MPI dump exists in the driver, though, an alternate mechanism is used. This mechanism, which was not fully correct, is not recommended and instead an MPI dump template walk is suggested to perform the MPI reset. To allow for the MPI dump template walk, extra space is reserved in the MPI dump buffer, which gets used only when there is already an MPI dump in place. Fixes: cbb01c2f2f630 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 10 +++++-- drivers/scsi/qla2xxx/qla_gbl.h | 1 - drivers/scsi/qla2xxx/qla_init.c | 2 ++ drivers/scsi/qla2xxx/qla_tmpl.c | 49 +++++++++------------------------ 4 files changed, 23 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 1ee747ba4ecc..284b1cc91c80 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -157,6 +157,14 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj, vha->host_no); } break; + case 10: + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { + ql_log(ql_log_info, vha, 0x70e9, + "Issuing MPI firmware dump on host#%ld.\n", + vha->host_no); + ha->isp_ops->mpi_fw_dump(vha, 0); + } + break; } return count; } @@ -744,8 +752,6 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP); qla83xx_idc_unlock(vha, 0); break; - } else if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { - qla27xx_reset_mpi(vha); } else { /* Make sure FC side is not in reset */ WARN_ON_ONCE(qla2x00_wait_for_hba_online(vha) != diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 9c4d077edf9e..26dc055d93b3 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -945,6 +945,5 @@ extern void qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp); /* nvme.c */ void qla_nvme_unregister_remote_port(struct fc_port *fcport); -void qla27xx_reset_mpi(scsi_qla_host_t *vha); void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea); #endif /* _QLA_GBL_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4659c8bc8c0d..e493c2df8aad 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3288,6 +3288,8 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) j, fwdt->dump_size); dump_size += fwdt->dump_size; } + /* Add space for spare MPI fw dump. */ + dump_size += ha->fwdt[1].dump_size; } else { req_q_size = req->length * sizeof(request_t); rsp_q_size = rsp->length * sizeof(response_t); diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 591df89a4d13..0af3e7fa31f0 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -12,33 +12,6 @@ #define IOBASE(vha) IOBAR(ISPREG(vha)) #define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL) -/* hardware_lock assumed held. */ -static void -qla27xx_write_remote_reg(struct scsi_qla_host *vha, - u32 addr, u32 data) -{ - struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24; - - ql_dbg(ql_dbg_misc, vha, 0xd300, - "%s: addr/data = %xh/%xh\n", __func__, addr, data); - - wrt_reg_dword(®->iobase_addr, 0x40); - wrt_reg_dword(®->iobase_c4, data); - wrt_reg_dword(®->iobase_window, addr); -} - -void -qla27xx_reset_mpi(scsi_qla_host_t *vha) -{ - ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd301, - "Entered %s.\n", __func__); - - qla27xx_write_remote_reg(vha, 0x104050, 0x40004); - qla27xx_write_remote_reg(vha, 0x10405c, 0x4); - - vha->hw->stat.num_mpi_reset++; -} - static inline void qla27xx_insert16(uint16_t value, void *buf, ulong *len) { @@ -1028,7 +1001,6 @@ void qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) { ulong flags = 0; - bool need_mpi_reset = true; #ifndef __CHECKER__ if (!hardware_locked) @@ -1036,14 +1008,20 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) #endif if (!vha->hw->mpi_fw_dump) { ql_log(ql_log_warn, vha, 0x02f3, "-> mpi_fwdump no buffer\n"); - } else if (vha->hw->mpi_fw_dumped) { - ql_log(ql_log_warn, vha, 0x02f4, - "-> MPI firmware already dumped (%p) -- ignoring request\n", - vha->hw->mpi_fw_dump); } else { struct fwdt *fwdt = &vha->hw->fwdt[1]; ulong len; void *buf = vha->hw->mpi_fw_dump; + bool walk_template_only = false; + + if (vha->hw->mpi_fw_dumped) { + /* Use the spare area for any further dumps. */ + buf += fwdt->dump_size; + walk_template_only = true; + ql_log(ql_log_warn, vha, 0x02f4, + "-> MPI firmware already dumped -- dump saving to temporary buffer %p.\n", + buf); + } ql_log(ql_log_warn, vha, 0x02f5, "-> fwdt1 running...\n"); if (!fwdt->template) { @@ -1058,9 +1036,10 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) ql_log(ql_log_warn, vha, 0x02f7, "-> fwdt1 fwdump residual=%+ld\n", fwdt->dump_size - len); - } else { - need_mpi_reset = false; } + vha->hw->stat.num_mpi_reset++; + if (walk_template_only) + goto bailout; vha->hw->mpi_fw_dump_len = len; vha->hw->mpi_fw_dumped = 1; @@ -1072,8 +1051,6 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) } bailout: - if (need_mpi_reset) - qla27xx_reset_mpi(vha); #ifndef __CHECKER__ if (!hardware_locked) spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); From patchwork Tue Sep 29 10:21:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 287302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A53CDC4346E for ; Tue, 29 Sep 2020 10:24:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B92D208FE for ; Tue, 29 Sep 2020 10:24:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="hTYafGAN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725776AbgI2KYT (ORCPT ); Tue, 29 Sep 2020 06:24:19 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:15388 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725372AbgI2KYT (ORCPT ); Tue, 29 Sep 2020 06:24:19 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAKrlk011303 for ; Tue, 29 Sep 2020 03:24:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=asQ6Wvz7l4H8lZQDG0F8MmYG8JOKHY7wrP+xJIlxEVk=; b=hTYafGAN55g6aV0dpCeWIlBQh5d6IxnsQS3BBSe8cv+W6Ka6hSbRg3fuBoCozegq1d+S GcXZxO2npB96MyqQWpNhoVHdemvaCkmdzMeFqdjQEtPvZor2kAyiPvOxkbxl8rOvTse+ +HoQxBvAC9FNE9SMMNwd49ItoG0RBpBiqcbYTwI0lwaFNd2XJV9wcHh4Uxflb9V606CZ 7aC3pm/05y91P9gLpAYLale5iCUVn7/HSIJ1sowPeSrN04Yw5FWVJ3NUEfdX6GcFvh/n g/wmNEZsIE6VyGQrnnicrS4lr43iHzyfdqCEK8CEXY9Qh01pt7YgSsgkxOh2JFpsDiPf 9g== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 33teembdec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:24:18 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:24:17 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:24:17 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:24:17 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 0FADA3F7048; Tue, 29 Sep 2020 03:24:17 -0700 (PDT) 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 08TAOGfv032349; Tue, 29 Sep 2020 03:24:16 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TAOGEh032348; Tue, 29 Sep 2020 03:24:16 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 5/7] qla2xxx: fix crash on session cleanup with unload Date: Tue, 29 Sep 2020 03:21:50 -0700 Message-ID: <20200929102152.32278-6-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran On unload, session cleanup prematurely gave the signal for driver unload path to advance. Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 7711f95033c0..2a0d3c85766a 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1231,14 +1231,15 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) case DSC_DELETE_PEND: return; case DSC_DELETED: - if (tgt && tgt->tgt_stop && (tgt->sess_count == 0)) - wake_up_all(&tgt->waitQ); - if (sess->vha->fcport_count == 0) - wake_up_all(&sess->vha->fcport_waitQ); - if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] && - !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) + !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) { + if (tgt && tgt->tgt_stop && tgt->sess_count == 0) + wake_up_all(&tgt->waitQ); + + if (sess->vha->fcport_count == 0) + wake_up_all(&sess->vha->fcport_waitQ); return; + } break; case DSC_UPD_FCPORT: /* From patchwork Tue Sep 29 10:21:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29882C4346E for ; Tue, 29 Sep 2020 10:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E95322076A for ; Tue, 29 Sep 2020 10:24:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Ygkh5iVQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbgI2KYo (ORCPT ); Tue, 29 Sep 2020 06:24:44 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:7016 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KYo (ORCPT ); Tue, 29 Sep 2020 06:24:44 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAOOn4016033 for ; Tue, 29 Sep 2020 03:24:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=J2B967FxQWegXwzhmG4lpAFO7jjNJwncTmv5XA3hynY=; b=Ygkh5iVQYFnvVPybyElZ/8NRRo294jkKXvRaO084+0c+3o55cxdESNsEhay2J0GEsZm4 y3u0pG6nEq22eUQU185/uETVLsPfm/vgaYQDxm+NNzrrS2rTUVs0gsDnUd4NI8DgaOXR Li9ylIWgR+CGBY1Mxx6vDwosMLjnrANvsN5GY/az1/TtcX5lTbRqwPCTn/1+kuqR1hdX 1XlQSx6znWK4IeFiV7VIUWOd0MVjhNrp/js0aUmJYqL7t+YRjpxIhvG1ZdHBlesvvHNz nSWUQGPp5UW8Ll8lpLt/VPpm7zHxloG/Z53ELNU5XENjnKfKW7q1By/Lex3GfbsPhSt9 vg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p5g61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:24:43 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:24:42 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:24:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:24:41 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 2F8873F703F; Tue, 29 Sep 2020 03:24:41 -0700 (PDT) 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 08TAOfup032362; Tue, 29 Sep 2020 03:24:41 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TAOfUX032352; Tue, 29 Sep 2020 03:24:41 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 6/7] qla2xxx: Fix point-to-point (N2N) device discovery issue Date: Tue, 29 Sep 2020 03:21:51 -0700 Message-ID: <20200929102152.32278-7-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Driver was using a shorter timeout waiting for PLOGI from the peer in point-to-point configurations. Some devices takes some time (~4 seconds) to initiate the PLOGI. This peer initiating PLOGI is when the peer has a higher P-WWN. Increase the wait time based on N2N R_A_TOV. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 2 ++ drivers/scsi/qla2xxx/qla_mbx.c | 3 ++- drivers/scsi/qla2xxx/qla_os.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 98814a9a8ea6..b0b4228050e9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -5147,6 +5147,8 @@ struct sff_8247_a0 { ha->current_topology == ISP_CFG_N || \ !ha->current_topology) +#define QLA_N2N_WAIT_TIME 5 /* 2 * ra_tov(n2n) + 1 */ + #define NVME_TYPE(fcport) \ (fcport->fc4_type & FS_FC4TYPE_NVME) \ diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index d861d025bce1..d90880d5cf46 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3994,7 +3994,8 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, if (fcport) { fcport->plogi_nack_done_deadline = jiffies + HZ; - fcport->dm_login_expire = jiffies + 2*HZ; + fcport->dm_login_expire = jiffies + + QLA_N2N_WAIT_TIME * HZ; fcport->scan_state = QLA_FCPORT_FOUND; fcport->n2n_flag = 1; fcport->keep_nport_handle = 1; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 6c4dc8eff8b8..b7a0feecac76 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5097,6 +5097,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) fcport->fc4_type = e->u.new_sess.fc4_type; if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { + fcport->dm_login_expire = jiffies + + QLA_N2N_WAIT_TIME * HZ; fcport->fc4_type = FS_FC4TYPE_FCP; fcport->n2n_flag = 1; if (vha->flags.nvme_enabled) From patchwork Tue Sep 29 10:21:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 287301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B568C4346E for ; Tue, 29 Sep 2020 10:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C32B220C09 for ; Tue, 29 Sep 2020 10:25:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ROR/ZOIO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725765AbgI2KZI (ORCPT ); Tue, 29 Sep 2020 06:25:08 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:46922 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KZI (ORCPT ); Tue, 29 Sep 2020 06:25:08 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08TAOjWp016175 for ; Tue, 29 Sep 2020 03:25:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=jVI5uPjBXsG0/jyovSNpyXskUInCzg01qM6HjLLBmGE=; b=ROR/ZOIOrGEF5xqM/OmyjmL6WDjIIo6JmqBbquJ+JKs8/ZP5c+RfZ4+DxKQhH+BSXytw wzFoq1r8QjnGMmq1rRrKtDOzdeC6ZOGt8LGcKL99pQaKzWJS8s0uOkl8Mr6x/gLSldXb 7ZtAxQSyKq7LBQnPyLPSvsBjI1HWX3yUz+XrAEOKkTT6X0LwOb3KwKM4Ffc8L1RJUPIS 4YEz0yRLirYWVtKU8N+t6rJwmw25gJztd/bQkZRRWULRTYQc+llFcn2ck9NTzPj6JxIa EES0XMS1BaXWjRQb4OyikBE4lElPJWmpoBlqK5gSc272k5X4w0ddPu2wHFiaCvNuDymW 7A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p5g72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 29 Sep 2020 03:25:06 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Sep 2020 03:25:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Sep 2020 03:25:05 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 4D1A33F7041; Tue, 29 Sep 2020 03:25:05 -0700 (PDT) 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 08TAP5i0032366; Tue, 29 Sep 2020 03:25:05 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 08TAP5v1032365; Tue, 29 Sep 2020 03:25:05 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 7/7] qla2xxx: Update version to 10.02.00.103-k Date: Tue, 29 Sep 2020 03:21:52 -0700 Message-ID: <20200929102152.32278-8-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200929102152.32278-1-njavali@marvell.com> References: <20200929102152.32278-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-29_01:2020-09-29,2020-09-29 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 0f5a5f17dcef..120e511d2ed5 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -7,9 +7,9 @@ /* * Driver version */ -#define QLA2XXX_VERSION "10.02.00.102-k" +#define QLA2XXX_VERSION "10.02.00.103-k" #define QLA_DRIVER_MAJOR_VER 10 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 0 -#define QLA_DRIVER_BETA_VER 102 +#define QLA_DRIVER_BETA_VER 103