* [PATCH 1/5] [TCM_Loop]: Add proper HBA defaults to struct Scsi_Host
@ 2010-05-12  7:35 Nicholas A. Bellinger
  0 siblings, 0 replies; only message in thread
From: Nicholas A. Bellinger @ 2010-05-12  7:35 UTC (permalink / raw)
  To: LIO-Target devel, linux-scsi, FUJITA Tomonori, Mike Christie
  Cc: Nicholas Bellinger
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch changes the original hardcoded values and uses the following defs for
TCM_Loop fabric module defaults for the struct Scsi_Host LLD.  The defaults for
struct scsi_host_template->[can_queue,cmd_per_lun] have been increased to 1024,
and ->max_sectors to 256.
This patch also proper sets ->max_cmd_len=16 in tcm_loop_driver_probe() that was
causing 16-byte CDBs to fail with TCM_Loop ports and SG_IO.
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 drivers/target/tcm_loop/tcm_loop_core.h        |   14 ++++++++++++++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c |    9 +++++----
 2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/target/tcm_loop/tcm_loop_core.h b/drivers/target/tcm_loop/tcm_loop_core.h
index cb0aeb5..a160082 100644
--- a/drivers/target/tcm_loop/tcm_loop_core.h
+++ b/drivers/target/tcm_loop/tcm_loop_core.h
@@ -1,6 +1,20 @@
 #define TCM_LOOP_VERSION		"v1.0"
 #define TL_NAA_SAS_ADDR_LEN		64
 #define TL_TPGS_PER_HBA			32
+/*
+ * Defaults for struct scsi_host_template tcm_loop_driver_template
+ *
+ * We use large can_queue and cmd_per_lun here and let TCM enforce
+ * the underlying se_device_t->queue_depth.
+ */
+#define TL_SCSI_CAN_QUEUE		1024
+#define TL_SCSI_CMD_PER_LUN		1024
+#define TL_SCSI_MAX_SECTORS		256
+#define TL_SCSI_SG_TABLESIZE		256
+/*
+ * Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len
+ */
+#define TL_SCSI_MAX_CMD_LEN		16
 
 #ifdef TCM_LOOP_CDB_DEBUG
 # define TL_CDB_DEBUG(x...)		printk(KERN_INFO x)
diff --git a/drivers/target/tcm_loop/tcm_loop_fabric_scsi.c b/drivers/target/tcm_loop/tcm_loop_fabric_scsi.c
index 5417579..66c02c9 100644
--- a/drivers/target/tcm_loop/tcm_loop_fabric_scsi.c
+++ b/drivers/target/tcm_loop/tcm_loop_fabric_scsi.c
@@ -391,11 +391,11 @@ static struct scsi_host_template tcm_loop_driver_template = {
 	.eh_device_reset_handler = NULL,
 	.eh_host_reset_handler	= NULL,
 	.bios_param		= NULL,
-	.can_queue		= 1,
+	.can_queue		= TL_SCSI_CAN_QUEUE,
 	.this_id		= -1,
-	.sg_tablesize		= 256,
-	.cmd_per_lun		= 1,
-	.max_sectors		= 128,
+	.sg_tablesize		= TL_SCSI_SG_TABLESIZE,
+	.cmd_per_lun		= TL_SCSI_CMD_PER_LUN,
+	.max_sectors		= TL_SCSI_MAX_SECTORS,
 	.use_clustering		= DISABLE_CLUSTERING,
 	.module			= THIS_MODULE,
 };
@@ -426,6 +426,7 @@ static int tcm_loop_driver_probe(struct device *dev)
 	sh->max_id = 2;
 	sh->max_lun = 0;
 	sh->max_channel = 0;
+	sh->max_cmd_len = TL_SCSI_MAX_CMD_LEN;
 
 	error = scsi_add_host(sh, &tl_hba->dev);
 	if (error) {
-- 
1.5.6.5
^ permalink raw reply related	[flat|nested] only message in thread
only message in thread, other threads:[~2010-05-12  5:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12  7:35 [PATCH 1/5] [TCM_Loop]: Add proper HBA defaults to struct Scsi_Host Nicholas A. Bellinger
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).