Re: [RFC PATCH v3 2/4] ufs: core: mcq: Adds Multi-Circular Queue support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2022-09-02 at 15:41 -0700, Asutosh Das wrote:
> +/**
> + * ufshcd_mcq_decide_queue_depth - decide the queue depth
> + * @hba - per adapter instance
> + *
> + * MAC - Max. Active Command of the Host Controller (HC)
> + * HC wouldn't send more than this commands to the device.
> + * The default MAC is 32, but the max. value may vary with
> + * vendor implementation.
> + * Calculates and adjusts the queue depth based on the depth
> + * supported by the HC, ufs device and if ext_iid is supported.
> + */
> +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 = (val & MCQ_CFG_MAC_MASK) >> MCQ_CFG_MAC_OFFSET;
> +       }
> +
> +       /*  MAC is a 0 based value. */
> +       mac += 1;
> +       qd = min_t(u32, mac, hba->dev_info.bqueuedepth);
> +       if (!qd)
> +               qd = mac;
> +
> +       /* Adjust queue depth based on ext_iid support. */
> +       if (qd > 256 && (!hba->ext_iid_sup || !hba-
> >dev_info.b_ext_iid_en))
> +               qd = 256;
> +       else if (qd > 4096 && hba->ext_iid_sup && hba-
> >dev_info.b_ext_iid_en)
> +               qd = 4096;
> +

Astosh,

I don't understand here.  How can qd be 4096?  MAC in UFSHCI  is 9 bits
width, the maximum depth will be 512, and hba->dev_info.bqueuedepth is
one byte width, maximum will be 256.

Kind regards,
Bean





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux