OSDN Git Service

tomoyo/tomoyo-test1.git
5 years agoscsi: libsas: Improve vague log in SAS rediscovery
John Garry [Fri, 12 Apr 2019 08:57:54 +0000 (16:57 +0800)]
scsi: libsas: Improve vague log in SAS rediscovery

When an expander PHY which was part of a wideport disconnects, we would see
a log like this from sas_rediscover():

[   39.695554] sas: phy20 part of wide port with phy16

Here, phy20 is the PHY that disconnected, and phy16 is the lowest indexed
member PHY of the wideport.

The log implies the phy20 is still part of the wideport with phy16, so is
misleading or, at least, vague.

Improve the logs in SAS rediscovery by removing this log and adding a log
in sas_rediscover_dev() to tell what's really going on.

While we're at it, also make the logs in sas_find_bcast_dev() more
informative (and more consistent with the reset of the expander logs).

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Try to retain programmed min linkrate for SATA min pathway unmatch...
John Garry [Fri, 12 Apr 2019 08:57:53 +0000 (16:57 +0800)]
scsi: libsas: Try to retain programmed min linkrate for SATA min pathway unmatch fixing

Currently for fixing the linkrate matching during discovery such that the
linkrate of a SATA PHY does not exceed min pathway to initiator, we set the
SATA PHY programmed min linkrate to the same value as the programmed max
linkrate.

This is unnecessary, and we should be able to keep the same programmed min
linkrate if it is already lower than this new max programmed linkrate.

This patch makes that change.

In effect, this will not make much difference since we generally will
negotiate a linkrate at the programmed max linkrate, and the programmed min
linkrate will have no impact.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Stop hardcoding SAS address length
John Garry [Fri, 12 Apr 2019 08:57:52 +0000 (16:57 +0800)]
scsi: libsas: Stop hardcoding SAS address length

Many times we use 8 for SAS address length, while we already have a macro
for this - SAS_ADDR_SIZE.

Replace instances of this with the macro. However, don't touch the SAS
address array sizes sas.h, as these are defined according to the SAS spec.

Some missing whitespaces are also added, and whitespace indentation
in sas_hash_addr() is also fixed (see sas_hash_addr()).

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Some misc tidy-up
Xiang Chen [Thu, 11 Apr 2019 12:46:44 +0000 (20:46 +0800)]
scsi: hisi_sas: Some misc tidy-up

Do some minor tidy-up.

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>
5 years agoscsi: hisi_sas: Don't fail IT nexus reset for Open Reject timeout
Luo Jiaxing [Thu, 11 Apr 2019 12:46:43 +0000 (20:46 +0800)]
scsi: hisi_sas: Don't fail IT nexus reset for Open Reject timeout

Currently we call hisi_sas_softreset_ata_disk() in
hisi_sas_I_T_nexus_reset().

If this fails for open reject reason, there is no reason to fail the IT
nexus reset, so only fail for TMF_RESP_FUNC_FAILED.

Some other strings spilled over multiple lines are reunited.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Don't hard reset disk during controller reset
Luo Jiaxing [Thu, 11 Apr 2019 12:46:42 +0000 (20:46 +0800)]
scsi: hisi_sas: Don't hard reset disk during controller reset

In the function of hisi_sas_init_device(), we added ops->hardreset() to
clear affiliation of STP target port or handle [STP pending] state.

Function hisi_sas_init_device() will be called when a device is found or
during controller reset. At controller reset, we call
hisi_sas_init_device() to re-init the disks, so calling hardreset() is
unnecessary and it also will cause some delay at controller reset.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Support all RAS events with MSI interrupts
Xiaofei Tan [Thu, 11 Apr 2019 12:46:41 +0000 (20:46 +0800)]
scsi: hisi_sas: Support all RAS events with MSI interrupts

This patch is to switch HW all error handling from PCI AER to MSI interrupt
due to non-standard PCI implementation. All HW errors which were being
reported through PCI AER can be reported through MSI interrupt also.

Do two things to complete the switch:

1. Notify FW to switch to MSI handling through ACPI DSM.

2. Add MSI handling for some hw errors, ECC errors and poison errors (we
   also call some of them AXI reuser error). They were handled only through
   PCI AER before.

For old FW reporting PCI AER events, the PCI AER handler will see that the
driver on longer support AER, and will leave the device in offlined state,
which is safe.

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>
5 years agoscsi: hisi_sas: allocate different SAS address for directly attached situation
Xiang Chen [Thu, 11 Apr 2019 12:46:40 +0000 (20:46 +0800)]
scsi: hisi_sas: allocate different SAS address for directly attached situation

In commit 8b8d66531555 ("scsi: hisi_sas: make SAS address of SATA disks
unique"), we ensured that each SATA disk in the system has a unique SAS
address, even if it is fake. That was for v2 hw.

Add this for v3 hw.

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>
5 years agoscsi: hisi_sas: Adjust the printk format of functions hisi_sas_init_device()
Xiang Chen [Thu, 11 Apr 2019 12:46:39 +0000 (20:46 +0800)]
scsi: hisi_sas: Adjust the printk format of functions hisi_sas_init_device()

In function hisi_sas_init_device(), the log is as follows when error for
hardreset:

  hisi_sas_v3_hw 0000:74:02.0: SATA disk hardreset fail: 0xffffffed

Actually if hardreset failed, its return value is negative, so change the
print format from %x to %d.

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>
5 years agoscsi: hisi_sas: Fix for setting the PHY linkrate when disconnected
John Garry [Thu, 11 Apr 2019 12:46:38 +0000 (20:46 +0800)]
scsi: hisi_sas: Fix for setting the PHY linkrate when disconnected

In commit efdcad62e7b8 ("scsi: hisi_sas: Set PHY linkrate when
disconnected"), we use the sas_phy_data.enable flag to track whether the
PHY was enabled or not, so that we know if we should set the PHY negotiated
linkrate at SAS_LINK_RATE_UNKNOWN or SAS_PHY_DISABLED.

However, it is not proper to use sas_phy_data.enable, since it is only set
when libsas attempts to set the PHY disabled/enabled; hence, it may not
even have an initial value.

As a solution to this problem, introduce hisi_sas_phy.enable to track
whether the PHY is enabled or not, so that we can set the negotiated
linkrate properly when the PHY comes down.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Remedy inconsistent PHY down state in software
Xiang Chen [Thu, 11 Apr 2019 12:46:37 +0000 (20:46 +0800)]
scsi: hisi_sas: Remedy inconsistent PHY down state in software

Currently there are two scenarioes which may cause PHY state of hardware
(which is 0) is inconsistent with the state held in software:

- Unplug SAS wire before get_phys_state when SAS controller reset, then the
  interrupts of phy down are ignored, phy state is 0 before reset, and it
  also gets 0 after reset, so phy down doesn't occur even if unplugged SAS
  wire;

- For v3 hw later version, it will close bus when 2 bit ECC error occurs.
  So if unplug SAS wire at that time, interrupts of phy down also not
  occur. So at last it will cause host reset. It also get phy state 0
  before and after reset, the same issue occurs.

To solve it, use hisi_sas_phy_down() directly in rescan topology function.

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>
5 years agoscsi: hisi_sas: add host reset interface for test
Xiang Chen [Thu, 11 Apr 2019 12:46:36 +0000 (20:46 +0800)]
scsi: hisi_sas: add host reset interface for test

Add host reset interface to make it easier for testing the host reset
feature.

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>
5 years agoMerge branch '5.1/scsi-fixes' into 5.2/merge
Martin K. Petersen [Sat, 13 Apr 2019 01:27:23 +0000 (21:27 -0400)]
Merge branch '5.1/scsi-fixes' into 5.2/merge

We have a few submissions for 5.2 that depend on fixes merged post
5.1-rc1. Merge the fixes branch into queue.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Make sure PDU processing continues if parsing a command fails
Bart Van Assche [Tue, 2 Apr 2019 19:58:15 +0000 (12:58 -0700)]
scsi: target/iscsi: Make sure PDU processing continues if parsing a command fails

Currently the iSCSI target driver sends a CHECK CONDITION code back to the
initiator if the immediate data buffer is too large but it does not discard
that immediate data buffer. The result is that the iSCSI target driver
attempts to parse the immediate data itself as iSCSI PDUs and that all
further iSCSI communication fails. Fix this by receiving and discarding too
large immediate data buffers.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Make iscsit_map_iovec() more robust
Bart Van Assche [Tue, 2 Apr 2019 19:58:14 +0000 (12:58 -0700)]
scsi: target/iscsi: Make iscsit_map_iovec() more robust

Make the code for mapping an iovec more robust by checking the bounds of
the allocated iovec. This patch avoids that the following crash occurs if a
map attempt is made that exceeds the bounds of the iovec that is being
mapped:

BUG: unable to handle kernel NULL pointer dereference at 00000000
00000014
RIP: 0010:iscsit_map_iovec+0x120/0x190 [iscsi_target_mod]
Call Trace:
 iscsit_get_rx_pdu+0x8a2/0xe00 [iscsi_target_mod]
 iscsi_target_rx_thread+0x6e/0xa0 [iscsi_target_mod]
 kthread+0x109/0x140

Cc: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Handle too large immediate data buffers correctly
Bart Van Assche [Tue, 2 Apr 2019 19:58:13 +0000 (12:58 -0700)]
scsi: target/iscsi: Handle too large immediate data buffers correctly

Since target_alloc_sgl() and iscsit_allocate_iovecs() allocate buffer space
for se_cmd.data_length bytes and since that number can be smaller than the
iSCSI Expected Data Transfer Length (EDTL), ensure that the iSCSI target
driver does not attempt to receive more bytes than what fits in the receive
buffer. Always receive the full immediate data buffer such that the iSCSI
target driver does not attempt to parse immediate data as an iSCSI PDU.

Note: the current code base only calls iscsit_get_dataout() if the size of
the immediate data buffer does not exceed the buffer size derived from the
SCSI CDB. See also target_cmd_size_check().

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Only send R2T if needed
Bart Van Assche [Tue, 2 Apr 2019 19:58:12 +0000 (12:58 -0700)]
scsi: target/iscsi: Only send R2T if needed

If an initiator submits more immediate data than the size derived from the
SCSI CDB, do not send any R2T to the initiator. This scenario is triggered
by the libiscsi test ALL.iSCSIResiduals.WriteVerify16Residuals if the iSCSI
target driver is modified to discard too large immediate data buffers
instead of trying to parse these as an iSCSI PDU. This patch avoids that a
negative xfer_len value is passed to iscsit_add_r2t_to_list() if too large
immediate data buffers are handled correctly.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/iscsi: Detect conn_cmd_list corruption early
Bart Van Assche [Tue, 2 Apr 2019 19:58:11 +0000 (12:58 -0700)]
scsi: target/iscsi: Detect conn_cmd_list corruption early

Certain behavior of an initiator can cause the target driver to send both a
reject and a SCSI response. If that happens two target_put_sess_cmd() calls
will occur without the command having been removed from conn_cmd_list. In
other words, conn_cmd_list will get corrupted once the freed memory is
reused. Although the Linux kernel can detect list corruption if list
debugging is enabled, in this case the context in which list corruption is
detected is not related to the context that caused list corruption.  Hence
add WARN_ON() statements that report the context that is causing list
corruption.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Make the XCOPY setup code easier to read by inlining two functions
Bart Van Assche [Tue, 2 Apr 2019 19:58:10 +0000 (12:58 -0700)]
scsi: target/core: Make the XCOPY setup code easier to read by inlining two functions

The target_xcopy_setup_pt_port() and target_xcopy_init_pt_lun() functions
obfuscate what is really going on. Hence inline these two functions. This
patch does not change any functionality.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Simplify LUN initialization in XCOPY implementation
Bart Van Assche [Tue, 2 Apr 2019 19:58:09 +0000 (12:58 -0700)]
scsi: target/core: Simplify LUN initialization in XCOPY implementation

Other than removing a few pr_debug() statements, this patch does not change
any functionality.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Remove a set-but-not-used member variable from the XCOPY implement...
Bart Van Assche [Tue, 2 Apr 2019 19:58:08 +0000 (12:58 -0700)]
scsi: target/core: Remove a set-but-not-used member variable from the XCOPY implementation

This patch does not change any functionality.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Rework the SPC-2 reservation handling code
Bart Van Assche [Tue, 2 Apr 2019 19:58:06 +0000 (12:58 -0700)]
scsi: target/core: Rework the SPC-2 reservation handling code

Instead of tracking the initiator that established an SPC-2 reservation,
track the session through which the SPC-2 reservation has been
established. This patch does not change any functionality.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Fix a race condition in the LUN lookup code
Bart Van Assche [Tue, 2 Apr 2019 19:58:05 +0000 (12:58 -0700)]
scsi: target/core: Fix a race condition in the LUN lookup code

The rcu_dereference(deve->se_lun) expression occurs twice in the LUN lookup
functions. Since these expressions are not serialized against deve->se_lun
assignments each of these expressions may yield a different result. Avoid
that the wrong LUN pointer is stored in se_cmd by reading deve->se_lun only
once.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Fixes: 29a05deebf6c ("target: Convert se_node_acl->device_list[] to RCU hlist") # v4.10
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: scsi_transport_fc: nvme: display FC-NVMe port roles
Hannes Reinecke [Wed, 10 Apr 2019 14:16:19 +0000 (16:16 +0200)]
scsi: scsi_transport_fc: nvme: display FC-NVMe port roles

Currently the FC-NVMe driver is leverating the SCSI FC transport class to
access the remote ports. Which means that all FC-NVMe remote ports will be
visible to the fc transport layer, but due to missing definitions the port
roles will always be 'unknown'.  This patch adds the missing definitions to
the fc transport class to that the port roles are correctly displayed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Giridhar Malavali <gmalavali@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: cxgbi: remove redundant __kfree_skb call on skb and free cst->atid
Colin Ian King [Fri, 12 Apr 2019 08:33:01 +0000 (09:33 +0100)]
scsi: cxgbi: remove redundant __kfree_skb call on skb and free cst->atid

The error return path via label rel_resource checks for a non-null skb
before free'ing it.  However, skb is always null at this exit path, so the
null check and the free are redundant and can be removed.  Removing this
allows the original goto's to rel_resource to be cleaned up; the first can
be replaced by a return of -EINVAL, the second can be replaced by a more
appropriate -ENOMEM return and fix a memory leak by freeing csk->atid.

Addresses-Coverity: ("Logically Dead Code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: tcm_qla2xxx: Minimize #include directives
Bart Van Assche [Thu, 4 Apr 2019 19:44:48 +0000 (12:44 -0700)]
scsi: tcm_qla2xxx: Minimize #include directives

Only include those header files that are needed by the code in this source
file.

[mkp: include build fix from Bart for SPARC]

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: csiostor: fix missing data copy in csio_scsi_err_handler()
Varun Prakash [Fri, 5 Apr 2019 15:09:13 +0000 (20:39 +0530)]
scsi: csiostor: fix missing data copy in csio_scsi_err_handler()

If scsi cmd sglist is not suitable for DDP then csiostor driver uses
preallocated buffers for DDP, because of this data copy is required from
DDP buffer to scsi cmd sglist before calling ->scsi_done().

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Unregister resources in the opposite order of the registration order
Bart Van Assche [Thu, 4 Apr 2019 19:44:47 +0000 (12:44 -0700)]
scsi: qla2xxx: Unregister resources in the opposite order of the registration order

Make sure that resources are only unregistered after the users of these
resources have been unregistered. Only unregister the character device if
registration of it succeeded.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Unregister chrdev if module initialization fails
Bart Van Assche [Thu, 4 Apr 2019 19:44:46 +0000 (12:44 -0700)]
scsi: qla2xxx: Unregister chrdev if module initialization fails

If module initialization fails after the character device has been
registered, unregister the character device. Additionally, avoid
duplicating error path code.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Fixes: 6a03b4cd78f3 ("[SCSI] qla2xxx: Add char device to increase driver use count") # v2.6.35.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Use get/put_unaligned where appropriate
Bart Van Assche [Thu, 4 Apr 2019 19:44:45 +0000 (12:44 -0700)]
scsi: qla2xxx: Use get/put_unaligned where appropriate

This patch makes the code easier to read but does not change any
functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Make qla2x00_process_response_queue() easier to read
Bart Van Assche [Thu, 4 Apr 2019 19:44:44 +0000 (12:44 -0700)]
scsi: qla2xxx: Make qla2x00_process_response_queue() easier to read

Make qla2x00_process_response_queue() easier to read by splitting this
function. This patch does not change any functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Reduce the number of forward declarations
Bart Van Assche [Thu, 4 Apr 2019 19:44:43 +0000 (12:44 -0700)]
scsi: qla2xxx: Reduce the number of forward declarations

Move the SCSI host template definition after the definition of the
functions that it references. Remove the forward declarations that became
unnecessary by that change. This patch does not change any functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Declare local symbols static
Bart Van Assche [Thu, 4 Apr 2019 19:44:42 +0000 (12:44 -0700)]
scsi: qla2xxx: Declare local symbols static

This patch avoids that sparse complains that a declaration is missing.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED
Bart Van Assche [Thu, 4 Apr 2019 19:44:41 +0000 (12:44 -0700)]
scsi: qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED

Make the code easier to read by avoiding to use a hard-coded constant. This
patch does not change any functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Remove a comment that refers to the SCSI host lock
Bart Van Assche [Thu, 4 Apr 2019 19:44:40 +0000 (12:44 -0700)]
scsi: qla2xxx: Remove a comment that refers to the SCSI host lock

Since qla2xxx_queuecommand() no longer takes the SCSI host lock, remove a
comment that refers to the host lock.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Change a stack variable into a static const variable
Bart Van Assche [Thu, 4 Apr 2019 19:44:39 +0000 (12:44 -0700)]
scsi: qla2xxx: Change a stack variable into a static const variable

Make qla2x00_get_host_fabric_name() slightly faster by changing a stack
array into a static array. Declare that array const now that the
wwn_to_u64() argument pointer has been declared const.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: scsi_transport_fc: Declare wwn_to_u64() argument const
Bart Van Assche [Thu, 4 Apr 2019 19:44:38 +0000 (12:44 -0700)]
scsi: scsi_transport_fc: Declare wwn_to_u64() argument const

Since the wwn_to_u64() function does not change its input, make its
argument const.

Cc: James Smart <james.smart@broadcom.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: fix spelling mistake "alredy" -> "already"
Colin Ian King [Mon, 8 Apr 2019 08:20:14 +0000 (09:20 +0100)]
scsi: qla2xxx: fix spelling mistake "alredy" -> "already"

There is a spelling mistake in a ql_log message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: add support for posting FC events on FPIN reception
James Smart [Fri, 5 Apr 2019 23:04:23 +0000 (16:04 -0700)]
scsi: lpfc: add support for posting FC events on FPIN reception

This patch adds support to recognize FPIN ELS's that are received.  When
one is received, the fc transport will be called to handle the the FPIN.

Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: scsi_transport_fc: Add FPIN fc event codes
James Smart [Fri, 5 Apr 2019 23:04:22 +0000 (16:04 -0700)]
scsi: scsi_transport_fc: Add FPIN fc event codes

Add a new event type - an FPIN event.

Add a new routine, fc_host_fpin_rcv(), that lldd's call when an FPIN is
received. The routine processes the fpin payload.  For now, the routine
only logs an FPIN event.

Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: scsi_transport_fc: refactor event posting routines
James Smart [Fri, 5 Apr 2019 23:04:21 +0000 (16:04 -0700)]
scsi: scsi_transport_fc: refactor event posting routines

There are two routines generating transport events that do the same thing
with only a couple of values set differently.

Refactor so there's a single routine doing the netlink operations to send
the event. All the differences are passed as arguments. Export the symbol
so the generic routine can be called by llds.

Modify the existing two event routines to use the helper.

Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: fc: add FPIN ELS definition
James Smart [Fri, 5 Apr 2019 23:04:20 +0000 (16:04 -0700)]
scsi: fc: add FPIN ELS definition

T11 has introduced a new Fabric Notifications mechanism whereby the fabric
can notify a port of events occurring in the fabric.  The notifications are
given by the FPIN ELS.

Add the FPIN ELS definitions to the kernel.

Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix a recently introduced compiler warning
Bart Van Assche [Fri, 5 Apr 2019 16:14:10 +0000 (09:14 -0700)]
scsi: lpfc: Fix a recently introduced compiler warning

This patch avoids that the following compiler warning is reported with
CONFIG_NVME_FC=n:

drivers/scsi/lpfc/lpfc_nvme.c:2140:1: warning: 'lpfc_nvme_lport_unreg_wait' defined but not used [-Wunused-function]
 lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 3999df75bccb ("scsi: lpfc: Declare local functions static")
Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Remove useless set memory to zero use memset()
YueHaibing [Sat, 23 Mar 2019 13:27:53 +0000 (21:27 +0800)]
scsi: qla2xxx: Remove useless set memory to zero use memset()

The memory return by kzalloc() has already be set to zero, so remove
useless memset(0).

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mptscsih: Mark expected switch fall-throughs
Gustavo A. R. Silva [Wed, 20 Mar 2019 20:31:39 +0000 (15:31 -0500)]
scsi: mptscsih: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch fixes the following warnings:

drivers/message/fusion/mptscsih.c: In function  mptscsih_io_done :
drivers/message/fusion/mptscsih.c:741:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if ( ioc->bus_type == SAS ) {
       ^
drivers/message/fusion/mptscsih.c:790:3: note: here
   case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */
   ^~~~
drivers/message/fusion/mptscsih.c:884:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    scsi_set_resid(sc, 0);
    ^~~~~~~~~~~~~~~~~~~~~
drivers/message/fusion/mptscsih.c:885:3: note: here
   case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
   ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs: Add VCC capability on MediaTek UFS driver
Stanley Chu [Fri, 29 Mar 2019 15:32:48 +0000 (23:32 +0800)]
scsi: dt-bindings: ufs: Add VCC capability on MediaTek UFS driver

Add VCC supply for ufs-mediatek driver to provide power-saving operation
during low-power modes. For example VCC can be turned-off during system
suspend and turned-on after system is resumed.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs: Remove custom property "<name>-fixed-regulator"
Stanley Chu [Fri, 29 Mar 2019 15:32:47 +0000 (23:32 +0800)]
scsi: dt-bindings: ufs: Remove custom property "<name>-fixed-regulator"

Custom device tree property "<name>-fixed-regulator" can be removed
because,

1) It is not used anywhere in tree.

2) All handlings for "<name>-fixed-regulator" have been removed in UFS
   driver.

3) There is no issue if an existed regulator defined
   "<name>-fixed-regulator" property in device tree.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs-cdns: Add support for UFSHCI with M31 PHY
Jan Kotas [Wed, 27 Mar 2019 14:44:05 +0000 (14:44 +0000)]
scsi: ufs-cdns: Add support for UFSHCI with M31 PHY

This patch adds an additional PHY initialization, required for M31 PHY when
used with Cadence UFS HC.  A new compatible string has been added for this
purpose.

[mkp: nuke superfluous status return]

Signed-off-by: Jan Kotas <jank@cadence.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs-cdns: Update Cadence UFS compatibility list
Jan Kotas [Wed, 27 Mar 2019 14:44:04 +0000 (14:44 +0000)]
scsi: dt-bindings: ufs-cdns: Update Cadence UFS compatibility list

This patch adds a new compatible string description for CDNS UFS HCD + M31
16nm PHY.

Signed-off-by: Jan Kotas <jank@cadence.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: remove unnecessary pointer evaluation
Zeng Guangyue [Sat, 30 Mar 2019 09:03:13 +0000 (17:03 +0800)]
scsi: ufs: remove unnecessary pointer evaluation

The pointer value is initialized as &hba->vreg_info, and it's never
changed. It's not necessary to check the pointer is null or not.

Signed-off-by: Zeng Guangyue <zengguangyue@hisilicon.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Remove set but not used variable 'fr_len'
YueHaibing [Sat, 30 Mar 2019 01:47:41 +0000 (01:47 +0000)]
scsi: qedf: Remove set but not used variable 'fr_len'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/qedf/qedf_fip.c: In function 'qedf_fcoe_send_vlan_req':
drivers/scsi/qedf/qedf_fip.c:22:6: warning:
 variable 'fr_len' set but not used [-Wunused-but-set-variable]

It's never used since introduction and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pm8001: fix spelling mistake, interupt -> interrupt
Colin Ian King [Fri, 29 Mar 2019 23:44:23 +0000 (23:44 +0000)]
scsi: pm8001: fix spelling mistake, interupt -> interrupt

Rename the functions pm8001_chip_is_our_interupt,
pm80xx_chip_is_our_interupt and function pointer is_our_interrupt to fix
spelling mistakes.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pm8001: clean up dead code when PM8001_USE_MSIX is defined
Colin Ian King [Thu, 28 Mar 2019 23:43:28 +0000 (23:43 +0000)]
scsi: pm8001: clean up dead code when PM8001_USE_MSIX is defined

When macro PM8001_USE_MSIX is defined there are redundant dead code calls
to pm8001_chip_intx_interrupt_{enable|disable} and pm8001_cr32.

Clean this up for the defined PM8001_USE_MSIX and undefined
PM8001_USE_MSIX cases.

[mkp: squashed two patches]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Update driver version to 10.01.00.16-k
Himanshu Madhani [Tue, 2 Apr 2019 21:24:34 +0000 (14:24 -0700)]
scsi: qla2xxx: Update driver version to 10.01.00.16-k

Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Change abort wait_loop from msleep to wait_event_timeout
Giridhar Malavali [Tue, 2 Apr 2019 21:24:33 +0000 (14:24 -0700)]
scsi: qla2xxx: Change abort wait_loop from msleep to wait_event_timeout

This patch converts driver wait time from using msleep to
wair_event_timeout to prevent race condition.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix driver unload when FC-NVMe LUNs are connected
Giridhar Malavali [Tue, 2 Apr 2019 21:24:32 +0000 (14:24 -0700)]
scsi: qla2xxx: Fix driver unload when FC-NVMe LUNs are connected

This patch allows driver to unload using "modprobe -r" when FC-NVMe LUNs
are connected.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Cleanup redundant qla2x00_abort_all_cmds during unload
Anil Gurumurthy [Tue, 2 Apr 2019 21:24:31 +0000 (14:24 -0700)]
scsi: qla2xxx: Cleanup redundant qla2x00_abort_all_cmds during unload

This patch removes redundant qla2x00_abort_all_cmds() during driver unload.

Signed-off-by: Anil Gurumurthy <agurumurthy@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Set remote port devloss timeout to 0
Giridhar Malavali [Tue, 2 Apr 2019 21:24:30 +0000 (14:24 -0700)]
scsi: qla2xxx: Set remote port devloss timeout to 0

This patch sets remote_port_devloss value to 0. This indicates to FC-NVMe
transport that driver is unloading and transport should not retry.

Fixes: e476fe8af5ff ("scsi: qla2xxx: Fix unload when NVMe devices are configured")
Cc: stable@vger.kernel.org
Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Cleanup fcport memory to prevent leak
Quinn Tran [Tue, 2 Apr 2019 21:24:29 +0000 (14:24 -0700)]
scsi: qla2xxx: Cleanup fcport memory to prevent leak

Clean up fcport list and loopid in one place and iterate through for loop.

Signed-off-by: Quinn Tran <qtran@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Use mutex protection during qla2x00_sysfs_read_fw_dump()
Quinn Tran [Tue, 2 Apr 2019 21:24:28 +0000 (14:24 -0700)]
scsi: qla2xxx: Use mutex protection during qla2x00_sysfs_read_fw_dump()

Add mutex protection to prevent driver from freeing the FW dump buffer
while the extraction is in progress.

[mkp: commit desc]

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix fw dump corruption
Quinn Tran [Tue, 2 Apr 2019 21:24:27 +0000 (14:24 -0700)]
scsi: qla2xxx: Fix fw dump corruption

If fw dump buffer size changes and there is an existing fw dump, then save
the old dump in the newly allocated buffer.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Further limit FLASH region write access from SysFS
Andrew Vasquez [Tue, 2 Apr 2019 21:24:26 +0000 (14:24 -0700)]
scsi: qla2xxx: Further limit FLASH region write access from SysFS

Recent ISPs have larger and more complex flash-write semantics
(secure-access and signing). The BSG interfaces support these semantics for
all ISPs and is exclusively used by QLogic user-space tools. Limit
flash-write operations to ISPs <= 25xx.

Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
Andrew Vasquez [Tue, 2 Apr 2019 21:24:25 +0000 (14:24 -0700)]
scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines

Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs
code") incorrectly set 'optrom_region_size' to 'start+size', which can
overflow option-rom boundaries when 'start' is non-zero.  Continue setting
optrom_region_size to the proper adjusted value of 'size'.

Fixes: e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix missing wakeups on abort threads
James Smart [Wed, 3 Apr 2019 18:10:34 +0000 (11:10 -0700)]
scsi: lpfc: Fix missing wakeups on abort threads

Abort thread wakeups, on some wqe types, are not happening.  The thread
wakeup logic is dependent upon the LPFC_DRIVER_ABORTED flag. However, on
these wqes, the completion handler running prior to the io completion
routine ends up clearing the flag.

Rework the wakeup logic to look at a non-null waitq element which must be
set if the abort thread is waiting. This is reverting the change in the
indicated patch.

Fixes: c2017260eea2d ("scsi: lpfc: Rework locking on SCSI io completion")
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: storvsc: Reduce default ring buffer size to 128 Kbytes
Michael Kelley [Mon, 1 Apr 2019 21:42:06 +0000 (21:42 +0000)]
scsi: storvsc: Reduce default ring buffer size to 128 Kbytes

Reduce the default VMbus channel ring buffer size for storvsc SCSI devices
from 1 Mbyte to 128 Kbytes. Measurements show that ring buffer sizes above
128 Kbytes do not increase performance even at very high IOPS rates, so
don't waste the memory. Also remove the dependence on PAGE_SIZE, since the
ring buffer size should not change on architectures where PAGE_SIZE is not
4 Kbytes.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: storvsc: Fix calculation of sub-channel count
Michael Kelley [Mon, 1 Apr 2019 16:10:52 +0000 (16:10 +0000)]
scsi: storvsc: Fix calculation of sub-channel count

When the number of sub-channels offered by Hyper-V is >= the number of CPUs
in the VM, calculate the correct number of sub-channels.  The current code
produces one too many.

This scenario arises only when the number of CPUs is artificially
restricted (for example, with maxcpus=<n> on the kernel boot line), because
Hyper-V normally offers a sub-channel count < number of CPUs.  While the
current code doesn't break, the extra sub-channel is unbalanced across the
CPUs (for example, a total of 5 channels on a VM with 4 CPUs).

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: add new RDAC LENOVO/DE_Series device
Xose Vazquez Perez [Sat, 30 Mar 2019 14:43:31 +0000 (15:43 +0100)]
scsi: core: add new RDAC LENOVO/DE_Series device

Blacklist "Universal Xport" LUN. It's used for in-band storage array
management.  Also add model to the rdac dh family.

Cc: Martin Wilck <mwilck@suse.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: SCSI ML <linux-scsi@vger.kernel.org>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Disable T10-DIF feature with FC-NVMe during probe
Giridhar Malavali [Tue, 2 Apr 2019 21:24:24 +0000 (14:24 -0700)]
scsi: qla2xxx: Disable T10-DIF feature with FC-NVMe during probe

With FC-NVMe enabled, driver does not support T10 DIF/DIX.  This patch
disables T10-PI information when ql2xnvmeenable is set.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Increase the max_sgl_segments to 1024
Giridhar Malavali [Tue, 2 Apr 2019 21:24:23 +0000 (14:24 -0700)]
scsi: qla2xxx: Increase the max_sgl_segments to 1024

This patch increases max_sgl_segments value from 128 to the maximum
supported which is 1024. Increasing max_sgl_segments will allow the driver
to support larger I/O sizes

[mkp: commit desc tweak]

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Reset the FCF_ASYNC_{SENT|ACTIVE} flags
Giridhar Malavali [Tue, 2 Apr 2019 21:24:22 +0000 (14:24 -0700)]
scsi: qla2xxx: Reset the FCF_ASYNC_{SENT|ACTIVE} flags

Driver maintains state machine for processing and completing switch
commands. This patch resets FCF_ASYNC_{SENT|ACTIVE} flag to indicate if the
previous command is active or sent, in order for next GPSC command to
advance the state machine.

[mkp: commit desc typo]

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Set the qpair in SRB to NULL when SRB is released
Giridhar Malavali [Tue, 2 Apr 2019 21:24:21 +0000 (14:24 -0700)]
scsi: qla2xxx: Set the qpair in SRB to NULL when SRB is released

This patch sets QPair pointer to NULL to prevent abort command racing ahead
of normal command completion handling during scsi_done call.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Set the SCSI command result before calling the command done
Giridhar Malavali [Tue, 2 Apr 2019 21:24:20 +0000 (14:24 -0700)]
scsi: qla2xxx: Set the SCSI command result before calling the command done

This patch tries to address race condition between abort handler and
completion handler. When scsi command result is set by both abort and
completion handler, scsi_done() is only called after refcount on SRB
structure goes to zero. The abort handler sets this result prematurely even
when the refcount is non-zero value. Fix this by setting SCSI cmd->result
before scsi_done() is called.

Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Change smp_processor_id() into raw_smp_processor_id()
Bart Van Assche [Thu, 28 Mar 2019 18:06:22 +0000 (11:06 -0700)]
scsi: lpfc: Change smp_processor_id() into raw_smp_processor_id()

This patch avoids that a kernel warning appears when smp_processor_id() is
called with preempt debugging enabled.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Remove unused functions
Bart Van Assche [Thu, 28 Mar 2019 18:06:21 +0000 (11:06 -0700)]
scsi: lpfc: Remove unused functions

Remove those functions that are not called from outside the removed
functions.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Remove set-but-not-used variables
Bart Van Assche [Thu, 28 Mar 2019 18:06:20 +0000 (11:06 -0700)]
scsi: lpfc: Remove set-but-not-used variables

This patch does not change any functionality but avoids that the compiler
complains about set-but-not-used variables when building with W=1.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Move trunk_errmsg[] from a header file into a .c file
Bart Van Assche [Thu, 28 Mar 2019 18:06:19 +0000 (11:06 -0700)]
scsi: lpfc: Move trunk_errmsg[] from a header file into a .c file

Arrays should be defined in .c files instead of in a header file. This
patch reduces the size of the lpfc kernel module.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Annotate switch/case fall-through
Bart Van Assche [Thu, 28 Mar 2019 18:06:18 +0000 (11:06 -0700)]
scsi: lpfc: Annotate switch/case fall-through

This patch avoids that the compiler warns about missing fall-through
annotation when building with W=1.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix indentation and balance braces
Bart Van Assche [Thu, 28 Mar 2019 18:06:17 +0000 (11:06 -0700)]
scsi: lpfc: Fix indentation and balance braces

This patch avoid that smatch complains about misleading indentation.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Declare local functions static
Bart Van Assche [Thu, 28 Mar 2019 18:06:16 +0000 (11:06 -0700)]
scsi: lpfc: Declare local functions static

This patch avoids that the compiler complains about missing declarations
when building with W=1.

Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Remove "<name>-fixed-regulator" device tree property
Stanley Chu [Thu, 28 Mar 2019 09:16:27 +0000 (17:16 +0800)]
scsi: ufs: Remove "<name>-fixed-regulator" device tree property

"<name>-fixed-regulator" device tree property can be safely removed because
below things are fixed or resolved,

1. "<name>-max-microamp" becomes optional property: Undefined
   "<name>-max-microamp" will not cause initialization fail if
   "<name>-fixed-regulator" is not defined.

2. Current switching operation (by regulator_set_load) now has rules:
   Regulators will have undefined current limit if "<name>-fixed-regulator"
   is not defined. But this is safe because only regulator which has
   configured current limit from "<name>-max-microamp" property is allowed
   to change its load.

Although "<name>-fixed-regulator" is not used in any dt-bindings in tree,
this patch is still safe for regulators already defined
"<name>-fixed-regulator". To be more clear, if a regulator defined
"<name>-fixed-regulator" before, the behavior difference after this patch
is,

1. "<name>-max-microamp":
   If a regulator defined "<name>-fixed-regulator", it is not necessary
   to define "<name>-max-microamp" property in device tree and it is
   expected to have an undefined current limit, i.e., "max_uA" field
   is zero in struct ufs_vreg. This is exactly the same as patched.

2. "vcc-supply-1p8" or volatge range settings:
   * For vcc, vccq or vccq2, these three regulators shall not define
     "<name>-fixed-regulator" because defining it will lead to
     undefined voltage range and thus voltage switching will be
     unexpected.
   * For other regulators with undefined voltage range, voltage range
     will be still undefined after patched.

Therefore this patch is safe for all existed regulators with
"<name>-fixed-regulator" property already defined.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Change "<name>-max-microamp" to non-mandatory property
Stanley Chu [Thu, 28 Mar 2019 09:16:26 +0000 (17:16 +0800)]
scsi: ufs: Change "<name>-max-microamp" to non-mandatory property

In dt-bindings for ufs, "<name>-max-microamp" property indicates current
limit and is mandatory if "<name>-fixed-regulator" is not defined on a
specified regulator.

However, in some platforms, regulators without "<name>-fixed-regulator"
property may not need to define their current limit because they may want
to define voltage range only for proper voltage switching in different
power modes, especially for vcc, vccq or vccq2.

Currently missing "<name>-max-microamp" property in device tree will lead
initialization to fail, thus such limitation shall be resolved to tolerate
this kind of regulators.

After resolving this, regulators without "<name>-max-microamp" property
will have undefined "max current" value, i.e., zero value in "max_uA" field
in struct ufs_vreg. Because we do bypass current switching operation (by
regulator_set_load) in case of undefined current limit, this patch shall be
safe.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Fix regulator load and icc-level configuration
Stanley Chu [Thu, 28 Mar 2019 09:16:25 +0000 (17:16 +0800)]
scsi: ufs: Fix regulator load and icc-level configuration

Currently if a regulator has "<name>-fixed-regulator" property in device
tree, it will skip current limit initialization.  This lead to a zero
"max_uA" value in struct ufs_vreg.

However, "regulator_set_load" operation shall be required on regulators
which have valid current limits, otherwise a zero "max_uA" set by
"regulator_set_load" may cause unexpected behavior when this regulator is
enabled or set as high power mode.

Similarly, in device's icc_level configuration flow, the target icc_level
shall be updated if regulator also has valid current limit, otherwise a
wrong icc_level will be calculated by zero "max_uA" and thus causes
unexpected results after it is written to device.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Avoid configuring regulator with undefined voltage range
Stanley Chu [Thu, 28 Mar 2019 09:16:24 +0000 (17:16 +0800)]
scsi: ufs: Avoid configuring regulator with undefined voltage range

For regulators used by UFS, vcc, vccq and vccq2 will have voltage range
initialized by ufshcd_populate_vreg(), however other regulators may have
undefined voltage range if dt-bindings have no such definition.

In above undefined case, both "min_uV" and "max_uV" fields in ufs_vreg
struct will be zero values and these values will be configured on
regulators in different power modes.

Currently this may have no harm if both "min_uV" and "max_uV" always keep
"zero values" because regulator_set_voltage() will always bypass such
invalid values and return "good" results.

However improper values shall be fixed to avoid potential bugs.  Simply
bypass voltage configuration if voltage range is not defined.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Remove unused min_uA field in struct ufs_vreg
Stanley Chu [Thu, 28 Mar 2019 09:16:23 +0000 (17:16 +0800)]
scsi: ufs: Remove unused min_uA field in struct ufs_vreg

There are two fields related to regulator current limit in struct ufs_vreg:
"min_uA" and "max_uA".

"max_uA" is probed by "<name>-max-microamp" property from device tree and
used for

 - regulator_set_load operations
 - icc_level configuration in device

However "min_uA" field is not used anywhere, thus we can remove it.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bnx2fc: remove unneeded variable
Ding Xiang [Fri, 29 Mar 2019 03:24:12 +0000 (11:24 +0800)]
scsi: bnx2fc: remove unneeded variable

The rc variable is not needed in bnx2fc_abts_cleanup(). Remove it and
just return SUCCESS.

[mkp: commit desc]

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: remove declaration of nvm_image from stack
Colin Ian King [Wed, 27 Mar 2019 18:11:03 +0000 (18:11 +0000)]
scsi: qedi: remove declaration of nvm_image from stack

The nvm_image is a large struct qedi_nvm_iscsi_image object of over 24K so
don't declare it on the stack just for a sizeof requirement; use sizeof on
struct qedi_nvm_iscsi_image instead.

Fixes: c77a2fa3ff8f ("scsi: qedi: Add the CRC size within iSCSI NVM image")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Update the driver version to 8.37.25.19
Saurav Kashyap [Tue, 26 Mar 2019 07:38:58 +0000 (00:38 -0700)]
scsi: qedf: Update the driver version to 8.37.25.19

 - Update the driver version.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Fix lport may be used uninitialized warning
Saurav Kashyap [Tue, 26 Mar 2019 07:38:57 +0000 (00:38 -0700)]
scsi: qedf: Fix lport may be used uninitialized warning

 - lport was getting used without initialization, initialize it to fix a
   warning.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Correctly handle refcounting of rdata
Saurav Kashyap [Tue, 26 Mar 2019 07:38:56 +0000 (00:38 -0700)]
scsi: qedf: Correctly handle refcounting of rdata

 - Handle refcount of rdata during error conditions.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Cleanup rrq_work after QEDF_CMD_OUTSTANDING is cleared
Shyam Sundar [Tue, 26 Mar 2019 07:38:55 +0000 (00:38 -0700)]
scsi: qedf: Cleanup rrq_work after QEDF_CMD_OUTSTANDING is cleared

Here is the relevant logs for the problem we are solving:

qedf_flush_active_ios:1707]:3: Flush active i/o's num=0x17 fcport=0xffff948168fbcc80 port_id=0x550200 scsi_id=0.
qedf_flush_active_ios:1708]:3: Locking flush mutex.
qedf_flush_active_ios:1758]:3: Not outstanding, xid=0xaaf, cmd_type=3 refcount=1.
qedf_flush_active_ios:1896]:3: Flushed 0x16 I/Os, active=0x1.
qedf_flush_active_ios:1901]:3: Flushed 0x16 I/Os, active=0x1 cnt=60.
qedf_send_rrq:295]:3: Sending RRQ orig io = ffffb48b8f7d7158, orig_xid = 0xaaf
qedf_initiate_els:37]:3: Sending ELS
qedf_initiate_els:68]:3: initiate_els els_req = 0xffffb48b8f6d3098 cb_arg = ffff948fd5e4de80 xid = 4c6
qedf_init_mp_req:2172]:3: Entered.
qedf_init_mp_task:727]:3: Initializing MP task for cmd_type=4
qedf_initiate_els:134]:3: Ringing doorbell for ELS req
qedf_flush_active_ios:1901]:3: Flushed 0x16 I/Os, active=0x2 cnt=20.
qedf_cmd_timeout:96]:3: ELS timeout, xid=0x4c6.
qedf_rrq_compl:186]:3: Entered.
qedf_rrq_compl:204]:3: rrq_compl: orig io = ffffb48b8f7d7158, orig xid = 0xaaf, rrq_xid = 0x4c6, refcount=1
qedf_flush_active_ios:1935]:3: Unlocking flush mutex.
qedf_upload_connection:1579]:3: Uploading connection port_id=550200.

We found an ABTS command for which CMD_OUTSTANDING was cleared (line 3).
For this command, delayed send_rrq was queued, but would take 10 secs to
execute.  Adding capability to detect that (based on io_req->state that is
being introduced), and attempt to cancel rrq_work. If we succeed, we drop
the reference and free the io_req. If we cannot, then the els will get sent
out and we will wait for 10 secs for it to complete.

Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Check for tm_flags instead of cmd_type during cleanup
Saurav Kashyap [Tue, 26 Mar 2019 07:38:54 +0000 (00:38 -0700)]
scsi: qedf: Check for tm_flags instead of cmd_type during cleanup

cmd_type is over written to QEDF_CLEANUP during cleanup, so check for
tm_flags.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Add a flag to help debugging io_req which could not be cleaned
Shyam Sundar [Tue, 26 Mar 2019 07:38:53 +0000 (00:38 -0700)]
scsi: qedf: Add a flag to help debugging io_req which could not be cleaned

 - The flag will help in to figure out if io_req is cleaned or not.

Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Don't send ABTS for under run scenario
Saurav Kashyap [Tue, 26 Mar 2019 07:38:52 +0000 (00:38 -0700)]
scsi: qedf: Don't send ABTS for under run scenario

 - Command is already completed with underrun so no need to send ABTS.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Don't queue anything if upload is in progress
Shyam Sundar [Tue, 26 Mar 2019 07:38:51 +0000 (00:38 -0700)]
scsi: qedf: Don't queue anything if upload is in progress

 - I/Os, aborts and tmf should not be queued if flush is in progress.

Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Check both the FCF and fabric ID before servicing clear virtual link
Chad Dupuis [Tue, 26 Mar 2019 07:38:50 +0000 (00:38 -0700)]
scsi: qedf: Check both the FCF and fabric ID before servicing clear virtual link

 - Check proper values before servicing CVL.

Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: fc_rport_priv reference counting fixes
Hannes Reinecke [Tue, 26 Mar 2019 07:38:49 +0000 (00:38 -0700)]
scsi: qedf: fc_rport_priv reference counting fixes

The fc_rport_priv structure is reference counted, so we need to ensure that
the reference is increased before accessing the structure.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Add missing return in qedf_scsi_done()
Chad Dupuis [Tue, 26 Mar 2019 07:38:48 +0000 (00:38 -0700)]
scsi: qedf: Add missing return in qedf_scsi_done()

On completions where we do not have a bad scsi_cmnd pointer we should
return before the the label lest we do a double kref_put.

Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Wait for upload and link down processing during soft ctx reset
Chad Dupuis [Tue, 26 Mar 2019 07:38:47 +0000 (00:38 -0700)]
scsi: qedf: Wait for upload and link down processing during soft ctx reset

 - Wait for all the connections to get uploaded.

Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: Add additional checks for io_req->sc_cmd validity
Chad Dupuis [Tue, 26 Mar 2019 07:38:46 +0000 (00:38 -0700)]
scsi: qedf: Add additional checks for io_req->sc_cmd validity

 - Check the validity of various pointers before processing.

Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedf: fixup bit operations
Hannes Reinecke [Tue, 26 Mar 2019 07:38:45 +0000 (00:38 -0700)]
scsi: qedf: fixup bit operations

test_bit() is atomic, test_bit() || test_bit() is not. So protect
consecutive bit tests with a lock to avoid races.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>