From patchwork Wed Sep 2 07:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257787 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=-13.1 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 CCCCEC433E6 for ; Wed, 2 Sep 2020 07:26:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB6272072A for ; Wed, 2 Sep 2020 07:26:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="RY9IKSJR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726895AbgIBH0j (ORCPT ); Wed, 2 Sep 2020 03:26:39 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:5746 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726800AbgIBH0i (ORCPT ); Wed, 2 Sep 2020 03:26:38 -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 0827QKbL016285 for ; Wed, 2 Sep 2020 00:26:38 -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=9Bk0beYoQkq7tpt7w6zQSf7zYtMMFyVtIAUKOKMYVbc=; b=RY9IKSJR+c0Ou0UlGdKqu2pLI9BAIx92XajoE35q4i+5vCeLVmpFbxhUxwQ6N8ZeLb2E Rkeg+d+LkEJ8Lh6M25IFENhcz1JtZo4r5LZ7DGnpCPfJTKpphap2jaOxrOPpAKpG1sey htDUl7xx2Clekj8pGeUhheFVHtNRWiRptM3nboBK2cBIW8RQQdHbHcd6ohqAMuoSrSE5 30bg9wFQyhoiDKKn2+ECcFDmxpVovDxbCaovO/Wd7djd5fM5KkEOpSRrVGfTX1ln3wZ5 WGTFqQQEO2/Z1VkuwJxazng0kdKhFKYmRzQPLEYFN7E0QI97FB50e1OH+3jvh31oVpsL cQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 337mcqdwkx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:26:38 -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; Wed, 2 Sep 2020 00:26:37 -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; Wed, 2 Sep 2020 00:26:36 -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; Wed, 2 Sep 2020 00:26:37 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id EB0283F703F; Wed, 2 Sep 2020 00:26:36 -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 0827QauB011538; Wed, 2 Sep 2020 00:26:36 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827QaDT011537; Wed, 2 Sep 2020 00:26:36 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 01/13] qla2xxx: Fix I/O failures during remote port toggle testing Date: Wed, 2 Sep 2020 00:25:36 -0700 Message-ID: <20200902072548.11491-2-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Driver was using a lower value for dev_loss_tmo making it more prone to I/O failures during remote port toggle testing. Set dev_loss_tmo to zero during remote port registration to allow nvme-fc default dev_loss_tmo to be used, which is higher than what driver was using. Signed-off-by: Arun Easi Signed-off-by: Himanshu Madhani Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 2 +- drivers/scsi/qla2xxx/qla_nvme.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 0ded9a778bb0..b05e4545ef5f 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -42,7 +42,7 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) req.port_name = wwn_to_u64(fcport->port_name); req.node_name = wwn_to_u64(fcport->node_name); req.port_role = 0; - req.dev_loss_tmo = NVME_FC_DEV_LOSS_TMO; + req.dev_loss_tmo = 0; if (fcport->nvme_prli_service_param & NVME_PRLI_SP_INITIATOR) req.port_role = FC_PORT_ROLE_NVME_INITIATOR; diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h index fbb844226630..cf45a5b277f1 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.h +++ b/drivers/scsi/qla2xxx/qla_nvme.h @@ -14,9 +14,6 @@ #include "qla_def.h" #include "qla_dsd.h" -/* default dev loss time (seconds) before transport tears down ctrl */ -#define NVME_FC_DEV_LOSS_TMO 30 - #define NVME_ATIO_CMD_OFF 32 #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF) #define Q2T_NVME_NUM_TAGS 2048 From patchwork Wed Sep 2 07:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 296906 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=-13.1 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 BD379C433E2 for ; Wed, 2 Sep 2020 07:27:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90B592072A for ; Wed, 2 Sep 2020 07:27:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ksMc9nTL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbgIBH1F (ORCPT ); Wed, 2 Sep 2020 03:27:05 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:11336 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbgIBH1E (ORCPT ); Wed, 2 Sep 2020 03:27:04 -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 0827Pbrf023781 for ; Wed, 2 Sep 2020 00:27:03 -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=SuH0Ybw/2xH4PYH/7tCX7RwbZ2Odvz7YDag3tQu0m0E=; b=ksMc9nTL0BOCF2P45rFyz6j1kxvpd+2CSW4aU7zn487Ksv4PmFn94Re5aj8geBBHc9CH aot2TJJvSPMUvM0qyfhy5i5bnfvvTd+mTmiLBDNKwLM20YcEXiUjpqmjfjDhnrlwhZak 1v1ml7ZGXBaMsxIxjiza0MCFRUQZovhvVWz4nkpUZnMKIHToPrSj+HN/6pl4hIBSezok l7uC7EVC4v4r2aIdcQ7rCUz8fZtre+PcDCw8HcT9qpC00ePSKqDOTq5YCb8BLZKcLjks pDbgghDfn9D9VcYqRgUkpAdOkYfAi/MdmC8SAGljSvUjL0xpFL9bU2EJK+mojyAO6a0a Aw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq5461-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:27:02 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:27:01 -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; Wed, 2 Sep 2020 00:27:00 -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; Wed, 2 Sep 2020 00:27:01 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 15E843F7043; Wed, 2 Sep 2020 00:27:01 -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 0827R0WL011542; Wed, 2 Sep 2020 00:27:00 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827R0G8011541; Wed, 2 Sep 2020 00:27:00 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 02/13] qla2xxx: Setup debugfs entries for remote ports Date: Wed, 2 Sep 2020 00:25:37 -0700 Message-ID: <20200902072548.11491-3-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Create a base for adding remote port related entries in debugfs. Signed-off-by: Arun Easi Signed-off-by: Himanshu Madhani Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_def.h | 4 +++ drivers/scsi/qla2xxx/qla_dfs.c | 42 ++++++++++++++++++++++++++++++- drivers/scsi/qla2xxx/qla_gbl.h | 2 ++ drivers/scsi/qla2xxx/qla_init.c | 2 ++ drivers/scsi/qla2xxx/qla_target.c | 2 ++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 1bc090d8a71b..074d8753cfc3 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2544,6 +2544,8 @@ typedef struct fc_port { u8 last_login_state; u16 n2n_link_reset_cnt; u16 n2n_chip_reset; + + struct dentry *dfs_rport_dir; } fc_port_t; enum { @@ -4780,6 +4782,8 @@ typedef struct scsi_qla_host { uint16_t ql2xexchoffld; uint16_t ql2xiniexchg; + struct dentry *dfs_rport_root; + struct purex_list { struct list_head head; spinlock_t lock; diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index e62b2115235e..3c4b9b549b17 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -12,6 +12,29 @@ static struct dentry *qla2x00_dfs_root; static atomic_t qla2x00_dfs_root_count; +void +qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) +{ + char wwn[32]; + + if (!vha->dfs_rport_root || fp->dfs_rport_dir) + return; + + sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name)); + fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root); + if (!fp->dfs_rport_dir) + return; +} + +void +qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp) +{ + if (!vha->dfs_rport_root || !fp->dfs_rport_dir) + return; + debugfs_remove_recursive(fp->dfs_rport_dir); + fp->dfs_rport_dir = NULL; +} + static int qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) { @@ -473,9 +496,21 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha) ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess", S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_sess_ops); - if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) + if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) { ha->tgt.dfs_naqp = debugfs_create_file("naqp", 0400, ha->dfs_dir, vha, &dfs_naqp_ops); + if (!ha->tgt.dfs_naqp) { + ql_log(ql_log_warn, vha, 0xd011, + "Unable to create debugFS naqp node.\n"); + goto out; + } + } + vha->dfs_rport_root = debugfs_create_dir("rports", ha->dfs_dir); + if (!vha->dfs_rport_root) { + ql_log(ql_log_warn, vha, 0xd012, + "Unable to create debugFS rports node.\n"); + goto out; + } out: return 0; } @@ -515,6 +550,11 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha) ha->dfs_fce = NULL; } + if (vha->dfs_rport_root) { + debugfs_remove_recursive(vha->dfs_rport_root); + vha->dfs_rport_root = NULL; + } + if (ha->dfs_dir) { debugfs_remove(ha->dfs_dir); ha->dfs_dir = NULL; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 0ced18f3104e..36c210c24f72 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -935,6 +935,8 @@ void qlt_clr_qp_table(struct scsi_qla_host *vha); void qlt_set_mode(struct scsi_qla_host *); int qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode); extern void qla24xx_process_purex_list(struct purex_list *); +extern void qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp); +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); diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 57a2d76aa691..b4d53eb4e53e 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5486,6 +5486,8 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) qla2x00_iidma_fcport(vha, fcport); + qla2x00_dfs_create_rport(vha, fcport); + if (NVME_TARGET(vha->hw, fcport)) { qla_nvme_register_remote(vha, fcport); qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_COMPLETE); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 1237d952973d..e28a977b0770 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1111,6 +1111,8 @@ void qlt_free_session_done(struct work_struct *work) spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); sess->free_pending = 0; + qla2x00_dfs_remove_rport(vha, sess); + ql_dbg(ql_dbg_disc, vha, 0xf001, "Unregistration of sess %p %8phC finished fcp_cnt %d\n", sess, sess->port_name, vha->fcport_count); From patchwork Wed Sep 2 07:25:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257786 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=-13.1 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 E7351C433E7 for ; Wed, 2 Sep 2020 07:27:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5FFF2072A for ; Wed, 2 Sep 2020 07:27:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="X5i7xlK1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbgIBH1d (ORCPT ); Wed, 2 Sep 2020 03:27:33 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:13126 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbgIBH12 (ORCPT ); Wed, 2 Sep 2020 03:27:28 -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 0827Pbrh023781 for ; Wed, 2 Sep 2020 00:27:27 -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=EWwQBcTDZhWPih78oYDnA7hOu/19oLEPOohIpbP/06k=; b=X5i7xlK1SDr6VpC2p1rEUmO4Zf4DgGJ1MbgFzISS0+DdD0HQqB0xC0ly3dN/0GL9Ny2a ArcvxeYf4fFmNVwndJGQm6Fneus4/ypp/QdUL7SKyrID3gSDjaRWJaSGb/QT9BiS4PaH 7o1ty+IUf9tKm1/Y1xAWwh/caEiYSCTTMJWD8t1i9AfaueOaqB7wuMQzO5Yq24+lit00 UoypE3xH/Ojh7jSO15xmEe/GNunYyUWAnShAlI+qO6ce+24RL2naqDNavK53qlvHXSRm eCdFx9IffgLymFT3HXKY9bzHYUbW1ddNECRe/3v7oAajcPBNR39HyaIHuJRDb+ocD9n7 lQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq547c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:27:27 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:27:25 -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; Wed, 2 Sep 2020 00:27:25 -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; Wed, 2 Sep 2020 00:27:25 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 330943F703F; Wed, 2 Sep 2020 00:27:25 -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 0827RPt9011555; Wed, 2 Sep 2020 00:27:25 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827RPgx011545; Wed, 2 Sep 2020 00:27:25 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 03/13] qla2xxx: Allow dev_loss_tmo setting for FC-NVMe devices Date: Wed, 2 Sep 2020 00:25:38 -0700 Message-ID: <20200902072548.11491-4-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Add a remote port debugfs entry to get/set dev_loss_tmo for NVMe devices. Signed-off-by: Arun Easi Signed-off-by: Himanshu Madhani Signed-off-by: Nilesh Javali Reported-by: kernel test robot Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dfs.c | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 3c4b9b549b17..616ce891818d 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -12,6 +12,61 @@ static struct dentry *qla2x00_dfs_root; static atomic_t qla2x00_dfs_root_count; +#define QLA_DFS_RPORT_DEVLOSS_TMO 1 + +static int +qla_dfs_rport_get(struct fc_port *fp, int attr_id, u64 *val) +{ + switch (attr_id) { + case QLA_DFS_RPORT_DEVLOSS_TMO: + /* Only supported for FC-NVMe devices that are registered. */ + if (!(fp->nvme_flag & NVME_FLAG_REGISTERED)) + return -EIO; + *val = fp->nvme_remote_port->dev_loss_tmo; + break; + default: + return -EINVAL; + } + return 0; +} + +static int +qla_dfs_rport_set(struct fc_port *fp, int attr_id, u64 val) +{ + switch (attr_id) { + case QLA_DFS_RPORT_DEVLOSS_TMO: + /* Only supported for FC-NVMe devices that are registered. */ + if (!(fp->nvme_flag & NVME_FLAG_REGISTERED)) + return -EIO; +#if (IS_ENABLED(CONFIG_NVME_FC)) + return nvme_fc_set_remoteport_devloss(fp->nvme_remote_port, + val); +#else /* CONFIG_NVME_FC */ + return -EINVAL; +#endif /* CONFIG_NVME_FC */ + default: + return -EINVAL; + } + return 0; +} + +#define DEFINE_QLA_DFS_RPORT_RW_ATTR(_attr_id, _attr) \ +static int qla_dfs_rport_##_attr##_get(void *data, u64 *val) \ +{ \ + struct fc_port *fp = data; \ + return qla_dfs_rport_get(fp, _attr_id, val); \ +} \ +static int qla_dfs_rport_##_attr##_set(void *data, u64 val) \ +{ \ + struct fc_port *fp = data; \ + return qla_dfs_rport_set(fp, _attr_id, val); \ +} \ +DEFINE_DEBUGFS_ATTRIBUTE(qla_dfs_rport_##_attr##_fops, \ + qla_dfs_rport_##_attr##_get, \ + qla_dfs_rport_##_attr##_set, "%llu\n") + +DEFINE_QLA_DFS_RPORT_RW_ATTR(QLA_DFS_RPORT_DEVLOSS_TMO, dev_loss_tmo); + void qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) { @@ -24,6 +79,9 @@ qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root); if (!fp->dfs_rport_dir) return; + if (NVME_TARGET(vha->hw, fp)) + debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir, + fp, &qla_dfs_rport_dev_loss_tmo_fops); } void From patchwork Wed Sep 2 07:25:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 296905 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=-13.1 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 CF492C433E2 for ; Wed, 2 Sep 2020 07:27:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5D612087C for ; Wed, 2 Sep 2020 07:27:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="A04dA4Ws" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbgIBH15 (ORCPT ); Wed, 2 Sep 2020 03:27:57 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:60738 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726167AbgIBH1u (ORCPT ); Wed, 2 Sep 2020 03:27:50 -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 0827QEQx016230 for ; Wed, 2 Sep 2020 00:27:50 -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=w2zHdnYFW/DS4x2zboVRrbKv1TQe6rPoStPkEEqdCjE=; b=A04dA4WsIbqwWMW1cz71gcLzwScILgkLMjwCr3jmEjmHV73+WXWAKbprYEs5myFVJlVe RQTTbaG/JTSIFr5BVjLMnPB4pVrB2RSJYeQbImEMFidG5eRPp93hV1ppNzIArs0k2oKe dvbHwvqoJtAqzEdjaMd1raD0mj/3Gq9fBqpsukJBIUcRt2DqI8F+J8PuaUDNHyNO0L12 Ft9Tpd4d9+O4hfK2aRwbkO5iAJYuKs4sExj6OhJ1cIhQB2LWzlyvKFyp1KeDY3pqlezK eObiigWxsNvWnzmvzGwaKGF+4Ufsf+WyWO903lQ2aUKAm4a/Q+KtObswXlELmqhwnXHe 0A== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 337mcqdwr7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:27:50 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:27:49 -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; Wed, 2 Sep 2020 00:27:49 -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; Wed, 2 Sep 2020 00:27:49 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 529F13F703F; Wed, 2 Sep 2020 00:27:49 -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 0827RnFW011559; Wed, 2 Sep 2020 00:27:49 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827RnGg011558; Wed, 2 Sep 2020 00:27:49 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 04/13] qla2xxx: Honor status qualifier in FCP_RSP per spec Date: Wed, 2 Sep 2020 00:25:39 -0700 Message-ID: <20200902072548.11491-5-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi FCP-4 (referred FCP-4 rev-2b) identifies the earlier known "retry delay timer" field as "status qualifier", which is described in SAM-5 and later specs. This fix makes appropriate driver side modifications to honor the new definition. The SAM document referred was SAM-6 rev-5. Signed-off-by: Arun Easi Signed-off-by: Himanshu Madhani Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_fw.h | 2 +- drivers/scsi/qla2xxx/qla_inline.h | 38 +++++++++++++++++++++++++++---- drivers/scsi/qla2xxx/qla_isr.c | 18 ++++----------- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index bba1b77fba7e..f0052d75849c 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -619,7 +619,7 @@ struct sts_entry_24xx { #define SF_NVME_ERSP BIT_6 #define SF_FCP_RSP_DMA BIT_0 - __le16 retry_delay; + __le16 status_qualifier; __le16 scsi_status; /* SCSI status. */ #define SS_CONFIRMATION_REQ BIT_12 diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 861dc522723c..5501b4c581ec 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -266,11 +266,41 @@ qla2x00_handle_mbx_completion(struct qla_hw_data *ha, int status) } static inline void -qla2x00_set_retry_delay_timestamp(fc_port_t *fcport, uint16_t retry_delay) +qla2x00_set_retry_delay_timestamp(fc_port_t *fcport, uint16_t sts_qual) { - if (retry_delay) - fcport->retry_delay_timestamp = jiffies + - (retry_delay * HZ / 10); + u8 scope; + u16 qual; +#define SQ_SCOPE_MASK 0xc000 /* SAM-6 rev5 5.3.2 */ +#define SQ_SCOPE_SHIFT 14 +#define SQ_QUAL_MASK 0x3fff + +#define SQ_MAX_WAIT_SEC 60 /* Max I/O hold off time in seconds. */ +#define SQ_MAX_WAIT_TIME (SQ_MAX_WAIT_SEC * 10) /* in 100ms. */ + + if (!sts_qual) /* Common case. */ + return; + + scope = (sts_qual & SQ_SCOPE_MASK) >> SQ_SCOPE_SHIFT; + /* Handle only scope 1 or 2, which is for I-T nexus. */ + if (scope != 1 && scope != 2) + return; + + /* Skip processing, if retry delay timer is already in effect. */ + if (fcport->retry_delay_timestamp && + time_before(jiffies, fcport->retry_delay_timestamp)) + return; + + qual = sts_qual & SQ_QUAL_MASK; + if (qual < 1 || qual > 0x3fef) + return; + qual = min(qual, (u16)SQ_MAX_WAIT_TIME); + + /* qual is expressed in 100ms increments. */ + fcport->retry_delay_timestamp = jiffies + (qual * HZ / 10); + + ql_log(ql_log_warn, fcport->vha, 0x5101, + "%8phC: I/O throttling requested (status qualifier = %04xh), holding off I/Os for %ums.\n", + fcport->port_name, sts_qual, qual * 100); } static inline bool diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index ab5275dbc338..d38dd6520b53 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2855,7 +2855,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) int logit = 1; int res = 0; uint16_t state_flags = 0; - uint16_t retry_delay = 0; + uint16_t sts_qual = 0; if (IS_FWI2_CAPABLE(ha)) { comp_status = le16_to_cpu(sts24->comp_status); @@ -2953,8 +2953,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) sense_len = par_sense_len = rsp_info_len = resid_len = fw_resid_len = 0; if (IS_FWI2_CAPABLE(ha)) { - u16 sts24_retry_delay = le16_to_cpu(sts24->retry_delay); - if (scsi_status & SS_SENSE_LEN_VALID) sense_len = le32_to_cpu(sts24->sense_len); if (scsi_status & SS_RESPONSE_INFO_LEN_VALID) @@ -2968,13 +2966,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) host_to_fcp_swap(sts24->data, sizeof(sts24->data)); ox_id = le16_to_cpu(sts24->ox_id); par_sense_len = sizeof(sts24->data); - /* Valid values of the retry delay timer are 0x1-0xffef */ - if (sts24_retry_delay > 0 && sts24_retry_delay < 0xfff1) { - retry_delay = sts24_retry_delay & 0x3fff; - ql_dbg(ql_dbg_io, sp->vha, 0x3033, - "%s: scope=%#x retry_delay=%#x\n", __func__, - sts24_retry_delay >> 14, retry_delay); - } + sts_qual = le16_to_cpu(sts24->status_qualifier); } else { if (scsi_status & SS_SENSE_LEN_VALID) sense_len = le16_to_cpu(sts->req_sense_length); @@ -3012,9 +3004,9 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) * Check retry_delay_timer value if we receive a busy or * queue full. */ - if (lscsi_status == SAM_STAT_TASK_SET_FULL || - lscsi_status == SAM_STAT_BUSY) - qla2x00_set_retry_delay_timestamp(fcport, retry_delay); + if (unlikely(lscsi_status == SAM_STAT_TASK_SET_FULL || + lscsi_status == SAM_STAT_BUSY)) + qla2x00_set_retry_delay_timestamp(fcport, sts_qual); /* * Based on Host and scsi status generate status code for Linux From patchwork Wed Sep 2 07:25:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257785 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=-13.1 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 B9AAEC433E2 for ; Wed, 2 Sep 2020 07:28:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 886D22072A for ; Wed, 2 Sep 2020 07:28:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="b3XdzEUv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgIBH2Q (ORCPT ); Wed, 2 Sep 2020 03:28:16 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:57894 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726167AbgIBH2P (ORCPT ); Wed, 2 Sep 2020 03:28:15 -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 0827QIKJ016280 for ; Wed, 2 Sep 2020 00:28:14 -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=MYADX4avcNZmzboiTP4xk988XHpdtl3JNgsENMOaHA8=; b=b3XdzEUvGxa8QTSpGoFrWXNdg9xJL8lu1+ReKRwn8i/wuQrdK0k3Nk9U/h33EQItFjRv Yt0l0qeWGIfIbcF5ojstmf8nIuL7PDbCW5Pnnz4rpu9wwKuUvq1MP1PAnk+RfdQzmktb 1KqSb33dYMUnw4E3pIjSdtVdr2MIKSxT+0P+BWUCEygCPr954qufwLD7OkVSwZIaYgxX 1typouJhFctYBAjm6Di/Yciln8tXp44WK8GGSiFnV+FQoNfFUiDoPYVehjZ8eeAwNeZi r/OAJiZjDY12e9efQCi05y5dOLy9+4MZmovEov/Ck1/ZebTkgAg7MFyGXuWYj2Qc1kxS sw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 337mcqdwsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:28:14 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:28:13 -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; Wed, 2 Sep 2020 00:28:13 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 7B72E3F703F; Wed, 2 Sep 2020 00:28:13 -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 0827SD6I011571; Wed, 2 Sep 2020 00:28:13 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827SDgs011562; Wed, 2 Sep 2020 00:28:13 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 05/13] qla2xxx: Reduce duplicate code in reporting speed Date: Wed, 2 Sep 2020 00:25:40 -0700 Message-ID: <20200902072548.11491-6-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran Indicate correct speed for 16G Mezz card. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 41 +------------- drivers/scsi/qla2xxx/qla_gbl.h | 2 + drivers/scsi/qla2xxx/qla_gs.c | 7 +-- drivers/scsi/qla2xxx/qla_os.c | 96 +-------------------------------- 4 files changed, 9 insertions(+), 137 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 5d93ccc73153..d006ae193677 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -3214,46 +3214,7 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha) fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports; fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count; - if (IS_CNA_CAPABLE(ha)) - speeds = FC_PORTSPEED_10GBIT; - else if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) { - if (ha->max_supported_speed == 2) { - if (ha->min_supported_speed <= 6) - speeds |= FC_PORTSPEED_64GBIT; - } - if (ha->max_supported_speed == 2 || - ha->max_supported_speed == 1) { - if (ha->min_supported_speed <= 5) - speeds |= FC_PORTSPEED_32GBIT; - } - if (ha->max_supported_speed == 2 || - ha->max_supported_speed == 1 || - ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 4) - speeds |= FC_PORTSPEED_16GBIT; - } - if (ha->max_supported_speed == 1 || - ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 3) - speeds |= FC_PORTSPEED_8GBIT; - } - if (ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 2) - speeds |= FC_PORTSPEED_4GBIT; - } - } else if (IS_QLA2031(ha)) - speeds = FC_PORTSPEED_16GBIT|FC_PORTSPEED_8GBIT| - FC_PORTSPEED_4GBIT; - else if (IS_QLA25XX(ha) || IS_QLAFX00(ha)) - speeds = FC_PORTSPEED_8GBIT|FC_PORTSPEED_4GBIT| - FC_PORTSPEED_2GBIT|FC_PORTSPEED_1GBIT; - else if (IS_QLA24XX_TYPE(ha)) - speeds = FC_PORTSPEED_4GBIT|FC_PORTSPEED_2GBIT| - FC_PORTSPEED_1GBIT; - else if (IS_QLA23XX(ha)) - speeds = FC_PORTSPEED_2GBIT|FC_PORTSPEED_1GBIT; - else - speeds = FC_PORTSPEED_1GBIT; + speeds = qla25xx_fdmi_port_speed_capability(ha); fc_host_supported_speeds(vha->host) = speeds; } diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 36c210c24f72..3360857c4405 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -704,6 +704,8 @@ int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *); void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *); void qla24xx_sp_unmap(scsi_qla_host_t *, srb_t *); void qla_scan_work_fn(struct work_struct *); +uint qla25xx_fdmi_port_speed_capability(struct qla_hw_data *); +uint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *); /* * Global Function Prototypes in qla_attr.c source file. diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 676607f2cf53..de5a944bdec2 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -1502,7 +1502,7 @@ qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd, return &p->p.req; } -static uint +uint qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) { uint speeds = 0; @@ -1546,7 +1546,7 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) } return speeds; } - if (IS_QLA25XX(ha)) + if (IS_QLA25XX(ha) || IS_QLAFX00(ha)) return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB| FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB; if (IS_QLA24XX_TYPE(ha)) @@ -1556,7 +1556,8 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) return FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB; return FDMI_PORT_SPEED_1GB; } -static uint + +uint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *ha) { switch (ha->link_data_rate) { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index f9e40a6d7189..74e6a04850c0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5810,98 +5810,6 @@ qla25xx_rdp_rsp_reduce_size(struct scsi_qla_host *vha, return true; } -static uint -qla25xx_rdp_port_speed_capability(struct qla_hw_data *ha) -{ - if (IS_CNA_CAPABLE(ha)) - return RDP_PORT_SPEED_10GB; - - if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { - unsigned int speeds = 0; - - if (ha->max_supported_speed == 2) { - if (ha->min_supported_speed <= 6) - speeds |= RDP_PORT_SPEED_64GB; - } - - if (ha->max_supported_speed == 2 || - ha->max_supported_speed == 1) { - if (ha->min_supported_speed <= 5) - speeds |= RDP_PORT_SPEED_32GB; - } - - if (ha->max_supported_speed == 2 || - ha->max_supported_speed == 1 || - ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 4) - speeds |= RDP_PORT_SPEED_16GB; - } - - if (ha->max_supported_speed == 1 || - ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 3) - speeds |= RDP_PORT_SPEED_8GB; - } - - if (ha->max_supported_speed == 0) { - if (ha->min_supported_speed <= 2) - speeds |= RDP_PORT_SPEED_4GB; - } - - return speeds; - } - - if (IS_QLA2031(ha)) - return RDP_PORT_SPEED_16GB|RDP_PORT_SPEED_8GB| - RDP_PORT_SPEED_4GB; - - if (IS_QLA25XX(ha)) - return RDP_PORT_SPEED_8GB|RDP_PORT_SPEED_4GB| - RDP_PORT_SPEED_2GB|RDP_PORT_SPEED_1GB; - - if (IS_QLA24XX_TYPE(ha)) - return RDP_PORT_SPEED_4GB|RDP_PORT_SPEED_2GB| - RDP_PORT_SPEED_1GB; - - if (IS_QLA23XX(ha)) - return RDP_PORT_SPEED_2GB|RDP_PORT_SPEED_1GB; - - return RDP_PORT_SPEED_1GB; -} - -static uint -qla25xx_rdp_port_speed_currently(struct qla_hw_data *ha) -{ - switch (ha->link_data_rate) { - case PORT_SPEED_1GB: - return RDP_PORT_SPEED_1GB; - - case PORT_SPEED_2GB: - return RDP_PORT_SPEED_2GB; - - case PORT_SPEED_4GB: - return RDP_PORT_SPEED_4GB; - - case PORT_SPEED_8GB: - return RDP_PORT_SPEED_8GB; - - case PORT_SPEED_10GB: - return RDP_PORT_SPEED_10GB; - - case PORT_SPEED_16GB: - return RDP_PORT_SPEED_16GB; - - case PORT_SPEED_32GB: - return RDP_PORT_SPEED_32GB; - - case PORT_SPEED_64GB: - return RDP_PORT_SPEED_64GB; - - default: - return RDP_PORT_SPEED_UNKNOWN; - } -} - /* * Function Name: qla24xx_process_purex_iocb * @@ -6068,9 +5976,9 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, rsp_payload->port_speed_desc.desc_len = cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( - qla25xx_rdp_port_speed_capability(ha)); + qla25xx_fdmi_port_speed_capability(ha)); rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( - qla25xx_rdp_port_speed_currently(ha)); + qla25xx_fdmi_port_speed_currently(ha)); /* Link Error Status Descriptor */ rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); From patchwork Wed Sep 2 07:25:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 296904 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=-13.1 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 4BE1DC433E6 for ; Wed, 2 Sep 2020 07:28:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D1D52072A for ; Wed, 2 Sep 2020 07:28:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="egdrFMNa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbgIBH2l (ORCPT ); Wed, 2 Sep 2020 03:28:41 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:42556 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgIBH2k (ORCPT ); Wed, 2 Sep 2020 03:28:40 -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 0827PQdT023726 for ; Wed, 2 Sep 2020 00:28:39 -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=qoRt9JOr9tD7ylGycmT52IP5m+l45Ks2NWab+X0v54M=; b=egdrFMNameLB2/FB0QWT+RD/ffINeJVc9XHJ/AVplaE9xSPP7DbCc8tvOo0qZnqPStR6 JPU6hR+FW42UV9rpvg/icKLP0fbiZiA40ERgnz6Fj5kVn7Y2V3OP0vTBB0XqUHilPjMV Pt9IS2A3StxusIgooxwrcaZjivXQw1aiBhLZUC1ekXQa4d5XxnKedBZnK7amOJkSTgP8 kG8fkUBRCFBC33Q3kTLJdh2jdVvpRjzfkkDS2VJQbLWs7fJjrYwD6bWYz7oICmuqazDY 0IkHcdmdST8KMo/g0+24SQq0z6eBr1nYuMfhyxj/fny+W7S5stGx7o50TONrDX90UK6v ow== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq54cx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:28:39 -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; Wed, 2 Sep 2020 00:28:37 -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; Wed, 2 Sep 2020 00:28:37 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 97F3A3F703F; Wed, 2 Sep 2020 00:28:37 -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 0827SbnF011575; Wed, 2 Sep 2020 00:28:37 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827SbWU011574; Wed, 2 Sep 2020 00:28:37 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 06/13] qla2xxx: Fix memory size truncation Date: Wed, 2 Sep 2020 00:25:41 -0700 Message-ID: <20200902072548.11491-7-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran Memory size calculation for Extended Login use in hardware offload was truncated when the setting was set with higher value. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 7 ++++--- drivers/scsi/qla2xxx/qla_os.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 074d8753cfc3..ad4a0ba7203c 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4216,7 +4216,7 @@ struct qla_hw_data { /* Extended Logins */ void *exlogin_buf; dma_addr_t exlogin_buf_dma; - int exlogin_size; + uint32_t exlogin_size; #define ENABLE_EXCHANGE_OFFLD BIT_2 diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 989327868dd8..ab7dbbc99c22 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -845,7 +845,7 @@ qla_get_exlogin_status(scsi_qla_host_t *vha, uint16_t *buf_sz, * Context: * Kernel context. */ -#define CONFIG_XLOGINS_MEM 0x3 +#define CONFIG_XLOGINS_MEM 0x9 int qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr) { @@ -872,8 +872,9 @@ qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr) mcp->flags = 0; rval = qla2x00_mailbox_command(vha, mcp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ - ql_dbg(ql_dbg_mbx, vha, 0x111b, "Failed=%x.\n", rval); + ql_dbg(ql_dbg_mbx, vha, 0x111b, + "EXlogin Failed=%x. MB0=%x MB11=%x\n", + rval, mcp->mb[0], mcp->mb[11]); } else { ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x118c, "Done %s.\n", __func__); diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 74e6a04850c0..31bfc0c088b7 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4379,11 +4379,12 @@ int qla2x00_set_exlogins_buffer(scsi_qla_host_t *vha) { int rval; - uint16_t size, max_cnt, temp; + uint16_t size, max_cnt; + uint32_t temp; struct qla_hw_data *ha = vha->hw; /* Return if we don't need to alloacate any extended logins */ - if (!ql2xexlogins) + if (ql2xexlogins <= MAX_FIBRE_DEVICES_2400) return QLA_SUCCESS; if (!IS_EXLOGIN_OFFLD_CAPABLE(ha)) From patchwork Wed Sep 2 07:25:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257784 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=-13.1 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 33B44C433E2 for ; Wed, 2 Sep 2020 07:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07BF02072A for ; Wed, 2 Sep 2020 07:29:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="BdEs6Vbn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbgIBH3H (ORCPT ); Wed, 2 Sep 2020 03:29:07 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:34368 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgIBH3F (ORCPT ); Wed, 2 Sep 2020 03:29:05 -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 0827Pbrq023781 for ; Wed, 2 Sep 2020 00:29:03 -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=gku2WFIZDQWrpVpLmO1cwmgJsi7npdKYAU2qKje0mK8=; b=BdEs6VbnA0YPCqqKRRXfAr3cHY2NRHa1GhcaLNth/RdLLCB8nTC5EMCBfUlB/YonIpB9 xLEQHj7qf+P8eZyKT5sySd96OMoNA5LQzvYPNRC2xdBc0rqZufSeGRkZOwcOANKK/OUr yD0L7otOEvZMa2NIiOideyci50wrzJZR+nxSVNX0ET0K+lvvc4HpRW/d6raMf+IglIJU 8rySeNoYW4S4XW5hqZOD9+agiKSng6Jl2RDKnylF67EVxn3carJvPiAyaVZtMF4M0tr+ GKPkwpVu0C7ArKnmvcycp9qZ3+iX98fVYxAsZ8O3uDSH31iVuwVx4DaaDSecUx5JHDuD Ig== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq54ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:29:03 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:29:02 -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; Wed, 2 Sep 2020 00:29:01 -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; Wed, 2 Sep 2020 00:29:01 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id C271D3F703F; Wed, 2 Sep 2020 00:29:01 -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 0827T1S0011580; Wed, 2 Sep 2020 00:29:01 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827T1WG011578; Wed, 2 Sep 2020 00:29:01 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 07/13] qla2xxx: performance tweak Date: Wed, 2 Sep 2020 00:25:42 -0700 Message-ID: <20200902072548.11491-8-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran This patch move statistic fields from vha struct to qpair to reduce memory thrashing. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_attr.c | 46 ++++++++++++++++++++++++++++----- drivers/scsi/qla2xxx/qla_def.h | 32 +++++++++++++++++------ drivers/scsi/qla2xxx/qla_init.c | 5 ++-- drivers/scsi/qla2xxx/qla_iocb.c | 18 +++++++------ drivers/scsi/qla2xxx/qla_isr.c | 8 +++--- drivers/scsi/qla2xxx/qla_mid.c | 4 +-- drivers/scsi/qla2xxx/qla_nvme.c | 8 +++--- drivers/scsi/qla2xxx/qla_os.c | 10 ++++--- 8 files changed, 92 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index d006ae193677..1ee747ba4ecc 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2726,6 +2726,9 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) struct link_statistics *stats; dma_addr_t stats_dma; struct fc_host_statistics *p = &vha->fc_host_stat; + struct qla_qpair *qpair; + int i; + u64 ib = 0, ob = 0, ir = 0, or = 0; memset(p, -1, sizeof(*p)); @@ -2762,6 +2765,27 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) if (rval != QLA_SUCCESS) goto done_free; + /* --- */ + for (i = 0; i < vha->hw->max_qpairs; i++) { + qpair = vha->hw->queue_pair_map[i]; + if (!qpair) + continue; + ir += qpair->counters.input_requests; + or += qpair->counters.output_requests; + ib += qpair->counters.input_bytes; + ob += qpair->counters.output_bytes; + } + ir += ha->base_qpair->counters.input_requests; + or += ha->base_qpair->counters.output_requests; + ib += ha->base_qpair->counters.input_bytes; + ob += ha->base_qpair->counters.output_bytes; + + ir += vha->qla_stats.input_requests; + or += vha->qla_stats.output_requests; + ib += vha->qla_stats.input_bytes; + ob += vha->qla_stats.output_bytes; + /* --- */ + p->link_failure_count = le32_to_cpu(stats->link_fail_cnt); p->loss_of_sync_count = le32_to_cpu(stats->loss_sync_cnt); p->loss_of_signal_count = le32_to_cpu(stats->loss_sig_cnt); @@ -2781,15 +2805,16 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) p->rx_words = le64_to_cpu(stats->fpm_recv_word_cnt); p->tx_words = le64_to_cpu(stats->fpm_xmit_word_cnt); } else { - p->rx_words = vha->qla_stats.input_bytes; - p->tx_words = vha->qla_stats.output_bytes; + p->rx_words = ib >> 2; + p->tx_words = ob >> 2; } } + p->fcp_control_requests = vha->qla_stats.control_requests; - p->fcp_input_requests = vha->qla_stats.input_requests; - p->fcp_output_requests = vha->qla_stats.output_requests; - p->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20; - p->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20; + p->fcp_input_requests = ir; + p->fcp_output_requests = or; + p->fcp_input_megabytes = ib >> 20; + p->fcp_output_megabytes = ob >> 20; p->seconds_since_last_reset = get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset; do_div(p->seconds_since_last_reset, HZ); @@ -2809,9 +2834,18 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost) struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); struct link_statistics *stats; dma_addr_t stats_dma; + int i; + struct qla_qpair *qpair; memset(&vha->qla_stats, 0, sizeof(vha->qla_stats)); memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat)); + for (i = 0; i < vha->hw->max_qpairs; i++) { + qpair = vha->hw->queue_pair_map[i]; + if (!qpair) + continue; + memset(&qpair->counters, 0, sizeof(qpair->counters)); + } + memset(&ha->base_qpair->counters, 0, sizeof(qpair->counters)); vha->qla_stats.jiffies_at_last_reset = get_jiffies_64(); diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index ad4a0ba7203c..3ca8665638c4 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2443,12 +2443,6 @@ typedef struct fc_port { struct list_head list; struct scsi_qla_host *vha; - uint8_t node_name[WWN_SIZE]; - uint8_t port_name[WWN_SIZE]; - port_id_t d_id; - uint16_t loop_id; - uint16_t old_loop_id; - unsigned int conf_compl_supported:1; unsigned int deleted:2; unsigned int free_pending:1; @@ -2465,6 +2459,13 @@ typedef struct fc_port { unsigned int n2n_flag:1; unsigned int explicit_logout:1; unsigned int prli_pend_timer:1; + uint8_t nvme_flag; + + uint8_t node_name[WWN_SIZE]; + uint8_t port_name[WWN_SIZE]; + port_id_t d_id; + uint16_t loop_id; + uint16_t old_loop_id; struct completion nvme_del_done; uint32_t nvme_prli_service_param; @@ -2473,7 +2474,7 @@ typedef struct fc_port { #define NVME_PRLI_SP_TARGET BIT_4 #define NVME_PRLI_SP_DISCOVERY BIT_3 #define NVME_PRLI_SP_FIRST_BURST BIT_0 - uint8_t nvme_flag; + uint32_t nvme_first_burst_size; #define NVME_FLAG_REGISTERED 4 #define NVME_FLAG_DELETING 2 @@ -3510,6 +3511,14 @@ struct qla_tgt_counters { uint64_t num_term_xchg_sent; }; +struct qla_counters { + uint64_t input_bytes; + uint64_t input_requests; + uint64_t output_bytes; + uint64_t output_requests; + +}; + struct qla_qpair; /* Response queue data structure */ @@ -3594,6 +3603,7 @@ struct qla_qpair { uint32_t enable_class_2:1; uint32_t enable_explicit_conf:1; uint32_t use_shadow_reg:1; + uint32_t rcv_intr:1; uint16_t id; /* qp number used with FW */ uint16_t vp_idx; /* vport ID */ @@ -3609,13 +3619,16 @@ struct qla_qpair { struct qla_msix_entry *msix; /* point to &ha->msix_entries[x] */ struct qla_hw_data *hw; struct work_struct q_work; + struct qla_counters counters; + struct list_head qp_list_elem; /* vha->qp_list */ struct list_head hints_list; - uint16_t cpuid; + uint16_t retry_term_cnt; __le32 retry_term_exchg_addr; uint64_t retry_term_jiff; struct qla_tgt_counters tgt_counters; + uint16_t cpuid; }; /* Place holder for FW buffer parameters */ @@ -4129,6 +4142,9 @@ struct qla_hw_data { #define USE_ASYNC_SCAN(ha) (IS_QLA25XX(ha) || IS_QLA81XX(ha) ||\ IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) +#define IS_ZIO_THRESHOLD_CAPABLE(ha) \ + (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) + /* HBA serial number */ uint8_t serial0; uint8_t serial1; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index b4d53eb4e53e..99f322fb74ab 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3690,9 +3690,8 @@ qla2x00_setup_chip(scsi_qla_host_t *vha) goto execute_fw_with_lr; } - if ((IS_QLA83XX(ha) || IS_QLA27XX(ha) || - IS_QLA28XX(ha)) && - (ha->zio_mode == QLA_ZIO_MODE_6)) + if (IS_ZIO_THRESHOLD_CAPABLE(ha) && + ha->zio_mode == QLA_ZIO_MODE_6) qla27xx_set_zio_threshold(vha, ha->last_zio_threshold); diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index e3d2dea0b057..d69e16e844aa 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -594,6 +594,7 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt, uint32_t dsd_list_len; struct dsd_dma *dsd_ptr; struct ct6_dsd *ctx; + struct qla_qpair *qpair = sp->qpair; cmd = GET_CMD_SP(sp); @@ -612,12 +613,12 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt, /* Set transfer direction */ if (cmd->sc_data_direction == DMA_TO_DEVICE) { cmd_pkt->control_flags = cpu_to_le16(CF_WRITE_DATA); - vha->qla_stats.output_bytes += scsi_bufflen(cmd); - vha->qla_stats.output_requests++; + qpair->counters.output_bytes += scsi_bufflen(cmd); + qpair->counters.output_requests++; } else if (cmd->sc_data_direction == DMA_FROM_DEVICE) { cmd_pkt->control_flags = cpu_to_le16(CF_READ_DATA); - vha->qla_stats.input_bytes += scsi_bufflen(cmd); - vha->qla_stats.input_requests++; + qpair->counters.input_bytes += scsi_bufflen(cmd); + qpair->counters.input_requests++; } cur_seg = scsi_sglist(cmd); @@ -704,6 +705,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, struct scsi_cmnd *cmd; struct scatterlist *sg; int i; + struct qla_qpair *qpair = sp->qpair; cmd = GET_CMD_SP(sp); @@ -721,12 +723,12 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, /* Set transfer direction */ if (cmd->sc_data_direction == DMA_TO_DEVICE) { cmd_pkt->task_mgmt_flags = cpu_to_le16(TMF_WRITE_DATA); - vha->qla_stats.output_bytes += scsi_bufflen(cmd); - vha->qla_stats.output_requests++; + qpair->counters.output_bytes += scsi_bufflen(cmd); + qpair->counters.output_requests++; } else if (cmd->sc_data_direction == DMA_FROM_DEVICE) { cmd_pkt->task_mgmt_flags = cpu_to_le16(TMF_READ_DATA); - vha->qla_stats.input_bytes += scsi_bufflen(cmd); - vha->qla_stats.input_requests++; + qpair->counters.input_bytes += scsi_bufflen(cmd); + qpair->counters.input_requests++; } /* One DSD is available in the Command Type 3 IOCB */ diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index d38dd6520b53..a63f2000fadf 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3414,8 +3414,10 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, if (!ha->flags.fw_started) return; - if (rsp->qpair->cpuid != smp_processor_id()) + if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) { + rsp->qpair->rcv_intr = 1; qla_cpu_update(rsp->qpair, smp_processor_id()); + } while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { pkt = (struct sts_entry_24xx *)rsp->ring_ptr; @@ -3865,7 +3867,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id) } ha = qpair->hw; - queue_work(ha->wq, &qpair->q_work); + queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work); return IRQ_HANDLED; } @@ -3891,7 +3893,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id) wrt_reg_dword(®->hccr, HCCRX_CLR_RISC_INT); spin_unlock_irqrestore(&ha->hardware_lock, flags); - queue_work(ha->wq, &qpair->q_work); + queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work); return IRQ_HANDLED; } diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 15efe2f04b86..08cfe043ac66 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -808,11 +808,9 @@ static void qla_do_work(struct work_struct *work) { unsigned long flags; struct qla_qpair *qpair = container_of(work, struct qla_qpair, q_work); - struct scsi_qla_host *vha; - struct qla_hw_data *ha = qpair->hw; + struct scsi_qla_host *vha = qpair->vha; spin_lock_irqsave(&qpair->qp_lock, flags); - vha = pci_get_drvdata(ha->pdev); qla24xx_process_response_queue(vha, qpair->rsp); spin_unlock_irqrestore(&qpair->qp_lock, flags); diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index b05e4545ef5f..b0c13144c21a 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -428,8 +428,8 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) /* No data transfer how do we check buffer len == 0?? */ if (fd->io_dir == NVMEFC_FCP_READ) { cmd_pkt->control_flags = cpu_to_le16(CF_READ_DATA); - vha->qla_stats.input_bytes += fd->payload_length; - vha->qla_stats.input_requests++; + qpair->counters.input_bytes += fd->payload_length; + qpair->counters.input_requests++; } else if (fd->io_dir == NVMEFC_FCP_WRITE) { cmd_pkt->control_flags = cpu_to_le16(CF_WRITE_DATA); if ((vha->flags.nvme_first_burst) && @@ -441,8 +441,8 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) cmd_pkt->control_flags |= cpu_to_le16(CF_NVME_FIRST_BURST_ENABLE); } - vha->qla_stats.output_bytes += fd->payload_length; - vha->qla_stats.output_requests++; + qpair->counters.output_bytes += fd->payload_length; + qpair->counters.output_requests++; } else if (fd->io_dir == 0) { cmd_pkt->control_flags = 0; } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 31bfc0c088b7..c53cc31cd068 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7198,8 +7198,10 @@ qla2x00_timer(struct timer_list *t) * FC-NVME * see if the active AEN count has changed from what was last reported. */ + index = atomic_read(&ha->nvme_active_aen_cnt); if (!vha->vp_idx && - (atomic_read(&ha->nvme_active_aen_cnt) != ha->nvme_last_rptd_aen) && + (index != ha->nvme_last_rptd_aen) && + (index >= DEFAULT_ZIO_THRESHOLD) && ha->zio_mode == QLA_ZIO_MODE_6 && !ha->flags.host_shutting_down) { ql_log(ql_log_info, vha, 0x3002, @@ -7211,9 +7213,9 @@ qla2x00_timer(struct timer_list *t) } if (!vha->vp_idx && - (atomic_read(&ha->zio_threshold) != ha->last_zio_threshold) && - (ha->zio_mode == QLA_ZIO_MODE_6) && - (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))) { + atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && + ha->zio_mode == QLA_ZIO_MODE_6 && + IS_ZIO_THRESHOLD_CAPABLE(ha)) { ql_log(ql_log_info, vha, 0x3002, "Sched: Set ZIO exchange threshold to %d.\n", ha->last_zio_threshold); From patchwork Wed Sep 2 07:25:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 296903 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=-13.1 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 BA698C433E2 for ; Wed, 2 Sep 2020 07:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 932642072A for ; Wed, 2 Sep 2020 07:29:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="U0nOuAPX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgIBH33 (ORCPT ); Wed, 2 Sep 2020 03:29:29 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:34638 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbgIBH33 (ORCPT ); Wed, 2 Sep 2020 03:29:29 -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 0827PZiu023775 for ; Wed, 2 Sep 2020 00:29:27 -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=gcJmb97crftgmncGJaYWhdquNw5StUWGEcsDFlJC89I=; b=U0nOuAPXMX5hY1vtIxxpQWX5fkWgCiaCJDFxqi6yasTFZ8LHnr9eq2gT1fcrETzQBQlP zr05BopMxZPtmunPrT7/cARmWnAfdoFS37PLjgF/pap7g3vvlKU44QSv7V4mHqOMroq8 BDrsG1tLele7iCnLROluQQPU83HBGg/F9Nl+WwhqvYrpvg1m3kJVyYsoJj2FBgvFqcFe rAyc/sm6kwAKZ8WzjQ1mVfUKisrWdatzf1NoKDBKavyQLX5UApSbv/KXsQ23NaDE0Fdw FlDYGSJxHm0CIfbuJ2k4m97RaLVVtyYAlveqDf3BQ+niQGs1qn1HggO2ujJMAJv3AlXF mw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq54h7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:29:27 -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; Wed, 2 Sep 2020 00:29:25 -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; Wed, 2 Sep 2020 00:29:26 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id E283B3F703F; Wed, 2 Sep 2020 00:29:25 -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 0827TP2H011592; Wed, 2 Sep 2020 00:29:25 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827TPDd011583; Wed, 2 Sep 2020 00:29:25 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 08/13] qla2xxx: Fix I/O errors during LIP reset tests Date: Wed, 2 Sep 2020 00:25:43 -0700 Message-ID: <20200902072548.11491-9-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi In .fcp_io(), returning ENODEV as soon as remote port delete has started can cause I/O errors. Fix this by returning EBUSY until the remote port delete finishes. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_nvme.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index b0c13144c21a..675f2b1180e8 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -548,6 +548,16 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, return rval; vha = fcport->vha; + + if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED)) + return rval; + + if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) + return -EBUSY; + + if ((qpair && !qpair->fw_started) || fcport->deleted) + return -EBUSY; + /* * If we know the dev is going away while the transport is still sending * IO's return busy back to stall the IO Q. This happens when the From patchwork Wed Sep 2 07:25:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 257783 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=-13.1 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 78230C433E6 for ; Wed, 2 Sep 2020 07:29:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 502CC2072A for ; Wed, 2 Sep 2020 07:29:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ZrWsBrMk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726311AbgIBH3x (ORCPT ); Wed, 2 Sep 2020 03:29:53 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:49494 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726247AbgIBH3w (ORCPT ); Wed, 2 Sep 2020 03:29:52 -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 0827QHNR016277 for ; Wed, 2 Sep 2020 00:29:51 -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=Q+0H442qC7kc0hYNuUZVRDljNpFDNadm4voVj/jsKAY=; b=ZrWsBrMk9rmZi3gtyuu6AxL8wd2R5Rqr4a0IgtI/ey5EgjM4WHEPSqHIvbISF37vgAB1 bUpkgj9WLlFq6uNgbJMm4OUBcBGKC1RQjOlkYU96Xlp39Vc5dVS+MQl1PfmSyZ5FNzTP HN8vlBh4jffVcD8m/oEV8ldBBhEn0O1kfYXXq/tpLF8syMLrj+JOFOa7Jd7spghBJr06 UnBW4OgE6w/3j1Iz6ktLBanrLPr903olBZeefB/B/fGFzljhJeG6MwwUp2aC2+sqCERo otqpxVTLTx3Af4OzRITws2CyjgMxb1LG10hb7OrkcKqJjD+N3Ti/blL06Cxy90sUJBhA 0g== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 337mcqdwy6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:29:51 -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; Wed, 2 Sep 2020 00:29:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:29:49 -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; Wed, 2 Sep 2020 00:29:50 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 095773F703F; Wed, 2 Sep 2020 00:29:50 -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 0827Tnvj011596; Wed, 2 Sep 2020 00:29:49 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827Tn2t011595; Wed, 2 Sep 2020 00:29:49 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 09/13] qla2xxx: Make tgt_port_database available in initiator mode Date: Wed, 2 Sep 2020 00:25:44 -0700 Message-ID: <20200902072548.11491-10-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi tgt_port_database data is today exported only in target mode, allow it to be shown in initiator mode, as well. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dfs.c | 64 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 616ce891818d..1e9db568aee3 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -138,51 +138,51 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) { scsi_qla_host_t *vha = s->private; struct qla_hw_data *ha = vha->hw; - struct gid_list_info *gid_list, *gid; + struct gid_list_info *gid_list; dma_addr_t gid_list_dma; fc_port_t fc_port; + char *id_iter; int rc, i; uint16_t entries, loop_id; - struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; seq_printf(s, "%s\n", vha->host_str); - if (tgt) { - gid_list = dma_alloc_coherent(&ha->pdev->dev, - qla2x00_gid_list_size(ha), - &gid_list_dma, GFP_KERNEL); - if (!gid_list) { - ql_dbg(ql_dbg_user, vha, 0x7018, - "DMA allocation failed for %u\n", - qla2x00_gid_list_size(ha)); - return 0; - } + gid_list = dma_alloc_coherent(&ha->pdev->dev, + qla2x00_gid_list_size(ha), + &gid_list_dma, GFP_KERNEL); + if (!gid_list) { + ql_dbg(ql_dbg_user, vha, 0x7018, + "DMA allocation failed for %u\n", + qla2x00_gid_list_size(ha)); + return 0; + } - rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma, - &entries); - if (rc != QLA_SUCCESS) - goto out_free_id_list; + rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma, + &entries); + if (rc != QLA_SUCCESS) + goto out_free_id_list; - gid = gid_list; + id_iter = (char *)gid_list; - seq_puts(s, "Port Name Port ID Loop ID\n"); + seq_puts(s, "Port Name Port ID Loop ID\n"); - for (i = 0; i < entries; i++) { - loop_id = le16_to_cpu(gid->loop_id); - memset(&fc_port, 0, sizeof(fc_port_t)); + for (i = 0; i < entries; i++) { + struct gid_list_info *gid = + (struct gid_list_info *)id_iter; + loop_id = le16_to_cpu(gid->loop_id); + memset(&fc_port, 0, sizeof(fc_port_t)); - fc_port.loop_id = loop_id; + fc_port.loop_id = loop_id; - rc = qla24xx_gpdb_wait(vha, &fc_port, 0); - seq_printf(s, "%8phC %02x%02x%02x %d\n", - fc_port.port_name, fc_port.d_id.b.domain, - fc_port.d_id.b.area, fc_port.d_id.b.al_pa, - fc_port.loop_id); - gid = (void *)gid + ha->gid_list_info_size; - } -out_free_id_list: - dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), - gid_list, gid_list_dma); + rc = qla24xx_gpdb_wait(vha, &fc_port, 0); + seq_printf(s, "%8phC %02x%02x%02x %d\n", + fc_port.port_name, fc_port.d_id.b.domain, + fc_port.d_id.b.area, fc_port.d_id.b.al_pa, + fc_port.loop_id); + id_iter += ha->gid_list_info_size; } +out_free_id_list: + dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), + gid_list, gid_list_dma); return 0; } From patchwork Wed Sep 2 07:25:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 296902 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=-13.1 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 94915C433E6 for ; Wed, 2 Sep 2020 07:30:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DA522084C for ; Wed, 2 Sep 2020 07:30:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="O8C+55dc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbgIBHaX (ORCPT ); Wed, 2 Sep 2020 03:30:23 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:38432 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgIBHaS (ORCPT ); Wed, 2 Sep 2020 03:30:18 -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 0827Pdti023796 for ; Wed, 2 Sep 2020 00:30:17 -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=eGJwIm8ONbHvio+t5lWdy3jqObsJGgRjDRXlZ9dz9f4=; b=O8C+55dcB9p8hIU6ajYXwwJ4Z6rTlU5uKqlzgROl+kJyRUmQJZ8qzRIQBz6oaYnqMPsA 6lJ62vrykjM+7r0vIsMnDkBMS/yCmC2zbGidP+GTGPoNdplWzuNIIQB57xXlh/zL/uo9 NHFuhWWJSUd6lfCD8mMv+fcWIgJPi7NBksMaCpMQmFT7oK8hanXEabwfcTguux6Y6yq6 F0ZqPZUN0a1VVFYZ4Lbo+1+4DXIHXGylAIE9iqzJ+W5oVtxB+gKI6xekCrE73wyE8An7 U8ZzyQmWbDCA06eouo1BZVtJS42FsxyJ6BKiESsmkzBesTejs2y/uRUxopAAf5YBNSpX DA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq54mf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:30:17 -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; Wed, 2 Sep 2020 00:30:15 -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; Wed, 2 Sep 2020 00:30:14 -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; Wed, 2 Sep 2020 00:30:14 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 2B6563F7051; Wed, 2 Sep 2020 00:30:14 -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 0827UETP011664; Wed, 2 Sep 2020 00:30:14 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827UDco011599; Wed, 2 Sep 2020 00:30:13 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 10/13] qla2xxx: Add rport fields in debugfs Date: Wed, 2 Sep 2020 00:25:45 -0700 Message-ID: <20200902072548.11491-11-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi This patch adds rport fields in debugfs. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_dfs.c | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 1e9db568aee3..118f2b223531 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -65,13 +65,53 @@ DEFINE_DEBUGFS_ATTRIBUTE(qla_dfs_rport_##_attr##_fops, \ qla_dfs_rport_##_attr##_get, \ qla_dfs_rport_##_attr##_set, "%llu\n") +/* + * Wrapper for getting fc_port fields. + * + * _attr : Attribute name. + * _get_val : Accessor macro to retrieve the value. + */ +#define DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, _get_val) \ +static int qla_dfs_rport_field_##_attr##_get(void *data, u64 *val) \ +{ \ + struct fc_port *fp = data; \ + *val = _get_val; \ + return 0; \ +} \ +DEFINE_DEBUGFS_ATTRIBUTE(qla_dfs_rport_field_##_attr##_fops, \ + qla_dfs_rport_field_##_attr##_get, \ + NULL, "%llu\n") + +#define DEFINE_QLA_DFS_RPORT_ACCESS(_attr, _get_val) \ + DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, _get_val) + +#define DEFINE_QLA_DFS_RPORT_FIELD(_attr) \ + DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, fp->_attr) + DEFINE_QLA_DFS_RPORT_RW_ATTR(QLA_DFS_RPORT_DEVLOSS_TMO, dev_loss_tmo); +DEFINE_QLA_DFS_RPORT_FIELD(disc_state); +DEFINE_QLA_DFS_RPORT_FIELD(scan_state); +DEFINE_QLA_DFS_RPORT_FIELD(fw_login_state); +DEFINE_QLA_DFS_RPORT_FIELD(login_pause); +DEFINE_QLA_DFS_RPORT_FIELD(flags); +DEFINE_QLA_DFS_RPORT_FIELD(nvme_flag); +DEFINE_QLA_DFS_RPORT_FIELD(last_rscn_gen); +DEFINE_QLA_DFS_RPORT_FIELD(rscn_gen); +DEFINE_QLA_DFS_RPORT_FIELD(login_gen); +DEFINE_QLA_DFS_RPORT_FIELD(loop_id); +DEFINE_QLA_DFS_RPORT_FIELD_GET(port_id, fp->d_id.b24); +DEFINE_QLA_DFS_RPORT_FIELD_GET(sess_kref, kref_read(&fp->sess_kref)); + void qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) { char wwn[32]; +#define QLA_CREATE_RPORT_FIELD_ATTR(_attr) \ + debugfs_create_file(#_attr, 0400, fp->dfs_rport_dir, \ + fp, &qla_dfs_rport_field_##_attr##_fops) + if (!vha->dfs_rport_root || fp->dfs_rport_dir) return; @@ -82,6 +122,19 @@ qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) if (NVME_TARGET(vha->hw, fp)) debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir, fp, &qla_dfs_rport_dev_loss_tmo_fops); + + QLA_CREATE_RPORT_FIELD_ATTR(disc_state); + QLA_CREATE_RPORT_FIELD_ATTR(scan_state); + QLA_CREATE_RPORT_FIELD_ATTR(fw_login_state); + QLA_CREATE_RPORT_FIELD_ATTR(login_pause); + QLA_CREATE_RPORT_FIELD_ATTR(flags); + QLA_CREATE_RPORT_FIELD_ATTR(nvme_flag); + QLA_CREATE_RPORT_FIELD_ATTR(last_rscn_gen); + QLA_CREATE_RPORT_FIELD_ATTR(rscn_gen); + QLA_CREATE_RPORT_FIELD_ATTR(login_gen); + QLA_CREATE_RPORT_FIELD_ATTR(loop_id); + QLA_CREATE_RPORT_FIELD_ATTR(port_id); + QLA_CREATE_RPORT_FIELD_ATTR(sess_kref); } void From patchwork Wed Sep 2 07:25: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: 257782 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=-13.1 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 7B7B3C433E2 for ; Wed, 2 Sep 2020 07:30:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F83F2084C for ; Wed, 2 Sep 2020 07:30:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ObVdLSS9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbgIBHam (ORCPT ); Wed, 2 Sep 2020 03:30:42 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:65200 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726144AbgIBHal (ORCPT ); Wed, 2 Sep 2020 03:30:41 -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 0827QHNX016277 for ; Wed, 2 Sep 2020 00:30:40 -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=d6pFgtvI0RCf8rTYtlYpncVxMDeFUFgnH2RnBhbu3nA=; b=ObVdLSS9dnkdeay6bzOiZ3JW0cSdI1s5jR/Zan0c6uGQVUZemjO3IMaebyNR3IDOZshD ob3nFmzrRds/TUJ3h04y9dwx7CnKzhppdwFJBkYZ/v4WTLHJrIEAEsH8tQgbyQhUZpPs EQBhbWKfQu4cefs+LZoqVnxH1qaVpg6mwrcTYjAojL7pcOHaucPxi1iIfZ54DyRUbDhs ngVJlVXSmVixujKqju3agzVBkIDlOn0wE5gHmK/qufSYQQ4nOHuoJvOv9QTMu4FAqhAA UQNxtDOu1AKuEmxnpJ5UzBuNBvDqUh61+sMjF2NSlHY90QMpxeSQqFvZk9Qils4+H52C bQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 337mcqdx4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:30:40 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:30:39 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Sep 2020 00:30:38 -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; Wed, 2 Sep 2020 00:30:38 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 5A4203F7045; Wed, 2 Sep 2020 00:30:38 -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 0827Uc41011668; Wed, 2 Sep 2020 00:30:38 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827UcDM011667; Wed, 2 Sep 2020 00:30:38 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 11/13] qla2xxx: Add IOCB resource tracking Date: Wed, 2 Sep 2020 00:25:46 -0700 Message-ID: <20200902072548.11491-12-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran This patch tracks number of IOCB resources used in the IO fast path. If the number of used IOCBs reach a high water limit, driver would return the IO as busy and let upper layer retry. This prevents over subscription of IOCB resources where any future error recovery command is unable to cut through. Enable IOCB throttling by default. Signed-off-by: Quinn Tran Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_def.h | 17 ++++++++++ drivers/scsi/qla2xxx/qla_dfs.c | 14 ++++++++ drivers/scsi/qla2xxx/qla_gbl.h | 3 ++ drivers/scsi/qla2xxx/qla_init.c | 26 +++++++++++++++ drivers/scsi/qla2xxx/qla_inline.h | 55 +++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_iocb.c | 28 ++++++++++++++++ drivers/scsi/qla2xxx/qla_isr.c | 2 ++ drivers/scsi/qla2xxx/qla_os.c | 6 ++++ 8 files changed, 151 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 3ca8665638c4..863b9c7766e1 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -624,6 +624,12 @@ enum { TYPE_TGT_TMCMD, /* task management */ }; +struct iocb_resource { + u8 res_type; + u8 pad; + u16 iocb_cnt; +}; + typedef struct srb { /* * Do not move cmd_type field, it needs to @@ -631,6 +637,7 @@ typedef struct srb { */ uint8_t cmd_type; uint8_t pad[3]; + struct iocb_resource iores; struct kref cmd_kref; /* need to migrate ref_count over to this */ void *priv; wait_queue_head_t nvme_ls_waitq; @@ -3577,6 +3584,15 @@ struct req_que { uint8_t req_pkt[REQUEST_ENTRY_SIZE]; }; +struct qla_fw_resources { + u16 iocbs_total; + u16 iocbs_limit; + u16 iocbs_qp_limit; + u16 iocbs_used; +}; + +#define QLA_IOCB_PCT_LIMIT 95 + /*Queue pair data structure */ struct qla_qpair { spinlock_t qp_lock; @@ -3629,6 +3645,7 @@ struct qla_qpair { uint64_t retry_term_jiff; struct qla_tgt_counters tgt_counters; uint16_t cpuid; + struct qla_fw_resources fwres ____cacheline_aligned; }; /* Place holder for FW buffer parameters */ diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 118f2b223531..6f5f18fc974a 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -261,6 +261,8 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) struct scsi_qla_host *vha = s->private; uint16_t mb[MAX_IOCB_MB_REG]; int rc; + struct qla_hw_data *ha = vha->hw; + u16 iocbs_used, i; rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG); if (rc != QLA_SUCCESS) { @@ -285,6 +287,18 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) mb[23]); } + if (ql2xenforce_iocb_limit) { + /* lock is not require. It's an estimate. */ + iocbs_used = ha->base_qpair->fwres.iocbs_used; + for (i = 0; i < ha->max_qpairs; i++) { + if (ha->queue_pair_map[i]) + iocbs_used += ha->queue_pair_map[i]->fwres.iocbs_used; + } + + seq_printf(s, "Driver: estimate iocb used [%d] high water limit [%d]\n", + iocbs_used, ha->base_qpair->fwres.iocbs_limit); + } + return 0; } diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 3360857c4405..9c4d077edf9e 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -129,6 +129,8 @@ int qla2x00_reserve_mgmt_server_loop_id(scsi_qla_host_t *); void qla_rscn_replay(fc_port_t *fcport); void qla24xx_free_purex_item(struct purex_item *item); extern bool qla24xx_risc_firmware_invalid(uint32_t *); +void qla_init_iocb_limit(scsi_qla_host_t *); + /* * Global Data in qla_os.c source file. @@ -175,6 +177,7 @@ extern int qla2xuseresexchforels; extern int ql2xexlogins; extern int ql2xdifbundlinginternalbuffers; extern int ql2xfulldump_on_mpifail; +extern int ql2xenforce_iocb_limit; extern int qla2x00_loop_reset(scsi_qla_host_t *); extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 99f322fb74ab..a1603bad3ee6 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3622,6 +3622,31 @@ qla24xx_detect_sfp(scsi_qla_host_t *vha) return ha->flags.lr_detected; } +void qla_init_iocb_limit(scsi_qla_host_t *vha) +{ + u16 i, num_qps; + u32 limit; + struct qla_hw_data *ha = vha->hw; + + num_qps = ha->num_qpairs + 1; + limit = (ha->orig_fw_iocb_count * QLA_IOCB_PCT_LIMIT) / 100; + + ha->base_qpair->fwres.iocbs_total = ha->orig_fw_iocb_count; + ha->base_qpair->fwres.iocbs_limit = limit; + ha->base_qpair->fwres.iocbs_qp_limit = limit / num_qps; + ha->base_qpair->fwres.iocbs_used = 0; + for (i = 0; i < ha->max_qpairs; i++) { + if (ha->queue_pair_map[i]) { + ha->queue_pair_map[i]->fwres.iocbs_total = + ha->orig_fw_iocb_count; + ha->queue_pair_map[i]->fwres.iocbs_limit = limit; + ha->queue_pair_map[i]->fwres.iocbs_qp_limit = + limit / num_qps; + ha->queue_pair_map[i]->fwres.iocbs_used = 0; + } + } +} + /** * qla2x00_setup_chip() - Load and start RISC firmware. * @vha: HA context @@ -3722,6 +3747,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha) MIN_MULTI_ID_FABRIC - 1; } qla2x00_get_resource_cnts(vha); + qla_init_iocb_limit(vha); /* * Allocate the array of outstanding commands diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 5501b4c581ec..9e9a5d3fb802 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -373,3 +373,58 @@ qla2xxx_get_fc4_priority(struct scsi_qla_host *vha) return (data >> 6) & BIT_0 ? FC4_PRIORITY_FCP : FC4_PRIORITY_NVME; } + +enum { + RESOURCE_NONE, + RESOURCE_INI, +}; + +static inline int +qla_get_iocbs(struct qla_qpair *qp, struct iocb_resource *iores) +{ + u16 iocbs_used, i; + struct qla_hw_data *ha = qp->vha->hw; + + if (!ql2xenforce_iocb_limit) { + iores->res_type = RESOURCE_NONE; + return 0; + } + + if ((iores->iocb_cnt + qp->fwres.iocbs_used) < qp->fwres.iocbs_qp_limit) { + qp->fwres.iocbs_used += iores->iocb_cnt; + return 0; + } else { + /* no need to acquire qpair lock. It's just rough calculation */ + iocbs_used = ha->base_qpair->fwres.iocbs_used; + for (i = 0; i < ha->max_qpairs; i++) { + if (ha->queue_pair_map[i]) + iocbs_used += ha->queue_pair_map[i]->fwres.iocbs_used; + } + + if ((iores->iocb_cnt + iocbs_used) < qp->fwres.iocbs_limit) { + qp->fwres.iocbs_used += iores->iocb_cnt; + return 0; + } else { + iores->res_type = RESOURCE_NONE; + return -ENOSPC; + } + } +} + +static inline void +qla_put_iocbs(struct qla_qpair *qp, struct iocb_resource *iores) +{ + switch (iores->res_type) { + case RESOURCE_NONE: + break; + default: + if (qp->fwres.iocbs_used >= iores->iocb_cnt) { + qp->fwres.iocbs_used -= iores->iocb_cnt; + } else { + // should not happen + qp->fwres.iocbs_used = 0; + } + break; + } + iores->res_type = RESOURCE_NONE; +} diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index d69e16e844aa..b60a332e5846 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1637,6 +1637,12 @@ qla24xx_start_scsi(srb_t *sp) tot_dsds = nseg; req_cnt = qla24xx_calc_iocbs(vha, tot_dsds); + + sp->iores.res_type = RESOURCE_INI; + sp->iores.iocb_cnt = req_cnt; + if (qla_get_iocbs(sp->qpair, &sp->iores)) + goto queuing_error; + if (req->cnt < (req_cnt + 2)) { cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : rd_reg_dword_relaxed(req->req_q_out); @@ -1709,6 +1715,7 @@ qla24xx_start_scsi(srb_t *sp) if (tot_dsds) scsi_dma_unmap(cmd); + qla_put_iocbs(sp->qpair, &sp->iores); spin_unlock_irqrestore(&ha->hardware_lock, flags); return QLA_FUNCTION_FAILED; @@ -1822,6 +1829,12 @@ qla24xx_dif_start_scsi(srb_t *sp) /* Total Data and protection sg segment(s) */ tot_prot_dsds = nseg; tot_dsds += nseg; + + sp->iores.res_type = RESOURCE_INI; + sp->iores.iocb_cnt = qla24xx_calc_iocbs(vha, tot_dsds); + if (qla_get_iocbs(sp->qpair, &sp->iores)) + goto queuing_error; + if (req->cnt < (req_cnt + 2)) { cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : rd_reg_dword_relaxed(req->req_q_out); @@ -1896,6 +1909,7 @@ qla24xx_dif_start_scsi(srb_t *sp) } /* Cleanup will be performed by the caller (queuecommand) */ + qla_put_iocbs(sp->qpair, &sp->iores); spin_unlock_irqrestore(&ha->hardware_lock, flags); return QLA_FUNCTION_FAILED; } @@ -1957,6 +1971,12 @@ qla2xxx_start_scsi_mq(srb_t *sp) tot_dsds = nseg; req_cnt = qla24xx_calc_iocbs(vha, tot_dsds); + + sp->iores.res_type = RESOURCE_INI; + sp->iores.iocb_cnt = req_cnt; + if (qla_get_iocbs(sp->qpair, &sp->iores)) + goto queuing_error; + if (req->cnt < (req_cnt + 2)) { cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : rd_reg_dword_relaxed(req->req_q_out); @@ -2029,6 +2049,7 @@ qla2xxx_start_scsi_mq(srb_t *sp) if (tot_dsds) scsi_dma_unmap(cmd); + qla_put_iocbs(sp->qpair, &sp->iores); spin_unlock_irqrestore(&qpair->qp_lock, flags); return QLA_FUNCTION_FAILED; @@ -2157,6 +2178,12 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) /* Total Data and protection sg segment(s) */ tot_prot_dsds = nseg; tot_dsds += nseg; + + sp->iores.res_type = RESOURCE_INI; + sp->iores.iocb_cnt = qla24xx_calc_iocbs(vha, tot_dsds); + if (qla_get_iocbs(sp->qpair, &sp->iores)) + goto queuing_error; + if (req->cnt < (req_cnt + 2)) { cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : rd_reg_dword_relaxed(req->req_q_out); @@ -2234,6 +2261,7 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) } /* Cleanup will be performed by the caller (queuecommand) */ + qla_put_iocbs(sp->qpair, &sp->iores); spin_unlock_irqrestore(&qpair->qp_lock, flags); return QLA_FUNCTION_FAILED; } diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index a63f2000fadf..bb3beaa77d39 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2901,6 +2901,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) } return; } + qla_put_iocbs(sp->qpair, &sp->iores); if (sp->cmd_type != TYPE_SRB) { req->outstanding_cmds[handle] = NULL; @@ -3313,6 +3314,7 @@ qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt) default: sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (sp) { + qla_put_iocbs(sp->qpair, &sp->iores); sp->done(sp, res); return 0; } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c53cc31cd068..a4d737b92ec1 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -40,6 +40,11 @@ module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(ql2xfulldump_on_mpifail, "Set this to take full dump on MPI hang."); +int ql2xenforce_iocb_limit = 1; +module_param(ql2xenforce_iocb_limit, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(ql2xenforce_iocb_limit, + "Enforce IOCB throttling, to avoid FW congestion. (default: 0)"); + /* * CT6 CTX allocation cache */ @@ -3316,6 +3321,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) for (i = 0; i < ha->max_qpairs; i++) qla2xxx_create_qpair(base_vha, 5, 0, startit); } + qla_init_iocb_limit(base_vha); if (ha->flags.running_gold_fw) goto skip_dpc; From patchwork Wed Sep 2 07:25: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: 296901 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=-13.1 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 291DEC433E2 for ; Wed, 2 Sep 2020 07:31:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E32652084C for ; Wed, 2 Sep 2020 07:31:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ZY+nCiDC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726311AbgIBHbI (ORCPT ); Wed, 2 Sep 2020 03:31:08 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:20068 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgIBHbI (ORCPT ); Wed, 2 Sep 2020 03:31: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 0827PQdp023726 for ; Wed, 2 Sep 2020 00:31:06 -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=VTaNBu7wCI0mIdJFbB993A9O69+FtduhJMpEXucg9pI=; b=ZY+nCiDClTDmIPfphHmcqjAp/5FR2rSfhznnnUQ/1WewtAvqzSjPsnp2ykiOyjKsTIOr pAKB9TbS/0izVSYAyK8SuRrG5InmSnulIMNb7VQvxQja4lpoSYwsH7jRXmbDiA0PAfYB /dhSoYEluDIjWTlAwE97EWUZB1RXYKJV0iQGEVu7vgkrBlPG4aF/Le1+THecoWpr8OF1 3M+SmlRPq+TiKrLXCY62diy+ibdEh8NdtB8uaYnkfXm4+LPPFxvxsFKZvu3wBTJsPmRv /nqUz5Wftiyg9B8vmHGEdB+dZZtFUYJ95BaOTd9Z4d630j4qYRgYiam8kJ0THX9oYPIX Tg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq554s-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:31:06 -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; Wed, 2 Sep 2020 00:31:03 -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; Wed, 2 Sep 2020 00:31:02 -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; Wed, 2 Sep 2020 00:31:02 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 7E4083F704A; Wed, 2 Sep 2020 00:31:02 -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 0827V2rW011672; Wed, 2 Sep 2020 00:31:02 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827V2Ns011671; Wed, 2 Sep 2020 00:31:02 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 12/13] qla2xxx: Add SLER and PI control support Date: Wed, 2 Sep 2020 00:25:47 -0700 Message-ID: <20200902072548.11491-13-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Saurav Kashyap - BIT_13 of extended FW attribute informs about NVMe-2 support. - Set BIT_15 of specical feature control block for enabling SLER in FW. - Set bit 8 (SLER supported) to 1 for the service parameter information when sending NVMe PRLI request. - Set BIT_14 of special feature control block for enabling PI Control in FW. - Driver should set bit 9 (PI Control supported) to 1 for the service parameter information when sending NVMe PRLI request. - Set BIT_13 for NVMe Async events. Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_dbg.c | 2 +- drivers/scsi/qla2xxx/qla_def.h | 4 ++++ drivers/scsi/qla2xxx/qla_iocb.c | 8 ++++++++ drivers/scsi/qla2xxx/qla_mbx.c | 21 +++++++++++++++++++-- drivers/scsi/qla2xxx/qla_nvme.c | 16 ++++++++++++++-- drivers/scsi/qla2xxx/qla_nvme.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 1 + 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 1be811a5d69d..369040250ab9 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -16,7 +16,7 @@ * | Device Discovery | 0x2134 | 0x210e-0x2116 | * | | | 0x211a | * | | | 0x211c-0x2128 | - * | | | 0x212a-0x2134 | + * | | | 0x212c-0x2134 | * | Queue Command and IO tracing | 0x3074 | 0x300b | * | | | 0x3027-0x3028 | * | | | 0x303d-0x3041 | diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 863b9c7766e1..19b5c0e3dc99 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2476,6 +2476,8 @@ typedef struct fc_port { struct completion nvme_del_done; uint32_t nvme_prli_service_param; +#define NVME_PRLI_SP_PI_CTRL BIT_9 +#define NVME_PRLI_SP_SLER BIT_8 #define NVME_PRLI_SP_CONF BIT_7 #define NVME_PRLI_SP_INITIATOR BIT_5 #define NVME_PRLI_SP_TARGET BIT_4 @@ -4308,6 +4310,7 @@ struct qla_hw_data { #define FW_ATTR_EXT0_SCM_BROCADE 0x00001000 /* Cisco fabric attached */ #define FW_ATTR_EXT0_SCM_CISCO 0x00002000 +#define FW_ATTR_EXT0_NVME2 BIT_13 uint16_t fw_attributes_ext[2]; uint32_t fw_memory_size; uint32_t fw_transfer_size; @@ -4657,6 +4660,7 @@ typedef struct scsi_qla_host { uint32_t qpairs_rsp_created:1; uint32_t nvme_enabled:1; uint32_t nvme_first_burst:1; + uint32_t nvme2_enabled:1; } flags; atomic_t loop_state; diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index b60a332e5846..a46f01a25582 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2378,6 +2378,14 @@ qla24xx_prli_iocb(srb_t *sp, struct logio_entry_24xx *logio) if (sp->vha->flags.nvme_first_burst) logio->io_parameter[0] = cpu_to_le32(NVME_PRLI_SP_FIRST_BURST); + if (sp->vha->flags.nvme2_enabled) { + /* Set service parameter BIT_8 for SLER support */ + logio->io_parameter[0] |= + cpu_to_le32(NVME_PRLI_SP_SLER); + /* Set service parameter BIT_9 for PI control support */ + logio->io_parameter[0] |= + cpu_to_le32(NVME_PRLI_SP_PI_CTRL); + } } logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index ab7dbbc99c22..e5a47d5147fc 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -1093,6 +1093,17 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha) "%s: FC-NVMe is Enabled (0x%x)\n", __func__, ha->fw_attributes_h); } + + /* BIT_13 of Extended FW Attributes informs about NVMe2 support */ + if (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_NVME2) { + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1191, + "%s: Firmware supports NVMe2 0x%x\n", + __func__, ha->fw_attributes_ext[0]); + ql_log(ql_log_info, vha, 0xd302, + "Firmware supports NVMe2 0x%x\n", + ha->fw_attributes_ext[0]); + vha->flags.nvme2_enabled = 1; + } } if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { @@ -1122,12 +1133,18 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha) if (ha->flags.scm_supported_a && (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_SCM_SUPPORTED)) { ha->flags.scm_supported_f = 1; - memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb)); ha->sf_init_cb->flags |= BIT_13; } ql_log(ql_log_info, vha, 0x11a3, "SCM in FW: %s\n", (ha->flags.scm_supported_f) ? "Supported" : "Not Supported"); + + if (vha->flags.nvme2_enabled) { + /* set BIT_15 of special feature control block for SLER */ + ha->sf_init_cb->flags |= BIT_15; + /* set BIT_14 of special feature control block for PI CTRL*/ + ha->sf_init_cb->flags |= BIT_14; + } } failed: @@ -1823,7 +1840,7 @@ qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size) mcp->out_mb |= MBX_14|MBX_13|MBX_12|MBX_11|MBX_10; } - if (ha->flags.scm_supported_f) { + if (ha->flags.scm_supported_f || vha->flags.nvme2_enabled) { mcp->mb[1] |= BIT_1; mcp->mb[16] = MSW(ha->sf_init_cb_dma); mcp->mb[17] = LSW(ha->sf_init_cb_dma); diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 675f2b1180e8..0d73c285a4d1 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -69,6 +69,14 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) return ret; } + if (fcport->nvme_prli_service_param & NVME_PRLI_SP_SLER) + ql_log(ql_log_info, vha, 0x212a, + "PortID:%06x Supports SLER\n", req.port_id); + + if (fcport->nvme_prli_service_param & NVME_PRLI_SP_PI_CTRL) + ql_log(ql_log_info, vha, 0x212b, + "PortID:%06x Supports PI control\n", req.port_id); + rport = fcport->nvme_remote_port->private; rport->fcport = fcport; @@ -368,6 +376,7 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) struct srb_iocb *nvme = &sp->u.iocb_cmd; struct scatterlist *sgl, *sg; struct nvmefc_fcp_req *fd = nvme->u.nvme.desc; + struct nvme_fc_cmd_iu *cmd = fd->cmdaddr; uint32_t rval = QLA_SUCCESS; /* Setup qpair pointers */ @@ -399,8 +408,6 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) } if (unlikely(!fd->sqid)) { - struct nvme_fc_cmd_iu *cmd = fd->cmdaddr; - if (cmd->sqe.common.opcode == nvme_admin_async_event) { nvme->u.nvme.aen_op = 1; atomic_inc(&ha->nvme_active_aen_cnt); @@ -446,6 +453,11 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) } else if (fd->io_dir == 0) { cmd_pkt->control_flags = 0; } + /* Set BIT_13 of control flags for Async event */ + if (vha->flags.nvme2_enabled && + cmd->sqe.common.opcode == nvme_admin_async_event) { + cmd_pkt->control_flags |= cpu_to_le16(CF_ADMIN_ASYNC_EVENT); + } /* Set NPORT-ID */ cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id); diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h index cf45a5b277f1..5d5f115a77c3 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.h +++ b/drivers/scsi/qla2xxx/qla_nvme.h @@ -54,6 +54,7 @@ struct cmd_nvme { uint64_t rsvd; __le16 control_flags; /* Control Flags */ +#define CF_ADMIN_ASYNC_EVENT BIT_13 #define CF_NVME_FIRST_BURST_ENABLE BIT_11 #define CF_DIF_SEG_DESCR_ENABLE BIT_3 #define CF_DATA_SEG_DESCR_ENABLE BIT_2 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a4d737b92ec1..a186c3a55088 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4231,6 +4231,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, &ha->sf_init_cb_dma); if (!ha->sf_init_cb) goto fail_sf_init_cb; + memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb)); ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, "sf_init_cb=%p.\n", ha->sf_init_cb); } From patchwork Wed Sep 2 07:25: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: 257781 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=-13.1 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 73913C433E2 for ; Wed, 2 Sep 2020 07:31:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 455692084C for ; Wed, 2 Sep 2020 07:31:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="fq3nP0rR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbgIBHba (ORCPT ); Wed, 2 Sep 2020 03:31:30 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:5072 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgIBHb3 (ORCPT ); Wed, 2 Sep 2020 03:31:29 -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 0827PCfV023444 for ; Wed, 2 Sep 2020 00:31:28 -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=TDWtMtKBWxdpdZgnL26EOSwkLj1zPQtZP0Vdbtd1s1o=; b=fq3nP0rRwXvOOvoCXTi1yKNBkp27bf5d4Ri9kQ8Bp4sg9s6K0dbdrhjM1h+bbacQK195 Ch4nEgyMOlxN15mGIrLuxAZhXekctdTNMyEJvN40t+9RdG+mXqqx0B/mVALSRenlMu/J 1tyPgQ4EXSgE+Ee5idZcwNsjZDEceZXPeg2JFU6OnnNBmMEOsLju5H0GEgL+P7la6K44 N1HRgsB7mXWP81LTFruAlpoEd/PW9goDR8YFsnNUI6B00/XdxiQ5Tknsm1ffJkvdLS6W B5voJGHiuQ9rhy4yZh9NYhH2R4fIuNYJUiOsyfvsj1tB+Q2AF0KXuRdpaVeiEGCdATGJ IQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 337phq556p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Sep 2020 00:31:28 -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; Wed, 2 Sep 2020 00:31:26 -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; Wed, 2 Sep 2020 00:31:26 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 9D9213F703F; Wed, 2 Sep 2020 00:31:26 -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 0827VQxg011684; Wed, 2 Sep 2020 00:31:26 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 0827VQfK011675; Wed, 2 Sep 2020 00:31:26 -0700 From: Nilesh Javali To: CC: , Subject: [PATCH v2 13/13] qla2xxx: Update version to 10.02.00.102-k Date: Wed, 2 Sep 2020 00:25:48 -0700 Message-ID: <20200902072548.11491-14-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200902072548.11491-1-njavali@marvell.com> References: <20200902072548.11491-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-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Update internal driver version and remove module version macro. Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_os.c | 1 - drivers/scsi/qla2xxx/qla_version.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a186c3a55088..36bc4efc5b1c 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7962,7 +7962,6 @@ module_exit(qla2x00_module_exit); MODULE_AUTHOR("QLogic Corporation"); MODULE_DESCRIPTION("QLogic Fibre Channel HBA Driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(QLA2XXX_VERSION); MODULE_FIRMWARE(FW_FILE_ISP21XX); MODULE_FIRMWARE(FW_FILE_ISP22XX); MODULE_FIRMWARE(FW_FILE_ISP2300); diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 8ccd9ba1ddef..0f5a5f17dcef 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.01.00.25-k" +#define QLA2XXX_VERSION "10.02.00.102-k" #define QLA_DRIVER_MAJOR_VER 10 -#define QLA_DRIVER_MINOR_VER 1 +#define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 0 -#define QLA_DRIVER_BETA_VER 0 +#define QLA_DRIVER_BETA_VER 102