1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, v.1, (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://opensource.org/licenses/CDDL-1.0. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2014-2017 Cavium, Inc. 24 * The contents of this file are subject to the terms of the Common Development 25 * and Distribution License, v.1, (the "License"). 26 27 * You may not use this file except in compliance with the License. 28 29 * You can obtain a copy of the License at available 30 * at http://opensource.org/licenses/CDDL-1.0 31 32 * See the License for the specific language governing permissions and 33 * limitations under the License. 34 */ 35 36 #ifndef __QEDF_HSI__ 37 #define __QEDF_HSI__ 38 /********************************/ 39 /* Add include to common target */ 40 /********************************/ 41 #include "common_hsi.h" 42 43 /********************************************************/ 44 /* Add include to common storage target for upper driver*/ 45 /*******************************************************/ 46 #include "qeds_hsi.h" 47 48 /****************************************/ 49 /* Add include to common storage target */ 50 /****************************************/ 51 #include "storage_common.h" 52 53 /************************************************************************/ 54 /* Add include to common fcoe target for both eCore and protocol driver */ 55 /************************************************************************/ 56 #include "fcoe_common.h" 57 58 59 /* 60 * FCoE CQ element ABTS information 61 */ 62 struct fcoe_abts_info 63 { 64 u8 r_ctl /* R_CTL in the ABTS response frame */; 65 u8 reserved0; 66 __le16 rx_id; 67 __le32 reserved2[2]; 68 __le32 fc_payload[3] /* ABTS FC payload response frame */; 69 }; 70 71 72 /* 73 * FCoE class type 74 */ 75 enum fcoe_class_type 76 { 77 FCOE_TASK_CLASS_TYPE_3, 78 FCOE_TASK_CLASS_TYPE_2, 79 MAX_FCOE_CLASS_TYPE 80 }; 81 82 83 /* 84 * FCoE CMDQ element control information 85 */ 86 struct fcoe_cmdqe_control 87 { 88 __le16 conn_id; 89 u8 num_additional_cmdqes; 90 u8 cmdType; 91 #define FCOE_CMDQE_CONTROL_ABTSREQCMD_MASK 0x1 /* true for ABTS request cmdqe. used in Target mode */ 92 #define FCOE_CMDQE_CONTROL_ABTSREQCMD_SHIFT 0 93 #define FCOE_CMDQE_CONTROL_RESERVED1_MASK 0x7F 94 #define FCOE_CMDQE_CONTROL_RESERVED1_SHIFT 1 95 u8 reserved2[4]; 96 }; 97 98 /* 99 * FCoE control + payload CMDQ element 100 */ 101 struct fcoe_cmdqe 102 { 103 struct fcoe_cmdqe_control hdr; 104 u8 fc_header[24]; 105 __le32 fcp_cmd_payload[8]; 106 }; 107 108 109 110 /* 111 * FCP RSP flags 112 */ 113 struct fcoe_fcp_rsp_flags 114 { 115 u8 flags; 116 #define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID_MASK 0x1 117 #define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID_SHIFT 0 118 #define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID_MASK 0x1 119 #define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID_SHIFT 1 120 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER_MASK 0x1 121 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER_SHIFT 2 122 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER_MASK 0x1 123 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER_SHIFT 3 124 #define FCOE_FCP_RSP_FLAGS_FCP_CONF_REQ_MASK 0x1 125 #define FCOE_FCP_RSP_FLAGS_FCP_CONF_REQ_SHIFT 4 126 #define FCOE_FCP_RSP_FLAGS_FCP_BIDI_FLAGS_MASK 0x7 127 #define FCOE_FCP_RSP_FLAGS_FCP_BIDI_FLAGS_SHIFT 5 128 }; 129 130 /* 131 * FCoE CQ element response information 132 */ 133 struct fcoe_cqe_rsp_info 134 { 135 struct fcoe_fcp_rsp_flags rsp_flags; 136 u8 scsi_status_code; 137 __le16 retry_delay_timer; 138 __le32 fcp_resid; 139 __le32 fcp_sns_len; 140 __le32 fcp_rsp_len; 141 __le16 rx_id; 142 u8 fw_error_flags; 143 #define FCOE_CQE_RSP_INFO_FW_UNDERRUN_MASK 0x1 /* FW detected underrun */ 144 #define FCOE_CQE_RSP_INFO_FW_UNDERRUN_SHIFT 0 145 #define FCOE_CQE_RSP_INFO_RESREVED_MASK 0x7F 146 #define FCOE_CQE_RSP_INFO_RESREVED_SHIFT 1 147 u8 reserved; 148 __le32 fw_residual /* Residual bytes calculated by FW */; 149 }; 150 151 /* 152 * FCoE CQ element Target completion information 153 */ 154 struct fcoe_cqe_target_info 155 { 156 __le16 rx_id; 157 __le16 reserved0; 158 __le32 reserved1[5]; 159 }; 160 161 /* 162 * FCoE error/warning reporting entry 163 */ 164 struct fcoe_err_report_entry 165 { 166 __le32 err_warn_bitmap_lo /* Error bitmap lower 32 bits */; 167 __le32 err_warn_bitmap_hi /* Error bitmap higher 32 bits */; 168 __le32 tx_buf_off /* Buffer offset the beginning of the Sequence last transmitted */; 169 __le32 rx_buf_off /* Buffer offset from the beginning of the Sequence last received */; 170 __le16 rx_id /* RX_ID of the associated task */; 171 __le16 reserved1; 172 __le32 reserved2; 173 }; 174 175 /* 176 * FCoE CQ element middle path information 177 */ 178 struct fcoe_cqe_midpath_info 179 { 180 __le32 data_placement_size; 181 __le16 rx_id; 182 __le16 reserved0; 183 __le32 reserved1[4]; 184 }; 185 186 /* 187 * FCoE CQ element unsolicited information 188 */ 189 struct fcoe_unsolic_info 190 { 191 struct scsi_bd bd_info /* BD information: Physical address and opaque data */; 192 __le16 conn_id /* Connection ID the frame is associated to */; 193 __le16 pkt_len /* Packet length */; 194 u8 reserved1[4]; 195 }; 196 197 /* 198 * FCoE warning reporting entry 199 */ 200 struct fcoe_warning_report_entry 201 { 202 struct scsi_bd bd_info /* BD information: Physical address and opaque data */; 203 __le32 buf_off /* Buffer offset the beginning of the Sequence last transmitted */; 204 __le16 rx_id /* RX_ID of the associated task */; 205 __le16 reserved1; 206 }; 207 208 /* 209 * FCoE CQ element information 210 */ 211 union fcoe_cqe_info 212 { 213 struct fcoe_cqe_rsp_info rsp_info /* Response completion information */; 214 struct fcoe_cqe_target_info target_info /* Target completion information */; 215 struct fcoe_err_report_entry err_info /* Error completion information */; 216 struct fcoe_abts_info abts_info /* ABTS completion information */; 217 struct fcoe_cqe_midpath_info midpath_info /* Middle path completion information */; 218 struct fcoe_unsolic_info unsolic_info /* Unsolicited packet completion information */; 219 struct fcoe_warning_report_entry warn_info /* Warning completion information (Rec Tov expiration) */; 220 }; 221 222 /* 223 * FCoE CQ element 224 */ 225 struct fcoe_cqe 226 { 227 __le32 cqe_data; 228 #define FCOE_CQE_TASK_ID_MASK 0xFFFF /* The task identifier (OX_ID) to be completed */ 229 #define FCOE_CQE_TASK_ID_SHIFT 0 230 #define FCOE_CQE_CQE_TYPE_MASK 0xF /* The CQE type: 0x0 Indicating on a pending work request completion. 0x1 - Indicating on an unsolicited event notification. use enum fcoe_cqe_type (use enum fcoe_cqe_type) */ 231 #define FCOE_CQE_CQE_TYPE_SHIFT 16 232 #define FCOE_CQE_RESERVED0_MASK 0xFFF 233 #define FCOE_CQE_RESERVED0_SHIFT 20 234 __le16 reserved1; 235 __le16 fw_cq_prod; 236 union fcoe_cqe_info cqe_info; 237 }; 238 239 240 241 242 243 244 /* 245 * FCoE CQE type 246 */ 247 enum fcoe_cqe_type 248 { 249 FCOE_GOOD_COMPLETION_CQE_TYPE /* solicited response on a R/W or middle-path SQE */, 250 FCOE_UNSOLIC_CQE_TYPE /* unsolicited packet, RQ consumed */, 251 FCOE_ERROR_DETECTION_CQE_TYPE /* timer expiration, validation error */, 252 FCOE_WARNING_CQE_TYPE /* rec_tov or rr_tov timer expiration */, 253 FCOE_EXCH_CLEANUP_CQE_TYPE /* task cleanup completed */, 254 FCOE_ABTS_CQE_TYPE /* ABTS received and task cleaned */, 255 FCOE_DUMMY_CQE_TYPE /* just increment SQ CONS */, 256 FCOE_LOCAL_COMP_CQE_TYPE /* Task was completed wight after sending a pkt to the target */, 257 MAX_FCOE_CQE_TYPE 258 }; 259 260 261 /* 262 * FCoE device type 263 */ 264 enum fcoe_device_type 265 { 266 FCOE_TASK_DEV_TYPE_DISK, 267 FCOE_TASK_DEV_TYPE_TAPE, 268 MAX_FCOE_DEVICE_TYPE 269 }; 270 271 272 273 274 /* 275 * FCoE fast path error codes 276 */ 277 enum fcoe_fp_error_warning_code 278 { 279 FCOE_ERROR_CODE_XFER_OOO_RO /* XFER error codes */, 280 FCOE_ERROR_CODE_XFER_RO_NOT_ALIGNED, 281 FCOE_ERROR_CODE_XFER_NULL_BURST_LEN, 282 FCOE_ERROR_CODE_XFER_RO_GREATER_THAN_DATA2TRNS, 283 FCOE_ERROR_CODE_XFER_INVALID_PAYLOAD_SIZE, 284 FCOE_ERROR_CODE_XFER_TASK_TYPE_NOT_WRITE, 285 FCOE_ERROR_CODE_XFER_PEND_XFER_SET, 286 FCOE_ERROR_CODE_XFER_OPENED_SEQ, 287 FCOE_ERROR_CODE_XFER_FCTL, 288 FCOE_ERROR_CODE_FCP_RSP_BIDI_FLAGS_SET /* FCP RSP error codes */, 289 FCOE_ERROR_CODE_FCP_RSP_INVALID_LENGTH_FIELD, 290 FCOE_ERROR_CODE_FCP_RSP_INVALID_SNS_FIELD, 291 FCOE_ERROR_CODE_FCP_RSP_INVALID_PAYLOAD_SIZE, 292 FCOE_ERROR_CODE_FCP_RSP_PEND_XFER_SET, 293 FCOE_ERROR_CODE_FCP_RSP_OPENED_SEQ, 294 FCOE_ERROR_CODE_FCP_RSP_FCTL, 295 FCOE_ERROR_CODE_FCP_RSP_LAST_SEQ_RESET, 296 FCOE_ERROR_CODE_FCP_RSP_CONF_REQ_NOT_SUPPORTED_YET, 297 FCOE_ERROR_CODE_DATA_OOO_RO /* FCP DATA error codes */, 298 FCOE_ERROR_CODE_DATA_EXCEEDS_DEFINED_MAX_FRAME_SIZE, 299 FCOE_ERROR_CODE_DATA_EXCEEDS_DATA2TRNS, 300 FCOE_ERROR_CODE_DATA_SOFI3_SEQ_ACTIVE_SET, 301 FCOE_ERROR_CODE_DATA_SOFN_SEQ_ACTIVE_RESET, 302 FCOE_ERROR_CODE_DATA_EOFN_END_SEQ_SET, 303 FCOE_ERROR_CODE_DATA_EOFT_END_SEQ_RESET, 304 FCOE_ERROR_CODE_DATA_TASK_TYPE_NOT_READ, 305 FCOE_ERROR_CODE_DATA_FCTL_INITIATIR, 306 FCOE_ERROR_CODE_MIDPATH_INVALID_TYPE /* Middle path error codes */, 307 FCOE_ERROR_CODE_MIDPATH_SOFI3_SEQ_ACTIVE_SET, 308 FCOE_ERROR_CODE_MIDPATH_SOFN_SEQ_ACTIVE_RESET, 309 FCOE_ERROR_CODE_MIDPATH_EOFN_END_SEQ_SET, 310 FCOE_ERROR_CODE_MIDPATH_EOFT_END_SEQ_RESET, 311 FCOE_ERROR_CODE_MIDPATH_REPLY_FCTL, 312 FCOE_ERROR_CODE_MIDPATH_INVALID_REPLY, 313 FCOE_ERROR_CODE_MIDPATH_ELS_REPLY_RCTL, 314 FCOE_ERROR_CODE_COMMON_MIDDLE_FRAME_WITH_PAD /* Common error codes */, 315 FCOE_ERROR_CODE_COMMON_SEQ_INIT_IN_TCE, 316 FCOE_ERROR_CODE_COMMON_FC_HDR_RX_ID_MISMATCH, 317 FCOE_ERROR_CODE_COMMON_INCORRECT_SEQ_CNT, 318 FCOE_ERROR_CODE_COMMON_DATA_FC_HDR_FCP_TYPE_MISMATCH, 319 FCOE_ERROR_CODE_COMMON_DATA_NO_MORE_SGES, 320 FCOE_ERROR_CODE_COMMON_OPTIONAL_FC_HDR, 321 FCOE_ERROR_CODE_COMMON_READ_TCE_OX_ID_TOO_BIG, 322 FCOE_ERROR_CODE_COMMON_DATA_WAS_NOT_TRANSMITTED, 323 FCOE_ERROR_CODE_COMMON_TASK_DDF_RCTL_INFO_FIELD, 324 FCOE_ERROR_CODE_COMMON_TASK_INVALID_RCTL, 325 FCOE_ERROR_CODE_COMMON_TASK_RCTL_GENERAL_MISMATCH, 326 FCOE_ERROR_CODE_E_D_TOV_TIMER_EXPIRATION /* Timer error codes */, 327 FCOE_WARNING_CODE_REC_TOV_TIMER_EXPIRATION /* Timer error codes */, 328 FCOE_ERROR_CODE_RR_TOV_TIMER_EXPIRATION /* Timer error codes */, 329 FCOE_ERROR_CODE_ABTS_REPLY_UNEXPECTED /* ABTSrsp pckt arrived unexpected */, 330 FCOE_ERROR_CODE_TARGET_MODE_FCP_RSP, 331 FCOE_ERROR_CODE_TARGET_MODE_FCP_XFER, 332 FCOE_ERROR_CODE_TARGET_MODE_DATA_TASK_TYPE_NOT_WRITE, 333 FCOE_ERROR_CODE_DATA_FCTL_TARGET, 334 FCOE_ERROR_CODE_TARGET_DATA_SIZE_NO_MATCH_XFER, 335 FCOE_ERROR_CODE_TARGET_DIF_CRC_CHECKSUM_ERROR, 336 FCOE_ERROR_CODE_TARGET_DIF_REF_TAG_ERROR, 337 FCOE_ERROR_CODE_TARGET_DIF_APP_TAG_ERROR, 338 MAX_FCOE_FP_ERROR_WARNING_CODE 339 }; 340 341 342 /* 343 * FCoE RESPQ element 344 */ 345 struct fcoe_respqe 346 { 347 __le16 ox_id /* OX_ID that is located in the FCP_RSP FC header */; 348 __le16 rx_id /* RX_ID that is located in the FCP_RSP FC header */; 349 __le32 additional_info; 350 #define FCOE_RESPQE_PARAM_MASK 0xFFFFFF /* PARAM that is located in the FCP_RSP FC header */ 351 #define FCOE_RESPQE_PARAM_SHIFT 0 352 #define FCOE_RESPQE_TARGET_AUTO_RSP_MASK 0xFF /* Indication whther its Target-auto-rsp mode or not */ 353 #define FCOE_RESPQE_TARGET_AUTO_RSP_SHIFT 24 354 }; 355 356 357 /* 358 * FCoE slow path error codes 359 */ 360 enum fcoe_sp_error_code 361 { 362 FCOE_ERROR_CODE_SLOW_PATH_TOO_MANY_FUNCS /* Error codes for Error Reporting in slow path flows */, 363 FCOE_ERROR_SLOW_PATH_CODE_NO_LICENSE, 364 MAX_FCOE_SP_ERROR_CODE 365 }; 366 367 368 /* 369 * FCoE SQE request type 370 */ 371 enum fcoe_sqe_request_type 372 { 373 SEND_FCOE_CMD, 374 SEND_FCOE_MIDPATH, 375 SEND_FCOE_ABTS_REQUEST, 376 FCOE_EXCHANGE_CLEANUP, 377 FCOE_SEQUENCE_RECOVERY, 378 SEND_FCOE_XFER_RDY, 379 SEND_FCOE_RSP, 380 SEND_FCOE_RSP_WITH_SENSE_DATA, 381 SEND_FCOE_TARGET_DATA, 382 SEND_FCOE_INITIATOR_DATA, 383 SEND_FCOE_XFER_CONTINUATION_RDY /* Xfer Continuation (==1) ready to be sent. Previous XFERs data received successfully. */, 384 SEND_FCOE_TARGET_ABTS_RSP, 385 MAX_FCOE_SQE_REQUEST_TYPE 386 }; 387 388 389 /* 390 * FCoE task TX state 391 */ 392 enum fcoe_task_tx_state 393 { 394 FCOE_TASK_TX_STATE_NORMAL /* Initiate state after driver has initialized the task */, 395 FCOE_TASK_TX_STATE_UNSOLICITED_COMPLETED /* Updated by TX path after complete transmitting unsolicited packet */, 396 FCOE_TASK_TX_STATE_CLEAN_REQ /* Updated by TX path after start processing the task requesting the cleanup/abort operation */, 397 FCOE_TASK_TX_STATE_ABTS /* Updated by TX path during abort procedure */, 398 FCOE_TASK_TX_STATE_EXCLEANUP /* Updated by TX path during exchange cleanup procedure */, 399 FCOE_TASK_TX_STATE_EXCLEANUP_TARGET_WRITE_CONT /* Updated by TX path during exchange cleanup continuation task procedure */, 400 FCOE_TASK_TX_STATE_EXCLEANUP_TARGET_WRITE /* Updated by TX path during exchange cleanup first xfer procedure */, 401 FCOE_TASK_TX_STATE_EXCLEANUP_TARGET_READ_OR_RSP /* Updated by TX path during exchange cleanup read task in Target */, 402 FCOE_TASK_TX_STATE_EXCLEANUP_TARGET_WRITE_LAST_CYCLE /* Updated by TX path during target exchange cleanup procedure */, 403 FCOE_TASK_TX_STATE_SEQRECOVERY /* Updated by TX path during sequence recovery procedure */, 404 MAX_FCOE_TASK_TX_STATE 405 }; 406 407 408 /* 409 * FCoE task type 410 */ 411 enum fcoe_task_type 412 { 413 FCOE_TASK_TYPE_WRITE_INITIATOR, 414 FCOE_TASK_TYPE_READ_INITIATOR, 415 FCOE_TASK_TYPE_MIDPATH, 416 FCOE_TASK_TYPE_UNSOLICITED, 417 FCOE_TASK_TYPE_ABTS, 418 FCOE_TASK_TYPE_EXCHANGE_CLEANUP, 419 FCOE_TASK_TYPE_SEQUENCE_CLEANUP, 420 FCOE_TASK_TYPE_WRITE_TARGET, 421 FCOE_TASK_TYPE_READ_TARGET, 422 FCOE_TASK_TYPE_RSP, 423 FCOE_TASK_TYPE_RSP_SENSE_DATA, 424 FCOE_TASK_TYPE_ABTS_TARGET, 425 FCOE_TASK_TYPE_ENUM_SIZE, 426 MAX_FCOE_TASK_TYPE 427 }; 428 429 430 431 #endif /* __QEDF_HSI__ */ 432