• Steffen Maier's avatar
    scsi: zfcp: use endianness conversions with common FC(P) struct fields · 9d464fc1
    Steffen Maier authored
    Just to silence sparse. Since zfcp only exists for s390 and
    s390 is big endian, this has been working correctly without conversions
    and all the new conversions are NOPs so no performance impact.
    
    Nonetheless, use the conversion on the constant expression where possible.
    
    NB: N_Port-IDs have always been handled with hton24 or ntoh24 conversions
    because they also convert to / from character array.
    
    Affected common code structs and .fields are:
    
    HOT I/O PATH:
    fcp_cmnd .fc_dl
       FCP command: regular SCSI I/O, including DIX case
    
    SEMI-HOT I/O PATH:
    fcp_cmnd .fc_dl
       recovery FCP command: task management function (LUN / target reset)
    fcp_resp_ext
       FCP response having FCP_SNS_LEN_VAL with .fr_rsp_len .fr_sns_len
       FCP response having FCP_RESID_UNDER with .fr_resid
    
    RECOVERY / DISCOVERY PATHS:
    fc_ct_hdr .ct_cmd .ct_mr_size
       zfcp auto port scan [GPN_FT] with fc_gpn_ft_resp.fp_wwpn,
       recovery for returned port [GID_PN] with fc_ns_gid_pn.fn_wwpn,
       get symbolic port name [GSPN],
       register symbolic port name [RSPN] (NPIV only).
    fc_els_rscn .rscn_plen
       incoming ELS (RSCN).
    fc_els_flogi .fl_wwpn .fl_wwnn
       incoming ELS (PLOGI),
       port open response with .fl_csp.sp_bb_data .fl_cssp[0..3].cp_class,
       FCP channel physical port,
       point-to-point peer (P2P only).
    fc_els_logo .fl_n_port_wwn
       incoming ELS (LOGO).
    fc_els_adisc .adisc_wwnn .adisc_wwpn
       path test after RSCN for gone target port.
    
    Since v4.10 commit 05de9700 ("linux/types.h: enable endian checks for
    all sparse builds"), below sparse endianness reports appear by default.
    Previously, one needed to pass argument CF="-D__CHECK_ENDIAN__" to make
    as in: $ make C=1 CF="-D__CHECK_ENDIAN__" M=drivers/s390/scsi.
    
    Silenced sparse warnings and one error:
    
    $ make C=1 M=drivers/s390/scsi
    ...
      CHECK   drivers/s390/scsi/zfcp_dbf.c
    drivers/s390/scsi/zfcp_dbf.c:463:22: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_dbf.c:476:28: warning: restricted __be16 degrades to integer
      CC      drivers/s390/scsi/zfcp_dbf.o
    ...
      CHECK   drivers/s390/scsi/zfcp_fc.c
    drivers/s390/scsi/zfcp_fc.c:263:26: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:299:41: warning: incorrect type in argument 2 (different base types)
    drivers/s390/scsi/zfcp_fc.c:299:41:    expected unsigned long long [unsigned] [usertype] wwpn
    drivers/s390/scsi/zfcp_fc.c:299:41:    got restricted __be64 [usertype] fl_wwpn
    drivers/s390/scsi/zfcp_fc.c:309:40: warning: incorrect type in argument 2 (different base types)
    drivers/s390/scsi/zfcp_fc.c:309:40:    expected unsigned long long [unsigned] [usertype] wwpn
    drivers/s390/scsi/zfcp_fc.c:309:40:    got restricted __be64 [usertype] fl_n_port_wwn
    drivers/s390/scsi/zfcp_fc.c:338:31: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:355:24: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:355:24:    expected restricted __be16 [usertype] ct_cmd
    drivers/s390/scsi/zfcp_fc.c:355:24:    got unsigned short [unsigned] [usertype] cmd
    drivers/s390/scsi/zfcp_fc.c:356:28: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:356:28:    expected restricted __be16 [usertype] ct_mr_size
    drivers/s390/scsi/zfcp_fc.c:356:28:    got int
    drivers/s390/scsi/zfcp_fc.c:379:36: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:379:36:    expected restricted __be64 [usertype] fn_wwpn
    drivers/s390/scsi/zfcp_fc.c:379:36:    got unsigned long long [unsigned] [usertype] wwpn
    drivers/s390/scsi/zfcp_fc.c:463:18: warning: restricted __be64 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:465:17: warning: cast from restricted __be64
    drivers/s390/scsi/zfcp_fc.c:473:20: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:473:20:    expected unsigned long long [unsigned] [usertype] wwnn
    drivers/s390/scsi/zfcp_fc.c:473:20:    got restricted __be64 [usertype] fl_wwnn
    drivers/s390/scsi/zfcp_fc.c:474:29: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:474:29:    expected unsigned int [unsigned] [usertype] maxframe_size
    drivers/s390/scsi/zfcp_fc.c:474:29:    got restricted __be16 [usertype] sp_bb_data
    drivers/s390/scsi/zfcp_fc.c:476:30: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:478:30: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:480:30: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:482:30: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:500:28: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:500:28:    expected unsigned long long [unsigned] [usertype] wwnn
    drivers/s390/scsi/zfcp_fc.c:500:28:    got restricted __be64 [usertype] adisc_wwnn
    drivers/s390/scsi/zfcp_fc.c:502:38: warning: restricted __be64 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:541:40: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:541:40:    expected restricted __be64 [usertype] adisc_wwpn
    drivers/s390/scsi/zfcp_fc.c:541:40:    got unsigned long long [unsigned] [usertype] port_name
    drivers/s390/scsi/zfcp_fc.c:542:40: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fc.c:542:40:    expected restricted __be64 [usertype] adisc_wwnn
    drivers/s390/scsi/zfcp_fc.c:542:40:    got unsigned long long [unsigned] [usertype] node_name
    drivers/s390/scsi/zfcp_fc.c:669:16: warning: restricted __be16 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:696:24: warning: restricted __be64 degrades to integer
    drivers/s390/scsi/zfcp_fc.c:699:54: warning: incorrect type in argument 2 (different base types)
    drivers/s390/scsi/zfcp_fc.c:699:54:    expected unsigned long long [unsigned] [usertype] <noident>
    drivers/s390/scsi/zfcp_fc.c:699:54:    got restricted __be64 [usertype] fp_wwpn
      CC      drivers/s390/scsi/zfcp_fc.o
      CHECK   drivers/s390/scsi/zfcp_fsf.c
    drivers/s390/scsi/zfcp_fsf.c:479:34: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fsf.c:479:34:    expected unsigned long long [unsigned] [usertype] port_name
    drivers/s390/scsi/zfcp_fsf.c:479:34:    got restricted __be64 [usertype] fl_wwpn
    drivers/s390/scsi/zfcp_fsf.c:480:34: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fsf.c:480:34:    expected unsigned long long [unsigned] [usertype] node_name
    drivers/s390/scsi/zfcp_fsf.c:480:34:    got restricted __be64 [usertype] fl_wwnn
    drivers/s390/scsi/zfcp_fsf.c:506:36: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fsf.c:506:36:    expected unsigned long long [unsigned] [usertype] peer_wwpn
    drivers/s390/scsi/zfcp_fsf.c:506:36:    got restricted __be64 [usertype] fl_wwpn
    drivers/s390/scsi/zfcp_fsf.c:507:36: warning: incorrect type in assignment (different base types)
    drivers/s390/scsi/zfcp_fsf.c:507:36:    expected unsigned long long [unsigned] [usertype] peer_wwnn
    drivers/s390/scsi/zfcp_fsf.c:507:36:    got restricted __be64 [usertype] fl_wwnn
    drivers/s390/scsi/zfcp_fc.h:269:46: warning: restricted __be32 degrades to integer
    drivers/s390/scsi/zfcp_fc.h:270:29: error: incompatible types in comparison expression (different base types)
    Signed-off-by: default avatarSteffen Maier <maier@linux.vnet.ibm.com>
    Reviewed-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
    Signed-off-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    9d464fc1
zfcp_fsf.c 66.2 KB