Skip to content

Commit 60dd6e8

Browse files
Darren Trappmartinkpetersen
authored andcommitted
scsi: qla2xxx: Cleanup code to improve FC-NVMe error handling
This patch cleans up ABTS handling for FC-NVMe by - Removing allocation of sp, instead pass the sp pointer for abort IOCB - Fix error handling from Trasport failure - set outstanding_cmds array to NULL for nvme completion Signed-off-by: Darren Trapp <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 623ee82 commit 60dd6e8

File tree

2 files changed

+29
-51
lines changed

2 files changed

+29
-51
lines changed

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,31 +1837,23 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
18371837
sp->done(sp, 0);
18381838
}
18391839

1840-
static void
1841-
qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
1840+
static void qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
1841+
void *tsk, srb_t *sp)
18421842
{
1843-
const char func[] = "NVME-IOCB";
18441843
fc_port_t *fcport;
1845-
srb_t *sp;
18461844
struct srb_iocb *iocb;
18471845
struct sts_entry_24xx *sts = (struct sts_entry_24xx *)tsk;
18481846
uint16_t state_flags;
18491847
struct nvmefc_fcp_req *fd;
18501848
uint16_t ret = 0;
1851-
struct srb_iocb *nvme;
1852-
1853-
sp = qla2x00_get_sp_from_handle(vha, func, req, tsk);
1854-
if (!sp)
1855-
return;
18561849

18571850
iocb = &sp->u.iocb_cmd;
18581851
fcport = sp->fcport;
18591852
iocb->u.nvme.comp_status = le16_to_cpu(sts->comp_status);
18601853
state_flags = le16_to_cpu(sts->state_flags);
18611854
fd = iocb->u.nvme.desc;
1862-
nvme = &sp->u.iocb_cmd;
18631855

1864-
if (unlikely(nvme->u.nvme.aen_op))
1856+
if (unlikely(iocb->u.nvme.aen_op))
18651857
atomic_dec(&sp->vha->hw->nvme_active_aen_cnt);
18661858

18671859
/*
@@ -1895,45 +1887,30 @@ qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
18951887
fd->transferred_length = fd->payload_length -
18961888
le32_to_cpu(sts->residual_len);
18971889

1898-
/*
1899-
* If transport error then Failure (HBA rejects request)
1900-
* otherwise transport will handle.
1901-
*/
1902-
if (sts->entry_status) {
1903-
ql_log(ql_log_warn, fcport->vha, 0x5038,
1904-
"NVME-%s error - hdl=%x entry-status(%x).\n",
1905-
sp->name, sp->handle, sts->entry_status);
1890+
switch (le16_to_cpu(sts->comp_status)) {
1891+
case CS_COMPLETE:
1892+
ret = QLA_SUCCESS;
1893+
break;
1894+
case CS_ABORTED:
1895+
case CS_RESET:
1896+
case CS_PORT_UNAVAILABLE:
1897+
case CS_PORT_LOGGED_OUT:
1898+
case CS_PORT_BUSY:
1899+
ql_log(ql_log_warn, fcport->vha, 0x5060,
1900+
"NVME-%s ERR Handling - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
1901+
sp->name, sp->handle, sts->comp_status,
1902+
le32_to_cpu(sts->residual_len), sts->ox_id);
1903+
fd->transferred_length = 0;
1904+
iocb->u.nvme.rsp_pyld_len = 0;
1905+
ret = QLA_ABORTED;
1906+
break;
1907+
default:
1908+
ql_log(ql_log_warn, fcport->vha, 0x5060,
1909+
"NVME-%s error - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
1910+
sp->name, sp->handle, sts->comp_status,
1911+
le32_to_cpu(sts->residual_len), sts->ox_id);
19061912
ret = QLA_FUNCTION_FAILED;
1907-
} else {
1908-
switch (le16_to_cpu(sts->comp_status)) {
1909-
case CS_COMPLETE:
1910-
ret = QLA_SUCCESS;
1911-
break;
1912-
1913-
case CS_RESET:
1914-
case CS_PORT_UNAVAILABLE:
1915-
fcport->nvme_flag |= NVME_FLAG_RESETTING;
1916-
/* fall through */
1917-
case CS_ABORTED:
1918-
case CS_PORT_LOGGED_OUT:
1919-
case CS_PORT_BUSY:
1920-
ql_log(ql_log_warn, fcport->vha, 0x5060,
1921-
"NVME-%s ERR Handling - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
1922-
sp->name, sp->handle, sts->comp_status,
1923-
le32_to_cpu(sts->residual_len), sts->ox_id);
1924-
fd->transferred_length = 0;
1925-
iocb->u.nvme.rsp_pyld_len = 0;
1926-
ret = QLA_ABORTED;
1927-
break;
1928-
1929-
default:
1930-
ql_log(ql_log_warn, fcport->vha, 0x5060,
1931-
"NVME-%s error - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
1932-
sp->name, sp->handle, sts->comp_status,
1933-
le32_to_cpu(sts->residual_len), sts->ox_id);
1934-
ret = QLA_FUNCTION_FAILED;
1935-
break;
1936-
}
1913+
break;
19371914
}
19381915
sp->done(sp, ret);
19391916
}
@@ -2461,7 +2438,8 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
24612438

24622439
/* NVME completion. */
24632440
if (sp->type == SRB_NVME_CMD) {
2464-
qla24xx_nvme_iocb_entry(vha, req, pkt);
2441+
req->outstanding_cmds[handle] = NULL;
2442+
qla24xx_nvme_iocb_entry(vha, req, pkt, sp);
24652443
return;
24662444
}
24672445

drivers/scsi/qla2xxx/qla_nvme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static void qla_nvme_poll(struct nvme_fc_local_port *lport, void *hw_queue_handl
280280
spin_unlock_irqrestore(&qpair->qp_lock, flags);
281281
}
282282

283-
static int qla2x00_start_nvme_mq(srb_t *sp)
283+
static inline int qla2x00_start_nvme_mq(srb_t *sp)
284284
{
285285
unsigned long flags;
286286
uint32_t *clr_ptr;

0 commit comments

Comments
 (0)