Re: [dm-devel] [RFC PATCH 00/32] separate operations from flags in the bio/request structs

2015-11-11 Thread Christoph Hellwig
On Wed, Nov 11, 2015 at 01:53:24AM -0600, Mike Christie wrote:
> We no longer have the bvec merge functions so the original reason given
> in the thread/patch Bart referenced is no longer valid.
> 
> Offlist it was suggested that dropping the argument from submit_bio
> might still improve performance, but I modified xfs and dm and did some
> testing and did not see anything.
> 
> So the change is not needed, and it would only be done because people
> feel it would improve the interface.

I would defintively prefer the changed interface, and to me it also
looks like it would make your overall patch simpler.  If you disagree
feel free to keep it as-is for now and I'll do another pass later.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] scsi_transport_fc: Implement 'async_user_scan' module parameter

2015-11-11 Thread Hannes Reinecke
When invoking a scan via the sysfs 'scan' attribute the process
will be blocked until the scan is completed, which can take a
very long time on large installations.
Enabling the 'async_user_scan' parameter moves the actual
LUN scanning to a workqueue, thereby unblocking the process.

Signed-off-by: Hannes Reinecke 
---
 drivers/scsi/scsi_transport_fc.c | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 72954a8..af1d35b 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -83,6 +83,21 @@ MODULE_PARM_DESC(disable_target_scan,
 "Disable target scan on remote ports (default=0)");
 
 /*
+ * async_user_scan: make 'scan' sysfs attribute asynchronous
+ *   on larger installations scanning can take a very long time
+ *   during which the process invoking the scan will be blocked
+ *   on writing to the 'scan' attribute. Enabling this attribute
+ *   will move scanning to a work queue, allowing the process
+ *   to return immediately.
+ */
+static bool fc_async_user_scan;
+
+module_param_named(async_user_scan, fc_async_user_scan,
+  bool, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(async_user_scan,
+"Allow for asynchronous user LUN scanning (default=0)");
+
+/*
  * Redefine so that we can have same named attributes in the
  * sdev/starget/host objects.
  */
@@ -2121,8 +2136,18 @@ fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, 
uint id, uint lun)
 
if ((channel == rport->channel) &&
(id == rport->scsi_target_id)) {
-   spin_unlock_irqrestore(shost->host_lock, flags);
-   scsi_scan_target(>dev, channel, id, lun, 1);
+   if (lun == SCAN_WILD_CARD &&
+   fc_async_user_scan) {
+   if (!(rport->flags & FC_RPORT_SCAN_PENDING)) {
+   rport->flags |= FC_RPORT_SCAN_PENDING;
+   scsi_queue_work(shost,
+   >scan_work);
+   }
+   spin_unlock_irqrestore(shost->host_lock, flags);
+   } else {
+   spin_unlock_irqrestore(shost->host_lock, flags);
+   scsi_scan_target(>dev, channel, id, lun, 
1);
+   }
return;
}
}
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] scsi_transport_fc: LUN masking

2015-11-11 Thread Hannes Reinecke
Hi all,

having been subjected to the pain of trying to bootstrap a really
large machine with systemd I decided to implement LUN masking in
scsi_transport_fc.
The principle is simple: disallow the automated LUN scanning when
discovering a rport, and create udev rules which selectively
enable individual LUNs by echoing the relevant values in the 'scan'
attribute of the SCSI host.
With that I'm able to boot an arbitrary large machine without
running into any udev or systemd imposed timeout.
To _disable_ LUN masking and restoring the original behaviour
I've noticed that the 'scan' sysfs attribute is actually synchronous,
ie the calling process will be blocked until the entire LUN scan
is completed.
So I've added another module parameter 'async_user_scan' to
move the scanning onto the existing scan workqueue, and unblock
the calling process.

As usual, comments and reviews are welcome.

Hannes Reinecke (2):
  scsi_transport_fc: implement 'disable_target_scan' module parameter
  scsi_transport_fc: Implement 'async_user_scan' module parameter

 drivers/scsi/scsi_transport_fc.c | 47 +---
 1 file changed, 44 insertions(+), 3 deletions(-)

-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] scsi_transport_fc: implement 'disable_target_scan' module parameter

2015-11-11 Thread Hannes Reinecke
On larger installations it makes sense to disable the target scan
per default on boot, and scan the required LUNs directly via udev
rules.

Signed-off-by: Hannes Reinecke 
---
 drivers/scsi/scsi_transport_fc.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 454cc28..72954a8 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -71,6 +71,18 @@ MODULE_PARM_DESC(dev_loss_tmo,
 " fast_io_fail_tmo is not set.");
 
 /*
+ * disable_target_scan: Disable target scan per default
+ *   useful on larger installations where only a small
+ *   number of LUNs are required for booting.
+ */
+static bool fc_disable_target_scan;
+
+module_param_named(disable_target_scan, fc_disable_target_scan,
+  bool, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(disable_target_scan,
+"Disable target scan on remote ports (default=0)");
+
+/*
  * Redefine so that we can have same named attributes in the
  * sdev/starget/host objects.
  */
@@ -3282,10 +3294,14 @@ fc_scsi_scan_rport(struct work_struct *work)
struct Scsi_Host *shost = rport_to_shost(rport);
struct fc_internal *i = to_fc_internal(shost->transportt);
unsigned long flags;
+   bool disable_target_scan;
+
+   disable_target_scan = fc_disable_target_scan ?
+   fc_disable_target_scan : i->f->disable_target_scan;
 
if ((rport->port_state == FC_PORTSTATE_ONLINE) &&
(rport->roles & FC_PORT_ROLE_FCP_TARGET) &&
-   !(i->f->disable_target_scan)) {
+   !disable_target_scan) {
scsi_scan_target(>dev, rport->channel,
rport->scsi_target_id, SCAN_WILD_CARD, 1);
}
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 00/32] separate operations from flags in the bio/request structs

2015-11-11 Thread Mike Snitzer
On Wed, Nov 11 2015 at  6:28am -0500,
Christoph Hellwig  wrote:

> On Wed, Nov 11, 2015 at 01:53:24AM -0600, Mike Christie wrote:
> > We no longer have the bvec merge functions so the original reason given
> > in the thread/patch Bart referenced is no longer valid.
> > 
> > Offlist it was suggested that dropping the argument from submit_bio
> > might still improve performance, but I modified xfs and dm and did some
> > testing and did not see anything.
> > 
> > So the change is not needed, and it would only be done because people
> > feel it would improve the interface.
> 
> I would defintively prefer the changed interface, and to me it also
> looks like it would make your overall patch simpler.  If you disagree
> feel free to keep it as-is for now and I'll do another pass later.

The less churn the better.  But honestly, not quite following the logic
on why all this flag-day churn is needed.  BUT if it needs to happen,
because we'll soon hit a wall on supported operations via REQ_*, now is
as good a time as any -- but best to limit the change to the flags IMHO.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RESEND] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE

2015-11-11 Thread Manoj Kumar

Hannes:

A very valid point. Thanks for your suggestion.
Will look at resolving the issue in blk-mq.

Regards,
- Manoj

On 11/11/2015 1:28 AM, Hannes Reinecke wrote:

Shouldn't we rather fixup blk-mq to properly support SG_NONE?
Silently converting SG_NONE (=0) to 1 has a fair chance of breaking
non-mq enabled setups, which happily work with SG_NONE currently.

Cheers,

Hannes



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 03/25] mpt3sas: Move Gen3 HBA's device registration with PCI, SML and IOCTL related API's to a separate file

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

1. Created a mpt3sas_module.c files for mpt3sas driver module,
where it can register SAS3 HBA devices with PCI, SML, IOCTL
subsystems. Also removed the correspanding API's from
mpt3sas_scsih.c file.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/Makefile |   3 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h   |   4 +-
 drivers/scsi/mpt3sas/mpt3sas_ctl.c|  21 ---
 drivers/scsi/mpt3sas/mpt3sas_module.c | 252 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  | 140 +--
 5 files changed, 261 insertions(+), 159 deletions(-)
 create mode 100644 drivers/scsi/mpt3sas/mpt3sas_module.c

diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile
index efb0c4c..188057f 100644
--- a/drivers/scsi/mpt3sas/Makefile
+++ b/drivers/scsi/mpt3sas/Makefile
@@ -5,4 +5,5 @@ mpt3sas-y +=  mpt3sas_base.o \
mpt3sas_scsih.o  \
mpt3sas_transport.o \
mpt3sas_ctl.o   \
-   mpt3sas_trigger_diag.o
+   mpt3sas_trigger_diag.o \
+   mpt3sas_module.o
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 699cf72..0f86729 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1084,6 +1084,7 @@ int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
 
 
 /* scsih shared API */
+extern struct raid_template *mpt3sas_raid_template;
 u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
u32 reply);
 void mpt3sas_scsih_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);
@@ -1108,7 +1109,7 @@ void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER 
*ioc);
 
 void scsih_exit(void);
 int scsih_init(void);
-int scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id);
+int scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost);
 void scsih_remove(struct pci_dev *pdev);
 void scsih_shutdown(struct pci_dev *pdev);
 pci_ers_result_t scsih_pci_error_detected(struct pci_dev *pdev,
@@ -1241,6 +1242,7 @@ int mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER 
*ioc, u8 buffer_type,
u8 *issue_reset);
 
 /* transport shared API */
+extern struct scsi_transport_template *mpt3sas_transport_template;
 u8 mpt3sas_transport_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply);
 struct _sas_port *mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index e72a16c..ffe7982 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -3218,22 +3218,6 @@ struct device_attribute *mpt3sas_dev_attrs[] = {
NULL,
 };
 
-static const struct file_operations ctl_fops = {
-   .owner = THIS_MODULE,
-   .unlocked_ioctl = ctl_ioctl,
-   .poll = ctl_poll,
-   .fasync = ctl_fasync,
-#ifdef CONFIG_COMPAT
-   .compat_ioctl = ctl_ioctl_compat,
-#endif
-};
-
-static struct miscdevice ctl_dev = {
-   .minor  = MPT3SAS_MINOR,
-   .name   = MPT3SAS_DEV_NAME,
-   .fops   = _fops,
-};
-
 /**
  * ctl_init - main entry point for ctl.
  *
@@ -3242,10 +3226,6 @@ void
 ctl_init(void)
 {
async_queue = NULL;
-   if (misc_register(_dev) < 0)
-   pr_err("%s can't register misc device [minor=%d]\n",
-   MPT3SAS_DRIVER_NAME, MPT3SAS_MINOR);
-
init_waitqueue_head(_poll_wait);
 }
 
@@ -3279,5 +3259,4 @@ ctl_exit(void)
 
kfree(ioc->event_log);
}
-   misc_deregister(_dev);
 }
diff --git a/drivers/scsi/mpt3sas/mpt3sas_module.c 
b/drivers/scsi/mpt3sas/mpt3sas_module.c
new file mode 100644
index 000..e5f43ba
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_module.c
@@ -0,0 +1,252 @@
+/*
+ * Scsi Host Layer for MPT (Message Passing Technology) based controllers
+ *
+ * Copyright (C) 2012-2014  LSI Corporation
+ * Copyright (C) 2013-2015 Avago Technologies
+ *  (mailto: mpt-fusionlinux@avagotech.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness 

[PATCH RESEND 04/25] mpt2sas: Created mpt2sas_module.c file in which Gen2 HBA's are registers with PCI, SML and IOCTLs

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

1. Create a mpt2sas_module.c file for mpt2sas driver module
where GEN2 HBA devices registers with PCI, SML, IOCTL subsytems.

2. Updated the Makefile to use the object files from mpt3sas folder

3. Defined a compilation defination flag SCSI_MPT2SAS which can be used to
not include those sections of code from mpt3sas driver which are not
required for mpt2sas driver.

4. Inherited Automatic diag buffer feature from mpt3sas driver.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/Makefile |  14 +-
 drivers/scsi/mpt2sas/mpt2sas_module.c | 280 ++
 drivers/scsi/mpt3sas/mpt3sas_ctl.h|   5 +-
 3 files changed, 293 insertions(+), 6 deletions(-)
 create mode 100644 drivers/scsi/mpt2sas/mpt2sas_module.c

diff --git a/drivers/scsi/mpt2sas/Makefile b/drivers/scsi/mpt2sas/Makefile
index 2ac2fc3..3771616 100644
--- a/drivers/scsi/mpt2sas/Makefile
+++ b/drivers/scsi/mpt2sas/Makefile
@@ -2,10 +2,14 @@
 
 # share the official mpi headers from the mpt3sas driver
 ccflags-y += -I$(src)/../mpt3sas
+ccflags-y += -DSCSI_MPT2SAS
 
+# use the common object files from mpt3sas driver
 obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas.o
-mpt2sas-y +=  mpt2sas_base.o\
-   mpt2sas_config.o\
-   mpt2sas_scsih.o \
-   mpt2sas_transport.o \
-   mpt2sas_ctl.o
+mpt2sas-y +=  ../mpt3sas/mpt3sas_base.o\
+   ../mpt3sas/mpt3sas_config.o\
+   ../mpt3sas/mpt3sas_scsih.o \
+   ../mpt3sas/mpt3sas_transport.o \
+   ../mpt3sas/mpt3sas_ctl.o   \
+   ../mpt3sas/mpt3sas_trigger_diag.o  \
+   mpt2sas_module.o
diff --git a/drivers/scsi/mpt2sas/mpt2sas_module.c 
b/drivers/scsi/mpt2sas/mpt2sas_module.c
new file mode 100644
index 000..2b70693
--- /dev/null
+++ b/drivers/scsi/mpt2sas/mpt2sas_module.c
@@ -0,0 +1,280 @@
+/*
+ * Scsi Host Layer for MPT (Message Passing Technology) based controllers
+ *
+ * Copyright (C) 2012-2014  LSI Corporation
+ * Copyright (C) 2013-2015 Avago Technologies
+ *  (mailto: mpt-fusionlinux@avagotech.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
+ */
+
+#include 
+#include 
+#include 
+
+#include "mpt3sas_base.h"
+#include "mpt3sas_ctl.h"
+
+MODULE_AUTHOR(MPT3SAS_AUTHOR);
+MODULE_DESCRIPTION(MPT2SAS_DESCRIPTION);
+MODULE_LICENSE("GPL");
+MODULE_VERSION(MPT2SAS_DRIVER_VERSION);
+
+/* shost template */
+static struct scsi_host_template mpt2sas_driver_template = {
+   .module = THIS_MODULE,
+   .name   = "Fusion MPT SAS Host",
+   .proc_name  = MPT2SAS_DRIVER_NAME,
+   .queuecommand   = scsih_qcmd,
+   .target_alloc   = scsih_target_alloc,
+   .slave_alloc= scsih_slave_alloc,
+   .slave_configure= scsih_slave_configure,
+   .target_destroy = scsih_target_destroy,
+   .slave_destroy  = scsih_slave_destroy,
+   .scan_finished  = scsih_scan_finished,
+   .scan_start 

[PATCH 00/25] mpt3sas: Mergering mpt2sas & mpt3sas driver code

2015-11-11 Thread Sreekanth Reddy
Last time we have posted a set of patches which combine the mpt2sas
and mpt3sas driver code. and we are generating two driver modules
(i.e. two separate .ko's) from this Combined driver source.

Now we have modified above Combined driver source (i.e. single driver
source with two .ko's) to a Merged driver source (i.e. sing source with
single .ko) which supports both LSI MPT Fusion SAS 2.0 and SAS 3.0
generation HBAs.

Here I am once again posting first 18 patches of Combined driver source
along with last 7 patches which converts this Combined driver source to
Merged driver source.

Here is the change list from Combined driver src to Merged driver src
* Added SAS 2.0 HBA device IDs to the mpt3sas_pci_table pci table.
* Created two separate SCSI host templates for SAS2 and SAS3 HBAs. So
  that, during the driver load time driver can use
  corresponding host template(based the pci device ID) while
  registering a scsi host adapter instance for that pci device.
* Registered two IOCTL devices, mpt2ctl is for SAS2 HBAs & mpt3ctl for
  SAS3 HBAs. Also updated the code to make sure   that mpt2ctl device to
  process only those ioctl cmds issued for the SAS2 HBAs and mpt3ctl
  device to process only those ioctl cmds issued for the SAS3 HBAs.
* Added two separate ioc number indexing for SAS2 and SAS3 HBAs.
* Replaced compile time check 'MPT2SAS_SCSI' to run time check
  'hba_mpi_version_belonged' wherever needed.
* Aliased this merged driver to mpt2sas using MODULE_ALIAS.so that
  still user can load this merged driver with 'modprobe mpt2sas'.
* Moved global variable 'driver_name' to per adapter instance variable.
* Created two raid function templates and used corresponding raid
  function templates based on the run time check
  'hba_mpi_version_belonged'.
* Moved mpt2sas_warpdrive.c file from mpt2sas to mpt3sas folder and
  renamed it as mpt3sas_warpdrive.c.
* Updated the Makefile to built as a mpt3sas_warpdrive.o file.
* Added module parameter 'hbas_to_enumarate', which user can use this
  merged driver as legacy mpt2sas driver or as a
  legacy mpt3sas driver if needed.

Here are the available options for this module parameter
   0 - Merged driver which enumerates both SAS 2.0 & SAS 3.0 HBAs
   1 - Acts as legacy mpt2sas driver, which enumerates only SAS 2.0 HBAs
   2 - Acts as legacy mpt3sas driver, which enumerates only SAS 3.0 HBAs

* Added SCSI_MPT3SAS_MERGED config option, This Kconfig option is only
  used for legacy mpt2sas/mpt3sas interoperability.

In patch 5 (ie. mpt2sas: Removed .c and .h files from mpt2sas driver)
we are just removing mpt2sas driver files. so one can just provide below
command if this patch is not reached to linux-scsi community mail list,

"git rm drivers/scsi/mpt2sas/mpt2sas_base.*
drivers/scsi/mpt2sas/mpt2sas_config.c
drivers/scsi/mpt2sas/mpt2sas_ctl.*
drivers/scsi/mpt2sas/mpt2sas_scsih.c
drivers/scsi/mpt2sas/mpt2sas_transport.c
drivers/scsi/mpt2sas/mpt2sas_debug.h"

Thanks,
Sreekanth

Sreekanth Reddy (25):
  mpt2sas: Use mpi headers from mpt3sas
  mpt3sas: Added mpt2sas driver definitions
  mpt3sas: Move Gen3 HBA's device registration with PCI, SML and IOCTL
related API's to a separate file
  mpt2sas: Created mpt2sas_module.c file in which Gen2 HBA's are
registers with PCI, SML and IOCTLs
  mpt2sas: Removed .c and .h files from mpt2sas driver
  mpt3sas: Define 'hba_mpi_version_belonged' IOC variable
  mpt2sas, mpt3sas : Removed SCSI_MPTXSAS_LOGGING entry from Kconfig
  mpt3sas: For an IO, build MPI SGL LIST on GEN2 HBA's and build IEEE
SGL LIST on GEN3 HBA's
  mpt3sas: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's
  mpt3sas: Manage MSIX vectors according to HBA device type
  mpt3sas: fix for driver fails EEH, recovery from injected pci bus
error
  mpt3sas: Ported WarpDrive product SSS6200 support
  mpt3sas: Ported the providing sysfs attribute to report Backup Rail
Monitor Status
  mpt3sas: Refcount sas_device objects and fix unsafe list usage
  mpt3sas: Refcount fw_events and fix unsafe list usage
  mpt3sas: Added OEMs Gen2 PnP ID Branding names
  mpt3sas: setpci reset kernel oops fix
  mpt2sas, mpt3sas: Update the driver versions
  mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0
HBA's
  mpt3sas: Moved Warpdriver specific functions to mpt3sas_warpdrive.c
  mpt2sas: Removed mpt2sas folder
  mpt3sas: Added a module parameter hbas_to_enumerate
  mpt2sas: Removed mpt2sas entries from SCSI's Kconfig and Makefile
  mpt3sas: Added SCSI_MPT3SAS_MERGED config option
  mpt3sas: Bump mpt3sas driver version to 09.102.00.00

 drivers/scsi/Kconfig |1 -
 drivers/scsi/Makefile|1 -
 drivers/scsi/mpt2sas/Kconfig |   67 -
 drivers/scsi/mpt2sas/Makefile|7 -
 drivers/scsi/mpt2sas/mpi/mpi2.h  | 1170 
 drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h | 3068 ---
 drivers/scsi/mpt2sas/mpi/mpi2_init.h |  461 --
 

[PATCH RESEND 09/25] mpt3sas: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Don't send PHYDISK_HIDDEN Raid Action request for SAS2 HBA's.
Since these HBA's doesn't support this Raid Action.

Also enable fast_path only for SAS3 HBA's.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index a638920..80469d0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1165,8 +1165,10 @@ scsih_target_alloc(struct scsi_target *starget)
if (test_bit(sas_device->handle, ioc->pd_handles))
sas_target_priv_data->flags |=
MPT_TARGET_FLAGS_RAID_COMPONENT;
+#ifndef SCSI_MPT2SAS
if (sas_device->fast_path)
sas_target_priv_data->flags |= MPT_TARGET_FASTPATH_IO;
+#endif
}
spin_unlock_irqrestore(>sas_device_lock, flags);
 
@@ -3719,11 +3721,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
*scmd)
ioc->build_zero_len_sge(ioc, _request->SGL);
 
if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) {
+#ifndef SCSI_MPT2SAS
if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
MPI25_SCSIIO_IOFLAGS_FAST_PATH);
mpt3sas_base_put_smid_fast_path(ioc, smid, handle);
} else
+#endif
mpt3sas_base_put_smid_scsi_io(ioc, smid, handle);
} else
mpt3sas_base_put_smid_default(ioc, smid);
@@ -5031,8 +5035,10 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 
handle, u8 phy_num,
sas_device->device_info = device_info;
sas_device->sas_address = sas_address;
sas_device->phy = sas_device_pg0.PhyNum;
+#ifndef SCSI_MPT2SAS
sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) &
MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0;
+#endif
 
if (sas_device_pg0.Flags & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
sas_device->enclosure_level =
@@ -5731,6 +5737,7 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc,
}
 }
 
+#ifndef SCSI_MPT2SAS
 /**
  * _scsih_ir_fastpath - turn on fastpath for IR physdisk
  * @ioc: per adapter object
@@ -5750,7 +5757,6 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 
handle, u8 phys_disk_num)
u16 ioc_status;
u32 log_info;
 
-
mutex_lock(>scsih_cmds.mutex);
 
if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
@@ -5825,6 +5831,8 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 
handle, u8 phys_disk_num)
FORCE_BIG_HAMMER);
return rc;
 }
+/* End of not defined SCSI_MPT2SAS */
+#endif
 
 /**
  * _scsih_reprobe_lun - reprobing lun
@@ -6017,8 +6025,10 @@ _scsih_sas_pd_hide(struct MPT3SAS_ADAPTER *ioc,
if (!sas_device)
return;
 
+#ifndef SCSI_MPT2SAS
/* hiding raid component */
_scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
+#endif
if (starget)
starget_for_each_device(starget, (void *)1, _scsih_reprobe_lun);
 }
@@ -6067,7 +6077,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc,
sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
spin_unlock_irqrestore(>sas_device_lock, flags);
if (sas_device) {
+#ifndef SCSI_MPT2SAS
_scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
+#endif
return;
}
 
@@ -6091,7 +6103,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc,
mpt3sas_transport_update_links(ioc, sas_address, handle,
sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
 
+#ifndef SCSI_MPT2SAS
_scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
+#endif
_scsih_add_device(ioc, handle, 0, 1);
 }
 
@@ -6202,13 +6216,14 @@ _scsih_sas_ir_config_change_event(struct 
MPT3SAS_ADAPTER *ioc,
 
element = (Mpi2EventIrConfigElement_t *)_data->ConfigElement[0];
if (ioc->shost_recovery) {
-
+#ifndef SCSI_MPT2SAS
for (i = 0; i < event_data->NumElements; i++, element++) {
if (element->ReasonCode == MPI2_EVENT_IR_CHANGE_RC_HIDE)
_scsih_ir_fastpath(ioc,
le16_to_cpu(element->PhysDiskDevHandle),
element->PhysDiskNum);
}
+#endif
return;
}
for (i = 0; i < event_data->NumElements; i++, element++) {
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH 4.1 v2] target-core: fix return without a value

2015-11-11 Thread Mikulas Patocka
Fix the warning drivers/target/target_core_pr.c:332:3: warning: 'return'
with no value, in function returning non-void [-Wreturn-type]

The patch 35afa65642a9a88c81913377b93a3a66220f8b9d committed to 4.1.11
adds a check if device_list is NULL. The patch adds a return statement
without a value to the function core_scsi3_pr_seq_non_holder that returns
int.

This patch has no upstream equivalent because the patch 35afa656 that 
introduced this bug has also no upstream equivalent. The code in upstream 
was already refactored, so neither 35afa656 nor this patch is needed 
there.

Signed-off-by: Mikulas Patocka 

---
 drivers/target/target_core_pr.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-4.1.13/drivers/target/target_core_pr.c
===
--- linux-4.1.13.orig/drivers/target/target_core_pr.c   2015-10-23 
18:25:26.0 +0200
+++ linux-4.1.13/drivers/target/target_core_pr.c2015-11-10 
19:22:07.0 +0100
@@ -329,7 +329,7 @@ static int core_scsi3_pr_seq_non_holder(
 * RESERVATION CONFLICT on some CDBs */
 
if (!se_sess->se_node_acl->device_list)
-   return;
+   return -EINVAL;
 
se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun];
/*
k
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/25] mpt3sas: Mergering mpt2sas & mpt3sas driver code

2015-11-11 Thread Hannes Reinecke
On 11/11/2015 01:00 PM, Sreekanth Reddy wrote:
> Last time we have posted a set of patches which combine the mpt2sas
> and mpt3sas driver code. and we are generating two driver modules
> (i.e. two separate .ko's) from this Combined driver source.
> 
> Now we have modified above Combined driver source (i.e. single driver
> source with two .ko's) to a Merged driver source (i.e. sing source with
> single .ko) which supports both LSI MPT Fusion SAS 2.0 and SAS 3.0
> generation HBAs.
> 
> Here I am once again posting first 18 patches of Combined driver source
> along with last 7 patches which converts this Combined driver source to
> Merged driver source.
> 
> Here is the change list from Combined driver src to Merged driver src
> * Added SAS 2.0 HBA device IDs to the mpt3sas_pci_table pci table.
> * Created two separate SCSI host templates for SAS2 and SAS3 HBAs. So
>   that, during the driver load time driver can use
>   corresponding host template(based the pci device ID) while
>   registering a scsi host adapter instance for that pci device.
> * Registered two IOCTL devices, mpt2ctl is for SAS2 HBAs & mpt3ctl for
>   SAS3 HBAs. Also updated the code to make sure   that mpt2ctl device to
>   process only those ioctl cmds issued for the SAS2 HBAs and mpt3ctl
>   device to process only those ioctl cmds issued for the SAS3 HBAs.
> * Added two separate ioc number indexing for SAS2 and SAS3 HBAs.
> * Replaced compile time check 'MPT2SAS_SCSI' to run time check
>   'hba_mpi_version_belonged' wherever needed.
> * Aliased this merged driver to mpt2sas using MODULE_ALIAS.so that
>   still user can load this merged driver with 'modprobe mpt2sas'.
> * Moved global variable 'driver_name' to per adapter instance variable.
> * Created two raid function templates and used corresponding raid
>   function templates based on the run time check
>   'hba_mpi_version_belonged'.
> * Moved mpt2sas_warpdrive.c file from mpt2sas to mpt3sas folder and
>   renamed it as mpt3sas_warpdrive.c.
> * Updated the Makefile to built as a mpt3sas_warpdrive.o file.
> * Added module parameter 'hbas_to_enumarate', which user can use this
>   merged driver as legacy mpt2sas driver or as a
>   legacy mpt3sas driver if needed.
> 
> Here are the available options for this module parameter
>0 - Merged driver which enumerates both SAS 2.0 & SAS 3.0 HBAs
>1 - Acts as legacy mpt2sas driver, which enumerates only SAS 2.0 
> HBAs
>2 - Acts as legacy mpt3sas driver, which enumerates only SAS 3.0 
> HBAs
> 
> * Added SCSI_MPT3SAS_MERGED config option, This Kconfig option is only
>   used for legacy mpt2sas/mpt3sas interoperability.
> 
> In patch 5 (ie. mpt2sas: Removed .c and .h files from mpt2sas driver)
> we are just removing mpt2sas driver files. so one can just provide below
> command if this patch is not reached to linux-scsi community mail list,
> 
> "git rm drivers/scsi/mpt2sas/mpt2sas_base.*
> drivers/scsi/mpt2sas/mpt2sas_config.c
> drivers/scsi/mpt2sas/mpt2sas_ctl.*
> drivers/scsi/mpt2sas/mpt2sas_scsih.c
> drivers/scsi/mpt2sas/mpt2sas_transport.c
> drivers/scsi/mpt2sas/mpt2sas_debug.h"
> 
> Thanks,
> Sreekanth
> 
> Sreekanth Reddy (25):
>   mpt2sas: Use mpi headers from mpt3sas
>   mpt3sas: Added mpt2sas driver definitions
>   mpt3sas: Move Gen3 HBA's device registration with PCI, SML and IOCTL
> related API's to a separate file
>   mpt2sas: Created mpt2sas_module.c file in which Gen2 HBA's are
> registers with PCI, SML and IOCTLs
>   mpt2sas: Removed .c and .h files from mpt2sas driver
>   mpt3sas: Define 'hba_mpi_version_belonged' IOC variable
>   mpt2sas, mpt3sas : Removed SCSI_MPTXSAS_LOGGING entry from Kconfig
>   mpt3sas: For an IO, build MPI SGL LIST on GEN2 HBA's and build IEEE
> SGL LIST on GEN3 HBA's
>   mpt3sas: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's
>   mpt3sas: Manage MSIX vectors according to HBA device type
>   mpt3sas: fix for driver fails EEH, recovery from injected pci bus
> error
>   mpt3sas: Ported WarpDrive product SSS6200 support
>   mpt3sas: Ported the providing sysfs attribute to report Backup Rail
> Monitor Status
>   mpt3sas: Refcount sas_device objects and fix unsafe list usage
>   mpt3sas: Refcount fw_events and fix unsafe list usage
>   mpt3sas: Added OEMs Gen2 PnP ID Branding names
>   mpt3sas: setpci reset kernel oops fix
>   mpt2sas, mpt3sas: Update the driver versions
>   mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0
> HBA's
>   mpt3sas: Moved Warpdriver specific functions to mpt3sas_warpdrive.c
>   mpt2sas: Removed mpt2sas folder
>   mpt3sas: Added a module parameter hbas_to_enumerate
>   mpt2sas: Removed mpt2sas entries from SCSI's Kconfig and Makefile
>   mpt3sas: Added SCSI_MPT3SAS_MERGED config option
>   mpt3sas: Bump mpt3sas driver version to 09.102.00.00
> 
>  drivers/scsi/Kconfig |1 -
>  drivers/scsi/Makefile|1 -
>  drivers/scsi/mpt2sas/Kconfig 

RE: [PATCH RESEND 09/25] mpt3sas: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's

2015-11-11 Thread Kashyap Desai
> -Original Message-
> From: Hannes Reinecke [mailto:h...@suse.de]
> Sent: Wednesday, November 11, 2015 6:27 PM
> To: Sreekanth Reddy; j...@kernel.org
> Cc: martin.peter...@oracle.com; linux-scsi@vger.kernel.org;
> jbottom...@parallels.com; sathya.prak...@avagotech.com;
> kashyap.de...@avagotech.com; linux-ker...@vger.kernel.org;
> h...@infradead.org; chaitra.basa...@avagotech.com; suganath-
> prabu.subram...@avagotech.com
> Subject: Re: [PATCH RESEND 09/25] mpt3sas: Don't send PHYDISK_HIDDEN
> Raid Action request on SAS2 HBA's
>
> On 11/11/2015 01:00 PM, Sreekanth Reddy wrote:
> > From: Sreekanth Reddy 
> >
> > Don't send PHYDISK_HIDDEN Raid Action request for SAS2 HBA's.
> > Since these HBA's doesn't support this Raid Action.
> >
> > Also enable fast_path only for SAS3 HBA's.
> >
> > Signed-off-by: Sreekanth Reddy 
> > ---
> >  drivers/scsi/mpt3sas/mpt3sas_scsih.c | 19 +--
> >  1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> > b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> > index a638920..80469d0 100644
> > --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> > +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> > @@ -1165,8 +1165,10 @@ scsih_target_alloc(struct scsi_target *starget)
> > if (test_bit(sas_device->handle, ioc->pd_handles))
> > sas_target_priv_data->flags |=
> > MPT_TARGET_FLAGS_RAID_COMPONENT;
> > +#ifndef SCSI_MPT2SAS
> > if (sas_device->fast_path)
> > sas_target_priv_data->flags |=
> MPT_TARGET_FASTPATH_IO;
> > +#endif
> > }
> > spin_unlock_irqrestore(>sas_device_lock, flags);
> >
> > @@ -3719,11 +3721,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct
> scsi_cmnd *scmd)
> > ioc->build_zero_len_sge(ioc, _request->SGL);
> >
> > if (likely(mpi_request->Function ==
> MPI2_FUNCTION_SCSI_IO_REQUEST))
> > {
> > +#ifndef SCSI_MPT2SAS
> > if (sas_target_priv_data->flags &
> MPT_TARGET_FASTPATH_IO) {
> > mpi_request->IoFlags = cpu_to_le16(scmd-
> >cmd_len |
> > MPI25_SCSIIO_IOFLAGS_FAST_PATH);
> > mpt3sas_base_put_smid_fast_path(ioc, smid,
> handle);
> > } else
> > +#endif
> > mpt3sas_base_put_smid_scsi_io(ioc, smid, handle);
> > } else
> > mpt3sas_base_put_smid_default(ioc, smid); @@ -5031,8
> +5035,10 @@
> > _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8
> phy_num,
> > sas_device->device_info = device_info;
> > sas_device->sas_address = sas_address;
> > sas_device->phy = sas_device_pg0.PhyNum;
> > +#ifndef SCSI_MPT2SAS
> > sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) &
> > MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0;
> > +#endif
> >
> > if (sas_device_pg0.Flags &
> MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
> > sas_device->enclosure_level =
> > @@ -5731,6 +5737,7 @@ _scsih_sas_discovery_event(struct
> MPT3SAS_ADAPTER *ioc,
> > }
> >  }
> >
> > +#ifndef SCSI_MPT2SAS
> >  /**
> >   * _scsih_ir_fastpath - turn on fastpath for IR physdisk
> >   * @ioc: per adapter object
> > @@ -5750,7 +5757,6 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER
> *ioc, u16 handle, u8 phys_disk_num)
> > u16 ioc_status;
> > u32 log_info;
> >
> > -
> > mutex_lock(>scsih_cmds.mutex);
> >
> > if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) { @@ -
> 5825,6
> > +5831,8 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16
> handle, u8 phys_disk_num)
> > FORCE_BIG_HAMMER);
> > return rc;
> >  }
> > +/* End of not defined SCSI_MPT2SAS */ #endif
> >
> >  /**
> >   * _scsih_reprobe_lun - reprobing lun @@ -6017,8 +6025,10 @@
> > _scsih_sas_pd_hide(struct MPT3SAS_ADAPTER *ioc,
> > if (!sas_device)
> > return;
> >
> > +#ifndef SCSI_MPT2SAS
> > /* hiding raid component */
> > _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> > +#endif
> > if (starget)
> > starget_for_each_device(starget, (void *)1,
> _scsih_reprobe_lun);  }
> > @@ -6067,7 +6077,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER
> *ioc,
> > sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
> > spin_unlock_irqrestore(>sas_device_lock, flags);
> > if (sas_device) {
> > +#ifndef SCSI_MPT2SAS
> > _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> > +#endif
> > return;
> > }
> >
> > @@ -6091,7 +6103,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER
> *ioc,
> > mpt3sas_transport_update_links(ioc, sas_address, handle,
> > sas_device_pg0.PhyNum,
> MPI2_SAS_NEG_LINK_RATE_1_5);
> >
> > +#ifndef SCSI_MPT2SAS
> > _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> > +#endif
> > _scsih_add_device(ioc, handle, 0, 1);  }
> >
> > @@ -6202,13 +6216,14 @@ 

[PATCH RESEND 02/25] mpt3sas: Added mpt2sas driver definitions

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

1. Added mpt2sas driver related macro's in mpt3sas header files
2. Made scsi host's, raid class's, pci's, ioctl's call back functions
as a gobal API's, so that both the drivers can use these
call back functions.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |   8 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  58 -
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |  40 +++---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 230 +--
 4 files changed, 191 insertions(+), 145 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index d4f1dcd..302f02a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2855,15 +2855,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER 
*ioc,  int sleep_flag)
else
sg_tablesize = MPT3SAS_SG_DEPTH;
 
-   if (sg_tablesize < MPT3SAS_MIN_PHYS_SEGMENTS)
-   sg_tablesize = MPT3SAS_MIN_PHYS_SEGMENTS;
-   else if (sg_tablesize > MPT3SAS_MAX_PHYS_SEGMENTS) {
+   if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
+   sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
+   else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
sg_tablesize = min_t(unsigned short, sg_tablesize,
  SCSI_MAX_SG_CHAIN_SEGMENTS);
pr_warn(MPT3SAS_FMT
 "sg_tablesize(%u) is bigger than kernel"
 " defined SCSI_MAX_SG_SEGMENTS(%u)\n", ioc->name,
-sg_tablesize, MPT3SAS_MAX_PHYS_SEGMENTS);
+sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
}
ioc->shost->sg_tablesize = sg_tablesize;
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index f0e462b..699cf72 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -63,15 +63,20 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "mpt3sas_debug.h"
 #include "mpt3sas_trigger_diag.h"
 
 /* driver versioning info */
 #define MPT3SAS_DRIVER_NAME"mpt3sas"
+#define MPT2SAS_DRIVER_NAME"mpt2sas"
 #define MPT3SAS_AUTHOR "Avago Technologies "
 #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver"
+#define MPT2SAS_DESCRIPTION"LSI MPT Fusion SAS 2.0 Device Driver"
 #define MPT3SAS_DRIVER_VERSION "09.100.00.00"
+#define MPT2SAS_DRIVER_VERSION "20.101.00.00"
 #define MPT3SAS_MAJOR_VERSION  9
 #define MPT3SAS_MINOR_VERSION  100
 #define MPT3SAS_BUILD_VERSION  0
@@ -80,14 +85,20 @@
 /*
  * Set MPT3SAS_SG_DEPTH value based on user input.
  */
-#define MPT3SAS_MAX_PHYS_SEGMENTS  SCSI_MAX_SG_SEGMENTS
-#define MPT3SAS_MIN_PHYS_SEGMENTS  16
+#define MPT_MAX_PHYS_SEGMENTS  SCSI_MAX_SG_SEGMENTS
+#define MPT_MIN_PHYS_SEGMENTS  16
+
 #ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
 #define MPT3SAS_SG_DEPTH   CONFIG_SCSI_MPT3SAS_MAX_SGE
 #else
-#define MPT3SAS_SG_DEPTH   MPT3SAS_MAX_PHYS_SEGMENTS
+#define MPT3SAS_SG_DEPTH   MPT_MAX_PHYS_SEGMENTS
 #endif
 
+#ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
+#define MPT2SAS_SG_DEPTH   CONFIG_SCSI_MPT2SAS_MAX_SGE
+#else
+#define MPT2SAS_SG_DEPTH   MPT_MAX_PHYS_SEGMENTS
+#endif
 
 /*
  * Generic Defines
@@ -1095,6 +1106,39 @@ struct _sas_device 
*mpt3sas_scsih_sas_device_find_by_sas_address(
 
 void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc);
 
+void scsih_exit(void);
+int scsih_init(void);
+int scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id);
+void scsih_remove(struct pci_dev *pdev);
+void scsih_shutdown(struct pci_dev *pdev);
+pci_ers_result_t scsih_pci_error_detected(struct pci_dev *pdev,
+   pci_channel_state_t state);
+pci_ers_result_t scsih_pci_mmio_enabled(struct pci_dev *pdev);
+pci_ers_result_t scsih_pci_slot_reset(struct pci_dev *pdev);
+void scsih_pci_resume(struct pci_dev *pdev);
+int scsih_suspend(struct pci_dev *pdev, pm_message_t state);
+int scsih_resume(struct pci_dev *pdev);
+
+int scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd);
+int scsih_target_alloc(struct scsi_target *starget);
+int scsih_slave_alloc(struct scsi_device *sdev);
+int scsih_slave_configure(struct scsi_device *sdev);
+void scsih_target_destroy(struct scsi_target *starget);
+void scsih_slave_destroy(struct scsi_device *sdev);
+int scsih_scan_finished(struct Scsi_Host *shost, unsigned long time);
+void scsih_scan_start(struct Scsi_Host *shost);
+int scsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
+int scsih_abort(struct scsi_cmnd *scmd);
+int scsih_dev_reset(struct scsi_cmnd *scmd);
+int scsih_target_reset(struct scsi_cmnd *scmd);
+int scsih_host_reset(struct scsi_cmnd *scmd);
+int scsih_bios_param(struct scsi_device *sdev, struct block_device *bdev,
+   sector_t 

Re: [PATCH RESEND 09/25] mpt3sas: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's

2015-11-11 Thread Hannes Reinecke
On 11/11/2015 01:00 PM, Sreekanth Reddy wrote:
> From: Sreekanth Reddy 
> 
> Don't send PHYDISK_HIDDEN Raid Action request for SAS2 HBA's.
> Since these HBA's doesn't support this Raid Action.
> 
> Also enable fast_path only for SAS3 HBA's.
> 
> Signed-off-by: Sreekanth Reddy 
> ---
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c | 19 +--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index a638920..80469d0 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -1165,8 +1165,10 @@ scsih_target_alloc(struct scsi_target *starget)
>   if (test_bit(sas_device->handle, ioc->pd_handles))
>   sas_target_priv_data->flags |=
>   MPT_TARGET_FLAGS_RAID_COMPONENT;
> +#ifndef SCSI_MPT2SAS
>   if (sas_device->fast_path)
>   sas_target_priv_data->flags |= MPT_TARGET_FASTPATH_IO;
> +#endif
>   }
>   spin_unlock_irqrestore(>sas_device_lock, flags);
>  
> @@ -3719,11 +3721,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
> *scmd)
>   ioc->build_zero_len_sge(ioc, _request->SGL);
>  
>   if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) {
> +#ifndef SCSI_MPT2SAS
>   if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
>   mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
>   MPI25_SCSIIO_IOFLAGS_FAST_PATH);
>   mpt3sas_base_put_smid_fast_path(ioc, smid, handle);
>   } else
> +#endif
>   mpt3sas_base_put_smid_scsi_io(ioc, smid, handle);
>   } else
>   mpt3sas_base_put_smid_default(ioc, smid);
> @@ -5031,8 +5035,10 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 
> handle, u8 phy_num,
>   sas_device->device_info = device_info;
>   sas_device->sas_address = sas_address;
>   sas_device->phy = sas_device_pg0.PhyNum;
> +#ifndef SCSI_MPT2SAS
>   sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) &
>   MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0;
> +#endif
>  
>   if (sas_device_pg0.Flags & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
>   sas_device->enclosure_level =
> @@ -5731,6 +5737,7 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc,
>   }
>  }
>  
> +#ifndef SCSI_MPT2SAS
>  /**
>   * _scsih_ir_fastpath - turn on fastpath for IR physdisk
>   * @ioc: per adapter object
> @@ -5750,7 +5757,6 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 
> handle, u8 phys_disk_num)
>   u16 ioc_status;
>   u32 log_info;
>  
> -
>   mutex_lock(>scsih_cmds.mutex);
>  
>   if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
> @@ -5825,6 +5831,8 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 
> handle, u8 phys_disk_num)
>   FORCE_BIG_HAMMER);
>   return rc;
>  }
> +/* End of not defined SCSI_MPT2SAS */
> +#endif
>  
>  /**
>   * _scsih_reprobe_lun - reprobing lun
> @@ -6017,8 +6025,10 @@ _scsih_sas_pd_hide(struct MPT3SAS_ADAPTER *ioc,
>   if (!sas_device)
>   return;
>  
> +#ifndef SCSI_MPT2SAS
>   /* hiding raid component */
>   _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> +#endif
>   if (starget)
>   starget_for_each_device(starget, (void *)1, _scsih_reprobe_lun);
>  }
> @@ -6067,7 +6077,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc,
>   sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
>   spin_unlock_irqrestore(>sas_device_lock, flags);
>   if (sas_device) {
> +#ifndef SCSI_MPT2SAS
>   _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> +#endif
>   return;
>   }
>  
> @@ -6091,7 +6103,9 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc,
>   mpt3sas_transport_update_links(ioc, sas_address, handle,
>   sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
>  
> +#ifndef SCSI_MPT2SAS
>   _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum);
> +#endif
>   _scsih_add_device(ioc, handle, 0, 1);
>  }
>  
> @@ -6202,13 +6216,14 @@ _scsih_sas_ir_config_change_event(struct 
> MPT3SAS_ADAPTER *ioc,
>  
>   element = (Mpi2EventIrConfigElement_t *)_data->ConfigElement[0];
>   if (ioc->shost_recovery) {
> -
> +#ifndef SCSI_MPT2SAS
>   for (i = 0; i < event_data->NumElements; i++, element++) {
>   if (element->ReasonCode == MPI2_EVENT_IR_CHANGE_RC_HIDE)
>   _scsih_ir_fastpath(ioc,
>   le16_to_cpu(element->PhysDiskDevHandle),
>   element->PhysDiskNum);
>   }
> +#endif
>   return;
>   }
>   for (i = 0; i < event_data->NumElements; i++, element++) {

[PATCH RESEND 12/25] mpt3sas: Ported WarpDrive product SSS6200 support

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Ported below list of Warp drive specific patches
1. 'commit 0bdccdb0a090ad8dc5f851cad5e843244c410ee8
("mpt2sas: WarpDrive New product SSS6200 support added")',

2. 'commit 82a452581230b3ffc9d6475dffdb2568497b5fec
   ("mpt2sas: WarpDrive Infinite command retries due to wrong scsi command 
entry in MPI message")',

3. 'commit ba96bd0b1d4a4e11f23671e1f375a5c8f46b0fe7
   ("mpt2sas: Support for greater than 2TB capacity WarpDrive")',

4. 'commit 4da7af9494b2f98a1503a2634059300c3e4615e6
   ("mpt2sas: Do not retry a timed out direct IO for Warpdrive")',

5. 'commit daeaa9df92bd742f4e6d4d6039d689277a8e31bd
   ("mpt2sas: Avoid type casting for direct I/O commands")'.

Also set the mpt2_ioctl_iocinfo structure's adpter_type to
   MPT3_IOCTL_INTERFACE_SAS3 for Gen3 HBA's
   MPT2_IOCTL_INTERFACE_SAS2_SSS6200 for Warp Drive
   MPT2_IOCTL_INTERFACE_SAS2  for other Gen2 HBA's

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/mpt2sas_warpdrive.c | 338 +++
 drivers/scsi/mpt3sas/mpt3sas_base.c  |  68 ++-
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  39 
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |   5 +-
 drivers/scsi/mpt3sas/mpt3sas_ctl.h   |   1 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 260 
 6 files changed, 665 insertions(+), 46 deletions(-)
 create mode 100644 drivers/scsi/mpt2sas/mpt2sas_warpdrive.c

diff --git a/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c 
b/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c
new file mode 100644
index 000..c4fcbc2
--- /dev/null
+++ b/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c
@@ -0,0 +1,338 @@
+/*
+ * Scsi Host Layer for MPT (Message Passing Technology) based controllers
+ *
+ * Copyright (C) 2012-2014  LSI Corporation
+ * Copyright (C) 2013-2015 Avago Technologies
+ *  (mailto: mpt-fusionlinux@avagotech.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
+ */
+
+/**
+ * _scsih_disable_ddio - Disable direct I/O for all the volumes
+ * @ioc: per adapter object
+ */
+static void
+_scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc)
+{
+   Mpi2RaidVolPage1_t vol_pg1;
+   Mpi2ConfigReply_t mpi_reply;
+   struct _raid_device *raid_device;
+   u16 handle;
+   u16 ioc_status;
+   unsigned long flags;
+
+   handle = 0x;
+   while (!(mpt3sas_config_get_raid_volume_pg1(ioc, _reply,
+   _pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
+   ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+   MPI2_IOCSTATUS_MASK;
+   if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
+   break;
+   handle = le16_to_cpu(vol_pg1.DevHandle);
+   spin_lock_irqsave(>raid_device_lock, flags);
+   raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
+   if (raid_device)
+   raid_device->direct_io_enabled = 0;
+   spin_unlock_irqrestore(>raid_device_lock, flags);
+   }
+   return;
+}
+
+
+/**
+ * _scsih_get_num_volumes - Get number of volumes in the ioc
+ * @ioc: per adapter object
+ */
+static u8

[PATCH RESEND 06/25] mpt3sas: Define 'hba_mpi_version_belonged' IOC variable

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

1. Use 'hba_mpi_version_belonged' IOC varable to uniquely
identify each individual generation driver functionality at
runtime.

2. Declared global variable 'driver_name' and used
this variable while reserving PCI regions and while
allocating the IRQ's.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/mpt2sas_module.c |  1 +
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  8 +++
 drivers/scsi/mpt3sas/mpt3sas_base.h   |  3 +++
 drivers/scsi/mpt3sas/mpt3sas_ctl.c| 18 +---
 drivers/scsi/mpt3sas/mpt3sas_module.c |  1 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  | 39 ++-
 6 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_module.c 
b/drivers/scsi/mpt2sas/mpt2sas_module.c
index 2b70693..d407ed0 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_module.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_module.c
@@ -196,6 +196,7 @@ _mpt2sas_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
if (!shost)
return -ENODEV;
 
+   sprintf(driver_name, "%s", MPT2SAS_DRIVER_NAME);
rv = scsih_probe(pdev, shost);
return rv;
 }
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 302f02a..8a7f93e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1643,10 +1643,10 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 
index, u32 vector)
atomic_set(_q->busy, 0);
if (ioc->msix_enable)
snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
-   MPT3SAS_DRIVER_NAME, ioc->id, index);
+   driver_name, ioc->id, index);
else
snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d",
-   MPT3SAS_DRIVER_NAME, ioc->id);
+   driver_name, ioc->id);
r = request_irq(vector, _base_interrupt, IRQF_SHARED, reply_q->name,
reply_q);
if (r) {
@@ -1872,7 +1872,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
 
 
if (pci_request_selected_regions(pdev, ioc->bars,
-   MPT3SAS_DRIVER_NAME)) {
+   driver_name)) {
pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n",
ioc->name);
ioc->bars = 0;
@@ -4021,7 +4021,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int 
sleep_flag)
mpi_request.WhoInit = MPI2_WHOINIT_HOST_DRIVER;
mpi_request.VF_ID = 0; /* TODO */
mpi_request.VP_ID = 0;
-   mpi_request.MsgVersion = cpu_to_le16(MPI25_VERSION);
+   mpi_request.MsgVersion = cpu_to_le16(ioc->hba_mpi_version_belonged);
mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION);
 
if (_base_is_controller_msix_enabled(ioc))
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 0f86729..4c9a154 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -870,6 +870,7 @@ struct MPT3SAS_ADAPTER {
MPT_BUILD_SGbuild_sg;
MPT_BUILD_ZERO_LEN_SGE build_zero_len_sge;
u16 sge_size_ieee;
+   u16 hba_mpi_version_belonged;
 
/* function ptr for MPI sg elements only */
MPT_BUILD_SGbuild_sg_mpi;
@@ -1023,6 +1024,8 @@ typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, 
u16 smid, u8 msix_index,
 
 /* base shared API */
 extern struct list_head mpt3sas_ioc_list;
+extern chardriver_name[MPT_NAME_LENGTH];
+
 void mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc);
 void mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc);
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index ffe7982..8b46cbf 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -1023,7 +1023,6 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user 
*arg)
__func__));
 
memset(, 0 , sizeof(karg));
-   karg.adapter_type = MPT3_IOCTL_INTERFACE_SAS3;
if (ioc->pfacts)
karg.port_number = ioc->pfacts[0].PortNumber;
karg.hw_rev = ioc->pdev->revision;
@@ -1035,9 +1034,22 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user 
*arg)
karg.pci_information.u.bits.function = PCI_FUNC(ioc->pdev->devfn);
karg.pci_information.segment_id = pci_domain_nr(ioc->pdev->bus);
karg.firmware_version = ioc->facts.FWVersion.Word;
-   strcpy(karg.driver_version, MPT3SAS_DRIVER_NAME);
+   strcpy(karg.driver_version, driver_name);
strcat(karg.driver_version, "-");
-   strcat(karg.driver_version, MPT3SAS_DRIVER_VERSION);
+   switch  (ioc->hba_mpi_version_belonged) {
+   case MPI2_VERSION:
+   karg.adapter_type = MPT2_IOCTL_INTERFACE_SAS2;
+   strcat(karg.driver_version, MPT2SAS_DRIVER_VERSION);
+

[PATCH RESEND 13/25] mpt3sas: Ported the providing sysfs attribute to report Backup Rail Monitor Status

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

A new sysfs shost attribute called "BMR_status" is implemented to
report Backup Rail Monitor status.

This attribute is located in the path
/sys/class/scsi_host/host#/BMR_status

when reading this adapter attribute, then driver will output the state
of GPIO[24]. It returns "0" if BMR is healthy and it returns "1" for
failure.

if it returns an empty string then it means that there was an error while
obtaining the BMR status. Then check dmesg for what error has occurred.

This sysfs shost attribute is mainly for WarpDrive controllers.

This changes are ported form below mpt2sas driver patch

'commit 6c265660c26267754a02063642ae042d469b4ef9
("mpt2sas: Provide sysfs attribute to report Backup Rail Monitor Status")

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h   |  4 ++
 drivers/scsi/mpt3sas/mpt3sas_config.c | 38 ++
 drivers/scsi/mpt3sas/mpt3sas_ctl.c| 74 +++
 3 files changed, 116 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 397f8a5..3b4aaa1 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1224,6 +1224,10 @@ int mpt3sas_config_get_sas_iounit_pg0(struct 
MPT3SAS_ADAPTER *ioc,
u16 sz);
 int mpt3sas_config_get_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, 
Mpi2ConfigReply_t
*mpi_reply, Mpi2IOUnitPage1_t *config_page);
+#ifdef SCSI_MPT2SAS
+int mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc,
+   Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz);
+#endif
 int mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, 
Mpi2ConfigReply_t
*mpi_reply, Mpi2IOUnitPage1_t *config_page);
 int mpt3sas_config_get_iounit_pg8(struct MPT3SAS_ADAPTER *ioc, 
Mpi2ConfigReply_t
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c 
b/drivers/scsi/mpt3sas/mpt3sas_config.c
index 53eb701..2bbb034 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -865,6 +865,44 @@ mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc,
return r;
 }
 
+#ifdef SCSI_MPT2SAS
+/**
+ * mpt3sas_config_get_iounit_pg3 - obtain iounit page 3
+ * @ioc: per adapter object
+ * @mpi_reply: reply mf payload returned from firmware
+ * @config_page: contents of the config page
+ * @sz: size of buffer passed in config_page
+ * Context: sleep.
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+int
+mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc,
+   Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz)
+{
+   Mpi2ConfigRequest_t mpi_request;
+   int r;
+
+   memset(_request, 0, sizeof(Mpi2ConfigRequest_t));
+   mpi_request.Function = MPI2_FUNCTION_CONFIG;
+   mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
+   mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_IO_UNIT;
+   mpi_request.Header.PageNumber = 3;
+   mpi_request.Header.PageVersion = MPI2_IOUNITPAGE3_PAGEVERSION;
+   ioc->build_zero_len_sge_mpi(ioc, _request.PageBufferSGE);
+   r = _config_request(ioc, _request, mpi_reply,
+   MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
+   if (r)
+   goto out;
+
+   mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT;
+   r = _config_request(ioc, _request, mpi_reply,
+   MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page, sz);
+ out:
+   return r;
+}
+#endif
+
 /**
  * mpt3sas_config_get_iounit_pg8 - obtain iounit page 8
  * @ioc: per adapter object
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 3f22754..1c62db8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -2720,6 +2720,77 @@ _ctl_ioc_reply_queue_count_show(struct device *cdev,
 static DEVICE_ATTR(reply_queue_count, S_IRUGO, _ctl_ioc_reply_queue_count_show,
NULL);
 
+#ifdef SCSI_MPT2SAS
+/**
+ * _ctl_BRM_status_show - Backup Rail Monitor Status
+ * @cdev - pointer to embedded class device
+ * @buf - the buffer returned
+ *
+ * This is number of reply queues
+ *
+ * A sysfs 'read-only' shost attribute.
+ */
+static ssize_t
+_ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr,
+   char *buf)
+{
+   struct Scsi_Host *shost = class_to_shost(cdev);
+   struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
+   Mpi2IOUnitPage3_t *io_unit_pg3 = NULL;
+   Mpi2ConfigReply_t mpi_reply;
+   u16 backup_rail_monitor_status = 0;
+   u16 ioc_status;
+   int sz;
+   ssize_t rc = 0;
+
+   if (!ioc->is_warpdrive) {
+   pr_err(MPT3SAS_FMT "%s: BRM attribute is only for"
+   " warpdrive\n", ioc->name, __func__);
+   goto out;
+   }
+
+   /* allocate upto GPIOVal 36 entries */
+   sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + 

[PATCH RESEND 08/25] mpt3sas: For an IO, build MPI SGL LIST on GEN2 HBA's and build IEEE SGL LIST on GEN3 HBA's

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Gen2 HBA's uses MPI Scatter Gather Lists where as Gen3 HBA's uses
IEEE Scatter Gather Lists. So modify the common code part in such
a way that it will build IEEE SGL table for Gen3 HBA's and it will
build MPI SGL table for Gen2 HBA's.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 181 +---
 1 file changed, 168 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 31d0ca8..62dc312 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1318,6 +1318,149 @@ _base_build_zero_len_sge_ieee(struct MPT3SAS_ADAPTER 
*ioc, void *paddr)
 }
 
 /**
+ * _base_build_sg_scmd - main sg creation routine
+ * @ioc: per adapter object
+ * @scmd: scsi command
+ * @smid: system request message index
+ * Context: none.
+ *
+ * The main routine that builds scatter gather table from a given
+ * scsi request sent via the .queuecommand main handler.
+ *
+ * Returns 0 success, anything else error
+ */
+static int
+_base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc,
+   struct scsi_cmnd *scmd, u16 smid)
+{
+   Mpi2SCSIIORequest_t *mpi_request;
+   dma_addr_t chain_dma;
+   struct scatterlist *sg_scmd;
+   void *sg_local, *chain;
+   u32 chain_offset;
+   u32 chain_length;
+   u32 chain_flags;
+   int sges_left;
+   u32 sges_in_segment;
+   u32 sgl_flags;
+   u32 sgl_flags_last_element;
+   u32 sgl_flags_end_buffer;
+   struct chain_tracker *chain_req;
+
+   mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+
+   /* init scatter gather flags */
+   sgl_flags = MPI2_SGE_FLAGS_SIMPLE_ELEMENT;
+   if (scmd->sc_data_direction == DMA_TO_DEVICE)
+   sgl_flags |= MPI2_SGE_FLAGS_HOST_TO_IOC;
+   sgl_flags_last_element = (sgl_flags | MPI2_SGE_FLAGS_LAST_ELEMENT)
+   << MPI2_SGE_FLAGS_SHIFT;
+   sgl_flags_end_buffer = (sgl_flags | MPI2_SGE_FLAGS_LAST_ELEMENT |
+   MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_END_OF_LIST)
+   << MPI2_SGE_FLAGS_SHIFT;
+   sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT;
+
+   sg_scmd = scsi_sglist(scmd);
+   sges_left = scsi_dma_map(scmd);
+   if (sges_left < 0) {
+   sdev_printk(KERN_ERR, scmd->device,
+"pci_map_sg failed: request for %d bytes!\n",
+scsi_bufflen(scmd));
+   return -ENOMEM;
+   }
+
+   sg_local = _request->SGL;
+   sges_in_segment = ioc->max_sges_in_main_message;
+   if (sges_left <= sges_in_segment)
+   goto fill_in_last_segment;
+
+   mpi_request->ChainOffset = (offsetof(Mpi2SCSIIORequest_t, SGL) +
+   (sges_in_segment * ioc->sge_size))/4;
+
+   /* fill in main message segment when there is a chain following */
+   while (sges_in_segment) {
+   if (sges_in_segment == 1)
+   ioc->base_add_sg_single(sg_local,
+   sgl_flags_last_element | sg_dma_len(sg_scmd),
+   sg_dma_address(sg_scmd));
+   else
+   ioc->base_add_sg_single(sg_local, sgl_flags |
+   sg_dma_len(sg_scmd), sg_dma_address(sg_scmd));
+   sg_scmd = sg_next(sg_scmd);
+   sg_local += ioc->sge_size;
+   sges_left--;
+   sges_in_segment--;
+   }
+
+   /* initializing the chain flags and pointers */
+   chain_flags = MPI2_SGE_FLAGS_CHAIN_ELEMENT << MPI2_SGE_FLAGS_SHIFT;
+   chain_req = _base_get_chain_buffer_tracker(ioc, smid);
+   if (!chain_req)
+   return -1;
+   chain = chain_req->chain_buffer;
+   chain_dma = chain_req->chain_buffer_dma;
+   do {
+   sges_in_segment = (sges_left <=
+   ioc->max_sges_in_chain_message) ? sges_left :
+   ioc->max_sges_in_chain_message;
+   chain_offset = (sges_left == sges_in_segment) ?
+   0 : (sges_in_segment * ioc->sge_size)/4;
+   chain_length = sges_in_segment * ioc->sge_size;
+   if (chain_offset) {
+   chain_offset = chain_offset <<
+   MPI2_SGE_CHAIN_OFFSET_SHIFT;
+   chain_length += ioc->sge_size;
+   }
+   ioc->base_add_sg_single(sg_local, chain_flags | chain_offset |
+   chain_length, chain_dma);
+   sg_local = chain;
+   if (!chain_offset)
+   goto fill_in_last_segment;
+
+   /* fill in chain segments */
+   while (sges_in_segment) {
+   if (sges_in_segment == 1)
+   ioc->base_add_sg_single(sg_local,
+   sgl_flags_last_element |
+ 

Re: [PATCH 4.1] target-core: fix return without a value

2015-11-11 Thread Mikulas Patocka


On Tue, 10 Nov 2015, Greg Kroah-Hartman wrote:

> On Tue, Nov 10, 2015 at 06:31:47PM -0500, Mikulas Patocka wrote:
> > 
> > 
> > On Tue, 10 Nov 2015, Greg Kroah-Hartman wrote:
> > 
> > > On Tue, Nov 10, 2015 at 01:32:10PM -0500, Mikulas Patocka wrote:
> > > > Fix the warning drivers/target/target_core_pr.c:332:3: warning: 'return'
> > > > with no value, in function returning non-void [-Wreturn-type]
> > > > 
> > > > The patch 35afa65642a9a88c81913377b93a3a66220f8b9d committed to 4.1.11
> > > > adds a check if device_list is NULL. The patch adds a return statement
> > > > without a value to the function core_scsi3_pr_seq_non_holder that 
> > > > returns
> > > > int.
> > > > 
> > > > Signed-off-by: Mikulas Patocka 
> > > > 
> > > > ---
> > > >  drivers/target/target_core_pr.c |2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > 
> > > 
> > > This is not the correct way to submit patches for inclusion in the
> > > stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
> > > for how to do this properly.
> > > 
> > > 
> > 
> > This patch has no upstream equivalent (because the code in upstream was 
> > already refactored), so none of the rules in stable_kernel_rules.txt apply 
> > to it. The patch that broke it also has no upstream equivalent.
> >
> 
> Then you need to say that!
> 
> And the fact that a "please take this patch, it's correct but doesn't
> apply to upstream" patch is now broken is proof of why I didn't want to
> take it in the first place!
> 
> Ugh.  How about I just revert the original patch and then you send me
> backports of what is actually in Linus's tree so we don't have this
> problem anymore?

The original patch that caused this compilation warning fixes some 
crashes, so you should not revert it. You can work with subsystem 
maintainers on backporting the refactored code from upstream to 4.1 - I 
don't know how hard or possible it is.

Mikulas

> Oh, and you got the stable mailing list address wrong as well :(
> 
> Please fix all of this up and resend.
> 
> thanks,
> 
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 15/25] mpt3sas: Refcount fw_events and fix unsafe list usage

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

The fw_event_work struct is concurrently referenced at shutdown, so
add a refcount to protect it, and refactor the code to use it.

Additionally, refactor _scsih_fw_event_cleanup_queue() such that it
no longer iterates over the list without holding the lock, since
_firmware_event_work() concurrently deletes items from the list.

This patch is ported from below mpt2sas driver patch, these changes
also required for mpt3sas driver and we tested this on mpt3sas driver
also,

'commit 008549f6e8a1dc4aeea4a8d64184909786b27713
("mpt2sas: Refcount fw_events and fix unsafe list usage")'

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 116 ---
 1 file changed, 94 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5dbf214..436e65e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -200,9 +200,37 @@ struct fw_event_work {
u8  VP_ID;
u8  ignore;
u16 event;
+   struct kref refcount;
charevent_data[0] __aligned(4);
 };
 
+static void fw_event_work_free(struct kref *r)
+{
+   kfree(container_of(r, struct fw_event_work, refcount));
+}
+
+static void fw_event_work_get(struct fw_event_work *fw_work)
+{
+   kref_get(_work->refcount);
+}
+
+static void fw_event_work_put(struct fw_event_work *fw_work)
+{
+   kref_put(_work->refcount, fw_event_work_free);
+}
+
+static struct fw_event_work *alloc_fw_event_work(int len)
+{
+   struct fw_event_work *fw_event;
+
+   fw_event = kzalloc(sizeof(*fw_event) + len, GFP_ATOMIC);
+   if (!fw_event)
+   return NULL;
+
+   kref_init(_event->refcount);
+   return fw_event;
+}
+
 /**
  * struct _scsi_io_transfer - scsi io transfer
  * @handle: sas device handle (assigned by firmware)
@@ -2598,32 +2626,36 @@ _scsih_fw_event_add(struct MPT3SAS_ADAPTER *ioc, struct 
fw_event_work *fw_event)
return;
 
spin_lock_irqsave(>fw_event_lock, flags);
+   fw_event_work_get(fw_event);
INIT_LIST_HEAD(_event->list);
list_add_tail(_event->list, >fw_event_list);
INIT_WORK(_event->work, _firmware_event_work);
+   fw_event_work_get(fw_event);
queue_work(ioc->firmware_event_thread, _event->work);
spin_unlock_irqrestore(>fw_event_lock, flags);
 }
 
 /**
- * _scsih_fw_event_free - delete fw_event
+ * _scsih_fw_event_del_from_list - delete fw_event from the list
  * @ioc: per adapter object
  * @fw_event: object describing the event
  * Context: This function will acquire ioc->fw_event_lock.
  *
- * This removes firmware event object from link list, frees associated memory.
+ * If the fw_event is on the fw_event_list, remove it and do a put.
  *
  * Return nothing.
  */
 static void
-_scsih_fw_event_free(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work
+_scsih_fw_event_del_from_list(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work
*fw_event)
 {
unsigned long flags;
 
spin_lock_irqsave(>fw_event_lock, flags);
-   list_del(_event->list);
-   kfree(fw_event);
+   if (!list_empty(_event->list)) {
+   list_del_init(_event->list);
+   fw_event_work_put(fw_event);
+   }
spin_unlock_irqrestore(>fw_event_lock, flags);
 }
 
@@ -2640,17 +2672,19 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER 
*ioc,
struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
 {
struct fw_event_work *fw_event;
+   u16 sz;
 
if (ioc->is_driver_loading)
return;
-   fw_event = kzalloc(sizeof(*fw_event) + sizeof(*event_data),
-  GFP_ATOMIC);
+   sz = sizeof(*event_data);
+   fw_event = alloc_fw_event_work(sz);
if (!fw_event)
return;
fw_event->event = MPT3SAS_PROCESS_TRIGGER_DIAG;
fw_event->ioc = ioc;
memcpy(fw_event->event_data, event_data, sizeof(*event_data));
_scsih_fw_event_add(ioc, fw_event);
+   fw_event_work_put(fw_event);
 }
 
 /**
@@ -2666,12 +2700,13 @@ _scsih_error_recovery_delete_devices(struct 
MPT3SAS_ADAPTER *ioc)
 
if (ioc->is_driver_loading)
return;
-   fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC);
+   fw_event = alloc_fw_event_work(0);
if (!fw_event)
return;
fw_event->event = MPT3SAS_REMOVE_UNRESPONDING_DEVICES;
fw_event->ioc = ioc;
_scsih_fw_event_add(ioc, fw_event);
+   fw_event_work_put(fw_event);
 }
 
 /**
@@ -2685,12 +2720,29 @@ mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER 
*ioc)
 {
struct fw_event_work *fw_event;
 
-   fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC);
+   fw_event = 

[PATCH RESEND 11/25] mpt3sas: fix for driver fails EEH, recovery from injected pci bus error

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

This patch stops the driver to invoke kthread (which remove the dead ioc)
for some time while EEH recovery has started.

This changes are ported from below mpt2sas driver patch
'commit b4730fb6e54a634a145c9c71c5cf856f00beb5cd
("mpt2sas: fix for driver fails EEH, recovery from injected pci bus error")'

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 19 ++-
 drivers/scsi/mpt3sas/mpt3sas_base.h |  1 +
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 2b33e48..b5b1eb2 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -157,7 +157,7 @@ _base_fault_reset_work(struct work_struct *work)
 
 
spin_lock_irqsave(>ioc_reset_in_progress_lock, flags);
-   if (ioc->shost_recovery)
+   if (ioc->shost_recovery || ioc->pci_error_recovery)
goto rearm_timer;
spin_unlock_irqrestore(>ioc_reset_in_progress_lock, flags);
 
@@ -166,6 +166,20 @@ _base_fault_reset_work(struct work_struct *work)
pr_err(MPT3SAS_FMT "SAS host is non-operational \n",
ioc->name);
 
+   /* It may be possible that EEH recovery can resolve some of
+* pci bus failure issues rather removing the dead ioc function
+* by considering controller is in a non-operational state. So
+* here priority is given to the EEH recovery. If it doesn't
+* not resolve this issue, mpt3sas driver will consider this
+* controller to non-operational state and remove the dead ioc
+* function.
+*/
+   if (ioc->non_operational_loop++ < 5) {
+   spin_lock_irqsave(>ioc_reset_in_progress_lock,
+flags);
+   goto rearm_timer;
+   }
+
/*
 * Call _scsih_flush_pending_cmds callback so that we flush all
 * pending commands back to OS. This call is required to aovid
@@ -193,6 +207,8 @@ _base_fault_reset_work(struct work_struct *work)
return; /* don't rearm timer */
}
 
+   ioc->non_operational_loop = 0;
+
if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) {
rc = mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP,
FORCE_BIG_HAMMER);
@@ -5162,6 +5178,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
if (r)
goto out_free_resources;
 
+   ioc->non_operational_loop = 0;
return 0;
 
  out_free_resources:
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 08f46a7..a0d1f13 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -845,6 +845,7 @@ struct MPT3SAS_ADAPTER {
u16 cpu_msix_table_sz;
u32 ioc_reset_count;
MPT3SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds;
+   u32 non_operational_loop;
 
/* internal commands, callback index */
u8  scsi_io_cb_idx;
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 14/25] mpt3sas: Refcount sas_device objects and fix unsafe list usage

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

These objects can be referenced concurrently throughout the driver, we
need a way to make sure threads can't delete them out from under each
other. This patch adds the refcount, and refactors the code to use it.

Additionally, we cannot iterate over the sas_device_list without
holding the lock, or we risk corrupting random memory if items are
added or deleted as we iterate. This patch refactors _scsih_probe_sas()
to use the sas_device_list in a safe way.

Ported this changes form below mpt2sas driver patch, as these changes
also required for mpt3sas driver and we have tested this chnages on
mpt3sas driver also.

'commit d224fe0d609734888af63656ddaf3a8352f0a7b5
("mpt2sas: Refcount sas_device objects and fix unsafe list usage")'

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  24 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 480 +--
 drivers/scsi/mpt3sas/mpt3sas_transport.c |  18 +-
 3 files changed, 365 insertions(+), 157 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 3b4aaa1..b61a785 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -273,6 +273,7 @@ struct Mpi2ManufacturingPage11_t {
  * @flags: MPT_TARGET_FLAGS_XXX flags
  * @deleted: target flaged for deletion
  * @tm_busy: target is busy with TM request.
+ * @sdev: The sas_device associated with this target
  */
 struct MPT3SAS_TARGET {
struct scsi_target *starget;
@@ -283,6 +284,7 @@ struct MPT3SAS_TARGET {
u32 flags;
u8  deleted;
u8  tm_busy;
+   struct _sas_device *sdev;
 };
 
 
@@ -389,8 +391,24 @@ struct _sas_device {
u8  pend_sas_rphy_add;
u8  enclosure_level;
u8  connector_name[4];
+   struct kref refcount;
 };
 
+static inline void sas_device_get(struct _sas_device *s)
+{
+   kref_get(>refcount);
+}
+
+static inline void sas_device_free(struct kref *r)
+{
+   kfree(container_of(r, struct _sas_device, refcount));
+}
+
+static inline void sas_device_put(struct _sas_device *s)
+{
+   kref_put(>refcount, sas_device_free);
+}
+
 /**
  * struct _raid_device - raid volume link list
  * @list: sas device list
@@ -1148,8 +1166,10 @@ struct _sas_node *mpt3sas_scsih_expander_find_by_handle(
struct MPT3SAS_ADAPTER *ioc, u16 handle);
 struct _sas_node *mpt3sas_scsih_expander_find_by_sas_address(
struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
-struct _sas_device *mpt3sas_scsih_sas_device_find_by_sas_address(
-   struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
+struct _sas_device *mpt3sas_get_sdev_by_addr(
+struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
+struct _sas_device *__mpt3sas_get_sdev_by_addr(
+struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
 
 void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc);
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index dc6b0ba..5dbf214 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -502,8 +502,61 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc,
}
 }
 
+static struct _sas_device *
+__mpt3sas_get_sdev_from_target(struct MPT3SAS_ADAPTER *ioc,
+   struct MPT3SAS_TARGET *tgt_priv)
+{
+   struct _sas_device *ret;
+
+   assert_spin_locked(>sas_device_lock);
+
+   ret = tgt_priv->sdev;
+   if (ret)
+   sas_device_get(ret);
+
+   return ret;
+}
+
+static struct _sas_device *
+mpt3sas_get_sdev_from_target(struct MPT3SAS_ADAPTER *ioc,
+   struct MPT3SAS_TARGET *tgt_priv)
+{
+   struct _sas_device *ret;
+   unsigned long flags;
+
+   spin_lock_irqsave(>sas_device_lock, flags);
+   ret = __mpt3sas_get_sdev_from_target(ioc, tgt_priv);
+   spin_unlock_irqrestore(>sas_device_lock, flags);
+
+   return ret;
+}
+
+
+struct _sas_device *
+__mpt3sas_get_sdev_by_addr(struct MPT3SAS_ADAPTER *ioc,
+   u64 sas_address)
+{
+   struct _sas_device *sas_device;
+
+   assert_spin_locked(>sas_device_lock);
+
+   list_for_each_entry(sas_device, >sas_device_list, list)
+   if (sas_device->sas_address == sas_address)
+   goto found_device;
+
+   list_for_each_entry(sas_device, >sas_device_init_list, list)
+   if (sas_device->sas_address == sas_address)
+   goto found_device;
+
+   return NULL;
+
+found_device:
+   sas_device_get(sas_device);
+   return sas_device;
+}
+
 /**
- * mpt3sas_scsih_sas_device_find_by_sas_address - sas device search
+ * mpt3sas_get_sdev_by_addr - sas device search
  * @ioc: per adapter object
  * @sas_address: sas address
  * Context: Calling function should acquire ioc->sas_device_lock
@@ -512,24 +565,44 @@ 

[PATCH RESEND 07/25] mpt2sas, mpt3sas : Removed SCSI_MPTXSAS_LOGGING entry from Kconfig

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Currently there is a logging level option provided for user for each of our
drivers in the kernel configuration utility. They can enable this option to
get more verbose information. By default this is enabled.

When this option is enabled then those functions which displays the
required information will also get compiled otherwise these functions
won't be included in the compilation code and so won't get compiled.

Now as we are merging the both the driver code, so now we can't
provide these option to the user. So removing SCSI_MPTXSAS_LOGGING
entry from Kconfig files and completely enable this logging option
(by removing the #ifdef CONFIG_SCSI_MPT3SAS_LOGGING preprocessor
check conditions), so that all the functions which are defined to
display more verbos will also get compiled.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/Kconfig  |  6 --
 drivers/scsi/mpt3sas/Kconfig  |  6 --
 drivers/scsi/mpt3sas/mpt3sas_base.c   | 10 -
 drivers/scsi/mpt3sas/mpt3sas_config.c |  6 --
 drivers/scsi/mpt3sas/mpt3sas_ctl.c| 10 +
 drivers/scsi/mpt3sas/mpt3sas_debug.h  | 16 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  | 39 ---
 7 files changed, 10 insertions(+), 83 deletions(-)

diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig
index 657b45c..1356a0a 100644
--- a/drivers/scsi/mpt2sas/Kconfig
+++ b/drivers/scsi/mpt2sas/Kconfig
@@ -59,9 +59,3 @@ config SCSI_MPT2SAS_MAX_SGE
SAFE_PHYS_SEGMENTS.  However, it may decreased down to 16.
Decreasing this parameter will reduce memory requirements
on a per controller instance.
-
-config SCSI_MPT2SAS_LOGGING
-   bool "LSI MPT Fusion logging facility"
-   depends on PCI && SCSI && SCSI_MPT2SAS
-   ---help---
-   This turns on a logging facility.
diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
index 4d235dd..18b64bc 100644
--- a/drivers/scsi/mpt3sas/Kconfig
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -59,9 +59,3 @@ config SCSI_MPT3SAS_MAX_SGE
MAX_PHYS_SEGMENTS in most kernels.  However in SuSE kernels this
can be 256. However, it may decreased down to 16.  Decreasing this
parameter will reduce memory requirements on a per controller instance.
-
-config SCSI_MPT3SAS_LOGGING
-   bool "LSI MPT Fusion logging facility"
-   depends on PCI && SCSI && SCSI_MPT3SAS
-   ---help---
-   This turns on a logging facility.
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 8a7f93e..31d0ca8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -324,7 +324,6 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc)
panic("panic in %s\n", __func__);
 }
 
-#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
 /**
  * _base_sas_ioc_info - verbose translation of the ioc status
  * @ioc: per adapter object
@@ -630,7 +629,6 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
 
pr_info(MPT3SAS_FMT "%s\n", ioc->name, desc);
 }
-#endif
 
 /**
  * _base_sas_log_info - verbose translation of firmware log info
@@ -710,13 +708,13 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 
smid, u8 msix_index,
return;
}
ioc_status = le16_to_cpu(mpi_reply->IOCStatus);
-#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+
if ((ioc_status & MPI2_IOCSTATUS_MASK) &&
(ioc->logging_level & MPT_DEBUG_REPLY)) {
_base_sas_ioc_info(ioc , mpi_reply,
   mpt3sas_base_get_msg_frame(ioc, smid));
}
-#endif
+
if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
loginfo = le32_to_cpu(mpi_reply->IOCLogInfo);
_base_sas_log_info(ioc, loginfo);
@@ -783,9 +781,9 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 
msix_index, u32 reply)
return 1;
if (mpi_reply->Function != MPI2_FUNCTION_EVENT_NOTIFICATION)
return 1;
-#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+
_base_display_event_data(ioc, mpi_reply);
-#endif
+
if (!(mpi_reply->AckRequired & MPI2_EVENT_NOTIFICATION_ACK_REQUIRED))
goto out;
smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c 
b/drivers/scsi/mpt3sas/mpt3sas_config.c
index e45c461..53eb701 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -83,7 +83,6 @@ struct config_request {
dma_addr_t  page_dma;
 };
 
-#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
 /**
  * _config_display_some_debug - debug routine
  * @ioc: per adapter object
@@ -173,7 +172,6 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 
smid,
ioc->name, le16_to_cpu(mpi_reply->IOCStatus),

[PATCH RESEND 10/25] mpt3sas: Manage MSIX vectors according to HBA device type

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

1. Don't enable MSI-X vector for SAS2008 B0 controller,
2. Enable only single MSI-X vectors for below HBA's
   a. SAS2004
   b. SAS2008
   c. SAS2008_1
   d. SAS2008_2
   e. SAS2008_3
   f. SAS2116_1
   g. SAS2116_2
3. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector)
   for only Gen3 Invader/Fury C0 and above revision HBA's
4. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector)
   for all Intruder and Cutlass HBA's

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 39 +++-
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  3 +++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  7 +++
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 62dc312..2b33e48 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1712,6 +1712,14 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
int base;
u16 message_control;
 
+   /* Check whether controller SAS2008 B0 controller,
+* if it is SAS2008 B0 controller use IO-APIC instead of MSIX
+*/
+   if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 &&
+   ioc->pdev->revision == SAS2_PCI_DEVICE_B0_REVISION) {
+   return -EINVAL;
+   }
+
base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
if (!base) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n",
@@ -1720,9 +1728,19 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
}
 
/* get msix vector count */
-
-   pci_read_config_word(ioc->pdev, base + 2, _control);
-   ioc->msix_vector_count = (message_control & 0x3FF) + 1;
+   /* NUMA_IO not supported for older controllers */
+   if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2004 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_1 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_2 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_3 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_1 ||
+   ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_2)
+   ioc->msix_vector_count = 1;
+   else {
+   pci_read_config_word(ioc->pdev, base + 2, _control);
+   ioc->msix_vector_count = (message_control & 0x3FF) + 1;
+   }
dinitprintk(ioc, pr_info(MPT3SAS_FMT
"msix is supported, vector_count(%d)\n",
ioc->name, ioc->msix_vector_count));
@@ -4979,7 +4997,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 {
int r, i;
int cpu_id, last_cpu_id = 0;
-   u8 revision;
 
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
__func__));
@@ -4999,20 +5016,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
goto out_free_resources;
}
 
-   /* Check whether the controller revision is C0 or above.
-* only C0 and above revision controllers support 96 MSI-X vectors.
-*/
-   revision = ioc->pdev->revision;
-
-   if ((ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3004 ||
-ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3008 ||
-ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_1 ||
-ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_2 ||
-ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_5 ||
-ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_6) &&
-(revision >= 0x02))
-   ioc->msix96_vector = 1;
-
ioc->rdpq_array_enable_assigned = 0;
ioc->dma_mask = 0;
r = mpt3sas_base_map_resources(ioc);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 4c9a154..08f46a7 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -142,6 +142,9 @@
 #define MPT_TARGET_FLAGS_DELETED   0x04
 #define MPT_TARGET_FASTPATH_IO 0x08
 
+#define SAS2_PCI_DEVICE_B0_REVISION(0x01)
+#define SAS3_PCI_DEVICE_C0_REVISION(0x02)
+
 /*
  * Intel HBA branding
  */
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 80469d0..2b51a41 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7938,6 +7938,13 @@ _scsih_determine_hba_mpi_version(struct MPT3SAS_ADAPTER 
*ioc) {
case MPI25_MFGPAGE_DEVID_SAS3108_5:
case MPI25_MFGPAGE_DEVID_SAS3108_6:
ioc->hba_mpi_version_belonged = MPI25_VERSION;
+
+   /* Check whether the controller revision is C0 or above.
+* only C0 and above revision controllers support 96 MSI-X
+* vectors.
+*/
+   if 

[PATCH RESEND 17/25] mpt3sas: setpci reset kernel oops fix

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

setpci reset on nytro warpdrive card along with sysfs access and
cli ioctl access resulted in kernel oops

1. pci_access_mutex lock added to provide synchronization between IOCTL,
   sysfs, PCI resource handling path

2. gioc_lock spinlock to protect list operations over multiple
controllers

This patch is ported from below mpt2sas driver patch,

'commit 6229b414b3adb3aac0b54e67d72d6462fc230c0d
("mpt2sas: setpci reset kernel oops fix")

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |  6 ++
 drivers/scsi/mpt3sas/mpt3sas_base.h  | 20 -
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   | 42 +---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 12 +++
 4 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index bec3163..f5d589e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -108,9 +108,12 @@ _scsih_set_fwfault_debug(const char *val, struct 
kernel_param *kp)
if (ret)
return ret;
 
+   /* global ioc spinlock to protect controller list on list operations */
pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug);
+   spin_lock(_lock);
list_for_each_entry(ioc, _ioc_list, list)
ioc->fwfault_debug = mpt3sas_fwfault_debug;
+   spin_unlock(_lock);
return 0;
 }
 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
@@ -5136,6 +5139,8 @@ mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
__func__));
 
+   /* synchronizing freeing resource with pci_access_mutex lock */
+   mutex_lock(>pci_access_mutex);
if (ioc->chip_phys && ioc->chip) {
_base_mask_interrupts(ioc);
ioc->shost_recovery = 1;
@@ -5144,6 +5149,7 @@ mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
}
 
mpt3sas_base_unmap_resources(ioc);
+   mutex_unlock(>pci_access_mutex);
return;
 }
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index c92be3c..6d64fa8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -916,7 +916,13 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct 
MPT3SAS_ADAPTER *ioc);
  * @replyPostRegisterIndex: index of next position in Reply Desc Post Queue
  * @delayed_tr_list: target reset link list
  * @delayed_tr_volume_list: volume target reset link list
- * @@temp_sensors_count: flag to carry the number of temperature sensors
+ * @temp_sensors_count: flag to carry the number of temperature sensors
+ * @pci_access_mutex: Mutex to synchronize ioctl,sysfs show path and
+ * pci resource handling. PCI resource freeing will lead to free
+ * vital hardware/memory resource, which might be in use by cli/sysfs
+ * path functions resulting in Null pointer reference followed by kernel
+ * crash. To avoid the above race condition we use mutex syncrhonization
+ * which ensures the syncrhonization between cli/sysfs_show path.
  */
 struct MPT3SAS_ADAPTER {
struct list_head list;
@@ -1131,6 +1137,7 @@ struct MPT3SAS_ADAPTER {
struct list_head delayed_tr_list;
struct list_head delayed_tr_volume_list;
u8  temp_sensors_count;
+   struct mutex pci_access_mutex;
 
/* diag buffer support */
u8  *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
@@ -1161,6 +1168,17 @@ typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, 
u16 smid, u8 msix_index,
 /* base shared API */
 extern struct list_head mpt3sas_ioc_list;
 extern chardriver_name[MPT_NAME_LENGTH];
+/* spinlock on list operations over IOCs
+ * Case: when multiple warpdrive cards(IOCs) are in use
+ * Each IOC will added to the ioc list structure on initialization.
+ * Watchdog threads run at regular intervals to check IOC for any
+ * fault conditions which will trigger the dead_ioc thread to
+ * deallocate pci resource, resulting deleting the IOC netry from list,
+ * this deletion need to protected by spinlock to enusre that
+ * ioc removal is syncrhonized, if not synchronized it might lead to
+ * list_del corruption as the ioc list is traversed in cli path.
+ */
+extern spinlock_t gioc_lock;
 
 void mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc);
 void mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 1c62db8..f257c96 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -416,13 +416,16 @@ static int
 _ctl_verify_adapter(int ioc_number, struct MPT3SAS_ADAPTER **iocpp)
 {
struct MPT3SAS_ADAPTER *ioc;
-
+   /* global ioc lock to protect controller 

[PATCH 25/25] mpt3sas: Bump mpt3sas driver version to 09.102.00.00

2015-11-11 Thread Sreekanth Reddy
Bump mpt3sas driver version to 09.102.00.00

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 25c141c..a17bea9 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -73,9 +73,9 @@
 #define MPT3SAS_DRIVER_NAME"mpt3sas"
 #define MPT3SAS_AUTHOR "Avago Technologies "
 #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION "09.101.00.00"
+#define MPT3SAS_DRIVER_VERSION "09.102.00.00"
 #define MPT3SAS_MAJOR_VERSION  9
-#define MPT3SAS_MINOR_VERSION  101
+#define MPT3SAS_MINOR_VERSION  102
 #define MPT3SAS_BUILD_VERSION  0
 #define MPT3SAS_RELEASE_VERSION00
 
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/25] mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0 HBA's

2015-11-11 Thread Sreekanth Reddy
Modified the mpt3sas driver to have a single driver module which
support both SAS 2.0 & SAS 3.0 HBA devices,

Change List:
* Added SAS 2.0 HBA device IDs to the mpt3sas_pci_table pci table.
* Created two separate SCSI host templates for SAS2 and SAS3 HBAs.
  so that, during the driver load time driver can use
  corresponding host template(based the pci device ID) while
  registering a scsi host adapter instance for that pci device.
* Registered two IOCTL devices, mpt2ctl is for SAS2 HBAs & mpt3ctl
  for SAS3 HBAs. Also updated the code to make sure that mpt2ctl
  device to process only those ioctl cmds issued for the SAS2 HBAs
  and mpt3ctl device to process only those ioctl cmds issued for
  the SAS3 HBAs.
* Added two separate indexing for SAS2 and SAS3 HBAs.
* Replaced compile time check 'MPT2SAS_SCSI' to run time check
  'hba_mpi_version_belonged' whereever needed.
* Aliased this merged driver to mpt2sas using MODULE_ALIAS.
* Moved global varaible 'driver_name' to per adapter instance variable.
* Created two raid function template and used corresponding
  raid function templates based on the run time check
  'hba_mpi_version_belonged'.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/Kconfig  |  16 +-
 drivers/scsi/mpt3sas/Makefile |   3 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  11 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h   |  45 +---
 drivers/scsi/mpt3sas/mpt3sas_config.c |   2 -
 drivers/scsi/mpt3sas/mpt3sas_ctl.c| 139 +---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  | 405 +++---
 7 files changed, 462 insertions(+), 159 deletions(-)

diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
index 18b64bc..2906146 100644
--- a/drivers/scsi/mpt3sas/Kconfig
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -41,15 +41,27 @@
 # USA.
 
 config SCSI_MPT3SAS
-   tristate "LSI MPT Fusion SAS 3.0 Device Driver"
+   tristate "LSI MPT Fusion SAS 3.0 & SAS 2.0 Device Driver"
depends on PCI && SCSI
select SCSI_SAS_ATTRS
select RAID_ATTRS
---help---
This driver supports PCI-Express SAS 12Gb/s Host Adapters.
 
+config SCSI_MPT2SAS_MAX_SGE
+   int "LSI MPT Fusion SAS 2.0 Max number of SG Entries (16 - 256)"
+   depends on PCI && SCSI && SCSI_MPT3SAS
+   default "128"
+   range 16 256
+   ---help---
+   This option allows you to specify the maximum number of scatter-
+   gather entries per I/O. The driver default is 128, which matches
+   MAX_PHYS_SEGMENTS in most kernels.  However in SuSE kernels this
+   can be 256. However, it may decreased down to 16.  Decreasing this
+   parameter will reduce memory requirements on a per controller instance.
+
 config SCSI_MPT3SAS_MAX_SGE
-   int "LSI MPT Fusion Max number of SG Entries (16 - 256)"
+   int "LSI MPT Fusion SAS 3.0 Max number of SG Entries (16 - 256)"
depends on PCI && SCSI && SCSI_MPT3SAS
default "128"
range 16 256
diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile
index 188057f..efb0c4c 100644
--- a/drivers/scsi/mpt3sas/Makefile
+++ b/drivers/scsi/mpt3sas/Makefile
@@ -5,5 +5,4 @@ mpt3sas-y +=  mpt3sas_base.o \
mpt3sas_scsih.o  \
mpt3sas_transport.o \
mpt3sas_ctl.o   \
-   mpt3sas_trigger_diag.o \
-   mpt3sas_module.o
+   mpt3sas_trigger_diag.o
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f5d589e..11393eb 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -198,7 +198,7 @@ _base_fault_reset_work(struct work_struct *work)
ioc->remove_host = 1;
/*Remove the Dead Host */
p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc,
-   "mpt3sas_dead_ioc_%d", ioc->id);
+   "%s_dead_ioc_%d", ioc->driver_name, ioc->id);
if (IS_ERR(p))
pr_err(MPT3SAS_FMT
"%s: Running mpt3sas_dead_ioc thread failed \n",
@@ -254,7 +254,8 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)
 
INIT_DELAYED_WORK(>fault_reset_work, _base_fault_reset_work);
snprintf(ioc->fault_reset_work_q_name,
-   sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id);
+   sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
+   ioc->driver_name, ioc->id);
ioc->fault_reset_work_q =
create_singlethread_workqueue(ioc->fault_reset_work_q_name);
if (!ioc->fault_reset_work_q) {
@@ -1835,10 +1836,10 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 
index, u32 vector)
atomic_set(_q->busy, 0);
if (ioc->msix_enable)
snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
-   driver_name, ioc->id, index);
+

[PATCH RESEND 18/25] mpt2sas, mpt3sas: Update the driver versions

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Bump the mpt2sas driver version to 20.102.00.00 and
Bump the mpt3sas driver version to 9.101.00.00.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 6d64fa8..213d7f8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -71,17 +71,22 @@
 
 /* driver versioning info */
 #define MPT3SAS_DRIVER_NAME"mpt3sas"
-#define MPT2SAS_DRIVER_NAME"mpt2sas"
 #define MPT3SAS_AUTHOR "Avago Technologies "
 #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT2SAS_DESCRIPTION"LSI MPT Fusion SAS 2.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION "09.100.00.00"
-#define MPT2SAS_DRIVER_VERSION "20.101.00.00"
+#define MPT3SAS_DRIVER_VERSION "09.101.00.00"
 #define MPT3SAS_MAJOR_VERSION  9
-#define MPT3SAS_MINOR_VERSION  100
+#define MPT3SAS_MINOR_VERSION  101
 #define MPT3SAS_BUILD_VERSION  0
 #define MPT3SAS_RELEASE_VERSION00
 
+#define MPT2SAS_DRIVER_NAME"mpt2sas"
+#define MPT2SAS_DESCRIPTION"LSI MPT Fusion SAS 2.0 Device Driver"
+#define MPT2SAS_DRIVER_VERSION "20.102.00.00"
+#define MPT2SAS_MAJOR_VERSION  20
+#define MPT2SAS_MINOR_VERSION  102
+#define MPT2SAS_BUILD_VERSION  0
+#define MPT2SAS_RELEASE_VERSION00
+
 /*
  * Set MPT3SAS_SG_DEPTH value based on user input.
  */
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/25] mpt3sas: Added SCSI_MPT3SAS_MERGED config option

2015-11-11 Thread Sreekanth Reddy
This Kconfig option is only used for legacy mpt2sas/mpt3sas
interoperability.

Once this config is set, out of box driver mpt2sas and mpt3sas
can reconginize difference between merged and legacy inbox driver.
Used only to interface gracefully between old mpt2sas/mpt3sas and
merged mpt3sas driver.

Allways set for merged mpt3sas driver.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/Kconfig | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
index 2906146..ad171c4 100644
--- a/drivers/scsi/mpt3sas/Kconfig
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -45,9 +45,20 @@ config SCSI_MPT3SAS
depends on PCI && SCSI
select SCSI_SAS_ATTRS
select RAID_ATTRS
+   select SCSI_MPT3SAS_MERGED
---help---
This driver supports PCI-Express SAS 12Gb/s Host Adapters.
 
+config SCSI_MPT3SAS_MERGED
+   bool "Only used for legacy mpt2sas/mpt3sas interoperability"
+   ---help---
+   Once this config is set, out of box driver mpt2sas and mpt3sas
+   can recongnize difference between merged and legacy inbox driver.
+   Used only to interface gracefully between old mpt2sas/mpt3sas and
+   merged mpt3sas driver.
+
+   Always set for merged mpt3sas driver.
+
 config SCSI_MPT2SAS_MAX_SGE
int "LSI MPT Fusion SAS 2.0 Max number of SG Entries (16 - 256)"
depends on PCI && SCSI && SCSI_MPT3SAS
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/25] mpt2sas: Removed mpt2sas folder

2015-11-11 Thread Sreekanth Reddy
Removed mpt2sas files, mpt2sas directory & mpt3sas_module.c file.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/Kconfig  |  61 
 drivers/scsi/mpt2sas/Makefile |  15 --
 drivers/scsi/mpt2sas/mpt2sas_module.c | 281 --
 drivers/scsi/mpt3sas/mpt3sas_module.c | 253 --
 4 files changed, 610 deletions(-)
 delete mode 100644 drivers/scsi/mpt2sas/Kconfig
 delete mode 100644 drivers/scsi/mpt2sas/Makefile
 delete mode 100644 drivers/scsi/mpt2sas/mpt2sas_module.c
 delete mode 100644 drivers/scsi/mpt3sas/mpt3sas_module.c

diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig
deleted file mode 100644
index 1356a0a..000
--- a/drivers/scsi/mpt2sas/Kconfig
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Kernel configuration file for the MPT2SAS
-#
-# This code is based on drivers/scsi/mpt2sas/Kconfig
-# Copyright (C) 2007-2014  LSI Corporation
-#  (mailto:dl-mptfusionli...@lsi.com)
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# NO WARRANTY
-# THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
-# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
-# LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
-# solely responsible for determining the appropriateness of using and
-# distributing the Program and assumes all risks associated with its
-# exercise of rights under this Agreement, including but not limited to
-# the risks and costs of program errors, damage to or loss of data,
-# programs or equipment, and unavailability or interruption of operations.
-
-# DISCLAIMER OF LIABILITY
-# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-# USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
-# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-# USA.
-
-config SCSI_MPT2SAS
-   tristate "LSI MPT Fusion SAS 2.0 Device Driver"
-   depends on PCI && SCSI
-   select SCSI_SAS_ATTRS
-   select RAID_ATTRS
-   ---help---
-   This driver supports PCI-Express SAS 6Gb/s Host Adapters.
-
-config SCSI_MPT2SAS_MAX_SGE
-   int "LSI MPT Fusion Max number of SG Entries (16 - 128)"
-   depends on PCI && SCSI && SCSI_MPT2SAS
-   default "128"
-   range 16 128
-   ---help---
-   This option allows you to specify the maximum number of scatter-
-   gather entries per I/O. The driver default is 128, which matches
-   SAFE_PHYS_SEGMENTS.  However, it may decreased down to 16.
-   Decreasing this parameter will reduce memory requirements
-   on a per controller instance.
diff --git a/drivers/scsi/mpt2sas/Makefile b/drivers/scsi/mpt2sas/Makefile
deleted file mode 100644
index 3771616..000
--- a/drivers/scsi/mpt2sas/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# mpt2sas makefile
-
-# share the official mpi headers from the mpt3sas driver
-ccflags-y += -I$(src)/../mpt3sas
-ccflags-y += -DSCSI_MPT2SAS
-
-# use the common object files from mpt3sas driver
-obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas.o
-mpt2sas-y +=  ../mpt3sas/mpt3sas_base.o\
-   ../mpt3sas/mpt3sas_config.o\
-   ../mpt3sas/mpt3sas_scsih.o \
-   ../mpt3sas/mpt3sas_transport.o \
-   ../mpt3sas/mpt3sas_ctl.o   \
-   ../mpt3sas/mpt3sas_trigger_diag.o  \
-   mpt2sas_module.o
diff --git a/drivers/scsi/mpt2sas/mpt2sas_module.c 
b/drivers/scsi/mpt2sas/mpt2sas_module.c
deleted file mode 100644
index d407ed0..000
--- a/drivers/scsi/mpt2sas/mpt2sas_module.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Scsi Host Layer for MPT (Message Passing Technology) based controllers
- *
- * Copyright (C) 2012-2014  LSI Corporation
- * Copyright (C) 2013-2015 Avago Technologies
- *  (mailto: mpt-fusionlinux@avagotech.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it 

[PATCH 20/25] mpt3sas: Moved Warpdriver specific functions to mpt3sas_warpdrive.c

2015-11-11 Thread Sreekanth Reddy
Change List:
* Moved mpt2sas_warpdrive.c file from mpt2sas to mpt3sas folder
  and renamed it as mpt3sas_warpdrive.c.
* Also renamed the functions in mpt3sas_warpdrive.c file to follow
  current driver function name convention.
* Updated the Makefile to build mpt3sas_warpdrive.o file for these
  warpdrive specific functions.
* Also in function mpt3sas_setup_direct_io(), used sector_div() API
  instead of division operator (which gives compilation errors on
  32 bit machines)

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/mpt2sas_warpdrive.c | 338 --
 drivers/scsi/mpt3sas/Makefile|   3 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  16 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  44 ++--
 drivers/scsi/mpt3sas/mpt3sas_warpdrive.c | 344 +++
 5 files changed, 376 insertions(+), 369 deletions(-)
 delete mode 100644 drivers/scsi/mpt2sas/mpt2sas_warpdrive.c
 create mode 100644 drivers/scsi/mpt3sas/mpt3sas_warpdrive.c

diff --git a/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c 
b/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c
deleted file mode 100644
index c4fcbc2..000
--- a/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Scsi Host Layer for MPT (Message Passing Technology) based controllers
- *
- * Copyright (C) 2012-2014  LSI Corporation
- * Copyright (C) 2013-2015 Avago Technologies
- *  (mailto: mpt-fusionlinux@avagotech.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * NO WARRANTY
- * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
- * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
- * solely responsible for determining the appropriateness of using and
- * distributing the Program and assumes all risks associated with its
- * exercise of rights under this Agreement, including but not limited to
- * the risks and costs of program errors, damage to or loss of data,
- * programs or equipment, and unavailability or interruption of operations.
-
- * DISCLAIMER OF LIABILITY
- * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
- * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
-
- * You should have received a copy of the GNU General Public License
- * along with this program.
- */
-
-/**
- * _scsih_disable_ddio - Disable direct I/O for all the volumes
- * @ioc: per adapter object
- */
-static void
-_scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc)
-{
-   Mpi2RaidVolPage1_t vol_pg1;
-   Mpi2ConfigReply_t mpi_reply;
-   struct _raid_device *raid_device;
-   u16 handle;
-   u16 ioc_status;
-   unsigned long flags;
-
-   handle = 0x;
-   while (!(mpt3sas_config_get_raid_volume_pg1(ioc, _reply,
-   _pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
-   ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
-   MPI2_IOCSTATUS_MASK;
-   if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-   break;
-   handle = le16_to_cpu(vol_pg1.DevHandle);
-   spin_lock_irqsave(>raid_device_lock, flags);
-   raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
-   if (raid_device)
-   raid_device->direct_io_enabled = 0;
-   spin_unlock_irqrestore(>raid_device_lock, flags);
-   }
-   return;
-}
-
-
-/**
- * _scsih_get_num_volumes - Get number of volumes in the ioc
- * @ioc: per adapter object
- */
-static u8
-_scsih_get_num_volumes(struct MPT3SAS_ADAPTER *ioc)
-{
-   Mpi2RaidVolPage1_t vol_pg1;
-   Mpi2ConfigReply_t mpi_reply;
-   u16 handle;
-   u8 vol_cnt = 0;
-   u16 ioc_status;
-
-   handle = 0x;
-   while (!(mpt3sas_config_get_raid_volume_pg1(ioc, _reply,
-   _pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
-   ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
-  

[PATCH 22/25] mpt3sas: Added a module parameter hbas_to_enumerate

2015-11-11 Thread Sreekanth Reddy
Added module parameter 'hbas_to_enumerate', which user can
use this merged driver as legacy mpt2sas driver or as a
legacy mpt3sas driver if needed.

Here are the available options for this module parameter
  0 - Merged driver which enumerates both SAS 2.0 & SAS 3.0 HBAs
  1 - Acts as legacy mpt2sas driver, which enumerates only SAS 2.0 HBAs
  2 - Acts as legacy mpt3sas driver, which enumerates only SAS 3.0 HBAs

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  4 +--
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   | 32 +---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 58 +++-
 3 files changed, 68 insertions(+), 26 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 087586e..25c141c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1357,8 +1357,8 @@ int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER 
*ioc,
 /* ctl shared API */
 extern struct device_attribute *mpt3sas_host_attrs[];
 extern struct device_attribute *mpt3sas_dev_attrs[];
-void mpt3sas_ctl_init(void);
-void mpt3sas_ctl_exit(void);
+void mpt3sas_ctl_init(ushort hbas_to_enumerate);
+void mpt3sas_ctl_exit(ushort hbas_to_enumerate);
 u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply);
 void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 05b0733..d8366b0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -3404,15 +3404,25 @@ static struct miscdevice gen2_ctl_dev = {
  *
  */
 void
-mpt3sas_ctl_init(void)
+mpt3sas_ctl_init(ushort hbas_to_enumerate)
 {
async_queue = NULL;
-   if (misc_register(_dev) < 0)
-   pr_err("%s can't register misc device [minor=%d]\n",
-   MPT3SAS_DRIVER_NAME, MPT3SAS_MINOR);
-   if (misc_register(_ctl_dev) < 0)
-   pr_err("%s can't register misc device [minor=%d]\n",
-   MPT2SAS_DRIVER_NAME, MPT2SAS_MINOR);
+
+   /* Don't register mpt3ctl ioctl device if
+* hbas_to_enumarate is one.
+*/
+   if (hbas_to_enumerate != 1)
+   if (misc_register(_dev) < 0)
+   pr_err("%s can't register misc device [minor=%d]\n",
+   MPT3SAS_DRIVER_NAME, MPT3SAS_MINOR);
+
+   /* Don't register mpt3ctl ioctl device if
+* hbas_to_enumarate is two.
+*/
+   if (hbas_to_enumerate != 2)
+   if (misc_register(_ctl_dev) < 0)
+   pr_err("%s can't register misc device [minor=%d]\n",
+   MPT2SAS_DRIVER_NAME, MPT2SAS_MINOR);
 
init_waitqueue_head(_poll_wait);
 }
@@ -3422,7 +3432,7 @@ mpt3sas_ctl_init(void)
  *
  */
 void
-mpt3sas_ctl_exit(void)
+mpt3sas_ctl_exit(ushort hbas_to_enumerate)
 {
struct MPT3SAS_ADAPTER *ioc;
int i;
@@ -3447,6 +3457,8 @@ mpt3sas_ctl_exit(void)
 
kfree(ioc->event_log);
}
-   misc_deregister(_dev);
-   misc_deregister(_ctl_dev);
+   if (hbas_to_enumerate != 1)
+   misc_deregister(_dev);
+   if (hbas_to_enumerate != 2)
+   misc_deregister(_ctl_dev);
 }
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 04570a2..d95206b 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -119,8 +119,12 @@ static u64 max_lun = MPT3SAS_MAX_LUN;
 module_param(max_lun, ullong, 0);
 MODULE_PARM_DESC(max_lun, " max lun, default=16895 ");
 
-
-
+static ushort hbas_to_enumerate;
+module_param(hbas_to_enumerate, ushort, 0);
+MODULE_PARM_DESC(hbas_to_enumerate,
+   " 0 - enumerates both SAS 2.0 & SAS 3.0 generation HBAs\n \
+ 1 - enumerates only SAS 2.0 generation HBAs\n \
+ 2 - enumerates only SAS 3.0 generation HBAs (default=0)");
 
 /* diag_buffer_enable is bitwise
  * bit 0 set = TRACE
@@ -8444,6 +8448,18 @@ _scsih_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
if (hba_mpi_version == 0)
return -ENODEV;
 
+   /* Enumerate only SAS 2.0 HBA's if hbas_to_enumerate is one,
+* for other generation HBA's return with -ENODEV
+*/
+   if ((hbas_to_enumerate == 1) && (hba_mpi_version !=  MPI2_VERSION))
+   return -ENODEV;
+
+   /* Enumerate only SAS 3.0 HBA's if hbas_to_enumerate is two,
+* for other generation HBA's return with -ENODEV
+*/
+   if ((hbas_to_enumerate == 2) && (hba_mpi_version !=  MPI25_VERSION))
+   return -ENODEV;
+
switch (hba_mpi_version) {
case MPI2_VERSION:
/* Use mpt2sas driver host template for SAS 2.0 HBA's */
@@ -8948,8 +8964,10 @@ scsih_exit(void)

[PATCH RESEND 16/25] mpt3sas: Added OEMs Gen2 PnP ID Branding names

2015-11-11 Thread Sreekanth Reddy
From: Sreekanth Reddy 

Added OEMs Gen2 PnP ID Branding names from mpt2sas driver.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 326 
 drivers/scsi/mpt3sas/mpt3sas_base.h |  93 +-
 2 files changed, 305 insertions(+), 114 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f7f2ab5..bec3163 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2508,143 +2508,261 @@ mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER 
*ioc, u16 smid)
 }
 
 /**
- * _base_display_intel_branding - Display branding string
+ * _base_display_OEMs_branding - Display branding string
  * @ioc: per adapter object
  *
  * Return nothing.
  */
 static void
-_base_display_intel_branding(struct MPT3SAS_ADAPTER *ioc)
+_base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
 {
if (ioc->pdev->subsystem_vendor != PCI_VENDOR_ID_INTEL)
return;
 
-   switch (ioc->pdev->device) {
-   case MPI25_MFGPAGE_DEVID_SAS3008:
-   switch (ioc->pdev->subsystem_device) {
-   case MPT3SAS_INTEL_RMS3JC080_SSDID:
-   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
-   MPT3SAS_INTEL_RMS3JC080_BRANDING);
-   break;
-
-   case MPT3SAS_INTEL_RS3GC008_SSDID:
-   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
-   MPT3SAS_INTEL_RS3GC008_BRANDING);
-   break;
-   case MPT3SAS_INTEL_RS3FC044_SSDID:
-   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
-   MPT3SAS_INTEL_RS3FC044_BRANDING);
-   break;
-   case MPT3SAS_INTEL_RS3UC080_SSDID:
-   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
-   MPT3SAS_INTEL_RS3UC080_BRANDING);
+   switch (ioc->pdev->subsystem_vendor) {
+   case PCI_VENDOR_ID_INTEL:
+   switch (ioc->pdev->device) {
+   case MPI2_MFGPAGE_DEVID_SAS2008:
+   switch (ioc->pdev->subsystem_device) {
+   case MPT2SAS_INTEL_RMS2LL080_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS2LL080_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS2LL040_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS2LL040_BRANDING);
+   break;
+   case MPT2SAS_INTEL_SSD910_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_SSD910_BRANDING);
+   break;
+   default:
+   pr_info(MPT3SAS_FMT
+"Intel(R) Controller: Subsystem ID: 0x%X\n",
+ioc->name, ioc->pdev->subsystem_device);
+   break;
+   }
+   case MPI2_MFGPAGE_DEVID_SAS2308_2:
+   switch (ioc->pdev->subsystem_device) {
+   case MPT2SAS_INTEL_RS25GB008_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RS25GB008_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25JB080_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS25JB080_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25JB040_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS25JB040_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25KB080_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS25KB080_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25KB040_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS25KB040_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25LB040_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   MPT2SAS_INTEL_RMS25LB040_BRANDING);
+   break;
+   case MPT2SAS_INTEL_RMS25LB080_SSDID:
+   pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+   

Re: [PATCH RESEND 06/25] mpt3sas: Define 'hba_mpi_version_belonged' IOC variable

2015-11-11 Thread Hannes Reinecke
On 11/11/2015 01:00 PM, Sreekanth Reddy wrote:
> From: Sreekanth Reddy 
> 
> 1. Use 'hba_mpi_version_belonged' IOC varable to uniquely
> identify each individual generation driver functionality at
> runtime.
> 
> 2. Declared global variable 'driver_name' and used
> this variable while reserving PCI regions and while
> allocating the IRQ's.
> 
> Signed-off-by: Sreekanth Reddy 
> ---
>  drivers/scsi/mpt2sas/mpt2sas_module.c |  1 +
>  drivers/scsi/mpt3sas/mpt3sas_base.c   |  8 +++
>  drivers/scsi/mpt3sas/mpt3sas_base.h   |  3 +++
>  drivers/scsi/mpt3sas/mpt3sas_ctl.c| 18 +---
>  drivers/scsi/mpt3sas/mpt3sas_module.c |  1 +
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c  | 39 
> ++-
>  6 files changed, 62 insertions(+), 8 deletions(-)
> 
I'd rather shorten that to 'hba_mpi_version'.

Other than that it's okay.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] mptfusion: don't allow negative bytes in kbuf_alloc_2_sgl()

2015-11-11 Thread Martin K. Petersen
> "Dan" == Dan Carpenter  writes:

Dan> There is a static checker warning here because "bytes" is
Dan> controlled by the user and we cap the upper bound with min() but
Dan> allow negatives.  Negative bytes will result in some nasty warning
Dan> messages but are not super harmful.  Anyway, no one needs negative
Dan> bytes so let's just check for it and return NULL.

Applied.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH] mpt2sas: Remove usage of 'struct timeval'

2015-11-11 Thread Martin K. Petersen
> "Tina" == Tina Ruchandani  writes:

Tina,

Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit
Tina> systems in year 2038 and beyond. This patch replaces the use of
Tina> struct timeval for computing mpi_request.TimeStamp, and instead
Tina> uses ktime_t which provides 64-bit seconds value. The timestamp
Tina> computed remains unaffected (milliseconds since Unix epoch).

We just consolidated the mpt2sas and mpt3sas drivers into one so I'm
afraid your time tweaks will have to be rebased. I encourage you repost
in a couple of weeks after the merge window dust settles.

Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/2] ibmvscsi: display default value for max_id, max_lun and max_channel.

2015-11-11 Thread Martin K. Petersen
> "Laurent" == Laurent Vivier  writes:

Laurent> As devices with values greater than that are silently ignored,
Laurent> this gives some hints to the sys admin to know why he doesn't
Laurent> see his devices...

Applied both patches.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


4.4 SCSI queue status

2015-11-11 Thread Martin K. Petersen

As some of you may have noticed, I have been volunteered to help with
the SCSI tree going forward. Much like Christoph did for while. My
current tree is here:

http://git.kernel.org/cgit/linux/kernel/git/mkp/linux.git/log/?h=4.4/scsi-queue

At this point I am done merging SCSI patches for 4.4. There was quite
the backlog and I probably missed a bunch. Sorry!

However, save for a couple of patch series from Hannes my SCSI folder is
now empty. Which means that for me to see something you will have to
resend to linux-scsi.

Most of my merge cycles have been spent on driver updates. I prioritized
those over core changes since we were essentially in the merge window
when I got enlisted(*). Will tackle the trickier core stuff for 4.5.

There were a couple of driver series that just missed the cut: The
HiSilicon SAS driver which required minor tweaks and two ufs patch
series which required comment feedback and/or reviews.

The rules of engagement haven't changed. Here they are, slightly updated
from the original version to reflect the omnipresent kbuild test robot
and a few other things:

 - A patch needs two positive reviews (non-author signoff, acked-by,
   reviewed-by or tested-by).

 - The patch must have been posted to linux-scsi and nobody has
   expressed any concerns about it.

 - The patch applies cleanly. Use checkpatch and git send-email.

 - The patch compiles without warnings on all relevant architectures and
   does not incur any 0-day kbuild test robot complaints.

 - Core changes survive a full xfstests run.

 - The patch must have a commit message that comprehensively describes
   what the patch does. Do not link to vendor bugzilla entries that
   require special access credentials. If there is anything of
   importance in bugzilla, put it in the commit message.

 - Resend the patches if you haven't received any feedback after a
   couple of weeks.

 - When you resend a patch or series make sure to record all existing
   reviewed-by/acked-by/tested-by tags.

 - Ping the list for additional reviewers.

(*) I will never merge during the merge window again!
I will never merge during the merge window again!
I will never merge during the merge window again!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970

2015-11-11 Thread Martin K. Petersen
> "Tina" == Tina Ruchandani  writes:

Tina> struct mvumi_hs_page2 stores a "seconds_since1970" field which is
Tina> of type u64. It is however, written to, using 'struct timeval'
Tina> which has a 32-bit seconds field and whose value will overflow in
Tina> year 2038.  This patch uses ktime_get_real_seconds() instead since
Tina> it provides a 64-bit seconds value, which is 2038 safe.

Under normal circumstances I would like a driver owner signoff but it
doesn't look like mvumi gets much attention. Applied.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sd: Clear PS bit before Mode Select.

2015-11-11 Thread Martin K. Petersen
> "Gabriel" == Gabriel Krisman Bertazi  writes:

Gabriel> This patch clears the PS bit in the buffer returned by Mode
Gabriel> Select, right before it is used in the Mode Select command.

Applied.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()

2015-11-11 Thread Martin K. Petersen
> "Alison" == Alison Schofield  writes:

Alison> Replace the use of struct timeval and do_gettimeofday() with 64
Alison> bit ktime_get_real_seconds. Prevents 32-bit type overflow in
Alison> year 2038 on 32-bit systems.

Applied.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] iscsi: fix regression caused by session lock patch

2015-11-11 Thread mchristi
From: Mike Christie 

This patch fixes this oops report by Guilherme Piccol:

list_del corruption. prev->next should be c00f3da2b080, but was 
c00f3da2c080
[ cut here ]
WARNING: at lib/list_debug.c:59
CPU: 48 PID: 12033 Comm: fio-2.2.7 Not tainted 
3.18.22-354.el7_1.pkvm3_1_0.3600.1.ppc64le #1
task: c00f25827000 ti: c00fff5f8000 task.ti: c00f057e4000
NIP: c04d15a4 LR: c04d15a0 CTR: c04bdfd0
REGS: c00fff5faf10 TRAP: 0700   Not tainted 
(3.18.22-354.el7_1.pkvm3_1_0.3600.1.ppc64le)
MSR: 90029033   CR: 28082842  XER: 2000
CFAR: c0988dbc SOFTE: 1
NIP [c04d15a4] __list_del_entry+0xb4/0xe0
LR [c04d15a0] __list_del_entry+0xb0/0xe0
Call Trace:
[c00fff5fb190] [c04d15a0] __list_del_entry+0xb0/0xe0 (unreliable)
[c00fff5fb1f0] [d00010fb0c8c] iscsi_complete_task+0x8c/0x190 [libiscsi]
[c00fff5fb270] [d00010fb24c8] __iscsi_complete_pdu+0x508/0xaa0 
[libiscsi]
[c00fff5fb350] [d00010fb2ab4] iscsi_complete_pdu+0x54/0xa0 [libiscsi]
[c00fff5fb3a0] [d000110121ac] iscsi_tcp_hdr_recv_done+0x38c/0x1250 
[libiscsi_tcp]
[c00fff5fb480] [d00011011a48] iscsi_tcp_recv_skb+0xd8/0x4b0 
[libiscsi_tcp]
[c00fff5fb570] [d00011071708] iscsi_sw_tcp_recv+0x98/0x170 [iscsi_tcp]
[c00fff5fb610] [c0882794] tcp_read_sock+0xe4/0x2d0
[c00fff5fb680] [d00011071590] iscsi_sw_tcp_data_ready+0x70/0x150 
[iscsi_tcp]
[c00fff5fb720] [c08921c8] tcp_rcv_established+0x3f8/0x6f0
[c00fff5fb780] [c089d75c] tcp_v4_do_rcv+0x19c/0x420
[c00fff5fb7e0] [c08a15bc] tcp_v4_rcv+0xa6c/0xb20
[c00fff5fb8c0] [c08700f8] ip_local_deliver_finish+0x178/0x350
[c00fff5fb910] [c0870424] ip_rcv_finish+0x154/0x420
[c00fff5fb990] [c0816bf4] __netif_receive_skb_core+0x7a4/0x9c0
[c00fff5fba80] [c081a0fc] netif_receive_skb_internal+0x4c/0xf0
[c00fff5fbac0] [c081b17c] napi_gro_receive+0xfc/0x1a0
[c00fff5fbb00] [d8373280] bnx2x_rx_int+0xb30/0x1650 [bnx2x]
[c00fff5fbc90] [d8374440] bnx2x_poll+0x310/0x440 [bnx2x]
[c00fff5fbd40] [c081a8e8] net_rx_action+0x2d8/0x3e0
[c00fff5fbe10] [c00cfc44] __do_softirq+0x174/0x3a0
[c00fff5fbf00] [c00d01f8] irq_exit+0xc8/0x100
[c00fff5fbf20] [c0010d40] __do_irq+0xa0/0x1c0
[c00fff5fbf90] [c0024aac] call_do_irq+0x14/0x24
[c00f057e7dd0] [c0010f00] do_IRQ+0xa0/0x120
[c00f057e7e30] [c00025e8] hardware_interrupt_common+0x168/0x180
Instruction dump:
0fe0 4bd8 3c62ff91 386304c0 484b77ad 6000 0fe0 4bc0
 3c62ff91 38630480 484b7795 6000 <0fe0> 4ba8 3c62ff91 7d254b78
---[ end trace 005d2749e6bab12f ]---

The bug is caused by this patch:

659743b02c411075b26601725947b21df0bb29c8

which allowed the task lists to be manipulated under different locks
in the xmit and completion path.

To fix the oops this patch just reverts that patch. It also reverts
these 2 patches for regressions that were also a result of that patch:

72b9740201d5f0e24b0b8326a4949786a30ff628
35843048e7e979df3b7b9f2ad49e21797a11386b

Cc: Guilherme  Piccoli 
Signed-off-by: Mike Christie 
---
 drivers/scsi/be2iscsi/be_main.c  |  26 ++---
 drivers/scsi/bnx2i/bnx2i_hwi.c   |  46 -
 drivers/scsi/bnx2i/bnx2i_iscsi.c |  10 +-
 drivers/scsi/iscsi_tcp.c |  22 ++--
 drivers/scsi/libiscsi.c  | 214 +--
 drivers/scsi/libiscsi_tcp.c  |  28 ++---
 drivers/scsi/qla4xxx/ql4_isr.c   |   4 +-
 include/scsi/libiscsi.h  |  17 +---
 include/scsi/libiscsi_tcp.h  |   2 -
 9 files changed, 161 insertions(+), 208 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index a4a5d6d..987cd60 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -232,20 +232,20 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
cls_session = starget_to_session(scsi_target(sc->device));
session = cls_session->dd_data;
 
-   spin_lock_bh(>frwd_lock);
+   spin_lock_bh(>lock);
if (!aborted_task || !aborted_task->sc) {
/* we raced */
-   spin_unlock_bh(>frwd_lock);
+   spin_unlock_bh(>lock);
return SUCCESS;
}
 
aborted_io_task = aborted_task->dd_data;
if (!aborted_io_task->scsi_cmnd) {
/* raced or invalid command */
-   spin_unlock_bh(>frwd_lock);
+   spin_unlock_bh(>lock);
return SUCCESS;
}
-   spin_unlock_bh(>frwd_lock);
+   spin_unlock_bh(>lock);
/* Invalidate WRB Posted for this Task */
AMAP_SET_BITS(struct amap_iscsi_wrb, invld,
  aborted_io_task->pwrb_handle->pwrb,
@@ -310,9 +310,9 

Re: [PATCH 00/25] mpt3sas: Mergering mpt2sas & mpt3sas driver code

2015-11-11 Thread Martin K. Petersen
> "Sreekanth" == Sreekanth Reddy  writes:

Sreekanth,

Sreekanth> Last time we have posted a set of patches which combine the
Sreekanth> mpt2sas and mpt3sas driver code. and we are generating two
Sreekanth> driver modules (i.e. two separate .ko's) from this Combined
Sreekanth> driver source.

I have merged your combined driver.

The patches in the single-module portion of the series did not compile
individually and I gave up untangling them. They were fundamentally too
intertwined and I squashed them into one commit. Since it's mostly
boilerplate stuff it should not matter too much from a bisection
perspective.

Thanks for doing this work! This will make things much easier going
forward.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check

2015-11-11 Thread Martin K. Petersen

Applied.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html