• Steffen Maier's avatar
    scsi: zfcp: support SCSI_ADAPTER_RESET via scsi_host sysfs attribute host_reset · 35e9111a
    Steffen Maier authored
    Make use of feature introduced with v3.2 commit 29443691 ("[SCSI] scsi:
    Added support for adapter and firmware reset").  The common code interface
    was introduced for commit 95d31262 ("[SCSI] qla4xxx: Added support for
    adapter and firmware reset").
    
    $ echo adapter > /sys/class/scsi_host/host<N>/host_reset
    
    Example trace record formatted with zfcpdbf from s390-tools:
    
    Timestamp      : ...
    Area           : REC
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1                      ZFCP_DBF_REC_TRIG
    Tag            : scshr_y                SCSI sysfs host_reset yes
    LUN            : 0xffffffffffffffff                     none (invalid)
    WWPN           : 0x0000000000000000                     none (invalid)
    D_ID           : 0x00000000                             none (invalid)
    Adapter status : 0x4500050b
    Port status    : 0x00000000                             none (invalid)
    LUN status     : 0x00000000                             none (invalid)
    Ready count    : 0x00000001
    Running count  : 0x00000000
    ERP want       : 0x04                   ZFCP_ERP_ACTION_REOPEN_ADAPTER
    ERP need       : 0x04                   ZFCP_ERP_ACTION_REOPEN_ADAPTER
    
    This is the common code equivalent to the zfcp-specific
    &dev_attr_adapter_failed.attr in zfcp_sysfs_adapter_attrs.attrs[]:
    
    $ echo 0 > /sys/bus/ccw/drivers/zfcp/<devbusid>/failed
    
    The unsupported case returns EOPNOTSUPP:
    
    $ echo firmware > /sys/class/scsi_host/host<N>/host_reset
    -bash: echo: write error: Operation not supported
    
    Example trace record formatted with zfcpdbf from s390-tools:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : scshr_n                        SCSI sysfs host_reset no
    Request ID     : 0x0000000000000000                     none (invalid)
    SCSI ID        : 0xffffffff                             none (invalid)
    SCSI LUN       : 0xffffffff                             none (invalid)
    SCSI LUN high  : 0xffffffff                             none (invalid)
    SCSI result    : 0xffffffa1                     -EOPNOTSUPP==-95
    SCSI retries   : 0xff                                   none (invalid)
    SCSI allowed   : 0xff                                   none (invalid)
    SCSI scribble  : 0xffffffffffffffff                     none (invalid)
    SCSI opcode    : ffffffff ffffffff ffffffff ffffffff    none (invalid)
    FCP rsp inf cod: 0xff                                   none (invalid)
    FCP rsp IU     : 00000000 00000000 00000000 00000000    none (invalid)
                     00000000 00000000
    
    For any other invalid value, common code returns EINVAL without invoking
    our callback:
    
    $ echo foo > /sys/class/scsi_host/host<N>/host_reset
    -bash: echo: write error: Invalid argument
    Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
    Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    35e9111a
zfcp_scsi.c 24.7 KB