qla2x00t: Stop using the SCSI pointer

Instead of using the SCp.ptr field to track whether or not a command is
in flight, use the sp->type field to track this information. sp->type
must be set for proper operation of the qla2xxx driver. See e.g. the
switch (sp->type) statement in qla2x00_ct_entry().

Port the commit 8cc7b18f ("qla2x00t-32gbit: Stop using the SCSI pointer")
to the old qlogic driver.
This commit is contained in:
Gleb Chesnokov
2022-04-04 19:56:13 +03:00
parent 8cc7b18fdb
commit be46206a69
2 changed files with 6 additions and 11 deletions
-2
View File
@@ -3189,8 +3189,6 @@ struct qla_tgt_vp_map {
#define QLA_DSDS_PER_IOCB 37
#define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
#define QLA_SG_ALL 1024
enum nexus_wait_type {
+6 -9
View File
@@ -644,7 +644,7 @@ qla2x00_sp_free_dma(void *vha, void *ptr)
ctx1 = NULL;
}
CMD_SP(cmd) = NULL;
sp->type = 0;
mempool_free(sp, ha->srb_mempool);
}
@@ -750,7 +750,6 @@ static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd)
sp->u.scmd.cmd = cmd;
sp->type = SRB_SCSI_CMD;
atomic_set(&sp->ref_count, 1);
CMD_SP(cmd) = (void *)sp;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
cmd->scsi_done = done;
#endif
@@ -807,6 +806,7 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)
unsigned long wait_iter = ABORT_WAIT_ITER;
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
struct qla_hw_data *ha = vha->hw;
srb_t *sp = scsi_cmd_priv(cmd);
int ret = QLA_SUCCESS;
if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) {
@@ -815,10 +815,10 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)
return ret;
}
while (CMD_SP(cmd) && wait_iter--) {
while (sp->type && wait_iter--) {
msleep(ABORT_POLLING_PERIOD);
}
if (CMD_SP(cmd))
if (sp->type)
ret = QLA_FUNCTION_FAILED;
return ret;
@@ -971,9 +971,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
int wait = 0;
struct qla_hw_data *ha = vha->hw;
if (!CMD_SP(cmd))
return SUCCESS;
ret = fc_block_scsi_eh(cmd);
if (ret != SUCCESS && ret != 0)
return ret;
@@ -984,7 +981,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
lun = cmd->device->lun;
spin_lock_irqsave(&ha->hardware_lock, flags);
sp = (srb_t *) CMD_SP(cmd);
sp = scsi_cmd_priv(cmd);
if (!sp) {
spin_unlock_irqrestore(&ha->hardware_lock, flags);
return SUCCESS;
@@ -1012,7 +1009,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* Did the command return during mailbox execution? */
if (ret == FAILED && !CMD_SP(cmd))
if (ret == FAILED && !sp->type)
ret = SUCCESS;
/* Wait for the command to be returned. */