Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252475 > unrolled thread

Re: [PATCH] libata: add support for NCQ commands for SG interface

Started byVinayak Kale <vinayak.kale@gmail.com>
First post2015-10-21 07:20 +0200
Last post2015-10-23 22:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] libata: add support for NCQ commands for SG interface Vinayak Kale <vinayak.kale@gmail.com> - 2015-10-21 07:20 +0200
    Re: [PATCH] libata: add support for NCQ commands for SG interface Tejun Heo <tj@kernel.org> - 2015-10-22 11:00 +0200
      Re: [PATCH] libata: add support for NCQ commands for SG interface Tejun Heo <tj@kernel.org> - 2015-10-23 07:50 +0200
        Re: [PATCH] libata: add support for NCQ commands for SG interface Vinayak Kale <vinayak.kale@seagate.com> - 2015-10-23 22:10 +0200

#1252475 — Re: [PATCH] libata: add support for NCQ commands for SG interface

FromVinayak Kale <vinayak.kale@gmail.com>
Date2015-10-21 07:20 +0200
SubjectRe: [PATCH] libata: add support for NCQ commands for SG interface
Message-ID<qlTYC-1xg-3@gated-at.bofh.it>
Hi Tejun,

On Sat, Oct 17, 2015 at 5:18 PM,  <vinayak.kale@gmail.com> wrote:
> From: Vinayak Kale <vinayak.kale@seagate.com>
>
> This patch is needed to make NCQ commands with FPDMA protocol value
> (eg READ/WRITE FPDMA) work over SCSI Generic (SG) interface.
>
> Signed-off-by: Vinayak Kale <vinayak.kale@seagate.com>
> ---
>  drivers/ata/libata-scsi.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 0d7f0da..5b0a5ab 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -2914,12 +2914,14 @@ ata_scsi_map_proto(u8 byte1)
>         case 5:         /* PIO Data-out */
>                 return ATA_PROT_PIO;
>
> +       case 12:        /* FPDMA */
> +               return ATA_PROT_NCQ;
> +
>         case 0:         /* Hard Reset */
>         case 1:         /* SRST */
>         case 8:         /* Device Diagnostic */
>         case 9:         /* Device Reset */
>         case 7:         /* DMA Queued */
> -       case 12:        /* FPDMA */
>         case 15:        /* Return Response Info */
>         default:        /* Reserved */
>                 break;
> @@ -2963,7 +2965,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
>                         tf->hob_lbal = cdb[7];
>                         tf->hob_lbam = cdb[9];
>                         tf->hob_lbah = cdb[11];
> -                       tf->flags |= ATA_TFLAG_LBA48;
> +                       tf->flags |= (ATA_TFLAG_LBA48 | ATA_TFLAG_LBA);
>                 } else
>                         tf->flags &= ~ATA_TFLAG_LBA48;
>
> @@ -2992,6 +2994,10 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
>                 tf->command = cdb[9];
>         }
>
> +       /* For NCQ commands with FPDMA protocol, copy the tag value */
> +       if (tf->protocol == ATA_PROT_NCQ)
> +               tf->nsect = qc->tag << 3;
> +
>         /* enforce correct master/slave bit */
>         tf->device = dev->devno ?
>                 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
> --
> 1.9.1
>
Any comments on this?

Regards,
Vinayak
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1253599

FromTejun Heo <tj@kernel.org>
Date2015-10-22 11:00 +0200
Message-ID<qmjT4-5Ic-15@gated-at.bofh.it>
In reply to#1252475
Hello,

On Wed, Oct 21, 2015 at 10:39:32AM +0530, Vinayak Kale wrote:
...
> > diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> > index 0d7f0da..5b0a5ab 100644
> > --- a/drivers/ata/libata-scsi.c
> > +++ b/drivers/ata/libata-scsi.c
> > @@ -2914,12 +2914,14 @@ ata_scsi_map_proto(u8 byte1)
> >         case 5:         /* PIO Data-out */
> >                 return ATA_PROT_PIO;
> >
> > +       case 12:        /* FPDMA */
> > +               return ATA_PROT_NCQ;
> > +
> >         case 0:         /* Hard Reset */
> >         case 1:         /* SRST */
> >         case 8:         /* Device Diagnostic */
> >         case 9:         /* Device Reset */
> >         case 7:         /* DMA Queued */
> > -       case 12:        /* FPDMA */
> >         case 15:        /* Return Response Info */
> >         default:        /* Reserved */
> >                 break;
> > @@ -2963,7 +2965,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
> >                         tf->hob_lbal = cdb[7];
> >                         tf->hob_lbam = cdb[9];
> >                         tf->hob_lbah = cdb[11];
> > -                       tf->flags |= ATA_TFLAG_LBA48;
> > +                       tf->flags |= (ATA_TFLAG_LBA48 | ATA_TFLAG_LBA);
> >                 } else
> >                         tf->flags &= ~ATA_TFLAG_LBA48;
> >
> > @@ -2992,6 +2994,10 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
> >                 tf->command = cdb[9];
> >         }
> >
> > +       /* For NCQ commands with FPDMA protocol, copy the tag value */
> > +       if (tf->protocol == ATA_PROT_NCQ)
> > +               tf->nsect = qc->tag << 3;
> > +
> >         /* enforce correct master/slave bit */
> >         tf->device = dev->devno ?
> >                 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
>
> Any comments on this?

It looks like it'd work given that it's forcing qc->tag into
tf->nsect.  What's the use case tho?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1254345

FromTejun Heo <tj@kernel.org>
Date2015-10-23 07:50 +0200
Message-ID<qmDoK-AJ-5@gated-at.bofh.it>
In reply to#1253599
Hello,

On Fri, Oct 23, 2015 at 10:01:35AM +0530, Vinayak Kale wrote:
> > It looks like it'd work given that it's forcing qc->tag into
> > tf->nsect.  What's the use case tho?
> 
> We need to issue NCQ commands with priority bit from user space application.
> 
> BTW, Sergei Shtylyov raised concern regarding usefulness of adding
> ATA_TFLAG_LBA to tf->flags. Can you please comment on that as well?
> Accordingly I will either keep it or discard it in V2. Thanks.

I like the change but can you please put that in a separate patch?
Also, can you please verify that this works fine with multiple regular
NCQ commands in flight?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1254982

FromVinayak Kale <vinayak.kale@seagate.com>
Date2015-10-23 22:10 +0200
Message-ID<qmQP0-3lW-29@gated-at.bofh.it>
In reply to#1254345
Hi Tejun,

On Fri, Oct 23, 2015 at 11:09 AM, Tejun Heo <tj@kernel.org> wrote:
> Hello,
>
> On Fri, Oct 23, 2015 at 10:01:35AM +0530, Vinayak Kale wrote:
>> > It looks like it'd work given that it's forcing qc->tag into
>> > tf->nsect.  What's the use case tho?
>>
>> We need to issue NCQ commands with priority bit from user space application.
>>
>> BTW, Sergei Shtylyov raised concern regarding usefulness of adding
>> ATA_TFLAG_LBA to tf->flags. Can you please comment on that as well?
>> Accordingly I will either keep it or discard it in V2. Thanks.
>
> I like the change but can you please put that in a separate patch?

Ok. I'll put this in a separate patch.

> Also, can you please verify that this works fine with multiple regular
> NCQ commands in flight?

I verified that multiple FPDMA Read/Write commands issued
simultaneously by different processes, work fine.
I hooked up our application's queued Read/Write APIs to fio, ran fio
for 'random rw' over multiple processes. It worked fine.

>
> Thanks.
>
> --
> tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web