* [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* Re: [PATCH] mpt2sas : Enable TLR for SSP TAPE drives
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
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2009-11-13 14:53 UTC (permalink / raw)
To: Kashyap, Desai; +Cc: linux-scsi, Eric.Moore, Sathya.Prakash
On Fri, 2009-11-13 at 13:56 +0530, Kashyap, Desai wrote:
> 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.
This is applicable to all SAS drivers, isn't it? So it should be in the
sas transport class and we should be figuring out how to add it to all
SAS drivers, shouldn't we?
James
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mpt2sas : Enable TLR for SSP TAPE drives
2009-11-13 14:53 ` James Bottomley
@ 2009-11-16 12:02 ` Desai, Kashyap
0 siblings, 0 replies; 3+ messages in thread
From: Desai, Kashyap @ 2009-11-16 12:02 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi@vger.kernel.org, Moore, Eric, Prakash, Sathya
> -----Original Message-----
> From: James Bottomley [mailto:James.Bottomley@suse.de]
> Sent: Friday, November 13, 2009 8:24 PM
> To: Desai, Kashyap
> Cc: linux-scsi@vger.kernel.org; Moore, Eric; Prakash, Sathya
> Subject: Re: [PATCH] mpt2sas : Enable TLR for SSP TAPE drives
>
> On Fri, 2009-11-13 at 13:56 +0530, Kashyap, Desai wrote:
> > 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.
>
> This is applicable to all SAS drivers, isn't it? So it should be in the
> sas transport class and we should be figuring out how to add it to all
> SAS drivers, shouldn't we?
>
> James
>
Agree. Nice to have it in transport layer. In that case, we have to add *tlr_enabled* field in *struct scsi_device*.
Currently we are using "sdev->hostdata" to store tlr flags.(this can be replaced by above proposed field in scs_device)
We can add functions like
/*Enable*/ Void sas_enable_tlr(struct scsi_device *sdev)
/*Disable*/ Void sas_disable_tlr(struct scsi_device *sdev)
/*Check*/ int sas_check_tlr(struct scsi_device *sdev)
Caller can take care of checking IOC capabilities of supporting TLR at HBA level and they can call sas_enable_tlr to enable TLR for particular drive.
Suggestion?
Kashyap
^ 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