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

From: Bao D. Nguyen
Date: Thu May 04 2023 - 00:10:01 EST


On 4/25/2023 5:12 PM, Bart Van Assche wrote:
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.
Yes. Same comment as in patch #2.


+    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?
Same comment as in patch #1. I will change this 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.
Yes, I will change.


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

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


Thanks,

Bart.