Re: [PATCH] mpt3sas: Display message on Configurable secure HBA

2018-11-08 Thread Martin K. Petersen


Sreekanth,

>> Display below warning message only up on detection of
>> Configurable secure type controllers.

Actually, same question as for Shivasharan: Why a warning?

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] megaraid_sas: Add support for MegaRAID Aero controllers

2018-11-08 Thread Martin K. Petersen


Shivasharan,

> This patch adds support for MegaRAID Aero controller PCI IDs.
> Throw a warning message when a Configurable secure type controller is
> encountered.

> + dev_warn(>dev, "Adapter is in configurable secure 
> mode\n");

Why warn and not info?

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH V2 RESEND] Timeouts occur on surprise removal of QLogic adapter

2018-11-08 Thread Martin K. Petersen


Bill,

> When doing a surprise removal of an adapter, some in flight I/Os can get 
> stuck and take a while to complete (they actually timeout and are 
> retried). We are not handling an early error exit from 
> qla2xxx_eh_abort properly.

Applied to 4.20/scsi-fixes, thank you.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 01/23] zfcp: make DIX experimental, disabled, and independent of DIF

2018-11-08 Thread Martin K. Petersen


Steffen,

> There are too many unresolved issues with DIX outside of zfcp such as
> wrong protection data on writesame/discard (over device-mapper)

We don't configure protected transfers for anything but read and write
commands. There is currently no protection information generated for
WRITE SAME. So if you guys are seeing failures, it must be due to zfcp
not handling the scsi_cmnd prot_op/prot_flags or the command PROTECT bit
correctly.

> or due to unstable page writes.

BDI_CAP_STABLE_WRITES should take care of this. What's the configuration
that fails?

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] mpt3sas: Display message on Configurable secure HBA

2018-11-08 Thread Martin K. Petersen


Sreekanth,

> Display below warning message only up on detection of
> Configurable secure type controllers.
>
> "HBA is in Configurable Secure mode"

Applied to 4.21/scsi-queue, thanks.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v4 0/5] qla2xxx: Add FC-NVMe Target support

2018-11-08 Thread Malavali, Giridhar
Thanks James. Please let us know. 

-- Giri

On 11/8/18, 9:18 AM, "linux-scsi-ow...@vger.kernel.org on behalf of James 
Smart"  
wrote:

External Email

Madhani,

I'll be looking through it over the weekend.

-- james


On 11/8/2018 8:58 AM, Madhani, Himanshu wrote:
> Hi James,
>
> Any more review comments?
>
>> On Oct 31, 2018, at 9:40 AM, Himanshu Madhani 
 wrote:
>>
>> Hi Martin,
>>
>> This series adds support for FC-NVMe Target.
>>
>> Patch #1 adds infrastructure to support FC-NVMeT Link Service processing.
>> Patch #2 adds addes new qla_nvmet.[ch] files for FC-NVMe Target support.
>> Patch #3 has bulk of changes to add hooks into common code infrastucture 
and
>>  adds support for FC-NVMe Target LS4 processing via Purex path.
>> Patch #4 adds SysFS hook to enable NVMe Target for the port.
>>
>> Please apply them to 4.21/scsi-queue at your earliest convenience.
>>
>> Changes from v3 -> v4
>> o Rebased Series on current 4.20/scsi-queue
>> o Removed NVMET_FCTGTFEAT_{CMD|OPDONE}_IN_ISR as per James Smart's 
review comment.
>>
>> Changes from v2 -> v3
>> o Reordered patches so that each patch compiles individually and is 
bisectable.
>>
>> Changes from v1 -> v2
>> o Addressed all comments from Bart.
>> o Consolidated Patch 1 and Patch 2 into single patch.
>> o Fixed smatch warning reported by kbuild autommation.
>> o NVMe Target mode is exclusive at the moment. Cavium driver does not 
support both
>>   FCP Target and NVMe Target at the same time. This will be fixed in 
later updates.
>>
>> Thanks,
>> Himanshu
>>
>> Anil Gurumurthy (4):
>>   qla2xxx_nvmet: Add FC-NVMe Target Link Service request handling
>>   qla2xxx_nvmet: Add files for FC-NVMe Target support
>>   qla2xxx_nvmet: Add FC-NVMe Target handling
>>   qla2xxx_nvmet: Add SysFS node for FC-NVMe Target
>>
>> Himanshu Madhani (1):
>>   qla2xxx: Update driver version to 11.00.00.00-k
>>
>> drivers/scsi/qla2xxx/Makefile  |   3 +-
>> drivers/scsi/qla2xxx/qla_attr.c|  33 ++
>> drivers/scsi/qla2xxx/qla_dbg.c |   1 +
>> drivers/scsi/qla2xxx/qla_dbg.h |   2 +
>> drivers/scsi/qla2xxx/qla_def.h |  35 +-
>> drivers/scsi/qla2xxx/qla_fw.h  | 263 ++
>> drivers/scsi/qla2xxx/qla_gbl.h |  24 +-
>> drivers/scsi/qla2xxx/qla_gs.c  |  16 +-
>> drivers/scsi/qla2xxx/qla_init.c|  49 +-
>> drivers/scsi/qla2xxx/qla_iocb.c|   8 +-
>> drivers/scsi/qla2xxx/qla_isr.c | 112 -
>> drivers/scsi/qla2xxx/qla_mbx.c | 101 +++-
>> drivers/scsi/qla2xxx/qla_nvme.h|  33 --
>> drivers/scsi/qla2xxx/qla_nvmet.c   | 831 +++
>> drivers/scsi/qla2xxx/qla_nvmet.h   | 129 +
>> drivers/scsi/qla2xxx/qla_os.c  |  75 ++-
>> drivers/scsi/qla2xxx/qla_target.c  | 977 
-
>> drivers/scsi/qla2xxx/qla_target.h  |  90 
>> drivers/scsi/qla2xxx/qla_version.h |   4 +-
>> 19 files changed, 2711 insertions(+), 75 deletions(-)
>> create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.c
>> create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.h
>>
>> --
>> 2.12.0
>>
> Hi Martin,
>
> if there are no more review comments. Can we merge this into 
4.21/scsi-queue.
>
> Thanks,
> - Himanshu
>






Re: [PATCH v4 0/5] qla2xxx: Add FC-NVMe Target support

2018-11-08 Thread James Smart

Madhani,

I'll be looking through it over the weekend.

-- james


On 11/8/2018 8:58 AM, Madhani, Himanshu wrote:

Hi James,

Any more review comments?


On Oct 31, 2018, at 9:40 AM, Himanshu Madhani  
wrote:

Hi Martin,

This series adds support for FC-NVMe Target.

Patch #1 adds infrastructure to support FC-NVMeT Link Service processing.
Patch #2 adds addes new qla_nvmet.[ch] files for FC-NVMe Target support.
Patch #3 has bulk of changes to add hooks into common code infrastucture and
 adds support for FC-NVMe Target LS4 processing via Purex path.
Patch #4 adds SysFS hook to enable NVMe Target for the port.

Please apply them to 4.21/scsi-queue at your earliest convenience.

Changes from v3 -> v4
o Rebased Series on current 4.20/scsi-queue
o Removed NVMET_FCTGTFEAT_{CMD|OPDONE}_IN_ISR as per James Smart's review 
comment.

Changes from v2 -> v3
o Reordered patches so that each patch compiles individually and is bisectable.

Changes from v1 -> v2
o Addressed all comments from Bart.
o Consolidated Patch 1 and Patch 2 into single patch.
o Fixed smatch warning reported by kbuild autommation.
o NVMe Target mode is exclusive at the moment. Cavium driver does not support 
both
  FCP Target and NVMe Target at the same time. This will be fixed in later 
updates.

Thanks,
Himanshu

Anil Gurumurthy (4):
  qla2xxx_nvmet: Add FC-NVMe Target Link Service request handling
  qla2xxx_nvmet: Add files for FC-NVMe Target support
  qla2xxx_nvmet: Add FC-NVMe Target handling
  qla2xxx_nvmet: Add SysFS node for FC-NVMe Target

Himanshu Madhani (1):
  qla2xxx: Update driver version to 11.00.00.00-k

drivers/scsi/qla2xxx/Makefile  |   3 +-
drivers/scsi/qla2xxx/qla_attr.c|  33 ++
drivers/scsi/qla2xxx/qla_dbg.c |   1 +
drivers/scsi/qla2xxx/qla_dbg.h |   2 +
drivers/scsi/qla2xxx/qla_def.h |  35 +-
drivers/scsi/qla2xxx/qla_fw.h  | 263 ++
drivers/scsi/qla2xxx/qla_gbl.h |  24 +-
drivers/scsi/qla2xxx/qla_gs.c  |  16 +-
drivers/scsi/qla2xxx/qla_init.c|  49 +-
drivers/scsi/qla2xxx/qla_iocb.c|   8 +-
drivers/scsi/qla2xxx/qla_isr.c | 112 -
drivers/scsi/qla2xxx/qla_mbx.c | 101 +++-
drivers/scsi/qla2xxx/qla_nvme.h|  33 --
drivers/scsi/qla2xxx/qla_nvmet.c   | 831 +++
drivers/scsi/qla2xxx/qla_nvmet.h   | 129 +
drivers/scsi/qla2xxx/qla_os.c  |  75 ++-
drivers/scsi/qla2xxx/qla_target.c  | 977 -
drivers/scsi/qla2xxx/qla_target.h  |  90 
drivers/scsi/qla2xxx/qla_version.h |   4 +-
19 files changed, 2711 insertions(+), 75 deletions(-)
create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.c
create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.h

--
2.12.0


Hi Martin,

if there are no more review comments. Can we merge this into 4.21/scsi-queue.

Thanks,
- Himanshu





Re: [PATCH v4 0/5] qla2xxx: Add FC-NVMe Target support

2018-11-08 Thread Madhani, Himanshu
Hi James, 

Any more review comments?

> On Oct 31, 2018, at 9:40 AM, Himanshu Madhani  
> wrote:
> 
> Hi Martin, 
> 
> This series adds support for FC-NVMe Target.
> 
> Patch #1 adds infrastructure to support FC-NVMeT Link Service processing. 
> Patch #2 adds addes new qla_nvmet.[ch] files for FC-NVMe Target support.
> Patch #3 has bulk of changes to add hooks into common code infrastucture and 
> adds support for FC-NVMe Target LS4 processing via Purex path.
> Patch #4 adds SysFS hook to enable NVMe Target for the port.
> 
> Please apply them to 4.21/scsi-queue at your earliest convenience.
> 
> Changes from v3 -> v4
> o Rebased Series on current 4.20/scsi-queue 
> o Removed NVMET_FCTGTFEAT_{CMD|OPDONE}_IN_ISR as per James Smart's review 
> comment. 
> 
> Changes from v2 -> v3
> o Reordered patches so that each patch compiles individually and is 
> bisectable.
> 
> Changes from v1 -> v2
> o Addressed all comments from Bart.
> o Consolidated Patch 1 and Patch 2 into single patch.
> o Fixed smatch warning reported by kbuild autommation.
> o NVMe Target mode is exclusive at the moment. Cavium driver does not support 
> both
>  FCP Target and NVMe Target at the same time. This will be fixed in later 
> updates.
> 
> Thanks,
> Himanshu 
> 
> Anil Gurumurthy (4):
>  qla2xxx_nvmet: Add FC-NVMe Target Link Service request handling
>  qla2xxx_nvmet: Add files for FC-NVMe Target support
>  qla2xxx_nvmet: Add FC-NVMe Target handling
>  qla2xxx_nvmet: Add SysFS node for FC-NVMe Target
> 
> Himanshu Madhani (1):
>  qla2xxx: Update driver version to 11.00.00.00-k
> 
> drivers/scsi/qla2xxx/Makefile  |   3 +-
> drivers/scsi/qla2xxx/qla_attr.c|  33 ++
> drivers/scsi/qla2xxx/qla_dbg.c |   1 +
> drivers/scsi/qla2xxx/qla_dbg.h |   2 +
> drivers/scsi/qla2xxx/qla_def.h |  35 +-
> drivers/scsi/qla2xxx/qla_fw.h  | 263 ++
> drivers/scsi/qla2xxx/qla_gbl.h |  24 +-
> drivers/scsi/qla2xxx/qla_gs.c  |  16 +-
> drivers/scsi/qla2xxx/qla_init.c|  49 +-
> drivers/scsi/qla2xxx/qla_iocb.c|   8 +-
> drivers/scsi/qla2xxx/qla_isr.c | 112 -
> drivers/scsi/qla2xxx/qla_mbx.c | 101 +++-
> drivers/scsi/qla2xxx/qla_nvme.h|  33 --
> drivers/scsi/qla2xxx/qla_nvmet.c   | 831 +++
> drivers/scsi/qla2xxx/qla_nvmet.h   | 129 +
> drivers/scsi/qla2xxx/qla_os.c  |  75 ++-
> drivers/scsi/qla2xxx/qla_target.c  | 977 -
> drivers/scsi/qla2xxx/qla_target.h  |  90 
> drivers/scsi/qla2xxx/qla_version.h |   4 +-
> 19 files changed, 2711 insertions(+), 75 deletions(-)
> create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.c
> create mode 100644 drivers/scsi/qla2xxx/qla_nvmet.h
> 
> -- 
> 2.12.0
> 

Hi Martin, 

if there are no more review comments. Can we merge this into 4.21/scsi-queue.

Thanks,
- Himanshu



Re: [PATCH] rescan-scsi-bus.sh: use LUN wildcard in idlist

2018-11-08 Thread Douglas Gilbert

On 2018-10-25 10:49 a.m., Martin Wilck wrote:

By scanning for LUN 0 only, we may encounter a device that the
kernel won't add (e.g. peripheral device type 31) and which may
thus never appear in sysfs for us to use for REPORT LUNS. That
causes LUN additions for such devices to be missed by
"rescan-iscsi-bus.sh -a".


Seems reasonable and applies clean to my development true. For
rescan-scsi-bus.sh I usually defer to Hannes. I have put it in
pending a decision from him.

BTW My alphas and betas (and releases) of sg3_utils go out through
Hannes' github account [https://github.com/hreinecke/sg3_utils] and/or
http://sg.danny.cz/sg . At the moment the latter is more up to date.

Doug Gilbert


Signed-off-by: Martin Wilck 
---
  scripts/rescan-scsi-bus.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 6989208..a2aa8d8 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -376,7 +376,7 @@ idlist ()
  
oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)

# Rescan LUN 0 to check if we found new targets
-  echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan
+  echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan
newlist=$(ls /sys/class/scsi_device/ | sed -n 
"s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
for newid in $newlist ; do
  oldid=$newid





[PATCH 05/23] zfcp: move scsi_eh & non-ERP timeout defines owned by and local to zfcp_fsf.c

2018-11-08 Thread Steffen Maier
Also clarify namespace prefix for the timeout used for FSF requests
on behalf of SCSI error recovery: It is zfcp_fsf_ not zfcp_scsi_.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h | 6 --
 drivers/s390/scsi/zfcp_fsf.c | 9 +++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 1b6d64eb66b7..87a1fef5568e 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -41,17 +41,11 @@
 #include "zfcp_fc.h"
 #include "zfcp_qdio.h"
 
-/* SCSI SPECIFIC DEFINES */
-#define ZFCP_SCSI_ER_TIMEOUT(10*HZ)
-
 /* FSF SPECIFIC DEFINES */
 
 /* ATTENTION: value must not be used by hardware */
 #define FSF_QTCB_UNSOLICITED_STATUS0x6305
 
-/* timeout value for "default timer" for fsf requests */
-#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ)
-
 /*** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS **/
 
 /*
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 3c86e27f094d..095ab7fdcf4b 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -19,6 +19,11 @@
 #include "zfcp_qdio.h"
 #include "zfcp_reqlist.h"
 
+/* timeout for FSF requests sent during scsi_eh: abort or FCP TMF */
+#define ZFCP_FSF_SCSI_ER_TIMEOUT (10*HZ)
+/* timeout for: exchange config/port data outside ERP, or open/close WKA port 
*/
+#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ)
+
 struct kmem_cache *zfcp_fsf_qtcb_cache;
 
 static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
@@ -912,7 +917,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct 
scsi_cmnd *scmnd)
req->qtcb->header.port_handle = zfcp_sdev->port->handle;
req->qtcb->bottom.support.req_handle = (u64) old_req_id;
 
-   zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT);
+   zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
if (!zfcp_fsf_req_send(req))
goto out;
 
@@ -2369,7 +2374,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct 
scsi_device *sdev,
fcp_cmnd = >qtcb->bottom.io.fcp_cmnd.iu;
zfcp_fc_fcp_tm(fcp_cmnd, sdev, tm_flags);
 
-   zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT);
+   zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
if (!zfcp_fsf_req_send(req))
goto out;
 
-- 
2.16.4



[PATCH 00/23] zfcp updates for v4.21

2018-11-08 Thread Steffen Maier
James, Martin,

this is the zfcp patch set for the v4.21 merge window.
The patches apply to Martin's 4.21/scsi-queue
and to James' misc branch.

Patch 1 is a small feature to select DIF only without DIX.

Patches 2-23 are cleanups including resolving new build warnings.

Fedor Loshakov (1):
  zfcp: make DIX experimental, disabled, and independent of DIF

Steffen Maier (21):
  zfcp: move SG table helper from aux to fc and make them static
  zfcp: drop unnecessary forward prototype for struct zfcp_reqlist
  zfcp: move scsi_eh & non-ERP timeout defines owned by and local to
zfcp_fsf.c
  zfcp: update width in comment for ZFCP_COMMON_FLAGS mask
  zfcp: namespace prefix for internal latency data structures
  zfcp: group sort internal structure definitions for proximity
  zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req
  zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in
QTCB header
  zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB
header
  zfcp: update kernel message for invalid FCP_CMND length, it's not the
CDB
  zfcp: ERP thread setup kdoc update
  zfcp: clarify function argument name for trace tag string
  zfcp: the action field of zfcp_erp_action is actually the type
  zfcp: use enum zfcp_erp_steps for struct zfcp_erp_action.step
  zfcp: use enum zfcp_erp_act_result for argument/return of affected
functions
  zfcp: properly format LUN (and WWPN) for LUN sharing violation kmsg
  zfcp: silence all W=1 build warnings for existing kdoc
  zfcp: silence remaining kdoc warnings in header files
  zfcp: silence -Wimplicit-fallthrough in zfcp_erp_lun_strategy()
  zfcp: drop default switch case which might paper over missing case
  zfcp: drop old default switch case which might paper over missing case

zhong jiang (1):
  zfcp: remove unnecessary null pointer check before mempool_destroy

-- 
2.16.4



[PATCH 06/23] zfcp: update width in comment for ZFCP_COMMON_FLAGS mask

2018-11-08 Thread Steffen Maier
v2.6.10 history commit 4062e12b2ba2 ("[PATCH] s390: zfcp act enhancements")
extended this mask by one nibble with the introduction of
ZFCP_STATUS_COMMON_ACCESS_DENIED == 0x0080 for ACT
(access control table).

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 87a1fef5568e..13bfc13eb42d 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -49,8 +49,8 @@
 /*** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS **/
 
 /*
- * Note, the leftmost status byte is common among adapter, port
- * and unit
+ * Note, the leftmost 12 status bits (3 nibbles) are common among adapter, port
+ * and unit. This is a mask for bitwise 'and' with status values.
  */
 #define ZFCP_COMMON_FLAGS  0xfff0
 
-- 
2.16.4



Re: [PATCH] rescan-scsi-bus.sh: use LUN wildcard in idlist

2018-11-08 Thread Martin Wilck
On Thu, 2018-10-25 at 10:49 +0200, Martin Wilck wrote:
> By scanning for LUN 0 only, we may encounter a device that the
> kernel won't add (e.g. peripheral device type 31) and which may
> thus never appear in sysfs for us to use for REPORT LUNS. That
> causes LUN additions for such devices to be missed by
> "rescan-iscsi-bus.sh -a".
> 
> Signed-off-by: Martin Wilck 
> ---
>  scripts/rescan-scsi-bus.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ping - no opinions on this one?

Thanks,
Martin

> 
> diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
> index 6989208..a2aa8d8 100755
> --- a/scripts/rescan-scsi-bus.sh
> +++ b/scripts/rescan-scsi-bus.sh
> @@ -376,7 +376,7 @@ idlist ()
>  
>oldlist=$(ls /sys/class/scsi_device/ | sed -n
> "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
># Rescan LUN 0 to check if we found new targets
> -  echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan
> +  echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan
>newlist=$(ls /sys/class/scsi_device/ | sed -n
> "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq)
>for newid in $newlist ; do
>  oldid=$newid




[PATCH 20/23] zfcp: silence remaining kdoc warnings in header files

2018-11-08 Thread Steffen Maier
Improve whatever the following simple invocation reported:
$ ./scripts/kernel-doc -none drivers/s390/scsi/*.h

While at it, improve some related kdoc,
including struct zfcp_fsf_ct_els in zfcp_fsf.h.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_dbf.h | 10 +-
 drivers/s390/scsi/zfcp_fc.h  | 21 ++---
 drivers/s390/scsi/zfcp_fsf.h |  4 ++--
 drivers/s390/scsi/zfcp_qdio.h|  9 +++--
 drivers/s390/scsi/zfcp_reqlist.h |  2 +-
 5 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index b4438713d1cc..900c779cc39b 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -42,7 +42,8 @@ struct zfcp_dbf_rec_trigger {
  * @fsf_req_id: request id for fsf requests
  * @rec_status: status of the fsf request
  * @rec_step: current step of the recovery action
- * rec_count: recovery counter
+ * @rec_action: ERP action type
+ * @rec_count: recoveries including retries for particular @rec_action
  */
 struct zfcp_dbf_rec_running {
u64 fsf_req_id;
@@ -72,6 +73,7 @@ enum zfcp_dbf_rec_id {
  * @adapter_status: current status of the adapter
  * @port_status: current status of the port
  * @lun_status: current status of the lun
+ * @u: record type specific data
  * @u.trig: structure zfcp_dbf_rec_trigger
  * @u.run: structure zfcp_dbf_rec_running
  */
@@ -126,6 +128,8 @@ struct zfcp_dbf_san {
  * @prot_status_qual: protocol status qualifier
  * @fsf_status: fsf status
  * @fsf_status_qual: fsf status qualifier
+ * @port_handle: handle for port
+ * @lun_handle: handle for LUN
  */
 struct zfcp_dbf_hba_res {
u64 req_issued;
@@ -158,6 +162,7 @@ struct zfcp_dbf_hba_uss {
  * @ZFCP_DBF_HBA_RES: response trace record
  * @ZFCP_DBF_HBA_USS: unsolicited status trace record
  * @ZFCP_DBF_HBA_BIT: bit error trace record
+ * @ZFCP_DBF_HBA_BASIC: basic adapter event, only trace tag, no other data
  */
 enum zfcp_dbf_hba_id {
ZFCP_DBF_HBA_RES= 1,
@@ -176,6 +181,9 @@ enum zfcp_dbf_hba_id {
  * @fsf_seq_no: fsf sequence number
  * @pl_len: length of payload stored as zfcp_dbf_pay
  * @u: record type specific data
+ * @u.res: data for fsf responses
+ * @u.uss: data for unsolicited status buffer
+ * @u.be:  data for bit error unsolicited status buffer
  */
 struct zfcp_dbf_hba {
u8 id;
diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h
index 3cd74729cfb9..6902ae1f8e4f 100644
--- a/drivers/s390/scsi/zfcp_fc.h
+++ b/drivers/s390/scsi/zfcp_fc.h
@@ -121,9 +121,24 @@ struct zfcp_fc_rspn_req {
 /**
  * struct zfcp_fc_req - Container for FC ELS and CT requests sent from zfcp
  * @ct_els: data required for issuing fsf command
- * @sg_req: scatterlist entry for request data
- * @sg_rsp: scatterlist entry for response data
- * @u: request specific data
+ * @sg_req: scatterlist entry for request data, refers to embedded @u submember
+ * @sg_rsp: scatterlist entry for response data, refers to embedded @u 
submember
+ * @u: request and response specific data
+ * @u.adisc: ADISC specific data
+ * @u.adisc.req: ADISC request
+ * @u.adisc.rsp: ADISC response
+ * @u.gid_pn: GID_PN specific data
+ * @u.gid_pn.req: GID_PN request
+ * @u.gid_pn.rsp: GID_PN response
+ * @u.gpn_ft: GPN_FT specific data
+ * @u.gpn_ft.sg_rsp2: GPN_FT response, not embedded here, allocated elsewhere
+ * @u.gpn_ft.req: GPN_FT request
+ * @u.gspn: GSPN specific data
+ * @u.gspn.req: GSPN request
+ * @u.gspn.rsp: GSPN response
+ * @u.rspn: RSPN specific data
+ * @u.rspn.req: RSPN request
+ * @u.rspn.rsp: RSPN response
  */
 struct zfcp_fc_req {
struct zfcp_fsf_ct_els  ct_els;
diff --git a/drivers/s390/scsi/zfcp_fsf.h b/drivers/s390/scsi/zfcp_fsf.h
index 535628b92f0a..2c658b66318c 100644
--- a/drivers/s390/scsi/zfcp_fsf.h
+++ b/drivers/s390/scsi/zfcp_fsf.h
@@ -438,8 +438,8 @@ struct zfcp_blk_drv_data {
 
 /**
  * struct zfcp_fsf_ct_els - zfcp data for ct or els request
- * @req: scatter-gather list for request
- * @resp: scatter-gather list for response
+ * @req: scatter-gather list for request, points to _fc_req.sg_req or BSG
+ * @resp: scatter-gather list for response, points to _fc_req.sg_rsp or 
BSG
  * @handler: handler function (called for response to the request)
  * @handler_data: data passed to handler function
  * @port: Optional pointer to port for zfcp internal ELS (only test link ADISC)
diff --git a/drivers/s390/scsi/zfcp_qdio.h b/drivers/s390/scsi/zfcp_qdio.h
index 886c662cc154..2a816a37b3c0 100644
--- a/drivers/s390/scsi/zfcp_qdio.h
+++ b/drivers/s390/scsi/zfcp_qdio.h
@@ -30,6 +30,8 @@
  * @req_q_full: queue full incidents
  * @req_q_wq: used to wait for SBAL availability
  * @adapter: adapter used in conjunction with this qdio structure
+ * @max_sbale_per_sbal: qdio limit per sbal
+ * @max_sbale_per_req: qdio limit per request
  */
 struct zfcp_qdio {
struct qdio_buffer  

[PATCH 18/23] zfcp: properly format LUN (and WWPN) for LUN sharing violation kmsg

2018-11-08 Thread Steffen Maier
zfcp: : LUN 0x0 on port 0x5005076. ...
zfcp: : LUN 0x1 on port 0x5005076. ...

should be

zfcp: : LUN 0x on port 0x5005076. ...
zfcp: : LUN 0x0001 on port 0x5005076.
  is already in use by CSS., MIF Image ID .

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_fsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 0bdbc596da97..b83d249d07dc 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1811,7 +1811,7 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req 
*req)
case FSF_LUN_SHARING_VIOLATION:
if (qual->word[0])
dev_warn(_sdev->port->adapter->ccw_device->dev,
-"LUN 0x%Lx on port 0x%Lx is already in "
+"LUN 0x%016Lx on port 0x%016Lx is already in "
 "use by CSS%d, MIF Image ID %x\n",
 zfcp_scsi_dev_lun(sdev),
 (unsigned long long)zfcp_sdev->port->wwpn,
-- 
2.16.4



[PATCH 22/23] zfcp: drop default switch case which might paper over missing case

2018-11-08 Thread Steffen Maier
This was introduced with v4.18 commit 8c3d20aada70 ("scsi: zfcp: fix
missing REC trigger trace for all objects in ERP_FAILED") but would now
suppress helpful -Wswitch compiler warnings when building with W=1 such as
the following forced example:

drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_handle_failed':
drivers/s390/scsi/zfcp_erp.c:126:2: warning: enumeration value 
'ZFCP_ERP_ACTION_REOPEN_PORT_FORCED' not handled in switch [-Wswitch]
  switch (want) {
  ^~

But then again, only with W=1 we would notice unhandled enum cases.
Without the default cases and a missed unhandled enum case, the code
might perform unforeseen things we might not want...

As of today, we never run through the removed default case,
so removing it is no functional change.
In the future, we never should run through a default case but
introduce the necessary specific case(s) to handle new functionality.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index b2845c5b8106..9345fed3bb37 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -151,9 +151,6 @@ static enum zfcp_erp_act_type zfcp_erp_handle_failed(
adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
}
break;
-   default:
-   need = 0;
-   break;
}
 
return need;
-- 
2.16.4



[PATCH 23/23] zfcp: drop old default switch case which might paper over missing case

2018-11-08 Thread Steffen Maier
This was introduced with v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup
code in zfcp_erp.c") but would now suppress helpful -Wswitch compiler
warnings when building with W=1 such as the following forced example:

drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_setup_act':
drivers/s390/scsi/zfcp_erp.c:220:2: warning: enumeration value 
'ZFCP_ERP_ACTION_REOPEN_PORT' not handled in switch [-Wswitch]
  switch (need) {
  ^~

But then again, only with W=1 we would notice unhandled enum cases.
Without the default cases and a missed unhandled enum case, the code
might perform unforeseen things we might not want...

As of today, we never run through the removed default case,
so removing it is no functional change.
In the future, we never should run through a default case but
introduce the necessary specific case(s) to handle new functionality.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 9345fed3bb37..744a64680d5b 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -257,9 +257,6 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(enum 
zfcp_erp_act_type need,
  ZFCP_STATUS_COMMON_RUNNING))
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
break;
-
-   default:
-   return NULL;
}
 
WARN_ON_ONCE(erp_action->adapter != adapter);
-- 
2.16.4



[PATCH 19/23] zfcp: silence all W=1 build warnings for existing kdoc

2018-11-08 Thread Steffen Maier
While at it also improve some copy kdoc mistakes.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_dbf.c  | 13 -
 drivers/s390/scsi/zfcp_erp.c  |  6 +++---
 drivers/s390/scsi/zfcp_fc.c   |  2 +-
 drivers/s390/scsi/zfcp_fsf.c  | 14 +-
 drivers/s390/scsi/zfcp_qdio.c |  3 +--
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 06696b76c300..dccdb41bed8c 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -63,7 +63,8 @@ void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 
length, char *area,
 
 /**
  * zfcp_dbf_hba_fsf_res - trace event for fsf responses
- * @tag: tag indicating which kind of unsolicited status has been received
+ * @tag: tag indicating which kind of FSF response has been received
+ * @level: trace level to be used for event
  * @req: request for which a response was received
  */
 void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req)
@@ -153,7 +154,7 @@ void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req 
*req)
 
 /**
  * zfcp_dbf_hba_bit_err - trace event for bit error conditions
- * @tag: tag indicating which kind of unsolicited status has been received
+ * @tag: tag indicating which kind of bit error unsolicited status was received
  * @req: request which caused the bit_error condition
  */
 void zfcp_dbf_hba_bit_err(char *tag, struct zfcp_fsf_req *req)
@@ -224,6 +225,7 @@ void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 
req_id, u16 scount,
 
 /**
  * zfcp_dbf_hba_basic - trace event for basic adapter events
+ * @tag: identifier for event
  * @adapter: pointer to struct zfcp_adapter
  */
 void zfcp_dbf_hba_basic(char *tag, struct zfcp_adapter *adapter)
@@ -478,7 +480,8 @@ void zfcp_dbf_san(char *tag, struct zfcp_dbf *dbf,
 /**
  * zfcp_dbf_san_req - trace event for issued SAN request
  * @tag: identifier for event
- * @fsf_req: request containing issued CT data
+ * @fsf: request containing issued CT or ELS data
+ * @d_id: N_Port_ID where SAN request is sent to
  * d_id: destination ID
  */
 void zfcp_dbf_san_req(char *tag, struct zfcp_fsf_req *fsf, u32 d_id)
@@ -560,7 +563,7 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag,
 /**
  * zfcp_dbf_san_res - trace event for received SAN request
  * @tag: identifier for event
- * @fsf_req: request containing issued CT data
+ * @fsf: request containing received CT or ELS data
  */
 void zfcp_dbf_san_res(char *tag, struct zfcp_fsf_req *fsf)
 {
@@ -580,7 +583,7 @@ void zfcp_dbf_san_res(char *tag, struct zfcp_fsf_req *fsf)
 /**
  * zfcp_dbf_san_in_els - trace event for incoming ELS
  * @tag: identifier for event
- * @fsf_req: request containing issued CT data
+ * @fsf: request containing received ELS data
  */
 void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)
 {
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 5c7fb64111fe..8e5f01f5be81 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -435,7 +435,7 @@ static void _zfcp_erp_port_reopen(struct zfcp_port *port, 
int clear,
 /**
  * zfcp_erp_port_reopen - trigger remote port recovery
  * @port: port to recover
- * @clear_mask: flags in port status to be cleared
+ * @clear: flags in port status to be cleared
  * @dbftag: Tag for debug trace event.
  */
 void zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *dbftag)
@@ -469,7 +469,7 @@ static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, 
int clear,
 /**
  * zfcp_erp_lun_reopen - initiate reopen of a LUN
  * @sdev: SCSI device / LUN to be reopened
- * @clear_mask: specifies flags in LUN status to be cleared
+ * @clear: specifies flags in LUN status to be cleared
  * @dbftag: Tag for debug trace event.
  *
  * Return: 0 on success, < 0 on error
@@ -606,7 +606,7 @@ void zfcp_erp_notify(struct zfcp_erp_action *erp_action, 
unsigned long set_mask)
 
 /**
  * zfcp_erp_timeout_handler - Trigger ERP action from timed out ERP request
- * @data: ERP action (from timer data)
+ * @t: timer list entry embedded in zfcp FSF request
  */
 void zfcp_erp_timeout_handler(struct timer_list *t)
 {
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 84a9c69cdd56..db00b5e3abbe 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -312,7 +312,7 @@ static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req)
 
 /**
  * zfcp_fc_incoming_els - handle incoming ELS
- * @fsf_req - request which contains incoming ELS
+ * @fsf_req: request which contains incoming ELS
  */
 void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req)
 {
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index b83d249d07dc..d94496ee6883 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -79,7 +79,7 @@ static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req)
 
 /**
  * zfcp_fsf_req_free - free 

[PATCH 16/23] zfcp: use enum zfcp_erp_steps for struct zfcp_erp_action.step

2018-11-08 Thread Steffen Maier
Use the already defined enum for this purpose to get at least some build
checking (even though an enum is type equivalent to an int in C).
v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c")
introduced the enum which was cpp defines previously.

Since struct zfcp_erp_action type is embedded into other structures
living in zfcp_def.h, we have to move enum zfcp_erp_act_type from
its private definition in zfcp_erp.c to the zfcp-global zfcp_def.h

Silence some false -Wswitch compiler warning cases with individual
NOP cases. When adding more enum values and building with W=1 we
would get compiler warnings about missed new cases.

Add missing break statements in some of the above switch cases.
No functional change, but making it future-proof.
I think all of these should have had a break statement ever since,
even if these switch cases happened to be the last ones in the switch
statement body.

"Fall through" in the context of switch case usually means not to have a
break and fall through to the subsequent switch case. However, I think
this old comment meant that here we do not have an _early return_ in the
switch case but the code path continues after the switch case body.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h |   16 +++-
 drivers/s390/scsi/zfcp_erp.c |   35 +--
 2 files changed, 40 insertions(+), 11 deletions(-)

--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -107,6 +107,20 @@ enum zfcp_erp_act_type {
ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
 };
 
+/*
+ * Values must fit into u16 because of code dependencies:
+ * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), zfcp_dbf_rec_run_wka(),
+ * _dbf_rec_running.rec_step.
+ */
+enum zfcp_erp_steps {
+   ZFCP_ERP_STEP_UNINITIALIZED = 0x,
+   ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
+   ZFCP_ERP_STEP_PORT_CLOSING  = 0x0100,
+   ZFCP_ERP_STEP_PORT_OPENING  = 0x0800,
+   ZFCP_ERP_STEP_LUN_CLOSING   = 0x1000,
+   ZFCP_ERP_STEP_LUN_OPENING   = 0x2000,
+};
+
 struct zfcp_erp_action {
struct list_head list;
enum zfcp_erp_act_type type;  /* requested action code */
@@ -114,7 +128,7 @@ struct zfcp_erp_action {
struct zfcp_port *port;
struct scsi_device *sdev;
u32 status;   /* recovery status */
-   u32 step; /* active step of this erp action */
+   enum zfcp_erp_steps step;   /* active step of this erp action */
unsigned long   fsf_req_id;
struct timer_list timer;
 };
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -24,15 +24,6 @@ enum zfcp_erp_act_flags {
ZFCP_STATUS_ERP_NO_REF  = 0x0080,
 };
 
-enum zfcp_erp_steps {
-   ZFCP_ERP_STEP_UNINITIALIZED = 0x,
-   ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
-   ZFCP_ERP_STEP_PORT_CLOSING  = 0x0100,
-   ZFCP_ERP_STEP_PORT_OPENING  = 0x0800,
-   ZFCP_ERP_STEP_LUN_CLOSING   = 0x1000,
-   ZFCP_ERP_STEP_LUN_OPENING   = 0x2000,
-};
-
 /*
  * Eyecatcher pseudo flag to bitwise or-combine with enum zfcp_erp_act_type.
  * Used to indicate that an ERP action could not be set up despite a detected
@@ -900,6 +891,13 @@ static int zfcp_erp_port_forced_strategy
case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
if (!(status & ZFCP_STATUS_PORT_PHYS_OPEN))
return ZFCP_ERP_SUCCEEDED;
+   break;
+   case ZFCP_ERP_STEP_PORT_CLOSING:
+   case ZFCP_ERP_STEP_PORT_OPENING:
+   case ZFCP_ERP_STEP_LUN_CLOSING:
+   case ZFCP_ERP_STEP_LUN_OPENING:
+   /* NOP */
+   break;
}
return ZFCP_ERP_FAILED;
 }
@@ -974,7 +972,12 @@ static int zfcp_erp_port_strategy_open_c
port->d_id = 0;
return ZFCP_ERP_FAILED;
}
-   /* fall through otherwise */
+   /* no early return otherwise, continue after switch case */
+   break;
+   case ZFCP_ERP_STEP_LUN_CLOSING:
+   case ZFCP_ERP_STEP_LUN_OPENING:
+   /* NOP */
+   break;
}
return ZFCP_ERP_FAILED;
 }
@@ -998,6 +1001,12 @@ static int zfcp_erp_port_strategy(struct
if (p_status & ZFCP_STATUS_COMMON_OPEN)
return ZFCP_ERP_FAILED;
break;
+   case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
+   case ZFCP_ERP_STEP_PORT_OPENING:
+   case ZFCP_ERP_STEP_LUN_CLOSING:
+   case ZFCP_ERP_STEP_LUN_OPENING:
+   /* NOP */
+   break;
}
 
 close_init_done:
@@ -1058,6 +1067,12 @@ static int zfcp_erp_lun_strategy(struct
case ZFCP_ERP_STEP_LUN_OPENING:
if (atomic_read(_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
return ZFCP_ERP_SUCCEEDED;
+   break;
+   case 

[PATCH 17/23] zfcp: use enum zfcp_erp_act_result for argument/return of affected functions

2018-11-08 Thread Steffen Maier
With that instead of just "int" it becomes clear which functions return
this type and which ones also accept it as argument they just pass through
in some cases or modify in other cases.
v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c")
introduced the enum which was cpp defines previously.

Silence some false -Wswitch compiler warning cases with individual
NOP cases. When adding more enum values and building with W=1 we
would get compiler warnings about missed new cases.

Consistently use the variable name "result", so change "retval" in
zfcp_erp_strategy() to "result". This avoids confusion with other
compile unit variables "retval" having different semantics and type.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 124 +--
 1 file changed, 84 insertions(+), 40 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 3da870e55ab5..5c7fb64111fe 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -713,7 +713,8 @@ static void zfcp_erp_enqueue_ptp_port(struct zfcp_adapter 
*adapter)
_zfcp_erp_port_reopen(port, 0, "ereptp1");
 }
 
-static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strat_fsf_xconf(
+   struct zfcp_erp_action *erp_action)
 {
int retries;
int sleep = 1;
@@ -758,7 +759,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action 
*act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf_xport(
+   struct zfcp_erp_action *act)
 {
int ret;
struct zfcp_adapter *adapter = act->adapter;
@@ -783,7 +785,8 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct 
zfcp_erp_action *act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf(
+   struct zfcp_erp_action *act)
 {
if (zfcp_erp_adapter_strat_fsf_xconf(act) == ZFCP_ERP_FAILED)
return ZFCP_ERP_FAILED;
@@ -822,7 +825,8 @@ static void zfcp_erp_adapter_strategy_close(struct 
zfcp_erp_action *act)
  ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, >status);
 }
 
-static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
 
@@ -843,7 +847,8 @@ static int zfcp_erp_adapter_strategy_open(struct 
zfcp_erp_action *act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
 
@@ -861,7 +866,8 @@ static int zfcp_erp_adapter_strategy(struct zfcp_erp_action 
*act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy_close(
+   struct zfcp_erp_action *act)
 {
int retval;
 
@@ -875,7 +881,8 @@ static int zfcp_erp_port_forced_strategy_close(struct 
zfcp_erp_action *act)
return ZFCP_ERP_CONTINUES;
 }
 
-static int zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy(
+   struct zfcp_erp_action *erp_action)
 {
struct zfcp_port *port = erp_action->port;
int status = atomic_read(>status);
@@ -902,7 +909,8 @@ static int zfcp_erp_port_forced_strategy(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_FAILED;
 }
 
-static int zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_close(
+   struct zfcp_erp_action *erp_action)
 {
int retval;
 
@@ -915,7 +923,8 @@ static int zfcp_erp_port_strategy_close(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_CONTINUES;
 }
 
-static int zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_port(
+   struct zfcp_erp_action *erp_action)
 {
int retval;
 
@@ -941,7 +950,8 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action 
*act)
return zfcp_erp_port_strategy_open_port(act);
 }
 
-static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_common(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
struct zfcp_port *port = act->port;
@@ -982,7 +992,8 @@ static int 

[PATCH 21/23] zfcp: silence -Wimplicit-fallthrough in zfcp_erp_lun_strategy()

2018-11-08 Thread Steffen Maier
For some reason the already existing substring "fall through" in the
comment is not sufficient for GCC to silence -Wimplicit-fallthrough.

  CC [M]  drivers/s390/scsi/zfcp_erp.o
drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_lun_strategy':
drivers/s390/scsi/zfcp_erp.c:1065:6: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
  if (atomic_read(_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
  ^
drivers/s390/scsi/zfcp_erp.c:1068:2: note: here
  case ZFCP_ERP_STEP_LUN_CLOSING:
  ^~~~

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 8e5f01f5be81..b2845c5b8106 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1070,7 +1070,8 @@ static enum zfcp_erp_act_result zfcp_erp_lun_strategy(
zfcp_erp_lun_strategy_clearstati(sdev);
if (atomic_read(_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
return zfcp_erp_lun_strategy_close(erp_action);
-   /* already closed, fall through */
+   /* already closed */
+   /* fall through */
case ZFCP_ERP_STEP_LUN_CLOSING:
if (atomic_read(_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
return ZFCP_ERP_FAILED;
-- 
2.16.4



[PATCH 13/23] zfcp: ERP thread setup kdoc update

2018-11-08 Thread Steffen Maier
zfcp_erp_thread_setup() update complements v2.6.32 commit 347c6a965dc1
("[SCSI] zfcp: Use kthread API for zfcp erp thread").

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index e7e6b63905e2..f6a2d66eef57 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1489,7 +1489,7 @@ static int zfcp_erp_thread(void *data)
  * zfcp_erp_thread_setup - Start ERP thread for adapter
  * @adapter: Adapter to start the ERP thread for
  *
- * Returns 0 on success or error code from kernel_thread()
+ * Return: 0 on success, or error code from kthread_run().
  */
 int zfcp_erp_thread_setup(struct zfcp_adapter *adapter)
 {
-- 
2.16.4



[PATCH 14/23] zfcp: clarify function argument name for trace tag string

2018-11-08 Thread Steffen Maier
v2.6.30 commit 5ffd51a5e495 ("[SCSI] zfcp: replace current ERP logging
with a more convenient version") changed trace record distinguishing from a
numerical ID to a 7 character string called "trace tag". While starting to
use function arguments with different type and semantics, it did not change
the argument name accordingly.

v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of the debug tracing
for recovery actions.") renamed variable names "id" into "tag" but only
within zfcp_dbf.*, not within zfcp_erp.c.

This was a bit confusing since the remainder of zfcp does use the term
"trace tag". Also "id" is quite generic and it's not obvious for what.
Just unify it consistently and use the "dbf" prefix to relate the arguments
to the code in zfcp_dbf.*.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c  | 92 ++-
 drivers/s390/scsi/zfcp_ext.h  |  8 ++--
 drivers/s390/scsi/zfcp_qdio.c |  8 ++--
 3 files changed, 57 insertions(+), 51 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index f6a2d66eef57..efb47cd6ab4a 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -297,7 +297,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, 
u32 act_status,
 static void zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
struct zfcp_port *port,
struct scsi_device *sdev,
-   char *id, u32 act_status)
+   char *dbftag, u32 act_status)
 {
int need;
struct zfcp_erp_action *act;
@@ -327,10 +327,11 @@ static void zfcp_erp_action_enqueue(int want, struct 
zfcp_adapter *adapter,
list_add_tail(>list, >erp_ready_head);
wake_up(>erp_ready_wq);
  out:
-   zfcp_dbf_rec_trig(id, adapter, port, sdev, want, need);
+   zfcp_dbf_rec_trig(dbftag, adapter, port, sdev, want, need);
 }
 
-void zfcp_erp_port_forced_no_port_dbf(char *id, struct zfcp_adapter *adapter,
+void zfcp_erp_port_forced_no_port_dbf(char *dbftag,
+ struct zfcp_adapter *adapter,
  u64 port_name, u32 port_id)
 {
unsigned long flags;
@@ -344,29 +345,30 @@ void zfcp_erp_port_forced_no_port_dbf(char *id, struct 
zfcp_adapter *adapter,
atomic_set(, -1); /* unknown */
tmpport.wwpn = port_name;
tmpport.d_id = port_id;
-   zfcp_dbf_rec_trig(id, adapter, , NULL,
+   zfcp_dbf_rec_trig(dbftag, adapter, , NULL,
  ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
  ZFCP_ERP_ACTION_NONE);
write_unlock_irqrestore(>erp_lock, flags);
 }
 
 static void _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
-   int clear_mask, char *id)
+   int clear_mask, char *dbftag)
 {
zfcp_erp_adapter_block(adapter, clear_mask);
zfcp_scsi_schedule_rports_block(adapter);
 
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
-   adapter, NULL, NULL, id, 0);
+   adapter, NULL, NULL, dbftag, 0);
 }
 
 /**
  * zfcp_erp_adapter_reopen - Reopen adapter.
  * @adapter: Adapter to reopen.
  * @clear: Status flags to clear.
- * @id: Id for debug trace event.
+ * @dbftag: Tag for debug trace event.
  */
-void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear, char *id)
+void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear,
+char *dbftag)
 {
unsigned long flags;
 
@@ -375,7 +377,7 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, 
int clear, char *id)
 
write_lock_irqsave(>erp_lock, flags);
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
-   NULL, NULL, id, 0);
+   NULL, NULL, dbftag, 0);
write_unlock_irqrestore(>erp_lock, flags);
 }
 
@@ -383,25 +385,25 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter 
*adapter, int clear, char *id)
  * zfcp_erp_adapter_shutdown - Shutdown adapter.
  * @adapter: Adapter to shut down.
  * @clear: Status flags to clear.
- * @id: Id for debug trace event.
+ * @dbftag: Tag for debug trace event.
  */
 void zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear,
-  char *id)
+  char *dbftag)
 {
int flags = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
-   zfcp_erp_adapter_reopen(adapter, clear | flags, id);
+   zfcp_erp_adapter_reopen(adapter, clear | flags, dbftag);
 }
 
 /**
  * zfcp_erp_port_shutdown - Shutdown port
  * @port: Port to shut down.
  * @clear: Status flags to clear.
- * @id: Id for debug trace event.
+ * @dbftag: Tag for debug trace event.
  */
-void 

[PATCH 15/23] zfcp: the action field of zfcp_erp_action is actually the type

2018-11-08 Thread Steffen Maier
_erp_action.action ==> _erp_action.type

While at it, make use of the already defined enum for this purpose
to get at least some build checking (even though an enum is type equivalent
to an int in C). v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code
in zfcp_erp.c") introduced the enum which was cpp defines previously.

To prevent compiler warnings with the switch(act->type), we have to
separate the recently added eyecatchers from enum zfcp_erp_act_type.

Since struct zfcp_erp_action type is embedded into other structures
living in zfcp_def.h, we have to move enum zfcp_erp_act_type from
its private definition in zfcp_erp.c to the zfcp-global zfcp_def.h.

Silence one false -Wswitch compiler warning case: LUNs as the leaves in our
object tree do not have any follow-up success recovery.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_dbf.c |  2 +-
 drivers/s390/scsi/zfcp_def.h | 20 +++-
 drivers/s390/scsi/zfcp_erp.c | 77 +---
 3 files changed, 56 insertions(+), 43 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 3503de873963..06696b76c300 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -357,7 +357,7 @@ void zfcp_dbf_rec_run_lvl(int level, char *tag, struct 
zfcp_erp_action *erp)
rec->u.run.fsf_req_id = erp->fsf_req_id;
rec->u.run.rec_status = erp->status;
rec->u.run.rec_step = erp->step;
-   rec->u.run.rec_action = erp->action;
+   rec->u.run.rec_action = erp->type;
 
if (erp->sdev)
rec->u.run.rec_count =
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 84a742a67975..4c938eb604b6 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -89,9 +89,27 @@
 
 /* STRUCTURE DEFINITIONS */
 
+/**
+ * enum zfcp_erp_act_type - Type of ERP action object.
+ * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
+ * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
+ * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
+ * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
+ *
+ * Values must fit into u8 because of code dependencies:
+ * zfcp_dbf_rec_trig(), _dbf_rec_trigger.want, _dbf_rec_trigger.need;
+ * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), 
_dbf_rec_running.rec_action.
+ */
+enum zfcp_erp_act_type {
+   ZFCP_ERP_ACTION_REOPEN_LUN = 1,
+   ZFCP_ERP_ACTION_REOPEN_PORT= 2,
+   ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
+   ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
+};
+
 struct zfcp_erp_action {
struct list_head list;
-   int action;   /* requested action code */
+   enum zfcp_erp_act_type type;  /* requested action code */
struct zfcp_adapter *adapter; /* device which should be recovered */
struct zfcp_port *port;
struct scsi_device *sdev;
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index efb47cd6ab4a..49d04e5af55f 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -4,7 +4,7 @@
  *
  * Error Recovery Procedures (ERP).
  *
- * Copyright IBM Corp. 2002, 2016
+ * Copyright IBM Corp. 2002, 2017
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -33,29 +33,18 @@ enum zfcp_erp_steps {
ZFCP_ERP_STEP_LUN_OPENING   = 0x2000,
 };
 
-/**
- * enum zfcp_erp_act_type - Type of ERP action object.
- * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
- * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
- * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
- * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
- * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with
- *   either of the first four enum values.
- *   Used to indicate that an ERP action could not be
- *   set up despite a detected need for some recovery.
- * @ZFCP_ERP_ACTION_FAILED: Eyecatcher pseudo flag to bitwise or-combine with
- * either of the first four enum values.
- * Used to indicate that ERP not needed because
- * the object has ZFCP_STATUS_COMMON_ERP_FAILED.
+/*
+ * Eyecatcher pseudo flag to bitwise or-combine with enum zfcp_erp_act_type.
+ * Used to indicate that an ERP action could not be set up despite a detected
+ * need for some recovery.
  */
-enum zfcp_erp_act_type {
-   ZFCP_ERP_ACTION_REOPEN_LUN = 1,
-   ZFCP_ERP_ACTION_REOPEN_PORT= 2,
-   ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
-   ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
-   ZFCP_ERP_ACTION_NONE   = 0xc0,
-   ZFCP_ERP_ACTION_FAILED = 0xe0,
-};
+#define ZFCP_ERP_ACTION_NONE   0xc0
+/*
+ * Eyecatcher pseudo flag to bitwise or-combine with enum zfcp_erp_act_type.
+ * Used to indicate that ERP not needed because the 

[PATCH 09/23] zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req

2018-11-08 Thread Steffen Maier
Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 31b3e2bb3b42..572debf2f528 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -89,8 +89,6 @@
 
 /* STRUCTURE DEFINITIONS */
 
-struct zfcp_fsf_req;
-
 struct zfcp_erp_action {
struct list_head list;
int action;   /* requested action code */
-- 
2.16.4



[PATCH 12/23] zfcp: update kernel message for invalid FCP_CMND length, it's not the CDB

2018-11-08 Thread Steffen Maier
The CDB is just a part inside of FCP_CMND, see zfcp_fc_scsi_to_fcp().
While at it, fix the device driver reaction: adapter not LUN shutdown.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_fsf.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c949c65ffc6a..0bdbc596da97 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2090,11 +2090,8 @@ static void zfcp_fsf_fcp_handler_common(struct 
zfcp_fsf_req *req,
break;
case FSF_CMND_LENGTH_NOT_VALID:
dev_err(>adapter->ccw_device->dev,
-   "Incorrect CDB length %d, LUN 0x%016Lx on "
-   "port 0x%016Lx closed\n",
-   req->qtcb->bottom.io.fcp_cmnd_length,
-   (unsigned long long)zfcp_scsi_dev_lun(sdev),
-   (unsigned long long)zfcp_sdev->port->wwpn);
+   "Incorrect FCP_CMND length %d, FCP device closed\n",
+   req->qtcb->bottom.io.fcp_cmnd_length);
zfcp_erp_adapter_shutdown(req->adapter, 0, "fssfch4");
req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break;
-- 
2.16.4



[PATCH 11/23] zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB header

2018-11-08 Thread Steffen Maier
There is no point for double bookkeeping especially just for tracing.
The trace can take it from the QTCB which always exists for non-SRB
responses traced with zfcp_dbf_hba_fsf_res().

As a side effect, this removes an alignment hole and reduces the
size of struct zfcp_fsf_req, and thus of each pending request, by
8 bytes.
Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *  qtcb; /*   144 8 */
u32seq_no;   /*   152 4 */
/* XXX 4 bytes hole, try to pack */
void * data; /*   160 8 */
...
/* size: 296, cachelines: 2, members: 14 */
/* sum members: 288, holes: 2, sum holes: 8 */
/* last cacheline: 40 bytes */
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *  qtcb; /*   144 8 */
void * data; /*   152 8 */
...
/* size: 288, cachelines: 2, members: 13 */
/* sum members: 284, holes: 1, sum holes: 4 */

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_dbf.c | 2 +-
 drivers/s390/scsi/zfcp_def.h | 2 --
 drivers/s390/scsi/zfcp_fsf.c | 1 -
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index d20977bb27a4..3503de873963 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -82,7 +82,7 @@ void zfcp_dbf_hba_fsf_res(char *tag, int level, struct 
zfcp_fsf_req *req)
rec->fsf_req_id = req->req_id;
rec->fsf_req_status = req->status;
rec->fsf_cmd = q_head->fsf_command;
-   rec->fsf_seq_no = req->seq_no;
+   rec->fsf_seq_no = q_pref->req_seq_no;
rec->u.res.req_issued = req->issued;
rec->u.res.prot_status = q_pref->prot_status;
rec->u.res.fsf_status = q_head->fsf_status;
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index d65adb0ae9f1..84a742a67975 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -278,7 +278,6 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device 
*sdev)
  * @completion: used to signal the completion of the request
  * @status: status of the request
  * @qtcb: associated QTCB
- * @seq_no: sequence number of this request
  * @data: private data
  * @timer: timer data of this request
  * @erp_action: reference to erp action if request issued on behalf of ERP
@@ -294,7 +293,6 @@ struct zfcp_fsf_req {
struct completion   completion;
u32 status;
struct fsf_qtcb *qtcb;
-   u32 seq_no;
void*data;
struct timer_list   timer;
struct zfcp_erp_action  *erp_action;
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 07b86375b461..c949c65ffc6a 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -724,7 +724,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct 
zfcp_qdio *qdio,
return ERR_PTR(-ENOMEM);
}
 
-   req->seq_no = adapter->fsf_req_seq_no;
req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
req->qtcb->prefix.req_id = req->req_id;
req->qtcb->prefix.ulp_info = 26;
-- 
2.16.4



[PATCH 10/23] zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header

2018-11-08 Thread Steffen Maier
Status read buffers (SRBs, unsolicited notifications) never use a QTCB
[zfcp_fsf_req_create()]. zfcp_fsf_req_send() already uses this to
distinguish SRBs from other FSF request types. We can re-use this method
in zfcp_fsf_req_complete(). Introduce a helper function to make the check
for req->qtcb less magic.

SRBs always are FSF_QTCB_UNSOLICITED_STATUS, so we can hard-code this for
the two trace functions dealing with SRBs.

All other FSF request types have a QTCB and we can get the fsf_command
from there.

zfcp_dbf_hba_fsf_response() and thus zfcp_dbf_hba_fsf_res() are only called
for non-SRB requests so it's safe to dereference the QTCB
[zfcp_fsf_req_complete() returns early on SRB,  else calls
 zfcp_fsf_protstatus_eval() which calls zfcp_dbf_hba_fsf_response()].
In zfcp_scsi_forget_cmnd() we guard the QTCB dereference with a preceding
NULL check and rely on boolean shortcut evaluation.

As a side effect, this causes an alignment hole which we can close in
a later patch after having cleaned up all fields of struct zfcp_fsf_req.
Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32status;   /*   136 4 */
u32fsf_command;  /*   140 4 */
struct fsf_qtcb *  qtcb; /*   144 8 */
...
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32status;   /*   136 4 */
/* XXX 4 bytes hole, try to pack */
struct fsf_qtcb *  qtcb; /*   144 8 */
...

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_dbf.c  |  8 
 drivers/s390/scsi/zfcp_dbf.h  |  4 ++--
 drivers/s390/scsi/zfcp_def.h  |  7 +--
 drivers/s390/scsi/zfcp_fsf.c  | 14 ++
 drivers/s390/scsi/zfcp_scsi.c |  4 +++-
 5 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 3b368fcf13f4..d20977bb27a4 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -81,7 +81,7 @@ void zfcp_dbf_hba_fsf_res(char *tag, int level, struct 
zfcp_fsf_req *req)
rec->id = ZFCP_DBF_HBA_RES;
rec->fsf_req_id = req->req_id;
rec->fsf_req_status = req->status;
-   rec->fsf_cmd = req->fsf_command;
+   rec->fsf_cmd = q_head->fsf_command;
rec->fsf_seq_no = req->seq_no;
rec->u.res.req_issued = req->issued;
rec->u.res.prot_status = q_pref->prot_status;
@@ -94,7 +94,7 @@ void zfcp_dbf_hba_fsf_res(char *tag, int level, struct 
zfcp_fsf_req *req)
memcpy(rec->u.res.fsf_status_qual, _head->fsf_status_qual,
   FSF_STATUS_QUALIFIER_SIZE);
 
-   if (req->fsf_command != FSF_QTCB_FCP_CMND) {
+   if (q_head->fsf_command != FSF_QTCB_FCP_CMND) {
rec->pl_len = q_head->log_length;
zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start,
  rec->pl_len, "fsf_res", req->req_id);
@@ -127,7 +127,7 @@ void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req 
*req)
rec->id = ZFCP_DBF_HBA_USS;
rec->fsf_req_id = req->req_id;
rec->fsf_req_status = req->status;
-   rec->fsf_cmd = req->fsf_command;
+   rec->fsf_cmd = FSF_QTCB_UNSOLICITED_STATUS;
 
if (!srb)
goto log;
@@ -174,7 +174,7 @@ void zfcp_dbf_hba_bit_err(char *tag, struct zfcp_fsf_req 
*req)
rec->id = ZFCP_DBF_HBA_BIT;
rec->fsf_req_id = req->req_id;
rec->fsf_req_status = req->status;
-   rec->fsf_cmd = req->fsf_command;
+   rec->fsf_cmd = FSF_QTCB_UNSOLICITED_STATUS;
memcpy(>u.be, _buf->payload.bit_error,
   sizeof(struct fsf_bit_error_payload));
 
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index d116c07ed77a..b4438713d1cc 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -339,8 +339,8 @@ void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
  zfcp_dbf_hba_fsf_resp_suppress(req)
  ? 5 : 1, req);
 
-   } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
-  (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
+   } else if ((qtcb->header.fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
+  (qtcb->header.fsf_command == FSF_QTCB_OPEN_LUN)) {
zfcp_dbf_hba_fsf_resp("fs_open", 4, req);
 
} else if (qtcb->header.log_length) {
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 572debf2f528..d65adb0ae9f1 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -277,7 +277,6 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device 
*sdev)
  * @qdio_req: qdio queue related values
  * @completion: used to signal the completion of the request
  * @status: status of the request
- * 

[PATCH 03/23] zfcp: move SG table helper from aux to fc and make them static

2018-11-08 Thread Steffen Maier
Since commit 663e0890e31c ("[SCSI] zfcp: remove access control tables
interface") these helper functions are only used for auto port scan in
zfcp_fc.c. Also change them to the corresponding namespace prefix.

This is a small cleanup for the miscellaneous catchall compile unit
zfcp_aux.c.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_aux.c | 44 +-
 drivers/s390/scsi/zfcp_fc.c  | 46 ++--
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 8818a3a290f6..df10f4e07a4a 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -4,7 +4,7 @@
  *
  * Module interface and handling of zfcp data structures.
  *
- * Copyright IBM Corp. 2002, 2013
+ * Copyright IBM Corp. 2002, 2017
  */
 
 /*
@@ -538,45 +538,3 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter 
*adapter, u64 wwpn,
zfcp_ccw_adapter_put(adapter);
return ERR_PTR(retval);
 }
-
-/**
- * zfcp_sg_free_table - free memory used by scatterlists
- * @sg: pointer to scatterlist
- * @count: number of scatterlist which are to be free'ed
- * the scatterlist are expected to reference pages always
- */
-void zfcp_sg_free_table(struct scatterlist *sg, int count)
-{
-   int i;
-
-   for (i = 0; i < count; i++, sg++)
-   if (sg)
-   free_page((unsigned long) sg_virt(sg));
-   else
-   break;
-}
-
-/**
- * zfcp_sg_setup_table - init scatterlist and allocate, assign buffers
- * @sg: pointer to struct scatterlist
- * @count: number of scatterlists which should be assigned with buffers
- * of size page
- *
- * Returns: 0 on success, -ENOMEM otherwise
- */
-int zfcp_sg_setup_table(struct scatterlist *sg, int count)
-{
-   void *addr;
-   int i;
-
-   sg_init_table(sg, count);
-   for (i = 0; i < count; i++, sg++) {
-   addr = (void *) get_zeroed_page(GFP_KERNEL);
-   if (!addr) {
-   zfcp_sg_free_table(sg, i);
-   return -ENOMEM;
-   }
-   sg_set_buf(sg, addr, PAGE_SIZE);
-   }
-   return 0;
-}
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index f6c415d6ef48..84a9c69cdd56 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -597,6 +597,48 @@ void zfcp_fc_test_link(struct zfcp_port *port)
put_device(>dev);
 }
 
+/**
+ * zfcp_fc_sg_free_table - free memory used by scatterlists
+ * @sg: pointer to scatterlist
+ * @count: number of scatterlist which are to be free'ed
+ * the scatterlist are expected to reference pages always
+ */
+static void zfcp_fc_sg_free_table(struct scatterlist *sg, int count)
+{
+   int i;
+
+   for (i = 0; i < count; i++, sg++)
+   if (sg)
+   free_page((unsigned long) sg_virt(sg));
+   else
+   break;
+}
+
+/**
+ * zfcp_fc_sg_setup_table - init scatterlist and allocate, assign buffers
+ * @sg: pointer to struct scatterlist
+ * @count: number of scatterlists which should be assigned with buffers
+ * of size page
+ *
+ * Returns: 0 on success, -ENOMEM otherwise
+ */
+static int zfcp_fc_sg_setup_table(struct scatterlist *sg, int count)
+{
+   void *addr;
+   int i;
+
+   sg_init_table(sg, count);
+   for (i = 0; i < count; i++, sg++) {
+   addr = (void *) get_zeroed_page(GFP_KERNEL);
+   if (!addr) {
+   zfcp_fc_sg_free_table(sg, i);
+   return -ENOMEM;
+   }
+   sg_set_buf(sg, addr, PAGE_SIZE);
+   }
+   return 0;
+}
+
 static struct zfcp_fc_req *zfcp_fc_alloc_sg_env(int buf_num)
 {
struct zfcp_fc_req *fc_req;
@@ -605,7 +647,7 @@ static struct zfcp_fc_req *zfcp_fc_alloc_sg_env(int buf_num)
if (!fc_req)
return NULL;
 
-   if (zfcp_sg_setup_table(_req->sg_rsp, buf_num)) {
+   if (zfcp_fc_sg_setup_table(_req->sg_rsp, buf_num)) {
kmem_cache_free(zfcp_fc_req_cache, fc_req);
return NULL;
}
@@ -763,7 +805,7 @@ void zfcp_fc_scan_ports(struct work_struct *work)
break;
}
}
-   zfcp_sg_free_table(_req->sg_rsp, buf_num);
+   zfcp_fc_sg_free_table(_req->sg_rsp, buf_num);
kmem_cache_free(zfcp_fc_req_cache, fc_req);
 out:
zfcp_fc_wka_port_put(>gs->ds);
-- 
2.16.4



[PATCH 08/23] zfcp: group sort internal structure definitions for proximity

2018-11-08 Thread Steffen Maier
Have structures just before the structures that use them
(without disrupting sequences of using structures such as
 zfcp_unit and zfcp_scsi_dev):
- zfcp_adapter_mempool embedded in zfcp_adapter,
- zfcp_latenc... embedded in zfcp_scsi_dev.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h | 58 ++--
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e227b0770221..31b3e2bb3b42 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -91,18 +91,6 @@
 
 struct zfcp_fsf_req;
 
-/* holds various memory pools of an adapter */
-struct zfcp_adapter_mempool {
-   mempool_t *erp_req;
-   mempool_t *gid_pn_req;
-   mempool_t *scsi_req;
-   mempool_t *scsi_abort;
-   mempool_t *status_read_req;
-   mempool_t *sr_data;
-   mempool_t *gid_pn;
-   mempool_t *qtcb_pool;
-};
-
 struct zfcp_erp_action {
struct list_head list;
int action;   /* requested action code */
@@ -115,23 +103,16 @@ struct zfcp_erp_action {
struct timer_list timer;
 };
 
-struct zfcp_latency_record {
-   u32 min;
-   u32 max;
-   u64 sum;
-};
-
-struct zfcp_latency_cont {
-   struct zfcp_latency_record channel;
-   struct zfcp_latency_record fabric;
-   u64 counter;
-};
-
-struct zfcp_latencies {
-   struct zfcp_latency_cont read;
-   struct zfcp_latency_cont write;
-   struct zfcp_latency_cont cmd;
-   spinlock_t lock;
+/* holds various memory pools of an adapter */
+struct zfcp_adapter_mempool {
+   mempool_t *erp_req;
+   mempool_t *gid_pn_req;
+   mempool_t *scsi_req;
+   mempool_t *scsi_abort;
+   mempool_t *status_read_req;
+   mempool_t *sr_data;
+   mempool_t *gid_pn;
+   mempool_t *qtcb_pool;
 };
 
 struct zfcp_adapter {
@@ -212,6 +193,25 @@ struct zfcp_port {
unsigned intstarget_id;
 };
 
+struct zfcp_latency_record {
+   u32 min;
+   u32 max;
+   u64 sum;
+};
+
+struct zfcp_latency_cont {
+   struct zfcp_latency_record channel;
+   struct zfcp_latency_record fabric;
+   u64 counter;
+};
+
+struct zfcp_latencies {
+   struct zfcp_latency_cont read;
+   struct zfcp_latency_cont write;
+   struct zfcp_latency_cont cmd;
+   spinlock_t lock;
+};
+
 /**
  * struct zfcp_unit - LUN configured via zfcp sysfs
  * @dev: struct device for sysfs representation and reference counting
-- 
2.16.4



[PATCH 07/23] zfcp: namespace prefix for internal latency data structures

2018-11-08 Thread Steffen Maier
In contrast to struct fsf_qual_latency_info, the ones here are not FSF
but software defined zfcp-internal.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_def.h | 14 +++---
 drivers/s390/scsi/zfcp_fsf.c |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 13bfc13eb42d..e227b0770221 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -115,22 +115,22 @@ struct zfcp_erp_action {
struct timer_list timer;
 };
 
-struct fsf_latency_record {
+struct zfcp_latency_record {
u32 min;
u32 max;
u64 sum;
 };
 
-struct latency_cont {
-   struct fsf_latency_record channel;
-   struct fsf_latency_record fabric;
+struct zfcp_latency_cont {
+   struct zfcp_latency_record channel;
+   struct zfcp_latency_record fabric;
u64 counter;
 };
 
 struct zfcp_latencies {
-   struct latency_cont read;
-   struct latency_cont write;
-   struct latency_cont cmd;
+   struct zfcp_latency_cont read;
+   struct zfcp_latency_cont write;
+   struct zfcp_latency_cont cmd;
spinlock_t lock;
 };
 
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 095ab7fdcf4b..62311bd2df03 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1991,7 +1991,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action)
return retval;
 }
 
-static void zfcp_fsf_update_lat(struct fsf_latency_record *lat_rec, u32 lat)
+static void zfcp_fsf_update_lat(struct zfcp_latency_record *lat_rec, u32 lat)
 {
lat_rec->sum += lat;
lat_rec->min = min(lat_rec->min, lat);
@@ -2001,7 +2001,7 @@ static void zfcp_fsf_update_lat(struct fsf_latency_record 
*lat_rec, u32 lat)
 static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd 
*scsi)
 {
struct fsf_qual_latency_info *lat_in;
-   struct latency_cont *lat = NULL;
+   struct zfcp_latency_cont *lat = NULL;
struct zfcp_scsi_dev *zfcp_sdev;
struct zfcp_blk_drv_data blktrc;
int ticks = req->adapter->timer_ticks;
-- 
2.16.4



[PATCH 02/22] zfcp: remove unnecessary null pointer check before mempool_destroy

2018-11-08 Thread Steffen Maier
From: zhong jiang 

mempool_destroy has taken null pointer check into account. so remove the
redundant check.

Signed-off-by: zhong jiang 
Acked-by: Benjamin Block 
[ma...@linux.ibm.com: depends on v4.3 4e3ca3e033d1 ("mm/mempool: allow NULL 
`pool' pointer in mempool_destroy()")]
Signed-off-by: Steffen Maier 
---
 drivers/s390/scsi/zfcp_aux.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 08cdc00e8299..8818a3a290f6 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -251,20 +251,13 @@ static int zfcp_allocate_low_mem_buffers(struct 
zfcp_adapter *adapter)
 
 static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
 {
-   if (adapter->pool.erp_req)
-   mempool_destroy(adapter->pool.erp_req);
-   if (adapter->pool.scsi_req)
-   mempool_destroy(adapter->pool.scsi_req);
-   if (adapter->pool.scsi_abort)
-   mempool_destroy(adapter->pool.scsi_abort);
-   if (adapter->pool.qtcb_pool)
-   mempool_destroy(adapter->pool.qtcb_pool);
-   if (adapter->pool.status_read_req)
-   mempool_destroy(adapter->pool.status_read_req);
-   if (adapter->pool.sr_data)
-   mempool_destroy(adapter->pool.sr_data);
-   if (adapter->pool.gid_pn)
-   mempool_destroy(adapter->pool.gid_pn);
+   mempool_destroy(adapter->pool.erp_req);
+   mempool_destroy(adapter->pool.scsi_req);
+   mempool_destroy(adapter->pool.scsi_abort);
+   mempool_destroy(adapter->pool.qtcb_pool);
+   mempool_destroy(adapter->pool.status_read_req);
+   mempool_destroy(adapter->pool.sr_data);
+   mempool_destroy(adapter->pool.gid_pn);
 }
 
 /**
-- 
2.16.4



[PATCH 01/23] zfcp: make DIX experimental, disabled, and independent of DIF

2018-11-08 Thread Steffen Maier
From: Fedor Loshakov 

There are too many unresolved issues with DIX outside of zfcp
such as wrong protection data on writesame/discard (over device-mapper)
or due to unstable page writes.
This can cause I/O stalls or endless loops or even kernel panics,
or I/O errors due to erroneously failed logical block guard checks.

Therefore, introduce separate zfcp module parameters to individually
select support for:
DIF which should work (zfcp.dif, which used to be DIF+DIX, disabled) or
DIX+DIF which causes trouble (zfcp.dix, new, disabled).

If DIX is enabled, we warn on zfcp driver initialization.

Signed-off-by: Steffen Maier 
Co-developed-by: Fedor Loshakov 
Signed-off-by: Fedor Loshakov 
Reviewed-by: Jens Remus 
---
 drivers/s390/scsi/zfcp_aux.c  |  3 +++
 drivers/s390/scsi/zfcp_ext.h  |  1 +
 drivers/s390/scsi/zfcp_scsi.c | 10 +++---
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 94f4d8fe85e0..08cdc00e8299 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -124,6 +124,9 @@ static int __init zfcp_module_init(void)
 {
int retval = -ENOMEM;
 
+   if (zfcp_experimental_dix)
+   pr_warn("DIX is enabled. It is experimental and might cause 
problems\n");
+
zfcp_fsf_qtcb_cache = zfcp_cache_hw_align("zfcp_fsf_qtcb",
  sizeof(struct fsf_qtcb));
if (!zfcp_fsf_qtcb_cache)
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index bd0c5a9f04cb..0940bef35020 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -144,6 +144,7 @@ extern void zfcp_qdio_close(struct zfcp_qdio *);
 extern void zfcp_qdio_siosl(struct zfcp_adapter *);
 
 /* zfcp_scsi.c */
+extern bool zfcp_experimental_dix;
 extern struct scsi_transport_template *zfcp_scsi_transport_template;
 extern int zfcp_scsi_adapter_register(struct zfcp_adapter *);
 extern void zfcp_scsi_adapter_unregister(struct zfcp_adapter *);
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index a8efcb330bc1..2b8c33627460 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -27,7 +27,11 @@ MODULE_PARM_DESC(queue_depth, "Default queue depth for new 
SCSI devices");
 
 static bool enable_dif;
 module_param_named(dif, enable_dif, bool, 0400);
-MODULE_PARM_DESC(dif, "Enable DIF/DIX data integrity support");
+MODULE_PARM_DESC(dif, "Enable DIF data integrity support (default off)");
+
+bool zfcp_experimental_dix;
+module_param_named(dix, zfcp_experimental_dix, bool, 0400);
+MODULE_PARM_DESC(dix, "Enable experimental DIX (data integrity extension) 
support which implies DIF support (default off)");
 
 static bool allow_lun_scan = true;
 module_param(allow_lun_scan, bool, 0600);
@@ -788,11 +792,11 @@ void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
data_div = atomic_read(>status) &
   ZFCP_STATUS_ADAPTER_DATA_DIV_ENABLED;
 
-   if (enable_dif &&
+   if ((enable_dif || zfcp_experimental_dix) &&
adapter->adapter_features & FSF_FEATURE_DIF_PROT_TYPE1)
mask |= SHOST_DIF_TYPE1_PROTECTION;
 
-   if (enable_dif && data_div &&
+   if (zfcp_experimental_dix && data_div &&
adapter->adapter_features & FSF_FEATURE_DIX_PROT_TCPIP) {
mask |= SHOST_DIX_TYPE1_PROTECTION;
scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP);
-- 
2.16.4



[PATCH -next] scsi: qedi: remove set but not used variable 'conn'

2018-11-08 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/qedi/qedi_main.c: In function 'qedi_queue_cqe':
drivers/scsi/qedi/qedi_main.c:1105:21: warning:
 variable 'conn' set but not used [-Wunused-but-set-variable]

It never used since introduction in commit
ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")

Signed-off-by: YueHaibing 
---
 drivers/scsi/qedi/qedi_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 105b0e4..a2eb611 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1102,7 +1102,6 @@ static int qedi_queue_cqe(struct qedi_ctx *qedi, union 
iscsi_cqe *cqe,
 {
struct qedi_work *qedi_work;
struct qedi_conn *q_conn;
-   struct iscsi_conn *conn;
struct qedi_cmd *qedi_cmd;
u32 iscsi_cid;
int rc = 0;
@@ -1115,7 +1114,6 @@ static int qedi_queue_cqe(struct qedi_ctx *qedi, union 
iscsi_cqe *cqe,
  iscsi_cid);
return -1;
}
-   conn = q_conn->cls_conn->dd_data;
 
switch (cqe->cqe_common.cqe_type) {
case ISCSI_CQE_TYPE_SOLICITED:





[PATCH] mpt3sas: Display message on Configurable secure HBA

2018-11-08 Thread Sreekanth Reddy
Display below warning message only up on detection of
Configurable secure type controllers.

"HBA is in Configurable Secure mode"

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 104413e..f73dadc 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10366,6 +10366,10 @@ static void pcie_device_make_active(struct 
MPT3SAS_ADAPTER *ioc,
ioc->id = mpt3_ids++;
sprintf(ioc->driver_name, "%s", MPT3SAS_DRIVER_NAME);
switch (pdev->device) {
+   case MPI26_MFGPAGE_DEVID_CFG_SEC_3816:
+   case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
+   dev_warn(>dev,
+   "HBA is in Configurable Secure mode\n");
case MPI26_MFGPAGE_DEVID_SAS3508:
case MPI26_MFGPAGE_DEVID_SAS3508_1:
case MPI26_MFGPAGE_DEVID_SAS3408:
@@ -10373,9 +10377,6 @@ static void pcie_device_make_active(struct 
MPT3SAS_ADAPTER *ioc,
case MPI26_MFGPAGE_DEVID_SAS3516_1:
case MPI26_MFGPAGE_DEVID_SAS3416:
case MPI26_MFGPAGE_DEVID_SAS3616:
-   case MPI26_MFGPAGE_DEVID_CFG_SEC_3816:
-   case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
-   ioc_warn(ioc, "HBA is in Configurable Secure mode\n");
case MPI26_MFGPAGE_DEVID_HARD_SEC_3816:
case MPI26_MFGPAGE_DEVID_HARD_SEC_3916:
ioc->is_gen35_ioc = 1;
-- 
1.8.3.1