cascardo/linux.git
7 years agoscsi: ibmvfc: fix typo in parameter description
Wei Yongjun [Thu, 8 Sep 2016 15:04:41 +0000 (15:04 +0000)]
scsi: ibmvfc: fix typo in parameter description

Fix typo in parameter description.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ufs: Fix a wrong string in power mode change
Kiwoong Kim [Thu, 8 Sep 2016 07:50:02 +0000 (16:50 +0900)]
scsi: ufs: Fix a wrong string in power mode change

I modified a string as described in UFS spec as follow: umpcrs -> upmcrs.

[mkp: applied by hand]

Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: bnx2fc: Mark symbols static where possible
Baoyou Xie [Sun, 4 Sep 2016 06:52:21 +0000 (14:52 +0800)]
scsi: bnx2fc: Mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/scsi/bnx2fc/bnx2fc_els.c:257:6: warning: no previous prototype for 'bnx2fc_srr_compl' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_els.c:367:6: warning: no previous prototype for 'bnx2fc_rec_compl' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:628:5: warning: no previous prototype for 'bnx2fc_percpu_io_thread' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:1413:26: warning: no previous prototype for 'bnx2fc_interface_create' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_hwi.c:997:21: warning: no previous prototype for 'bnx2fc_alloc_work' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_io.c:1082:5: warning: no previous prototype for 'bnx2fc_abts_cleanup' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.  so this
patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: aacraid: mark aac_src_select_comm() static
Baoyou Xie [Sun, 4 Sep 2016 06:47:10 +0000 (14:47 +0800)]
scsi: aacraid: mark aac_src_select_comm() static

We get 1 warning when building kernel with W=1:
drivers/scsi/aacraid/src.c:616:5: warning: no previous prototype for 'aac_src_select_comm' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static.  so this patch
marks this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: bnx2fc: Simplify code
Christophe JAILLET [Sat, 3 Sep 2016 07:05:48 +0000 (09:05 +0200)]
scsi: bnx2fc: Simplify code

Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to
'list_splice_init'.

This has been spotted with the following coccinelle script:
/////
@@
expression y,z;
@@

-   list_splice(y,z);
-   INIT_LIST_HEAD(y);
+   list_splice_init(y,z);

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ufs: Add missing header dependencies for tc-dwc-g210
Baoyou Xie [Mon, 29 Aug 2016 10:19:00 +0000 (18:19 +0800)]
scsi: ufs: Add missing header dependencies for tc-dwc-g210

We get 2 warnings when build kernel with W=1:
drivers/scsi/ufs/tc-dwc-g210.c:261:5: warning: no previous prototype for 'tc_dwc_g210_config_40_bit' [-Wmissing-prototypes]
drivers/scsi/ufs/tc-dwc-g210.c:293:5: warning: no previous prototype for 'tc_dwc_g210_config_20_bit' [-Wmissing-prototypes]

In fact, these functions are declared in ufs/tc-dwc-g210.h, so this
patch add missing header dependencies

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: sr: constify sr_pm_ops structure
Julia Lawall [Sun, 28 Aug 2016 20:17:38 +0000 (22:17 +0200)]
scsi: sr: constify sr_pm_ops structure

sr_pm_ops, of type struct dev_pm_ops, is never modified, so declare it
as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: pmcraid: mark symbols static where possible
Baoyou Xie [Sat, 27 Aug 2016 15:49:24 +0000 (23:49 +0800)]
scsi: pmcraid: mark symbols static where possible

We get 4 warnings about global functions without a declaration
in the scsi pmcraid driver when building with W=1:
drivers/scsi/pmcraid.c:309:6: warning: no previous prototype for 'pmcraid_init_cmdblk' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:404:6: warning: no previous prototype for 'pmcraid_return_cmd' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:1713:6: warning: no previous prototype for 'pmcraid_ioasc_logger' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:3141:1: warning: no previous prototype for 'pmcraid_init_ioadls' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which it is
declared and don't need a declaration, but can be made static.  so this
patch marks it 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Fixed a bug reported by Dan Carpenter
Bryant G. Ly [Wed, 31 Aug 2016 16:29:01 +0000 (11:29 -0500)]
scsi: ibmvscsis: Fixed a bug reported by Dan Carpenter

SUPPORTED_FORMATS is 1 << 1 so it's never zero.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Code cleanup of print statements
Bryant G. Ly [Wed, 31 Aug 2016 16:29:00 +0000 (11:29 -0500)]
scsi: ibmvscsis: Code cleanup of print statements

[mkp: applied by hand]

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Properly deregister target sessions
Bryant G. Ly [Wed, 31 Aug 2016 16:28:59 +0000 (11:28 -0500)]
scsi: ibmvscsis: Properly deregister target sessions

The driver currently doesn't properly deregisters target sessions
completely, so this will address that.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: bump driver version
Kevin Barnett [Wed, 31 Aug 2016 19:55:36 +0000 (14:55 -0500)]
scsi: smartpqi: bump driver version

[mkp: fixed typo]

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: add smartpqi.txt
Don Brace [Wed, 31 Aug 2016 19:55:30 +0000 (14:55 -0500)]
scsi: smartpqi: add smartpqi.txt

added Documentation/scsi/smartpqi.txt

[mkp: applied by hand]

Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: update Kconfig
Kevin Barnett [Wed, 31 Aug 2016 19:55:24 +0000 (14:55 -0500)]
scsi: smartpqi: update Kconfig

The aacraid driver will not managage Microsemi smartpqi controllers, but
will still manage older aacraid devices.

Updated help section.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: remove timeout for cache flush operations
Kevin Barnett [Wed, 31 Aug 2016 19:55:17 +0000 (14:55 -0500)]
scsi: smartpqi: remove timeout for cache flush operations

Some cache flush operations can take longer than the timeout value. Best
to not impose a time limit to handle all cases.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: scsi queuecommand cleanup
Kevin Barnett [Wed, 31 Aug 2016 19:55:11 +0000 (14:55 -0500)]
scsi: smartpqi: scsi queuecommand cleanup

minor cleanup of scsi queue command function

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: minor tweaks to update time support
Kevin Barnett [Wed, 31 Aug 2016 19:55:05 +0000 (14:55 -0500)]
scsi: smartpqi: minor tweaks to update time support

minor tweaks to update time support

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: minor function reformating
Kevin Barnett [Wed, 31 Aug 2016 19:54:59 +0000 (14:54 -0500)]
scsi: smartpqi: minor function reformating

reformatted pqi_num_elements_free() to match the rest of the driver

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: correct event acknowledgment timeout issue
Kevin Barnett [Wed, 31 Aug 2016 19:54:53 +0000 (14:54 -0500)]
scsi: smartpqi: correct event acknowledgment timeout issue

the driver no longer waits for the firmware to consume
the event ack IU.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: correct controller offline issue
Kevin Barnett [Wed, 31 Aug 2016 19:54:47 +0000 (14:54 -0500)]
scsi: smartpqi: correct controller offline issue

Fixes: 6c223761e 'smartpqi: initial commit of Microsemi smartpqi driver'

Fixed a bug where the driver would not free all of the
controller resources if the controller ever went offline.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: add kdump support
Kevin Barnett [Wed, 31 Aug 2016 19:54:41 +0000 (14:54 -0500)]
scsi: smartpqi: add kdump support

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: enhance reset logic
Kevin Barnett [Wed, 31 Aug 2016 19:54:35 +0000 (14:54 -0500)]
scsi: smartpqi: enhance reset logic

Eliminated timeout from LUN reset logic.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: enhance drive offline informational message
Kevin Barnett [Wed, 31 Aug 2016 19:54:29 +0000 (14:54 -0500)]
scsi: smartpqi: enhance drive offline informational message

Made a couple of error messages more verbose.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: simplify spanning
Kevin Barnett [Wed, 31 Aug 2016 19:54:23 +0000 (14:54 -0500)]
scsi: smartpqi: simplify spanning

Removed the workaround for the transition to spanning.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: change tmf macro names
Kevin Barnett [Wed, 31 Aug 2016 19:54:17 +0000 (14:54 -0500)]
scsi: smartpqi: change tmf macro names

small change to make code look cleaner

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: smartpqi: change aio sg processing
Kevin Barnett [Wed, 31 Aug 2016 19:54:11 +0000 (14:54 -0500)]
scsi: smartpqi: change aio sg processing

Take advantage of controller improvements.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: mpt: Remove deprecated create_singlethread_workqueue
Bhaktipriya Shridhar [Tue, 30 Aug 2016 19:03:25 +0000 (00:33 +0530)]
scsi: mpt: Remove deprecated create_singlethread_workqueue

The workqueues "ioc->reset_work_q" and "ioc->fw_event_q" queue a single
work item &ioc->fault_reset_work and &fw_event->work, respectively and
hence don't require ordering. Hence, they have been converted to use
alloc_workqueue().

The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure since the workqueue belongs to a storage driver which is
being used on a memory reclaim path.

Since there are fixed number of work items, explicit concurrency limit
is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: mptfc: Remove deprecated create_singlethread_workqueue
Bhaktipriya Shridhar [Tue, 30 Aug 2016 19:03:05 +0000 (00:33 +0530)]
scsi: mptfc: Remove deprecated create_singlethread_workqueue

The workqueue "fc_rescan_work_q" queues multiple work items viz
&ioc->fc_rescan_work, &ioc->fc_lsc_work, &ioc->fc_setup_reset_work,
which require strict execution ordering.  Hence, an ordered dedicated
workqueue has been used.

WQ_MEM_RECLAIM has been set since the workqueue is belongs to a storage
driver which is being used on a memory reclaim path and hence, requires
forward progress under memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: bfa: Do not dereference port before it is null checked
Colin Ian King [Tue, 30 Aug 2016 16:36:16 +0000 (17:36 +0100)]
scsi: bfa: Do not dereference port before it is null checked

Port is deferenced before it is null sanity checked, hence we
potentially have a null pointer dereference bug. Instead, initialise
trl_enabled from port->fcs->bfa after we are sure port is not null.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: qla4xxx: Mark symbols static where possible
Baoyou Xie [Mon, 29 Aug 2016 10:46:51 +0000 (18:46 +0800)]
scsi: qla4xxx: Mark symbols static where possible

We get 1 warning when build kernel with W=1:
drivers/scsi/qla4xxx/ql4_nx.c:1846:10: warning: no previous prototype for 'ql4_84xx_ipmdio_rd_reg' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static. This patch marks
this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: move function declarations to scsi_priv.h
Baoyou Xie [Tue, 30 Aug 2016 11:26:00 +0000 (19:26 +0800)]
scsi: move function declarations to scsi_priv.h

We get 2 warnings about global functions without a declaration in the
scsi driver when building with W=1:

drivers/scsi/scsi_lib.c:467:6: warning: no previous prototype for 'scsi_requeue_run_queue' [-Wmissing-prototypes]
drivers/scsi/scsi_lib.c:2609:6: warning: no previous prototype for 'scsi_evt_thread' [-Wmissing-prototypes]

In fact, both functions are declared in drivers/scsi/scsi_scan.c but
need to move them into scsi_priv.h.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: qla2xxx: fix spelling mistake "retyring" -> "retrying"
Colin Ian King [Sun, 28 Aug 2016 11:24:48 +0000 (12:24 +0100)]
scsi: qla2xxx: fix spelling mistake "retyring" -> "retrying"

Trivial fix to spelling mistakes in ql_dbg messages.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ncr5380: Avoid a compiler warning
Finn Thain [Sat, 27 Aug 2016 02:30:00 +0000 (12:30 +1000)]
scsi: ncr5380: Avoid a compiler warning

With commit 3a0f64bfa907 ("mac_scsi: Fix pseudo DMA implementation")
some versions of gcc now warn:

In file included from drivers/scsi/mac_scsi.c:335:
drivers/scsi/NCR5380.h:295: warning: `NCR5380_poll_politely' declared inline after being called
drivers/scsi/NCR5380.h:295: warning: previous declaration of `NCR5380_poll_politely' was here

Avoid this by defining NCR5380_poll_politely() in NCR5380.h.

[mkp: checkpatch warnings]

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: Documentation/scsi: Remove nodisconnect parameter
Finn Thain [Sat, 27 Aug 2016 02:29:59 +0000 (12:29 +1000)]
scsi: Documentation/scsi: Remove nodisconnect parameter

The driver that used the 'nodisconnect' parameter was removed in commit
565bae6a4a8f ("[SCSI] 53c7xx: kill driver"). Related documentation was
cleaned up in commit f37a7238d379 ("[SCSI] 53c7xx: fix removal
fallout"), except for the remaining two mentions that are removed here.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvscsis: Use list_move_tail instead of list_del/list_add_tail
Wei Yongjun [Fri, 22 Jul 2016 14:03:46 +0000 (14:03 +0000)]
scsi: ibmvscsis: Use list_move_tail instead of list_del/list_add_tail

Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Add missing unlock for mbox_lock
Jitendra Bhivare [Fri, 26 Aug 2016 09:39:08 +0000 (15:09 +0530)]
scsi: be2iscsi: Add missing unlock for mbox_lock

Julia pointed out beiscsi_boot_get_sinfo does not unlock mbox_lock on
nonemb_cmd memory allocation failure.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Remove redundant iscsi_wrb desc memset
Jitendra Bhivare [Fri, 26 Aug 2016 09:39:07 +0000 (15:09 +0530)]
scsi: be2iscsi: Remove redundant iscsi_wrb desc memset

alloc_wrb_handle already does memset zero of iscsi_wrb descriptor so
remove redundant memset in WRB submission paths.

Add pwrb_handle NULL check before memsett'ing pwrb.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix error return code
Christophe JAILLET [Fri, 26 Aug 2016 09:39:06 +0000 (15:09 +0530)]
scsi: be2iscsi: Fix error return code

We know that 'ret' is not an error code because it has been tested a few
lines above.  So, if one of these function fails, 0 will be returned
instead of an error code.  Return -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
'ret' needs to be set with error code if hba_setup_cid_tbls fails.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: megaraid_sas: Fix the search of first memory bar
Christophe JAILLET [Sun, 21 Aug 2016 08:28:25 +0000 (10:28 +0200)]
scsi: megaraid_sas: Fix the search of first memory bar

The 2nd parameter of 'find_first_bit' is the number of bits to search.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4.

It is likely that the number of bits in a long was expected here, so use
BITS_PER_LONG instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: sg: Use mult_frac, drop MULDIV macro
Paul Burton [Fri, 19 Aug 2016 16:43:57 +0000 (17:43 +0100)]
scsi: sg: Use mult_frac, drop MULDIV macro

The MULDIV macro is essentially a duplicate of the more standard
mult_frac macro. Replace use of MULDIV with mult_frac & drop the
duplication.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: sg: Avoid overflow when USER_HZ > HZ
Paul Burton [Fri, 19 Aug 2016 16:43:56 +0000 (17:43 +0100)]
scsi: sg: Avoid overflow when USER_HZ > HZ

Calculating the maximum timeout that a user can set via the
SG_SET_TIMEOUT ioctl involves multiplying INT_MAX by USER_HZ/HZ. If
USER_HZ is larger than HZ then this results in an overflow when
performed as a 32 bit integer calculation, resulting in compiler
warnings such as the following:

  drivers/scsi/sg.c: In function 'sg_ioctl':
  drivers/scsi/sg.c:91:67: warning: integer overflow in expression [-Woverflow]
   #define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
                                                                     ^
  drivers/scsi/sg.c:887:14: note: in expansion of macro 'MULDIV'
     if (val >= MULDIV (INT_MAX, USER_HZ, HZ))
                ^
  drivers/scsi/sg.c:91:67: warning: integer overflow in expression [-Woverflow]
   #define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
                                                                     ^
  drivers/scsi/sg.c:888:13: note: in expansion of macro 'MULDIV'
         val = MULDIV (INT_MAX, USER_HZ, HZ);
               ^

Avoid this overflow by performing the (constant) arithmetic on 64 bit
integers, which ensures that overflow from multiplying the 32 bit values
cannot occur. When converting the result back to a 32 bit integer use
min_t to ensure that we don't simply truncate a value beyond INT_MAX to
a 32 bit integer, but instead use INT_MAX where the result was larger
than it. As the values are all compile time constant the 64 bit
arithmetic should have no runtime cost.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvfc: add FC Class 3 Error Recovery support
Tyrel Datwyler [Wed, 3 Aug 2016 21:36:53 +0000 (16:36 -0500)]
scsi: ibmvfc: add FC Class 3 Error Recovery support

The ibmvfc driver currently doesn't support FC Class 3 Error Recovery.
However, it is simply a matter of informing the VIOS that the payload
expects to use sequence level error recovery via a bit flag in the
ibmvfc_cmd structure.

This patch adds a module parameter to enable error recovery support at
boot time. When enabled the RETRY service parameter bit is set during
PRLI, and ibmvfc_cmd->flags includes the IBMVFC_CLASS_3_ERR bit.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ibmvfc: Set READ FCP_XFER_READY DISABLED bit in PRLI
Tyrel Datwyler [Wed, 3 Aug 2016 21:36:52 +0000 (16:36 -0500)]
scsi: ibmvfc: Set READ FCP_XFER_READY DISABLED bit in PRLI

The READ FCP_XFER_READY DISABLED bit is required to always be set to one
since FCP-3. Set it in the service parameter page frame during process
login.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: aic94xx: Add missing error code assignment before test
Christophe JAILLET [Tue, 9 Aug 2016 11:30:02 +0000 (13:30 +0200)]
scsi: aic94xx: Add missing error code assignment before test

It is likely that checking the result of 'pci_write_config_dword' is
expected here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: configure runtime pm before calling device_add in scsi_add_host_with_dma
Heiner Kallweit [Wed, 3 Aug 2016 19:49:03 +0000 (21:49 +0200)]
scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma

Runtime PM should be configured already once we call device_add. See
also the description in this mail thread
https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
or the order of calls e.g. in usb_new_device.

The changed order also helps to avoid scenarios where runtime pm for
&shost->shost_gendev is activated whilst the parent is suspended,
resulting in error message "runtime PM trying to activate child device
hostx but parent yyy is not active".

In addition properly reverse the runtime pm calls in the error path.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: ipr: Add asynchronous error notification
Brian King [Wed, 24 Aug 2016 17:56:51 +0000 (12:56 -0500)]
scsi: ipr: Add asynchronous error notification

This patch implements functions for pushing HCAM (host controlled
asynchronous messages) error buffers to userspace through sysfs
attributes.  Reads to the "async_err_log" attribute will result in a
single HCAM buffer being copied to userspace; one can process the next
HCAM buffer by writing any string to the same attribute.

A new list was added to the ioa_cfg structure to store the HCAM buffers
for later reporting. We also send a KOBJ_CHANGE event whenever a new
HCAM buffer is made available to userspace.

Signed-off-by: Heitor Ricardo Alves de Siqueira <halves@linux.vnet.ibm.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: update version to 1.6
John Garry [Wed, 24 Aug 2016 11:05:54 +0000 (19:05 +0800)]
scsi: hisi_sas: update version to 1.6

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add TMF success check
John Garry [Wed, 24 Aug 2016 11:05:53 +0000 (19:05 +0800)]
scsi: hisi_sas: add TMF success check

When a tmf is issued, various response codes can be returned from the
target. For a query tmf the response may be TMF_RESP_FUNC_COMPLETE or
TMF_RESP_FUNC_SUCC.  Add a condition for TMF_RESP_FUNC_SUCC to
hisi_sas_exec_internal_tmf_task().  This affects query tmf, as the
result is success the returned value was for failure.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: fail tmf task prep when port detached
John Garry [Wed, 24 Aug 2016 11:05:52 +0000 (19:05 +0800)]
scsi: hisi_sas: fail tmf task prep when port detached

When the port is detached we cannot execute a TMF, as there can be no
device attached to the port.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add v2 hw slot complete internal abort support
John Garry [Wed, 24 Aug 2016 11:05:51 +0000 (19:05 +0800)]
scsi: hisi_sas: add v2 hw slot complete internal abort support

Add code in slot_complete_v2_hw() to deal with the slots which have
completed due to internal abort.

The status codes have the following meaning:

- STAT_IO_ABORTED: the IO has been aborted due to internal abort,
  whether by device or individual abort command

- STAT_IO_COMPLETE: internal abort command has completed successfully
  for device or individual abort command

- STAT_IO_NO_DEVICE: internal abort command has completed for device but
  cannot find any IO

- STAT_IO_NOT_VALID: internal abort command has completed for single
  command but could not find the command

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add prep_abort_v2_hw()
John Garry [Wed, 24 Aug 2016 11:05:50 +0000 (19:05 +0800)]
scsi: hisi_sas: add prep_abort_v2_hw()

Add function to prepare the an internal abort for v2 hw.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add internal abort to hisi_sas_abort_task()
John Garry [Wed, 24 Aug 2016 11:05:49 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort to hisi_sas_abort_task()

Execute an internal abort for executing a task abort.
This is for case of the command still being present
in host when abort is executed.

For a SATA internal abort, we set abort for all tasks
associated with the device.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add internal abort in hisi_sas_dev_gone()
John Garry [Wed, 24 Aug 2016 11:05:48 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort in hisi_sas_dev_gone()

Execute an internal abort for that device when it is removed, so that
commands for that device are not processed.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: hisi_sas: add internal abort main code
John Garry [Wed, 24 Aug 2016 11:05:47 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort main code

Add main code for internal abort functionality.

The internal abort features allows the host controller to abort commands
which are still active in the controller but have not yet been sent to
the slave device.

Typically a command only spends a relatively short time in the
controller when compared to the amount of the time after it is sent to
the slave device.

Two modes of internal abort are supported:

 - device
 - individual command

For device, when the internal abort is issued all commands in the host
for that device are aborted.  For a single command, only that command is
aborted if it is still in the host.

In HW the internal abort command is executed similar to any other sort
of command, like SSP.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: esas2r: don't reinitialize adapter's req_table
Shawn Lin [Sun, 21 Aug 2016 02:39:24 +0000 (10:39 +0800)]
scsi: esas2r: don't reinitialize adapter's req_table

req_table is allocate by kzalloc, so we don't need to zero it again.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: esas2r: not need to alloc zero buffer for local_atto_ioctl
Shawn Lin [Sun, 21 Aug 2016 02:33:29 +0000 (10:33 +0800)]
scsi: esas2r: not need to alloc zero buffer for local_atto_ioctl

We don't need to use kzalloc as we will always memset the
local_atto_ioctl later.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation
Markus Elfring [Sun, 21 Aug 2016 08:39:04 +0000 (10:39 +0200)]
scsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation

Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoMAINTAINERS: Update be2iscsi contact info
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:26 +0000 (15:20 +0530)]
MAINTAINERS: Update be2iscsi contact info

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Update the driver version
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:25 +0000 (15:20 +0530)]
scsi: be2iscsi: Update the driver version

Driver version: 11.2.0.0

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Update copyright information
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:24 +0000 (15:20 +0530)]
scsi: be2iscsi: Update copyright information

Change the copyright to:
Copyright Â© xxxx - 2016 Broadcom

Update email.ids:
@avagotech.com - @broadcom.com

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix queue and connection parameters
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:23 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix queue and connection parameters

Current EQ delay is set to 0 to receive very high max interrupt per sec.
Set EQ delay to 32 - reducing max interrupt rate from 65K to 20K per sec.

Set TCP connection window size to 64K with scale shift count 2.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix bad WRB index error
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:22 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix bad WRB index error

In very rare scenario, connection gets killed after throwing this error:
scsi host0: BM_2312 : Event CXN_KILLED_BAD_WRB_INDEX_ERROR[15]... CID : 4
connection1:0: detected conn error (1011)

memset ISCSI_WRB descriptor to zero for all allocations of WRB handle.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix async PDU handling path
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:21 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix async PDU handling path

BUG: unable to handle kernel NULL pointer dereference at 000000000000015e
IP: [<ffffffffa0081700>]
hwi_get_async_handle.isra.23.constprop.39+0x90/0x1d0 [be2iscsi]
PGD 0
Oops: 0000 [#1] SMP
...
Call Trace:
 <IRQ>
 [<ffffffffa00818bc>] hwi_process_default_pdu_ring+0x7c/0x280 [be2iscsi]
 [<ffffffffa0088f51>] beiscsi_process_cq+0x321/0xb90 [be2iscsi]
 [<ffffffff810af028>] ? __wake_up_common+0x58/0x90
 [<ffffffff810b0d84>] ? __wake_up+0x44/0x50
 [<ffffffffa0089a2d>] be_iopoll+0x1d/0xb0 [be2iscsi]
 [<ffffffff812d1f61>] blk_iopoll_softirq+0xc1/0x100
 [<ffffffff81084b0f>] __do_softirq+0xef/0x280

The symptom observed is multiple async handles get queued for same index
thus causing leak in buffers posted to FW.

The root cause is:
- async handle is continued to be used even if it does not match the
completion.
- list_move operation done on already filled index.

1. Remove use of writables, host_write_ptr and ep_read_ptr.
2. Remove consumed logic to update writables. Instead, use only
free_entries to do the accounting of handles to be posted back.
3. Remove busy_list, instead use simple slot to index handles.
4. Added check no data, header less and overflow to make sure
all async_handles are flushed in error cases.
5. Added code to verify gathering of handles to form PDU by
checking final bit before forwarding PDU.
6. Added code to catch mismatch with CQE and handle gracefully.
7. Use AMAP, traverse cri_wait_queue list to post buffers, log
"async PDU" related errors.
8. Rearranged few data structures and added comments in init &
processing path.
9. Added WARN_ONs to catch any HD ring corruption.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Add FUNCTION_RESET during driver unload
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:20 +0000 (15:20 +0530)]
scsi: be2iscsi: Add FUNCTION_RESET during driver unload

Driver unload should call COMMON_FUNCTION_RESET. For TPE feature, this
ensures that FW has knowledge about driver getting unloaded and can
reset its bit vector.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fail the sessions immediately after TPE
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:19 +0000 (15:20 +0530)]
scsi: be2iscsi: Fail the sessions immediately after TPE

Sessions are no longer valid, so schedule sess_work to fail the sessions
immediately when error is detected. This is done to avoid iSCSI transport
layer to keep sending NOP-Out which driver any ways fail.

Schedule sess_work immediately in case of HBA error. Old sessions are gone
for good and need to be re-established.

iscsi_session_failure needs process context hence this work.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Add TPE recovery feature
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:18 +0000 (15:20 +0530)]
scsi: be2iscsi: Add TPE recovery feature

After UE is detected, check for recoverable error by reading
SLIPORT SEMAPHORE register. If transient parity error i.e. 0xExxx
then schedule recovery work on driver wq.

FLag this error to prevent any transactions for the duration of ue2rp to
restart polling. After that, if FW becomes ready then recover port.

Wake up processes in wq before going offline.
Wait for process to execute before cleaning up.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Add V1 of EPFW cleanup IOCTL
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:17 +0000 (15:20 +0530)]
scsi: be2iscsi: Add V1 of EPFW cleanup IOCTL

mgmt_epfw_cleanup does not implement v1 of OPCODE_COMMON_ISCSI_CLEANUP
IOCTL for SkyHawk.

Replace use of MCCQ with BMBX for issuing the IOCTL.
Remove be_mcc_compl_poll which is no longer needed.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix POST check and reset sequence
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:16 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix POST check and reset sequence

SLIPORT FUNCTION_RESET does not reset the chip.
So POST status needs to be checked before issuing FUNCTION_RESET.
The completion of FUNCTION_RESET is indicated in BMBX Rdy bit.

be_cmd_fw_initialize too needs to be done before issuing any cmd to FW.
be_cmd_fw_initialize is renamed as beiscsi_cmd_special_wrb.
Rearrange and rename few functions in init and cleanup path.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Move functions to right files
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:15 +0000 (15:20 +0530)]
scsi: be2iscsi: Move functions to right files

beiscsi_fail_session is defined in be_cmds.c: move it to be_iscsi.c
Move card configuration commands to be_cmds.c.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Add IOCTL to check UER supported
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:14 +0000 (15:20 +0530)]
scsi: be2iscsi: Add IOCTL to check UER supported

BE3 and SH cards can recover from transient parity errors treated
earlier as unrecoverable errors.

Add IOCTL to query FW support for this feature.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix to add timer for UE detection
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:13 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix to add timer for UE detection

UE detection in health check is done in a work scheduled in global wq.
UE caused due to transient parity errors are recoverable and reported
within 1s. If this check for TPE gets delayed, PF0 might initiate
soft-reset and then status of UE recoverable is lost.

Handle UE detection in timer routine. Move out EQ delay update work
from health check. Make the IOCTL for EQ delay update non-blocking
as the completion status is ignored.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix to make boot discovery non-blocking
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:12 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix to make boot discovery non-blocking

Boot work involves:
1. Find and fetch configured boot session and its handle.
2. Attempt to open the session if its not.
3. Get the session details for boot kset creation.
4. Logout of that session owned by FW.
5. Create boot kset for session details.

All these actions were done in blocking call with retries in global wq.
Other works in wq suffered if the IOCTLs stalled or timed out.

This change moves all the boot work to make it non-blocking.
The work queued in global wq just issues the IOCTL depending on the action
to be taken and mcc wq schedules work depending on status of the IOCTL.
Initial boot_work is started on link and ASYNC event.

The other code changes move all boot related functions in one place and
follow naming conventions.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix checks for HBA in error state
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:11 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix checks for HBA in error state

Save ue_detected and fw_timeout errors in state field of beiscsi_hba.
BEISCSI_HBA_RUNNING
BEISCSI_HBA_LINK_UP
BEISCSI_HBA_BOOT_FOUND
BEISCSI_HBA_PCI_ERR
BEISCSI_HBA_FW_TIMEOUT
BEISCSI_HBA_IN_UE

Make sure no PCI transaction happens once in error state.
Add checks in IO path to detect HBA in error.

Skip hwi_purge_eq step which can't be done in error state.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Remove isr_lock and dead code
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:10 +0000 (15:20 +0530)]
scsi: be2iscsi: Remove isr_lock and dead code

todo_mcc_cq is not needed as only MCC work is queued.
todo_cq is not used at all.
Rename functions to be consistent.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Remove alloc_mcc_tag & beiscsi_pci_soft_reset
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:09 +0000 (15:20 +0530)]
scsi: be2iscsi: Remove alloc_mcc_tag & beiscsi_pci_soft_reset

alloc_mcc_tag was replaced with alloc_mcc_wrb and is no more used.
beiscsi_pci_soft_reset is not used at all and won't be needed.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Check all zeroes IP before issuing IOCTL
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:08 +0000 (15:20 +0530)]
scsi: be2iscsi: Check all zeroes IP before issuing IOCTL

Redefine FW IP types.
Before issuing IOCTL to clear IP, check if IP is all zeroes.
All zeroes IP implies IP is not set in FW so FW fails that IOCTL.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Handle only NET_PARAM in iface_get_param
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:07 +0000 (15:20 +0530)]
scsi: be2iscsi: Handle only NET_PARAM in iface_get_param

Wrong settings displayed for iface:
iface.header_digest = 192.168.197.22
iface.data_digest = 255.255.255.0
iface.immediate_data = 192.168.197.1

Process ISCSI_NET_PARAM only in beiscsi_iface_get_param.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Rename iface get/set/create/destroy APIs
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:06 +0000 (15:20 +0530)]
scsi: be2iscsi: Rename iface get/set/create/destroy APIs

Rename mgmt_get_if_info to be consistent with APIs name.
Rename create/destroy APIs to indicate IFACE operations.
Remove legacy be2iscsi and use beiscsi.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Update iface handle before any set param
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:05 +0000 (15:20 +0530)]
scsi: be2iscsi: Update iface handle before any set param

Move mgmt_get_all_if_id before any set param operation.
Rename mgmt_get_all_if_id to beiscsi_if_get_handle.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Move VLAN code to common iface_set_param
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:04 +0000 (15:20 +0530)]
scsi: be2iscsi: Move VLAN code to common iface_set_param

VLAN tag is L2 construct, move VLAN code out from configuring IP.
Rearrange and rename the APIs to make it consistent.
Replace ENOSYS with EPERM.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix release of DHCP IP in static mode
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:03 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix release of DHCP IP in static mode

If BOOTPROTO is changed to static, the DHCP IP address should be released.
All cases are being handled mgmt_set_ip and mgmt_static_ip_modify.

Rearrange IFACE APIs to:
beiscsi_if_clr_ip
beiscsi_if_set_ip
beiscsi_if_en_static
beiscsi_if_en_dhcp

This simplifies release of DHCP IP when BOOTPROTO is set to static.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix gateway APIs to support IPv4 & IPv6
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:02 +0000 (15:20 +0530)]
scsi: be2iscsi: Fix gateway APIs to support IPv4 & IPv6

Gateway APIs assume IP type as IPv4. Modify it to be generic to allow
clearing of IPv6 gateway set using BIOS.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Set and return right iface v4/v6 states
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:01 +0000 (15:20 +0530)]
scsi: be2iscsi: Set and return right iface v4/v6 states

ipv4_iface and ipv6_iface fields need to be set to NULL when destroyed.
Before creation these are checked. Use these to report correct states.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Reduce driver load/unload time
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:00 +0000 (15:20 +0530)]
scsi: be2iscsi: Reduce driver load/unload time

Driver takes significant time to load 1m:20s and unload 40s.

Checkpatch script threw warning:
WARNING: msleep < 20ms can sleep for up to 20ms; see
Documentation/timers/timers-howto.txt

To eliminate this warning msleep(1) was replaced with msleep(20) before
submitting.

msleep(20) in init and uninit path for creation and destroying of number
of WRBQs, CQs, and EQs is adding to load/unload time.

Replace msleep with schedule_timeout_uninterruptible of 1ms as its
enough in most cases.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Replace _bh version for mcc_lock spinlock
Jitendra Bhivare [Fri, 19 Aug 2016 09:49:59 +0000 (15:19 +0530)]
scsi: be2iscsi: Replace _bh version for mcc_lock spinlock

This got unnecessarily introduced with other changes in previous
commits. mcc_lock is taken only in process contexts.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: be2iscsi: Fix to use correct configuration values
Jitendra Bhivare [Fri, 19 Aug 2016 09:49:58 +0000 (15:19 +0530)]
scsi: be2iscsi: Fix to use correct configuration values

Following configuration is created with what driver exports:
iface.vlan_id = 65535
iface.vlan_priority = 255
iface.vlan_state = <empty>

vlan_state is empty as iscsiadm doesn't process "Disabled".
When applying this configuration, iscsiadm checks for if vlan_state is
"disable" if not it enables with value in vlan_id. 65535 not being valid
value, 0 is applied.

Use "enable" or "disable" for ISCSI_NET_PARAM.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: fcoe: provide translation table between Ethernet and FC port speeds
Johannes Thumshirn [Fri, 19 Aug 2016 13:33:37 +0000 (15:33 +0200)]
scsi: fcoe: provide translation table between Ethernet and FC port speeds

Provide a translation table between Ethernet and FC port speeds so odd
speeds (from a Ethernet POV) like 8 Gbit are correctly mapped to sysfs
and open-fcoe's fcoeadm.

Before:
    Description:      BCM57840 NetXtreme II 10/20-Gigabit Ethernet
    Revision:         11
    Manufacturer:     Broadcom Corporation
    Serial Number:    6CC2173EA1D0

    Driver:           bnx2x 1.712.30-0
    Number of Ports:  1

        Symbolic Name:     bnx2fc (QLogic BCM57840) v2.10.3 over eth2
        OS Device Name:    host1
        Node Name:         0x20006cc2173ea1d1
        Port Name:         0x10006cc2173ea1d1
        FabricName:        0x100000c0dd0ce717
        Speed:             unknown
        Supported Speed:   1 Gbit, 10 Gbit
        MaxFrameSize:      2048 bytes
        FC-ID (Port ID):   0x660702
        State:             Online

After:
    Description:      BCM57840 NetXtreme II 10/20-Gigabit Ethernet
    Revision:         11
    Manufacturer:     Broadcom Corporation
    Serial Number:    6CC2173EA1D0

    Driver:           bnx2x 1.712.30-0
    Number of Ports:  1

        Symbolic Name:     bnx2fc (QLogic BCM57840) v2.10.3 over eth2
        OS Device Name:    host1
        Node Name:         0x20006cc2173ea1d1
        Port Name:         0x10006cc2173ea1d1
        FabricName:        0x100000c0dd0ce717
        Speed:             8 Gbit
        Supported Speed:   1 Gbit, 10 Gbit
        MaxFrameSize:      2048 bytes
        FC-ID (Port ID):   0x660701
        State:             Online

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Update documentation
Matthew R. Ochs [Tue, 9 Aug 2016 23:40:13 +0000 (18:40 -0500)]
scsi: cxlflash: Update documentation

Update the block library link in the API documentation.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Remove adapter file descriptor cache
Matthew R. Ochs [Tue, 9 Aug 2016 23:40:02 +0000 (18:40 -0500)]
scsi: cxlflash: Remove adapter file descriptor cache

The adapter file descriptor was previously cached within the kernel for
a given context in order to support performing a close on behalf of an
application. This is no longer needed as applications are now required
to perform a close on the adapter file descriptor.

Inspired-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Transition to application close model
Matthew R. Ochs [Tue, 9 Aug 2016 23:39:52 +0000 (18:39 -0500)]
scsi: cxlflash: Transition to application close model

Caching the adapter file descriptor and performing a close on behalf of
an application is a poor design. This is due to the fact that once a
file descriptor in installed, it is free to be altered without the
knowledge of the cxlflash driver. This can lead to inconsistencies
between the application and kernel. Furthermore, the nature of the
former design is more exploitable and thus should be abandoned.

To support applications performing a close on the adapter file that is
associated with a context, a new flag is introduced to the user API to
indicate to applications that they are responsible for the close
following the cleanup (detach) of a context. The documentation is also
updated to reflect this change in behavior.

Inspired-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Add kref to context
Matthew R. Ochs [Tue, 9 Aug 2016 23:39:42 +0000 (18:39 -0500)]
scsi: cxlflash: Add kref to context

Currently, context user references are tracked via the list of LUNs that
have attached to the context. While convenient, this is not intuitive
without a deep study of the code and is inconsistent with the existing
reference tracking patterns within the kernel. This design choice can
lead to future bug injection.

To improve code comprehension and better protect against future bugs,
add explicit reference counting to contexts and migrate the context
removal code to the kref release handler.

Inspired-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Cache owning adapter within context
Matthew R. Ochs [Tue, 9 Aug 2016 23:39:30 +0000 (18:39 -0500)]
scsi: cxlflash: Cache owning adapter within context

The context removal routine requires access to the owning adapter
structure to reset the context within the AFU as part of the tear down
sequence. In order to support kref adoption, the owning adapter must be
accessible from the release handler. As the kref framework only provides
the kref reference as the sole parameter, another means is needed to
derive the owning adapter.

As a remedy, the owning adapter reference is saved off within the
context during initialization.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: cxlflash: Avoid mutex when destroying context
Matthew R. Ochs [Tue, 9 Aug 2016 23:39:18 +0000 (18:39 -0500)]
scsi: cxlflash: Avoid mutex when destroying context

Context information structures are protected by a mutex that is held
when accessing/manipulating the context. When the code that manages
these structures was authored, a decision was made to include taking the
mutex as part of the allocation/initialization sequence and also handle
the scenario where the mutex was already held when freeing the context.

While not a problem outright, this design decision has been deemed as
too flexible and the code should be made more rigid to avoid future
bugs.  In addition, further review of the code yields that the existing
mutex manipulations in both of these context management paths are
superfluous.

This commit removes the obtaining of the context mutex in the context
initialization routine and assumes the mutex is not held in the context
free path.

Inspired-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: do not send ABTS when resetting exchanges
Hannes Reinecke [Fri, 5 Aug 2016 12:55:03 +0000 (14:55 +0200)]
scsi: libfc: do not send ABTS when resetting exchanges

When all exchanges are reset the upper layers have already logged out of
the remote port, so the exchanges can be reset without sending any ABTS.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com>
Tested-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: reset exchange manager during LOGO handling
Hannes Reinecke [Fri, 5 Aug 2016 12:55:02 +0000 (14:55 +0200)]
scsi: libfc: reset exchange manager during LOGO handling

FC-LS mandates that we should invalidate all sequences before sending a
LOGO. And we should set the event to RPORT_EV_STOP when a LOGO request
has been received to signal that all exchanges are terminated.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com>
Tested-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: send LOGO for PLOGI failure
Hannes Reinecke [Fri, 5 Aug 2016 12:55:01 +0000 (14:55 +0200)]
scsi: libfc: send LOGO for PLOGI failure

When running in point-to-multipoint mode PLOGI is done after FLOGI
completed. So when the PLOGI fails we should be sending a LOGO to the
remote port.

[mkp: Applied by hand]

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com>
Tested-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agoscsi: libfc: Issue PRLI after a PRLO has been received
Hannes Reinecke [Fri, 5 Aug 2016 12:55:00 +0000 (14:55 +0200)]
scsi: libfc: Issue PRLI after a PRLO has been received

When receiving a PRLO it just means that the operating parameters have
changed, it does _not_ mean that the port doesn't want to communicate
with us.  So instead of implicitly logging out we should be issueing a
PRLI to figure out the new operating parameters.  We can always recover
once PRLI fails.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com>
Tested-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agozfcp: trace full payload of all SAN records (req,resp,iels)
Steffen Maier [Wed, 10 Aug 2016 16:30:53 +0000 (18:30 +0200)]
zfcp: trace full payload of all SAN records (req,resp,iels)

This was lost with commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c
("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
but is necessary for problem determination, e.g. to see the
currently active zone set during automatic port scan.

For the large GPN_FT response (4 pages), save space by not dumping
any empty residual entries.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Fixes: 2c55b750a884 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
Cc: <stable@vger.kernel.org> #2.6.38+
Reviewed-by: Alexey Ishchuk <aishchuk@linux.vnet.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agozfcp: fix payload trace length for SAN request&response
Steffen Maier [Wed, 10 Aug 2016 16:30:52 +0000 (18:30 +0200)]
zfcp: fix payload trace length for SAN request&response

commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c
("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
started to add FC_CT_HDR_LEN which made zfcp dump random data
out of bounds for RSPN GS responses because u.rspn.rsp
is the largest and last field in the union of struct zfcp_fc_req.
Other request/response types only happened to stay within bounds
due to the padding of the union or
due to the trace capping of u.gspn.rsp to ZFCP_DBF_SAN_MAX_PAYLOAD.

Timestamp      : ...
Area           : SAN
Subarea        : 00
Level          : 1
Exception      : -
CPU id         : ..
Caller         : ...
Record id      : 2
Tag            : fsscth2
Request id     : 0x...
Destination ID : 0x00fffffc
Payload short  : 01000000 fc020000 80020000 00000000
                 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx <===
                 00000000 00000000 00000000 00000000
Payload length : 32                                  <===

struct zfcp_fc_req {
    [0] struct zfcp_fsf_ct_els ct_els;
   [56] struct scatterlist sg_req;
   [96] struct scatterlist sg_rsp;
        union {
            struct {req; rsp;} adisc;    SIZE: 28+28=   56
            struct {req; rsp;} gid_pn;   SIZE: 24+20=   44
            struct {rspsg; req;} gpn_ft; SIZE: 40*4+20=180
            struct {req; rsp;} gspn;     SIZE: 20+273= 293
            struct {req; rsp;} rspn;     SIZE: 277+16= 293
  [136] } u;
}
SIZE: 432

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Fixes: 2c55b750a884 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
Cc: <stable@vger.kernel.org> #2.6.38+
Reviewed-by: Alexey Ishchuk <aishchuk@linux.vnet.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 years agozfcp: fix D_ID field with actual value on tracing SAN responses
Steffen Maier [Wed, 10 Aug 2016 16:30:51 +0000 (18:30 +0200)]
zfcp: fix D_ID field with actual value on tracing SAN responses

With commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c
("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
we lost the N_Port-ID where an ELS response comes from.
With commit 7c7dc196814b9e1d5cc254dc579a5fa78ae524f7
("[SCSI] zfcp: Simplify handling of ct and els requests")
we lost the N_Port-ID where a CT response comes from.
It's especially useful if the request SAN trace record
with D_ID was already lost due to trace buffer wrap.

GS uses an open WKA port handle and ELS just a D_ID, and
only for ELS we could get D_ID from QTCB bottom via zfcp_fsf_req.
To cover both cases, add a new field to zfcp_fsf_ct_els
and fill it in on request to use in SAN response trace.
Strictly speaking the D_ID on SAN response is the FC frame's S_ID.
We don't need a field for the other end which is always us.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Fixes: 2c55b750a884 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
Fixes: 7c7dc196814b ("[SCSI] zfcp: Simplify handling of ct and els requests")
Cc: <stable@vger.kernel.org> #2.6.38+
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>