]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 years agonvme: Fixes u64 division which breaks i386 builds
Jon Derrick [Tue, 21 Jul 2015 21:08:13 +0000 (15:08 -0600)]
nvme: Fixes u64 division which breaks i386 builds

Uses div_u64 for u64 division and round_down, a bitwise operation,
instead of rounddown, which uses a modulus.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit c45f5c9943ce0b16b299b543c2aae12408039027)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoNVMe: Use CMB for the IO SQes if available
Jon Derrick [Mon, 20 Jul 2015 16:14:09 +0000 (10:14 -0600)]
NVMe: Use CMB for the IO SQes if available

Some controllers have a controller-side memory buffer available for use
for submissions, completions, lists, or data.

If a CMB is available, the entire CMB will be ioremapped and it will
attempt to map the IO SQes onto the CMB. The queues will be shrunk as
needed. The CMB will not be used if the queue depth is shrunk below some
threshold where it may have reduced performance over a larger queue
in system memory.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 8ffaadf7429270914b8f146ec13cf305e01df20d)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoNVMe: Unify SQ entry writing and doorbell ringing
Jon Derrick [Mon, 20 Jul 2015 16:14:08 +0000 (10:14 -0600)]
NVMe: Unify SQ entry writing and doorbell ringing

This patch changes sq_cmd writers to instead create their command on
the stack. __nvme_submit_cmd copies the sq entry to the queue and writes
the doorbell.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 498c43949c7b8f57e0afb8195019cf5a7ba72de0)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoNVMe: Reread partitions on metadata formats
Keith Busch [Tue, 14 Jul 2015 17:57:48 +0000 (11:57 -0600)]
NVMe: Reread partitions on metadata formats

This patch has the driver automatically reread partitions if a namespace
has a separate metadata format. Previously revalidating a disk was
sufficient to get the correct capacity set on such formatted drives,
but partitions that may exist would not have been surfaced.

Reported-by: Paul Grabinar <paul.grabinar@ranbarg.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Tested-by: Paul Grabinar <paul.grabinar@ranbarg.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 7bee607472aa2e5a36dfe143e5a625be06125f53)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoNVMe: Fix irq freeing when queue_request_irq fails
Jon Derrick [Tue, 30 Jun 2015 17:22:52 +0000 (11:22 -0600)]
NVMe: Fix irq freeing when queue_request_irq fails

Fixes an issue when queue_reuest_irq fails in nvme_setup_io_queues. This
patch initializes all vectors to -1 and resets the vector to -1 in the
case of a failure in queue_request_irq. This avoids the free_irq in
nvme_suspend_queue if the queue did not get an irq.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 758dd7fdffd60507624edce34fff122a63163b3f)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoNVMe: Memory barrier before queue_count is incremented
Jon Derrick [Wed, 27 May 2015 18:26:23 +0000 (12:26 -0600)]
NVMe: Memory barrier before queue_count is incremented

Protects against reordering and/or preempting which would allow the
kthread to access the queue descriptor before it is set up

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 36a7e993eedb2c3f11de3b686b351f75e1edbbb5)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agodrivers/block/nvme-core.c: fix build with gcc-4.4.4
Andrew Morton [Sat, 27 Jun 2015 18:20:34 +0000 (12:20 -0600)]
drivers/block/nvme-core.c: fix build with gcc-4.4.4

gcc-4.4.4 (and possibly other versions) fail the compile when initializers
are used with anonymous unions.  Work around this.

drivers/block/nvme-core.c: In function 'nvme_identify_ctrl':
drivers/block/nvme-core.c:1163: error: unknown field 'identify' specified in initializer
drivers/block/nvme-core.c:1163: warning: missing braces around initializer
drivers/block/nvme-core.c:1163: warning: (near initialization for 'c.<anonymous>')
drivers/block/nvme-core.c:1164: error: unknown field 'identify' specified in initializer
drivers/block/nvme-core.c:1164: warning: excess elements in struct initializer
drivers/block/nvme-core.c:1164: warning: (near initialization for 'c')
...

This patch has no effect on text size with gcc-4.8.2.

Fixes: d29ec8241c10eac ("nvme: submit internal commands through the block layer")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit e44ac588cd61c960226d61c379e2873a95544a51)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoblock: nvme-scsi: Catch kcalloc failure
Axel Lin [Sat, 20 Jun 2015 08:29:14 +0000 (16:29 +0800)]
block: nvme-scsi: Catch kcalloc failure

res variable was initialized to -ENOMEM, but it's override by
nvme_trans_copy_from_user(). So current code returns 0 if kcalloc fails.
Fix it to return proper error code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 51ef72bda70841fddd595142ed0e7e0fc571c500)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: submit internal commands through the block layer
Christoph Hellwig [Fri, 22 May 2015 09:12:46 +0000 (11:12 +0200)]
nvme: submit internal commands through the block layer

Use block layer queues with an internal cmd_type to submit internally
generated NVMe commands.  This both simplifies the code a lot and allow
for a better structure.  For example now the LighNVM code can construct
commands without knowing the details of the underlying I/O descriptors.
Or a future NVMe over network target could inject commands, as well as
could the SCSI translation and ioctl code be reused for such a beast.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit d29ec8241c10eacf59c23b3828a88dbae06e7e3f)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
Conflicts:
drivers/block/nvme-core.c

9 years agonvme: fail SCSI read/write command with unsupported protection bit
Christoph Hellwig [Fri, 22 May 2015 09:12:45 +0000 (11:12 +0200)]
nvme: fail SCSI read/write command with unsupported protection bit

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 772ce43559e076730ddff5907fabcb3485545e38)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: report the DPOFUA in MODE_SENSE
Christoph Hellwig [Fri, 22 May 2015 09:12:44 +0000 (11:12 +0200)]
nvme: report the DPOFUA in MODE_SENSE

NVMe device always support the FUA bit, and the SCSI translations
accepts the DPO bit, which doesn't have much of a meaning for us.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 908517684807f3b3d93893da78c7906f5ff2c49b)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: simplify and cleanup the READ/WRITE SCSI CDB parsing code
Christoph Hellwig [Fri, 22 May 2015 09:12:43 +0000 (11:12 +0200)]
nvme: simplify and cleanup the READ/WRITE SCSI CDB parsing code

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit cbbb7a2ec6001a0c15297c85184c9cc7fae5f11e)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: first round at deobsfucating the SCSI translation code
Christoph Hellwig [Fri, 22 May 2015 09:12:42 +0000 (11:12 +0200)]
nvme: first round at deobsfucating the SCSI translation code

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 3726897efde1d7a43b6f966ab81b0c143a176556)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: fix scsi translation error handling
Christoph Hellwig [Fri, 22 May 2015 09:12:41 +0000 (11:12 +0200)]
nvme: fix scsi translation error handling

Erorr handling for the scsi translation was completely broken, as there
were two different positive error number spaces overlapping.  Fix this
up by removing one of them, and centralizing the generation of the other
positive values in a single place.  Also fix up a few places that didn't
handle the NVMe error codes properly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit e61b0a86cac83c3bf501705c8d52a0a29cecf091)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: split nvme_trans_send_fw_cmd
Christoph Hellwig [Fri, 22 May 2015 09:12:40 +0000 (11:12 +0200)]
nvme: split nvme_trans_send_fw_cmd

This function handles two totally different opcodes, so split it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit b90c48d0c11efe373a42a60e66e2ac2a503c287b)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonvme: store a struct device pointer in struct nvme_dev
Christoph Hellwig [Fri, 22 May 2015 09:12:39 +0000 (11:12 +0200)]
nvme: store a struct device pointer in struct nvme_dev

Most users want the generic device, so store that in struct nvme_dev
instead of the pci_dev.  This also happens to be a nice step towards
making some code reusable for non-PCI transports.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit e75ec752d725b7b612c0b2db1bca50a9e53c0879)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
Conflicts:
drivers/block/nvme-core.c

9 years agonvme: consolidate synchronous command submission helpers
Christoph Hellwig [Fri, 22 May 2015 09:12:38 +0000 (11:12 +0200)]
nvme: consolidate synchronous command submission helpers

Note that we keep the unused timeout argument, but allow callers to
pass 0 instead of a timeout if they want the default.  This will allow
adding a timeout to the pass through path later on.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit f705f837c58ebe1ea69dfffff4dcc234e2fbc8dd)

Orabug: 22620486
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
Conflicts:
drivers/block/nvme-core.c

9 years agohpsa: correct check for disk and zbc devices
Petros Koutoupis [Fri, 6 May 2016 19:18:37 +0000 (12:18 -0700)]
hpsa: correct check for disk and zbc devices

The check added always skips over every device and the
ioaccel parameters are never set.

Reviewed-by: Justin Lindley <Justin.Lindley@microsemi.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: update driver version
Don Brace [Fri, 6 May 2016 19:18:17 +0000 (12:18 -0700)]
hpsa: update driver version

Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct handling of HBA device removal
Don Brace [Fri, 6 May 2016 19:17:57 +0000 (12:17 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct ioaccel2 error procecssing.
Don Brace [Fri, 6 May 2016 19:17:36 +0000 (12:17 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct ioaccel state change operation
Don Brace [Fri, 6 May 2016 19:17:16 +0000 (12:17 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add timeouts for driver initiated commands
Don Brace [Fri, 6 May 2016 19:16:56 +0000 (12:16 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add sas_address to sysfs device attibute
Joseph T Handzik [Fri, 6 May 2016 19:16:35 +0000 (12:16 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct initialization order issue
Don Brace [Fri, 6 May 2016 19:16:15 +0000 (12:16 -0700)]
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>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: update copyright information
Don Brace [Fri, 6 May 2016 19:15:55 +0000 (12:15 -0700)]
hpsa: update copyright information

Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add support for tagged queuing
Don Brace [Thu, 12 May 2016 18:13:07 +0000 (14:13 -0400)]
hpsa: add support for tagged queuing

Signed-off-by: Don Brace <don.brace@pmcs.com>
Orabug: 23064595
Signed-off-by: Manjunath <manjunath.govindashetty@oracle.com>
9 years agohpsa: check for a null phys_disk pointer in ioaccel2
Don Brace [Fri, 6 May 2016 19:15:14 +0000 (12:15 -0700)]
hpsa: check for a null phys_disk pointer in ioaccel2

 path

An oops can occur when submitting ioaccel2 commands when the phys_disk
pointer is NULL in hpsa_scsi_ioaccel_raid_map.  Happens when there are
configuration changes during I/O operations.

If the phys_disk pointer is NULL, send the command down the RAID path.

Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct abort tmf for hba devices
Don Brace [Fri, 6 May 2016 19:14:54 +0000 (12:14 -0700)]
hpsa: correct abort tmf for hba devices

Aborts were not being sent down to HBA devices

Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct lun data caching bitmap definition
Don Brace [Fri, 6 May 2016 19:14:34 +0000 (12:14 -0700)]
hpsa: correct lun data caching bitmap definition

The bitmap was changed after this definition was added to the
driver. Correcting the bitmap definition.

Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add SMR drive support
Don Brace [Fri, 6 May 2016 19:14:14 +0000 (12:14 -0700)]
hpsa: add SMR drive support

Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: do not get enclosure info for external devices
Don Brace [Fri, 6 May 2016 19:13:53 +0000 (12:13 -0700)]
hpsa: do not get enclosure info for external devices

Stop annoying "Error, could not get enclosure information"
messages.

Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: Add box and bay information for enclosure
Don Brace [Fri, 6 May 2016 19:13:33 +0000 (12:13 -0700)]
hpsa: Add box and bay information for enclosure

 devices

Adding a new method to display enclosure device information.

Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: Change SAS transport devices to bus 0.
Don Brace [Fri, 6 May 2016 19:13:13 +0000 (12:13 -0700)]
hpsa: Change SAS transport devices to bus 0.

SAS transport places devices on bus 0 but driver was setting the bus to
3.

Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix path_info_show
Don Brace [Fri, 6 May 2016 19:12:53 +0000 (12:12 -0700)]
hpsa: fix path_info_show

Left off some changes from Rasmus Villemoes where he changed snprintf to
scnprintf.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: logical vs bitwise AND typo
Dan Carpenter [Fri, 6 May 2016 19:12:32 +0000 (12:12 -0700)]
hpsa: logical vs bitwise AND typo

HPSA_DIAG_OPTS_DISABLE_RLD_CACHING is a mask and bitwise AND was
intended here instead of logical &&.  This bug is essentially harmless,
it means that sometimes we don't print a warning message which we wanted
to print.

Fixes: c2adae44e916 ('hpsa: disable report lun data caching')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agoscsi: use host wide tags by default
Christoph Hellwig [Fri, 6 May 2016 19:12:12 +0000 (12:12 -0700)]
scsi: use host wide tags by default

This patch changes the !blk-mq path to the same defaults as the blk-mq
I/O path by always enabling block tagging, and always using host wide
tags.  We've had blk-mq available for a few releases so bugs with
this mode should have been ironed out, and this ensures we get better
coverage of over tagging setup over different configs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: bump the driver version
Don Brace [Fri, 6 May 2016 19:11:52 +0000 (12:11 -0700)]
hpsa: bump the driver version

Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Gerry Morong <gerry.morong.pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add in sas transport class
Kevin Barnett [Fri, 6 May 2016 19:11:32 +0000 (12:11 -0700)]
hpsa: add in sas transport class

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix multiple issues in path_info_show
Rasmus Villemoes [Fri, 6 May 2016 19:11:09 +0000 (12:11 -0700)]
hpsa: fix multiple issues in path_info_show

path_info_show() seems to be broken in multiple ways.

First, there's

  817 return snprintf(buf, output_len+1, "%s%s%s%s%s%s%s%s",
  818       path[0], path[1], path[2], path[3],
  819       path[4], path[5], path[6], path[7]);

so hopefully output_len contains the combined length of the eight
strings. Otherwise, snprintf will stop copying to the output
buffer, but still end up reporting that combined length - which
in turn would result in user-space getting a bunch of useless nul
bytes (thankfully the upper sysfs layer seems to clear the output
buffer before passing it to the various ->show routines). But we have

  767      output_len = snprintf(path[i],
  768                       PATH_STRING_LEN, "[%d:%d:%d:%d] %20.20s ",
  769                       h->scsi_host->host_no,
  770                       hdev->bus, hdev->target, hdev->lun,
  771                       scsi_device_type(hdev->devtype));

so output_len at best contains the length of the last string printed.

Inside the loop, we then otherwise add to output_len. By magic,
we still have PATH_STRING_LEN available every time... This
wouldn't really be a problem if the bean-counting has been done
properly and each line actually does fit in 50 bytes, and maybe
it does, but I don't immediately see why. Suppose we end up
taking this branch:

  802                  output_len += snprintf(path[i] + output_len,
  803                          PATH_STRING_LEN,
  804                          "BOX: %hhu BAY: %hhu %s\n",
  805                          box, bay, active);

An optimistic estimate says this uses strlen("BOX: 1 BAY: 2
Active\n") which is 21. Now add the 20 bytes guaranteed by the
%20.20s and then some for the rest of that format string, and
we're easily over 50 bytes. I don't think we can get over 100
bytes even being pessimistic, so this just means we'll scribble
into the next path[i+1] and maybe get that overwritten later,
leading to some garbled output (in fact, since we'd overwrite the
previous string's 0-terminator, we could end up with one very
long string and then print various suffixes of that, leading to
much more than 400 bytes of output). Except of course when we're
filling path[7], where overrunning it means writing random stuff
to the kernel stack, which is usually a lot of fun.

We can fix all of that and get rid of the 400 byte stack buffer by
simply writing directly to the given output buffer, which the upper
layer guarantees is at least PAGE_SIZE. s[c]nprintf doesn't care where
it is writing to, so this doesn't make the spin lock hold time any
longer. Using scnprintf ensures that output_len always represents the
number of bytes actually written to the buffer, so we'll report the
proper amount to the upper layer.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: enhance device messages
Don Brace [Fri, 6 May 2016 19:10:47 +0000 (12:10 -0700)]
hpsa: enhance device messages

Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: disable report lun data caching
Scott Teel [Fri, 6 May 2016 19:10:20 +0000 (12:10 -0700)]
hpsa: disable report lun data caching

When external target arrays are present, disable the firmware's
normal behavior of returning a cached copy of the report lun data,
and force it to collect new data each time we request a report luns.

This is necessary for external arrays, since there may be no
reliable signal from the external array to the smart array when
lun configuration changes, and thus when driver requests
report luns, it may be stale data.

Use diag options to turn off RPL data caching.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add discovery polling for PT RAID devices.
Scott Teel [Fri, 6 May 2016 19:09:59 +0000 (12:09 -0700)]
hpsa: add discovery polling for PT RAID devices.

There are problems with getting configuration change notification
in pass-through RAID environments.  So, activate flag
h->discovery_polling when one of these devices is detected in
update_scsi_devices.

After discovery_polling is set, execute a report luns from
rescan_controller_worker (every 30 seconds).

If the data from report_luns is different than last
time (binary compare), execute a full rescan via update_scsi_devices.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: eliminate fake lun0 enclosures
Scott Teel [Fri, 6 May 2016 19:09:39 +0000 (12:09 -0700)]
hpsa: eliminate fake lun0 enclosures

We don't need to create fake enclosure devices at Lun0
in external target array configurations anymore.
This was done to support Pre-SCSI rev 5 controllers
that didn't suppoprt report luns commands, so the
SCSI layer had to scan targets. If there was no
LUN at LUN 0, then the target scan would stop, and
move to the next target.  Lun0 enclosure device
was added to prevent sparsely-numbered LUNs from
being missed.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: generalize external arrays
Scott Teel [Fri, 6 May 2016 19:09:19 +0000 (12:09 -0700)]
hpsa: generalize external arrays

External array LUNs must use target and lun numbers assigned by the
external array. So the driver must treat these differently from
local LUNs when assigning lun/target.

LUN's 'model' field has been used to detect Lun types that need
special treatment, but the desire is to eliminate the need to reference
specific array models, and support any external array.

Pass-through RAID (PTRAID) luns are not luns of the local controller,
so they are not reported in LUN count of command 'ID controller'.
However, they ARE reported in "Report logical Luns" command.
Local luns are listed first, then PTRAID LUNs.

The number of luns from "Report LUNs" in excess of those reported by
'ID controller' are therefore the PTRAID LUNS.

We can now remove function is_ext_target, and the 'white list'
array of supported model names.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: move scsi_add_device and scsi_remove_device
Kevin Barnett [Fri, 6 May 2016 19:08:59 +0000 (12:08 -0700)]
hpsa: move scsi_add_device and scsi_remove_device

 calls to new function

preparation for adding the sas transport class

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: refactor hpsa_figure_bus_target_lun
Kevin Barnett [Fri, 6 May 2016 19:08:38 +0000 (12:08 -0700)]
hpsa: refactor hpsa_figure_bus_target_lun

setup for sas transport. Need to set the
bus and target accordingly.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: enhance hpsa_get_device_id
Don Brace [Fri, 6 May 2016 19:08:18 +0000 (12:08 -0700)]
hpsa: enhance hpsa_get_device_id

use an index into vpd data for SAS/SATA drives

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add function is_logical_device
Kevin Barnett [Fri, 6 May 2016 19:07:58 +0000 (12:07 -0700)]
hpsa: add function is_logical_device

simplify checking for logical/physical devices

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: simplify update scsi devices
Kevin Barnett [Fri, 6 May 2016 19:07:38 +0000 (12:07 -0700)]
hpsa: simplify update scsi devices

remove repeated calculation that checks for physical
or logical devices.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: simplify check for device exposure
Kevin Barnett [Fri, 6 May 2016 19:07:17 +0000 (12:07 -0700)]
hpsa: simplify check for device exposure

remove macros and cleanup device exposure checking

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct ioaccel2 sg chain len
Don Brace [Fri, 6 May 2016 19:06:57 +0000 (12:06 -0700)]
hpsa: correct ioaccel2 sg chain len

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct check for non-disk devices
Don Brace [Fri, 6 May 2016 19:06:37 +0000 (12:06 -0700)]
hpsa: correct check for non-disk devices

The driver is using two MACROs which seemingly are looking in
the wrong location for the device_flags returned from
CISS_REPORT_PHYS. Both MACROs, NON_DISK_PHYS_DEV and
PHYS_IOACCEL, are using the pointer returned from figure_lunaddrbytes
which is the address of the LUN.lunid element in
the extended CISS_REPORT_PHYS.  But the MACROS are using offsets
beyond the range of the element (offset 17 of an 8 byte element).

These MACROs actually are looking at the correct location but
they fail static checker analysis. It also will not work
if any new elements are added to the extended LUN structure.

Change the code to use the structure elements directly
since this MACRO is only used in one location.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix physical target reset
Scott Teel [Fri, 6 May 2016 19:06:17 +0000 (12:06 -0700)]
hpsa: fix physical target reset

Set reset type in device_reset_handler to do either
logical unit reset for logical devices, or physical
target reset, for physical devices.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix hpsa_adjust_hpsa_scsi_table
Don Brace [Fri, 6 May 2016 19:05:56 +0000 (12:05 -0700)]
hpsa: fix hpsa_adjust_hpsa_scsi_table

Fix a NULL pointer issue in the driver when devices are removed
during a reset.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct transfer length for 6 byte read/write
Don Brace [Fri, 6 May 2016 19:05:36 +0000 (12:05 -0700)]
hpsa: correct transfer length for 6 byte read/write

 commands

handle block counts of 0. Cleanup block and block count calculations.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: abandon rescans on memory alloaction failures.
Don Brace [Fri, 6 May 2016 19:05:16 +0000 (12:05 -0700)]
hpsa: abandon rescans on memory alloaction failures.

Abandon and reschedule rescan process only if device inquiries
fail due to mem alloc failures, which are likely to occur for
all devices.

Otherwise, skip device if inquiry fails for other reasons,
and continue rescanning process for other devices.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: allow driver requested rescans
Don Brace [Fri, 6 May 2016 19:04:56 +0000 (12:04 -0700)]
hpsa: allow driver requested rescans

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by; Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix null device issues
Don Brace [Fri, 6 May 2016 19:04:35 +0000 (12:04 -0700)]
hpsa: fix null device issues

Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: check for null arguments to dev_printk
Don Brace [Fri, 6 May 2016 19:04:15 +0000 (12:04 -0700)]
hpsa: check for null arguments to dev_printk

Check for NULLs.

Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: change devtype to unsigned
Don Brace [Fri, 6 May 2016 19:03:55 +0000 (12:03 -0700)]
hpsa: change devtype to unsigned

This member is used in calls to scsi_device_type.
It should be unsigned since the kernel checks for upper bounds
and it should never be negative.

Suggested-by: Tomas Henzl <thenzl@redhat.com>
Suggested-by: Hannes Reinecke <hare@suse.de>
Suggested-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: remove unused hpsa_tag_discard_error_bits
Don Brace [Fri, 6 May 2016 19:03:35 +0000 (12:03 -0700)]
hpsa: remove unused hpsa_tag_discard_error_bits

This function is no longer used.

Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: stop zeroing reset_cmds_out and
Don Brace [Fri, 6 May 2016 19:03:14 +0000 (12:03 -0700)]
hpsa: stop zeroing reset_cmds_out and

 ioaccel_cmds_out during rescan

pulling the rug out from under the reset handler
likewise for ioaccel_cmds_out

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: remove unused parameter hostno
Don Brace [Fri, 6 May 2016 19:02:54 +0000 (12:02 -0700)]
hpsa: remove unused parameter hostno

This parameter was once used before scan_start was defined
but now it is no longer used.

Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: add in new offline mode
Scott Benesh [Fri, 6 May 2016 19:02:34 +0000 (12:02 -0700)]
hpsa: add in new offline mode

prevent adding volumes that are not available.

Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agoChange how controllers in mixed mode are handled.
Kevin Barnett [Fri, 6 May 2016 19:02:14 +0000 (12:02 -0700)]
Change how controllers in mixed mode are handled.

Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: update controller names
Don Brace [Fri, 6 May 2016 19:01:53 +0000 (12:01 -0700)]
hpsa: update controller names

replace PM8068/69 with actual names

Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: fix an sprintf() overflow in the reset handler
Dan Carpenter [Fri, 6 May 2016 19:01:33 +0000 (12:01 -0700)]
hpsa: fix an sprintf() overflow in the reset handler

The string "cmd %d RESET FAILED, new lockup detected" is not quite
large enough so the sprintf() will overflow.  I have increased the size
of the buffer and also changed the sprintf calls to snprintf.

Fixes: 73153fe533bc ('hpsa: use block layer tag for command allocation')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agohpsa: correct white spaces
Don Brace [Fri, 6 May 2016 19:01:13 +0000 (12:01 -0700)]
hpsa: correct white spaces

helps eliminate a diff between kernel.org and uek driver

Signed-off-by: Don Brace <don.brace@microsemi.com>
Orabug: 23064595
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobnx2x: Fix VLANs null-pointer for 57710, 57711
Yuval Mintz [Sun, 15 Nov 2015 13:02:16 +0000 (15:02 +0200)]
bnx2x: Fix VLANs null-pointer for 57710, 57711

Orabug: 23092424

Commit 05cc5a39ddb7 "bnx2x: add vlan filtering offload" introduced
a regression in regard for vlans for 57710, 57711 adapters -
Loading 8021q module on a machine with such an adapter would cause
a null pointer dereference, as the driver mistakenly publishes it
has capabilities for vlan CTAG filtering.

Reported-by: Otto Sabart <osabart@redhat.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ab6d7846cf80affc43b9d412fed5e25dfcf4f35d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agofnic: Leftshift returned scsi_cmnd error code 16 bits
Jason Luo [Thu, 17 Mar 2016 04:06:07 +0000 (12:06 +0800)]
fnic: Leftshift returned scsi_cmnd error code 16 bits

From: Satish Kharat <satishkh@cisco.com>

The the scsi_cmnd error code is expected to be in the left 16 bits
of the result field. Change is to correct this.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Orabug: 22918200
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agofnic: Setting scsi host template to indicate that fnic does not support multiqueue
Jason Luo [Thu, 17 Mar 2016 04:00:56 +0000 (12:00 +0800)]
fnic: Setting scsi host template to indicate that fnic does not support multiqueue

From: Satish Kharat <satishkh@cisco.com>

Fnic does not support mutiqueue. Setting the scsi_host_template in
fnic_host_template to indicate that.

Changing fnic_version from 1.6.0.21 to 1.6.0.22

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Orabug: 22918200
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agofnic: Using rport-_dd_data to check rport online instead of rport_lookup
Jason Luo [Thu, 17 Mar 2016 03:29:50 +0000 (11:29 +0800)]
fnic: Using rport-_dd_data to check rport online instead of rport_lookup

From: Satish Kharat <satishkh@cisco.com>

When issuing I/O we check if rport is online through libfc
rport_lookup() function which needs to be protected by mutex lock
that cannot acquired in I/O context. The change is to use midlayer
remote port’s dd_data which is preserved until its devloss timeout
and no protection is required.

Fnic driver version changed from 1.6.0.20 to 1.6.0.21

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Orabug: 22918200
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agofnic: Cleanup the I_O that has timed out and is used to issue LUN reset
Jason Luo [Thu, 17 Mar 2016 03:14:24 +0000 (11:14 +0800)]
fnic: Cleanup the I_O that has timed out and is used to issue LUN reset

From: Satish Kharat <satishkh@cisco.com>

In case of LUN reset, the device reset command is issued with one of
the I/Os that has timed out on that LUN. The change is to also return
this I/O with error status set to DID_RESET.
Fnic driver version changed from 1.6.0.19 to 1.6.0.20

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Orabug: 22918200
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agofnic: Fix to cleanup aborted IO to avoid device being offlined by mid-layer
Jason Luo [Thu, 17 Mar 2016 02:59:23 +0000 (10:59 +0800)]
fnic: Fix to cleanup aborted IO to avoid device being offlined by mid-layer

From: Satish Kharat <satishkh@cisco.com>

If an I/O times out and an abort issued by host, if the abort is
successful we need to set scsi status as DID_ABORT. Or else the
mid-layer error handler which looks for this error code, will
offline the device. Also if the original I/O is not found in fnic
firmware, we will consider the abort as successful.
Fnic driver version changed from 1.6.0.17a to 1.6.0.19,
version 1.6.0.18 has been skipped

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Orabug: 22918200
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohpsa: move lockup_detected attribute to host attr
Tomas Henzl [Fri, 6 Nov 2015 15:24:09 +0000 (16:24 +0100)]
hpsa: move lockup_detected attribute to host attr

This patch fixes a 'general protection fault' issue by
moving the attribute to where it was likely meant.

Orabug: 22930824

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mainline v4.4 commit fb53c439d84387621c53808a3957ffd9876e5094
Signed-off-by: Guru Anbalagane <guru.anbalagane@oracle.com>
9 years agomegaraid_sas: Add an i/o barrier
Tomas Henzl [Mon, 1 Feb 2016 14:12:04 +0000 (15:12 +0100)]
megaraid_sas: Add an i/o barrier

Orabug: 22620626

A barrier should be added to ensure proper ordering of memory mapped
writes.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
Acked-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b99dbe56d511eb07de33bfa1b99ac5a6ff76ae08)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug : 22620626
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agomegaraid_sas: Fix SMAP issue
Sumit Saxena [Thu, 28 Jan 2016 15:44:26 +0000 (21:14 +0530)]
megaraid_sas: Fix SMAP issue

Orabug: 22620626

Inside compat IOCTL hook of driver, driver was using wrong address of
ioc->frame.raw which leads sense_ioc_ptr to be calculated wrongly and
failing IOCTL.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ea1c928bb6051ec4ccf24826898aa2361eaa71e5)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Fix for IO failing post OCR in SRIOV environment
Sumit Saxena [Thu, 28 Jan 2016 15:44:25 +0000 (21:14 +0530)]
megaraid_sas: Fix for IO failing post OCR in SRIOV environment

Orabug: 22620626

Driver assumes that VFs always have peers present whenever they have
same LD IDs. But this is not the case.  This patch handles the above
mentioned by explicitly checking for a peer before making HA/non-HA path
decision.

Signed-off-by: Uday Lingala <uday.lingala@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8f67c8c518f324874e8caf93d1f4468d25754333)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid: fix null pointer check in megasas_detach_one().
Maurizio Lombardi [Fri, 22 Jan 2016 12:41:42 +0000 (13:41 +0100)]
megaraid: fix null pointer check in megasas_detach_one().

Orabug: 22620626

The pd_seq_sync pointer can't be NULL, we have to check its entries
instead.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 546e559c79b1a8d27c23262907a00fc209e392a0)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: driver version upgrade
Sumit Saxena [Thu, 28 Jan 2016 15:34:36 +0000 (21:04 +0530)]
megaraid_sas: driver version upgrade

Orabug: 22620626

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d92ca9d3de862cb123d7ef0fd42dc1e9867dd590)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: SPERC OCR changes
Sumit Saxena [Thu, 28 Jan 2016 15:34:35 +0000 (21:04 +0530)]
megaraid_sas: SPERC OCR changes

Orabug: 22620626

This patch fixes online controller resets on SRIOV-enabled series of
Avago controllers.

1) Remove late detection heartbeat.

2) Change in the behavior if the FW found in READY/OPERATIONAL state.

Signed-off-by: Uday Lingala <uday.lingala@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 3885c26b773750bf2e7e071a5b0b72f079196d60)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Introduce module parameter for SCSI command timeout
Sumit Saxena [Thu, 28 Jan 2016 15:34:34 +0000 (21:04 +0530)]
megaraid_sas: Introduce module parameter for SCSI command timeout

Orabug: 22620626

This patch will introduce module-parameter for SCSI command timeout
value and fix setting of resetwaittime beyond a value.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e3d178ca773ff997c6c94989d0b14a2c0eae761c)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: MFI adapter OCR changes
Sumit Saxena [Thu, 28 Jan 2016 15:34:33 +0000 (21:04 +0530)]
megaraid_sas: MFI adapter OCR changes

Orabug: 22620626

Optimized MFI adapters' OCR path, particularly
megasas_wait_for_outstanding() function.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ccc7507de27a639c9e1327d6e56ef1f357962b09)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Make adprecovery variable atomic
Sumit Saxena [Thu, 28 Jan 2016 15:34:32 +0000 (21:04 +0530)]
megaraid_sas: Make adprecovery variable atomic

Orabug: 22620626

Make instance->adprecovery variable atomic and removes hba_lock spinlock
while accessing instance->adprecovery.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8a01a41d864771fbc3cfc80a9629e06189479cce)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: IO throttling support
Sumit Saxena [Thu, 28 Jan 2016 15:34:31 +0000 (21:04 +0530)]
megaraid_sas: IO throttling support

Orabug: 22620626

This patch will add capability in driver to tell firmware that it can
throttle IOs in case controller's queue depth is downgraded post OFU
(online firmware upgrade). This feature will ensure firmware can be
downgraded from higher queue depth to lower queue depth without needing
system reboot. Added throttling code in IO path of driver, in case OS
tries to send more IOs than post OFU firmware's queue depth.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 52b62ac7c66e1a11eb8b3e3b0212847749af3b2d)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Dual queue depth support
Sumit Saxena [Thu, 28 Jan 2016 15:34:30 +0000 (21:04 +0530)]
megaraid_sas: Dual queue depth support

Orabug: 22620626

1. For iMR controllers, firmware will report two queue depths:

   - Controller-wide queue depth
   - LDIO queue depth (240)

Controller-wide queue depth will be greater among the two. Using this
new feature, iMR can provide larger Queue depth(QD) for JBOD and limited
QD for Virtual Disk(VD).

2. megaraid_sas driver will throttle read/write LDIOs based on "LDIO
Queue Depth".

3. Dual queue depth can be enabled/disabled via module parameter. It is
enabled by default if the firmware supports it. Only specific firmware
builds will enable the feature.

4. Added sysfs parameter "ldio_outstanding" which permits querying the
number of outstanding LDIO requests at runtime.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 308ec459bc1975d9856cfeb3d1cd6461794a3976)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Code optimization build_and_issue_cmd return-type
Sumit Saxena [Thu, 28 Jan 2016 15:34:29 +0000 (21:04 +0530)]
megaraid_sas: Code optimization build_and_issue_cmd return-type

Orabug: 22620626

build_and_issue_cmd should return SCSI_MLQUEUE_HOST_BUSY for a few error
cases instead of returning 1.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit f9a9dee6a1fd8570884a0ab6f19c6b5cca05bd49)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Reply Descriptor Post Queue (RDPQ) support
Sumit Saxena [Thu, 28 Jan 2016 15:34:28 +0000 (21:04 +0530)]
megaraid_sas: Reply Descriptor Post Queue (RDPQ) support

Orabug: 22620626

This patch will create a reply queue pool for each MSI-X index and will
provide an array of base addresses instead of the single address of
legacy mode. Using this new interface the driver can support higher
queue depths through scattered DMA pools.

If array mode is not supported driver will fall back to the legacy
method of reply pool allocation. This limits controller queue depth to
1K max. To enable a queue depth of more than 1K driver requires firmware
to support array mode and scratch_pad3 will provide the new queue depth
value.

When RDPQ is used, downgrading to an older firmware release should not
be permitted. This may cause firmware fault and is not supported.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 179ac14291a0e1cf8c2b2dfedce7c5af66696cc9)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Fastpath region lock bypass
Sumit Saxena [Thu, 28 Jan 2016 15:34:27 +0000 (21:04 +0530)]
megaraid_sas: Fastpath region lock bypass

Orabug: 22620626

Firmware will fill out per-LD data to tell driver whether a particular
LD supports region lock bypass. If yes, then driver will send non-FP
LDIO to region lock bypass FIFO. With this change in driver, firmware
will optimize certain code to improve performance.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8f05024cd3dbd3ec85923f3e8da05bf6db187d57)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Update device queue depth based on interface type
Sumit Saxena [Thu, 28 Jan 2016 15:34:26 +0000 (21:04 +0530)]
megaraid_sas: Update device queue depth based on interface type

Orabug: 22620626

This patch will update device Queue depth based on interface type(SAS,
SATA..) for sysPDs.  For Virtual disks(VDs), there will be no change in
queue depth (will remain 256).  To fetch interface type (SAS or SATA or
FC..) of syspD, driver will send DCMD MR_DCMD_PD_GET_INFO.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2216c30523b0a1835b6d522ffe73ca167f199f00)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Task management support
Sumit Saxena [Thu, 28 Jan 2016 15:34:25 +0000 (21:04 +0530)]
megaraid_sas: Task management support

Orabug: 22620626

This patch adds task management for SCSI commands. Added functions are
task abort and target reset.

1. Currently, megaraid_sas driver performs controller reset when any IO
times out.  With task management support added, task abort and target
reset will be tried to recover timed out IO. If task management fails,
then controller reset will be performaned. If the task management
request times out, fail the request and escalate to the next
level (controller reset).

2. mr_device_priv_data will be allocated for all generations of
controller, but is_tm_capable flag will never be set for
controllers (prior to Invader series) as firmware support is not
available for task management.

3. Task management capable firmware will set is_tm_capable flag in
firmware API.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 18365b138508bfbce0405f9904639fa3b7caf3c9)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Syncing request flags macro names with firmware
Sumit Saxena [Thu, 28 Jan 2016 15:34:24 +0000 (21:04 +0530)]
megaraid_sas: Syncing request flags macro names with firmware

Orabug: 22620626

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2c048351c8e3e2b90b3c8b9dea3ee1b709853a9d)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: MFI IO timeout handling
Sumit Saxena [Thu, 28 Jan 2016 15:34:23 +0000 (21:04 +0530)]
megaraid_sas: MFI IO timeout handling

Orabug: 22620626

This patch will do proper error handling for DCMD timeout failure cases
for Fusion adapters:

1. For MFI adapters, in case of DCMD timeout (DCMD which must return
SUCCESS) driver will call kill adapter.

2. What action needs to be taken in case of DCMD timeout is decided by
function dcmd_timeout_ocr_possible().  DCMD timeout causing OCR is
applicable to the following commands:

MR_DCMD_PD_LIST_QUERY
MR_DCMD_LD_GET_LIST
MR_DCMD_LD_LIST_QUERY
MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS
MR_DCMD_SYSTEM_PD_MAP_GET_INFO
MR_DCMD_LD_MAP_GET_INFO

3. If DCMD fails from driver init path there are certain DCMDs which
must return SUCCESS. If those DCMDs fail, driver bails out. For optional
DCMDs like pd_info etc., driver continues without executing certain
functionality.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6d40afbc7d13359b30a5cd783e3db6ebefa5f40a)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Do not allow PCI access during OCR
Sumit Saxena [Thu, 28 Jan 2016 15:34:22 +0000 (21:04 +0530)]
megaraid_sas: Do not allow PCI access during OCR

Orabug: 22620626

This patch will do synhronization between OCR function and AEN function
using "reset_mutex" lock.  reset_mutex will be acquired only in the
first half of the AEN function which issues a DCMD. Second half of the
function which calls SCSI API (scsi_add_device/scsi_remove_device)
should be out of reset_mutex to avoid deadlock between scsi_eh thread
and driver.

During chip reset (inside OCR function), there should not be any PCI
access and AEN function (which is called in delayed context) may be
firing DCMDs (doing PCI writes) when chip reset is happening in parallel
which will cause FW fault. This patch will solve the problem by making
AEN thread and OCR thread mutually exclusive.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 11c71cb4ab7cd901b9d6f0ff267c102778c1c8ef)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid: Fix possible NULL pointer deference in mraid_mm_ioctl
Nicholas Krause [Tue, 5 Jan 2016 19:32:54 +0000 (14:32 -0500)]
megaraid: Fix possible NULL pointer deference in mraid_mm_ioctl

Orabug: 22620626

This adds the needed check after the call to the function
mraid_mm_alloc_kioc in order to make sure that this function has not
returned NULL and therefore makes sure we do not deference a NULL
pointer if one is returned by mraid_mm_alloc_kioc.  Further more add
needed comments explaining that this function call can return NULL if
the list head is empty for the pointer passed in order to allow furture
users to understand this required pointer check.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 7296f62f0322d808362b21064deb34f20799c20d)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Fix sparse warning
Sumit Saxena [Thu, 5 Nov 2015 15:47:38 +0000 (21:17 +0530)]
megaraid_sas: Fix sparse warning

Orabug: 22620626

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 9fb74c4e66daab5c3fb3b949d37c15684d7ee82a)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas: Make tape drives visible on PERC5 controllers
Sumit Saxena [Thu, 5 Nov 2015 15:47:37 +0000 (21:17 +0530)]
megaraid_sas: Make tape drives visible on PERC5 controllers

Orabug: 22620626

The DELL PERC5 controller firmware does not list tape drives in response
to MR_DCMD_PD_LIST_QUERY. This causes tape drives not be exposed to the
OS when connected to a PERC5 controller.

This patch permits detection of tape drives connected to a PERC5
controller by exposing non-TYPE_DISK devices unconditionally.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit aed335eecf8f09c28588b01c7f7e24ee78156e28)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas : Remove debug print from function megasas_update_span_set
sumit.saxena@avagotech.com [Thu, 15 Oct 2015 08:11:14 +0000 (13:41 +0530)]
megaraid_sas : Remove debug print from function megasas_update_span_set

Orabug: 22620626

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c8051156d1d3dd99d02e0bf5b127fc8d32f30f69)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agomegaraid_sas : Driver version upgrade
sumit.saxena@avagotech.com [Thu, 15 Oct 2015 08:11:04 +0000 (13:41 +0530)]
megaraid_sas : Driver version upgrade

Orabug: 22620626

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit afb2b5ddac9f3727983030bc4450e9e3b5956b2a)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>