platform/kernel/linux-rpi.git
4 years agoscsi: docs: convert dc395x.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:46 +0000 (09:15 +0100)]
scsi: docs: convert dc395x.txt to ReST

Link: https://lore.kernel.org/r/3c0876df0045695185f922a0404c497a69de36a9.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert cxgb3i.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:45 +0000 (09:15 +0100)]
scsi: docs: convert cxgb3i.txt to ReST

Link: https://lore.kernel.org/r/0708b62b6ec4f0dddc581e412bb02ba6476f4523.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert BusLogic.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:44 +0000 (09:15 +0100)]
scsi: docs: convert BusLogic.txt to ReST

Link: https://lore.kernel.org/r/750629b6a5233c85c5391c44d126606b8aabefc8.1583136624.git.mchehab+huawei@kernel.org
Acked-by: Khalid Aziz <khalid@gonehiking.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert bnx2fc.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:43 +0000 (09:15 +0100)]
scsi: docs: convert bnx2fc.txt to ReST

Link: https://lore.kernel.org/r/f239116bd2c36f6fc8deb62e325bb8161da04270.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert bfa.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:42 +0000 (09:15 +0100)]
scsi: docs: convert bfa.txt to ReST

Link: https://lore.kernel.org/r/6660d0f83ddae2ab8efb31c39f9c220fc132e9d4.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert aic7xxx.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:41 +0000 (09:15 +0100)]
scsi: docs: convert aic7xxx.txt to ReST

Link: https://lore.kernel.org/r/dc2b1ffe4bf64cfc4b32328740704a30e8d38a79.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert aic79xx.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:40 +0000 (09:15 +0100)]
scsi: docs: convert aic79xx.txt to ReST

Link: https://lore.kernel.org/r/e8a40337a2173f028c9ac569d3d71fd880f4fab5.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert aha152x.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:39 +0000 (09:15 +0100)]
scsi: docs: convert aha152x.txt to ReST

Link: https://lore.kernel.org/r/097cfcc7f25343676a1fedcefed7e3b91b41b4df.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert advansys.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:38 +0000 (09:15 +0100)]
scsi: docs: convert advansys.txt to ReST

Link: https://lore.kernel.org/r/3c697a046e641c81cdfd0784f037d41d54766931.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert aacraid.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:37 +0000 (09:15 +0100)]
scsi: docs: convert aacraid.txt to ReST

Link: https://lore.kernel.org/r/67c60ad88777c91937d49771e2a3f48cbf353e4c.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: convert 53c700.txt to ReST
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:36 +0000 (09:15 +0100)]
scsi: docs: convert 53c700.txt to ReST

Link: https://lore.kernel.org/r/a2e5116b70564f36b4fc7f1f1e5da1e693d7dadb.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: include SCSI Transport SRP diagram at the doc body
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:35 +0000 (09:15 +0100)]
scsi: docs: include SCSI Transport SRP diagram at the doc body

Instead of having a separate makefile, and be alone, group
it at the SCSI documentation and make it being built as part
of docs makefile.

Link: https://lore.kernel.org/r/419c455fb40c9a1e85cc9a654a7fdb07aeeccf71.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: docs: Add an empty index file for SCSI documents
Mauro Carvalho Chehab [Mon, 2 Mar 2020 08:15:34 +0000 (09:15 +0100)]
scsi: docs: Add an empty index file for SCSI documents

In preparation for adding the SCSI documents to the documentation
body, add an empty index for it.

The next patches should be adding contents to it, as files get
converted to ReST format.

Link: https://lore.kernel.org/r/4d8c1b7ebe5898ac4a8265ca5e5a9552da3b426f.1583136624.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: add ring buffer for tracing debug logs
Rajan Shanmugavelu [Thu, 13 Feb 2020 01:29:28 +0000 (17:29 -0800)]
scsi: qla2xxx: add ring buffer for tracing debug logs

Having this log in a ring buffer helps to diagnose qla2xxx driver and
firmware issues instead of having to reproduce the problem with
extended_logging enabled. This saves cycles and helps when it is hard
to reproduce problem.

Link: https://lore.kernel.org/r/1581557368-32080-1-git-send-email-rajan.shanmugavelu@oracle.com
Reviewed-by: Joe Jin <joe.jin@oracle.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Rajan Shanmugavelu <rajan.shanmugavelu@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: clean up warning cast-function-type
Phong Tran [Mon, 9 Mar 2020 15:53:19 +0000 (22:53 +0700)]
scsi: aacraid: clean up warning cast-function-type

Make the aacraid driver -Wcast-function-type clean

Report by: https://github.com/KSPP/linux/issues/20

drivers/scsi/aacraid/aachba.c:813:23:
warning: cast between incompatible function types from
'int (*)(struct scsi_cmnd *)' to 'void (*)(struct scsi_cmnd *)'
[-Wcast-function-type]

Link: https://lore.kernel.org/r/20200309155319.12658-1-tranmanphong@gmail.com
Reviewed-by: Bart van Assche <bvanassche@acm.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs-mediatek: fix HOST_PA_TACTIVATE quirk for Samsung UFS Devices
Stanley Chu [Mon, 2 Mar 2020 13:53:46 +0000 (21:53 +0800)]
scsi: ufs-mediatek: fix HOST_PA_TACTIVATE quirk for Samsung UFS Devices

Device quirk "UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE" is enabled for all
Samsung devices by default currently.

However MediaTek UFS host requires different host PA_TACTIVATE
configuration. Hence clear this quirk first and then apply vendor-specific
value in vops callback.

Link: https://lore.kernel.org/r/20200302135346.16797-1-stanley.chu@mediatek.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ibmvfc: Fix NULL return compiler warning
Brian King [Mon, 2 Mar 2020 14:39:21 +0000 (08:39 -0600)]
scsi: ibmvfc: Fix NULL return compiler warning

Fix up a compiler warning introduced via 54b04c99d02e

Link: https://lore.kernel.org/r/1583159961-15903-1-git-send-email-brking@linux.vnet.ibm.com
Fixes: 54b04c99d02e ("scsi: ibmvfc: Avoid loss of all paths during SVC node reboot")
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: fusion: fix if-statement empty body warning
Randy Dunlap [Sun, 8 Mar 2020 05:01:15 +0000 (21:01 -0800)]
scsi: fusion: fix if-statement empty body warning

When driver debugging is not enabled, change the debug print macros
to use the no_printk() macro.

This fixes a gcc warning when -Wextra is set:
../drivers/message/fusion/mptlan.c:266:39: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

I have verified that there is very little object code change (with
gcc 7.5.0). There are a few changes like:
  cmp %a,%b
  jl $1
to
  cmp %b,%a
  jg $1

Link: https://lore.kernel.org/r/ff9df31b-c4c1-c942-1cbf-18039e084c8e@infradead.org
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: MPT-FusionLinux.pdl@broadcom.com
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Reviewed-by: Bart van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: iscsi: Add support for asynchronous iSCSI session destruction
Frank Mayhar [Thu, 27 Feb 2020 19:59:45 +0000 (14:59 -0500)]
scsi: iscsi: Add support for asynchronous iSCSI session destruction

iSCSI session destruction can be arbitrarily slow, since it might require
network operations and serialization inside the SCSI layer.  This patch
adds a new user event to trigger the destruction work asynchronously,
releasing the rx_queue_mutex as soon as the operation is queued and before
it is performed.  This change allows other operations to run in other
sessions in the meantime, removing one of the major iSCSI bottlenecks for
us.

To prevent the session from being used after the destruction request, we
remove it immediately from the sesslist. This simplifies the locking
required during the asynchronous removal.

Link: https://lore.kernel.org/r/20200227195945.761719-1-krisman@collabora.com
Co-developed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Co-developed-by: Khazhismel Kumykov <khazhy@google.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Frank Mayhar <fmayhar@google.com>
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: Disabling TM path and only processing IOP reset
Sagar Biradar [Thu, 13 Feb 2020 00:29:31 +0000 (16:29 -0800)]
scsi: aacraid: Disabling TM path and only processing IOP reset

Fixes the occasional adapter panic when sg_reset is issued with -d, -t, -b
and -H flags.  Removal of command type HBA_IU_TYPE_SCSI_TM_REQ in
aac_hba_send since iu_type, request_id and fib_flags are not populated.
Device and target reset handlers are made to send TMF commands only when
reset_state is 0.

Link: https://lore.kernel.org/r/1581553771-25796-1-git-send-email-Sagar.Biradar@microchip.com
Reviewed-by: Sagar Biradar <Sagar.Biradar@microchip.com>
Signed-off-by: Sagar Biradar <Sagar.Biradar@microchip.com>
Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ibmvfc: Avoid loss of all paths during SVC node reboot
Brian King [Thu, 27 Feb 2020 01:45:43 +0000 (19:45 -0600)]
scsi: ibmvfc: Avoid loss of all paths during SVC node reboot

When an SVC node goes down as part of a node reboot, its WWPNs are moved to
the remaining node. When the node is back online, its WWPNs are moved
back. The result is that the WWPN moves from one NPort_ID to another, then
back again.  The ibmvfc driver was forcing the old port to be removed, but
not sending an implicit logout. When the WWPN showed up at the new
location, the PLOGI failed as there was already a login established for the
old scsi id. The patch below fixes this by ensuring we always send an
implicit logout for any scsi id associated with an rport prior to calling
fc_remote_port_delete.

Link: https://lore.kernel.org/r/1582767943-16611-1-git-send-email-brking@linux.vnet.ibm.com
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Mon, 24 Feb 2020 16:14:06 +0000 (10:14 -0600)]
scsi: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language extension
to the C90 standard, but the preferred mechanism to declare variable-length
types such as these ones is a flexible array member[1][2], introduced in
C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning in
case the flexible array does not occur last in the structure, which will
help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by this
change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Link: https://lore.kernel.org/r/20200224161406.GA21454@embeddedor
Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Simplify two tests
Bart Van Assche [Thu, 23 Jan 2020 03:56:36 +0000 (19:56 -0800)]
scsi: ufs: Simplify two tests

lrbp->cmd is set only for SCSI commands. Use this knowledge to simplify two
boolean expressions.

Link: https://lore.kernel.org/r/20200123035637.21848-4-bvanassche@acm.org
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Can Guo <cang@codeaurora.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Introduce ufshcd_init_lrb()
Bart Van Assche [Thu, 23 Jan 2020 03:56:35 +0000 (19:56 -0800)]
scsi: ufs: Introduce ufshcd_init_lrb()

This patch does not change any functionality but makes the next patch in
this series easier to read.

Link: https://lore.kernel.org/r/20200123035637.21848-3-bvanassche@acm.org
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Can Guo <cang@codeaurora.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: Introduce {init,exit}_cmd_priv()
Bart Van Assche [Thu, 23 Jan 2020 03:56:34 +0000 (19:56 -0800)]
scsi: core: Introduce {init,exit}_cmd_priv()

The current behavior of the SCSI core is to clear driver-private data
before preparing a request for submission to the SCSI LLD. Make it possible
for SCSI LLDs to disable clearing of driver-private data.

These hooks will be used by a later patch, namely "scsi: ufs: Let the SCSI
core allocate per-command UFS data".

Link: https://lore.kernel.org/r/20200123035637.21848-2-bvanassche@acm.org
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Can Guo <cang@codeaurora.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Johannes Thumshirn <jth@kernel.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: Remove cmd_list functionality
Hannes Reinecke [Fri, 28 Feb 2020 07:53:18 +0000 (08:53 +0100)]
scsi: core: Remove cmd_list functionality

Remove cmd_list functionality; no users left.  With that the
scsi_put_command() becomes empty, so remove that one, too.

Link: https://lore.kernel.org/r/20200228075318.91255-14-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()
Hannes Reinecke [Fri, 28 Feb 2020 07:53:17 +0000 (08:53 +0100)]
scsi: aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()

Use the SCSI midlayer helper to traverse the number of outstanding
commands. This also eliminates the last usage for the cmd_list
functionality so we can drop it.

Link: https://lore.kernel.org/r/20200228075318.91255-13-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: use scsi_host_busy_iter() to wait for outstanding commands
Hannes Reinecke [Fri, 28 Feb 2020 07:53:16 +0000 (08:53 +0100)]
scsi: aacraid: use scsi_host_busy_iter() to wait for outstanding commands

Instead of traversing the list of possible commands by hands we should be
using scsi_host_busy_iter() to figure out if there are outstanding
commands.

Link: https://lore.kernel.org/r/20200228075318.91255-12-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P < Balsundar.P@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: add scsi_host_busy_iter()
Hannes Reinecke [Fri, 28 Feb 2020 07:53:15 +0000 (08:53 +0100)]
scsi: core: add scsi_host_busy_iter()

Add an iterator scsi_host_busy_iter() to traverse all busy commands.  If
locking against concurrent command completions is required, it has to be
provided by the caller.

Link: https://lore.kernel.org/r/20200228075318.91255-11-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: use scsi_host_(block,unblock) to block I/O
Hannes Reinecke [Fri, 28 Feb 2020 07:53:14 +0000 (08:53 +0100)]
scsi: aacraid: use scsi_host_(block,unblock) to block I/O

Use scsi_host_block() and scsi_host_unblock() instead of
scsi_block_requests()/scsi_unblock_requests() to block and unblock I/O.
This has the advantage that the block layer will stop sending I/O to the
adapter instead of having the SCSI midlayer requeueing I/O internally.

Link: https://lore.kernel.org/r/20200228075318.91255-10-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P < Balsundar.P@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: add scsi_host_(block,unblock) helper function
Hannes Reinecke [Fri, 28 Feb 2020 07:53:13 +0000 (08:53 +0100)]
scsi: core: add scsi_host_(block,unblock) helper function

Add helper functions to call scsi_internal_device_block()/
scsi_internal_device_unblock() for all attached devices on a SCSI host.

Link: https://lore.kernel.org/r/20200228075318.91255-9-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: move scsi_(block,unblock)_requests out of _aac_reset_adapter()
Hannes Reinecke [Fri, 28 Feb 2020 07:53:12 +0000 (08:53 +0100)]
scsi: aacraid: move scsi_(block,unblock)_requests out of _aac_reset_adapter()

_aac_reset_adapter() only has one caller, and that one already calls
scsi_block_requests(). Move the calls out of _aac_reset_adapter() to avoid
calling scsi_block_requests() twice.

Link: https://lore.kernel.org/r/20200228075318.91255-8-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P < Balsundar.P@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: replace aac_flush_ios() with midlayer helper
Hannes Reinecke [Fri, 28 Feb 2020 07:53:11 +0000 (08:53 +0100)]
scsi: aacraid: replace aac_flush_ios() with midlayer helper

Use the midlayer helper scsi_host_complete_all_commands() to flush all
outstanding commands.

Link: https://lore.kernel.org/r/20200228075318.91255-7-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: use scsi_host_complete_all_commands() to terminate outstanding commands
Hannes Reinecke [Fri, 28 Feb 2020 07:53:10 +0000 (08:53 +0100)]
scsi: aacraid: use scsi_host_complete_all_commands() to terminate outstanding commands

Use scsi_host_complete_all_commands() to terminate all outstanding commands
and change the command result for terminated commands to the more common
'DID_RESET' instead of 'QUEUE_FULL'.

Link: https://lore.kernel.org/r/20200228075318.91255-6-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: Do not wait for outstanding write commands on synchronize_cache
Hannes Reinecke [Fri, 28 Feb 2020 07:53:09 +0000 (08:53 +0100)]
scsi: aacraid: Do not wait for outstanding write commands on synchronize_cache

There is no need to wait for outstanding write commands on synchronize
cache; the block layer is responsible for I/O scheduling, no need to
out-guess it in the driver layer.

Link: https://lore.kernel.org/r/20200228075318.91255-5-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P <balsundar.b@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: dpt_i2o: use scsi_host_complete_all_commands() to abort outstanding commands
Hannes Reinecke [Fri, 28 Feb 2020 07:53:08 +0000 (08:53 +0100)]
scsi: dpt_i2o: use scsi_host_complete_all_commands() to abort outstanding commands

Rather than traversing all outstanding commands manually, use the
scsi_host_complete_all_commands() helper to terminate all commands during
reset.  With that we can drop the cmd_list usage from the midlayer.

Link: https://lore.kernel.org/r/20200228075318.91255-4-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: add scsi_host_complete_all_commands() helper
Hannes Reinecke [Fri, 28 Feb 2020 07:53:07 +0000 (08:53 +0100)]
scsi: core: add scsi_host_complete_all_commands() helper

Add a helper scsi_host_complete_all_commands() to terminate all outstanding
commands on a SCSI host.

Link: https://lore.kernel.org/r/20200228075318.91255-3-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete()
Hannes Reinecke [Fri, 28 Feb 2020 07:53:06 +0000 (08:53 +0100)]
scsi: dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete()

Rename the badly named function into adpt_i2o_scsi_complete(), and make it
a void function as the return value is never used.  This also fixes a
potential use-after-free as the return value might be evaluated from the
command result after the command has been freed.

Link: https://lore.kernel.org/r/20200228075318.91255-2-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: use kobj_to_dev
Guosong Su [Tue, 25 Feb 2020 10:04:11 +0000 (18:04 +0800)]
scsi: core: use kobj_to_dev

Use kobj_to_dev to instead of open-coding it.

Link: https://lore.kernel.org/r/20200225100411.10250-1-guosongsu@gmail.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Guosong Su <suguosong@xiaomi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: ufs-mediatek: add waiting time for reference clock
Stanley Chu [Thu, 20 Feb 2020 13:48:48 +0000 (21:48 +0800)]
scsi: ufs: ufs-mediatek: add waiting time for reference clock

Some delays may be required either after gating or before ungating
reference clock for device according to vendor requirements.

Note that in UFS 3.0, the delay time after gating reference
clock can be defined by attribute bRefClkGatingWaitTime. Use the
formal value instead if it can be queried from device.

Link: https://lore.kernel.org/r/20200220134848.8807-2-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices
Can Guo [Mon, 24 Feb 2020 04:09:22 +0000 (20:09 -0800)]
scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices

Western Digital UFS devices require host's PA_TACTIVATE to be lower than
device's PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

Link: https://lore.kernel.org/r/1582517363-11536-3-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Allow vendor device quirks to be applied early
Can Guo [Mon, 24 Feb 2020 04:09:21 +0000 (20:09 -0800)]
scsi: ufs: Allow vendor device quirks to be applied early

Currently ufshcd_vops_apply_dev_quirks() comes after all UniPro parameters
have been tuned. Move it up so that vendors have a chance to apply device
quirks in advance.

Link: https://lore.kernel.org/r/1582517363-11536-2-git-send-email-cang@codeaurora.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufshcd: use an enum for quirks
Christoph Hellwig [Fri, 21 Feb 2020 14:08:12 +0000 (06:08 -0800)]
scsi: ufshcd: use an enum for quirks

Use an enum to specify the various quirks instead of #defines inside the
structure definition.

[mkp: fix typo]

Link: https://lore.kernel.org/r/20200221140812.476338-3-hch@lst.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufshcd: remove unused quirks
Christoph Hellwig [Fri, 21 Feb 2020 14:08:11 +0000 (06:08 -0800)]
scsi: ufshcd: remove unused quirks

Remove various quirks that don't have users, as well as the dead code keyed
off them.

Link: https://lore.kernel.org/r/20200221140812.476338-2-hch@lst.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Update driver version to 10.01.00.25-k
Himanshu Madhani [Wed, 26 Feb 2020 22:40:22 +0000 (14:40 -0800)]
scsi: qla2xxx: Update driver version to 10.01.00.25-k

Link: https://lore.kernel.org/r/20200226224022.24518-19-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Set Nport ID for N2N
Quinn Tran [Wed, 26 Feb 2020 22:40:21 +0000 (14:40 -0800)]
scsi: qla2xxx: Set Nport ID for N2N

When transitioning from loop to N2N, stale NPort ID is not
re-assigned. Stale ID can collide with remote device.  This patch will
re-assign NPort ID on N2N is detected.

Link: https://lore.kernel.org/r/20200226224022.24518-18-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Handle NVME status iocb correctly
Arun Easi [Wed, 26 Feb 2020 22:40:20 +0000 (14:40 -0800)]
scsi: qla2xxx: Handle NVME status iocb correctly

Certain state flags bit combinations are not checked and not handled
correctly. Plus, do not log a normal underrun situation where there is
no frame drop.

Link: https://lore.kernel.org/r/20200226224022.24518-17-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Remove restriction of FC T10-PI and FC-NVMe
Quinn Tran [Wed, 26 Feb 2020 22:40:19 +0000 (14:40 -0800)]
scsi: qla2xxx: Remove restriction of FC T10-PI and FC-NVMe

T10-PI and FC-NVMe are not mutually exclusive. This patch removes
restrictions where if FC-NVMe is enabled T10-PI defaults to disabled.

Link: https://lore.kernel.org/r/20200226224022.24518-16-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Serialize fc_port alloc in N2N
Quinn Tran [Wed, 26 Feb 2020 22:40:18 +0000 (14:40 -0800)]
scsi: qla2xxx: Serialize fc_port alloc in N2N

For N2N, fc_port struct is created during report id acquisition.  At
later time, the loop resync (fabric, n2n, loop) would trigger the rest
of the login using the created fc_port struct.  The loop resync logic
can trigger another fc_port allocation if the 1st allocation was not
able to execute.  This patch prevents the 2nd allocation trigger.

Link: https://lore.kernel.org/r/20200226224022.24518-15-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix NPIV instantiation after FW dump
Quinn Tran [Wed, 26 Feb 2020 22:40:17 +0000 (14:40 -0800)]
scsi: qla2xxx: Fix NPIV instantiation after FW dump

NPIV re-enable code was blocked after FW had been initialized.  The
blocking check was too broad. Reduce the check to make sure if FW is
initialized or not.

Link: https://lore.kernel.org/r/20200226224022.24518-14-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix RDP respond data format
Quinn Tran [Wed, 26 Feb 2020 22:40:16 +0000 (14:40 -0800)]
scsi: qla2xxx: Fix RDP respond data format

RPD information failed to display by switch cli command.  This is
caused by driver failure to properly format RDP response data with
data descriptor to allow switch to parse it correctly.

Link: https://lore.kernel.org/r/20200226224022.24518-13-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Force semaphore on flash validation failure
Quinn Tran [Wed, 26 Feb 2020 22:40:15 +0000 (14:40 -0800)]
scsi: qla2xxx: Force semaphore on flash validation failure

For single port 28XX adapter, the second core can still run in the
background.  The flash semaphore can be held by the non-active core.
This patch tell MPI FW to check for this case and clear the semaphore
from the non-active core.

Link: https://lore.kernel.org/r/20200226224022.24518-12-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: add more FW debug information
Quinn Tran [Wed, 26 Feb 2020 22:40:14 +0000 (14:40 -0800)]
scsi: qla2xxx: add more FW debug information

Per FW request, MB 1-7 should be logged for 8002 error.

Link: https://lore.kernel.org/r/20200226224022.24518-11-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Update BPM enablement semantics.
Andrew Vasquez [Wed, 26 Feb 2020 22:40:13 +0000 (14:40 -0800)]
scsi: qla2xxx: Update BPM enablement semantics.

commit e4e3a2ce9556 ("scsi: qla2xxx: Add ability to autodetect SFP
type") takes a heavy handed approach to BPM (Buffer Plus Management)
enablement:

1) During hardware initialization, if an LR-capable transceiver is
   recognized, the driver schedules a disruptive post-initialization
   chip-reset (ISP-ABORT) to allow the BPM settings to be sent to the
   firmware.  This chip-reset will result in (short-term) path-loss to
   all fc-rports and their attached SCSI devices.

2) LR-detection is triggered during any link-up event, resulting in a
   refresh and potential chip-reset

Based on firmware-team guidance, upon LR-capable transceiver
recognition, the driver's hardware initialization code will now
re-execute firmware with the new BPM settings, then continue on with
driver initialization.  To address the second issue, the driver
performs LR-capable detection upon the driver receiving a
transceiver-insertion asynchronous event from firmware.  No short-term
path loss is needed with this new semantic.

Link: https://lore.kernel.org/r/20200226224022.24518-10-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: fix FW resource count values
Quinn Tran [Wed, 26 Feb 2020 22:40:12 +0000 (14:40 -0800)]
scsi: qla2xxx: fix FW resource count values

This patch fixes issue where current and original exchanges count
were swapped for intiator and targets.

Also fix IOCB count for current and original which were swapped.

Link: https://lore.kernel.org/r/20200226224022.24518-9-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Use a dedicated interrupt handler for 'handshake-required' ISPs
Andrew Vasquez [Wed, 26 Feb 2020 22:40:11 +0000 (14:40 -0800)]
scsi: qla2xxx: Use a dedicated interrupt handler for 'handshake-required' ISPs

There's no point checking flags.disable_msix_handshake in the
interrupt handler hot-path.  Instead perform the check during
queue-pair instantiation and use the proper interrupt handler.

Link: https://lore.kernel.org/r/20200226224022.24518-8-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Return appropriate failure through BSG Interface
Michael Hernandez [Wed, 26 Feb 2020 22:40:10 +0000 (14:40 -0800)]
scsi: qla2xxx: Return appropriate failure through BSG Interface

This patch ensures flash updates API calls return possible failure
status through BSG interface to the application.

Link: https://lore.kernel.org/r/20200226224022.24518-7-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Michael Hernandez <mhernandez@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Improved secure flash support messages
Michael Hernandez [Wed, 26 Feb 2020 22:40:09 +0000 (14:40 -0800)]
scsi: qla2xxx: Improved secure flash support messages

This patch improved message for Secure Flash support.  No
functionality has been changed.

Link: https://lore.kernel.org/r/20200226224022.24518-6-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Michael Hernandez <mhernandez@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix FCP-SCSI FC4 flag passing error
Quinn Tran [Wed, 26 Feb 2020 22:40:08 +0000 (14:40 -0800)]
scsi: qla2xxx: Fix FCP-SCSI FC4 flag passing error

This patch fixes issue where incorrect flag was used for sending
switch commands.

Link: https://lore.kernel.org/r/20200226224022.24518-5-hmadhani@marvell.com
Fixes: e8c72ba51a15 ("[SCSI] qla2xxx: Use GFF_ID to check FCP-SCSI FC4 type before logging into Nx_Ports")
Fixes: a4239945b8ad ("scsi: qla2xxx: Add switch command to simplify fabric discovery")
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Use FC generic update firmware options routine for ISP27xx
Giridhar Malavali [Wed, 26 Feb 2020 22:40:07 +0000 (14:40 -0800)]
scsi: qla2xxx: Use FC generic update firmware options routine for ISP27xx

This patch uses generic firmware update options for FCoE based
adapters as well to reduce code duplication.

Link: https://lore.kernel.org/r/20200226224022.24518-4-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Avoid setting firmware options twice in 24xx_update_fw_options.
Giridhar Malavali [Wed, 26 Feb 2020 22:40:06 +0000 (14:40 -0800)]
scsi: qla2xxx: Avoid setting firmware options twice in 24xx_update_fw_options.

This patch moves ql2xrdpenable check earlier to avoids setting
fw_option once again before exiting qla24xx_update_fw_options.

Link: https://lore.kernel.org/r/20200226224022.24518-3-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add 16.0GT for PCI String
Himanshu Madhani [Wed, 26 Feb 2020 22:40:05 +0000 (14:40 -0800)]
scsi: qla2xxx: Add 16.0GT for PCI String

This patch adds 16.0GT for readable display string.

Link: https://lore.kernel.org/r/20200226224022.24518-2-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Convert MAKE_HANDLE() from a define into an inline function
Bart Van Assche [Thu, 20 Feb 2020 04:34:40 +0000 (20:34 -0800)]
scsi: qla2xxx: Convert MAKE_HANDLE() from a define into an inline function

This patch allows sparse to verify the endianness of the arguments passed
to make_handle().

Link: https://lore.kernel.org/r/20200220043441.20504-5-bvanassche@acm.org
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Cc: Daniel Wagner <dwagner@suse.de>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Quinn Tran <qutran@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix sparse warnings triggered by the PCI state checking code
Bart Van Assche [Thu, 20 Feb 2020 04:34:39 +0000 (20:34 -0800)]
scsi: qla2xxx: Fix sparse warnings triggered by the PCI state checking code

This patch fixes the following sparse warnings:

drivers/scsi/qla2xxx/qla_mbx.c:120:21: warning: restricted pci_channel_state_t degrades to integer
drivers/scsi/qla2xxx/qla_mbx.c:120:37: warning: restricted pci_channel_state_t degrades to integer

>From include/linux/pci.h:

enum pci_channel_state {
/* I/O channel is in normal state */
pci_channel_io_normal = (__force pci_channel_state_t) 1,

/* I/O to channel is blocked */
pci_channel_io_frozen = (__force pci_channel_state_t) 2,

/* PCI card is dead */
pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
};

Link: https://lore.kernel.org/r/20200220043441.20504-4-bvanassche@acm.org
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Quinn Tran <qutran@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Suppress endianness complaints in qla2x00_configure_local_loop()
Bart Van Assche [Thu, 20 Feb 2020 04:34:38 +0000 (20:34 -0800)]
scsi: qla2xxx: Suppress endianness complaints in qla2x00_configure_local_loop()

Instead of changing endianness in-place, write the data in CPU endian
format in another buffer and copy that buffer back. This patch does not
change any functionality but silences some sparse endianness warnings.

Link: https://lore.kernel.org/r/20200220043441.20504-3-bvanassche@acm.org
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Quinn Tran <qutran@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Simplify the code for aborting SCSI commands
Bart Van Assche [Thu, 20 Feb 2020 04:34:37 +0000 (20:34 -0800)]
scsi: qla2xxx: Simplify the code for aborting SCSI commands

Since the SCSI core does not reuse the tag of the SCSI command that is
being aborted by .eh_abort() before .eh_abort() has finished it is not
necessary to check from inside that callback whether or not the SCSI
command has already completed. Instead, rely on the firmware to return an
error code when attempting to abort a command that has already
completed. Additionally, rely on the firmware to return an error code when
attempting to abort an already aborted command.

In qla2x00_abort_srb(), use blk_mq_request_started() instead of
sp->completed and sp->aborted.

Link: https://lore.kernel.org/r/20200220043441.20504-2-bvanassche@acm.org
Cc: Martin Wilck <mwilck@suse.com>
Cc: Quinn Tran <qutran@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix sparse warning reported by kbuild bot
Himanshu Madhani [Thu, 27 Feb 2020 20:11:48 +0000 (12:11 -0800)]
scsi: qla2xxx: Fix sparse warning reported by kbuild bot

this patch fixes following sparse warnings

 >> drivers/scsi/qla2xxx/qla_tmpl.c:873:32: sparse: sparse: incorrect type in assignment (different base types)
 >> drivers/scsi/qla2xxx/qla_tmpl.c:873:32: sparse:    expected unsigned int [usertype] capture_timestamp
 >> drivers/scsi/qla2xxx/qla_tmpl.c:873:32: sparse:    got restricted __le32 [usertype]
    drivers/scsi/qla2xxx/qla_tmpl.c:885:29: sparse: sparse: incorrect type in assignment (different base types)
 >> drivers/scsi/qla2xxx/qla_tmpl.c:885:29: sparse:    expected unsigned int

  vim +873 drivers/scsi/qla2xxx/qla_tmpl.c

  869
  870 static void
  871 qla27xx_time_stamp(struct qla27xx_fwdt_template *tmp)
  872 {
> 873 tmp->capture_timestamp = cpu_to_le32(jiffies);
  874 }
  875
  876 static void
  877 qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
  878 {
  879 uint8_t v[] = { 0, 0, 0, 0, 0, 0 };
  880
  881 WARN_ON_ONCE(sscanf(qla2x00_version_str,
  882     "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
  883     v+0, v+1, v+2, v+3, v+4, v+5) != 6);
  884
> 885 tmp->driver_info[0] = cpu_to_le32(
  886 v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);
  887 tmp->driver_info[1] = cpu_to_le32(v[5] << 8 | v[4]);
  888 tmp->driver_info[2] = __constant_cpu_to_le32(0x12345678);
  889 }
  890

Link: https://lore.kernel.org/r/20200227201148.13973-1-hmadhani@marvell.com
Fixes: a31056ddc665 ("scsi: qla2xxx: Use endian macros to assign static fields in fwdump header")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: lpfc: fix spelling mistake "Notication" -> "Notification"
Colin Ian King [Fri, 21 Feb 2020 15:48:41 +0000 (15:48 +0000)]
scsi: lpfc: fix spelling mistake "Notication" -> "Notification"

There is a spelling mistake in a lpfc_printf_vlog info message. Fix it.

[mkp: fix spelling mistake in commit description]

Link: https://lore.kernel.org/linux-scsi/20200221154841.77791-1-colin.king@canonical.com
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sr: get rid of sr global mutex
Merlijn Wajer [Tue, 18 Feb 2020 14:39:17 +0000 (15:39 +0100)]
scsi: sr: get rid of sr global mutex

When replacing the Big Kernel Lock in commit 2a48fc0ab242 ("block:
autoconvert trivial BKL users to private mutex"), the lock was replaced
with a sr-wide lock.

This causes very poor performance when using multiple sr devices, as the sr
driver was not able to execute more than one command to one drive at any
given time, even when there were many CD drives available.

Replace the global mutex with per-sr-device mutex.

Someone tried this patch at the time, but it never made it upstream, due to
possible concerns with race conditions, but it's not clear the patch
actually caused those:

https://www.spinics.net/lists/linux-scsi/msg63706.html
https://www.spinics.net/lists/linux-scsi/msg63750.html

Also see

http://lists.xiph.org/pipermail/paranoia/2019-December/001647.html

Link: https://lore.kernel.org/r/20200218143918.30267-1-merlijn@archive.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Merlijn Wajer <merlijn@archive.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled
Diego Elio Pettenò [Sun, 23 Feb 2020 19:11:44 +0000 (19:11 +0000)]
scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled

This kernel configuration is basically enabling/disabling sr driver quirks
detection. While these quirks are for fairly rare devices (very old CD
burners, and a glucometer), the additional detection of these models is a
very minimal amount of code.

The logic behind the quirks is always built into the sr driver.

This also removes the config from all the defconfig files that are enabling
this already.

Link: https://lore.kernel.org/r/20200223191144.726-1-flameeyes@flameeyes.com
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ch: remove ch_mutex()
Hannes Reinecke [Thu, 13 Feb 2020 15:32:07 +0000 (16:32 +0100)]
scsi: ch: remove ch_mutex()

ch_mutex() was introduced with a mechanical conversion, but as we now have
correct locking we can remove it altogether.

Link: https://lore.kernel.org/r/20200213153207.123357-4-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ch: synchronize ch_probe() and ch_open()
Hannes Reinecke [Thu, 13 Feb 2020 15:32:06 +0000 (16:32 +0100)]
scsi: ch: synchronize ch_probe() and ch_open()

The 'ch' device node is created before the configuration is being read in,
which leads to a race window when ch_open() is called before that.

To avoid any races we should be taking the device mutex during
ch_readconfig() and ch_init_elem(), and also during ch_open().
That ensures ch_probe is finished before ch_open() completes.

Link: https://lore.kernel.org/r/20200213153207.123357-3-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ch: fixup refcounting imbalance for SCSI devices
Hannes Reinecke [Thu, 13 Feb 2020 15:32:05 +0000 (16:32 +0100)]
scsi: ch: fixup refcounting imbalance for SCSI devices

The SCSI device is required to be present during ch_probe() and ch_open().
But the SCSI device itself is only checked during ch_open(), so it's anyones
guess if it had been present during ch_probe(). And consequently we can't
reliably detach it during ch_release(), as ch_remove() might have been
called first.  So initialize the changer device during ch_probe(), and take
a reference to the SCSI device during both ch_probe() and ch_open().

[mkp: fixed checkpatch warning]

Link: https://lore.kernel.org/r/20200213153207.123357-2-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Update driver version to 10.01.00.24-k
Himanshu Madhani [Wed, 12 Feb 2020 21:44:36 +0000 (13:44 -0800)]
scsi: qla2xxx: Update driver version to 10.01.00.24-k

Link: https://lore.kernel.org/r/20200212214436.25532-26-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Use QLA_FW_STOPPED macro to propagate flag
Himanshu Madhani [Wed, 12 Feb 2020 21:44:35 +0000 (13:44 -0800)]
scsi: qla2xxx: Use QLA_FW_STOPPED macro to propagate flag

This patch uses QLA_FW_STOPPED macro so that flag is propogated to all the
QPairs.

Link: https://lore.kernel.org/r/20200212214436.25532-25-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add fixes for mailbox command
Himanshu Madhani [Wed, 12 Feb 2020 21:44:34 +0000 (13:44 -0800)]
scsi: qla2xxx: Add fixes for mailbox command

This patch fixes:

- qla2x00_issue_iocb_timeout will now return if chip is down

- only check for sp->qpair in abort handling

Link: https://lore.kernel.org/r/20200212214436.25532-24-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix control flags for login/logout IOCB
Himanshu Madhani [Wed, 12 Feb 2020 21:44:33 +0000 (13:44 -0800)]
scsi: qla2xxx: Fix control flags for login/logout IOCB

This patch fixes control flag options for login/logout IOCB.

Link: https://lore.kernel.org/r/20200212214436.25532-23-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Save rscn_gen for new fcport
Himanshu Madhani [Wed, 12 Feb 2020 21:44:32 +0000 (13:44 -0800)]
scsi: qla2xxx: Save rscn_gen for new fcport

Add missing rscn_gen when creating new fcport.

Link: https://lore.kernel.org/r/20200212214436.25532-22-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Use correct ISP28xx active FW region
Quinn Tran [Wed, 12 Feb 2020 21:44:31 +0000 (13:44 -0800)]
scsi: qla2xxx: Use correct ISP28xx active FW region

For ISP28xx, use 28xx call to retrieve active FW region.

Link: https://lore.kernel.org/r/20200212214436.25532-21-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Print portname for logging in qla24xx_logio_entry()
Joe Carnuccio [Wed, 12 Feb 2020 21:44:30 +0000 (13:44 -0800)]
scsi: qla2xxx: Print portname for logging in qla24xx_logio_entry()

Add port name in the messages file to help debugging of Login/Logout IOCBs

Link: https://lore.kernel.org/r/20200212214436.25532-20-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix qla2x00_echo_test() based on ISP type
Joe Carnuccio [Wed, 12 Feb 2020 21:44:29 +0000 (13:44 -0800)]
scsi: qla2xxx: Fix qla2x00_echo_test() based on ISP type

Ths patch fixes MBX in-direction for setting right bits for
qla2x00_echo_test()

Link: https://lore.kernel.org/r/20200212214436.25532-19-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Correction to selection of loopback/echo test
Joe Carnuccio [Wed, 12 Feb 2020 21:44:28 +0000 (13:44 -0800)]
scsi: qla2xxx: Correction to selection of loopback/echo test

This fixes loopback and echo test options.

Link: https://lore.kernel.org/r/20200212214436.25532-18-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Use endian macros to assign static fields in fwdump header
Joe Carnuccio [Wed, 12 Feb 2020 21:44:27 +0000 (13:44 -0800)]
scsi: qla2xxx: Use endian macros to assign static fields in fwdump header

This takes care of big endian architectures.

Link: https://lore.kernel.org/r/20200212214436.25532-17-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix RDP response size
Himanshu Madhani [Wed, 12 Feb 2020 21:44:26 +0000 (13:44 -0800)]
scsi: qla2xxx: Fix RDP response size

This patch fixes RDP length in case when driver needs to reduce length of
RDP response

Link: https://lore.kernel.org/r/20200212214436.25532-16-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Handle cases for limiting RDP response payload length
Joe Carnuccio [Wed, 12 Feb 2020 21:44:25 +0000 (13:44 -0800)]
scsi: qla2xxx: Handle cases for limiting RDP response payload length

This patch reduces RDP response payload length, if requesting port is a
domain controller (sid 0xfffc01) and fw is earlier than 8.09.00 and fw is
not 8.05.65 then limit the RDP response payload length to maximum of 256
bytes by terminating the response just before the optical element
descriptor.

Link: https://lore.kernel.org/r/20200212214436.25532-15-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add deferred queue for processing ABTS and RDP
Joe Carnuccio [Wed, 12 Feb 2020 21:44:24 +0000 (13:44 -0800)]
scsi: qla2xxx: Add deferred queue for processing ABTS and RDP

This patch adds deferred queue for processing aborts and RDP in the driver.

Link: https://lore.kernel.org/r/20200212214436.25532-14-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Cleanup ELS/PUREX iocb fields
Joe Carnuccio [Wed, 12 Feb 2020 21:44:23 +0000 (13:44 -0800)]
scsi: qla2xxx: Cleanup ELS/PUREX iocb fields

This patch does the following to improve RDP processing:

 - Rename field port_id to d_id in ELS and PUREX iocb structs to match FW
   spec.

 - Remove redundant comments from ELS and PUREX iocb structs.

 - Refactor fields in ELS iocb struct for error subcode common access.

 - Properly use error subcode fields in rdp processing routine.

 - Add print logs for alloc failure in purex rdp processing routine.

Link: https://lore.kernel.org/r/20200212214436.25532-13-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Show correct port speed capabilities for RDP command
Himanshu Madhani [Wed, 12 Feb 2020 21:44:22 +0000 (13:44 -0800)]
scsi: qla2xxx: Show correct port speed capabilities for RDP command

This patch correctly displays port speed capability and current speed for
RDP command.

Link: https://lore.kernel.org/r/20200212214436.25532-12-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Display message for FCE enabled
Himanshu Madhani [Wed, 12 Feb 2020 21:44:21 +0000 (13:44 -0800)]
scsi: qla2xxx: Display message for FCE enabled

During Link up phase and Data rate MBX command response, print message
indicating FCE is enabled.

Link: https://lore.kernel.org/r/20200212214436.25532-11-hmadhani@marvell.com
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add vendor extended FDMI commands
Joe Carnuccio [Wed, 12 Feb 2020 21:44:20 +0000 (13:44 -0800)]
scsi: qla2xxx: Add vendor extended FDMI commands

This patch adds support for extended FDMI commands and cleans up code to
reduce duplication.

Link: https://lore.kernel.org/r/20200212214436.25532-10-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add ql2xrdpenable module parameter for RDP
Joe Carnuccio [Wed, 12 Feb 2020 21:44:19 +0000 (13:44 -0800)]
scsi: qla2xxx: Add ql2xrdpenable module parameter for RDP

This patch provides separate module parameter ql2xrdpenable to turn on/off
RDP capability in the driver. However, if ql2xsmartsan parameter is
enabled, it will also turn on ql2xfdmienable parameter since it is required
for RDP to work.

Link: https://lore.kernel.org/r/20200212214436.25532-9-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add vendor extended RDP additions and amendments
Joe Carnuccio [Wed, 12 Feb 2020 21:44:18 +0000 (13:44 -0800)]
scsi: qla2xxx: Add vendor extended RDP additions and amendments

This patch adds RDP command support in the driver. With the help of new
ql2xsmartsan parameter, driver will use PUREX IOCB mode to send RDP command
to switch and will be able to receive various diagnostic data.

Link: https://lore.kernel.org/r/20200212214436.25532-8-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add changes in preparation for vendor extended FDMI/RDP
Joe Carnuccio [Wed, 12 Feb 2020 21:44:17 +0000 (13:44 -0800)]
scsi: qla2xxx: Add changes in preparation for vendor extended FDMI/RDP

This patch prepares code for implementing Vendor specific extended FDMI/RDP
commands. It also addes support for MBC_GET_PORT_DATABASE and
MBC_GET_RNID_PARAMS commands.

Link: https://lore.kernel.org/r/20200212214436.25532-7-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add endianizer macro calls to fc host stats
Joe Carnuccio [Wed, 12 Feb 2020 21:44:16 +0000 (13:44 -0800)]
scsi: qla2xxx: Add endianizer macro calls to fc host stats

This patch fixes endian warning for fc_host_stats.

Link: https://lore.kernel.org/r/20200212214436.25532-6-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add sysfs node for D-Port Diagnostics AEN data
Joe Carnuccio [Wed, 12 Feb 2020 21:44:14 +0000 (13:44 -0800)]
scsi: qla2xxx: Add sysfs node for D-Port Diagnostics AEN data

This patch adds sysfs node to show D-Port diag data.

Link: https://lore.kernel.org/r/20200212214436.25532-4-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Move free of fcport out of interrupt context
Joe Carnuccio [Wed, 12 Feb 2020 21:44:13 +0000 (13:44 -0800)]
scsi: qla2xxx: Move free of fcport out of interrupt context

This patch moves freeing of fcport out of interrupt context.

Link: https://lore.kernel.org/r/20200212214436.25532-3-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add beacon LED config sysfs interface
Joe Carnuccio [Wed, 12 Feb 2020 21:44:12 +0000 (13:44 -0800)]
scsi: qla2xxx: Add beacon LED config sysfs interface

This patch provides an interface to do the following (using MBC 0x3B):

 - Displays (in hex) the LED config words for all three LEDs.

 - Programs the config words for one LED or for all three LEDs.

The sysfs node defined is named beacon_config.

First, to allow driver to gain LED control, do this:
 # echo 1 > /sys/class/scsi_host/host#/beacon

Then, to display config words for all three LEDs do this:
 # cat /sys/class/scsi_host/host#/beacon_config

To set config words for all three LEDs do this:
 # echo 3 xxxx yyyy zzzz > /sys/class/scsi_host/host#/beacon_config

Or, to set config word for a specific single LED n do this:
 # echo n xxxx > /sys/class/scsi_host/host#/beacon_config
  where n is the LED number (0, 1, 2)

Finally, to restore LED control back to firmware, do this:
 # echo 0 > /sys/class/scsi_host/host#/beacon

Link: https://lore.kernel.org/r/20200212214436.25532-2-hmadhani@marvell.com
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: use an enum to track emulate_ua_intlck_ctrl
David Disseldorp [Fri, 21 Feb 2020 09:44:01 +0000 (10:44 +0100)]
scsi: target: use an enum to track emulate_ua_intlck_ctrl

The emulate_ua_intlck_ctrl device attribute accepts values of 0, 1 or 2 via
ConfigFS, which map to unit attention interlocks control codes in the MODE
SENSE control Mode Page.  Use an enum to track these values so that it's
clear that, unlike the remaining emulate_X attributes,
emulate_ua_intlck_ctrl isn't boolean.

Link: https://marc.info/?l=target-devel&m=158227825428798
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: convert boolean se_dev_attrib types to bool
David Disseldorp [Wed, 19 Feb 2020 13:01:36 +0000 (14:01 +0100)]
scsi: target: convert boolean se_dev_attrib types to bool

This should harden us against configfs API regressions similar to the one
fixed by the previous commit.

Link: https://marc.info/?l=target-devel&m=158211731505174
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: fix unmap_zeroes_data boolean initialisation
David Disseldorp [Wed, 19 Feb 2020 13:01:35 +0000 (14:01 +0100)]
scsi: target: fix unmap_zeroes_data boolean initialisation

The LIO unmap_zeroes_data device attribute is mapped to the LBPRZ flag in
the READ CAPACITY(16) and Thin Provisioning VPD INQUIRY responses.

The unmap_zeroes_data attribute is exposed via configfs, where any write
value is correctly validated via strtobool(). However, when initialised via
target_configure_unmap_from_queue() it takes the value of the device's
max_write_zeroes_sectors queue limit, which is non-boolean.

A non-boolean value can be read from configfs, but attempting to write the
same value back results in -EINVAL, causing problems for configuration
utilities such as targetcli.

Link: https://marc.info/?l=target-devel&m=158213354011309
Fixes: 2237498f0b5c ("target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout")
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>