1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds /* 3553448f6SChristof Schmitt * zfcp device driver 41da177e4SLinus Torvalds * 5553448f6SChristof Schmitt * Interface to the FSF support functions. 61da177e4SLinus Torvalds * 7a17c7846SJens Remus * Copyright IBM Corp. 2002, 2020 81da177e4SLinus Torvalds */ 91da177e4SLinus Torvalds 101da177e4SLinus Torvalds #ifndef FSF_H 111da177e4SLinus Torvalds #define FSF_H 121da177e4SLinus Torvalds 1345633fdcSChristof Schmitt #include <linux/pfn.h> 14d46f384aSChristof Schmitt #include <linux/scatterlist.h> 15800c0cadSChristof Schmitt #include <scsi/libfc.h> 1645633fdcSChristof Schmitt 1706506d00SAndreas Herrmann #define FSF_QTCB_CURRENT_VERSION 0x00000001 181da177e4SLinus Torvalds 191da177e4SLinus Torvalds /* FSF commands */ 201da177e4SLinus Torvalds #define FSF_QTCB_FCP_CMND 0x00000001 211da177e4SLinus Torvalds #define FSF_QTCB_ABORT_FCP_CMND 0x00000002 221da177e4SLinus Torvalds #define FSF_QTCB_OPEN_PORT_WITH_DID 0x00000005 231da177e4SLinus Torvalds #define FSF_QTCB_OPEN_LUN 0x00000006 241da177e4SLinus Torvalds #define FSF_QTCB_CLOSE_LUN 0x00000007 251da177e4SLinus Torvalds #define FSF_QTCB_CLOSE_PORT 0x00000008 261da177e4SLinus Torvalds #define FSF_QTCB_CLOSE_PHYSICAL_PORT 0x00000009 271da177e4SLinus Torvalds #define FSF_QTCB_SEND_ELS 0x0000000B 281da177e4SLinus Torvalds #define FSF_QTCB_SEND_GENERIC 0x0000000C 291da177e4SLinus Torvalds #define FSF_QTCB_EXCHANGE_CONFIG_DATA 0x0000000D 301da177e4SLinus Torvalds #define FSF_QTCB_EXCHANGE_PORT_DATA 0x0000000E 311da177e4SLinus Torvalds #define FSF_QTCB_DOWNLOAD_CONTROL_FILE 0x00000012 321da177e4SLinus Torvalds #define FSF_QTCB_UPLOAD_CONTROL_FILE 0x00000013 331da177e4SLinus Torvalds 341da177e4SLinus Torvalds /* FSF QTCB types */ 351da177e4SLinus Torvalds #define FSF_IO_COMMAND 0x00000001 361da177e4SLinus Torvalds #define FSF_SUPPORT_COMMAND 0x00000002 371da177e4SLinus Torvalds #define FSF_CONFIG_COMMAND 0x00000003 381da177e4SLinus Torvalds #define FSF_PORT_COMMAND 0x00000004 391da177e4SLinus Torvalds 4006506d00SAndreas Herrmann /* FSF protocol states */ 411da177e4SLinus Torvalds #define FSF_PROT_GOOD 0x00000001 421da177e4SLinus Torvalds #define FSF_PROT_QTCB_VERSION_ERROR 0x00000010 431da177e4SLinus Torvalds #define FSF_PROT_SEQ_NUMB_ERROR 0x00000020 441da177e4SLinus Torvalds #define FSF_PROT_UNSUPP_QTCB_TYPE 0x00000040 451da177e4SLinus Torvalds #define FSF_PROT_HOST_CONNECTION_INITIALIZING 0x00000080 461da177e4SLinus Torvalds #define FSF_PROT_FSF_STATUS_PRESENTED 0x00000100 471da177e4SLinus Torvalds #define FSF_PROT_DUPLICATE_REQUEST_ID 0x00000200 481da177e4SLinus Torvalds #define FSF_PROT_LINK_DOWN 0x00000400 491da177e4SLinus Torvalds #define FSF_PROT_REEST_QUEUE 0x00000800 501da177e4SLinus Torvalds #define FSF_PROT_ERROR_STATE 0x01000000 511da177e4SLinus Torvalds 5206506d00SAndreas Herrmann /* FSF states */ 531da177e4SLinus Torvalds #define FSF_GOOD 0x00000000 541da177e4SLinus Torvalds #define FSF_PORT_ALREADY_OPEN 0x00000001 551da177e4SLinus Torvalds #define FSF_LUN_ALREADY_OPEN 0x00000002 561da177e4SLinus Torvalds #define FSF_PORT_HANDLE_NOT_VALID 0x00000003 571da177e4SLinus Torvalds #define FSF_LUN_HANDLE_NOT_VALID 0x00000004 581da177e4SLinus Torvalds #define FSF_HANDLE_MISMATCH 0x00000005 591da177e4SLinus Torvalds #define FSF_SERVICE_CLASS_NOT_SUPPORTED 0x00000006 601da177e4SLinus Torvalds #define FSF_FCPLUN_NOT_VALID 0x00000009 611da177e4SLinus Torvalds #define FSF_LUN_SHARING_VIOLATION 0x00000012 621da177e4SLinus Torvalds #define FSF_FCP_COMMAND_DOES_NOT_EXIST 0x00000022 631da177e4SLinus Torvalds #define FSF_DIRECTION_INDICATOR_NOT_VALID 0x00000030 641da177e4SLinus Torvalds #define FSF_CMND_LENGTH_NOT_VALID 0x00000033 651da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED 0x00000040 661da177e4SLinus Torvalds #define FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED 0x00000041 671da177e4SLinus Torvalds #define FSF_ELS_COMMAND_REJECTED 0x00000050 681da177e4SLinus Torvalds #define FSF_GENERIC_COMMAND_REJECTED 0x00000051 691da177e4SLinus Torvalds #define FSF_PORT_BOXED 0x00000059 701da177e4SLinus Torvalds #define FSF_LUN_BOXED 0x0000005A 711da177e4SLinus Torvalds #define FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE 0x0000005B 721da177e4SLinus Torvalds #define FSF_PAYLOAD_SIZE_MISMATCH 0x00000060 731da177e4SLinus Torvalds #define FSF_REQUEST_SIZE_TOO_LARGE 0x00000061 741da177e4SLinus Torvalds #define FSF_RESPONSE_SIZE_TOO_LARGE 0x00000062 751da177e4SLinus Torvalds #define FSF_SBAL_MISMATCH 0x00000063 76ef3eb71dSFelix Beck #define FSF_INCONSISTENT_PROT_DATA 0x00000070 77ef3eb71dSFelix Beck #define FSF_INVALID_PROT_PARM 0x00000071 78ef3eb71dSFelix Beck #define FSF_BLOCK_GUARD_CHECK_FAILURE 0x00000081 79ef3eb71dSFelix Beck #define FSF_APP_TAG_CHECK_FAILURE 0x00000082 80ef3eb71dSFelix Beck #define FSF_REF_TAG_CHECK_FAILURE 0x00000083 81e53d9285SJens Remus #define FSF_SECURITY_ERROR 0x00000090 821da177e4SLinus Torvalds #define FSF_ADAPTER_STATUS_AVAILABLE 0x000000AD 8356d23ed7SSteffen Maier #define FSF_FCP_RSP_AVAILABLE 0x000000AF 841da177e4SLinus Torvalds #define FSF_UNKNOWN_COMMAND 0x000000E2 851da177e4SLinus Torvalds #define FSF_UNKNOWN_OP_SUBTYPE 0x000000E3 861da177e4SLinus Torvalds #define FSF_INVALID_COMMAND_OPTION 0x000000E5 871da177e4SLinus Torvalds 888a36e453SMaxim Shchetynin #define FSF_PROT_STATUS_QUAL_SIZE 16 891da177e4SLinus Torvalds #define FSF_STATUS_QUALIFIER_SIZE 16 901da177e4SLinus Torvalds 911da177e4SLinus Torvalds /* FSF status qualifier, recommendations */ 921da177e4SLinus Torvalds #define FSF_SQ_NO_RECOM 0x00 931da177e4SLinus Torvalds #define FSF_SQ_FCP_RSP_AVAILABLE 0x01 941da177e4SLinus Torvalds #define FSF_SQ_RETRY_IF_POSSIBLE 0x02 951da177e4SLinus Torvalds #define FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED 0x03 961da177e4SLinus Torvalds #define FSF_SQ_INVOKE_LINK_TEST_PROCEDURE 0x04 971da177e4SLinus Torvalds #define FSF_SQ_COMMAND_ABORTED 0x06 981da177e4SLinus Torvalds #define FSF_SQ_NO_RETRY_POSSIBLE 0x07 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds /* FSF status qualifier (most significant 4 bytes), local link down */ 101aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_LIGHT 0x00000004 102aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WRAP_PLUG 0x00000008 103aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP 0x00000010 104aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FIRMWARE_UPDATE 0x00000020 105aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_INVALID_WWPN 0x00000100 106aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_NPIV_SUPPORT 0x00000200 107aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FCP_RESOURCES 0x00000400 108aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_FABRIC_RESOURCES 0x00000800 109aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE 0x00001000 110aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED 0x00002000 111aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_MODE_TABLE_CURRUPTED 0x00004000 112aef4a983SMaxim Shchetynin #define FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT 0x00008000 1131da177e4SLinus Torvalds 11442cabdafSJens Remus /* FSF status qualifier, security error */ 11542cabdafSJens Remus #define FSF_SQ_SECURITY_REQUIRED 0x00000001 11642cabdafSJens Remus #define FSF_SQ_SECURITY_TIMEOUT 0x00000002 11742cabdafSJens Remus #define FSF_SQ_SECURITY_KM_UNAVAILABLE 0x00000003 11842cabdafSJens Remus #define FSF_SQ_SECURITY_RKM_UNAVAILABLE 0x00000004 11942cabdafSJens Remus #define FSF_SQ_SECURITY_AUTH_FAILURE 0x00000005 12042cabdafSJens Remus #define FSF_SQ_SECURITY_ENC_FAILURE 0x00000010 12142cabdafSJens Remus 1221da177e4SLinus Torvalds /* payload size in status read buffer */ 1231da177e4SLinus Torvalds #define FSF_STATUS_READ_PAYLOAD_SIZE 4032 1241da177e4SLinus Torvalds 1251da177e4SLinus Torvalds /* number of status read buffers that should be sent by ULP */ 1261da177e4SLinus Torvalds #define FSF_STATUS_READS_RECOM 16 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds /* status types in status read buffer */ 1291da177e4SLinus Torvalds #define FSF_STATUS_READ_PORT_CLOSED 0x00000001 1301da177e4SLinus Torvalds #define FSF_STATUS_READ_INCOMING_ELS 0x00000002 1311da177e4SLinus Torvalds #define FSF_STATUS_READ_SENSE_DATA_AVAIL 0x00000003 1321da177e4SLinus Torvalds #define FSF_STATUS_READ_BIT_ERROR_THRESHOLD 0x00000004 133aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_LINK_DOWN 0x00000005 1341da177e4SLinus Torvalds #define FSF_STATUS_READ_LINK_UP 0x00000006 1359eb69affSMaxim Shchetynin #define FSF_STATUS_READ_NOTIFICATION_LOST 0x00000009 136aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_FEATURE_UPDATE_ALERT 0x0000000C 137*a6c37abeSJulian Wiedmann #define FSF_STATUS_READ_VERSION_CHANGE 0x0000000D 1381da177e4SLinus Torvalds 139aef4a983SMaxim Shchetynin /* status subtypes for link down */ 140aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK 0x00000000 141aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FDISC_FAILED 0x00000001 142aef4a983SMaxim Shchetynin #define FSF_STATUS_READ_SUB_FIRMWARE_UPDATE 0x00000002 143aef4a983SMaxim Shchetynin 1449eb69affSMaxim Shchetynin /* status subtypes for unsolicited status notification lost */ 1459eb69affSMaxim Shchetynin #define FSF_STATUS_READ_SUB_INCOMING_ELS 0x00000001 1461da177e4SLinus Torvalds 147*a6c37abeSJulian Wiedmann /* status subtypes for version change */ 148*a6c37abeSJulian Wiedmann #define FSF_STATUS_READ_SUB_LIC_CHANGE 0x00000001 149*a6c37abeSJulian Wiedmann 1501da177e4SLinus Torvalds /* topologie that is detected by the adapter */ 1511da177e4SLinus Torvalds #define FSF_TOPO_P2P 0x00000001 1521da177e4SLinus Torvalds #define FSF_TOPO_FABRIC 0x00000002 1531da177e4SLinus Torvalds #define FSF_TOPO_AL 0x00000003 1541da177e4SLinus Torvalds 1551da177e4SLinus Torvalds /* data direction for FCP commands */ 1561da177e4SLinus Torvalds #define FSF_DATADIR_WRITE 0x00000001 1571da177e4SLinus Torvalds #define FSF_DATADIR_READ 0x00000002 1581da177e4SLinus Torvalds #define FSF_DATADIR_CMND 0x00000004 159ef3eb71dSFelix Beck #define FSF_DATADIR_DIF_WRITE_INSERT 0x00000009 160ef3eb71dSFelix Beck #define FSF_DATADIR_DIF_READ_STRIP 0x0000000a 161ef3eb71dSFelix Beck #define FSF_DATADIR_DIF_WRITE_CONVERT 0x0000000b 162ef3eb71dSFelix Beck #define FSF_DATADIR_DIF_READ_CONVERT 0X0000000c 163ef3eb71dSFelix Beck 164ef3eb71dSFelix Beck /* data protection control flags */ 165ef3eb71dSFelix Beck #define FSF_APP_TAG_CHECK_ENABLE 0x10 1661da177e4SLinus Torvalds 1671da177e4SLinus Torvalds /* fc service class */ 1681da177e4SLinus Torvalds #define FSF_CLASS_3 0x00000003 1691da177e4SLinus Torvalds 1701da177e4SLinus Torvalds /* logging space behind QTCB */ 1711da177e4SLinus Torvalds #define FSF_QTCB_LOG_SIZE 1024 1721da177e4SLinus Torvalds 1731da177e4SLinus Torvalds /* channel features */ 1749eb69affSMaxim Shchetynin #define FSF_FEATURE_NOTIFICATION_LOST 0x00000008 1751da177e4SLinus Torvalds #define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010 17639eb7e9aSChristof Schmitt #define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020 177aef4a983SMaxim Shchetynin #define FSF_FEATURE_UPDATE_ALERT 0x00000100 1786d9d63b9SSwen Schillig #define FSF_FEATURE_MEASUREMENT_DATA 0x00000200 179a10a61e8SBenjamin Block #define FSF_FEATURE_REQUEST_SFP_DATA 0x00000200 180a10a61e8SBenjamin Block #define FSF_FEATURE_REPORT_SFP_DATA 0x00000800 181a17c7846SJens Remus #define FSF_FEATURE_FC_SECURITY 0x00001000 182ef3eb71dSFelix Beck #define FSF_FEATURE_DIF_PROT_TYPE1 0x00010000 183ef3eb71dSFelix Beck #define FSF_FEATURE_DIX_PROT_TCPIP 0x00020000 184aef4a983SMaxim Shchetynin 185aef4a983SMaxim Shchetynin /* host connection features */ 186aef4a983SMaxim Shchetynin #define FSF_FEATURE_NPIV_MODE 0x00000001 1871da177e4SLinus Torvalds 1881da177e4SLinus Torvalds /* option */ 1891da177e4SLinus Torvalds #define FSF_OPEN_LUN_SUPPRESS_BOXING 0x00000001 1901da177e4SLinus Torvalds 191a17c7846SJens Remus /* FC security algorithms */ 192a17c7846SJens Remus #define FSF_FC_SECURITY_AUTH 0x00000001 193a17c7846SJens Remus #define FSF_FC_SECURITY_ENC_FCSP2 0x00000002 194a17c7846SJens Remus #define FSF_FC_SECURITY_ENC_ERAS 0x00000004 195a17c7846SJens Remus 1961da177e4SLinus Torvalds struct fsf_queue_designator { 1971da177e4SLinus Torvalds u8 cssid; 1981da177e4SLinus Torvalds u8 chpid; 1991da177e4SLinus Torvalds u8 hla; 2001da177e4SLinus Torvalds u8 ua; 2011da177e4SLinus Torvalds u32 res1; 2021da177e4SLinus Torvalds } __attribute__ ((packed)); 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvalds struct fsf_bit_error_payload { 2051da177e4SLinus Torvalds u32 res1; 2061da177e4SLinus Torvalds u32 link_failure_error_count; 2071da177e4SLinus Torvalds u32 loss_of_sync_error_count; 2081da177e4SLinus Torvalds u32 loss_of_signal_error_count; 2091da177e4SLinus Torvalds u32 primitive_sequence_error_count; 2101da177e4SLinus Torvalds u32 invalid_transmission_word_error_count; 2111da177e4SLinus Torvalds u32 crc_error_count; 2121da177e4SLinus Torvalds u32 primitive_sequence_event_timeout_count; 2131da177e4SLinus Torvalds u32 elastic_buffer_overrun_error_count; 2141da177e4SLinus Torvalds u32 fcal_arbitration_timeout_count; 2151da177e4SLinus Torvalds u32 advertised_receive_b2b_credit; 2161da177e4SLinus Torvalds u32 current_receive_b2b_credit; 2171da177e4SLinus Torvalds u32 advertised_transmit_b2b_credit; 2181da177e4SLinus Torvalds u32 current_transmit_b2b_credit; 2191da177e4SLinus Torvalds } __attribute__ ((packed)); 2201da177e4SLinus Torvalds 221aef4a983SMaxim Shchetynin struct fsf_link_down_info { 222aef4a983SMaxim Shchetynin u32 error_code; 223aef4a983SMaxim Shchetynin u32 res1; 224aef4a983SMaxim Shchetynin u8 res2[2]; 225aef4a983SMaxim Shchetynin u8 primary_status; 226aef4a983SMaxim Shchetynin u8 ioerr_code; 227aef4a983SMaxim Shchetynin u8 action_code; 228aef4a983SMaxim Shchetynin u8 reason_code; 229aef4a983SMaxim Shchetynin u8 explanation_code; 230aef4a983SMaxim Shchetynin u8 vendor_specific_code; 2311da177e4SLinus Torvalds } __attribute__ ((packed)); 2321da177e4SLinus Torvalds 233*a6c37abeSJulian Wiedmann struct fsf_version_change { 234*a6c37abeSJulian Wiedmann u32 current_version; 235*a6c37abeSJulian Wiedmann u32 previous_version; 236*a6c37abeSJulian Wiedmann } __packed; 237*a6c37abeSJulian Wiedmann 238c41f8cbdSSwen Schillig struct fsf_status_read_buffer { 239c41f8cbdSSwen Schillig u32 status_type; 240c41f8cbdSSwen Schillig u32 status_subtype; 241c41f8cbdSSwen Schillig u32 length; 242c41f8cbdSSwen Schillig u32 res1; 243c41f8cbdSSwen Schillig struct fsf_queue_designator queue_designator; 244800c0cadSChristof Schmitt u8 res2; 245800c0cadSChristof Schmitt u8 d_id[3]; 246c41f8cbdSSwen Schillig u32 class; 247c41f8cbdSSwen Schillig u64 fcp_lun; 248c41f8cbdSSwen Schillig u8 res3[24]; 249c41f8cbdSSwen Schillig union { 250c41f8cbdSSwen Schillig u8 data[FSF_STATUS_READ_PAYLOAD_SIZE]; 251c41f8cbdSSwen Schillig u32 word[FSF_STATUS_READ_PAYLOAD_SIZE/sizeof(u32)]; 252c41f8cbdSSwen Schillig struct fsf_link_down_info link_down_info; 253c41f8cbdSSwen Schillig struct fsf_bit_error_payload bit_error; 254*a6c37abeSJulian Wiedmann struct fsf_version_change version_change; 255c41f8cbdSSwen Schillig } payload; 256c41f8cbdSSwen Schillig } __attribute__ ((packed)); 257c41f8cbdSSwen Schillig 258c41f8cbdSSwen Schillig struct fsf_qual_version_error { 259c41f8cbdSSwen Schillig u32 fsf_version; 260c41f8cbdSSwen Schillig u32 res1[3]; 261c41f8cbdSSwen Schillig } __attribute__ ((packed)); 262c41f8cbdSSwen Schillig 263c41f8cbdSSwen Schillig struct fsf_qual_sequence_error { 264c41f8cbdSSwen Schillig u32 exp_req_seq_no; 265c41f8cbdSSwen Schillig u32 res1[3]; 266c41f8cbdSSwen Schillig } __attribute__ ((packed)); 267c41f8cbdSSwen Schillig 268c9615858SChristof Schmitt struct fsf_qual_latency_info { 269c9615858SChristof Schmitt u32 channel_lat; 270c9615858SChristof Schmitt u32 fabric_lat; 271c9615858SChristof Schmitt u8 res1[8]; 272c9615858SChristof Schmitt } __attribute__ ((packed)); 273c9615858SChristof Schmitt 2741da177e4SLinus Torvalds union fsf_prot_status_qual { 275553448f6SChristof Schmitt u32 word[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u32)]; 2768a36e453SMaxim Shchetynin u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)]; 2771da177e4SLinus Torvalds struct fsf_qual_version_error version_error; 2781da177e4SLinus Torvalds struct fsf_qual_sequence_error sequence_error; 279aef4a983SMaxim Shchetynin struct fsf_link_down_info link_down_info; 280c9615858SChristof Schmitt struct fsf_qual_latency_info latency_info; 2811da177e4SLinus Torvalds } __attribute__ ((packed)); 2821da177e4SLinus Torvalds 2831da177e4SLinus Torvalds struct fsf_qtcb_prefix { 2841da177e4SLinus Torvalds u64 req_id; 2851da177e4SLinus Torvalds u32 qtcb_version; 2861da177e4SLinus Torvalds u32 ulp_info; 2871da177e4SLinus Torvalds u32 qtcb_type; 2881da177e4SLinus Torvalds u32 req_seq_no; 2891da177e4SLinus Torvalds u32 prot_status; 2901da177e4SLinus Torvalds union fsf_prot_status_qual prot_status_qual; 2911da177e4SLinus Torvalds u8 res1[20]; 2921da177e4SLinus Torvalds } __attribute__ ((packed)); 2931da177e4SLinus Torvalds 2946d9d63b9SSwen Schillig struct fsf_statistics_info { 2956d9d63b9SSwen Schillig u64 input_req; 2966d9d63b9SSwen Schillig u64 output_req; 2976d9d63b9SSwen Schillig u64 control_req; 2986d9d63b9SSwen Schillig u64 input_mb; 2996d9d63b9SSwen Schillig u64 output_mb; 3006d9d63b9SSwen Schillig u64 seconds_act; 3016d9d63b9SSwen Schillig } __attribute__ ((packed)); 3026d9d63b9SSwen Schillig 3031da177e4SLinus Torvalds union fsf_status_qual { 3041da177e4SLinus Torvalds u8 byte[FSF_STATUS_QUALIFIER_SIZE]; 3051da177e4SLinus Torvalds u16 halfword[FSF_STATUS_QUALIFIER_SIZE / sizeof (u16)]; 3061da177e4SLinus Torvalds u32 word[FSF_STATUS_QUALIFIER_SIZE / sizeof (u32)]; 3078a36e453SMaxim Shchetynin u64 doubleword[FSF_STATUS_QUALIFIER_SIZE / sizeof(u64)]; 3081da177e4SLinus Torvalds struct fsf_queue_designator fsf_queue_designator; 309aef4a983SMaxim Shchetynin struct fsf_link_down_info link_down_info; 3101da177e4SLinus Torvalds } __attribute__ ((packed)); 3111da177e4SLinus Torvalds 3121da177e4SLinus Torvalds struct fsf_qtcb_header { 3131da177e4SLinus Torvalds u64 req_handle; 3141da177e4SLinus Torvalds u32 fsf_command; 3151da177e4SLinus Torvalds u32 res1; 3161da177e4SLinus Torvalds u32 port_handle; 3171da177e4SLinus Torvalds u32 lun_handle; 3181da177e4SLinus Torvalds u32 res2; 3191da177e4SLinus Torvalds u32 fsf_status; 3201da177e4SLinus Torvalds union fsf_status_qual fsf_status_qual; 3211da177e4SLinus Torvalds u8 res3[28]; 3221da177e4SLinus Torvalds u16 log_start; 3231da177e4SLinus Torvalds u16 log_length; 3241da177e4SLinus Torvalds u8 res4[16]; 3251da177e4SLinus Torvalds } __attribute__ ((packed)); 3261da177e4SLinus Torvalds 32739eb7e9aSChristof Schmitt #define FSF_PLOGI_MIN_LEN 112 3281da177e4SLinus Torvalds 3291da177e4SLinus Torvalds #define FSF_FCP_CMND_SIZE 288 3301da177e4SLinus Torvalds #define FSF_FCP_RSP_SIZE 128 3311da177e4SLinus Torvalds 3321da177e4SLinus Torvalds struct fsf_qtcb_bottom_io { 3331da177e4SLinus Torvalds u32 data_direction; 3341da177e4SLinus Torvalds u32 service_class; 335ef3eb71dSFelix Beck u8 res1; 336ef3eb71dSFelix Beck u8 data_prot_flags; 337ef3eb71dSFelix Beck u16 app_tag_value; 338ef3eb71dSFelix Beck u32 ref_tag_value; 3391da177e4SLinus Torvalds u32 fcp_cmnd_length; 340ef3eb71dSFelix Beck u32 data_block_length; 341ef3eb71dSFelix Beck u32 prot_data_length; 342ef3eb71dSFelix Beck u8 res2[4]; 343df00d7b8SSteffen Maier union { 344df00d7b8SSteffen Maier u8 byte[FSF_FCP_CMND_SIZE]; 345df00d7b8SSteffen Maier struct fcp_cmnd iu; 346df00d7b8SSteffen Maier } fcp_cmnd; 347df00d7b8SSteffen Maier union { 348df00d7b8SSteffen Maier u8 byte[FSF_FCP_RSP_SIZE]; 349df00d7b8SSteffen Maier struct fcp_resp_with_ext iu; 350df00d7b8SSteffen Maier } fcp_rsp; 3511da177e4SLinus Torvalds u8 res3[64]; 3521da177e4SLinus Torvalds } __attribute__ ((packed)); 3531da177e4SLinus Torvalds 3541da177e4SLinus Torvalds struct fsf_qtcb_bottom_support { 3551da177e4SLinus Torvalds u32 operation_subtype; 356800c0cadSChristof Schmitt u8 res1[13]; 357800c0cadSChristof Schmitt u8 d_id[3]; 3581da177e4SLinus Torvalds u32 option; 3591da177e4SLinus Torvalds u64 fcp_lun; 3601da177e4SLinus Torvalds u64 res2; 3611da177e4SLinus Torvalds u64 req_handle; 3621da177e4SLinus Torvalds u32 service_class; 3631da177e4SLinus Torvalds u8 res3[3]; 3641da177e4SLinus Torvalds u8 timeout; 3651da177e4SLinus Torvalds u32 lun_access_info; 366a17c7846SJens Remus u32 connection_info; 367a17c7846SJens Remus u8 res4[176]; 3681da177e4SLinus Torvalds u32 els1_length; 3691da177e4SLinus Torvalds u32 els2_length; 3701da177e4SLinus Torvalds u32 req_buf_length; 3711da177e4SLinus Torvalds u32 resp_buf_length; 3721da177e4SLinus Torvalds u8 els[256]; 3731da177e4SLinus Torvalds } __attribute__ ((packed)); 3741da177e4SLinus Torvalds 375faf4cd85SChristof Schmitt #define ZFCP_FSF_TIMER_INT_MASK 0x3FFF 376faf4cd85SChristof Schmitt 3771da177e4SLinus Torvalds struct fsf_qtcb_bottom_config { 3781da177e4SLinus Torvalds u32 lic_version; 3791da177e4SLinus Torvalds u32 feature_selection; 3801da177e4SLinus Torvalds u32 high_qtcb_version; 3811da177e4SLinus Torvalds u32 low_qtcb_version; 3821da177e4SLinus Torvalds u32 max_qtcb_size; 3831da177e4SLinus Torvalds u32 max_data_transfer_size; 384aef4a983SMaxim Shchetynin u32 adapter_features; 385aef4a983SMaxim Shchetynin u32 connection_features; 3861da177e4SLinus Torvalds u32 fc_topology; 38716dad279SJens Remus u32 fc_link_speed; /* one of ZFCP_FSF_PORTSPEED_* */ 3881da177e4SLinus Torvalds u32 adapter_type; 389800c0cadSChristof Schmitt u8 res0; 390800c0cadSChristof Schmitt u8 peer_d_id[3]; 39164deb6efSChristof Schmitt u16 status_read_buf_num; 392c9615858SChristof Schmitt u16 timer_interval; 393800c0cadSChristof Schmitt u8 res2[9]; 394800c0cadSChristof Schmitt u8 s_id[3]; 3959d05ce2cSChristof Schmitt u8 nport_serv_param[128]; 3961da177e4SLinus Torvalds u8 res3[8]; 3971da177e4SLinus Torvalds u32 adapter_ports; 3981da177e4SLinus Torvalds u32 hardware_version; 3991da177e4SLinus Torvalds u8 serial_number[32]; 4009d05ce2cSChristof Schmitt u8 plogi_payload[112]; 4016d9d63b9SSwen Schillig struct fsf_statistics_info stat_info; 4026d9d63b9SSwen Schillig u8 res4[112]; 4031da177e4SLinus Torvalds } __attribute__ ((packed)); 4041da177e4SLinus Torvalds 4051da177e4SLinus Torvalds struct fsf_qtcb_bottom_port { 406aef4a983SMaxim Shchetynin u64 wwpn; 4071da177e4SLinus Torvalds u32 fc_port_id; 4081da177e4SLinus Torvalds u32 port_type; 4091da177e4SLinus Torvalds u32 port_state; 4101da177e4SLinus Torvalds u32 class_of_service; /* should be 0x00000006 for class 2 and 3 */ 4111da177e4SLinus Torvalds u8 supported_fc4_types[32]; /* should be 0x00000100 for scsi fcp */ 4121da177e4SLinus Torvalds u8 active_fc4_types[32]; 41316dad279SJens Remus u32 supported_speed; /* any combination of ZFCP_FSF_PORTSPEED_* */ 4141da177e4SLinus Torvalds u32 maximum_frame_size; /* fixed value of 2112 */ 4151da177e4SLinus Torvalds u64 seconds_since_last_reset; 4161da177e4SLinus Torvalds u64 tx_frames; 4171da177e4SLinus Torvalds u64 tx_words; 4181da177e4SLinus Torvalds u64 rx_frames; 4191da177e4SLinus Torvalds u64 rx_words; 4201da177e4SLinus Torvalds u64 lip; /* 0 */ 4211da177e4SLinus Torvalds u64 nos; /* currently 0 */ 4221da177e4SLinus Torvalds u64 error_frames; /* currently 0 */ 4231da177e4SLinus Torvalds u64 dumped_frames; /* currently 0 */ 4241da177e4SLinus Torvalds u64 link_failure; 4251da177e4SLinus Torvalds u64 loss_of_sync; 4261da177e4SLinus Torvalds u64 loss_of_signal; 4271da177e4SLinus Torvalds u64 psp_error_counts; 4281da177e4SLinus Torvalds u64 invalid_tx_words; 4291da177e4SLinus Torvalds u64 invalid_crcs; 4301da177e4SLinus Torvalds u64 input_requests; 4311da177e4SLinus Torvalds u64 output_requests; 4321da177e4SLinus Torvalds u64 control_requests; 4331da177e4SLinus Torvalds u64 input_mb; /* where 1 MByte == 1.000.000 Bytes */ 4341da177e4SLinus Torvalds u64 output_mb; /* where 1 MByte == 1.000.000 Bytes */ 4356d9d63b9SSwen Schillig u8 cp_util; 4366d9d63b9SSwen Schillig u8 cb_util; 4376d9d63b9SSwen Schillig u8 a_util; 438a10a61e8SBenjamin Block u8 res2; 439a3fd4bfeSBenjamin Block s16 temperature; 440a10a61e8SBenjamin Block u16 vcc; 441a10a61e8SBenjamin Block u16 tx_bias; 442a10a61e8SBenjamin Block u16 tx_power; 443a10a61e8SBenjamin Block u16 rx_power; 444a10a61e8SBenjamin Block union { 445a10a61e8SBenjamin Block u16 raw; 446a10a61e8SBenjamin Block struct { 447a10a61e8SBenjamin Block u16 fec_active :1; 448a10a61e8SBenjamin Block u16:7; 449a10a61e8SBenjamin Block u16 connector_type :2; 450a10a61e8SBenjamin Block u16 sfp_invalid :1; 451a10a61e8SBenjamin Block u16 optical_port :1; 452a10a61e8SBenjamin Block u16 port_tx_type :4; 453a10a61e8SBenjamin Block }; 454a10a61e8SBenjamin Block } sfp_flags; 455a17c7846SJens Remus u32 fc_security_algorithms; 456a17c7846SJens Remus u8 res3[236]; 4571da177e4SLinus Torvalds } __attribute__ ((packed)); 4581da177e4SLinus Torvalds 4591da177e4SLinus Torvalds union fsf_qtcb_bottom { 4601da177e4SLinus Torvalds struct fsf_qtcb_bottom_io io; 4611da177e4SLinus Torvalds struct fsf_qtcb_bottom_support support; 4621da177e4SLinus Torvalds struct fsf_qtcb_bottom_config config; 4631da177e4SLinus Torvalds struct fsf_qtcb_bottom_port port; 4641da177e4SLinus Torvalds }; 4651da177e4SLinus Torvalds 4661da177e4SLinus Torvalds struct fsf_qtcb { 4671da177e4SLinus Torvalds struct fsf_qtcb_prefix prefix; 4681da177e4SLinus Torvalds struct fsf_qtcb_header header; 4691da177e4SLinus Torvalds union fsf_qtcb_bottom bottom; 4701da177e4SLinus Torvalds u8 log[FSF_QTCB_LOG_SIZE]; 4711da177e4SLinus Torvalds } __attribute__ ((packed)); 4721da177e4SLinus Torvalds 4730997f1c5SStefan Raspl struct zfcp_blk_drv_data { 4740997f1c5SStefan Raspl #define ZFCP_BLK_DRV_DATA_MAGIC 0x1 4750997f1c5SStefan Raspl u32 magic; 4760997f1c5SStefan Raspl #define ZFCP_BLK_LAT_VALID 0x1 4770997f1c5SStefan Raspl #define ZFCP_BLK_REQ_ERROR 0x2 4780997f1c5SStefan Raspl u16 flags; 4790997f1c5SStefan Raspl u8 inb_usage; 4800997f1c5SStefan Raspl u8 outb_usage; 4810997f1c5SStefan Raspl u64 channel_lat; 4820997f1c5SStefan Raspl u64 fabric_lat; 4830997f1c5SStefan Raspl } __attribute__ ((packed)); 4840997f1c5SStefan Raspl 4857c7dc196SChristof Schmitt /** 4867c7dc196SChristof Schmitt * struct zfcp_fsf_ct_els - zfcp data for ct or els request 487623cd180SSteffen Maier * @req: scatter-gather list for request, points to &zfcp_fc_req.sg_req or BSG 488623cd180SSteffen Maier * @resp: scatter-gather list for response, points to &zfcp_fc_req.sg_rsp or BSG 4897c7dc196SChristof Schmitt * @handler: handler function (called for response to the request) 4907c7dc196SChristof Schmitt * @handler_data: data passed to handler function 4917c7dc196SChristof Schmitt * @port: Optional pointer to port for zfcp internal ELS (only test link ADISC) 4927c7dc196SChristof Schmitt * @status: used to pass error status to calling function 493771bf035SSteffen Maier * @d_id: Destination ID of either open WKA port for CT or of D_ID for ELS 4947c7dc196SChristof Schmitt */ 4957c7dc196SChristof Schmitt struct zfcp_fsf_ct_els { 4967c7dc196SChristof Schmitt struct scatterlist *req; 4977c7dc196SChristof Schmitt struct scatterlist *resp; 4987c7dc196SChristof Schmitt void (*handler)(void *); 4997c7dc196SChristof Schmitt void *handler_data; 5007c7dc196SChristof Schmitt struct zfcp_port *port; 5017c7dc196SChristof Schmitt int status; 502771bf035SSteffen Maier u32 d_id; 5037c7dc196SChristof Schmitt }; 5047c7dc196SChristof Schmitt 5051da177e4SLinus Torvalds #endif /* FSF_H */ 506