From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Igor Pylypiv <ipylypiv@google.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Damien Le Moal <dlemoal@kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Jack Wang <jinpu.wang@cloud.ionos.com>,
John Garry <john.g.garry@oracle.com>,
Jason Yan <yanaijie@huawei.com>
Subject: Re: [PATCH 2/3] scsi: libsas: Add return_fis_on_success to sas_ata_task
Date: Fri, 18 Aug 2023 01:08:07 +0000 [thread overview]
Message-ID: <ZN7D5BPK8eiXPEt2@x1-carbon> (raw)
In-Reply-To: <ZN6vB0COt0eJU93A@x1-carbon>
On Fri, Aug 18, 2023 at 01:36:39AM +0200, Niklas Cassel wrote:
> On Thu, Aug 17, 2023 at 02:41:36PM -0700, Igor Pylypiv wrote:
(snip)
> Considering that libsas return value is defined like this:
> https://github.com/torvalds/linux/blob/v6.5-rc6/include/scsi/libsas.h#L507
>
> Basically, if you returned a FIS in resp->ending_fis, you should return
> SAS_PROTO_RESPONSE. If you didn't return a FIS for your command, then
> you return SAS_SAM_STAT_GOOD (or if it is an error, a SAS_ error code
> that is not SAS_PROTO_RESPONSE, as you didn't return a FIS).
>
> Since you have implemented this only for pm80xx, how about adding something
> like this to sas_ata_task_done:
>
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 77714a495cbb..e1c56c2c00a5 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -114,6 +114,15 @@ static void sas_ata_task_done(struct sas_task *task)
> }
> }
>
> + /*
> + * If a FIS was requested for a good command, and the lldd returned
> + * SAS_SAM_STAT_GOOD instead of SAS_PROTO_RESPONSE, then the lldd
> + * has not implemented support for sas_ata_task.return_fis_on_success
> + * Warn about this once. If we don't return FIS on success, then we
> + * won't be able to return an up to date TF.status and TF.error.
> + */
> + WARN_ON_ONCE(ata_qc_wants_result(qc) && stat->stat == SAS_SAM_STAT_GOOD);
> +
> if (stat->stat == SAS_PROTO_RESPONSE ||
> stat->stat == SAS_SAM_STAT_GOOD ||
> (stat->stat == SAS_SAM_STAT_CHECK_CONDITION &&
>
Note that some drivers, e.g. aic94xx, already seem to:
always copy to ending_fis, and sets SAS_PROTO_RESPONSE,
both for successful and error commands. So it would already work.
Other drivers like isci, hisi, and mvsas seem to always copy
to ending_fis, but incorrectly sets status to SAS_PROTO_RESPONSE
only when there was an error.
They should probably also set status to SAS_PROTO_RESPONSE in the
success case, since they did copy the FIS also in the success case.
Kind regards,
Niklas
next prev parent reply other threads:[~2023-08-18 1:08 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
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 [this message]
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=ZN7D5BPK8eiXPEt2@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=john.g.garry@oracle.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox