Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
	quic_asutoshd@quicinc.com, quic_cang@quicinc.com,
	mani@kernel.org, stanley.chu@mediatek.com,
	adrian.hunter@intel.com, beanhuo@micron.com, avri.altman@wdc.com,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Arthur Simchaev <Arthur.Simchaev@wdc.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2 1/3] ufs: mcq: Add supporting functions for mcq abort
Date: Thu, 9 Mar 2023 10:15:23 -0800	[thread overview]
Message-ID: <1ca7dbef-5747-29c2-a11c-086cf36d636f@acm.org> (raw)
In-Reply-To: <68b786f390dbd93218a482d18c513bc332e82da3.1678338926.git.quic_nguyenb@quicinc.com>

On 3/8/23 21:28, Bao D. Nguyen wrote:
> +static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
> +		struct ufs_hw_queue *hwq, int task_tag)
> +{
> +	struct utp_transfer_req_desc *utrd;
> +	u32 mask = hwq->max_entries - 1;
> +	bool ret = false;
> +	u64 addr, match;
> +	u32 i;

The variable name "i" is usually used for a loop index. In this case it 
represents a slot in the submission queue. How about renaming "i" into 
"slot"?

> +static inline void ufshcd_mcq_update_sq_head_slot(struct ufs_hw_queue *q)
> +{
> +	u32 val = readl(q->mcq_sq_head);
> +
> +	q->sq_head_slot = val / sizeof(struct utp_transfer_req_desc);
> +}

Please modify this function such that it returns the head slot value 
instead of storing it in a member variable and remove the sq_head_slot 
member variable. Storing the sq_head_slot value in a member variable 
seems wrong to me since the value of that variable will be outdated as 
soon as the submission queue is restarted.

> +static inline bool ufshcd_mcq_is_sq_empty(struct ufs_hw_queue *q)
> +{
> +	return q->sq_head_slot == q->sq_tail_slot;
> +}

Please remove this function and inline this function into its callers.

Thanks,

Bart.

  parent reply	other threads:[~2023-03-09 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  5:28 [RFC PATCH v2 0/3] ufs: core: mcq: Add ufshcd_abort() support in MCQ mode Bao D. Nguyen
2023-03-09  5:28 ` [RFC PATCH v2 1/3] ufs: mcq: Add supporting functions for mcq abort Bao D. Nguyen
2023-03-09  5:58   ` Adrian Hunter
2023-03-09 18:15   ` Bart Van Assche [this message]
2023-03-09 22:47     ` Bao D. Nguyen
2023-03-09 22:54       ` Bart Van Assche
2023-03-09 22:56         ` Bao D. Nguyen
2023-03-09  5:28 ` [RFC PATCH v2 2/3] ufs: mcq: Add support for clean up mcq resources Bao D. Nguyen
2023-03-09  5:28 ` [RFC PATCH v2 3/3] ufs: mcq: Added ufshcd_mcq_abort() Bao D. Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ca7dbef-5747-29c2-a11c-086cf36d636f@acm.org \
    --to=bvanassche@acm.org \
    --cc=Arthur.Simchaev@wdc.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox