]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/log
mirror_ubuntu-bionic-kernel.git
6 years agoscsi: hptiop: Simplify reset handling
Hannes Reinecke [Fri, 25 Aug 2017 11:57:04 +0000 (13:57 +0200)]
scsi: hptiop: Simplify reset handling

The Highpoint driver only has one reset function, and that is a host
reset. So stop pretending we're doing anything else.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bfa: move bus reset to target reset
Hannes Reinecke [Fri, 25 Aug 2017 11:57:03 +0000 (13:57 +0200)]
scsi: bfa: move bus reset to target reset

The bus reset handler is just calling target reset on all targets, which
is exactly what SCSI EH will be doing anyway.  So move the bus reset
function to target reset and drop the loop.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: libsas: move bus_reset_handler() to target_reset_handler()
Hannes Reinecke [Fri, 25 Aug 2017 11:57:02 +0000 (13:57 +0200)]
scsi: libsas: move bus_reset_handler() to target_reset_handler()

The bus reset handler is calling I_T Nexus reset, which logically is a
target reset as it need to specify both the initiator and the target.
So move it to target reset.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: uas: move eh_bus_reset_handler to eh_device_reset_handler
Hannes Reinecke [Fri, 25 Aug 2017 11:57:01 +0000 (13:57 +0200)]
scsi: uas: move eh_bus_reset_handler to eh_device_reset_handler

The bus_reset handler is really a device reset, so move it to
eh_device_reset_handler().

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fnic: do not call host reset from command abort
Hannes Reinecke [Fri, 25 Aug 2017 11:57:00 +0000 (13:57 +0200)]
scsi: fnic: do not call host reset from command abort

Command abort already returns FAILED, which will then be escalated to a
host reset. So no need to call host_reset directly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fc_fcp: do not call fc_block_scsi_eh() from host reset
Hannes Reinecke [Fri, 25 Aug 2017 11:56:59 +0000 (13:56 +0200)]
scsi: fc_fcp: do not call fc_block_scsi_eh() from host reset

When calling host reset we're resetting all ports anyway, so there is no
point in waiting for the ports to become unblocked.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ibmvfc: Do not call fc_block_scsi_eh() on host reset
Hannes Reinecke [Fri, 25 Aug 2017 11:56:58 +0000 (13:56 +0200)]
scsi: ibmvfc: Do not call fc_block_scsi_eh() on host reset

When we're resetting the host any remote port states will be reset
anyway, so it's pointless to wait for dev_loss_tmo during host reset.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: mptfc: Do not call fc_block_scsi_eh() on host reset
Hannes Reinecke [Fri, 25 Aug 2017 11:56:57 +0000 (13:56 +0200)]
scsi: mptfc: Do not call fc_block_scsi_eh() on host reset

When we're resetting the host any remote port states will be reset
anyway, so it's pointless to wait for dev_loss_tmo during host reset.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fix comment in scsi_device_set_state()
Hannes Reinecke [Fri, 25 Aug 2017 11:56:56 +0000 (13:56 +0200)]
scsi: fix comment in scsi_device_set_state()

The function returns '0' if successful; with the original comment
the function doesn't have a way to indicate success ...

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart van Assche <bvanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: iscsi_tcp: Remove a set-but-not-used variable
Bart Van Assche [Fri, 25 Aug 2017 20:46:43 +0000 (13:46 -0700)]
scsi: iscsi_tcp: Remove a set-but-not-used variable

This patch avoids that gcc reports the following warning when
building with W=1:

drivers/scsi/iscsi_tcp.c:166:24: warning: variable ?session? set but not used [-Wunused-but-set-variable]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Lee Duncan <lduncan@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: scsi_debug: Remove a set-but-not-used variable
Bart Van Assche [Fri, 25 Aug 2017 20:46:42 +0000 (13:46 -0700)]
scsi: scsi_debug: Remove a set-but-not-used variable

This patch avoids that gcc reports the following warning when
building with W=1:

drivers/scsi/scsi_debug.c:2264:15: warning: variable ?pcontrol? set but not used [-Wunused-but-set-variable]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: scsi_transport_srp: Suppress a W=1 compiler warning
Bart Van Assche [Fri, 25 Aug 2017 20:46:41 +0000 (13:46 -0700)]
scsi: scsi_transport_srp: Suppress a W=1 compiler warning

Avoid that the following compiler warning is reported when building
with W=1:

drivers/scsi/scsi_transport_srp.c:92:19: warning: comparison is always false due to limited range of data type [-Wtype-limits]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: scsi_transport_sas: Check kzalloc() return value
Bart Van Assche [Fri, 25 Aug 2017 20:46:40 +0000 (13:46 -0700)]
scsi: scsi_transport_sas: Check kzalloc() return value

Check whether memory allocation succeeded before dereferencing
the pointer to the allocated memory.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: libsas: Annotate fall-through in a switch statement
Bart Van Assche [Fri, 25 Aug 2017 20:46:39 +0000 (13:46 -0700)]
scsi: libsas: Annotate fall-through in a switch statement

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: libsas: Remove a set-but-not-used variable
Bart Van Assche [Fri, 25 Aug 2017 20:46:38 +0000 (13:46 -0700)]
scsi: libsas: Remove a set-but-not-used variable

This was detected by building with W=1.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: libiscsi: Fix indentation
Bart Van Assche [Fri, 25 Aug 2017 20:46:37 +0000 (13:46 -0700)]
scsi: libiscsi: Fix indentation

This patch avoids that smatch reports the following:

drivers/scsi/libiscsi.c:1081: iscsi_handle_reject() warn: inconsistent indenting

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sg: Fix type of last blk_trace_setup() argument
Bart Van Assche [Fri, 25 Aug 2017 20:46:36 +0000 (13:46 -0700)]
scsi: sg: Fix type of last blk_trace_setup() argument

Avoid that sparse reports the following:

drivers/scsi/sg.c:1114:41: warning: incorrect type in argument 5 (different address spaces)
drivers/scsi/sg.c:1114:41:    expected char [noderef] <asn:1>*arg
drivers/scsi/sg.c:1114:41:    got char *<noident>

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sd: Remove a useless comparison
Bart Van Assche [Fri, 25 Aug 2017 20:46:35 +0000 (13:46 -0700)]
scsi: sd: Remove a useless comparison

This patch avoids that gcc reports the following warning when
building with W=1:

drivers/scsi/sd.c:315:10: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
  if (val >= 0 && val <= T10_PI_TYPE3_PROTECTION)

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sd: Fix indentation
Bart Van Assche [Fri, 25 Aug 2017 20:46:34 +0000 (13:46 -0700)]
scsi: sd: Fix indentation

This patch avoids that smatch reports the following:

drivers/scsi/sd.c:3540: sd_suspend_common() warn: inconsistent indenting

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sd: sr: Convert two assignments into warning statements
Bart Van Assche [Fri, 25 Aug 2017 20:46:33 +0000 (13:46 -0700)]
scsi: sd: sr: Convert two assignments into warning statements

Before scsi_prep_fn() calls the ULP .init_command() callback
function it stores the SCSI command pointer in request.special.
This means that the SCpnt = rq->special assignments in the sd
and sr drivers assign a pointer to itself. Hence convert these
two assignment statements into warning statements.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer
Bart Van Assche [Fri, 25 Aug 2017 20:46:32 +0000 (13:46 -0700)]
scsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer

Since commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as
part of struct request") struct request and struct scsi_cmnd are
adjacent. This means that there is now an alternative to reading
req->special to convert a pointer to a prepared request into a
SCSI command pointer, namely by using blk_mq_rq_to_pdu(). Make
this change where appropriate. Although this patch does not
change any functionality, it slightly improves performance and
slightly improves readability.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Document which queue type a function is intended for
Bart Van Assche [Fri, 25 Aug 2017 20:46:31 +0000 (13:46 -0700)]
scsi: Document which queue type a function is intended for

Rename several functions to make it easy to see which queue type a
function is intended for.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Convert a strncmp() call into a strcmp() call
Bart Van Assche [Fri, 25 Aug 2017 20:46:30 +0000 (13:46 -0700)]
scsi: Convert a strncmp() call into a strcmp() call

This patch avoids that smatch reports the following warning:

drivers/scsi/scsi_sysfs.c:117: check_set() error: strncmp() '"-"' too small (2 vs 20)

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Suppress gcc 7 fall-through warnings reported with W=1
Bart Van Assche [Fri, 25 Aug 2017 20:46:29 +0000 (13:46 -0700)]
scsi: Suppress gcc 7 fall-through warnings reported with W=1

The conclusion of a recent discussion about the new warnings
reported by gcc 7 is that the new warnings reported when building
with W=1 should be suppressed. However, gcc 7 still warns about
fall-through in switch statements when building with W=1. Suppress
these warnings by annotating the SCSI core properly.

See also Linus Torvalds, Lots of new warnings with gcc-7.1.1, 11
July 2017 (https://www.mail-archive.com/linux-media@vger.kernel.org/msg115428.html).

References: commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Avoid sign extension of scsi_device.type
Bart Van Assche [Fri, 25 Aug 2017 20:46:28 +0000 (13:46 -0700)]
scsi: Avoid sign extension of scsi_device.type

This patch avoids that smatch reports the following:

drivers/scsi/scsi_sysfs.c:506 scsi_bus_uevent() warn: argument 3 to %02x specifier has type 'char'
drivers/scsi/scsi_sysfs.c:872 sdev_show_modalias() warn: argument 4 to %02x specifier has type 'char'

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Remove an obsolete function declaration
Bart Van Assche [Fri, 25 Aug 2017 20:46:27 +0000 (13:46 -0700)]
scsi: Remove an obsolete function declaration

Commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as part of
struct request") removed the scsi_get_command() function. Hence also
remove the declaration of that function.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ufs: reqs and tasks were put in the wrong order
Zang Leigang [Thu, 24 Aug 2017 02:57:15 +0000 (10:57 +0800)]
scsi: ufs: reqs and tasks were put in the wrong order

Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: lpfc version bump 11.4.0.3
Dick Kennedy [Wed, 23 Aug 2017 23:55:49 +0000 (16:55 -0700)]
scsi: lpfc: lpfc version bump 11.4.0.3

Update driver version to 11.4.0.3

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: fix "integer constant too large" error on 32bit archs
Maurizio Lombardi [Wed, 23 Aug 2017 23:55:48 +0000 (16:55 -0700)]
scsi: lpfc: fix "integer constant too large" error on 32bit archs

cc1: warnings being treated as errors
drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_get_wwpn':
drivers/scsi/lpfc/lpfc_init.c:3253: error: integer constant is too large for 'long' type

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Add Buffer to Buffer credit recovery support
James Smart [Wed, 23 Aug 2017 23:55:47 +0000 (16:55 -0700)]
scsi: lpfc: Add Buffer to Buffer credit recovery support

Add Buffer to buffer credit recovery support to the driver.  This is a
negotiated feature with the peer that allows for both sides to detect
dropped RRDY's and FC Frames and recover credit.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: remove console log clutter
James Smart [Wed, 23 Aug 2017 23:55:46 +0000 (16:55 -0700)]
scsi: lpfc: remove console log clutter

Change hw queue binding messages to info - not error.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix bad sgl reposting after 2nd adapter reset
Dick Kennedy [Wed, 23 Aug 2017 23:55:45 +0000 (16:55 -0700)]
scsi: lpfc: Fix bad sgl reposting after 2nd adapter reset

Port issue was fixed, the hbacmd reset would take more than 8 minutes to
complete.

There were conflicting NVME SGL posting/reposting responsibilities
between lpfc_online()/lpfc_sli4_hba_setup() and
lpfc_nvme_create_localport().  The lpfc_online() causes a REPOST on
existing NVME SGLs which is not released during the fc port reset.
However, lpfc_nvme_create_localport() wants to allocate new NVME buffers
and post them. Both cancelled out each other which had a side effect of
hosing the mailbox handling that was used to remove the sgl lists -
causing multiple 60s mbx timeouts.

Fix by preserving all SGL lists over the fc port reset.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix nvme target failure after 2nd adapter reset
Dick Kennedy [Wed, 23 Aug 2017 23:55:44 +0000 (16:55 -0700)]
scsi: lpfc: Fix nvme target failure after 2nd adapter reset

The nonrecovery occurred because the lpfc nvme initiator function did
not reestablish its localport creation with the nvme host transport in
lpfc_oneline.  Because of that, an NVME rport binding could not take
place.

Corrected by recreating the localport in the adapter reset recovery
routine.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix relative offset error on large nvmet target ios
Dick Kennedy [Wed, 23 Aug 2017 23:55:43 +0000 (16:55 -0700)]
scsi: lpfc: Fix relative offset error on large nvmet target ios

If the nvmet_fc transport breaks an io into multiple sequences, the
driver will improperly set the relative offset on the 2nd through N
sequences.

Correct by properly formatting the hw cmd so the relative offset is
picked up from the hw cmd.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix MRQ > 1 context list handling
Dick Kennedy [Wed, 23 Aug 2017 23:55:42 +0000 (16:55 -0700)]
scsi: lpfc: Fix MRQ > 1 context list handling

Various oops including cpu LOCKUPs were seen.

For asynchronously received ius where the driver must assign exchange
resources, the resources were on a single get (free) list and put list
(finished, waiting to be put on get list). As all cpus are sharing the
lists, an interrupt for a receive frame may have to wait for all the
other cpus to place their done work onto the put list before it can
acquire the lock to pull from the list.

Fix by breaking the resource lists into per-cpu lists or at least more
than 1 list with cpu's sharing the lists). A cpu would allocate from the
free list for its own cpu, and put its done work on the its own put list
- avoiding the contention. As cpu load may vary, when empty, a cpu may
grab from another cpu, thereby changing resource distribution.  But
searching for a resource only occurs on 1 or a few cpus until a single
resource can be allocated. if the condition reoccurs, it starts looking
at a different cpu.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Limit amount of work processed in IRQ
Dick Kennedy [Wed, 23 Aug 2017 23:55:41 +0000 (16:55 -0700)]
scsi: lpfc: Limit amount of work processed in IRQ

Various oops being seen on being in the ISR too long and cpu lockups,
when under heavy load.

The amount of work being posted off of completion queues kept the ISR
running almost all the time

Correct the issue by limiting the amount of work per iteration.

[mkp: typo]

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Correct issues with FAWWN and FDISCs
Dick Kennedy [Wed, 23 Aug 2017 23:55:40 +0000 (16:55 -0700)]
scsi: lpfc: Correct issues with FAWWN and FDISCs

When using fabric-assigned WWNs, the switch doesn't like copy of the
FLOGI payload, which includes valid VVL bits, to be used as the FDISC
payload.

Rather than wait for corrected switch firmware, ensure the VVL bits are
marked invalid on FDISCs.

[mkp: typo]

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix NVME PRLI handling during RSCN
Dick Kennedy [Wed, 23 Aug 2017 23:55:39 +0000 (16:55 -0700)]
scsi: lpfc: Fix NVME PRLI handling during RSCN

A race condition was found whereby the initiator would receive the RSCN
for a new NVME device before it had a chance to register its FC4 support
with the fabric. Thus, when queried by the initiator, it would see that
the target supported FC-NVME.

Corrected by making the assumption that the target always supports
FC-NVME thus a PRLI is sent. It's ok for the target to reject it.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix crash in lpfc nvmet when fc port is reset
Dick Kennedy [Wed, 23 Aug 2017 23:55:38 +0000 (16:55 -0700)]
scsi: lpfc: Fix crash in lpfc nvmet when fc port is reset

In adapter reset tests, an oops was seen with a NULL pointer in
lpfc_free_rq_buffer+0x20/0x60

The driver is failing to properly repost the nvmet sgl list when
recovering from the reset. Thus the driver eventually trys to walk an
errant buffer list.

Corrected the sgl buffer recovery as well as strengthening the
initialization of the bufferlist.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix duplicate NVME rport entries and namespaces.
Dick Kennedy [Wed, 23 Aug 2017 23:55:37 +0000 (16:55 -0700)]
scsi: lpfc: Fix duplicate NVME rport entries and namespaces.

After lip, the driver sometimes would have two rports for the same
device, allowing the namespaces to be duplicated by nvme.

In lpfc_plogi_confirm_nport() the driver was not swapping the nrport
maintained by the ndlp's undergoing address swapping. This allowed the
2nd rport to sneak in as it was considered a separate device.

This patch adds the fixes to Swap the nrport in each ndlp and take care
of the reference counts on the ndlps similar to FCP rports.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topology
Dick Kennedy [Wed, 23 Aug 2017 23:55:36 +0000 (16:55 -0700)]
scsi: lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topology

After link bounce in a NVME Pt2Pt config, the driver managed to map the
same nport twice, resulting in multiple device nodes for the same
namespace.

In Pt2Pt, the driver must send PRLI's for both (scsi) FCP and NVME
rather than using fabric aids. The driver was inconsistent on handling
various PRLI completions, especially rejects, which had reject codes
cross the different protocol PRLI completions.

Fixed to perform the following: if nvmet mode (fc port can only be a
nvme target) - rejects all unsolicitly FCP PRLI's. Never issues a FCP
PRLI.

The multiple protocol PRLI's are sent simultaneously. However, driver
will now only state transition after both PRLI's are complete. New flags
were added to aid tracking the responses from the different PRLI's.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Correct return error codes to align with nvme_fc transport
Dick Kennedy [Wed, 23 Aug 2017 23:55:35 +0000 (16:55 -0700)]
scsi: lpfc: Correct return error codes to align with nvme_fc transport

Modify driver return error codes to align with host nvme transport.

Driver isn't returning Exxx error codes to properly reflect out of
resource or connectivity conditions (-EBUSY), yet there were hard error
conditions returning -EBUSY.

Ensure the following situations return the proper return code:

 - Temporary failures or temporary resource availability: -EBUSY

 - Connectivity issues: -ENODEV

All others are treated as hard errors and return an -Exxx value that
indicates the type of error.

Also, lpfc_sli4_issue_wqe() was modified to not translate error from
-Exxx to WQE state.  This allows lpfc_nvme_fcp_io_submit() routine to
just return whatever -E value was returned from other routines.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: convert info messages to standard messages
Dick Kennedy [Wed, 23 Aug 2017 23:55:34 +0000 (16:55 -0700)]
scsi: lpfc: convert info messages to standard messages

Transitioned some informational discovery messages to now always be
displayed when log_verbose is set.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix oops when NVME Target is discovered in a nonNVME environment
Dick Kennedy [Wed, 23 Aug 2017 23:55:33 +0000 (16:55 -0700)]
scsi: lpfc: Fix oops when NVME Target is discovered in a nonNVME environment

lpfc oops when it discovers a NVME target but is configured for SCSI
only operation. Oops is in lpfc_nvme_register_port+0x33/0x300.

The localport is not valid so it should not have been referenced.

Added validity check for localport

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix rediscovery on switch blade pull
Dick Kennedy [Wed, 23 Aug 2017 23:55:32 +0000 (16:55 -0700)]
scsi: lpfc: Fix rediscovery on switch blade pull

When the switch blade is pulled out then plugged back in, the driver
does not issue a PLOGI to the target

When the switch blade is pulled out, it does not reset the link. The
driver ends up issuing a LOGO to the target, and finally sees devloss.
Since the driver believes that a LOGO is outstanding, it does not issue
a PLOGI to the target upon link up

Correct by placing the ndlp in UNUSED state When devloss happens in
LOGO_ISSUE state.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix loop mode target discovery
Dick Kennedy [Wed, 23 Aug 2017 23:55:31 +0000 (16:55 -0700)]
scsi: lpfc: Fix loop mode target discovery

The driver does not discover targets when in loop mode.

The NLP type is correctly getting set when a fabric connection is
detected but, not for loop. The unknown NLP type means that the driver
does not issue a PRLI when in loop topology. Thus target discovery
fails.

Fix by checking the topology during discovery.  If it is loop, set the
NLP FC4 type to FCP.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix plogi collision that causes illegal state transition
Dick Kennedy [Wed, 23 Aug 2017 23:55:30 +0000 (16:55 -0700)]
scsi: lpfc: Fix plogi collision that causes illegal state transition

Message "0271 Illegal State Transition: node" seen in logs, all luns are
unuseable for that target.

A window exists in the rcv_plogi path where if the state is plogi issue
but the driver has not issued a plogi, then two reglogins will be sent
for the same RPI. The first one to complete will advance the state to
prli issue the second one will be detected as an illegal state, and
leave the node in an unusable state.

Correct the completion routine for the PLOGI ACC that detects the state
change when the driver starts discovery on the node again and drop the
REGLOGIN mailbox command.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Update driver version to 10.00.00.01-k
himanshu.madhani@cavium.com [Wed, 23 Aug 2017 22:05:25 +0000 (15:05 -0700)]
scsi: qla2xxx: Update driver version to 10.00.00.01-k

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Do not call abort handler function during chip reset
Sawan Chandak [Wed, 23 Aug 2017 22:05:24 +0000 (15:05 -0700)]
scsi: qla2xxx: Do not call abort handler function during chip reset

If there are IO's running and host reset or chip reset is triggered,
IO's can fail due to rport time out. During chip reset recovery process,
driver notifies the transport layer that remote port no longer exist, by
calling fc_remote_port_delete(). When this function is called, it
actually delays deletion by "blocking" it. It sets the remote port state
to "FC_PORTSTATE_BLOCKED" and sets FC_RPORT_DEVLOSS_PENDING.  When
driver tries to abort the command by calling its abort handler function,
abort handler will wait until remote port state is blocked state or wait
for dev_loss_tmo time. Due to this blocking, rport times out and results
in an IO failure. This patch adds a check for any active reset process
before calling abort handler function.

[mkp: typo]

Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Ability to process multiple SGEs in Command SGL for CT passthrough...
Giridhar Malavali [Wed, 23 Aug 2017 22:05:23 +0000 (15:05 -0700)]
scsi: qla2xxx: Ability to process multiple SGEs in Command SGL for CT passthrough commands.

Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Skip zero queue count entry during FW dump capture
Joe Carnuccio [Wed, 23 Aug 2017 22:05:22 +0000 (15:05 -0700)]
scsi: qla2xxx: Skip zero queue count entry during FW dump capture

If queue count is zero while reading FW dump template, for entry
T263/T274, skip capturing those entries during FW dump capture.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Recheck session state after RSCN
Quinn Tran [Wed, 23 Aug 2017 22:05:21 +0000 (15:05 -0700)]
scsi: qla2xxx: Recheck session state after RSCN

When RSCN is delivered for specific remote port. Use ADISC to verify the
session is still valid or not.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Increase ql2xmaxqdepth to 64
Michael Hernandez [Wed, 23 Aug 2017 22:05:20 +0000 (15:05 -0700)]
scsi: qla2xxx: Increase ql2xmaxqdepth to 64

ql2xmaxqdepth is the module parameter that seeds the per target
queue depth in the Scsi midlayer (sdev->queue_depth). Performance
testing revealed that increasing this value would improve IOPS
numbers under certain workloads.

Signed-off-by: Michael Hernandez <michael.hernandez@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Enable Async TMF processing
himanshu.madhani@cavium.com [Wed, 23 Aug 2017 22:05:19 +0000 (15:05 -0700)]
scsi: qla2xxx: Enable Async TMF processing

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Cleanup NPIV host in target mode during config teardown
Quinn Tran [Wed, 23 Aug 2017 22:05:18 +0000 (15:05 -0700)]
scsi: qla2xxx: Cleanup NPIV host in target mode during config teardown

When we tear down the NPIV host configuration in target mode, the
qla_tgt struct was left dangling on the global list. This patch cleans
up link list and frees memory.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add LR distance support from nvram bit
Joe Carnuccio [Wed, 23 Aug 2017 22:05:17 +0000 (15:05 -0700)]
scsi: qla2xxx: Add LR distance support from nvram bit

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add support for minimum link speed
Sawan Chandak [Wed, 23 Aug 2017 22:05:16 +0000 (15:05 -0700)]
scsi: qla2xxx: Add support for minimum link speed

Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Remove potential macro parameter side-effect in ql_dump_regs()
Joe Carnuccio [Wed, 23 Aug 2017 22:05:15 +0000 (15:05 -0700)]
scsi: qla2xxx: Remove potential macro parameter side-effect in ql_dump_regs()

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Print correct mailbox registers in failed summary
Joe Carnuccio [Wed, 23 Aug 2017 22:05:14 +0000 (15:05 -0700)]
scsi: qla2xxx: Print correct mailbox registers in failed summary

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Fix task mgmt handling for NPIV
Quinn Tran [Wed, 23 Aug 2017 22:05:13 +0000 (15:05 -0700)]
scsi: qla2xxx: Fix task mgmt handling for NPIV

Fix task management response for NPIV Target mode.
Current code uses the wrong vp index.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Allow SNS fabric login to be retried
Joe Carnuccio [Wed, 23 Aug 2017 22:05:12 +0000 (15:05 -0700)]
scsi: qla2xxx: Allow SNS fabric login to be retried

If SNS fabric login fails, set loop resync flag to retry via dpc.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add timeout ability to wait_for_sess_deletion().
Joe Carnuccio [Wed, 23 Aug 2017 22:05:11 +0000 (15:05 -0700)]
scsi: qla2xxx: Add timeout ability to wait_for_sess_deletion().

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Move logging default mask to execute once only.
Joe Carnuccio [Wed, 23 Aug 2017 22:05:10 +0000 (15:05 -0700)]
scsi: qla2xxx: Move logging default mask to execute once only.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Use sp->free instead of hard coded call.
Joe Carnuccio [Wed, 23 Aug 2017 22:05:09 +0000 (15:05 -0700)]
scsi: qla2xxx: Use sp->free instead of hard coded call.

Calling sp->free() ensures the context-correct free routine is called.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Prevent sp->free null/uninitialized pointer dereference.
Joe Carnuccio [Wed, 23 Aug 2017 22:05:08 +0000 (15:05 -0700)]
scsi: qla2xxx: Prevent sp->free null/uninitialized pointer dereference.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add ability to autodetect SFP type
Quinn Tran [Wed, 23 Aug 2017 22:05:07 +0000 (15:05 -0700)]
scsi: qla2xxx: Add ability to autodetect SFP type

SFP can come in 2 formats: short range/SR and long range/LR.  For LR,
user the can increase the number of Buffer to Buffer credits between end
points via Cavium's command line tool.  By default, FW uses a lower BB
Credit value optimized for SR.  This patch will read the SFP for each
link up event and during chip reset sequence. If the SFP type and
setting are mismatch, then the chip is reset 1 time to use the
appropriate setting.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Use fabric name for Get Port Speed command
Quinn Tran [Wed, 23 Aug 2017 22:05:06 +0000 (15:05 -0700)]
scsi: qla2xxx: Use fabric name for Get Port Speed command

The Get Port Speed switch command needs the fabric port name of the
remote device.  Current code uses the registered WWPN.

Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable@vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Change ha->wq max_active value to default
Quinn Tran [Wed, 23 Aug 2017 22:05:05 +0000 (15:05 -0700)]
scsi: qla2xxx: Change ha->wq max_active value to default

Update ha->wq max_active from 1 to default. MQ interrupts are queued up
via this work queue. This allows interrupts to be process in parrallel,
instead of serialized by the work queue.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Remove extra register read
Quinn Tran [Wed, 23 Aug 2017 22:05:04 +0000 (15:05 -0700)]
scsi: qla2xxx: Remove extra register read

Remove extra register read for each interrupt for performance
improvement.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Fix NPIV host enable after chip reset
Quinn Tran [Wed, 23 Aug 2017 22:05:03 +0000 (15:05 -0700)]
scsi: qla2xxx: Fix NPIV host enable after chip reset

For NPIV ports, call configure_hba() so that NPIV ports can proceed to
loop initialization.

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Use BIT_6 to acquire FAWWPN from switch
Sawan Chandak [Wed, 23 Aug 2017 22:05:02 +0000 (15:05 -0700)]
scsi: qla2xxx: Use BIT_6 to acquire FAWWPN from switch

If FA-WWPN feature disabled on the switch side and enabled for the
adapter, then driver would update the port name with switch port name.

This patch fixes issue by checking correct BIT flag to validate.

Fixes: 41dc529a4602 ("qla2xxx: Improve RSCN handling in driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Fix system panic due to pointer access problem
Duane Grigsby [Wed, 23 Aug 2017 22:05:01 +0000 (15:05 -0700)]
scsi: qla2xxx: Fix system panic due to pointer access problem

[ 1013.772926] BUG: unable to handle kernel paging request at 0000000300000020
[ 1013.772950] IP: qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx]
[ 1013.772951] PGD 0
[ 1013.772952] P4D 0
[ 1013.772952]
[ 1013.772953] Oops: 0000 [#1] SMP
[ 1013.772955] Modules linked in: qla2xxx(+) scsi_transport_fc nvme_fc
nvme_fabrics nvme_core netconsole configfs af_packet iscsi_ibft
iscsi_boot_sysfs xfs intel_rapl sb_edac libcrc32c x86_pkg_temp_thermal
intel_powerclamp coretemp mgag200 kvm_intel ttm kvm drm_kms_helper
ipmi_ssif irqbypass tg3 drm fb_sys_fops crct10dif_pclmul syscopyarea
crc32_pclmul ghash_clmulni_intel ptp pcbc sysfillrect pps_core
aesni_intel joydev aes_x86_64 sysimgblt crypto_simd iTCO_wdt libphy
iTCO_vendor_support i2c_algo_bit glue_helper ipmi_si lpc_ich hpwdt
ioatdma cryptd ipmi_devintf pcspkr mfd_core pcc_cpufreq ipmi_msghandler
hpilo thermal dca button shpchp btrfs xor raid6_pq hid_generic usbhid
sr_mod cdrom sd_mod ata_generic crc32c_intel serio_raw ata_piix ahci
libahci uhci_hcd ehci_pci ehci_hcd libata usbcore hpsa scsi_transport_sas
[ 1013.772994]  sg scsi_mod autofs4
[ 1013.772998] CPU: 0 PID: 374 Comm: systemd-journal Not tainted 4.13.0-rc1-2-default #2
[ 1013.772999] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 07/15/2012
[ 1013.773000] task: ffff88082c188380 task.stack: ffffc90004d7c000
[ 1013.773011] RIP: 0010:qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx]
[ 1013.773012] RSP: 0000:ffff88042f603d90 EFLAGS: 00010082
[ 1013.773013] RAX: ffff88039f723ac8 RBX: ffff88039f723ac8 RCX: ffff8803a2e18010
[ 1013.773014] RDX: ffff88039f723ac0 RSI: ffff88042f603dc4 RDI: ffff88041b6787c0
[ 1013.773015] RBP: ffff88042f603e00 R08: 0000000000000002 R09: 000000000000000d
[ 1013.773016] R10: 0000000000000002 R11: 0000000000000000 R12: ffff8803a2e80080
[ 1013.773016] R13: ffff88041b6787c0 R14: 0000000300000000 R15: 0000000000000102
[ 1013.773018] FS:  00007fa2e0a73880(0000) GS:ffff88042f600000(0000) knlGS:0000000000000000
[ 1013.773019] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1013.773020] CR2: 0000000300000020 CR3: 000000042cd7e000 CR4: 00000000000406f0
[ 1013.773021] Call Trace:
[ 1013.773022]  <IRQ>
[ 1013.773026]  ? consume_skb+0x34/0xa0
[ 1013.773040]  qla24xx_process_response_queue+0x319/0x700 [qla2xxx]
[ 1013.773050]  qla24xx_msix_rsp_q+0x7b/0xd0 [qla2xxx]
[ 1013.773054]  __handle_irq_event_percpu+0x3c/0x1b0
[ 1013.773056]  handle_irq_event_percpu+0x23/0x60
[ 1013.773057]  handle_irq_event+0x42/0x70
[ 1013.773059]  handle_edge_irq+0x8f/0x190
[ 1013.773062]  handle_irq+0x1d/0x30
[ 1013.773065]  do_IRQ+0x48/0xd0
[ 1013.773067]  common_interrupt+0x93/0x93
[ 1013.773068] RIP: 0033:0xed622c6e42
[ 1013.773069] RSP: 002b:00007ffee8b5c820 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff17
[ 1013.773071] RAX: 000000ed6316a3f0 RBX: 000000ed6316a840 RCX: 00000000000c4e33
[ 1013.773071] RDX: 000000ed6316a878 RSI: 000000ed6316a840 RDI: 000000ed631682d0
[ 1013.773072] RBP: 0000000000000001 R08: 0000000000000001 R09: 000000ed63179b70
[ 1013.773073] R10: 000000000005f6f8 R11: 0000000000000202 R12: 0000000000000001
[ 1013.773074] R13: 00007ffee8b5c85c R14: 000000ed6316a840 R15: 00007ffee8b5c850
[ 1013.773074]  </IRQ>
[ 1013.773076] Code: a9 8a 9a e0 48 8d 75 c4 48 89 da 4c 89 e1 4c 89 ef
e8 54 6e fb ff 48 85 c0 48 89 c3 0f 84 0e 02 00 00 44 0f b7 48 36 4c 8b
70 58 <4d> 8b 7e 20 41 8d 41 fd 66 83 f8 0c 77 6c 0f b7 c0 ff 24 c5 88
[ 1013.773102] RIP: qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx] RSP: ffff88042f603d90
[ 1013.773102] CR2: 0000000300000020
[ 1013.773129] ---[ end trace 532363559924f426 ]---
[ 1013.773131] Kernel panic - not syncing: Fatal exception in interrupt
[ 1013.777719] Kernel Offset: disabled
[ 1013.827528] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Duane Grigsby <Duane.Grigsby@cavium.com>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Handle PCIe error for driver
Sawan Chandak [Wed, 23 Aug 2017 22:05:00 +0000 (15:05 -0700)]
scsi: qla2xxx: Handle PCIe error for driver

Driver will perform following

- Set PFLG_DRIVER_REMOVING flag and do not disable PCIe error reporting
  during adapter shutdown.
- If PCIe device count is already zero, return correct error type from
  PCI error interface.
- When device is offline, return correct error type from PCIe error
  path.
- If there is board disable thread active during shutdown and PCIe
  device count is zero then cancel scheduling board disable thread
  during shutdown and return.

Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Fix WWPN/WWNN in debug message
Darren Trap [Wed, 23 Aug 2017 22:04:59 +0000 (15:04 -0700)]
scsi: qla2xxx: Fix WWPN/WWNN in debug message

Signed-off-by: Darren Trap <darren.trap@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add command completion for error path
Duane Grigsby [Wed, 23 Aug 2017 22:04:58 +0000 (15:04 -0700)]
scsi: qla2xxx: Add command completion for error path

The driver held spinlocks during callbacks for NVME errors which
resulted in a deadlock because recovery LS cmds needed the same lock.

Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Update fw_started flags at qpair creation.
himanshu.madhani@cavium.com [Wed, 23 Aug 2017 22:04:57 +0000 (15:04 -0700)]
scsi: qla2xxx: Update fw_started flags at qpair creation.

Fixes: 4b60c82736d0 ("scsi: qla2xxx: Add fw_started flags to qpair")
Cc: <stable@vger.kernel.org>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Fix target multiqueue configuration
Michael Hernandez [Wed, 23 Aug 2017 22:04:56 +0000 (15:04 -0700)]
scsi: qla2xxx: Fix target multiqueue configuration

Following error will be logged in to message file while trying to
configure target with multiqueue.

"Cmd 0x1f aborted with timeout since ISP Abort is pending"
"qla25xx_init_queues Rsp que: 1 init failed."

Fixes: 82de802ad46e ("scsi: qla2xxx: Preparation for Target MQ.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Michael Hernandez <michael.hernandez@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Correction to vha->vref_count timeout
Joe Carnuccio [Wed, 23 Aug 2017 22:04:55 +0000 (15:04 -0700)]
scsi: qla2xxx: Correction to vha->vref_count timeout

Fix incorrect second argument for wait_event_timeout()

Fixes: c4a9b538ab2a ("qla2xxx: Allow vref count to timeout on vport delete.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: driver version upgrade
Shivasharan S [Wed, 23 Aug 2017 11:47:08 +0000 (04:47 -0700)]
scsi: megaraid_sas: driver version upgrade

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: call megasas_dump_frame with correct IO frame size
Shivasharan S [Wed, 23 Aug 2017 11:47:07 +0000 (04:47 -0700)]
scsi: megaraid_sas: call megasas_dump_frame with correct IO frame size

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: modified few prints in OCR and IOC INIT path
Shivasharan S [Wed, 23 Aug 2017 11:47:06 +0000 (04:47 -0700)]
scsi: megaraid_sas: modified few prints in OCR and IOC INIT path

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: replace internal FALSE/TRUE definitions with false/true
Shivasharan S [Wed, 23 Aug 2017 11:47:05 +0000 (04:47 -0700)]
scsi: megaraid_sas: replace internal FALSE/TRUE definitions with false/true

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in...
Shivasharan S [Wed, 23 Aug 2017 11:47:04 +0000 (04:47 -0700)]
scsi: megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead

After a kill adapter, since the cmd_status is not set, the IOCTLs will
be hung in driver resulting in application hang.  Set cmd_status
MFI_STAT_WRONG_STATE when completing pended IOCTLs.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
Shivasharan S [Wed, 23 Aug 2017 11:47:03 +0000 (04:47 -0700)]
scsi: megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map

Driver's local RAID map is accessed frequently. We will first try to get
memory from __get_free_pages. If this fails, fall back to using vmalloc.
For crash dump buffers always prefer vmalloc.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Use SMID for Task abort case only
Shivasharan S [Wed, 23 Aug 2017 11:47:02 +0000 (04:47 -0700)]
scsi: megaraid_sas: Use SMID for Task abort case only

In TM code, smid_task is valid only in case of task aborts.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Check valid aen class range to avoid kernel panic
Shivasharan S [Wed, 23 Aug 2017 11:47:01 +0000 (04:47 -0700)]
scsi: megaraid_sas: Check valid aen class range to avoid kernel panic

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Fix endianness issues in DCMD handling
Shivasharan S [Wed, 23 Aug 2017 11:47:00 +0000 (04:47 -0700)]
scsi: megaraid_sas: Fix endianness issues in DCMD handling

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Do not re-fire shutdown DCMD after OCR
Shivasharan S [Wed, 23 Aug 2017 11:46:59 +0000 (04:46 -0700)]
scsi: megaraid_sas: Do not re-fire shutdown DCMD after OCR

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there...
Shivasharan S [Wed, 23 Aug 2017 11:46:58 +0000 (04:46 -0700)]
scsi: megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands

megasas_wait_for_outstanding_fusion checks for pending commands every 1
second. But megasas_complete_cmd_dpc_fusion is only called every 5
seconds.  If the commands are already completed by firmware, there is an
additional delay of 5 seconds before driver will process completion for
these commands.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: Use synchronize_irq in target reset case
Shivasharan S [Wed, 23 Aug 2017 11:46:57 +0000 (04:46 -0700)]
scsi: megaraid_sas: Use synchronize_irq in target reset case

Similar to task abort case, use synchronize_irq API in target reset
case.  Also, remove redundant call to megasas_complete_cmd_dpc_fusion
after calling megasas_sync_irqs in task abort case.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: set minimum value of resetwaittime to be 1 secs
Shivasharan S [Wed, 23 Aug 2017 11:46:56 +0000 (04:46 -0700)]
scsi: megaraid_sas: set minimum value of resetwaittime to be 1 secs

Setting resetwaittime to 0 during a FW fault will result in driver not
calling the OCR.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI...
Shivasharan S [Wed, 23 Aug 2017 11:46:55 +0000 (04:46 -0700)]
scsi: megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command

Driver allocated 256 byte MFI frames bytes but while sending MFI frame
(embedded inside chain frame of MPT frame) to firmware, driver sets the
length as 4k. This results in DMA read error messages during boot.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
Gustavo A. R. Silva [Tue, 22 Aug 2017 20:53:53 +0000 (15:53 -0500)]
scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test

Remove variable assignments. The value stored in local variable _rc_ is
overwritten at line 2448:rc = lpfc_sli4_bsg_set_link_diag_state(phba,
0); before it can be used.

Addresses-Coverity-ID: 1226935
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sg: protect against races between mmap() and SG_SET_RESERVED_SIZE
Todd Poynor [Wed, 16 Aug 2017 05:41:08 +0000 (22:41 -0700)]
scsi: sg: protect against races between mmap() and SG_SET_RESERVED_SIZE

Take f_mutex around mmap() processing to protect against races with the
SG_SET_RESERVED_SIZE ioctl.  Ensure the reserve buffer length remains
consistent during the mapping operation, and set the "mmap called" flag
to prevent further changes to the reserved buffer size as an atomic
operation with the mapping.

[mkp: fixed whitespace]

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sg: recheck MMAP_IO request length with lock held
Todd Poynor [Wed, 16 Aug 2017 04:48:43 +0000 (21:48 -0700)]
scsi: sg: recheck MMAP_IO request length with lock held

Commit 1bc0eb044615 ("scsi: sg: protect accesses to 'reserved' page
array") adds needed concurrency protection for the "reserve" buffer.
Some checks that are initially made outside the lock are replicated once
the lock is taken to ensure the checks and resulting decisions are made
using consistent state.

The check that a request with flag SG_FLAG_MMAP_IO set fits in the
reserve buffer also needs to be performed again under the lock to ensure
the reserve buffer length compared against matches the value in effect
when the request is linked to the reserve buffer.  An -ENOMEM should be
returned in this case, instead of switching over to an indirect buffer
as for non-MMAP_IO requests.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hpsa: fix the device_id in hpsa_update_device_info()
Dan Carpenter [Thu, 17 Aug 2017 14:44:44 +0000 (17:44 +0300)]
scsi: hpsa: fix the device_id in hpsa_update_device_info()

The parentheses are in the wrong place so we specify the length as
"sizeof(this_device->device_id) < 0" which is zero.

Fixes: 988b87edd231 ("scsi: hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: aha1542: constify pnp_device_id
Arvind Yadav [Wed, 16 Aug 2017 04:59:24 +0000 (10:29 +0530)]
scsi: aha1542: constify pnp_device_id

pnp_device_id are not supposed to change at runtime. All functions
working with pnp_device_id provided by <linux/pnp.h> work with const
pnp_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: scsi-sysfs: Adjust error returned for adapter reset request
weiping zhang [Thu, 10 Aug 2017 17:52:17 +0000 (01:52 +0800)]
scsi: scsi-sysfs: Adjust error returned for adapter reset request

If scsi_host_template->host_reset is NULL and the user requests an
adapter reset through

echo adapter > /sys/class/scsi_host/hostx/host_reset

-EINVAL will be returned even though the "adapter" argument is perfectly
valid.

Change this so that we only return -EINVAL if the provided string is
invalid.  If the host does not implement a ->host_reset function we'll
return -EOPNOTSUPP.

[mkp: tweaked patch description]

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ch: add refcounting
Hannes Reinecke [Tue, 15 Aug 2017 14:28:49 +0000 (16:28 +0200)]
scsi: ch: add refcounting

struct scsi_changer needs refcounting as the device might be removed
while the fd is still open.

[mkp: whitespace]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: pmcraid: fix duplicated code for different branches
Gustavo A. R. Silva [Sun, 13 Aug 2017 01:26:32 +0000 (20:26 -0500)]
scsi: pmcraid: fix duplicated code for different branches

Refactor code in order to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>