public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] libata: add support for NCQ commands for SG interface
@ 2015-10-27  5:49 vinayak.kale
  2015-10-27  6:16 ` Tejun Heo
  2015-11-16 13:47 ` Mark Lord
  0 siblings, 2 replies; 5+ messages in thread
From: vinayak.kale @ 2015-10-27  5:49 UTC (permalink / raw)
  To: tj, linux-ide, linux-kernel; +Cc: sumit.g.gupta, Vinayak Kale

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>
---
Changes in v2:
 - Decoupled tf->flags changes in ata_scsi_pass_thru() from this patch
   as per Tejun's suggestion. A separate patch will be sent for that change.

 drivers/ata/libata-scsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0d7f0da..c2af592 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;
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] libata: add support for NCQ commands for SG interface
  2015-10-27  5:49 [PATCH v2] libata: add support for NCQ commands for SG interface vinayak.kale
@ 2015-10-27  6:16 ` Tejun Heo
  2015-10-27  6:37   ` Vinayak Kale
  2015-11-16 13:47 ` Mark Lord
  1 sibling, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2015-10-27  6:16 UTC (permalink / raw)
  To: vinayak.kale; +Cc: linux-ide, linux-kernel, sumit.g.gupta, Vinayak Kale

On Tue, Oct 27, 2015 at 11:19:15AM +0530, 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>

Applied to libata/for-4.4.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] libata: add support for NCQ commands for SG interface
  2015-10-27  6:16 ` Tejun Heo
@ 2015-10-27  6:37   ` Vinayak Kale
  0 siblings, 0 replies; 5+ messages in thread
From: Vinayak Kale @ 2015-10-27  6:37 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, linux-kernel, sumit.g.gupta, Vinayak Kale

On Tue, Oct 27, 2015 at 11:46 AM, Tejun Heo <tj@kernel.org> wrote:
> On Tue, Oct 27, 2015 at 11:19:15AM +0530, 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>
>
> Applied to libata/for-4.4.

Thanks Tejun :-)

>
> Thanks.
>
> --
> tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] libata: add support for NCQ commands for SG interface
  2015-10-27  5:49 [PATCH v2] libata: add support for NCQ commands for SG interface vinayak.kale
  2015-10-27  6:16 ` Tejun Heo
@ 2015-11-16 13:47 ` Mark Lord
  2015-11-16 15:31   ` Tejun Heo
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Lord @ 2015-11-16 13:47 UTC (permalink / raw)
  To: vinayak.kale, tj, linux-ide, linux-kernel; +Cc: sumit.g.gupta, Vinayak Kale

On 15-10-27 01:49 AM, 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.
..
> +	/* For NCQ commands with FPDMA protocol, copy the tag value */
> +	if (tf->protocol == ATA_PROT_NCQ)
> +		tf->nsect = qc->tag << 3;
> +


What prevents the qc-tag value here from conflicting with in-flight I/O
using the exact same qc-tag ??

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] libata: add support for NCQ commands for SG interface
  2015-11-16 13:47 ` Mark Lord
@ 2015-11-16 15:31   ` Tejun Heo
  0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2015-11-16 15:31 UTC (permalink / raw)
  To: Mark Lord
  Cc: vinayak.kale, linux-ide, linux-kernel, sumit.g.gupta,
	Vinayak Kale

On Mon, Nov 16, 2015 at 08:47:19AM -0500, Mark Lord wrote:
> On 15-10-27 01:49 AM, 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.
> ..
> >+	/* For NCQ commands with FPDMA protocol, copy the tag value */
> >+	if (tf->protocol == ATA_PROT_NCQ)
> >+		tf->nsect = qc->tag << 3;
> >+
> 
> 
> What prevents the qc-tag value here from conflicting with in-flight I/O
> using the exact same qc-tag ??

The SG command doesn't set the tag, it's being set from an allocated
qc which can't otherwise be in-flight.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-16 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27  5:49 [PATCH v2] libata: add support for NCQ commands for SG interface vinayak.kale
2015-10-27  6:16 ` Tejun Heo
2015-10-27  6:37   ` Vinayak Kale
2015-11-16 13:47 ` Mark Lord
2015-11-16 15:31   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox