Skip to content

Commit 8fa0758

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: core: Requeue aborted request
After the SQ cleanup fix, the CQ will receive a response with the corresponding tag marked as OCS: ABORTED. To align with the behavior of Legacy SDB mode, the handling of OCS: ABORTED has been changed to match that of OCS_INVALID_COMMAND_STATUS (SDB), with both returning a SCSI result of DID_REQUEUE. Furthermore, the workaround implemented before the SQ cleanup fix can be removed. Fixes: ab24864 ("scsi: ufs: core: Add error handling for MCQ mode") Cc: stable@vger.kernel.org Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20241001091917.6917-3-peter.wang@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent bf0c6cc commit 8fa0758

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5416,10 +5416,12 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
54165416
}
54175417
break;
54185418
case OCS_ABORTED:
5419-
result |= DID_ABORT << 16;
5420-
break;
54215419
case OCS_INVALID_COMMAND_STATUS:
54225420
result |= DID_REQUEUE << 16;
5421+
dev_warn(hba->dev,
5422+
"OCS %s from controller for tag %d\n",
5423+
(ocs == OCS_ABORTED ? "aborted" : "invalid"),
5424+
lrbp->task_tag);
54235425
break;
54245426
case OCS_INVALID_CMD_TABLE_ATTR:
54255427
case OCS_INVALID_PRDT_ATTR:
@@ -6465,26 +6467,12 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64656467
struct scsi_device *sdev = cmd->device;
64666468
struct Scsi_Host *shost = sdev->host;
64676469
struct ufs_hba *hba = shost_priv(shost);
6468-
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
6469-
struct ufs_hw_queue *hwq;
6470-
unsigned long flags;
64716470

64726471
*ret = ufshcd_try_to_abort_task(hba, tag);
64736472
dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag,
64746473
hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1,
64756474
*ret ? "failed" : "succeeded");
64766475

6477-
/* Release cmd in MCQ mode if abort succeeds */
6478-
if (hba->mcq_enabled && (*ret == 0)) {
6479-
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
6480-
if (!hwq)
6481-
return 0;
6482-
spin_lock_irqsave(&hwq->cq_lock, flags);
6483-
if (ufshcd_cmd_inflight(lrbp->cmd))
6484-
ufshcd_release_scsi_cmd(hba, lrbp);
6485-
spin_unlock_irqrestore(&hwq->cq_lock, flags);
6486-
}
6487-
64886476
return *ret == 0;
64896477
}
64906478

0 commit comments

Comments
 (0)