Skip to content

Commit

Permalink
scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG
Browse files Browse the repository at this point in the history
Only the __qlt_24xx_handle_abts() code path does not know the LUN for an
abort and it uses the TARGET_SCF_LOOKUP_LUN_FROM_TAG flag to have LIO core
look it up. LIO uses target_lookup_lun_from_tag to go from cmd tag to LUN
for the driver. However, qla2xxx has a tcm_qla2xxx_find_cmd_by_tag() which
does almost the same thing as the LIO helper (it finds the cmd but does not
return the LUN). This patch has qla2xxx use its internal helper.

Link: https://lore.kernel.org/r/1604257174-4524-4-git-send-email-michael.christie@oracle.com
Cc: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Mike Christie authored and Martin K. Petersen committed Nov 5, 2020
1 parent 02dd491 commit 8f394da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 11 additions & 10 deletions drivers/scsi/qla2xxx/qla_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
struct qla_hw_data *ha = vha->hw;
struct qla_tgt_mgmt_cmd *mcmd;
struct qla_qpair_hint *h = &vha->vha_tgt.qla_tgt->qphints[0];
struct qla_tgt_cmd *abort_cmd;

ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f,
"qla_target(%d): task abort (tag=%d)\n",
Expand Down Expand Up @@ -2110,17 +2111,17 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
*/
mcmd->se_cmd.cpuid = h->cpuid;

if (ha->tgt.tgt_ops->find_cmd_by_tag) {
struct qla_tgt_cmd *abort_cmd;

abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess,
abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess,
le32_to_cpu(abts->exchange_addr_to_abort));
if (abort_cmd && abort_cmd->qpair) {
mcmd->qpair = abort_cmd->qpair;
mcmd->se_cmd.cpuid = abort_cmd->se_cmd.cpuid;
mcmd->abort_io_attr = abort_cmd->atio.u.isp24.attr;
mcmd->flags = QLA24XX_MGMT_ABORT_IO_ATTR_VALID;
}
if (!abort_cmd)
return -EIO;
mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun;

if (abort_cmd->qpair) {
mcmd->qpair = abort_cmd->qpair;
mcmd->se_cmd.cpuid = abort_cmd->se_cmd.cpuid;
mcmd->abort_io_attr = abort_cmd->atio.u.isp24.attr;
mcmd->flags = QLA24XX_MGMT_ABORT_IO_ATTR_VALID;
}

INIT_WORK(&mcmd->work, qlt_do_tmr_work);
Expand Down
4 changes: 1 addition & 3 deletions drivers/scsi/qla2xxx/tcm_qla2xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,11 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, u64 lun,
struct fc_port *sess = mcmd->sess;
struct se_cmd *se_cmd = &mcmd->se_cmd;
int transl_tmr_func = 0;
int flags = TARGET_SCF_ACK_KREF;

switch (tmr_func) {
case QLA_TGT_ABTS:
pr_debug("%ld: ABTS received\n", sess->vha->host_no);
transl_tmr_func = TMR_ABORT_TASK;
flags |= TARGET_SCF_LOOKUP_LUN_FROM_TAG;
break;
case QLA_TGT_2G_ABORT_TASK:
pr_debug("%ld: 2G Abort Task received\n", sess->vha->host_no);
Expand Down Expand Up @@ -613,7 +611,7 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, u64 lun,
}

return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd,
transl_tmr_func, GFP_ATOMIC, tag, flags);
transl_tmr_func, GFP_ATOMIC, tag, TARGET_SCF_ACK_KREF);
}

static struct qla_tgt_cmd *tcm_qla2xxx_find_cmd_by_tag(struct fc_port *sess,
Expand Down

0 comments on commit 8f394da

Please sign in to comment.