public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpt2sas : Enable TLR for SSP TAPE drives
@ 2009-11-13  8:26 Kashyap, Desai
  2009-11-13 14:53 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Kashyap, Desai @ 2009-11-13  8:26 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, Eric.Moore, Sathya.Prakash

The driver is sending vpd page 0, to get a list of supported pages. Then it
will traverse the list searching for page 0x90. when page 0x90 is present,
the driver will enable the TLR logic for Tape devices only.  The TLR logic
will enable the TLR bits in the SCSI_IO for every request. If there is a
response with MPI2_SCSITASKMGMT_RSP_INVALID_FRAME, the driver will turn off
the TLR logic.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
---
diff -Naurp mpt2sas_orig/mpt2sas_scsih.c mpt2sas/mpt2sas_scsih.c
--- mpt2sas_orig/mpt2sas_scsih.c	2009-11-10 01:28:44.000000000 +0530
+++ mpt2sas/mpt2sas_scsih.c	2009-11-13 14:06:47.000000000 +0530
@@ -1301,7 +1301,6 @@ _scsih_slave_alloc(struct scsi_device *s
 	struct MPT2SAS_DEVICE *sas_device_priv_data;
 	struct scsi_target *starget;
 	struct _raid_device *raid_device;
-	struct _sas_device *sas_device;
 	unsigned long flags;
 
 	sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
@@ -1328,21 +1327,8 @@ _scsih_slave_alloc(struct scsi_device *s
 		if (raid_device)
 			raid_device->sdev = sdev; /* raid is single lun */
 		spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
-	} else {
-		/* set TLR bit for SSP devices */
-		if (!(ioc->facts.IOCCapabilities &
-		     MPI2_IOCFACTS_CAPABILITY_TLR))
-			goto out;
-		spin_lock_irqsave(&ioc->sas_device_lock, flags);
-		sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
-		   sas_device_priv_data->sas_target->sas_address);
-		spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
-		if (sas_device && sas_device->device_info &
-		    MPI2_SAS_DEVICE_INFO_SSP_TARGET)
-			sas_device_priv_data->flags |= MPT_DEVICE_TLR_ON;
 	}
 
- out:
 	return 0;
 }
 
@@ -1475,6 +1461,51 @@ _scsih_get_volume_capabilities(struct MP
 }
 
 /**
+ * _scsih_enable_tlr - setting TLR flags
+ * @ioc: per adapter object
+ * @sdev: scsi device struct
+ *
+ * Enabling Transaction Layer Retries for tape devices when
+ * vpd page 0x90 is present
+ *
+ */
+static void
+_scsih_enable_tlr(struct MPT2SAS_ADAPTER *ioc, struct scsi_device *sdev)
+{
+	struct MPT2SAS_DEVICE *sas_device_priv_data;
+	struct MPT2SAS_TARGET *sas_target_priv_data;
+	char *buffer;
+
+	/* only for TAPE */
+	if (sdev->type != TYPE_TAPE)
+		return;
+
+	if (!(ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR))
+		return;
+
+	sas_device_priv_data = sdev->hostdata;
+	if (!sas_device_priv_data)
+		return;
+	sas_target_priv_data = sas_device_priv_data->sas_target;
+	if (!sas_target_priv_data)
+		return;
+
+	buffer = scsi_get_vpd_page(sdev, 0x90);
+	if (buffer == NULL) {
+		dprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: VPD page 0x90 is not"
+			"supported\n", ioc->name, __func__));
+                return;
+	}
+
+	dprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: VPD page 0x90 is "
+		"supported\n", ioc->name, __func__));
+	sas_device_priv_data->flags |= MPT_DEVICE_TLR_ON;
+	kfree(buffer);
+	return;
+
+}
+
+/**
  * _scsih_slave_configure - device configure routine.
  * @sdev: scsi device struct
  *
@@ -1617,8 +1648,10 @@ _scsih_slave_configure(struct scsi_devic
 
 	_scsih_change_queue_depth(sdev, qdepth);
 
-	if (ssp_target)
+	if (ssp_target) {
 		sas_read_port_mode_page(sdev);
+		_scsih_enable_tlr(ioc, sdev);
+	}
 	return 0;
 }
 

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

end of thread, other threads:[~2009-11-16 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13  8:26 [PATCH] mpt2sas : Enable TLR for SSP TAPE drives Kashyap, Desai
2009-11-13 14:53 ` James Bottomley
2009-11-16 12:02   ` Desai, Kashyap

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