Skip to content

Commit d90171d

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: Multi-que support for TMF
Add queue flush for task management command, before placing it on the wire. Do IO flush for all Request Q's. Reported-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Cc: [email protected] Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected] <mailto:[email protected]>> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ac9a786 commit d90171d

File tree

4 files changed

+66
-18
lines changed

4 files changed

+66
-18
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,14 @@ static inline be_id_t port_id_to_be_id(port_id_t port_id)
465465
return res;
466466
}
467467

468+
struct tmf_arg {
469+
struct qla_qpair *qpair;
470+
struct fc_port *fcport;
471+
struct scsi_qla_host *vha;
472+
u64 lun;
473+
u32 flags;
474+
};
475+
468476
struct els_logo_payload {
469477
uint8_t opcode;
470478
uint8_t rsvd[3];

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *);
6969
extern int qla2x00_async_prlo(struct scsi_qla_host *, fc_port_t *);
7070
extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *,
7171
uint16_t *);
72-
extern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint32_t, uint32_t);
72+
extern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint64_t, uint32_t);
7373
struct qla_work_evt *qla2x00_alloc_work(struct scsi_qla_host *,
7474
enum qla_work_type);
7575
extern int qla24xx_async_gnl(struct scsi_qla_host *, fc_port_t *);

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,17 +2020,19 @@ static void qla2x00_tmf_sp_done(srb_t *sp, int res)
20202020
complete(&tmf->u.tmf.comp);
20212021
}
20222022

2023-
int
2024-
qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
2025-
uint32_t tag)
2023+
static int
2024+
__qla2x00_async_tm_cmd(struct tmf_arg *arg)
20262025
{
2027-
struct scsi_qla_host *vha = fcport->vha;
2026+
struct scsi_qla_host *vha = arg->vha;
20282027
struct srb_iocb *tm_iocb;
20292028
srb_t *sp;
2029+
unsigned long flags;
20302030
int rval = QLA_FUNCTION_FAILED;
20312031

2032+
fc_port_t *fcport = arg->fcport;
2033+
20322034
/* ref: INIT */
2033-
sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
2035+
sp = qla2xxx_get_qpair_sp(vha, arg->qpair, fcport, GFP_KERNEL);
20342036
if (!sp)
20352037
goto done;
20362038

@@ -2043,15 +2045,15 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
20432045

20442046
tm_iocb = &sp->u.iocb_cmd;
20452047
init_completion(&tm_iocb->u.tmf.comp);
2046-
tm_iocb->u.tmf.flags = flags;
2047-
tm_iocb->u.tmf.lun = lun;
2048+
tm_iocb->u.tmf.flags = arg->flags;
2049+
tm_iocb->u.tmf.lun = arg->lun;
20482050

2051+
rval = qla2x00_start_sp(sp);
20492052
ql_dbg(ql_dbg_taskm, vha, 0x802f,
2050-
"Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x.\n",
2053+
"Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x ctrl=%x.\n",
20512054
sp->handle, fcport->loop_id, fcport->d_id.b.domain,
2052-
fcport->d_id.b.area, fcport->d_id.b.al_pa);
2055+
fcport->d_id.b.area, fcport->d_id.b.al_pa, arg->flags);
20532056

2054-
rval = qla2x00_start_sp(sp);
20552057
if (rval != QLA_SUCCESS)
20562058
goto done_free_sp;
20572059
wait_for_completion(&tm_iocb->u.tmf.comp);
@@ -2065,12 +2067,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
20652067

20662068
if (!test_bit(UNLOADING, &vha->dpc_flags) && !IS_QLAFX00(vha->hw)) {
20672069
flags = tm_iocb->u.tmf.flags;
2068-
lun = (uint16_t)tm_iocb->u.tmf.lun;
2070+
if (flags & (TCF_LUN_RESET|TCF_ABORT_TASK_SET|
2071+
TCF_CLEAR_TASK_SET|TCF_CLEAR_ACA))
2072+
flags = MK_SYNC_ID_LUN;
2073+
else
2074+
flags = MK_SYNC_ID;
20692075

2070-
/* Issue Marker IOCB */
2071-
qla2x00_marker(vha, vha->hw->base_qpair,
2072-
fcport->loop_id, lun,
2073-
flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID);
2076+
qla2x00_marker(vha, sp->qpair,
2077+
sp->fcport->loop_id, arg->lun, flags);
20742078
}
20752079

20762080
done_free_sp:
@@ -2080,6 +2084,41 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
20802084
return rval;
20812085
}
20822086

2087+
int
2088+
qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint64_t lun,
2089+
uint32_t tag)
2090+
{
2091+
struct scsi_qla_host *vha = fcport->vha;
2092+
struct qla_qpair *qpair;
2093+
struct tmf_arg a;
2094+
struct completion comp;
2095+
int i, rval;
2096+
2097+
init_completion(&comp);
2098+
a.vha = fcport->vha;
2099+
a.fcport = fcport;
2100+
a.lun = lun;
2101+
2102+
if (vha->hw->mqenable) {
2103+
for (i = 0; i < vha->hw->num_qpairs; i++) {
2104+
qpair = vha->hw->queue_pair_map[i];
2105+
if (!qpair)
2106+
continue;
2107+
a.qpair = qpair;
2108+
a.flags = flags|TCF_NOTMCMD_TO_TARGET;
2109+
rval = __qla2x00_async_tm_cmd(&a);
2110+
if (rval)
2111+
break;
2112+
}
2113+
}
2114+
2115+
a.qpair = vha->hw->base_qpair;
2116+
a.flags = flags;
2117+
rval = __qla2x00_async_tm_cmd(&a);
2118+
2119+
return rval;
2120+
}
2121+
20832122
int
20842123
qla24xx_async_abort_command(srb_t *sp)
20852124
{

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
25412541
scsi_qla_host_t *vha = fcport->vha;
25422542
struct qla_hw_data *ha = vha->hw;
25432543
struct srb_iocb *iocb = &sp->u.iocb_cmd;
2544-
struct req_que *req = vha->req;
2544+
struct req_que *req = sp->qpair->req;
25452545

25462546
flags = iocb->u.tmf.flags;
25472547
lun = iocb->u.tmf.lun;
@@ -2557,7 +2557,8 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
25572557
tsk->port_id[2] = fcport->d_id.b.domain;
25582558
tsk->vp_index = fcport->vha->vp_idx;
25592559

2560-
if (flags == TCF_LUN_RESET) {
2560+
if (flags & (TCF_LUN_RESET | TCF_ABORT_TASK_SET|
2561+
TCF_CLEAR_TASK_SET|TCF_CLEAR_ACA)) {
25612562
int_to_scsilun(lun, &tsk->lun);
25622563
host_to_fcp_swap((uint8_t *)&tsk->lun,
25632564
sizeof(tsk->lun));

0 commit comments

Comments
 (0)