public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] add dma_max_segment_size option to scsi_host_template
@ 2007-09-26  8:57 FUJITA Tomonori
  2007-09-26  9:05 ` Jens Axboe
  2007-09-26 10:11 ` Jeff Garzik
  0 siblings, 2 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2007-09-26  8:57 UTC (permalink / raw)
  To: James.Bottomley, jens.axboe, hch, jeff, gregkh, hare, linux-scsi
  Cc: fujita.tomonori

This patch moves blk_queue_max_segment_size to scsi_alloc_queue from
llds. It enables scsi_add_host to tells iommu lld's
dma_max_segment_size. If a low-level driver doesn't specify
dma_max_segment_size, scsi-ml uses 65536 (MAX_SEGMENT_SIZE). So there
are not any functional changes.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/scsi/hosts.c     |    5 +++++
 drivers/scsi/scsi_lib.c  |    1 +
 include/scsi/scsi_host.h |    6 ++++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 96bc312..22877d3 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -365,6 +365,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	else
 		shost->dma_boundary = 0xffffffff;
 
+	if (sht->dma_max_segment_size)
+		shost->dma_max_segment_size = sht->dma_max_segment_size;
+	else
+		shost->dma_max_segment_size = 65536;
+
 	rval = scsi_setup_command_freelist(shost);
 	if (rval)
 		goto fail_kfree;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a417a6f..2ec77a9 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1564,6 +1564,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
 	blk_queue_max_sectors(q, shost->max_sectors);
 	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 	blk_queue_segment_boundary(q, shost->dma_boundary);
+	blk_queue_max_segment_size(q, shost->dma_max_segment_size);
 
 	if (!shost->use_clustering)
 		clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 3b8a6a8..1eb8435 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -383,6 +383,11 @@ struct scsi_host_template {
 	unsigned long dma_boundary;
 
 	/*
+	 * dma scatter gather segment size limit.
+	 */
+	unsigned int dma_max_segment_size;
+
+	/*
 	 * This specifies "machine infinity" for host templates which don't
 	 * limit the transfer size.  Note this limit represents an absolute
 	 * maximum, and may be over the transfer limits allowed for
@@ -571,6 +576,7 @@ struct Scsi_Host {
 	short unsigned int sg_tablesize;
 	short unsigned int max_sectors;
 	unsigned long dma_boundary;
+	unsigned int dma_max_segment_size;
 	/* 
 	 * Used to assign serial numbers to the cmds.
 	 * Protected by the host lock.
-- 
1.5.2.4


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

end of thread, other threads:[~2007-09-29  6:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26  8:57 [PATCH 1/5] add dma_max_segment_size option to scsi_host_template FUJITA Tomonori
2007-09-26  9:05 ` Jens Axboe
2007-09-26 10:11 ` Jeff Garzik
2007-09-26 14:34   ` FUJITA Tomonori
2007-09-26 14:42     ` Jeff Garzik
2007-09-27  0:37       ` FUJITA Tomonori
2007-09-27  6:31         ` Jeff Garzik
2007-09-29  6:30           ` FUJITA Tomonori

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