Message ID | 20220214021747.4976-2-damien.lemoal@opensource.wdc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libsas and pm8001 fixes | expand |
On 14/02/2022 02:17, Damien Le Moal wrote: > To detect for the DMA_NONE (no data transfer) DMA direction, > sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. > This test does not include the ATA_CMD_NCQ_NON_DATA command as this > command protocol is defined as ATA_PROT_NCQ_NODATA (equal to > ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA. > > To include both NCQ and non-NCQ commands when testing for the DMA_NONE > DMA direction, use "!ata_is_data()". > > Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") > Cc: stable@vger.kernel.org > Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Regardless of comment below: Reviewed-by: John Garry <john.garry@huawei.com> > --- > drivers/scsi/libsas/sas_ata.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c > index e0030a093994..50f779088b6e 100644 > --- a/drivers/scsi/libsas/sas_ata.c > +++ b/drivers/scsi/libsas/sas_ata.c > @@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) > task->total_xfer_len = qc->nbytes; > task->num_scatter = qc->n_elem; > task->data_dir = qc->dma_dir; > - } else if (qc->tf.protocol == ATA_PROT_NODATA) { > + } else if (!ata_is_data(qc->tf.protocol)) { I was thinking ata_is_dma() would be more appropiate, but I suppose we don't have to use DMA. > task->data_dir = DMA_NONE; > } else { > for_each_sg(qc->sg, sg, qc->n_elem, si)
On 2/15/22 02:56, John Garry wrote: > On 14/02/2022 02:17, Damien Le Moal wrote: >> To detect for the DMA_NONE (no data transfer) DMA direction, >> sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. >> This test does not include the ATA_CMD_NCQ_NON_DATA command as this >> command protocol is defined as ATA_PROT_NCQ_NODATA (equal to >> ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA. >> >> To include both NCQ and non-NCQ commands when testing for the DMA_NONE >> DMA direction, use "!ata_is_data()". >> >> Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") >> Cc: stable@vger.kernel.org >> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> > > Regardless of comment below: > Reviewed-by: John Garry <john.garry@huawei.com> > >> --- >> drivers/scsi/libsas/sas_ata.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c >> index e0030a093994..50f779088b6e 100644 >> --- a/drivers/scsi/libsas/sas_ata.c >> +++ b/drivers/scsi/libsas/sas_ata.c >> @@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) >> task->total_xfer_len = qc->nbytes; >> task->num_scatter = qc->n_elem; >> task->data_dir = qc->dma_dir; >> - } else if (qc->tf.protocol == ATA_PROT_NODATA) { >> + } else if (!ata_is_data(qc->tf.protocol)) { > > I was thinking ata_is_dma() would be more appropiate, but I suppose we > don't have to use DMA. That was my first thought, but using ata_is_dma() would not include PIO case, so that would not work. > >> task->data_dir = DMA_NONE; > } else { >> for_each_sg(qc->sg, sg, qc->n_elem, si) >
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index e0030a093994..50f779088b6e 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; task->data_dir = qc->dma_dir; - } else if (qc->tf.protocol == ATA_PROT_NODATA) { + } else if (!ata_is_data(qc->tf.protocol)) { task->data_dir = DMA_NONE; } else { for_each_sg(qc->sg, sg, qc->n_elem, si)
To detect for the DMA_NONE (no data transfer) DMA direction, sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. This test does not include the ATA_CMD_NCQ_NON_DATA command as this command protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA. To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA direction, use "!ata_is_data()". Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> --- drivers/scsi/libsas/sas_ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)