]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mpt2sas: setting SDEV into RUNNING state from Interrupt context
authorKashyap, Desai <kashyap.desai@lsi.com>
Thu, 20 Aug 2009 07:53:19 +0000 (13:23 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 24 Sep 2009 15:43:48 +0000 (08:43 -0700)
commit 34a03bef2202d0c9983a8da0a8abaee37d285847 upstream.

Changing SDEV Running state from interrupt context. Previously It was
handle in work queue thread. With this change It will not wait for work
queue thread to execute scsih_ublock_io_device to put SDEV into Running
state. This will reduce delay for Device becoming RUNNING.

Modified this patch considering James comment "Not to change SDEV state
using  scsi_device_set_state API, instead use scsi_internal_device_unblock
scsi_internal_device_block API"

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/mpt2sas/mpt2sas_base.h
drivers/scsi/mpt2sas/mpt2sas_scsih.c

index 15827582a90e1bd9144f7cf5e27749a6508b66a1..e0e9c5ec19020cd9dab5d3ceed1f56ef8f4b2de9 100644 (file)
@@ -802,5 +802,7 @@ void mpt2sas_transport_update_phy_link_change(struct MPT2SAS_ADAPTER *ioc, u16 h
    u16 attached_handle, u8 phy_number, u8 link_rate);
 extern struct sas_function_template mpt2sas_transport_functions;
 extern struct scsi_transport_template *mpt2sas_transport_template;
+extern int scsi_internal_device_block(struct scsi_device *sdev);
+extern int scsi_internal_device_unblock(struct scsi_device *sdev);
 
 #endif /* MPT2SAS_BASE_H_INCLUDED */
index 195f5e5aabf1b0131e40c09f37bd026fe1ab1edc..d3dec2b7e001ac5058bef584253a5888f0e0d9f8 100644 (file)
@@ -2222,7 +2222,7 @@ _scsih_ublock_io_device(struct MPT2SAS_ADAPTER *ioc, u16 handle)
                            MPT2SAS_INFO_FMT "SDEV_RUNNING: "
                            "handle(0x%04x)\n", ioc->name, handle));
                        sas_device_priv_data->block = 0;
-                       scsi_device_set_state(sdev, SDEV_RUNNING);
+                       scsi_internal_device_unblock(sdev);
                }
        }
 }
@@ -2251,7 +2251,7 @@ _scsih_block_io_device(struct MPT2SAS_ADAPTER *ioc, u16 handle)
                            MPT2SAS_INFO_FMT "SDEV_BLOCK: "
                            "handle(0x%04x)\n", ioc->name, handle));
                        sas_device_priv_data->block = 1;
-                       scsi_device_set_state(sdev, SDEV_BLOCK);
+                       scsi_internal_device_block(sdev);
                }
        }
 }
@@ -2327,6 +2327,7 @@ _scsih_block_io_to_children_attached_directly(struct MPT2SAS_ADAPTER *ioc,
        u16 handle;
        u16 reason_code;
        u8 phy_number;
+       u8 link_rate;
 
        for (i = 0; i < event_data->NumEntries; i++) {
                handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle);
@@ -2337,6 +2338,11 @@ _scsih_block_io_to_children_attached_directly(struct MPT2SAS_ADAPTER *ioc,
                    MPI2_EVENT_SAS_TOPO_RC_MASK;
                if (reason_code == MPI2_EVENT_SAS_TOPO_RC_DELAY_NOT_RESPONDING)
                        _scsih_block_io_device(ioc, handle);
+               if (reason_code == MPI2_EVENT_SAS_TOPO_RC_PHY_CHANGED) {
+                       link_rate = event_data->PHY[i].LinkRate >> 4;
+                       if (link_rate >= MPI2_SAS_NEG_LINK_RATE_1_5)
+                               _scsih_ublock_io_device(ioc, handle);
+               }
        }
 }
 
@@ -3708,6 +3714,9 @@ _scsih_remove_device(struct MPT2SAS_ADAPTER *ioc, u16 handle)
            le32_to_cpu(mpi_reply.IOCLogInfo)));
 
  out:
+
+       _scsih_ublock_io_device(ioc, handle);
+
        mpt2sas_transport_port_remove(ioc, sas_device->sas_address,
            sas_device->parent_handle);
 
@@ -3887,10 +3896,6 @@ _scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
                                                   link_rate_);
                                }
                        }
-                       if (reason_code == MPI2_EVENT_SAS_TOPO_RC_PHY_CHANGED) {
-                               if (link_rate_ >= MPI2_SAS_NEG_LINK_RATE_1_5)
-                                       _scsih_ublock_io_device(ioc, handle);
-                       }
                        if (reason_code == MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED) {
                                if (link_rate_ < MPI2_SAS_NEG_LINK_RATE_1_5)
                                        break;