From: Himanshu Madhani <himanshu.madhani@cavium.com>
To: James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com
Cc: himanshu.madhani@cavium.com, linux-scsi@vger.kernel.org
Subject: [PATCH 3/7] qla2xxx: Add command completion wq for error path
Date: Wed, 19 Jul 2017 11:51:47 -0700 [thread overview]
Message-ID: <20170719185151.8564-4-himanshu.madhani@cavium.com> (raw)
In-Reply-To: <20170719185151.8564-1-himanshu.madhani@cavium.com>
From: Duane Grigsby <duane.grigsby@cavium.com>
When NVMe commands encounter error NVMe FC transport needs to
teardown the connection. This patch adds worker thread to process
these IO errors.
Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
drivers/scsi/qla2xxx/qla_def.h | 2 ++
drivers/scsi/qla2xxx/qla_nvme.c | 20 +++++++++++++++++++-
drivers/scsi/qla2xxx/qla_os.c | 10 +++++++++-
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 1635e98867aa..799d25564ed6 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -430,6 +430,7 @@ struct srb_iocb {
} nvme;
} u;
+ struct work_struct rq_work;
struct timer_list timer;
void (*timeout)(void *);
};
@@ -4132,6 +4133,7 @@ typedef struct scsi_qla_host {
atomic_t nvme_ref_count;
wait_queue_head_t nvme_waitq;
struct list_head nvme_rport_list;
+ struct workqueue_struct *nvme_io_wq;
atomic_t nvme_active_aen_cnt;
uint16_t nvme_last_rptd_aen;
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 11494f2f90b5..7543f533edfb 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -156,6 +156,17 @@ static void qla_nvme_sp_ls_done(void *ptr, int res)
qla2x00_rel_sp(sp);
}
+static void qla_nvme_io_work(struct work_struct *work)
+{
+ srb_t *sp;
+ struct srb_iocb *nvme = container_of(work, struct srb_iocb, rq_work);
+ struct nvmefc_fcp_req *fd = nvme->u.nvme.desc;
+ sp = container_of(nvme, srb_t, u.iocb_cmd);
+
+ fd->done(fd);
+ qla2xxx_rel_qpair_sp(sp->qpair, sp);
+}
+
static void qla_nvme_sp_done(void *ptr, int res)
{
srb_t *sp = ptr;
@@ -177,7 +188,13 @@ static void qla_nvme_sp_done(void *ptr, int res)
fd->status = 0;
fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len;
- fd->done(fd);
+ if (res == QLA_FUNCTION_FAILED) {
+ INIT_WORK(&nvme->rq_work, qla_nvme_io_work);
+ queue_work(sp->fcport->vha->nvme_io_wq, &nvme->rq_work);
+ return;
+ } else {
+ fd->done(fd);
+ }
rel:
qla2xxx_rel_qpair_sp(sp->qpair, sp);
}
@@ -514,6 +531,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
sp->done = qla_nvme_sp_done;
sp->qpair = qpair;
nvme = &sp->u.iocb_cmd;
+ INIT_WORK(&nvme->rq_work, qla_nvme_io_work);
nvme->u.nvme.desc = fd;
rval = qla2x00_start_nvme_mq(sp);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 635ce75c630b..3329512b4b35 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2751,7 +2751,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
spin_lock_init(&ha->tgt.sess_lock);
spin_lock_init(&ha->tgt.atio_lock);
-
/* Clear our data area */
ha->bars = bars;
ha->mem_only = mem_only;
@@ -3286,6 +3285,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
base_vha->flags.init_done = 1;
base_vha->flags.online = 1;
ha->prev_minidump_failed = 0;
+ atomic_set(&base_vha->nvme_active_aen_cnt, 0);
+ base_vha->nvme_io_wq = alloc_workqueue("qlnvme-io-wq", 0, 0);
+ if (!base_vha->nvme_io_wq) {
+ ql_log(ql_log_fatal, base_vha, 0x000b,
+ "Unable to allocate workqueue for nvme_io_wq\n");
+ goto disable_device;
+ }
ql_dbg(ql_dbg_init, base_vha, 0x00f2,
"Init done and hba is online.\n");
@@ -3559,6 +3565,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
set_bit(UNLOADING, &base_vha->dpc_flags);
qla_nvme_delete(base_vha);
+ if (base_vha->nvme_io_wq)
+ destroy_workqueue(base_vha->nvme_io_wq);
dma_free_coherent(&ha->pdev->dev,
base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma);
--
2.12.0
next prev parent reply other threads:[~2017-07-19 18:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 18:51 [PATCH 0/7] qla2xxx: Bug fixes for driver Himanshu Madhani
2017-07-19 18:51 ` [PATCH 1/7] qla2xxx: Cleanup NVMe code Himanshu Madhani
2017-07-19 20:44 ` Bart Van Assche
2017-07-19 20:58 ` Madhani, Himanshu
2017-07-20 6:40 ` Johannes Thumshirn
2017-07-20 6:44 ` Johannes Thumshirn
2017-07-19 18:51 ` [PATCH 2/7] qla2xxx: Move function prototype to correct header Himanshu Madhani
2017-07-20 6:49 ` Johannes Thumshirn
2017-07-19 18:51 ` Himanshu Madhani [this message]
2017-07-19 20:46 ` [PATCH 3/7] qla2xxx: Add command completion wq for error path Bart Van Assche
2017-07-20 17:17 ` Madhani, Himanshu
2017-07-19 18:51 ` [PATCH 4/7] qla2xxx: Added change to enable ZIO for FC-NVMe devices Himanshu Madhani
2017-07-20 7:00 ` Johannes Thumshirn
2017-07-20 16:55 ` Madhani, Himanshu
2017-07-19 18:51 ` [PATCH 5/7] qla2xxx: Simpify unregistration of FC-NVMe local/remote ports Himanshu Madhani
2017-07-20 7:03 ` Johannes Thumshirn
2017-07-21 16:25 ` Madhani, Himanshu
2017-07-19 18:51 ` [PATCH 6/7] qla2xxx: Fix remoteport disconnect for FC-NVMe Himanshu Madhani
2017-07-20 7:04 ` Johannes Thumshirn
2017-07-19 18:51 ` [PATCH 7/7] qla2xxx: Refactor usage of Active command arrays Himanshu Madhani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170719185151.8564-4-himanshu.madhani@cavium.com \
--to=himanshu.madhani@cavium.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox