From: Hannes Reinecke <hare@suse.de>
To: Damien Le Moal <dlemoal@kernel.org>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: John Garry <john.g.garry@oracle.com>, Jason Yan <yanaijie@huawei.com>
Subject: Re: [PATCH 3/3] ata: libata-scsi: Use ata_ncq_supported in ata_scsi_dev_config()
Date: Mon, 5 Jun 2023 11:46:45 +0200 [thread overview]
Message-ID: <4cd15610-1381-3fc6-2475-0831a50bf72d@suse.de> (raw)
In-Reply-To: <ebbf146b-d9b7-c870-9894-bfdf8268d768@kernel.org>
On 6/5/23 11:37, Damien Le Moal wrote:
> On 6/5/23 17:04, Hannes Reinecke wrote:
>> On 6/5/23 03:32, Damien Le Moal wrote:
>>> In ata_scsi_dev_config(), instead of hardconing the test to check if
>>> an ATA device supports NCQ by looking at the ATA_DFLAG_NCQ flag, use
>>> ata_ncq_supported().
>>>
>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>> ---
>>> drivers/ata/libata-scsi.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>>> index 8ce90284eb34..22e2e9ab6b60 100644
>>> --- a/drivers/ata/libata-scsi.c
>>> +++ b/drivers/ata/libata-scsi.c
>>> @@ -1122,7 +1122,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
>>> if (dev->flags & ATA_DFLAG_AN)
>>> set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
>>>
>>> - if (dev->flags & ATA_DFLAG_NCQ)
>>> + if (ata_ncq_supported(dev))
>>> depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
>>> depth = min(ATA_MAX_QUEUE, depth);
>>> scsi_change_queue_depth(sdev, depth);
>>
>> Argh. ATA NCQ flags. We have ATA_DFLAG_NCQ, ATA_DFLAG_PIO,
>> ATA_DFLAG_NCQ_OFF (and maybe even more which I forgot about).
>> Can we please move them into some more descriptive, ie which flags
>> are for the drive capabilities (ie _can_ the drive do NCQ) and
>> the current current drive status (ie _does_ the drive do NCQ)?
>> As it stands it's quite confusing.
>
> In include/linux/libata.h, we have:
>
> ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
> ATA_DFLAG_PIO = (1 << 13), /* device limited to PIO mode */
> ATA_DFLAG_NCQ_OFF = (1 << 14), /* device limited to non-NCQ mode */
>
> So there are some description. Not enough ?
>
Well. Guess my point is that ATA_DFLAG_PIO is a device status (which
might change during runtime), whereas ATA_DFLAG_NCQ is a device setting
(either it does or does not support NCQ).
And ATA_DFLAG_NCQ_OFF is again a device status (device supports NCQ, but
it's disabled for whatever reason).
I'd rather have a more descriptive naming like
ATA_DFLAG_NCQ_SUPPORTED
to clearly indicate that this flag is not about what the driver
_currently_ is using (as opposed to ATA_DFLAG_PIO), but rather a static
device configuration which won't change whatever I do.
Cheers,
Hannes
next prev parent reply other threads:[~2023-06-05 9:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 1:32 [PATCH 0/3] Cleanups and improvements Damien Le Moal
2023-06-05 1:32 ` [PATCH 1/3] ata: libata-sata: Improve ata_change_queue_depth() Damien Le Moal
2023-06-05 7:57 ` Hannes Reinecke
2023-06-05 9:58 ` John Garry
2023-06-05 10:40 ` Damien Le Moal
2023-06-05 1:32 ` [PATCH 2/3] ata: libata-eh: Use ata_ncq_enabled() in ata_eh_speed_down() Damien Le Moal
2023-06-05 7:57 ` Hannes Reinecke
2023-06-05 9:45 ` Sergei Shtylyov
2023-06-05 9:47 ` Damien Le Moal
2023-06-05 12:31 ` John Garry
2023-06-05 1:32 ` [PATCH 3/3] ata: libata-scsi: Use ata_ncq_supported in ata_scsi_dev_config() Damien Le Moal
2023-06-05 8:04 ` Hannes Reinecke
2023-06-05 9:37 ` Damien Le Moal
2023-06-05 9:46 ` Hannes Reinecke [this message]
2023-06-05 9:58 ` Damien Le Moal
2023-06-05 9:47 ` Sergei Shtylyov
2023-06-05 9:48 ` 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=4cd15610-1381-3fc6-2475-0831a50bf72d@suse.de \
--to=hare@suse.de \
--cc=dlemoal@kernel.org \
--cc=john.g.garry@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yanaijie@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.