From 796b64022aa9a9ef04889d5cac803a1c7de8712f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:00:31 +0000 Subject: [PATCH 01/13] qla2x00t-32gbit/Kconfig: Add SPDX license identifier See also upstream commit ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kconfig"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8448 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/qla2x00t-32gbit/Kconfig b/qla2x00t-32gbit/Kconfig index 09f9cc0d6..e80304ede 100644 --- a/qla2x00t-32gbit/Kconfig +++ b/qla2x00t-32gbit/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only config SCSI_QLA_FC tristate "QLogic QLA2XXX Fibre Channel Support" depends on PCI && SCSI From 39be52dd39ba3f1216fbaaa1a6b9704902d1857d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:01:12 +0000 Subject: [PATCH 02/13] qla2x00t-32gbit/qla_target.h: Replace GPLv2 boilerplate/reference with SPDX See also upstream commit c942fddf8793 ("treewide: Replace GPLv2 boilerplate/ reference with SPDX - rule 157") # v5.2-rc3. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8449 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_target.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/qla2x00t-32gbit/qla_target.h b/qla2x00t-32gbit/qla_target.h index 586c980db..59d9f910a 100644 --- a/qla2x00t-32gbit/qla_target.h +++ b/qla2x00t-32gbit/qla_target.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2004 - 2010 Vladislav Bolkhovitin * Copyright (C) 2004 - 2005 Leonid Stoljar @@ -9,16 +10,6 @@ * Copyright (C) 2010-2011 Nicholas A. Bellinger * * Additional file for the target driver support. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ /* * This is the global def file that is useful for including from the From 81666681893ea3bf48f428df18cef6b0b8852d7d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:01:59 +0000 Subject: [PATCH 03/13] qla2x00t-32gbit/qla_target.c: Replace GPLv2 boilerplate/reference with SPDX See also upstream commit 8e8e69d67e5f ("treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285") # v5.2-rc4. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8450 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_target.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/qla2x00t-32gbit/qla_target.c b/qla2x00t-32gbit/qla_target.c index a307301e7..f18c3ec43 100644 --- a/qla2x00t-32gbit/qla_target.c +++ b/qla2x00t-32gbit/qla_target.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * qla_target.c SCSI LLD infrastructure for QLogic 22xx/23xx/24xx/25xx * @@ -11,16 +12,6 @@ * Forward port and refactoring to modern qla2xxx and target/configfs * * Copyright (C) 2010-2013 Nicholas A. Bellinger - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include From 9574432b73be0583e47c1565aa51755def229c34 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:02:43 +0000 Subject: [PATCH 04/13] qla2x00t-32gbit/qla_os.c: Fix hardlockup in abort command during driver remove See also upstream commit 5589b08e5be4 ("scsi: qla2xxx: Fix hardlockup in abort command during driver remove") # v5.2-rc6. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8451 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 67dfd414f..2da92eace 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -1779,8 +1779,8 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && !qla2x00_isp_reg_stat(ha))) { sp->comp = ∁ - rval = ha->isp_ops->abort_command(sp); spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); + rval = ha->isp_ops->abort_command(sp); switch (rval) { case QLA_SUCCESS: From da3b50b65ee3384a5b7f65175f96445f2b18fae5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:03:57 +0000 Subject: [PATCH 05/13] qla2x00t-32gbit, NVMe: Fix kernel crash after disconnecting NVMe devices See also upstream commit 6a81533d616f ("scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8452 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_def.h | 1 - qla2x00t-32gbit/qla_nvme.c | 37 ++++++++++--------------------------- qla2x00t-32gbit/qla_nvme.h | 1 - qla2x00t-32gbit/qla_os.c | 1 - 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 7801cc785..65565dec2 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -4454,7 +4454,6 @@ typedef struct scsi_qla_host { struct nvme_fc_local_port *nvme_local_port; struct completion nvme_del_done; - struct list_head nvme_rport_list; uint16_t fcoe_vlan_id; uint16_t fcoe_fcf_idx; diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 6e10f6ee0..4581c08b4 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -85,7 +85,6 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) rport = fcport->nvme_remote_port->private; rport->fcport = fcport; - list_add_tail(&rport->list, &vha->nvme_rport_list); fcport->nvme_flag |= NVME_FLAG_REGISTERED; return 0; @@ -553,18 +552,11 @@ static void qla_nvme_localport_delete(struct nvme_fc_local_port *lport) static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) { fc_port_t *fcport; - struct qla_nvme_rport *qla_rport = rport->private, *trport; + struct qla_nvme_rport *qla_rport = rport->private; fcport = qla_rport->fcport; fcport->nvme_remote_port = NULL; fcport->nvme_flag &= ~NVME_FLAG_REGISTERED; - list_for_each_entry_safe(qla_rport, trport, - &fcport->vha->nvme_rport_list, list) { - if (qla_rport->fcport == fcport) { - list_del(&qla_rport->list); - break; - } - } complete(&fcport->nvme_del_done); if (!test_bit(UNLOADING, &fcport->vha->dpc_flags)) { @@ -600,7 +592,7 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) { struct fc_port *fcport = container_of(work, struct fc_port, nvme_del_work); - struct qla_nvme_rport *qla_rport, *trport; + int ret; if (!IS_ENABLED(CONFIG_NVME_FC)) return; @@ -608,25 +600,16 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) ql_log(ql_log_warn, NULL, 0x2112, "%s: unregister remoteport on %p\n", __func__, fcport); - list_for_each_entry_safe(qla_rport, trport, - &fcport->vha->nvme_rport_list, list) { - if (qla_rport->fcport == fcport) { - ql_log(ql_log_info, fcport->vha, 0x2113, - "%s: fcport=%p\n", __func__, fcport); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) - nvme_fc_set_remoteport_devloss - (fcport->nvme_remote_port, 0); + nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); #endif - init_completion(&fcport->nvme_del_done); - if (nvme_fc_unregister_remoteport - (fcport->nvme_remote_port)) - ql_log(ql_log_info, fcport->vha, 0x2114, - "%s: Failed to unregister nvme_remote_port\n", - __func__); - wait_for_completion(&fcport->nvme_del_done); - break; - } - } + init_completion(&fcport->nvme_del_done); + ret = nvme_fc_unregister_remoteport(fcport->nvme_remote_port); + if (ret) + ql_log(ql_log_info, fcport->vha, 0x2114, + "%s: Failed to unregister nvme_remote_port (%d)\n", + __func__, ret); + wait_for_completion(&fcport->nvme_del_done); } void qla_nvme_delete(struct scsi_qla_host *vha) diff --git a/qla2x00t-32gbit/qla_nvme.h b/qla2x00t-32gbit/qla_nvme.h index b98aded69..235126834 100644 --- a/qla2x00t-32gbit/qla_nvme.h +++ b/qla2x00t-32gbit/qla_nvme.h @@ -39,7 +39,6 @@ struct nvme_private { }; struct qla_nvme_rport { - struct list_head list; struct fc_port *fcport; }; diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 2da92eace..c7cb69138 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -4844,7 +4844,6 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(&vha->plogi_ack_list); INIT_LIST_HEAD(&vha->qp_list); INIT_LIST_HEAD(&vha->gnl.fcports); - INIT_LIST_HEAD(&vha->nvme_rport_list); INIT_LIST_HEAD(&vha->gpnid_list); INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); From 87724bd6b437db925b78e8701f871bb130b1734e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:05:09 +0000 Subject: [PATCH 06/13] qla2x00t-32gbit, NVMe: On session delete, return nvme cmd See also upstream commit 2eb9238affa7 ("scsi: qla2xxx: on session delete, return nvme cmd"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8453 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_nvme.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 4581c08b4..92433ff9b 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -250,8 +250,16 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, struct qla_hw_data *ha; srb_t *sp; + + if (!fcport || (fcport && fcport->deleted)) + return rval; + vha = fcport->vha; ha = vha->hw; + + if (!ha->flags.fw_started) + return rval; + /* Alloc SRB structure */ sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC); if (!sp) @@ -283,6 +291,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, "qla2x00_start_sp failed = %d\n", rval); atomic_dec(&sp->ref_count); wake_up(&sp->nvme_ls_waitq); + sp->free(sp); return rval; } @@ -497,11 +506,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, fcport = qla_rport->fcport; - vha = fcport->vha; - - if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) + if (!qpair || !fcport || (qpair && !qpair->fw_started) || + (fcport && fcport->deleted)) return rval; + vha = fcport->vha; /* * 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 @@ -534,6 +543,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, "qla2x00_start_nvme_mq failed = %d\n", rval); atomic_dec(&sp->ref_count); wake_up(&sp->nvme_ls_waitq); + sp->free(sp); } return rval; @@ -559,14 +569,13 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) fcport->nvme_flag &= ~NVME_FLAG_REGISTERED; complete(&fcport->nvme_del_done); - if (!test_bit(UNLOADING, &fcport->vha->dpc_flags)) { - INIT_WORK(&fcport->free_work, qlt_free_session_done); - schedule_work(&fcport->free_work); - } + INIT_WORK(&fcport->free_work, qlt_free_session_done); + schedule_work(&fcport->free_work); fcport->nvme_flag &= ~NVME_FLAG_DELETING; ql_log(ql_log_info, fcport->vha, 0x2110, - "remoteport_delete of %p completed.\n", fcport); + "remoteport_delete of %p %8phN completed.\n", + fcport, fcport->port_name); } static struct nvme_fc_port_template qla_nvme_fc_transport = { @@ -598,7 +607,8 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) return; ql_log(ql_log_warn, NULL, 0x2112, - "%s: unregister remoteport on %p\n", __func__, fcport); + "%s: unregister remoteport on %p %8phN\n", + __func__, fcport, fcport->port_name); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); From f46ed828388b79bbdd86ad38570c3effa90a3945 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:07:34 +0000 Subject: [PATCH 07/13] qla2x00t-32gbit, NVMe: Fix NVME cmd and LS cmd timeout race condition See also upstream commit 4c2a2d0178d5 ("scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8454 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_def.h | 3 + qla2x00t-32gbit/qla_nvme.c | 172 +++++++++++++++++++++++++------------ qla2x00t-32gbit/qla_nvme.h | 1 + 3 files changed, 121 insertions(+), 55 deletions(-) diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 65565dec2..136cb4bf4 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -605,6 +605,8 @@ typedef struct srb { uint8_t cmd_type; uint8_t pad[3]; atomic_t ref_count; + struct kref cmd_kref; /* need to migrate ref_count over to this */ + void *priv; wait_queue_head_t nvme_ls_waitq; struct fc_port *fcport; struct scsi_qla_host *vha; @@ -631,6 +633,7 @@ typedef struct srb { } u; void (*done)(void *, int); void (*free)(void *); + void (*put_fn)(struct kref *kref); } srb_t; #define GET_CMD_SP(sp) (sp->u.scmd.cmd) diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 92433ff9b..8fd9db77b 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -134,53 +134,91 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport, return 0; } -static void qla_nvme_sp_ls_done(void *ptr, int res) +static void qla_nvme_release_fcp_cmd_kref(struct kref *kref) { - srb_t *sp = ptr; - struct srb_iocb *nvme; - struct nvmefc_ls_req *fd; - struct nvme_private *priv; - - if (WARN_ON_ONCE(atomic_read(&sp->ref_count) == 0)) - return; - - atomic_dec(&sp->ref_count); - - if (res) - res = -EINVAL; - - nvme = &sp->u.iocb_cmd; - fd = nvme->u.nvme.desc; - priv = fd->private; - priv->comp_status = res; - schedule_work(&priv->ls_work); - /* work schedule doesn't need the sp */ - qla2x00_rel_sp(sp); -} - -static void qla_nvme_sp_done(void *ptr, int res) -{ - srb_t *sp = ptr; - struct srb_iocb *nvme; + struct srb *sp = container_of(kref, struct srb, cmd_kref); + struct nvme_private *priv = (struct nvme_private *)sp->priv; struct nvmefc_fcp_req *fd; + struct srb_iocb *nvme; + unsigned long flags; + + if (!priv) + goto out; nvme = &sp->u.iocb_cmd; fd = nvme->u.nvme.desc; - if (WARN_ON_ONCE(atomic_read(&sp->ref_count) == 0)) - return; - - atomic_dec(&sp->ref_count); - - if (res == QLA_SUCCESS) { + spin_lock_irqsave(&priv->cmd_lock, flags); + priv->sp = NULL; + sp->priv = NULL; + if (priv->comp_status == QLA_SUCCESS) { fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; } else { fd->rcv_rsplen = 0; fd->transferred_length = 0; } fd->status = 0; + spin_unlock_irqrestore(&priv->cmd_lock, flags); + fd->done(fd); +out: qla2xxx_rel_qpair_sp(sp->qpair, sp); +} + +static void qla_nvme_release_ls_cmd_kref(struct kref *kref) +{ + struct srb *sp = container_of(kref, struct srb, cmd_kref); + struct nvme_private *priv = (struct nvme_private *)sp->priv; + struct nvmefc_ls_req *fd; + unsigned long flags; + + if (!priv) + goto out; + + spin_lock_irqsave(&priv->cmd_lock, flags); + priv->sp = NULL; + sp->priv = NULL; + spin_unlock_irqrestore(&priv->cmd_lock, flags); + + fd = priv->fd; + fd->done(fd, priv->comp_status); +out: + qla2x00_rel_sp(sp); +} + +static void qla_nvme_ls_complete(struct work_struct *work) +{ + struct nvme_private *priv = + container_of(work, struct nvme_private, ls_work); + + kref_put(&priv->sp->cmd_kref, qla_nvme_release_ls_cmd_kref); +} + +static void qla_nvme_sp_ls_done(void *ptr, int res) +{ + srb_t *sp = ptr; + struct nvme_private *priv; + + if (WARN_ON_ONCE(kref_read(&sp->cmd_kref) == 0)) + return; + + if (res) + res = -EINVAL; + + priv = (struct nvme_private *)sp->priv; + priv->comp_status = res; + INIT_WORK(&priv->ls_work, qla_nvme_ls_complete); + schedule_work(&priv->ls_work); +} + +/* it assumed that QPair lock is held. */ +static void qla_nvme_sp_done(void *ptr, int res) +{ + srb_t *sp = ptr; + struct nvme_private *priv = (struct nvme_private *)sp->priv; + + priv->comp_status = res; + kref_put(&sp->cmd_kref, qla_nvme_release_fcp_cmd_kref); return; } @@ -199,45 +237,50 @@ static void qla_nvme_abort_work(struct work_struct *work) __func__, sp, sp->handle, fcport, fcport->deleted); if (!ha->flags.fw_started && fcport->deleted) - return; + goto out; if (ha->flags.host_shutting_down) { ql_log(ql_log_info, sp->fcport->vha, 0xffff, "%s Calling done on sp: %p, type: 0x%x, sp->ref_count: 0x%x\n", __func__, sp, sp->type, atomic_read(&sp->ref_count)); sp->done(sp, 0); - return; + goto out; } - if (WARN_ON_ONCE(atomic_read(&sp->ref_count) == 0)) - return; - rval = ha->isp_ops->abort_command(sp); ql_dbg(ql_dbg_io, fcport->vha, 0x212b, "%s: %s command for sp=%p, handle=%x on fcport=%p rval=%x\n", __func__, (rval != QLA_SUCCESS) ? "Failed to abort" : "Aborted", sp, sp->handle, fcport, rval); + +out: + /* kref_get was done before work was schedule. */ + kref_put(&sp->cmd_kref, sp->put_fn); } static void qla_nvme_ls_abort(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *fd) { struct nvme_private *priv = fd->private; + unsigned long flags; + + spin_lock_irqsave(&priv->cmd_lock, flags); + if (!priv->sp) { + spin_unlock_irqrestore(&priv->cmd_lock, flags); + return; + } + + if (!kref_get_unless_zero(&priv->sp->cmd_kref)) { + spin_unlock_irqrestore(&priv->cmd_lock, flags); + return; + } + spin_unlock_irqrestore(&priv->cmd_lock, flags); INIT_WORK(&priv->abort_work, qla_nvme_abort_work); schedule_work(&priv->abort_work); } -static void qla_nvme_ls_complete(struct work_struct *work) -{ - struct nvme_private *priv = - container_of(work, struct nvme_private, ls_work); - struct nvmefc_ls_req *fd = priv->fd; - - fd->done(fd, priv->comp_status); -} - static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *fd) { @@ -268,11 +311,13 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, sp->type = SRB_NVME_LS; sp->name = "nvme_ls"; sp->done = qla_nvme_sp_ls_done; - atomic_set(&sp->ref_count, 1); - nvme = &sp->u.iocb_cmd; + sp->put_fn = qla_nvme_release_ls_cmd_kref; + sp->priv = (void *)priv; priv->sp = sp; + kref_init(&sp->cmd_kref); + spin_lock_init(&priv->cmd_lock); + nvme = &sp->u.iocb_cmd; priv->fd = fd; - INIT_WORK(&priv->ls_work, qla_nvme_ls_complete); nvme->u.nvme.desc = fd; nvme->u.nvme.dir = 0; nvme->u.nvme.dl = 0; @@ -289,9 +334,10 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x700e, "qla2x00_start_sp failed = %d\n", rval); - atomic_dec(&sp->ref_count); wake_up(&sp->nvme_ls_waitq); - sp->free(sp); + sp->priv = NULL; + priv->sp = NULL; + qla2x00_rel_sp(sp); return rval; } @@ -303,6 +349,18 @@ static void qla_nvme_fcp_abort(struct nvme_fc_local_port *lport, struct nvmefc_fcp_req *fd) { struct nvme_private *priv = fd->private; + unsigned long flags; + + spin_lock_irqsave(&priv->cmd_lock, flags); + if (!priv->sp) { + spin_unlock_irqrestore(&priv->cmd_lock, flags); + return; + } + if (!kref_get_unless_zero(&priv->sp->cmd_kref)) { + spin_unlock_irqrestore(&priv->cmd_lock, flags); + return; + } + spin_unlock_irqrestore(&priv->cmd_lock, flags); INIT_WORK(&priv->abort_work, qla_nvme_abort_work); schedule_work(&priv->abort_work); @@ -526,12 +584,15 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, if (!sp) return -EBUSY; - atomic_set(&sp->ref_count, 1); init_waitqueue_head(&sp->nvme_ls_waitq); + kref_init(&sp->cmd_kref); + spin_lock_init(&priv->cmd_lock); + sp->priv = (void *)priv; priv->sp = sp; sp->type = SRB_NVME_CMD; sp->name = "nvme_cmd"; sp->done = qla_nvme_sp_done; + sp->put_fn = qla_nvme_release_fcp_cmd_kref; sp->qpair = qpair; sp->vha = vha; nvme = &sp->u.iocb_cmd; @@ -541,9 +602,10 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x212d, "qla2x00_start_nvme_mq failed = %d\n", rval); - atomic_dec(&sp->ref_count); wake_up(&sp->nvme_ls_waitq); - sp->free(sp); + sp->priv = NULL; + priv->sp = NULL; + qla2xxx_rel_qpair_sp(sp->qpair, sp); } return rval; diff --git a/qla2x00t-32gbit/qla_nvme.h b/qla2x00t-32gbit/qla_nvme.h index 235126834..32c1caf40 100644 --- a/qla2x00t-32gbit/qla_nvme.h +++ b/qla2x00t-32gbit/qla_nvme.h @@ -36,6 +36,7 @@ struct nvme_private { struct work_struct ls_work; struct work_struct abort_work; int comp_status; + spinlock_t cmd_lock; }; struct qla_nvme_rport { From 1e4c96bf76a254af1b690e244049f9f3e24cbdb7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:08:33 +0000 Subject: [PATCH 08/13] qla2x00t-32gbit: Move IO flush to the front of NVME rport unregistration See also upstream commit baf23eddbf2a ("scsi: qla2xxx: move IO flush to the front of NVME rport unregistration"). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8455 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_def.h | 1 - qla2x00t-32gbit/qla_gbl.h | 2 ++ qla2x00t-32gbit/qla_nvme.c | 12 ++---------- qla2x00t-32gbit/qla_target.c | 16 ++++++++-------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 136cb4bf4..f67e9dcbf 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -2416,7 +2416,6 @@ typedef struct fc_port { unsigned int id_changed:1; unsigned int scan_needed:1; - struct work_struct nvme_del_work; struct completion nvme_del_done; uint32_t nvme_prli_service_param; #define NVME_PRLI_SP_CONF BIT_7 diff --git a/qla2x00t-32gbit/qla_gbl.h b/qla2x00t-32gbit/qla_gbl.h index 45388bbc3..4c7449247 100644 --- a/qla2x00t-32gbit/qla_gbl.h +++ b/qla2x00t-32gbit/qla_gbl.h @@ -919,4 +919,6 @@ 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); +/* nvme.c */ +void qla_nvme_unregister_remote_port(struct fc_port *fcport); #endif /* _QLA_GBL_H */ diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 8fd9db77b..1f1ace611 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -17,8 +17,6 @@ static struct nvme_fc_port_template qla_nvme_fc_transport; -static void qla_nvme_unregister_remote_port(struct work_struct *); - int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) { struct qla_nvme_rport *rport; @@ -43,7 +41,6 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) (fcport->nvme_flag & NVME_FLAG_REGISTERED)) return 0; - INIT_WORK(&fcport->nvme_del_work, qla_nvme_unregister_remote_port); fcport->nvme_flag &= ~NVME_FLAG_RESETTING; memset(&req, 0, sizeof(struct nvme_fc_port_info)); @@ -629,15 +626,12 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) fcport = qla_rport->fcport; fcport->nvme_remote_port = NULL; fcport->nvme_flag &= ~NVME_FLAG_REGISTERED; - complete(&fcport->nvme_del_done); - - INIT_WORK(&fcport->free_work, qlt_free_session_done); - schedule_work(&fcport->free_work); fcport->nvme_flag &= ~NVME_FLAG_DELETING; ql_log(ql_log_info, fcport->vha, 0x2110, "remoteport_delete of %p %8phN completed.\n", fcport, fcport->port_name); + complete(&fcport->nvme_del_done); } static struct nvme_fc_port_template qla_nvme_fc_transport = { @@ -659,10 +653,8 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = { .fcprqst_priv_sz = sizeof(struct nvme_private), }; -static void qla_nvme_unregister_remote_port(struct work_struct *work) +void qla_nvme_unregister_remote_port(struct fc_port *fcport) { - struct fc_port *fcport = container_of(work, struct fc_port, - nvme_del_work); int ret; if (!IS_ENABLED(CONFIG_NVME_FC)) diff --git a/qla2x00t-32gbit/qla_target.c b/qla2x00t-32gbit/qla_target.c index f18c3ec43..33a9cc158 100644 --- a/qla2x00t-32gbit/qla_target.c +++ b/qla2x00t-32gbit/qla_target.c @@ -1017,6 +1017,12 @@ void qlt_free_session_done(struct work_struct *work) else logout_started = true; } + } /* if sess->logout_on_delete */ + + if (sess->nvme_flag & NVME_FLAG_REGISTERED && + !(sess->nvme_flag & NVME_FLAG_DELETING)) { + sess->nvme_flag |= NVME_FLAG_DELETING; + qla_nvme_unregister_remote_port(sess); } } @@ -1169,14 +1175,8 @@ void qlt_unreg_sess(struct fc_port *sess) sess->last_rscn_gen = sess->rscn_gen; sess->last_login_gen = sess->login_gen; - if (sess->nvme_flag & NVME_FLAG_REGISTERED && - !(sess->nvme_flag & NVME_FLAG_DELETING)) { - sess->nvme_flag |= NVME_FLAG_DELETING; - schedule_work(&sess->nvme_del_work); - } else { - INIT_WORK(&sess->free_work, qlt_free_session_done); - schedule_work(&sess->free_work); - } + INIT_WORK(&sess->free_work, qlt_free_session_done); + schedule_work(&sess->free_work); } EXPORT_SYMBOL(qlt_unreg_sess); From 3584b2470892f41e80c2e3b38a6b16e1b7e1cd03 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:09:33 +0000 Subject: [PATCH 09/13] qla2x00t-32gbit/qla_init.c: Minimize diffs with the upstream code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8456 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index a4ebff52c..b4ff4cf80 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -123,7 +123,7 @@ static int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) int rval = QLA_FUNCTION_FAILED; sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, - GFP_ATOMIC); + GFP_ATOMIC); if (!sp) return rval; From b5f91e2e8c4f653a96e98d3f1a200fe932aed55f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:10:10 +0000 Subject: [PATCH 10/13] qla2x00t-32gbit/qla_nvme.c: Minimize diffs with the upstream code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8457 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_nvme.c | 1 - 1 file changed, 1 deletion(-) diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 1f1ace611..aaca5ca1e 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -626,7 +626,6 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) fcport = qla_rport->fcport; fcport->nvme_remote_port = NULL; fcport->nvme_flag &= ~NVME_FLAG_REGISTERED; - fcport->nvme_flag &= ~NVME_FLAG_DELETING; ql_log(ql_log_info, fcport->vha, 0x2110, "remoteport_delete of %p %8phN completed.\n", From d73d4daf6f7ae4049a0265c6256d5b6d00f95d45 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:14:29 +0000 Subject: [PATCH 11/13] qla2x00t-32gbit/qla_target.c: Minimize diffs with the upstream code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8458 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_target.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qla2x00t-32gbit/qla_target.c b/qla2x00t-32gbit/qla_target.c index 33a9cc158..62c7224de 100644 --- a/qla2x00t-32gbit/qla_target.c +++ b/qla2x00t-32gbit/qla_target.c @@ -1084,6 +1084,7 @@ void qlt_free_session_done(struct work_struct *work) struct qlt_plogi_ack_t *con = sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]; struct imm_ntfy_from_isp *iocb; + own = sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN]; if (con) { From e43954090e24e0f8f68fc598cdb06425c4c8d973 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:15:23 +0000 Subject: [PATCH 12/13] qla2x00t-32gbit/qla_bsg.c: Minimize diffs with the upstream code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8459 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_bsg.c | 178 +++++++++++++++++++++++++------------- 1 file changed, 118 insertions(+), 60 deletions(-) diff --git a/qla2x00t-32gbit/qla_bsg.c b/qla2x00t-32gbit/qla_bsg.c index 78f10d967..d7711091e 100644 --- a/qla2x00t-32gbit/qla_bsg.c +++ b/qla2x00t-32gbit/qla_bsg.c @@ -146,9 +146,11 @@ qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha, } #ifndef NEW_LIBFC_API -static int qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) +static int +qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) #else -static int qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) +static int +qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) #endif { struct Scsi_Host *host = fc_bsg_to_shost(bsg_job); @@ -278,9 +280,11 @@ exit_fcp_prio_cfg: } #ifndef NEW_LIBFC_API -static int qla2x00_process_els(struct fc_bsg_job *bsg_job) +static int +qla2x00_process_els(struct fc_bsg_job *bsg_job) #else -static int qla2x00_process_els(struct bsg_job *bsg_job) +static int +qla2x00_process_els(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -460,9 +464,11 @@ qla24xx_calc_ct_iocbs(uint16_t dsds) } #ifndef NEW_LIBFC_API -static int qla2x00_process_ct(struct fc_bsg_job *bsg_job) +static int +qla2x00_process_ct(struct fc_bsg_job *bsg_job) #else -static int qla2x00_process_ct(struct bsg_job *bsg_job) +static int +qla2x00_process_ct(struct bsg_job *bsg_job) #endif { srb_t *sp; @@ -741,9 +747,11 @@ done_set_internal: } #ifndef NEW_LIBFC_API -static int qla2x00_process_loopback(struct fc_bsg_job *bsg_job) +static int +qla2x00_process_loopback(struct fc_bsg_job *bsg_job) #else -static int qla2x00_process_loopback(struct bsg_job *bsg_job) +static int +qla2x00_process_loopback(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -986,9 +994,11 @@ done_unmap_req_sg: } #ifndef NEW_LIBFC_API -static int qla84xx_reset(struct fc_bsg_job *bsg_job) +static int +qla84xx_reset(struct fc_bsg_job *bsg_job) #else -static int qla84xx_reset(struct bsg_job *bsg_job) +static int +qla84xx_reset(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1025,9 +1035,11 @@ static int qla84xx_reset(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla84xx_updatefw(struct fc_bsg_job *bsg_job) +static int +qla84xx_updatefw(struct fc_bsg_job *bsg_job) #else -static int qla84xx_updatefw(struct bsg_job *bsg_job) +static int +qla84xx_updatefw(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1138,9 +1150,11 @@ done_unmap_sg: } #ifndef NEW_LIBFC_API -static int qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) +static int +qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) #else -static int qla84xx_mgmt_cmd(struct bsg_job *bsg_job) +static int +qla84xx_mgmt_cmd(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1337,9 +1351,11 @@ exit_mgmt: } #ifndef NEW_LIBFC_API -static int qla24xx_iidma(struct fc_bsg_job *bsg_job) +static int +qla24xx_iidma(struct fc_bsg_job *bsg_job) #else -static int qla24xx_iidma(struct bsg_job *bsg_job) +static int +qla24xx_iidma(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1429,11 +1445,13 @@ static int qla24xx_iidma(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, - scsi_qla_host_t *vha, uint8_t is_update) +static int +qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, + uint8_t is_update) #else -static int qla2x00_optrom_setup(struct bsg_job *bsg_job, - scsi_qla_host_t *vha, uint8_t is_update) +static int +qla2x00_optrom_setup(struct bsg_job *bsg_job, scsi_qla_host_t *vha, + uint8_t is_update) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1503,9 +1521,11 @@ static int qla2x00_optrom_setup(struct bsg_job *bsg_job, } #ifndef NEW_LIBFC_API -static int qla2x00_read_optrom(struct fc_bsg_job *bsg_job) +static int +qla2x00_read_optrom(struct fc_bsg_job *bsg_job) #else -static int qla2x00_read_optrom(struct bsg_job *bsg_job) +static int +qla2x00_read_optrom(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1543,9 +1563,11 @@ static int qla2x00_read_optrom(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_update_optrom(struct fc_bsg_job *bsg_job) +static int +qla2x00_update_optrom(struct fc_bsg_job *bsg_job) #else -static int qla2x00_update_optrom(struct bsg_job *bsg_job) +static int +qla2x00_update_optrom(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1582,9 +1604,11 @@ static int qla2x00_update_optrom(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job) +static int +qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job) #else -static int qla2x00_update_fru_versions(struct bsg_job *bsg_job) +static int +qla2x00_update_fru_versions(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1638,9 +1662,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla2x00_read_fru_status(struct fc_bsg_job *bsg_job) +static int +qla2x00_read_fru_status(struct fc_bsg_job *bsg_job) #else -static int qla2x00_read_fru_status(struct bsg_job *bsg_job) +static int +qla2x00_read_fru_status(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1692,9 +1718,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla2x00_write_fru_status(struct fc_bsg_job *bsg_job) +static int +qla2x00_write_fru_status(struct fc_bsg_job *bsg_job) #else -static int qla2x00_write_fru_status(struct bsg_job *bsg_job) +static int +qla2x00_write_fru_status(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1742,9 +1770,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla2x00_write_i2c(struct fc_bsg_job *bsg_job) +static int +qla2x00_write_i2c(struct fc_bsg_job *bsg_job) #else -static int qla2x00_write_i2c(struct bsg_job *bsg_job) +static int +qla2x00_write_i2c(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1791,9 +1821,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla2x00_read_i2c(struct fc_bsg_job *bsg_job) +static int +qla2x00_read_i2c(struct fc_bsg_job *bsg_job) #else -static int qla2x00_read_i2c(struct bsg_job *bsg_job) +static int +qla2x00_read_i2c(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1844,9 +1876,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) +static int +qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) #else -static int qla24xx_process_bidir_cmd(struct bsg_job *bsg_job) +static int +qla24xx_process_bidir_cmd(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2025,9 +2059,11 @@ done: } #ifndef NEW_LIBFC_API -static int qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job) +static int +qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job) #else -static int qlafx00_mgmt_cmd(struct bsg_job *bsg_job) +static int +qlafx00_mgmt_cmd(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -2151,9 +2187,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla26xx_serdes_op(struct fc_bsg_job *bsg_job) +static int +qla26xx_serdes_op(struct fc_bsg_job *bsg_job) #else -static int qla26xx_serdes_op(struct bsg_job *bsg_job) +static int +qla26xx_serdes_op(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2196,9 +2234,11 @@ static int qla26xx_serdes_op(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla8044_serdes_op(struct fc_bsg_job *bsg_job) +static int +qla8044_serdes_op(struct fc_bsg_job *bsg_job) #else -static int qla8044_serdes_op(struct bsg_job *bsg_job) +static int +qla8044_serdes_op(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2241,9 +2281,11 @@ static int qla8044_serdes_op(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job) +static int +qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job) #else -static int qla27xx_get_flash_upd_cap(struct bsg_job *bsg_job) +static int +qla27xx_get_flash_upd_cap(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2276,9 +2318,11 @@ static int qla27xx_get_flash_upd_cap(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job) +static int +qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job) #else -static int qla27xx_set_flash_upd_cap(struct bsg_job *bsg_job) +static int +qla27xx_set_flash_upd_cap(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2325,9 +2369,11 @@ static int qla27xx_set_flash_upd_cap(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job) +static int +qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job) #else -static int qla27xx_get_bbcr_data(struct bsg_job *bsg_job) +static int +qla27xx_get_bbcr_data(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2387,9 +2433,11 @@ done: } #ifndef NEW_LIBFC_API -static int qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job) +static int +qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job) #else -static int qla2x00_get_priv_stats(struct bsg_job *bsg_job) +static int +qla2x00_get_priv_stats(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -2449,9 +2497,11 @@ static int qla2x00_get_priv_stats(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job) +static int +qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job) #else -static int qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job) +static int +qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -2496,9 +2546,11 @@ static int qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_get_flash_image_status(struct fc_bsg_job *bsg_job) +static int +qla2x00_get_flash_image_status(struct fc_bsg_job *bsg_job) #else -static int qla2x00_get_flash_image_status(struct bsg_job *bsg_job) +static int +qla2x00_get_flash_image_status(struct bsg_job *bsg_job) #endif { scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); @@ -2538,9 +2590,11 @@ static int qla2x00_get_flash_image_status(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -static int qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) +static int +qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) #else -static int qla2x00_process_vendor_specific(struct bsg_job *bsg_job) +static int +qla2x00_process_vendor_specific(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -2622,9 +2676,11 @@ static int qla2x00_process_vendor_specific(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -int qla24xx_bsg_request(struct fc_bsg_job *bsg_job) +int +qla24xx_bsg_request(struct fc_bsg_job *bsg_job) #else -int qla24xx_bsg_request(struct bsg_job *bsg_job) +int +qla24xx_bsg_request(struct bsg_job *bsg_job) #endif { struct fc_bsg_request *bsg_request = bsg_job->request; @@ -2678,9 +2734,11 @@ int qla24xx_bsg_request(struct bsg_job *bsg_job) } #ifndef NEW_LIBFC_API -int qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) +int +qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) #else -int qla24xx_bsg_timeout(struct bsg_job *bsg_job) +int +qla24xx_bsg_timeout(struct bsg_job *bsg_job) #endif { struct fc_bsg_reply *bsg_reply = bsg_job->reply; From d15fec750f7b3ca43729601e823eba5930e3162f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jul 2019 03:17:22 +0000 Subject: [PATCH 13/13] qla2x00t-32gbit/qla_iocb.c: Minimize diffs with the upstream code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8460 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_iocb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qla2x00t-32gbit/qla_iocb.c b/qla2x00t-32gbit/qla_iocb.c index b946dd1b1..468827f07 100644 --- a/qla2x00t-32gbit/qla_iocb.c +++ b/qla2x00t-32gbit/qla_iocb.c @@ -1071,7 +1071,7 @@ qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, #if QLA_ENABLE_PI int qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp, - struct dsd64 *cur_dsd, uint16_t tot_dsds, struct qla_tgt_cmd *tc) + struct dsd64 *cur_dsd, uint16_t tot_dsds, struct qla_tgt_cmd *tc) { struct dsd_dma *dsd_ptr = NULL, *dif_dsd, *nxt_dsd; struct scatterlist *sg, *sgl;