Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Igor Pylypiv <ipylypiv@google.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: Re: [PATCH 2/3] scsi: libsas: Add return_fis_on_success to sas_ata_task
Date: Thu, 17 Aug 2023 23:50:23 +0000	[thread overview]
Message-ID: <ZN6yO8Zcd6BXqKrX@x1-carbon> (raw)
In-Reply-To: <1a3f8cbb-9d2c-08c1-d1ea-4d9898eb0e23@kernel.org>

On Fri, Aug 18, 2023 at 08:12:02AM +0900, Damien Le Moal wrote:
> On 2023/08/18 6:41, Igor Pylypiv wrote:
> > For Command Duration Limits policy 0xD (command completes without
> > an error) libata needs FIS in order to detect the ATA_SENSE bit and
> > read the Sense Data for Successful NCQ Commands log (0Fh).
> > 
> > Set return_fis_on_success for commands that have a CDL descriptor
> > since any CDL descriptor can be configured with policy 0xD.
> > 
> > Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> > ---
> >  drivers/scsi/libsas/sas_ata.c | 3 +++
> >  include/scsi/libsas.h         | 1 +
> >  2 files changed, 4 insertions(+)
> > 
> > diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> > index 77714a495cbb..da67c4f671b2 100644
> > --- a/drivers/scsi/libsas/sas_ata.c
> > +++ b/drivers/scsi/libsas/sas_ata.c
> > @@ -207,6 +207,9 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
> >  	task->ata_task.use_ncq = ata_is_ncq(qc->tf.protocol);
> >  	task->ata_task.dma_xfer = ata_is_dma(qc->tf.protocol);
> >  
> > +	/* CDL policy 0xD requires FIS for successful (no error) completions */
> > +	task->ata_task.return_fis_on_success = ata_qc_has_cdl(qc);
> 
> From the comments on patch 1, this should be:
> 
> 	if (qc->flags & ATA_QCFLAG_HAS_CDL)
> 		task->ata_task.return_sdb_fis_on_success = 1;
> 
> Note the renaming to "return_sdb_fis_on_success" to be clear about the FIS type.

I'm not sure if I agree with this comment.

According to the pm80xx programmers manual,
setting the RETFIS bit enables the HBA to return a FIS for a successful
command:

PIO Read: Nothing is returned
PIO Write: Device To Host FIS received from the device.
DMA Read: Device To Host FIS received from the device.
DMA Write: Device To Host FIS received from the device.
FPDMA Read: Set Device Bit FIS received from the device.
FPDMA Write: Set Device Bit FIS received from the device.
Non-Data: Device To Host FIS received from the device.

So the FIS you get back can also be e.g. a D2H FIS, if you send
e.g. a DMA read command.

If the RETFIS bit is not set, and the command was successful,
no FIS will be returned.

So if you really want to rename this bit, then we would also need to
change the logic in pm80xx to be something like:
if (ata_is_ncq() && task->ata_task.return_sdb_fis_on_success)
	set_RETFIS_bit;

Doesn't it make more sense for this generic libsas flag to keep its
current name, i.e. it means that we enable FIS reception for successful
commands, regardless of FIS type?


Kind regards,
Niklas

  reply	other threads:[~2023-08-17 23:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 21:41 [PATCH 1/3] ata: libata: Introduce ata_qc_has_cdl() Igor Pylypiv
2023-08-17 21:41 ` [PATCH 2/3] scsi: libsas: Add return_fis_on_success to sas_ata_task Igor Pylypiv
2023-08-17 23:12   ` Damien Le Moal
2023-08-17 23:50     ` Niklas Cassel [this message]
2023-08-18  0:06       ` Damien Le Moal
2023-08-17 23:36   ` Niklas Cassel
2023-08-18  0:08     ` Damien Le Moal
2023-08-18  0:37       ` Niklas Cassel
2023-08-18  0:09     ` Damien Le Moal
2023-08-18  1:08     ` Niklas Cassel
2023-08-18 22:00     ` Igor Pylypiv
2023-08-17 21:41 ` [PATCH 3/3] scsi: pm80xx: Set RETFIS when requested by libsas Igor Pylypiv
2023-08-17 23:12   ` Damien Le Moal
2023-08-18 22:45     ` Igor Pylypiv
2023-08-17 23:11 ` [PATCH 1/3] ata: libata: Introduce ata_qc_has_cdl() Damien Le Moal
2023-08-18 20:47   ` Igor Pylypiv

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=ZN6yO8Zcd6BXqKrX@x1-carbon \
    --to=niklas.cassel@wdc.com \
    --cc=dlemoal@kernel.org \
    --cc=ipylypiv@google.com \
    --cc=jejb@linux.ibm.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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