]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
6 years agoscsi: lpfc: spin_lock_irq() is not nestable
Dan Carpenter [Fri, 30 Jun 2017 08:02:51 +0000 (11:02 +0300)]
scsi: lpfc: spin_lock_irq() is not nestable

We're calling spin_lock_irq() multiple times, the problem is that on the
first spin_unlock_irq() then we will re-enable IRQs and we don't want
that.

Fixes: 966bb5b71196 ("scsi: lpfc: Break up IO ctx list into a separate get and put list")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: optimise DMA slot memory
Xiaofei Tan [Thu, 29 Jun 2017 13:02:14 +0000 (21:02 +0800)]
scsi: hisi_sas: optimise DMA slot memory

Currently we allocate 3 sets of DMA memories from separate pools for
each slot. This is inefficient in terms of memory usage
(buffers are less than 1 page in size, so we lose due to alignment),
and also time spent in doing 3 allocations + de-allocations per slot,
instead of 1.

To optimise, combine the 3 DMA buffers into a single buffer from a
single pool.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ibmvfc: constify dev_pm_ops structures.
Arvind Yadav [Thu, 29 Jun 2017 07:54:41 +0000 (13:24 +0530)]
scsi: ibmvfc: constify dev_pm_ops structures.

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

File size before:
   text    data     bss     dec     hex filename
  41937    1296      20   43253    a8f5 drivers/scsi/ibmvscsi/ibmvfc.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  42129    1104      20   43253    a8f5 drivers/scsi/ibmvscsi/ibmvfc.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ibmvscsi: constify dev_pm_ops structures.
Arvind Yadav [Thu, 29 Jun 2017 07:43:55 +0000 (13:13 +0530)]
scsi: ibmvscsi: constify dev_pm_ops structures.

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

File size before:
   text    data     bss     dec     hex filename
  17956    1456       8   19420    4bdc drivers/scsi/ibmvscsi/ibmvscsi.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  18164    1264       8   19436    4bec drivers/scsi/ibmvscsi/ibmvscsi.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Update debug prints in reset handlers
Matthew R. Ochs [Wed, 28 Jun 2017 17:14:37 +0000 (12:14 -0500)]
scsi: cxlflash: Update debug prints in reset handlers

The device and host reset handler contain debug prints to help identify
the entities being reset. Today these reset handlers are based on a SCSI
EH design that uses a SCSI command reference as a means of identifying
the target entity. As such, the debug trace includes the SCSI command
pointer and associated CDB. This is not necessary as the SCSI command is
simply the messenger in these scenarios.

Refactor the debug prints in the host and reset handlers to only present
information that is applicable given the function scope.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Update send_tmf() parameters
Matthew R. Ochs [Wed, 28 Jun 2017 17:14:30 +0000 (12:14 -0500)]
scsi: cxlflash: Update send_tmf() parameters

The current send_tmf() implementation is based on the caller providing a
SCSI command reference. In reality all that is needed is a SCSI device
reference as the routine uses a private command.

Refactor send_tmf() to pass the private adapter configuration reference
and a SCSI device reference. As a nice side effect, this will ease the
burden of converting caller routines to be based solely off of a SCSI
device reference.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Avoid double free of character device
Matthew R. Ochs [Wed, 28 Jun 2017 17:14:21 +0000 (12:14 -0500)]
scsi: cxlflash: Avoid double free of character device

The device_unregister() service used when cleaning up the character
device is already responsible for the internal state associated with the
device upon successful creation. As the cxlflash driver does not obtain
a second reference to the character device, the explicit call to
put_device() is not required and can lead to an inconsistent sysfs among
other issues as the reference is no longer valid after the first
put_device() is performed.

Remove the unnecessary put_device() to remedy this issue.

Fixes: a834a36b57d9 ("scsi: cxlflash: Create character device to provide host management interface")
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Add STARGET_CREATED_REMOVE state to scsi_target_state
Ewan D. Milne [Tue, 27 Jun 2017 18:55:58 +0000 (14:55 -0400)]
scsi: Add STARGET_CREATED_REMOVE state to scsi_target_state

The addition of the STARGET_REMOVE state had the side effect of
introducing a race condition that can cause a crash.

scsi_target_reap_ref_release() checks the starget->state to
see if it still in STARGET_CREATED, and if so, skips calling
transport_remove_device() and device_del(), because the starget->state
is only set to STARGET_RUNNING after scsi_target_add() has called
device_add() and transport_add_device().

However, if an rport loss occurs while a target is being scanned,
it can happen that scsi_remove_target() will be called while the
starget is still in the STARGET_CREATED state.  In this case, the
starget->state will be set to STARGET_REMOVE, and as a result,
scsi_target_reap_ref_release() will take the wrong path.  The end
result is a panic:

[ 1255.356653] Oops: 0000 [#1] SMP
[ 1255.360154] Modules linked in: x86_pkg_temp_thermal kvm_intel kvm irqbypass crc32c_intel ghash_clmulni_i
[ 1255.393234] CPU: 5 PID: 149 Comm: kworker/u96:4 Tainted: G        W       4.11.0+ #8
[ 1255.401879] Hardware name: Dell Inc. PowerEdge R320/08VT7V, BIOS 2.0.22 11/19/2013
[ 1255.410327] Workqueue: scsi_wq_6 fc_scsi_scan_rport [scsi_transport_fc]
[ 1255.417720] task: ffff88060ca8c8c0 task.stack: ffffc900048a8000
[ 1255.424331] RIP: 0010:kernfs_find_ns+0x13/0xc0
[ 1255.429287] RSP: 0018:ffffc900048abbf0 EFLAGS: 00010246
[ 1255.435123] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 1255.443083] RDX: 0000000000000000 RSI: ffffffff8188d659 RDI: 0000000000000000
[ 1255.451043] RBP: ffffc900048abc10 R08: 0000000000000000 R09: 0000012433fe0025
[ 1255.459005] R10: 0000000025e5a4b5 R11: 0000000025e5a4b5 R12: ffffffff8188d659
[ 1255.466972] R13: 0000000000000000 R14: ffff8805f55e5088 R15: 0000000000000000
[ 1255.474931] FS:  0000000000000000(0000) GS:ffff880616b40000(0000) knlGS:0000000000000000
[ 1255.483959] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1255.490370] CR2: 0000000000000068 CR3: 0000000001c09000 CR4: 00000000000406e0
[ 1255.498332] Call Trace:
[ 1255.501058]  kernfs_find_and_get_ns+0x31/0x60
[ 1255.505916]  sysfs_unmerge_group+0x1d/0x60
[ 1255.510498]  dpm_sysfs_remove+0x22/0x60
[ 1255.514783]  device_del+0xf4/0x2e0
[ 1255.518577]  ? device_remove_file+0x19/0x20
[ 1255.523241]  attribute_container_class_device_del+0x1a/0x20
[ 1255.529457]  transport_remove_classdev+0x4e/0x60
[ 1255.534607]  ? transport_add_class_device+0x40/0x40
[ 1255.540046]  attribute_container_device_trigger+0xb0/0xc0
[ 1255.546069]  transport_remove_device+0x15/0x20
[ 1255.551025]  scsi_target_reap_ref_release+0x25/0x40
[ 1255.556467]  scsi_target_reap+0x2e/0x40
[ 1255.560744]  __scsi_scan_target+0xaa/0x5b0
[ 1255.565312]  scsi_scan_target+0xec/0x100
[ 1255.569689]  fc_scsi_scan_rport+0xb1/0xc0 [scsi_transport_fc]
[ 1255.576099]  process_one_work+0x14b/0x390
[ 1255.580569]  worker_thread+0x4b/0x390
[ 1255.584651]  kthread+0x109/0x140
[ 1255.588251]  ? rescuer_thread+0x330/0x330
[ 1255.592730]  ? kthread_park+0x60/0x60
[ 1255.596815]  ret_from_fork+0x29/0x40
[ 1255.600801] Code: 24 08 48 83 42 40 01 5b 41 5c 5d c3 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90
[ 1255.621876] RIP: kernfs_find_ns+0x13/0xc0 RSP: ffffc900048abbf0
[ 1255.628479] CR2: 0000000000000068
[ 1255.632756] ---[ end trace 34a69ba0477d036f ]---

Fix this by adding another scsi_target state STARGET_CREATED_REMOVE
to distinguish this case.

Fixes: f05795d3d771 ("scsi: Add intermediate STARGET_REMOVE state to scsi_target_state")
Reported-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ses: do not add a device to an enclosure if enclosure_add_links() fails.
Maurizio Lombardi [Tue, 27 Jun 2017 09:53:27 +0000 (11:53 +0200)]
scsi: ses: do not add a device to an enclosure if enclosure_add_links() fails.

The enclosure_add_device() function should fail if it can't create the
relevant sysfs links.

Cc: <stable@vger.kernel.org>
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Tested-by: Douglas Miller <dougmill@linux.vnet.ibm.com>
Acked-by: James Bottomley <jejb@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: ufs: flush eh_work when eh_work scheduled.
Zang Leigang [Sat, 24 Jun 2017 11:14:32 +0000 (19:14 +0800)]
scsi: ufs: flush eh_work when eh_work scheduled.

Forget a condition: eh_work scheduled but do not start to work.

Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Protect access to qpair members with qpair->qp_lock
Johannes Thumshirn [Fri, 23 Jun 2017 07:10:11 +0000 (09:10 +0200)]
scsi: qla2xxx: Protect access to qpair members with qpair->qp_lock

In qla2xx_start_scsi_mq() and qla2xx_dif_start_scsi_mq() we grab the
qpair->qp_lock but do access members of the qpair before having the lock.
Re-order the locking sequence to have all read and write access to qpair
members under the qpair->qp_lock.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sun_esp: fix device reference leaks
Johan Hovold [Wed, 21 Jun 2017 09:35:09 +0000 (11:35 +0200)]
scsi: sun_esp: fix device reference leaks

Make sure to drop the reference to the dma device taken by
of_find_device_by_node() on probe errors and on driver unbind.

Fixes: 334ae614772b ("sparc: Kill SBUS DVMA layer.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fnic: changing queue command to return result DID_IMM_RETRY when rport is init
Satish Kharat [Tue, 27 Jun 2017 00:49:06 +0000 (17:49 -0700)]
scsi: fnic: changing queue command to return result DID_IMM_RETRY when rport is init

Currently the queue command returns DID_NO_CONNECT anytime the rport is
not in RPORT_ST_READY state. Changing it to return DID_NO_CONNECT only
when the rport is in RPORT_ST_DELETE state. When the rport is in one of
the init states retruning DID_IMM_RETRY.

Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fnic: correct speed display and add support for 25,40 and 100G
Satish Kharat [Tue, 27 Jun 2017 00:48:44 +0000 (17:48 -0700)]
scsi: fnic: correct speed display and add support for 25,40 and 100G

Setting speed based on the vinc device parameter read during
linkup. Also adding support to display 25,40 and 100G

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fnic: added timestamp reporting in fnic debug stats
Satish Kharat [Tue, 27 Jun 2017 00:48:08 +0000 (17:48 -0700)]
scsi: fnic: added timestamp reporting in fnic debug stats

Added the timestamps for
1. current timestamp
2. last fnic stats read timestamp
3. last fnic stats reset timestamp
and the deltas since last stats read and last reset in fnic stats.
fnic stats uses debugfs

Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fnic: Zero io_cmpl_skip on fw reset completion
Satish Kharat [Tue, 27 Jun 2017 00:46:23 +0000 (17:46 -0700)]
scsi: fnic: Zero io_cmpl_skip on fw reset completion

io_cmpl_skip keep track of number of completions to skip when stats are
reset. If a fw_reset happens immediately after stats reset it could put
it out of sync so need to reset io_cmpl_skip when fw reset is completed.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Update version number to 2.11.8.
Chad Dupuis [Mon, 26 Jun 2017 15:59:38 +0000 (08:59 -0700)]
scsi: bnx2fc: Update version number to 2.11.8.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Make rport_terminate_io callback a NOOP.
Chad Dupuis [Mon, 26 Jun 2017 15:59:37 +0000 (08:59 -0700)]
scsi: bnx2fc: Make rport_terminate_io callback a NOOP.

Do not call the stock libfc terminate rport i/o handler so we won't reset
the libfc exchange manager and kill any outstanding discovery requests.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: If IO is still in cleanup then do not return to SCSI layer.
Chad Dupuis [Mon, 26 Jun 2017 15:59:36 +0000 (08:59 -0700)]
scsi: bnx2fc: If IO is still in cleanup then do not return to SCSI layer.

In eh_abort, driver is calling scsi->done() for a IO for which cleanup is
pending. As the IO is outstanding with the firmware, it may do DMA
associated with the IO. This may lead to heap corruption.

Do not complete the IO for which cleanup is still pending. Return failure
from eh_abort and let the SCSI-ml retry the IO.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Adjust bnx2fc_npiv_create_vports for WWNNs from NVRAM that are zero.
Chad Dupuis [Mon, 26 Jun 2017 15:59:35 +0000 (08:59 -0700)]
scsi: bnx2fc: Adjust bnx2fc_npiv_create_vports for WWNNs from NVRAM that are zero.

Some vports addresses stored in NVRAM may have zero for the WWNN.  Adjust
the WWNN that we'll use to be the same as the WWPN.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Update copyright for 2017.
Chad Dupuis [Mon, 26 Jun 2017 15:59:34 +0000 (08:59 -0700)]
scsi: bnx2fc: Update copyright for 2017.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Check for connection offload before sending RRQ.
Chad Dupuis [Mon, 26 Jun 2017 15:59:33 +0000 (08:59 -0700)]
scsi: bnx2fc: Check for connection offload before sending RRQ.

If the connection is not offloaded then the backpointers from the tgt
pointer are undefined.

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2fc: Add filters to the non-offload FCoE receive path.
Chad Dupuis [Mon, 26 Jun 2017 15:59:32 +0000 (08:59 -0700)]
scsi: bnx2fc: Add filters to the non-offload FCoE receive path.

Add the following filters to bnx2fc_recv_frame():

1. Filter out invalid packets
    - eth->dest_mac[3] matches FC frame's D_ID
2. Filter out packets that are not from our connected target
    - In FIP_ST_ENABLED mode
    - eth->src_mac matches fcoe_ctlr->dest_addr
3. Filter out packets where if d_id of the packet doesn't belong to
   the device when one is already assigned a port_id, only then this
   packet is dropped

Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: default to scsi-mq
Christoph Hellwig [Fri, 16 Jun 2017 08:27:55 +0000 (10:27 +0200)]
scsi: default to scsi-mq

Remove the SCSI_MQ_DEFAULT config option and default to the blk-mq I/O
path now that we had plenty of testing, and have I/O schedulers for
blk-mq.  The module option to disable the blk-mq path is kept around for
now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sas: scsi_queue_work can fail, so make callers aware
Johannes Thumshirn [Wed, 14 Jun 2017 11:52:43 +0000 (13:52 +0200)]
scsi: sas: scsi_queue_work can fail, so make callers aware

libsas uses scsi_queue_work() to queue its internal event notifications.
scsi_queue_work() can return -EINVAL if the work queue doesn't exist and
it does call queue_work() which can return false if the work is already
queued.

Make the SAS event code capable of returning errors up to the caller,
which is handy when changing to dynamically allocated work in libsas
as well, as discussed here: https://lkml.org/lkml/2017/6/14/121.

[mkp: fixed typo]

Signed-off-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.00-k
Himanshu Madhani [Wed, 21 Jun 2017 20:48:46 +0000 (13:48 -0700)]
scsi: qla2xxx: Update Driver version to 10.00.00.00-k

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Use FC-NVMe FC4 type for FDMI registration
Duane Grigsby [Wed, 21 Jun 2017 20:48:45 +0000 (13:48 -0700)]
scsi: qla2xxx: Use FC-NVMe FC4 type for FDMI registration

[mkp: fixed typo]

Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurhty@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Send FC4 type NVMe to the management server
Duane Grigsby [Wed, 21 Jun 2017 20:48:44 +0000 (13:48 -0700)]
scsi: qla2xxx: Send FC4 type NVMe to the management server

This patch adds switch command support for FC-4 type of FC-NVMe (0x28)
for resgistering HBA port to the management server. RFT_ID command is
used to register FC-4 type of 0x28 and RFF_ID is used to register FC-4
features bits for FC-NVMe port.

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurhty@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-By: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration
Duane Grigsby [Wed, 21 Jun 2017 20:48:43 +0000 (13:48 -0700)]
scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration

This code provides the interfaces to register remote and local ports of
FC4 type 0x28 with the FC-NVMe transport and transports the requests
(FC-NVMe FC link services and FC-NVMe commands IUs) to the fabric. It
also provides the support for allocating h/w queues and aborting FC-NVMe
FC requests.

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurhty@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add FC-NVMe command handling
Duane Grigsby [Wed, 21 Jun 2017 20:48:42 +0000 (13:48 -0700)]
scsi: qla2xxx: Add FC-NVMe command handling

This patch adds logic to handle the completion of FC-NVMe commands and
creates a sub-command in the SRB command structure to manage NVMe
commands.

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurhty@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Add FC-NVMe port discovery and PRLI handling
Duane Grigsby [Wed, 21 Jun 2017 20:48:41 +0000 (13:48 -0700)]
scsi: qla2xxx: Add FC-NVMe port discovery and PRLI handling

Added logic to change the login process into an optional PRIL step for
FC-NVMe ports as a separate operation, such that we can change type to
0x28 (NVMe).

Currently, the driver performs the PLOGI/PRLI together as one operation,
but if the discovered port is an NVMe port then we first issue the PLOGI
and then we issue the PRLI. Also, the fabric discovery logic was changed
to mark each discovered FC NVMe port, so that we can register them with
the FC-NVMe transport later.

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Signed-off-by: Duane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurhty@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: Update driver version to 9.01.00.00-k
himanshu.madhani@cavium.com [Wed, 14 Jun 2017 03:47:30 +0000 (20:47 -0700)]
scsi: qla2xxx: Update driver version to 9.01.00.00-k

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: Include Exchange offload/Extended Login into FW dump
Quinn Tran [Wed, 14 Jun 2017 03:47:29 +0000 (20:47 -0700)]
scsi: qla2xxx: Include Exchange offload/Extended Login into FW dump

Add missing memory dump of Exchange Offload and Extended login into FW
dump.

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: Move target stat counters from vha to qpair.
Quinn Tran [Wed, 14 Jun 2017 03:47:28 +0000 (20:47 -0700)]
scsi: qla2xxx: Move target stat counters from vha to qpair.

Move counters to qpair to reduce cache miss.

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 datasegs_per_cmd and datasegs_per_cont field
Quinn Tran [Wed, 14 Jun 2017 03:47:27 +0000 (20:47 -0700)]
scsi: qla2xxx: Remove datasegs_per_cmd and datasegs_per_cont field

These fields only hold one set of value. Replace it with macros to
reduce cache thrash.

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 unused tgt_enable_64bit_addr flag
Quinn Tran [Wed, 14 Jun 2017 03:47:26 +0000 (20:47 -0700)]
scsi: qla2xxx: Remove unused tgt_enable_64bit_addr flag

By default this flag is forced to true.  Remove this flag and
unneccessary check for this flag.

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 debug logging routine for qpair
Quinn Tran [Wed, 14 Jun 2017 03:47:25 +0000 (20:47 -0700)]
scsi: qla2xxx: Add debug logging routine for qpair

For target main path io routines that uses qpair, create new logging &
debugging routines to use qpair instead of reaching for scsi_qla_host to
reduce cache thrash.

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 function call to qpair for door bell
Quinn Tran [Wed, 14 Jun 2017 03:47:24 +0000 (20:47 -0700)]
scsi: qla2xxx: Add function call to qpair for door bell

Add call back to door bell for qpair. This help reduce access to
qla_hw_data structure, in order to reduce cach thrash.

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 shadow register for ISP27XX
Quinn Tran [Wed, 14 Jun 2017 03:47:23 +0000 (20:47 -0700)]
scsi: qla2xxx: use shadow register for ISP27XX

For ISP27XX, use shadow register to read FW provided REQQ's consumer
index.  The shadow register is dma'ed by firmware.

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: move fields from qla_hw_data to qla_qpair
Quinn Tran [Wed, 14 Jun 2017 03:47:22 +0000 (20:47 -0700)]
scsi: qla2xxx: move fields from qla_hw_data to qla_qpair

- Move chip_reset, enable_class_2 fields from qla_hw_data to qla_qpair
  to reduce cache thrash for target MQ.
- Optimizations to reduce unnecessary memory load for good path io.

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 fw_started flags to qpair
Quinn Tran [Wed, 14 Jun 2017 03:47:21 +0000 (20:47 -0700)]
scsi: qla2xxx: Add fw_started flags to qpair

Add fw_started flag to qpair to reduce cache thrash.  This reduce access
to qla_hw_data structure by each qpair.

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 debug knob for user control workload
Quinn Tran [Wed, 14 Jun 2017 03:47:20 +0000 (20:47 -0700)]
scsi: qla2xxx: Add debug knob for user control workload

For Target mode, user can control the work load by placing qla2xxx's irq
vector on certain CPU via the smp_affinity knob. This patch allows user
to control the number of QPair's irq to be active. The irqs are
allocated at driver load time until unload. The work itself is placed on
the QPair based on user setting.

Usage:
  modprobe qla2xxx qlini_mode=disabled ql2xuctrlirq=1
  mount -t debugfs none /sys/kernel/debug
  echo 2 > /sys/kernel/debug/qla2xxx/qla2xxx_[host num]/naqp
  echo [cpu id] > /proc/irq/[irq id]/smp_affinity_list

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 mailbox failure while deleting Queue pairs
Sawan Chandak [Wed, 14 Jun 2017 03:47:19 +0000 (20:47 -0700)]
scsi: qla2xxx: Fix mailbox failure while deleting Queue pairs

In target mode driver, queue pairs are not created during driver load
time, instead they are created at the configuration time after chip
reset.  If a user tries to load/unload driver after queue pairs are
created, then there would be mailbox failure, while deleting queue
pairs.  Flag is added to check if queue pairs are created or not. Queue
pairs will be deleted only If they were created during target
configuration.

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: Enable Target Multi Queue
Quinn Tran [Wed, 14 Jun 2017 03:47:18 +0000 (20:47 -0700)]
scsi: qla2xxx: Enable Target Multi Queue

Enable Multi Queue for Target mode. At Initiator LUN scan time, each LUN
is assign to a QPair. Each QPair is affinitize to certain CPU. When new
cmd arrives from the wire, the lunid is used to search for qpair. The
qpair's affinitized cpuid will be used to queue up the work element.

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: Preparation for Target MQ.
Quinn Tran [Wed, 14 Jun 2017 03:47:17 +0000 (20:47 -0700)]
scsi: qla2xxx: Preparation for Target MQ.

In Current code, Req Q 0, RespQ 0 & hardware_lock are the main resources
for sending and process completion of Target IO. These resources are now
referenced behind a new qpair/"struct qla_qpair base_qpair".  Main path
IO handle will access those resources via the qpair pointer in
preparation for Target MQ.

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: Combine Active command arrays.
Quinn Tran [Wed, 14 Jun 2017 03:47:16 +0000 (20:47 -0700)]
scsi: qla2xxx: Combine Active command arrays.

Merge active/outstanding cmd arrays from target side and initiator side
together in prepration for Target Multi Queue support.

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: cxlflash: Update TMF command processing
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:54 +0000 (21:16 -0500)]
scsi: cxlflash: Update TMF command processing

Currently, the SCSI command presented to the device reset handler is used
to send TMFs to the AFU for a device reset. This behavior is incorrect as
the command presented is an actual command and not a special notification.
As such, it should only be used for reference and not be acted upon.

Additionally, the existing TMF transmission routine does not account for
actual errors from the hardware, only reflecting failure when a timeout
occurs. This can lead to a condition where the device reset handler is
presented with a false 'success'.

Update send_tmf() to dynamically allocate a private command for sending
the TMF command and properly reflect failure when the completed command
indicates an error or was aborted. Detect TMF commands during response
processing and avoid scsi_done() for these types of commands. Lastly,
update comments in the TMF processing paths to describe the new behavior.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Remove zeroing of private command data
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:44 +0000 (21:16 -0500)]
scsi: cxlflash: Remove zeroing of private command data

The SCSI core now zeroes the per-command private data area prior to
calling into the LLD. Replace the clearing operation that takes place
when the private command data reference is obtained with a routine that
performs common initializations. The zeroing that takes place in the
device reset path remains intact as the private command data associated
with the specified SCSI command is not guaranteed to be cleared.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Support WS16 unmap
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:33 +0000 (21:16 -0500)]
scsi: cxlflash: Support WS16 unmap

The cxlflash driver supports performing a write-same16 to scrub virtual
luns when they are released by a user. To date, AFUs for adapters that
are supported by cxlflash do not have the capability to unmap as part of
the WS operation. This can lead to fragmented flash devices which results
in performance degradation.

Future AFUs can optionally support unmap write-same commands and reflects
this support via the context control register. This provides userspace
applications with direct visibility such that they need not depend on a
host API.

Detect unmap support during cxlflash initialization by reading the context
control register associated with the primary hardware queue. Update the
existing write_same16() routine to set the unmap bit in the CDB when unmap
is supported by the host.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Support AFU debug
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:22 +0000 (21:16 -0500)]
scsi: cxlflash: Support AFU debug

Adopt the SISLite AFU debug capability to allow future CXL Flash
adapters the ability to better debug AFU issues. Update the SISLite
header with the changes necessary to support AFU debug operations
and create a host ioctl interface for user debug software. Also
update the cxlflash documentation to describe this new host ioctl.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Support LUN provisioning
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:13 +0000 (21:16 -0500)]
scsi: cxlflash: Support LUN provisioning

Adopt the SISLite AFU LUN provisioning capability to allow future CXL
Flash adapters the ability to better manage storage. Update the SISLite
header with the changes necessary to support LUN provision operations
and create a host ioctl interface for user LUN management software. Also
update the cxlflash documentation to describe this new host ioctl.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Refactor AFU capability checking
Matthew R. Ochs [Thu, 22 Jun 2017 02:16:02 +0000 (21:16 -0500)]
scsi: cxlflash: Refactor AFU capability checking

The existing AFU capability checking infrastructure is closely tied to
the command mode capability bits. In order to support new capabilities,
refactor the existing infrastructure to be more generic.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Introduce host ioctl support
Matthew R. Ochs [Thu, 22 Jun 2017 02:15:42 +0000 (21:15 -0500)]
scsi: cxlflash: Introduce host ioctl support

As staging for supporting various host management functions, add a host
ioctl infrastructure to filter ioctl commands and perform operations that
are common for all host ioctls. Also update the cxlflash documentation to
create a new section for documenting host ioctls.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Separate AFU internal command handling from AFU sync specifics
Matthew R. Ochs [Thu, 22 Jun 2017 02:15:31 +0000 (21:15 -0500)]
scsi: cxlflash: Separate AFU internal command handling from AFU sync specifics

To date the only supported internal AFU command is AFU sync. The logic
to send an internal AFU command is embedded in the specific AFU sync
handler and would need to be duplicated for new internal AFU commands.

In order to support new internal AFU commands, separate code that is
common for AFU internal commands into a generic transmission routine
and support passing back command status through an IOASA structure.
The first user of this new routine is the existing AFU sync command.
As a cleanup, use a descriptive name for the AFU sync command instead
of a magic number.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Create character device to provide host management interface
Uma Krishnan [Thu, 22 Jun 2017 02:15:18 +0000 (21:15 -0500)]
scsi: cxlflash: Create character device to provide host management interface

The cxlflash driver currently lacks host management interface. Future
devices supported by cxlflash will provide a variety of host-wide
management functions. Examples include LUN provisioning, hardware debug
support, and firmware download.

In order to provide a way to manage the device, a character device will
be created during probe of each adapter. This device will support a set of
ioctls defined in the SISLite specification from which administrators can
manage the adapter.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Add scsi command abort handler
Uma Krishnan [Thu, 22 Jun 2017 02:15:06 +0000 (21:15 -0500)]
scsi: cxlflash: Add scsi command abort handler

To date, CXL flash devices do not support a single command abort operation.
Instead, the SISLite specification provides a context reset operation to
cleanup all pending commands for a given context.

When a context reset is successful, it is guaranteed that the AFU has
aborted all currently pending I/O. This sequence is less invasive than a
device or host reset and can be executed to support scsi command abort
requests. Add eh_abort_handler callback support to process command timeouts
and abort requests.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Flush pending commands in cleanup path
Uma Krishnan [Thu, 22 Jun 2017 02:14:56 +0000 (21:14 -0500)]
scsi: cxlflash: Flush pending commands in cleanup path

When the AFU is reset in an error path, pending scsi commands can be
silently dropped without completion or a formal abort. This puts the onus
on the cxlflash driver to notify mid-layer and indicating that the command
can be retried.

Once the card has been quiesced, the hardware send queue lock is acquired
to prevent any data movement while the pending commands are processed.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Track pending scsi commands in each hardware queue
Uma Krishnan [Thu, 22 Jun 2017 02:14:43 +0000 (21:14 -0500)]
scsi: cxlflash: Track pending scsi commands in each hardware queue

Currently, there is no book keeping of the pending scsi commands in the
cxlflash driver. This lack of tracking in-flight requests is too
restrictive and requires a heavy-hammer reset each time an adapter error is
encountered. Additionally, it does not allow for commands to be properly
retried.

In order to avoid this problem and to better handle error path command
cleanup, introduce a linked list for each hardware queue that tracks
pending commands.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Handle AFU sync failures
Uma Krishnan [Thu, 22 Jun 2017 02:14:30 +0000 (21:14 -0500)]
scsi: cxlflash: Handle AFU sync failures

AFU sync operations are not currently evaluated for failure. This is
acceptable for paths where there is not a dependency on the AFU being
consistent with the host. Examples include link reset events and LUN
cleanup operations. On paths where there is a dependency, such as a LUN
open, a sync failure should be acted upon.

In the event of AFU sync failures, either log or cleanup as appropriate for
operations that are dependent on a successful sync completion.

Update documentation to reflect behavior in the event of an AFU sync
failure.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Schedule asynchronous reset of the host
Uma Krishnan [Thu, 22 Jun 2017 02:14:17 +0000 (21:14 -0500)]
scsi: cxlflash: Schedule asynchronous reset of the host

A context reset failure indicates the AFU is in a bad state. At present,
when such a situation occurs, no further action is taken. This leaves the
adapter in an unusable state with no recoverable actions.

To avoid this situation, context reset failures will be escalated to a host
reset operation. This will be done asynchronously to allow the acting
thread to return to the user with a failure.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Reset hardware queue context via specified register
Uma Krishnan [Thu, 22 Jun 2017 02:14:02 +0000 (21:14 -0500)]
scsi: cxlflash: Reset hardware queue context via specified register

Per the SISLite specification, context_reset() writes 0x1 to the LSB of the
reset register. When the AFU processes this reset request, it is expected
to clear the bit after reset is complete. The current implementation simply
checks that the entire value read back is not 1, instead of masking off the
LSB and evaluating it for a change to 0. Should the AFU manipulate other
bits during the reset (reading back a value of 0xF for example), successful
completion will be prematurely indicated given the existing logic.

Additionally, in the event that the context reset operation fails, there
does not currently exist a way to provide feedback to the initiator of the
reset. This poses a problem for the rare case that a context reset fails as
the caller will proceed on the assumption that all is well.

To remedy these issues, refactor the context reset routine to only mask off
the LSB when evaluating for success and return status to the caller. Also
update the context reset handler parameters to pass a hardware queue
reference instead of a single command to better reflect that the entire
queue associated with the context is impacted by the reset.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Update cxlflash_afu_sync() to return errno
Uma Krishnan [Thu, 22 Jun 2017 02:13:48 +0000 (21:13 -0500)]
scsi: cxlflash: Update cxlflash_afu_sync() to return errno

The cxlflash_afu_sync() routine returns a negative one to indicate any kind
of failure. This makes it impossible to establish why the error occurred.

Update the return codes to clearly indicate the failure cause to the
caller.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxlflash: Combine the send queue locks
Uma Krishnan [Thu, 22 Jun 2017 02:13:32 +0000 (21:13 -0500)]
scsi: cxlflash: Combine the send queue locks

Currently there are separate spin locks for the two supported I/O queueing
models. This makes it difficult to serialize with paths outside the enqueue
path.

As a design simplification and to support serialization with enqueue
operations, move to only a single lock that is used for enqueueing
regardless of the queueing model.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sgiwd93: switch to dma_alloc_attrs
Christoph Hellwig [Fri, 16 Jun 2017 07:17:11 +0000 (09:17 +0200)]
scsi: sgiwd93: switch to dma_alloc_attrs

Use dma_alloc_attrs directly instead of the dma_alloc_noncoherent
wrapper.

[mkp: fixed driver name]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: 53c700: switch to dma_alloc_attrs
Christoph Hellwig [Fri, 16 Jun 2017 07:17:12 +0000 (09:17 +0200)]
scsi: 53c700: switch to dma_alloc_attrs

Use dma_alloc_attrs directly instead of the dma_alloc_noncoherent
wrapper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qedi: Remove comparison of u16 idx with zero.
Christos Gkekas [Sat, 24 Jun 2017 16:24:45 +0000 (17:24 +0100)]
scsi: qedi: Remove comparison of u16 idx with zero.

Variable idx is defined as u16 thus statement (idx < 0) is always false
and should be removed.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hpsa: fix spelling mistake: "encrypytion" -> "encryption"
Colin Ian King [Mon, 26 Jun 2017 13:31:10 +0000 (14:31 +0100)]
scsi: hpsa: fix spelling mistake: "encrypytion" -> "encryption"

Trivial fix to spelling mistake in dev_info message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32
John Garry [Mon, 26 Jun 2017 10:27:28 +0000 (18:27 +0800)]
scsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32

Element phy_type is a bitmask and it only ever has 2 bits possibly set,
and it is overkill to define as a u64, so redefine as a u32.

This change resolves static code check complaint that "phy->phy_type &=
~PORT_TYPE_SAS;" would unintentionally clear the high 32 bits as well.

Structure hisi_sas_phy is also reordered to ensure packing efficiency.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: Remove the definition of VLC_SA_RECEIVE_CREDENTIAL
Bart Van Assche [Fri, 23 Jun 2017 17:32:39 +0000 (10:32 -0700)]
scsi: Remove the definition of VLC_SA_RECEIVE_CREDENTIAL

The symbolic name VLC_SA_RECEIVE_CREDENTIAL is not used anywhere in the
kernel. Additionally, since SPC 5 the RECEIVE CREDENTIAL command is
obsolete. The VLC_SA_RECEIVE_CREDENTIAL definition is misleading since
it occurs outside the list of other variable length CDB service action
codes (READ_32, WRITE_32, ...). Hence remove this definition.

References: commit e9ccc998b70f ("[SCSI] Add missing SPC-4 CDB and
MAINTENANCE_[IN,OUT] service action definitions")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@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: aacraid: Don't copy uninitialized stack memory to userspace
Seth Forshee [Fri, 23 Jun 2017 14:04:22 +0000 (09:04 -0500)]
scsi: aacraid: Don't copy uninitialized stack memory to userspace

Both aac_send_raw_srb() and aac_get_hba_info() may copy stack allocated
structs to userspace without initializing all members of these
structs. Clear out this memory to prevent information leaks.

Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
Fixes: c799d519bf088 ("scsi: aacraid: Retrieve HBA host information ioctl")
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: bnx2i: missing error code in bnx2i_ep_connect()
Dan Carpenter [Fri, 23 Jun 2017 07:02:00 +0000 (10:02 +0300)]
scsi: bnx2i: missing error code in bnx2i_ep_connect()

If bnx2i_map_ep_dbell_regs() then we accidentally return NULL instead of
an error pointer.  It results in a NULL dereference in
iscsi_if_ep_connect().

Fixes: cf4e6363859d ("[SCSI] bnx2i: Add bnx2i iSCSI driver.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hptiop: make function hptiop_iop_request_callback_itl static
Colin Ian King [Thu, 22 Jun 2017 15:52:19 +0000 (16:52 +0100)]
scsi: hptiop: make function hptiop_iop_request_callback_itl static

The function hptiop_iop_request_callback_itl does not need to be in
global scope, so make it static.

Cleans up sparse warning:
"symbol 'hptiop_iop_request_callback_itl' was not declared. Should it
 be static?"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: cxgb4i: assign rxqs in round robin mode
Varun Prakash [Thu, 22 Jun 2017 10:17:49 +0000 (15:47 +0530)]
scsi: cxgb4i: assign rxqs in round robin mode

Assign rxq to TCP connections in round robin mode to use all available
rxqs.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fix typos and grammar in comments of scsi_transport_fc.c
Tyrel Datwyler [Wed, 21 Jun 2017 20:24:39 +0000 (16:24 -0400)]
scsi: fix typos and grammar in comments of scsi_transport_fc.c

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: fix refcount error on node list
James Smart [Wed, 21 Jun 2017 17:51:23 +0000 (10:51 -0700)]
scsi: lpfc: fix refcount error on node list

A change in remote port removal introduced a spurious put which can
cause a premature structure teardown. The affects were most notable when
the driver attempted to unload as a null pointer would be hit.

Fix by removing the unnecessary put.

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 io stoppage after link bounce
James Smart [Wed, 21 Jun 2017 17:37:58 +0000 (10:37 -0700)]
scsi: lpfc: Fix nvme io stoppage after link bounce

On link down, transport is calling driver to abort outstanding ios.
Driver erroneously rejects the abort if the port indicates it isn't
logged in - which will be the case after the link down. Thus, the io
can't clean up. This prevents reconnection at the transport level.

Fix by allowing abort to proceed.

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: virtio_scsi: let host do exception handling
Paolo Bonzini [Wed, 21 Jun 2017 14:35:46 +0000 (16:35 +0200)]
scsi: virtio_scsi: let host do exception handling

virtio_scsi tries to do exception handling after the default 30 seconds
timeout expires.  However, it's better to let the host control the
timeout, otherwise with a heavy I/O load it is likely that an abort will
also timeout.  This leads to fatal errors like filesystems going
offline.

Disable the 'sd' timeout and allow the host to do exception handling,
following the precedent of the storvsc driver.

Hannes has a proposal to introduce timeouts in virtio, but this provides
an immediate solution for stable kernels too.

[mkp: fixed typo]

Reported-by: Douglas Miller <dougmill@linux.vnet.ibm.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: qla2xxx: don't include <generated/utsrelease.h>
Johannes Berg [Wed, 21 Jun 2017 11:40:05 +0000 (13:40 +0200)]
scsi: qla2xxx: don't include <generated/utsrelease.h>

There's no need to use the static UTS_RELEASE string, since
utsname()->release contains the same.

This avoids rebuilding this file for every change of the release string.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: fc: drop residual tsk_mgmt_response and it_nexus_response
Kefeng Wang [Wed, 21 Jun 2017 02:48:30 +0000 (10:48 +0800)]
scsi: fc: drop residual tsk_mgmt_response and it_nexus_response

After commit 556e26a70b64 ("scsi: remove tsk_mgmt_response and
it_nexus_response transport methods"), the target driver support was
removed totally. Drop the residual.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: csiostor: update module version
Varun Prakash [Tue, 20 Jun 2017 14:11:21 +0000 (19:41 +0530)]
scsi: csiostor: update module version

Add -ko to the module version similar to module version of other Chelsio
drivers.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: sd: Use sysfs_match_string()
Martin K. Petersen [Thu, 25 May 2017 13:34:30 +0000 (09:34 -0400)]
scsi: sd: Use sysfs_match_string()

Avoid unnecessary snprintf() when formatting variables for display in
sysfs and switch to sysfs_match_string() for validating user input.

Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: scsi_dh_alua: remove synchronous STPG support
Christoph Hellwig [Mon, 19 Jun 2017 12:27:24 +0000 (14:27 +0200)]
scsi: scsi_dh_alua: remove synchronous STPG support

Since 9c58b395 ("scsi: scsi_devinfo: remove synchronous ALUA for NETAPP
devices") this code is unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: remove various unused blist flags
Christoph Hellwig [Mon, 19 Jun 2017 12:27:23 +0000 (14:27 +0200)]
scsi: remove various unused blist flags

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: storvsc: use default I/O timeout handler for FC devices
Long Li [Tue, 13 Jun 2017 21:34:05 +0000 (14:34 -0700)]
scsi: storvsc: use default I/O timeout handler for FC devices

FC disks issue I/O directly to the host storage port driver, this is
diffirent to VHD disks where I/O is virtualized and timeout is handled
by the host VSP (Virtualization Service Provider).

FC disks are usually setup in a multipath system, and they don't want to
reset timer on I/O timeout. Timeout is detected by multipath as a good
time to failover and recover.

Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: aacraid: fix leak of data from stack back to userspace
Colin Ian King [Mon, 15 May 2017 14:56:05 +0000 (15:56 +0100)]
scsi: aacraid: fix leak of data from stack back to userspace

The fields sense_data_size and sense_data are unitialized garbage from
the stack and are being copied back to userspace.  Fix this leak of
stack information by ensuring they are zero'd.

Detected by CoverityScan, CID#1435473 ("Uninitialized scalar variable")

Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: update to revision to 11.4.0.1
James Smart [Fri, 16 Jun 2017 05:56:51 +0000 (22:56 -0700)]
scsi: lpfc: update to revision to 11.4.0.1

Set lpfc driver revision to 11.4.0.1

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Driver responds LS_RJT to Beacon Off ELS - Linux
James Smart [Fri, 16 Jun 2017 05:56:50 +0000 (22:56 -0700)]
scsi: lpfc: Driver responds LS_RJT to Beacon Off ELS - Linux

Beacon OFF from switch is rejected by driver.

Driver fails Beacon OFF if frequency is set to 0. As per fc-ls spec,
status, capability, frequency and duration fields are only applicable
for Beacon ON.

Remove frequency and type checks. Reject Beacon ON if duration is non
zero.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request.
James Smart [Fri, 16 Jun 2017 05:56:49 +0000 (22:56 -0700)]
scsi: lpfc: Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request.

When running nvme detach-ns /dev/nvme0n1 -n 1 command, the nvmet lpfc
driver crashes with this stack dump:

kernel BUG at /root/NVME/lpfc_8.4/lpfc_sli.c:1393!
invalid opcode: 0000 [#1] SMP
Workqueue: nvmet-fc-cpu0 nvmet_fc_do_work_on_cpu [nvmet_fc]
 lpfc_sli4_issue_wqe+0x357/0x440 [lpfc]
 lpfc_nvmet_xmt_fcp_abort+0x36b/0x5c0 [lpfc]
 nvmet_fc_abort_op+0x30/0x50 [nvmet_fc]
 nvmet_fc_do_work_on_cpu+0xd9/0x130 [nvmet_fc]
 process_one_work+0x14e/0x410
 worker_thread+0x116/0x490
 kthread+0xc7/0xe0
 ret_from_fork+0x3f/0x70

Crash is due to an uninitialized iocbq->vport pointer.

Explicitly set the iocbq->vport field to phba->pport in
lpfc_nvmet_sol_fcp_issue_abort as it does all abort iocbq initialization
in the routine.  Using phba->pport is ok because target does not support
NPIV instances.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix crash doing IO with resets
James Smart [Fri, 16 Jun 2017 05:56:48 +0000 (22:56 -0700)]
scsi: lpfc: Fix crash doing IO with resets

During every reset, IOCBs are allocated. So, at one point, number of
allocated IOCBs reaches maximum limit and lpfc_sli_next_iotag fails.

Allocate IOCBs only during initialization. Reuse them after every reset
instead of allocating new set of IOCBs.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix crash after firmware flash when IO is running.
James Smart [Fri, 16 Jun 2017 05:56:47 +0000 (22:56 -0700)]
scsi: lpfc: Fix crash after firmware flash when IO is running.

OS crashes after the completion of firmware download.

Failure in posting SCSI SGL buffers because number of SGL buffers is
less than total count. Some of the pending IOs are not completed by
driver. SGL buffers for these IOs are not added back to the list.
Pending IOs are not completed because lpfc_wq_list list is initialized
before completion of pending IOs.

Postpone lpfc_wq_list reinitialization by moving
lpfc_sli4_queue_destroy() after lpfc_hba_down_post().

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix SLI3 drivers attempting NVME ELS commands.
James Smart [Fri, 16 Jun 2017 05:56:46 +0000 (22:56 -0700)]
scsi: lpfc: Fix SLI3 drivers attempting NVME ELS commands.

In a server with an 8G adapter and a 32G adapter, running NVME and FCP,
the server would crash with the following stack.

RIP: 0010: ... lpfc_nvme_register_port+0x38/0x420 [lpfc]
 lpfc_nlp_state_cleanup+0x154/0x4f0 [lpfc]
 lpfc_nlp_set_state+0x9d/0x1a0 [lpfc]
 lpfc_cmpl_prli_prli_issue+0x35f/0x440 [lpfc]
 lpfc_disc_state_machine+0x78/0x1c0 [lpfc]
 lpfc_cmpl_els_prli+0x17c/0x1f0 [lpfc]
 lpfc_sli_sp_handle_rspiocb+0x39b/0x6b0 [lpfc]
 lpfc_sli_handle_slow_ring_event_s3+0x134/0x2d0 [lpfc]
 lpfc_work_done+0x8ac/0x13b0 [lpfc]
 lpfc_do_work+0xf1/0x1b0 [lpfc]

Crash, on the 8G adapter, is due to a vport which does not have a nvme
local port structure. It's not supposed to have one. NVME is not
supported on the 8G adapter, so the NVME PRLI, which started this flow
shouldn't have been sent in the first place.

Correct discovery engine to recognize when on an SLI3 rport, which
doesn't support SLI3, if the rport supports only NVME, don't send a NVME
PRLI. Instead, as no FC4 will be used, a LOGO is sent.  If rport is FCP
and NVME, only execute the SCSI PRLI.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Break up IO ctx list into a separate get and put list
James Smart [Fri, 16 Jun 2017 05:56:45 +0000 (22:56 -0700)]
scsi: lpfc: Break up IO ctx list into a separate get and put list

Since unsol rcv ISR and command cmpl ISR both access/lock this list,
separate get/put lists will reduce contention.

Replaced
struct list_head lpfc_nvmet_ctx_list;
with
struct list_head lpfc_nvmet_ctx_get_list;
struct list_head lpfc_nvmet_ctx_put_list;
and all correpsonding locks and counters.

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: Reduce time spent in IRQ for received NVME commands
James Smart [Fri, 16 Jun 2017 05:56:44 +0000 (22:56 -0700)]
scsi: lpfc: Reduce time spent in IRQ for received NVME commands

Removed unnecessary bzero of context area. Due to size of sg list, added
a substantial delay and played havoc on cpu caches.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Vport creation is failing with "Link Down" error
James Smart [Fri, 16 Jun 2017 05:56:43 +0000 (22:56 -0700)]
scsi: lpfc: Vport creation is failing with "Link Down" error

Vport creation fails for SLI-3 adapters.

Mailbox submission fails because mailbox interrupt is disabled. Mailbox
interrupt is disabled during port reset.

Do reset only for physical port.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix nvme_info sysfs output to be consistent
James Smart [Fri, 16 Jun 2017 05:56:42 +0000 (22:56 -0700)]
scsi: lpfc: Fix nvme_info sysfs output to be consistent

First line of nvme_info output is not consistent. There is an Extra
colon in the format.

First line of output will contain one of the following strings:
NVME Initiator Enabled
NVME Target Enabled
NVME Disabled

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: lpfc: Fix system panic when express lane enabled.
James Smart [Fri, 16 Jun 2017 05:56:41 +0000 (22:56 -0700)]
scsi: lpfc: Fix system panic when express lane enabled.

There is a null pointer dereference that can happen in the FOF interrupt
handler.

The driver was not setting up cq->assoc_qp_for sli4_hba->oas_cq.

Initialize cq->assoc_qp before accessing it.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: modify internal abort dev flow for v3 hw
Xiang Chen [Wed, 14 Jun 2017 15:33:32 +0000 (23:33 +0800)]
scsi: hisi_sas: modify internal abort dev flow for v3 hw

There is a change for abort dev for v3 hw: add registers to configure
unaborted iptt for a device, and then inform this to logic.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: add v3 code to fill some more hw function pointers
Xiang Chen [Wed, 14 Jun 2017 15:33:31 +0000 (23:33 +0800)]
scsi: hisi_sas: add v3 code to fill some more hw function pointers

Add code to fill the interface of phy_hard_reset, phy_get_max_linkrate,
and phy enable/disable.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: add get_wideport_bitmap_v3_hw()
Xiang Chen [Wed, 14 Jun 2017 15:33:30 +0000 (23:33 +0800)]
scsi: hisi_sas: add get_wideport_bitmap_v3_hw()

Add code for interface get_wideport_bitmap.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 years agoscsi: hisi_sas: add v3 code to send internal abort command
Xiang Chen [Wed, 14 Jun 2017 15:33:29 +0000 (23:33 +0800)]
scsi: hisi_sas: add v3 code to send internal abort command

Add code to prepare internal abort command.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>