]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mpt2sas: Fix for staged device discovery functionality of driver not working
authorsreekanth.reddy@lsi.com <sreekanth.reddy@lsi.com>
Tue, 17 Jul 2012 10:26:12 +0000 (15:56 +0530)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Mon, 27 Aug 2012 14:09:30 +0000 (07:09 -0700)
This patch provides a command line option to disable "Port enable" during
the driver load.

The objective of this command line option is to load the driver and do
all the necessary initialization excluding port enable(i.e. delay
device discovery)

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/mpt2sas/mpt2sas_scsih.c

index 71caabe8dd7427830e575483667358025d5e1176..948230a26fe3d8f80f85ebaacbc0daca014f99cb 100644 (file)
@@ -124,6 +124,10 @@ module_param(diag_buffer_enable, int, 0);
 MODULE_PARM_DESC(diag_buffer_enable, " post diag buffers "
        "(TRACE=1/SNAPSHOT=2/EXTENDED=4/default=0)");
 
+static int disable_discovery = -1;
+module_param(disable_discovery, int, 0);
+MODULE_PARM_DESC(disable_discovery, " disable discovery ");
+
 /**
  * struct sense_info - common structure for obtaining sense keys
  * @skey: sense key
@@ -5968,8 +5972,14 @@ _scsih_sas_discovery_event(struct MPT2SAS_ADAPTER *ioc,
 #endif
 
        if (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED &&
-           !ioc->sas_hba.num_phys)
+           !ioc->sas_hba.num_phys) {
+               if (disable_discovery > 0 && ioc->shost_recovery) {
+                       /* Wait for the reset to complete */
+                       while (ioc->shost_recovery)
+                               ssleep(1);
+               }
                _scsih_sas_host_add(ioc);
+       }
 }
 
 /**
@@ -7924,6 +7934,9 @@ _scsih_scan_start(struct Scsi_Host *shost)
        if (diag_buffer_enable != -1 && diag_buffer_enable != 0)
                mpt2sas_enable_diag_buffer(ioc, diag_buffer_enable);
 
+       if (disable_discovery > 0)
+               return;
+
        ioc->start_scan = 1;
        rc = mpt2sas_port_enable(ioc);
 
@@ -7945,6 +7958,12 @@ _scsih_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
        struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
 
+       if (disable_discovery > 0) {
+               ioc->is_driver_loading = 0;
+               ioc->wait_for_discovery_to_complete = 0;
+               return 1;
+       }
+
        if (time >= (300 * HZ)) {
                ioc->base_cmds.status = MPT2_CMD_NOT_USED;
                printk(MPT2SAS_INFO_FMT "port enable: FAILED with timeout "