Skip to contentSkip to conversation

: Add proper HBA defaults to struct Scsi_Host

PATCH New Nicholas A. Bellinger 1 participant 1 message May 12, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 : Add proper HBA defaults to struct Scsi_Host

From: Nicholas Bellinger <[email protected]>

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.

---
 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(-)
drivers/target/tcm_loop/tcm_loop_core.h +14 -0
index cb0aeb5..a160082 100644
@@ -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)
drivers/target/tcm_loop/tcm_loop_fabric_scsi.c +5 -4
index 5417579..66c02c9 100644
@@ -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) {
Signature · 1 line
1.5.6.5