lkml.org 
[lkml]   [2022]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 07/17] ufs: core: mcq: Calculate queue depth
From
On 10/20/22 11:03, Asutosh Das wrote:
> +u32 ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
> +{
> + u32 qd, val;
> + int mac;
> +
> + mac = ufshcd_mcq_vops_get_hba_mac(hba);
> + if (mac < 0) {
> + val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
> + mac = FIELD_GET(MCQ_CFG_MAC_MASK, val);
> + }

According to the UFSHCI 4.0 specification the MAC value is set by the
host. Can the above code read the MAC value from the host controller
before it has been set by the host? If so, how about leaving out the
code that reads the MAC value from the controller and making it
mandatory to implement the new get_hba_mac vop?

> +
> + /* MAC is a 0 based value. */
> + mac += 1;
> + /* max. value of bqueuedepth = 256, mac is host dependent */

host dependent -> defined by the host controller?

> + qd = min_t(u32, mac, hba->dev_info.bqueuedepth);
> + if (!qd)
> + qd = mac;

How about using min_not_zero() instead of open-coding it?

Thanks,

Bart.

\
 
 \ /
  Last update: 2022-10-27 23:52    [W:0.063 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site