cascardo/linux.git
8 years agolibata: NCQ encapsulation for ZAC MANAGEMENT OUT
Hannes Reinecke [Mon, 25 Apr 2016 10:45:54 +0000 (12:45 +0200)]
libata: NCQ encapsulation for ZAC MANAGEMENT OUT

Add NCQ encapsulation for ZAC MANAGEMENT OUT and evaluate
NCQ Non-Data log pages to figure out if NCQ encapsulation
is supported.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: Implement ZBC OUT translation
Hannes Reinecke [Mon, 25 Apr 2016 10:45:53 +0000 (12:45 +0200)]
libata: Implement ZBC OUT translation

ZAC drives implement a 'ZAC Management Out' command template,
which maps onto the ZBC OUT command.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: implement ZBC IN translation
Hannes Reinecke [Mon, 25 Apr 2016 10:45:52 +0000 (12:45 +0200)]
libata: implement ZBC IN translation

ZAC drives implement a 'ZAC Management In' command template,
which maps onto the ZBC IN command.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: fixup ZAC device disabling
Hannes Reinecke [Mon, 25 Apr 2016 10:45:51 +0000 (12:45 +0200)]
libata: fixup ZAC device disabling

libata device disabling is ... curious. So add the correct
definitions that we can disable ZAC devices properly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata-scsi: Generate sense code for disabled devices
Hannes Reinecke [Mon, 25 Apr 2016 10:45:50 +0000 (12:45 +0200)]
libata-scsi: Generate sense code for disabled devices

If a device is disabled after error recovery it doesn't make
any sense to generate an ATA sense, but we should rather
return a generic sense code indicating the device is gone.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata-trace: decode subcommands
Hannes Reinecke [Mon, 25 Apr 2016 10:45:49 +0000 (12:45 +0200)]
libata-trace: decode subcommands

Some commands like FPDMA RECEIVE or NCQ NON DATA can encapsulate
other commands to NCQ transport. So decode the subcmds, too.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: Check log page directory before accessing pages
Hannes Reinecke [Mon, 25 Apr 2016 10:45:48 +0000 (12:45 +0200)]
libata: Check log page directory before accessing pages

When reading the NCQ Send/Recv log it might actually not
supported, thereby causing irritating messages
'READ LOG DMA EXT failed'.
Instead we should be reading the log directory first to
figure out if the log is actually supported before trying
to access it.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: Add command definitions for NCQ Encapsulation for READ LOG DMA EXT
Hannes Reinecke [Mon, 25 Apr 2016 10:45:47 +0000 (12:45 +0200)]
libata: Add command definitions for NCQ Encapsulation for READ LOG DMA EXT

ACS-4 defines an NCQ encapsulation for READ LOG DMA EXT.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: Separate out ata_dev_config_ncq_send_recv()
Hannes Reinecke [Mon, 25 Apr 2016 10:45:46 +0000 (12:45 +0200)]
libata: Separate out ata_dev_config_ncq_send_recv()

Move NCQ SEND/RECEIVE checks into a separate function.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata/libsas: Define ATA_CMD_NCQ_NON_DATA
Hannes Reinecke [Mon, 25 Apr 2016 10:45:45 +0000 (12:45 +0200)]
libata/libsas: Define ATA_CMD_NCQ_NON_DATA

Define the NCQ NON DATA command and update libsas to handle it
correctly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibsas: enable FPDMA SEND/RECEIVE
Hannes Reinecke [Mon, 25 Apr 2016 10:45:44 +0000 (12:45 +0200)]
libsas: enable FPDMA SEND/RECEIVE

Update libsas and dependent drivers to handle FPDMA
SEND/RECEIVE correctly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agolibata: do not attempt to retrieve sense code twice
Hannes Reinecke [Mon, 25 Apr 2016 10:45:43 +0000 (12:45 +0200)]
libata: do not attempt to retrieve sense code twice

Do not call ata_request_sense() if the sense code is already
present.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agoMerge branch '4.7/scsi-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/mkp...
Tejun Heo [Mon, 9 May 2016 16:34:39 +0000 (12:34 -0400)]
Merge branch '4.7/scsi-queue' of git://git./linux/kernel/git/mkp/scsi into for-4.7-zac

Pulling in the dependencies for further ZAC changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
8 years agomegaraid_sas: Downgrade two success messages to info
Andy Lutomirski [Tue, 3 May 2016 17:24:31 +0000 (10:24 -0700)]
megaraid_sas: Downgrade two success messages to info

I actually read the error messages in my logs, and successful
initialization is not an error.

Arguably these log lines could be deleted entirely.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agocxlflash: Fix to resolve dead-lock during EEH recovery
Manoj N. Kumar [Tue, 3 May 2016 16:27:34 +0000 (11:27 -0500)]
cxlflash: Fix to resolve dead-lock during EEH recovery

When a cxlflash adapter goes into EEH recovery and multiple processes
(each having established its own context) are active, the EEH recovery
can hang if the processes attempt to recover in parallel. The symptom
logged after a couple of minutes is:

INFO: task eehd:48 blocked for more than 120 seconds.
Not tainted 4.5.0-491-26f710d+ #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
eehd            0    48      2
Call Trace:
__switch_to+0x2f0/0x410
__schedule+0x300/0x980
schedule+0x48/0xc0
rwsem_down_write_failed+0x294/0x410
down_write+0x88/0xb0
cxlflash_pci_error_detected+0x100/0x1c0 [cxlflash]
cxl_vphb_error_detected+0x88/0x110 [cxl]
cxl_pci_error_detected+0xb0/0x1d0 [cxl]
eeh_report_error+0xbc/0x130
eeh_pe_dev_traverse+0x94/0x160
eeh_handle_normal_event+0x17c/0x450
eeh_handle_event+0x184/0x370
eeh_event_handler+0x1c8/0x1d0
kthread+0x110/0x130
ret_from_kernel_thread+0x5c/0xa4
INFO: task blockio:33215 blocked for more than 120 seconds.

Not tainted 4.5.0-491-26f710d+ #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
blockio         0 33215  33213
Call Trace:
0x1 (unreliable)
__switch_to+0x2f0/0x410
__schedule+0x300/0x980
schedule+0x48/0xc0
rwsem_down_read_failed+0x124/0x1d0
down_read+0x68/0x80
cxlflash_ioctl+0x70/0x6f0 [cxlflash]
scsi_ioctl+0x3b0/0x4c0
sg_ioctl+0x960/0x1010
do_vfs_ioctl+0xd8/0x8c0
SyS_ioctl+0xd4/0xf0
system_call+0x38/0xb4
INFO: task eehd:48 blocked for more than 120 seconds.

The hang is because of a 3 way dead-lock:

Process A holds the recovery mutex, and waits for eehd to complete.
Process B holds the semaphore and waits for the recovery mutex.
eehd waits for semaphore.

The fix is to have Process B above release the semaphore before
attempting to acquire the recovery mutex. This will allow
eehd to proceed to completion.

Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: rework resp_report_luns
Douglas Gilbert [Sun, 1 May 2016 02:44:43 +0000 (22:44 -0400)]
scsi_debug: rework resp_report_luns

Based on "[PATH V2] scsi_debug: rework resp_report_luns" patch
sent by Tomas Winkler on Thursday, 26 Feb 2015. His notes:
  1. Remove duplicated boundary checks which simplify the fill-in
     loop
  2. Use more of scsi generic API
Replace fixed length response array a with heap allocation
allowing up to 256 normal LUNs per target.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: use pdt constants
Douglas Gilbert [Sun, 1 May 2016 02:44:42 +0000 (22:44 -0400)]
scsi_debug: use pdt constants

Use TYPE_* constants for SCSI peripheral device types instead of
numbers. Further cleanups requested by checkpatch.pl.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: use likely hints on fast path
Douglas Gilbert [Mon, 25 Apr 2016 16:16:34 +0000 (12:16 -0400)]
scsi_debug: use likely hints on fast path

The most common commands in normal use are the READ and WRITE SCSI
commands. Use likely and unlikely hints along the path taken by these
commands. Rename check_readiness() to make_ua() and remove associated
dead code. Rename devInfoReg() to find_build_dev_info().

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: re-order file scope declarations
Douglas Gilbert [Mon, 25 Apr 2016 16:16:33 +0000 (12:16 -0400)]
scsi_debug: re-order file scope declarations

Group most defines together first; followed by struct definitions and
then table and variable definitions. Normalize all function headers.

[mkp: Corrected hex value in WP/DPOFUA MODE SENSE comment]

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: replace tasklet with work queue
Douglas Gilbert [Mon, 25 Apr 2016 16:16:32 +0000 (12:16 -0400)]
scsi_debug: replace tasklet with work queue

When a negative value was placed in the delay parameter, a tasklet was
scheduled. Change the tasklet to a work queue. Previously a delay of -1
scheduled a high priority tasklet; since there are no high priority work
queues, treat -1 like other negative values in delay and schedule a work
item.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: make jiffy delay name clearer
Douglas Gilbert [Mon, 25 Apr 2016 16:16:31 +0000 (12:16 -0400)]
scsi_debug: make jiffy delay name clearer

Add 'j' to delay names to make it clearer that its unit is jiffies and
to differentiate it from sdebug_ndelay whose unit is nanoseconds.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: replace jiffy timers with hr timers
Douglas Gilbert [Mon, 25 Apr 2016 16:16:30 +0000 (12:16 -0400)]
scsi_debug: replace jiffy timers with hr timers

The driver supports two command delay interfaces, the original one whose
unit is a jiffy, and a newer one whose unit is a nanosecond. Each had
different implementations.  Keep both interfaces but simplify the
implemenation to use a single delay mechanism based on high resolution
timers.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: ignore host lock option
Douglas Gilbert [Mon, 25 Apr 2016 16:16:29 +0000 (12:16 -0400)]
scsi_debug: ignore host lock option

Remove logic to optionally hold host_lock while each command is
queued. Keep module and sysfs host_lock parameters for backward
compatibility. Note in module parameter description that host_lock is
ignored.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: cleanup naming and bit crunching
Douglas Gilbert [Mon, 25 Apr 2016 16:16:28 +0000 (12:16 -0400)]
scsi_debug: cleanup naming and bit crunching

Shorten file scope static and constant names. Use more
get/put_unaligned calls to hide bit banging. Introduce
sdebug_verbose boolean to replace frequent masking of
option bit flags. Add GPL and bump version.

[mkp: Use logical instead of bitwise OR for LBP VPD flags]

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: update driver version
Don Brace [Wed, 27 Apr 2016 22:14:26 +0000 (17:14 -0500)]
hpsa: update driver version

Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: correct handling of HBA device removal
Don Brace [Wed, 27 Apr 2016 22:14:17 +0000 (17:14 -0500)]
hpsa: correct handling of HBA device removal

Need to report HBA device removal faster than the
event handler polling interval.

Stop I/O to the removed disk and wait for all
I/O operations to flush before removing the device.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: correct ioaccel2 error procecssing.
Don Brace [Wed, 27 Apr 2016 22:14:07 +0000 (17:14 -0500)]
hpsa: correct ioaccel2 error procecssing.

set offload_to_be_enabled to 0 when an ioaccel2 error is processed.

Before, an ioaccel completion error would turn of ioaccel but a rescan
would turn it back on again.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: correct ioaccel state change operation
Don Brace [Wed, 27 Apr 2016 22:13:59 +0000 (17:13 -0500)]
hpsa: correct ioaccel state change operation

offload_to_be_enabled also needs to be set to 0 during a state
change.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: add timeouts for driver initiated commands
Don Brace [Wed, 27 Apr 2016 22:13:51 +0000 (17:13 -0500)]
hpsa: add timeouts for driver initiated commands

faulty drives can cause the driver to hang during a
scan operation.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: add sas_address to sysfs device attibute
Joseph T Handzik [Wed, 27 Apr 2016 22:13:33 +0000 (17:13 -0500)]
hpsa: add sas_address to sysfs device attibute

There have been companies requesting a sysfs entry
to obtain the sas address of device.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: correct initialization order issue
Don Brace [Wed, 27 Apr 2016 22:13:26 +0000 (17:13 -0500)]
hpsa: correct initialization order issue

The driver was calling scsi_scan_host before enabling interrupts.

This has gone unnoticed except for customers running in intx mode.
Calling scsi_scan_host before interrupts are enabled causes
"irq XX: nobody cared" messages and the driver to hang.

This patch enables interrupts before the call to scsi_scan_host.

Reported-by: Piotr Karbowski <piotr.karbowski@gmail.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Update driver version
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:44 +0000 (23:32 -0700)]
aacraid: Update driver version

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Fix for KDUMP driver hang
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:37 +0000 (23:32 -0700)]
aacraid: Fix for KDUMP driver hang

When KDUMP is triggered the driver first talks to the firmware in INTX
mode, but the adapter firmware is still in MSIX mode. Therefore the first
driver command hangs since the driver is waiting for an INTX response and
firmware gives a MSIX response. If when the OS is installed on a RAID
drive created by the adapter KDUMP will hang since the driver does not
receive a response in sync mode.

Fixed by: Change the firmware to INTX mode if it is in MSIX mode before
sending the first sync command.

Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Remove code to needlessly complete fib
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:26 +0000 (23:32 -0700)]
aacraid: Remove code to needlessly complete fib

Currently driver completes double completed or spurious interrupted fibs.
This  is not necessary and causes the SCSI mid layer to issue aborts and
resets, since completing a fib  prematurely might trigger a race condition
resulting in the driver not calling the scsi_done callback.

Fixed by removing the call to fib complete.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Log firmware AIF messages
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:09 +0000 (23:32 -0700)]
aacraid: Log firmware AIF messages

Firmware AIF messages about cache loss and data recovery are being missed
by the driver since currently they are not captured but rather let go.
This patch to capture those messages and log them for the user.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Fix for aac_command_thread hang
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:57 +0000 (23:31 -0700)]
aacraid: Fix for aac_command_thread hang

Typically under error conditions, it is possible for aac_command_thread()
to miss the wakeup from kthread_stop() and go back to sleep, causing it
to hang aac_shutdown.

In the observed scenario, the adapter is not functioning correctly and so
aac_fib_send() never completes (or time-outs depending on how it was
called). Shortly after aac_command_thread() starts it performs
aac_fib_send(SendHostTime) which hangs. When aac_probe_one
/aac_get_adapter_info send time outs, kthread_stop is called which breaks
the command thread out of it's hang.

The code will still go back to sleep in schedule_timeout() without
checking kthread_should_stop() so it causes aac_probe_one to hang until
the schedule_timeout() which is 30 minutes.

Fixed by: Adding another kthread_should_stop() before schedule_timeout()
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Disable MSI mode for series 6, 7, 8 cards
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:43 +0000 (23:31 -0700)]
aacraid: Disable MSI mode for series 6, 7, 8 cards

As the firmware for series 6, 7, 8 cards does not support msi, remove it
in the driver

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Relinquish CPU during timeout wait
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:26 +0000 (23:31 -0700)]
aacraid: Relinquish CPU during timeout wait

aac_fib_send has a special function case for initial commands during
driver initialization using wait < 0(pseudo sync mode). In this case,
the command does not sleep but rather spins checking for timeout.This
loop is calls cpu_relax() in an attempt to allow other processes/threads
to use the CPU, but this function does not relinquish the CPU and so the
command will hog the processor. This was observed in a KDUMP
"crashkernel" and that prevented the "command thread" (which is
responsible for completing the command from being timed out) from
starting because it could not get the CPU.

Fixed by replacing "cpu_relax()" call with "schedule()"
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Start adapter after updating number of MSIX vectors
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:12 +0000 (23:31 -0700)]
aacraid: Start adapter after updating number of MSIX vectors

The adapter has to be started after updating the number of MSIX Vectors

Fixes: ecc479e00db8 (aacraid: Set correct MSIX count for EEH recovery)
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Fix incorrectly named MACRO
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:03 +0000 (23:31 -0700)]
aacraid: Fix incorrectly named MACRO

Suggested-by: Seymour, Shane M <shane.seymour@hpe.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: Removed unnecessary checks for NULL
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:30:55 +0000 (23:30 -0700)]
aacraid: Removed unnecessary checks for NULL

Current driver checks for NULL return from aac_fib_alloc_tag, but it not
possible for it to return NULL.

Fixed by: Remove all the checks for NULL returns from aac_fib_alloc_tag

Suggested-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomptsas: fix checks for dma mapping errors
Alexey Khoroshilov [Fri, 15 Apr 2016 23:12:29 +0000 (02:12 +0300)]
mptsas: fix checks for dma mapping errors

mptsas_smp_handler() checks for dma mapping errors by comparison
returned address with zero, while pci_dma_mapping_error() should be
used.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoMAINTAINERS: Update the file list for the NCR 5380 entry
Finn Thain [Sat, 23 Apr 2016 02:20:07 +0000 (12:20 +1000)]
MAINTAINERS: Update the file list for the NCR 5380 entry

The file atari_NCR5380.c has been removed from the tree so remove it
from the MAINTAINERS file as well.

While we are here, add the file dtc3x80.txt as it is only relevant to
the dtc driver.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agost: clear ILI if Medium Error
Kai Makisara [Mon, 18 Apr 2016 05:47:18 +0000 (08:47 +0300)]
st: clear ILI if Medium Error

Some drives set the ILI flag together with MEDIUM ERROR sense code.
Clear the ILI flag in this case so that the medium error will be
handled.  The problem was reported by Maurizio Lombardi.

Signed-off-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: remove incorrect lockdep assertion
Sebastian Herbszt [Sun, 17 Apr 2016 11:27:27 +0000 (13:27 +0200)]
lpfc: remove incorrect lockdep assertion

Remove incorrect lockdep assertion from lpfc_sli_hbqbuf_find() which
acquires the hbalock itself. Fix the comment which resulted in this
mistake.

Fixes: 1c2ba475eb0e ("lpfc: Add lockdep assertions")
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2i: silence uninitialized variable warnings
Dan Carpenter [Thu, 14 Apr 2016 09:40:06 +0000 (12:40 +0300)]
bnx2i: silence uninitialized variable warnings

Presumably it isn't possible to have empty lists here, but my static
checker doesn't know that and complains that "ep" can be used
uninitialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohpsa: set the enclosure identifier to zero
Dan Carpenter [Thu, 14 Apr 2016 09:37:44 +0000 (12:37 +0300)]
hpsa: set the enclosure identifier to zero

This has only called from show_sas_rphy_enclosure_identifier().  The
caller expects that we set an identifier, otherwise it uses an
uninitialized variable.

[mkp: fixed typo]

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agompt3sas - remove unused fw_event_work elements
Joe Lawrence [Mon, 18 Apr 2016 14:50:12 +0000 (10:50 -0400)]
mpt3sas - remove unused fw_event_work elements

Firmware events are queued up using the fw_event_work's struct work, not
its delayed_work member.  The initial driver for SAS2 controllers had
handled firmware reset using the rescan barrier and was later redesigned
through "mpt2sas: [Resend] Host Reset code cleanup".  The delayed_work
variables are now unused and may provoke CONFIG_DEBUG_OBJECTS_TIMERS
"assert_init not available" false warnings in
_scsih_fw_event_cleanup_queue.

Cleanup fw_event_work's unused entries, update its kerneldoc, and
update _scsih_fw_event_cleanup_queue accordingly.

Fixes: 146b16c8071f (mpt3sas: Refcount fw_events and fix unsafe list usage)
Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: add alloc_dev_quirk_v2_hw()
John Garry [Fri, 15 Apr 2016 13:36:38 +0000 (21:36 +0800)]
hisi_sas: add alloc_dev_quirk_v2_hw()

Add custom version of function to allocate device,
alloc_dev_quirk_v2_hw().  For sata devices the device id bit0 should be
0.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: add slot_index_alloc_quirk_v2_hw()
John Garry [Fri, 15 Apr 2016 13:36:37 +0000 (21:36 +0800)]
hisi_sas: add slot_index_alloc_quirk_v2_hw()

Add v2 hw custom function slot_index_alloc_quirk_v2_hw().  SAS devices
should have IPTT bit0 equal to 1.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: add device and slot alloc hw methods
John Garry [Fri, 15 Apr 2016 13:36:36 +0000 (21:36 +0800)]
hisi_sas: add device and slot alloc hw methods

Add methods to use HW specific versions of functions to allocate slot
and device.  HW specific methods are permitted to workaround device id
vs IPTT collision issue in v2 hw.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomegaraid_sas: driver version upgrade
Sumit Saxena [Fri, 15 Apr 2016 07:23:33 +0000 (00:23 -0700)]
megaraid_sas: driver version upgrade

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomegaraid_sas: task management code optimizations
Sumit Saxena [Fri, 15 Apr 2016 07:23:32 +0000 (00:23 -0700)]
megaraid_sas: task management code optimizations

This patch will do code optmization for task management functions.
Below are key changes:

1. Remove reset_device hook as it was not being used and driver was
setting this to NULL.

2. Create wrapper functions for task abort and target reset and inside
   these functions adapter specific calls be made. e.g. fusion adapters
   support task abort and target reset so task abort and target reset
   should be issued to fusion adapters only and for MFI adapters, print
   a message saying feature not supported.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomegaraid_sas: call ISR function to clean up pending replies in OCR path
Sumit Saxena [Fri, 15 Apr 2016 07:23:31 +0000 (00:23 -0700)]
megaraid_sas: call ISR function to clean up pending replies in OCR path

In OCR path, before calling chip reset calls function
megasas_wait_for_outstanding_fusion to check reason for OCR. In case of
firmware FAULT initiated OCR and DCMD timeout initiated timeout, driver
will clear any outstanding reply (yet to be processed by driver) in
reply queues before going for chip reset. This code is added to handle a
scenario when IO timeout initiated adapter reset and management
application initiated adapter reset (by sending command to FAULT
firmware) happens simultaneously since adapter reset function is
safe-guarded by reset_mutex so only thread will be doing controller
reset. Consider IO timeout thread gets mutex and proceeds with adapter
reset process after disabling interrupts and by the time management
application has fired command to firmware to do adapter reset and the
same command is completed by firmware but since interrupts are disabled,
driver will not get completion and the same command will be in
outstanding/pending commands list of driver and refires same command
from IO timeout thread after chip reset which will again FAULT firmware
and eventually causes kill adapter.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomegaraid_sas: reduce memory footprints in kdump mode
Sumit Saxena [Fri, 15 Apr 2016 07:23:30 +0000 (00:23 -0700)]
megaraid_sas: reduce memory footprints in kdump mode

This patch will reduce memory footprints of megaraid_sas driver when
booted in kdump mode.  Driver will not allocate memory for optional and
perfromance oriented features.  Below are key changes done in
megaraid_sas driver to do this:

1. Limit Controller's queue depth to 100 in kdump mode.

2. Do not allocate memory for system info buffer and PD info buffer.

3. Disable performance oriented features e.g. Disable RDPQ mode, disable
   dual queue depth, restrict to single MSI-x vector.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: Declare local functions static
Bart Van Assche [Thu, 14 Apr 2016 17:27:14 +0000 (10:27 -0700)]
scsi_dh_alua: Declare local functions static

This patch avoids that building with W=1 causes gcc to report the
following type of warning:

    no previous prototype for ... [-Wmissing-prototypes]

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agompt3sas: Remove usage of 'struct timeval'
Tina Ruchandani [Wed, 13 Apr 2016 07:01:40 +0000 (00:01 -0700)]
mpt3sas: Remove usage of 'struct timeval'

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

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agopm80xx: Remove bogus address masking in pm8001_ioremap()
David Daney [Wed, 13 Apr 2016 21:26:56 +0000 (14:26 -0700)]
pm80xx: Remove bogus address masking in pm8001_ioremap()

It is unclear what the original intent of the masking was, but it is
clearly incorrect to truncate a physical address before calling
ioremap().  On systems where there are valid physical address bits above
bit-31 (arm64 for example) the result is an eventual OOPs when
initializing the driver.

Remove the bogus code to fix it.

Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoqla2xxx: Remove use of 'struct timeval'
Tina Ruchandani [Mon, 25 Jan 2016 22:00:20 +0000 (23:00 +0100)]
qla2xxx: Remove use of 'struct timeval'

struct register_host_info stores a 64-bit UTC system time timestamp.
This patch removes the use of 'struct timeval' to obtain that timestamp
as its tv_sec value will overflow on 32-bit systems in year 2038 beyond.
The patch uses ktime_get_real_seconds() which returns a 64-bit seconds value.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: update driver version to 1.4
John Garry [Fri, 8 Apr 2016 09:23:15 +0000 (17:23 +0800)]
hisi_sas: update driver version to 1.4

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: for v2 hw only set ITCT qw2 for SAS device
John Garry [Fri, 8 Apr 2016 09:23:14 +0000 (17:23 +0800)]
hisi_sas: for v2 hw only set ITCT qw2 for SAS device

This patch fixes the ITCT table setup as it should be configured
differently for SAS and SATA devices.  For SATA disks there is no need
to set qw2 (already zeroed).  Also, link parameters for Bus inactive
limit, max connection time limit, and reject to open limit timers
parameters are changed to match global config register,
MAX_CON_TIME_LIMIT_TIME, as recommended by hw team.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: add v2 hw support for >4 SATA phys
John Garry [Fri, 8 Apr 2016 09:23:13 +0000 (17:23 +0800)]
hisi_sas: add v2 hw support for >4 SATA phys

This patch adds support for directly attaching SATA disks to phy
4-8. The problem was that only registers concerned with phy 0-3 were
being considered in sata_int_v2_hw().  The issue was not detected
previously as the development board only exposed phy 0-3; the new board
provides access to 8 phys.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: fix v2 hw multiple SATA disk issue
John Garry [Fri, 8 Apr 2016 09:23:12 +0000 (17:23 +0800)]
hisi_sas: fix v2 hw multiple SATA disk issue

Intermittently it is found that when multiple SATA disks are directly
connected to the host that some disks are not detected.  The problem is
that all set bitfields in ENT_INT_SRC1 are cleared for all phys in
sata_int_v2_hw() - it should clear the set bit for the phy being
serviced.

Also unnecessary double-write to ENT_INT_SRC1 and ENT_INT_SRC_MSK1 is
removed (remaining writes are done at end label).

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: use device linkrate in MCR for v2 hw
John Garry [Fri, 8 Apr 2016 09:23:11 +0000 (17:23 +0800)]
hisi_sas: use device linkrate in MCR for v2 hw

Contrary to the field name, the MCR (max connection rate) in the ITCT
should hold the device linkrate (linkrate of the connected phy), and not
the max linkrate.

This fixes an issue seen where some SATA drives connected through an
expander which would not attach.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c
Ming Lin [Mon, 4 Apr 2016 21:48:11 +0000 (14:48 -0700)]
lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c

Now it's ready to move the mempool based SG chained allocator code from
SCSI driver to lib/sg_pool.c, which will be compiled only based on a Kconfig
symbol CONFIG_SG_POOL.

SCSI selects CONFIG_SG_POOL.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS
Ming Lin [Mon, 4 Apr 2016 21:48:10 +0000 (14:48 -0700)]
scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS

Rename SCSI_MAX_SG_SEGMENTS to SG_CHUNK_SIZE, which means the amount
we fit into a single scatterlist chunk.

Rename SCSI_MAX_SG_CHAIN_SEGMENTS to SG_MAX_SEGMENTS.

Will move these 2 generic definitions to scatterlist.h later.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Bart Van Assche <bart.vanassche@sandisk.com> (for ib_srp changes)
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: rename SG related struct and functions
Ming Lin [Mon, 4 Apr 2016 21:48:09 +0000 (14:48 -0700)]
scsi: rename SG related struct and functions

Rename SCSI specific struct and functions to more genenic names.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Sagi Grimberg <sgi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: replace "mq" with "first_chunk" in SG functions
Ming Lin [Mon, 4 Apr 2016 21:48:08 +0000 (14:48 -0700)]
scsi: replace "mq" with "first_chunk" in SG functions

Parameter "bool mq" is block driver specific.
Change it to "first_chunk" to make it more generic.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: replace "scsi_data_buffer" with "sg_table" in SG functions
Ming Lin [Mon, 4 Apr 2016 21:48:07 +0000 (14:48 -0700)]
scsi: replace "scsi_data_buffer" with "sg_table" in SG functions

Replace parameter "struct scsi_data_buffer" with "struct sg_table" in
SG alloc/free functions to make them generic.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agozfcp: Revert to original scanning behaviour
Hannes Reinecke [Fri, 8 Apr 2016 06:14:54 +0000 (08:14 +0200)]
zfcp: Revert to original scanning behaviour

zfcp has its own mechanism for selective scanning, so revert to the
original scanning behaviour to not confuse users.

Fixes: 4e91e876e9b8b6eb4255aa0d690778a89d3f1d28
Suggested-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomvsas: Generalize Marvell 9485 in pci_device_id
Leonid Moiseichuk [Thu, 7 Apr 2016 18:52:25 +0000 (21:52 +0300)]
mvsas: Generalize Marvell 9485 in pci_device_id

Claim Marvell 9485 controllers regardless of subdevice ID.

Tested on ASUS P9A-I/C2550/SAS/4L which uses vendor-specific 1043:8635.

[mkp: Tweaked commit message]

Signed-off-by: Leonid Moiseichuk <leonid.moiseichuk@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2fc: Update version number to 2.10.3.
Chad Dupuis [Thu, 7 Apr 2016 13:08:00 +0000 (09:08 -0400)]
bnx2fc: Update version number to 2.10.3.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2fc: Check sc_cmd device and host pointer before returning the command to the...
Chad Dupuis [Thu, 7 Apr 2016 13:07:59 +0000 (09:07 -0400)]
bnx2fc: Check sc_cmd device and host pointer before returning the command to the mid-layer.

When we are in connection recovery and the internal command timer on a
request pops, either the scsi_cmnd->device or scsi_cmnd->device->host
back pointers may be NULL as the device that the command that the
request was submitted on may have been subsequently reaped due to the
connection recovery. This can cause one or both of the pointers above to
be NULL and cause a system crash if we try to return the command to the
midlayer.

Instead, double check the pointers before the return to the midlayer so
as to prevent the crash and let the upper layers finish the session
recovery and rediscover the device.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2fc: Print netdev device name when FCoE is successfully initialized.
Chad Dupuis [Thu, 7 Apr 2016 13:07:58 +0000 (09:07 -0400)]
bnx2fc: Print netdev device name when FCoE is successfully initialized.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2fc: Print when we send a fip keep alive.
Chad Dupuis [Thu, 7 Apr 2016 13:07:57 +0000 (09:07 -0400)]
bnx2fc: Print when we send a fip keep alive.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobnx2fc: Add driver tunables.
Joe Carnuccio [Thu, 7 Apr 2016 13:07:56 +0000 (09:07 -0400)]
bnx2fc: Add driver tunables.

Per customer request, add the following driver tunables:

o devloss_tmo
o max_luns
o queue_depth
o tm_timeout

tm_timeout is set per scsi_host in /sys/class/scsi_host/hostX/tm_timeout.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: vpd pages are mandatory for SPC-2
Hannes Reinecke [Fri, 1 Apr 2016 06:57:37 +0000 (08:57 +0200)]
scsi: vpd pages are mandatory for SPC-2

VPD pages 0x0 and 0x83 are mandatory even for SPC-2, so we should be
lowering the restriction to avoid having to whitelist every SPC-2
compliant device.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoRevert "scsi: fix soft lockup in scsi_remove_target() on module removal"
Johannes Thumshirn [Tue, 5 Apr 2016 09:50:45 +0000 (11:50 +0200)]
Revert "scsi: fix soft lockup in scsi_remove_target() on module removal"

Now that we've done a more comprehensive fix with the intermediate
target state we can remove the previous hack introduced with commit
90a88d6ef88e ("scsi: fix soft lockup in scsi_remove_target() on module
removal").

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: stable@vger.kernel.org
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: Add intermediate STARGET_REMOVE state to scsi_target_state
Johannes Thumshirn [Tue, 5 Apr 2016 09:50:44 +0000 (11:50 +0200)]
scsi: Add intermediate STARGET_REMOVE state to scsi_target_state

Add intermediate STARGET_REMOVE state to scsi_target_state to avoid
running into the BUG_ON() in scsi_target_reap(). The STARGET_REMOVE
state is only valid in the path from scsi_remove_target() to
scsi_target_destroy() indicating this target is going to be removed.

This re-fixes the problem introduced in commits bc3f02a795d3 ("[SCSI]
scsi_remove_target: fix softlockup regression on hot remove") and
40998193560d ("scsi: restart list search after unlock in
scsi_remove_target") in a more comprehensive way.

[mkp: Included James' fix for scsi_target_destroy()]

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Fixes: 40998193560dab6c3ce8d25f4fa58a23e252ef38
Cc: stable@vger.kernel.org
Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: James Bottomley <jejb@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: add scsi host after determining max IOs.
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:16 +0000 (00:51 -0700)]
snic: add scsi host after determining max IOs.

scsi host is added after negotiating the max number of IOs with
Firmware.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: Fixing race in the hba reset and IO/TM completion
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:15 +0000 (00:51 -0700)]
snic: Fixing race in the hba reset and IO/TM completion

While HBA reset is in progress, if IO/TM completion is received for the
same IO then IO/TM completion path releases the driver private resources
associated with IO. This fix prevents releasing the resources in
IO and TM completion path if HBA reset is in progress.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: Fix for missing interrupts
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:14 +0000 (00:51 -0700)]
snic: Fix for missing interrupts

- On posting an IO to the firmware, adapter generates an interrupt.
  Due to hardware issues, sometimes the adapter fails to generate
  the interrupt. This behavior skips updating transmit queue-
  counters, which in turn causes the queue full condition. The fix
  addresses the queue full condition.

- The fix also reserves a slot in transmit queue for hba reset.
  when queue full is observed during IO, there will always be room
  to post hba reset command.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: target cleanup in driver unload path
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:13 +0000 (00:51 -0700)]
snic: target cleanup in driver unload path

Fix deletes the snic targets synchronously prior to deletion of host.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: Handling control path queue issues
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:12 +0000 (00:51 -0700)]
snic: Handling control path queue issues

Fix handles control path queue issues such as queue full and sudden
removal of hardware.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: LUN goes offline due to scsi cmd timeouts
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:11 +0000 (00:51 -0700)]
snic: LUN goes offline due to scsi cmd timeouts

- LUN goes offline if there are at least two scsi command timeouts
  Completing the IO with scsi_done() fixes the issue.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agosnic: Added additional stats
Narsimhulu Musini [Thu, 17 Mar 2016 07:51:10 +0000 (00:51 -0700)]
snic: Added additional stats

Adding additional stats, and fixed logging messages.
- Added qdepth change stats
- Added separate isr stats for each type of interrupt
- Fixed race in updating active IOs
- Suppressed Link event message for DAS backend.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Update driver version to 11.1.0.0
James Smart [Thu, 31 Mar 2016 21:12:35 +0000 (14:12 -0700)]
lpfc: Update driver version to 11.1.0.0

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Update modified file copyrights
James Smart [Thu, 31 Mar 2016 21:12:34 +0000 (14:12 -0700)]
lpfc: Update modified file copyrights

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Fix interaction between fdmi_on and enable_SmartSAN
James Smart [Thu, 31 Mar 2016 21:12:33 +0000 (14:12 -0700)]
lpfc: Fix interaction between fdmi_on and enable_SmartSAN

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Add support for SmartSAN 2.0
James Smart [Thu, 31 Mar 2016 21:12:32 +0000 (14:12 -0700)]
lpfc: Add support for SmartSAN 2.0

Revise versions to reflect SmartSAN 2.0 support

RDP updated to support additional descriptors:
  Credit descriptor
  Optical Element Data descriptors for Temperature, Voltage,
        Bias current, TX power and TX power.
  Optical Product Data descriptor.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Fix Device discovery failures during switch reboot test.
James Smart [Thu, 31 Mar 2016 21:12:31 +0000 (14:12 -0700)]
lpfc: Fix Device discovery failures during switch reboot test.

When the switch is rebooted, the lpfc driver fails to log
into the fabric, and Unexpected timeout message is seen.

Fix: Do not issue RegVFI if the FLOGI was internally aborted.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Utilize embedded CDB logic to minimize IO latency
James Smart [Thu, 31 Mar 2016 21:12:30 +0000 (14:12 -0700)]
lpfc: Utilize embedded CDB logic to minimize IO latency

Pass cmd iu payloads inline to adapter job structure rather than as
separate dma buffers.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Fix crash when unregistering default rpi.
James Smart [Thu, 31 Mar 2016 21:12:29 +0000 (14:12 -0700)]
lpfc: Fix crash when unregistering default rpi.

The default rpi completion handler does back to back puts to force the
removal of the ndlp. This ends up calling lpfc_unreg_rpi after the
reference count is at 0.

Fix:  Check the reference count of the ndlp before getting the ref to
make sure we are not getting a reference on a removed object.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Fix DMA faults observed upon plugging loopback connector
James Smart [Thu, 31 Mar 2016 21:12:28 +0000 (14:12 -0700)]
lpfc: Fix DMA faults observed upon plugging loopback connector

Driver didn't program the REG_VFI mailbox correctly, giving the adapter
bad addresses.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolpfc: Correct LOGO handling during login
James Smart [Thu, 31 Mar 2016 21:12:27 +0000 (14:12 -0700)]
lpfc: Correct LOGO handling during login

After a link bounce, when a remote port issues a LOGO while a REGLOGIN
is pending on that port, the driver does not clean up the ndlp
structure. May result in stack traces in the console log.

Fix: Clear the NLP_REG_LOGIN_SEND flag on the ndlp in the routine

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_transport_iscsi: Declare local symbols static
Bart Van Assche [Wed, 30 Mar 2016 18:28:11 +0000 (11:28 -0700)]
scsi_transport_iscsi: Declare local symbols static

Avoid that building with W=1 causes gcc to report warnings about symbols
that have not been declared.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_transport_iscsi: Unexport iscsi_is_flashnode_conn_dev()
Bart Van Assche [Wed, 30 Mar 2016 18:27:47 +0000 (11:27 -0700)]
scsi_transport_iscsi: Unexport iscsi_is_flashnode_conn_dev()

The output of "git grep -nHw iscsi_is_flashnode_conn_dev" shows that
this function is only called from inside source file
drivers/scsi/scsi_transport_iscsi.c. Hence unexport this function.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_transport_iscsi: Remove set-but-not-used variables
Bart Van Assche [Wed, 30 Mar 2016 18:27:27 +0000 (11:27 -0700)]
scsi_transport_iscsi: Remove set-but-not-used variables

Avoid that building with W=1 causes gcc to report warnings about
set-but-not-used variables.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolibiscsi: Remove set-but-not-used variables
Bart Van Assche [Wed, 30 Mar 2016 18:27:08 +0000 (11:27 -0700)]
libiscsi: Remove set-but-not-used variables

Avoid that building with W=1 causes gcc to report warnings about
set-but-not-used variables.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agolibiscsi: Unexport iscsi_eh_target_reset()
Bart Van Assche [Wed, 30 Mar 2016 18:26:46 +0000 (11:26 -0700)]
libiscsi: Unexport iscsi_eh_target_reset()

Running "git grep -nHw iscsi_eh_target_reset" shows that this function
is only called from inside the drivers/scsi/libiscsi.c source
file. Hence unexport this function.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>