From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org,
Sathya Prakash <sathya.prakash@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Subject: Re: [PATCH] scsi: mpi3mr: Fix SATA NCQ priority support
Date: Thu, 6 Jun 2024 21:14:46 +0900 [thread overview]
Message-ID: <a61c0dc6-40f3-4e01-9657-eadbf3a50c99@kernel.org> (raw)
In-Reply-To: <ZmGB6I1OQ5TZOHAn@infradead.org>
On 6/6/24 18:31, Christoph Hellwig wrote:
> On Thu, Jun 06, 2024 at 02:47:49PM +0900, Damien Le Moal wrote:
>> The function mpi3mr_qcmd() of the mpi3mr driver is able to indicate to
>> the HBA if a read or write command directed at a SATA device should be
>> executed using NCQ high priority, if the request uses the RT priority
>> class and the user has enabled NCQ priority through sysfs.
>>
>> However, unlike the mpt3sas driver, the mpi3mr driver does not define
>> the sas_ncq_prio_supported and sas_ncq_prio_enable sysfs attributes, so
>> the ncq_prio_enable field of struct mpi3mr_sdev_priv_data is never
>> actually set and NCQ Priority cannot ever be used.
>>
>> Fix this by defining these missing atributes to allow a user to check if
>> a device supports NCQ priority and to enable/disable the use of NCQ
>> priority. To do this, lift the function scsih_ncq_prio_supp() out of the
>> mpt3sas driver and make it the generic scsi device function
>> scsi_ncq_prio_supported(). Nothing in that function is hardware
>> specific, so this function can be used for both the mpt3sas driver and
>> the mpi3mr driver.
>
> Shouldn't this move into the SAS transport class instead then?
>
>> +/**
>> + * scsi_ncq_prio_supported - Check for NCQ command priority support
>> + * @sdev: SCSI device
>> + *
>> + * Check if a (SATA) device supports NCQ priority. For non-SATA devices,
>> + * this always return false.
>> + */
>> +bool scsi_ncq_prio_supported(struct scsi_device *sdev)
>> +{
>> + struct scsi_vpd *vpd;
>> + bool ncq_prio_supported = false;
>> +
>> + rcu_read_lock();
>> + vpd = rcu_dereference(sdev->vpd_pg89);
>> + if (vpd && vpd->len >= 214)
>> + ncq_prio_supported = (vpd->data[213] >> 4) & 1;
>> + rcu_read_unlock();
>> +
>> + return ncq_prio_supported;
>> +}
>> +EXPORT_SYMBOL_GPL(scsi_ncq_prio_supported);
>
> This also feels kinda out of place in the core SCSI code and more in
> scope for the SAS transport class, even if the other code can't
> move there for whatever reason.
"also" ? your previous point was not about this function ?
But I think I get it. I will move this to scsi_transport_sas.c and rename it to
sas_ata_ncq_prio_supported().
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-06-06 12:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 5:47 [PATCH] scsi: mpi3mr: Fix SATA NCQ priority support Damien Le Moal
2024-06-06 9:31 ` Christoph Hellwig
2024-06-06 12:14 ` Damien Le Moal [this message]
2024-06-06 12:34 ` Christoph Hellwig
2024-06-06 23:16 ` Damien Le Moal
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=a61c0dc6-40f3-4e01-9657-eadbf3a50c99@kernel.org \
--to=dlemoal@kernel.org \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.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