From patchwork Tue Feb 12 23:40:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10808943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F1591390 for ; Tue, 12 Feb 2019 23:42:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C5FF2C083 for ; Tue, 12 Feb 2019 23:42:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 808DE2C0AD; Tue, 12 Feb 2019 23:42:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B49412C082 for ; Tue, 12 Feb 2019 23:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732160AbfBLXmR (ORCPT ); Tue, 12 Feb 2019 18:42:17 -0500 Received: from mail-eopbgr710078.outbound.protection.outlook.com ([40.107.71.78]:28643 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728924AbfBLXmQ (ORCPT ); Tue, 12 Feb 2019 18:42:16 -0500 Received: from BYAPR07CA0004.namprd07.prod.outlook.com (2603:10b6:a02:bc::17) by BY1PR0701MB1925.namprd07.prod.outlook.com (2a01:111:e400:51ab::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Tue, 12 Feb 2019 23:42:02 +0000 Received: from CO1NAM05FT060.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::205) by BYAPR07CA0004.outlook.office365.com (2603:10b6:a02:bc::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1622.16 via Frontend Transport; Tue, 12 Feb 2019 23:42:02 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by CO1NAM05FT060.mail.protection.outlook.com (10.152.96.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.2 via Frontend Transport; Tue, 12 Feb 2019 23:42:01 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 12 Feb 2019 15:40:53 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x1CNerdW029861; Tue, 12 Feb 2019 15:40:53 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x1CNerIu029860; Tue, 12 Feb 2019 15:40:53 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 02/12] qla2xxx: Add First Burst support for FC-NVMe devices Date: Tue, 12 Feb 2019 15:40:36 -0800 Message-ID: <20190212234046.29809-3-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190212234046.29809-1-hmadhani@marvell.com> References: <20190212234046.29809-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131944885220995469;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(136003)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(53936002)(76176011)(105606002)(1076003)(110136005)(16586007)(42186006)(4326008)(106466001)(51416003)(86362001)(126002)(6666004)(87636003)(498600001)(54906003)(2616005)(11346002)(356004)(26826003)(69596002)(80596001)(446003)(476003)(336012)(486006)(97736004)(2906002)(85426001)(68736007)(50466002)(14444005)(305945005)(48376002)(8936002)(36906005)(316002)(50226002)(26005)(36756003)(81156014)(81166006)(47776003)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:BY1PR0701MB1925;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT060;1:5rlp9/Ue+M47qBHyPl/7NNovhr3GR+G5lx61tc5Okv6CLrjbTco0oN/SDnllKOr7xlEnvpI8dR6DvAMnEUsep9LS1wMgDPrHsobzS9HMpZZvct/ygcYzX+mGMOVKbzJFTDhK/ECTjriMMCzKwS03JKcdeJN7EJaF8HX+82iISkI= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c870b156-ecf6-4331-7c79-08d69143affd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600110)(711020)(4605077)(2017052603328);SRVR:BY1PR0701MB1925; X-MS-TrafficTypeDiagnostic: BY1PR0701MB1925: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0946DC87A1 X-Microsoft-Exchange-Diagnostics: 1;BY1PR0701MB1925;23:2RB44NrSDeNRu46wngDRUemY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imrtyg1+W99AxA2Oh6ifZTOkjRslrFfmP/MHjcCEoiHIAtwvVHAdqd0d2aaJB0Beyzd03Lc7NdIxQ+GfnmvN1xzoA9ncUFy+4Iog/NTzc0Mjz/suP2bugeO24xP6VA== X-Microsoft-Antispam-Message-Info: dp/98WvUSTIuEPF11cc8tLYoiDYQse3gaYIyKrsc8s7025tN5SH7jSAgKDIwbg5x1GdMTWgHt2chbygyBAUI7H9y1yUdPOwhvBZR70pgiqLRk9rT4Wf4isncoWHTC2DlLwaaSnc2UCFTPxH+hBesCEsD93EyOWG7xfGslYrH41Od5kygzvcWQmG4S1+h0ZgLhA9jb2JAhEEXIGZCdD8zZ45B/7P5UoEPE8LvL3Ml35oN2y+TWUClVvD9nwcn9umcw2P5XkWXugpCTY8vv3wmCKyiEBRwDIAtMzeJ7vxVp8Oy00Y89CmqNQNZxTWI2WaTlWsNg7Qia6KbqHZoQF7Dhy9641MqpNm/tB8cfEHTf18bSXbC/V2KI3RW67uRWw9/P7+W5yqtbmfGqGlxycJ9bxSBTqcJE0mSOGwjwO15jMw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2019 23:42:01.8003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c870b156-ecf6-4331-7c79-08d69143affd X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1925 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darren Trapp Add Support for First Burst for FC-NVMe protocol. This feature requires First Burst support in the firmware. Signed-off-by: Darren Trapp Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 6 ++++++ drivers/scsi/qla2xxx/qla_iocb.c | 5 ++++- drivers/scsi/qla2xxx/qla_isr.c | 9 +++++++++ drivers/scsi/qla2xxx/qla_mbx.c | 5 +++-- drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++++++--- drivers/scsi/qla2xxx/qla_nvme.h | 2 +- 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 80acf30fd8a5..c256ba7fba84 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2367,7 +2367,9 @@ typedef struct fc_port { #define NVME_PRLI_SP_INITIATOR BIT_5 #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 #define NVME_FLAG_RESETTING 1 @@ -3966,6 +3968,7 @@ struct qla_hw_data { uint16_t fw_subminor_version; uint16_t fw_attributes; uint16_t fw_attributes_h; +#define FW_ATTR_H_NVME_FBURST BIT_1 #define FW_ATTR_H_NVME BIT_10 #define FW_ATTR_H_NVME_UPDATED BIT_14 @@ -4260,6 +4263,7 @@ typedef struct scsi_qla_host { uint32_t qpairs_req_created:1; uint32_t qpairs_rsp_created:1; uint32_t nvme_enabled:1; + uint32_t nvme_first_burst:1; } flags; atomic_t loop_state; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index cdf57eb643b3..2d9336a87e42 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1829,6 +1829,12 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea) ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; ea->fcport->logout_on_delete = 1; + ea->fcport->nvme_prli_service_param = ea->iop[0]; + if (ea->iop[0] & NVME_PRLI_SP_FIRST_BURST) + ea->fcport->nvme_first_burst_size = + (ea->iop[1] & 0xffff) * 512; + else + ea->fcport->nvme_first_burst_size = 0; qla24xx_post_gpdb_work(vha, ea->fcport, 0); break; default: diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 2c27ae1924c5..cdac282b5bd3 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2419,8 +2419,11 @@ qla24xx_prli_iocb(srb_t *sp, struct logio_entry_24xx *logio) logio->entry_type = LOGINOUT_PORT_IOCB_TYPE; logio->control_flags = cpu_to_le16(LCF_COMMAND_PRLI); - if (lio->u.logio.flags & SRB_LOGIN_NVME_PRLI) + if (lio->u.logio.flags & SRB_LOGIN_NVME_PRLI) { logio->control_flags |= LCF_NVME_PRLI; + if (sp->vha->flags.nvme_first_burst) + logio->io_parameter[0] = NVME_PRLI_SP_FIRST_BURST; + } logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); logio->port_id[0] = sp->fcport->d_id.b.al_pa; diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index bde9940ea7d1..b5ae76869d5b 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1715,6 +1715,15 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, vha->hw->exch_starvation = 0; data[0] = MBS_COMMAND_COMPLETE; + + if (sp->type == SRB_PRLI_CMD) { + lio->u.logio.iop[0] = + le32_to_cpu(logio->io_parameter[0]); + lio->u.logio.iop[1] = + le32_to_cpu(logio->io_parameter[1]); + goto logio_done; + } + if (sp->type != SRB_LOGIN_CMD) goto logio_done; diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index f4adf6baee69..6c911f2e4cdb 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -1112,6 +1112,9 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha) if ((ha->fw_attributes_h & (FW_ATTR_H_NVME | FW_ATTR_H_NVME_UPDATED)) && ql2xnvmeenable) { + if (ha->fw_attributes_h & FW_ATTR_H_NVME_FBURST) + vha->flags.nvme_first_burst = 1; + vha->flags.nvme_enabled = 1; ql_log(ql_log_info, vha, 0xd302, "%s: FC-NVMe is Enabled (0x%x)\n", @@ -6267,8 +6270,6 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, fcport->d_id.b.rsvd_1 = 0; if (fcport->fc4f_nvme) { - fcport->nvme_prli_service_param = - pd->prli_nvme_svc_param_word_3; fcport->port_type = FCT_NVME; } else { /* If not target must be initiator or unknown type. */ diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 39d892bbd219..efc23761de1c 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -359,16 +359,25 @@ 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 | CF_NVME_ENABLE); + cpu_to_le16(CF_READ_DATA); vha->qla_stats.input_bytes += fd->payload_length; vha->qla_stats.input_requests++; } else if (fd->io_dir == NVMEFC_FCP_WRITE) { cmd_pkt->control_flags = - cpu_to_le16(CF_WRITE_DATA | CF_NVME_ENABLE); + cpu_to_le16(CF_WRITE_DATA); + if ((vha->flags.nvme_first_burst) && + (sp->fcport->nvme_prli_service_param & + NVME_PRLI_SP_FIRST_BURST)) { + if ((fd->payload_length <= + sp->fcport->nvme_first_burst_size) || + (sp->fcport->nvme_first_burst_size == 0)) + 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++; } else if (fd->io_dir == 0) { - cmd_pkt->control_flags = cpu_to_le16(CF_NVME_ENABLE); + cmd_pkt->control_flags = 0; } /* Set NPORT-ID */ diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h index 4941d107fb1c..da8dad5ad693 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.h +++ b/drivers/scsi/qla2xxx/qla_nvme.h @@ -57,7 +57,7 @@ struct cmd_nvme { uint64_t rsvd; uint16_t control_flags; /* Control Flags */ -#define CF_NVME_ENABLE BIT_9 +#define CF_NVME_FIRST_BURST_ENABLE BIT_11 #define CF_DIF_SEG_DESCR_ENABLE BIT_3 #define CF_DATA_SEG_DESCR_ENABLE BIT_2 #define CF_READ_DATA BIT_1