From: "Kashyap, Desai" <kashyap.desai@lsi.com>
To: linux-scsi@vger.kernel.org
Cc: James.Bottomley@HansenPartnership.com, Eric.Moore@lsi.com,
Sathya.Prakash@lsi.com
Subject: [PATCH] mpt2sas : Enable TLR for SSP TAPE drives
Date: Fri, 13 Nov 2009 13:56:20 +0530 [thread overview]
Message-ID: <20091113082620.GB18271@lsi.com> (raw)
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;
}
next reply other threads:[~2009-11-13 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 8:26 Kashyap, Desai [this message]
2009-11-13 14:53 ` [PATCH] mpt2sas : Enable TLR for SSP TAPE drives James Bottomley
2009-11-16 12:02 ` Desai, Kashyap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091113082620.GB18271@lsi.com \
--to=kashyap.desai@lsi.com \
--cc=Eric.Moore@lsi.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Sathya.Prakash@lsi.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox