* [PATCH 1/3] mpt fusion: Queue full event handling
@ 2009-04-20 10:43 Kashyap, Desai
2009-04-20 16:38 ` Grant Grundler
0 siblings, 1 reply; 3+ messages in thread
From: Kashyap, Desai @ 2009-04-20 10:43 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley, Eric.Moore, Sathya.Prakash
Handle Queue full event.
FW will report Queue full event to Driver and driver will handle this queue
full event to SCSI Mid layer.
---
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
---
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 32cdfe7..bc6f4b6 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -121,6 +121,7 @@ static void mptsas_expander_delete(MPT_ADAPTER *ioc,
static void mptsas_send_expander_event(struct fw_event_work *fw_event);
static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
+static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event);
static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);
static void mptsas_print_phy_data(MPT_ADAPTER *ioc,
@@ -680,6 +681,18 @@ mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus,
phys_disk.PhysDiskID);
+ mutex_lock(&ioc->sas_device_info_mutex);
+ list_for_each_entry(sas_info, &ioc->sas_device_info_list,
+ list) {
+ if (!sas_info->is_logical_volume &&
+ (sas_info->fw.channel == phys_disk.PhysDiskBus &&
+ sas_info->fw.id == phys_disk.PhysDiskID)) {
+ sas_info->is_hidden_raid_component = 1;
+ sas_info->volume_id = starget->id;
+ }
+ }
+ mutex_unlock(&ioc->sas_device_info_mutex);
+
}
/*
@@ -747,6 +760,29 @@ mptsas_add_device_component_starget(MPT_ADAPTER *ioc,
}
/**
+ * mptsas_del_device_component_by_os - Once a device has been removed, we
+ * mark the entry in the list as being cached
+ * @ioc: Pointer to MPT_ADAPTER structure
+ * @channel: os mapped id's
+ * @id:
+ *
+ **/
+static void
+mptsas_del_device_component_by_os(MPT_ADAPTER *ioc, u8 channel, u8 id)
+{
+ struct sas_device_info *sas_info, *next;
+
+ /*
+ * Set is_cached flag
+ */
+ list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
+ list) {
+ if (sas_info->os.channel == channel && sas_info->os.id == id)
+ sas_info->is_cached = 1;
+ }
+}
+
+/**
* mptsas_del_device_components - Cleaning the list
* @ioc: Pointer to MPT_ADAPTER structure
*
@@ -1576,6 +1612,9 @@ mptsas_firmware_event_work(struct work_struct *work)
case MPI_EVENT_SAS_PHY_LINK_STATUS:
mptsas_send_link_status_event(fw_event);
break;
+ case MPI_EVENT_QUEUE_FULL:
+ mptsas_handle_queue_full_event(fw_event);
+ break;
}
}
@@ -1705,6 +1744,9 @@ mptsas_target_destroy(struct scsi_target *starget)
vtarget = starget->hostdata;
+ mptsas_del_device_component_by_os(ioc, starget->channel,
+ starget->id);
+
if (starget->channel == MPTSAS_RAID_CHANNEL)
goto out;
@@ -3396,6 +3438,8 @@ mptsas_not_responding_devices(MPT_ADAPTER *ioc)
/* devices, logical volumes */
redo_device_scan:
list_for_each_entry(sas_info, &ioc->sas_device_info_list, list) {
+ if (sas_info->is_cached)
+ continue;
if (!sas_info->is_logical_volume) {
sas_device.handle = 0;
retry_count = 0;
@@ -3605,6 +3649,95 @@ mptsas_scan_sas_topology(MPT_ADAPTER *ioc)
}
}
+
+static void
+mptsas_handle_queue_full_event(struct fw_event_work *fw_event)
+{
+ MPT_ADAPTER *ioc;
+ EventDataQueueFull_t *qfull_data;
+ struct sas_device_info *sas_info;
+ struct scsi_device *sdev;
+ int depth;
+ int id = -1;
+ int channel = -1;
+ int fw_id, fw_channel;
+ u16 current_depth;
+
+
+ ioc = fw_event->ioc;
+ qfull_data = (EventDataQueueFull_t *)fw_event->event_data;
+ fw_id = qfull_data->TargetID;
+ fw_channel = qfull_data->Bus;
+ current_depth = le16_to_cpu(qfull_data->CurrentDepth);
+
+ /* if hidden raid component, look for the volume id */
+ mutex_lock(&ioc->sas_device_info_mutex);
+ if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) {
+ list_for_each_entry(sas_info, &ioc->sas_device_info_list,
+ list) {
+ if (sas_info->is_cached ||
+ sas_info->is_logical_volume)
+ continue;
+ if (sas_info->is_hidden_raid_component &&
+ (sas_info->fw.channel == fw_channel &&
+ sas_info->fw.id == fw_id)) {
+ id = sas_info->volume_id;
+ channel = MPTSAS_RAID_CHANNEL;
+ goto out;
+ }
+ }
+ } else {
+ list_for_each_entry(sas_info, &ioc->sas_device_info_list,
+ list) {
+ if (sas_info->is_cached ||
+ sas_info->is_hidden_raid_component ||
+ sas_info->is_logical_volume)
+ continue;
+ if (sas_info->fw.channel == fw_channel &&
+ sas_info->fw.id == fw_id) {
+ id = sas_info->os.id;
+ channel = sas_info->os.channel;
+ goto out;
+ }
+ }
+
+ }
+
+ out:
+ mutex_unlock(&ioc->sas_device_info_mutex);
+
+ if (id != -1) {
+ shost_for_each_device(sdev, ioc->sh) {
+ if (sdev->id == id && sdev->channel == channel) {
+ if (current_depth > sdev->queue_depth) {
+ sdev_printk(KERN_INFO, sdev,
+ "strange observation, the queue "
+ "depth is (%d) meanwhile fw queue "
+ "depth (%d)\n", sdev->queue_depth,
+ current_depth);
+ continue;
+ }
+ depth = scsi_track_queue_full(sdev,
+ current_depth - 1);
+ if (depth > 0)
+ sdev_printk(KERN_INFO, sdev,
+ "Queue depth reduced to (%d)\n",
+ depth);
+ else if (depth < 0)
+ sdev_printk(KERN_INFO, sdev,
+ "Tagged Command Queueing is being "
+ "disabled\n");
+ else if (depth == 0)
+ sdev_printk(KERN_INFO, sdev,
+ "Queue depth not changed yet\n");
+ }
+ }
+ }
+
+ mptsas_free_fw_event(ioc, fw_event);
+}
+
+
static struct mptsas_phyinfo *
mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
{
diff --git a/drivers/message/fusion/mptsas.h b/drivers/message/fusion/mptsas.h
index 9b47379..36578df 100644
--- a/drivers/message/fusion/mptsas.h
+++ b/drivers/message/fusion/mptsas.h
@@ -83,6 +83,12 @@ struct sas_device_info {
u16 slot; /* enclosure slot id */
u64 enclosure_logical_id; /*enclosure address */
u8 is_logical_volume; /* is this logical volume */
+ /* this belongs to volume */
+ u8 is_hidden_raid_component;
+ /* this valid when is_hidden_raid_component set */
+ u8 volume_id;
+ /* cached data for a removed device */
+ u8 is_cached;
};
struct mptsas_hotplug_event {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/3] mpt fusion: Queue full event handling
2009-04-20 10:43 [PATCH 1/3] mpt fusion: Queue full event handling Kashyap, Desai
@ 2009-04-20 16:38 ` Grant Grundler
2009-04-20 19:52 ` Moore, Eric
0 siblings, 1 reply; 3+ messages in thread
From: Grant Grundler @ 2009-04-20 16:38 UTC (permalink / raw)
To: Kashyap, Desai; +Cc: linux-scsi, James.Bottomley, Eric.Moore, Sathya.Prakash
Desai,
Some nits about comments. And suggestions that you can chose to ignore. :)
On Mon, Apr 20, 2009 at 3:43 AM, Kashyap, Desai <kashyap.desai@lsi.com> wrote:
...
> diff --git a/drivers/message/fusion/mptsas.h b/drivers/message/fusion/mptsas.h
> index 9b47379..36578df 100644
> --- a/drivers/message/fusion/mptsas.h
> +++ b/drivers/message/fusion/mptsas.h
> @@ -83,6 +83,12 @@ struct sas_device_info {
> u16 slot; /* enclosure slot id */
> u64 enclosure_logical_id; /*enclosure address */
> u8 is_logical_volume; /* is this logical volume */
"is this logical volume" comment is just repeating the variable name. :)
Maybe point at a description (e.g. "See page XX of Programmers Guide")
or omit this comment.
> + /* this belongs to volume */
> + u8 is_hidden_raid_component;
Does "belongs to a volume" mean a "logical volume"?
Suggestion: replace with something like /* is physical dev part of volume? */
> + /* this valid when is_hidden_raid_component set */
> + u8 volume_id;
When looking at code, I would have associated volume_id
with "is_logical_volume" variable. Maybe call this "hidden_raid_VID" ?
> + /* cached data for a removed device */
> + u8 is_cached;
"cached data" generally refers to user payload data.
I'm pretty sure that's not meant here.
Suggestion: /* Device info is cached (or not) */
It's interesting to know this if the device has been removed.
But the act of caching has to take place before the device is
gone and thus, this flag will tell us the data was
read once "before" and may not be current.
Some devices will change the SCSI model string after
they've spun up and loaded the full firmware from reserved
tracks on the media.
> };
>
> struct mptsas_hotplug_event {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH 1/3] mpt fusion: Queue full event handling
2009-04-20 16:38 ` Grant Grundler
@ 2009-04-20 19:52 ` Moore, Eric
0 siblings, 0 replies; 3+ messages in thread
From: Moore, Eric @ 2009-04-20 19:52 UTC (permalink / raw)
To: Grant Grundler, Desai, Kashyap
Cc: linux-scsi@vger.kernel.org, James.Bottomley@hansenpartnership.com,
Prakash, Sathya
On Monday, April 20, 2009 10:39 AM, Grant Grundler wrote:
> > u8 is_logical_volume; /* is
> this logical volume */
>
> "is this logical volume" comment is just repeating the
> variable name. :)
> Maybe point at a description (e.g. "See page XX of Programmers Guide")
> or omit this comment.
This is a boolean variable meaning whether the device object is a raid volume or not. If its a raid volume, this is set to 1. If its not a raid volume, this is set to zero. When its set to zero, then it means the device could be bare drive, hidden raid component, or some other periphial like tape, cdrom, etc.
>
> > + /* this belongs to volume */
> > + u8 is_hidden_raid_component;
>
> Does "belongs to a volume" mean a "logical volume"?
This is a boolean variable meaning whether the device object is a hidden raid component. A hidden raid component is a drive belonging to a raid volume set.
>
> Suggestion: replace with something like /* is physical dev
> part of volume? */
>
> > + /* this valid when is_hidden_raid_component set */
> > + u8 volume_id;
>
> When looking at code, I would have associated volume_id
> with "is_logical_volume" variable. Maybe call this "hidden_raid_VID" ?
This is the target id for the volume when the device object happens to be a hidden raid component.
>
> > + /* cached data for a removed device */
> > + u8 is_cached;
>
> "cached data" generally refers to user payload data.
> I'm pretty sure that's not meant here.
> Suggestion: /* Device info is cached (or not) */
>
> It's interesting to know this if the device has been removed.
> But the act of caching has to take place before the device is
> gone and thus, this flag will tell us the data was
> read once "before" and may not be current.
>
> Some devices will change the SCSI model string after
> they've spun up and loaded the full firmware from reserved
> tracks on the media.
>
No it doesn't mean that.
What this variable means that this device object is still live in the link list after the bare drive has been deleted, hence the data for this object is cached. The reason we are caching the device object is due to a customer request. This particular customer want us to support reporting hidden raid components after then have been removed. They want their storage apps to report this information so the service support reps can identify which drive was pulled or failed.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-20 19:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 10:43 [PATCH 1/3] mpt fusion: Queue full event handling Kashyap, Desai
2009-04-20 16:38 ` Grant Grundler
2009-04-20 19:52 ` Moore, Eric
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.