Re: [PATCH v2 3/5] ufs: mcq: Added ufshcd_mcq_abort()

From: Bart Van Assche
Date: Tue Apr 25 2023 - 20:12:51 EST


On 4/17/23 14:05, Bao D. Nguyen wrote:
+ if (!lrbp->cmd) {
+ dev_err(hba->dev,
+ "%s: skip abort. cmd at tag %d already completed.\n",
+ __func__, tag);
+ goto out;
+ }

Please do not use lrbp->cmd to check whether or not a command has completed.

+ if (ufshcd_mcq_sqe_search(hba, hwq, tag)) {
+ /*
+ * Failure. The command should not be "stuck" in SQ for
+ * a long time which resulted in command being aborted.
+ */
+ dev_err(hba->dev, "%s: cmd found in sq. hwq=%d, tag=%d\n",
+ __func__, hwq->id, tag);
+ /* Set the Command Type to 0xF per the spec */
+ ufshcd_mcq_nullify_cmd(hba, hwq);

The above looks wrong to me. How can ufshcd_mcq_nullify_cmd() identify a command if the 'tag' argument is not passed to that function?

+ /*
+ * The command is not in the Submission Queue, and it is not
+ * in the Completion Queue either. Query the device to see if
+ * the command is being processed in the device.
+ */

Please only use capitals if these are required.

+ if (lrbp->cmd)
+ ufshcd_release_scsi_cmd(hba, lrbp);

Same comment here - do not use lrbp->cmd to check for completion.

Thanks,

Bart.