linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 08/15] libata: Add ability to prevent PRD from being allocated
@ 2006-02-06 15:42 brking
  2006-02-08 11:12 ` Tejun Heo
  2006-02-09  7:20 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: brking @ 2006-02-06 15:42 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, linux-scsi, brking


For some HBAs, particularly SAS HBAs, there is no reason to
allocate a PRD buffer, since it is not used. Add a flag
to prevent its allocation.

Signed-off-by: Brian King <brking@us.ibm.com>
---

 drivers/scsi/libata-core.c |   11 +++++++----
 include/linux/libata.h     |    1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff -puN include/linux/libata.h~libata_no_prd include/linux/libata.h
--- libata-dev/include/linux/libata.h~libata_no_prd	2006-02-03 12:37:32.000000000 -0600
+++ libata-dev-bjking1/include/linux/libata.h	2006-02-03 12:37:32.000000000 -0600
@@ -161,6 +161,7 @@ enum {
 
 	ATA_FLAG_PIO_LBA48	= (1 << 13), /* Host DMA engine is LBA28 only */
 	ATA_FLAG_IRQ_MASK	= (1 << 14), /* Mask IRQ in PIO xfers */
+	ATA_FLAG_NO_PRD		= (1 << 15), /* No PRD to allocate */
 
 	ATA_QCFLAG_ACTIVE	= (1 << 1), /* cmd not yet ack'd to scsi lyer */
 	ATA_QCFLAG_SG		= (1 << 3), /* have s/g table? */
diff -puN drivers/scsi/libata-core.c~libata_no_prd drivers/scsi/libata-core.c
--- libata-dev/drivers/scsi/libata-core.c~libata_no_prd	2006-02-03 12:37:32.000000000 -0600
+++ libata-dev-bjking1/drivers/scsi/libata-core.c	2006-02-03 12:37:32.000000000 -0600
@@ -4644,9 +4644,11 @@ int ata_port_start (struct ata_port *ap)
 	struct device *dev = ap->dev;
 	int rc;
 
-	ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL);
-	if (!ap->prd)
-		return -ENOMEM;
+	if ((ap->flags & ATA_FLAG_NO_PRD) == 0) {
+		ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL);
+		if (!ap->prd)
+			return -ENOMEM;
+	}
 
 	rc = ata_pad_alloc(ap, dev);
 	if (rc) {
@@ -4676,7 +4678,8 @@ void ata_port_stop (struct ata_port *ap)
 {
 	struct device *dev = ap->dev;
 
-	dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);
+	if ((ap->flags & ATA_FLAG_NO_PRD) == 0)
+		dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);
 	ata_pad_free(ap, dev);
 }
 
_

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

* Re: [patch 08/15] libata: Add ability to prevent PRD from being allocated
  2006-02-06 15:42 [patch 08/15] libata: Add ability to prevent PRD from being allocated brking
@ 2006-02-08 11:12 ` Tejun Heo
  2006-02-08 14:28   ` Brian King
  2006-02-09  9:22   ` Jeff Garzik
  2006-02-09  7:20 ` Jeff Garzik
  1 sibling, 2 replies; 5+ messages in thread
From: Tejun Heo @ 2006-02-08 11:12 UTC (permalink / raw)
  To: brking; +Cc: jgarzik, linux-ide, linux-scsi

Hello, Brian.

brking@us.ibm.com wrote:
> For some HBAs, particularly SAS HBAs, there is no reason to
> allocate a PRD buffer, since it is not used. Add a flag
> to prevent its allocation.
> 

I think it's better done with ata_sas_port_start/stop rather than with
ATA_FLAG_NO_PRD.  All sata low level drivers which don't use PRD table
implement their own port_start/stop (ahci.c, sata_sil24.c for example).

-- 
tejun

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

* Re: [patch 08/15] libata: Add ability to prevent PRD from being allocated
  2006-02-08 11:12 ` Tejun Heo
@ 2006-02-08 14:28   ` Brian King
  2006-02-09  9:22   ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Brian King @ 2006-02-08 14:28 UTC (permalink / raw)
  To: Tejun Heo; +Cc: jgarzik, linux-ide, linux-scsi

Tejun Heo wrote:
> Hello, Brian.
> 
> brking@us.ibm.com wrote:
>> For some HBAs, particularly SAS HBAs, there is no reason to
>> allocate a PRD buffer, since it is not used. Add a flag
>> to prevent its allocation.
>>
> 
> I think it's better done with ata_sas_port_start/stop rather than with
> ATA_FLAG_NO_PRD.  All sata low level drivers which don't use PRD table
> implement their own port_start/stop (ahci.c, sata_sil24.c for example).

Sounds good to me. I'll go ahead and drop this patch and add
ata_sas_port_start/stop.

-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

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

* Re: [patch 08/15] libata: Add ability to prevent PRD from being allocated
  2006-02-06 15:42 [patch 08/15] libata: Add ability to prevent PRD from being allocated brking
  2006-02-08 11:12 ` Tejun Heo
@ 2006-02-09  7:20 ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2006-02-09  7:20 UTC (permalink / raw)
  To: brking; +Cc: linux-ide, linux-scsi

brking@us.ibm.com wrote:
> For some HBAs, particularly SAS HBAs, there is no reason to
> allocate a PRD buffer, since it is not used. Add a flag
> to prevent its allocation.
> 
> Signed-off-by: Brian King <brking@us.ibm.com>

ACK.  This is nice to have regardless of SAS, and perhaps should be 
bumped up in the patch order.



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

* Re: [patch 08/15] libata: Add ability to prevent PRD from being allocated
  2006-02-08 11:12 ` Tejun Heo
  2006-02-08 14:28   ` Brian King
@ 2006-02-09  9:22   ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2006-02-09  9:22 UTC (permalink / raw)
  To: Tejun Heo; +Cc: brking, linux-ide, linux-scsi

Tejun Heo wrote:
> Hello, Brian.
> 
> brking@us.ibm.com wrote:
> 
>>For some HBAs, particularly SAS HBAs, there is no reason to
>>allocate a PRD buffer, since it is not used. Add a flag
>>to prevent its allocation.
>>
> 
> 
> I think it's better done with ata_sas_port_start/stop rather than with
> ATA_FLAG_NO_PRD.  All sata low level drivers which don't use PRD table
> implement their own port_start/stop (ahci.c, sata_sil24.c for example).

Good point.

	Jeff




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

end of thread, other threads:[~2006-02-09  9:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-06 15:42 [patch 08/15] libata: Add ability to prevent PRD from being allocated brking
2006-02-08 11:12 ` Tejun Heo
2006-02-08 14:28   ` Brian King
2006-02-09  9:22   ` Jeff Garzik
2006-02-09  7:20 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).