xref: /freebsd/sys/dev/qlnx/qlnxe/iscsi_common.h (revision 44bb80b0)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __ISCSI_COMMON__
30 #define __ISCSI_COMMON__
31 /**********************/
32 /* ISCSI FW CONSTANTS */
33 /**********************/
34 
35 /* iSCSI HSI constants */
36 #define ISCSI_DEFAULT_MTU	(1500)
37 
38 /* KWQ (kernel work queue) layer codes */
39 #define ISCSI_SLOW_PATH_LAYER_CODE   (6)
40 
41 /* iSCSI parameter defaults */
42 #define ISCSI_DEFAULT_HEADER_DIGEST         (0)
43 #define ISCSI_DEFAULT_DATA_DIGEST           (0)
44 #define ISCSI_DEFAULT_INITIAL_R2T           (1)
45 #define ISCSI_DEFAULT_IMMEDIATE_DATA        (1)
46 #define ISCSI_DEFAULT_MAX_PDU_LENGTH        (0x2000)
47 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH    (0x10000)
48 #define ISCSI_DEFAULT_MAX_BURST_LENGTH      (0x40000)
49 #define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T   (1)
50 
51 /* iSCSI parameter limits */
52 #define ISCSI_MIN_VAL_MAX_PDU_LENGTH        (0x200)
53 #define ISCSI_MAX_VAL_MAX_PDU_LENGTH        (0xffffff)
54 #define ISCSI_MIN_VAL_BURST_LENGTH          (0x200)
55 #define ISCSI_MAX_VAL_BURST_LENGTH          (0xffffff)
56 #define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T   (1)
57 #define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T   (0xff) // 0x10000 according to RFC
58 
59 #define ISCSI_AHS_CNTL_SIZE 4
60 
61 #define ISCSI_WQE_NUM_SGES_SLOWIO           (0xf)
62 
63 /* iSCSI reserved params */
64 #define ISCSI_ITT_ALL_ONES					(0xffffffff)
65 #define ISCSI_TTT_ALL_ONES					(0xffffffff)
66 
67 #define ISCSI_OPTION_1_OFF_CHIP_TCP 1
68 #define ISCSI_OPTION_2_ON_CHIP_TCP 2
69 
70 #define ISCSI_INITIATOR_MODE 0
71 #define ISCSI_TARGET_MODE 1
72 
73 /* iSCSI request op codes */
74 #define ISCSI_OPCODE_NOP_OUT				(0)
75 #define ISCSI_OPCODE_SCSI_CMD       		(1)
76 #define ISCSI_OPCODE_TMF_REQUEST			(2)
77 #define ISCSI_OPCODE_LOGIN_REQUEST			(3)
78 #define ISCSI_OPCODE_TEXT_REQUEST       	(4)
79 #define ISCSI_OPCODE_DATA_OUT				(5)
80 #define ISCSI_OPCODE_LOGOUT_REQUEST     	(6)
81 
82 /* iSCSI response/messages op codes */
83 #define ISCSI_OPCODE_NOP_IN             (0x20)
84 #define ISCSI_OPCODE_SCSI_RESPONSE      (0x21)
85 #define ISCSI_OPCODE_TMF_RESPONSE       (0x22)
86 #define ISCSI_OPCODE_LOGIN_RESPONSE     (0x23)
87 #define ISCSI_OPCODE_TEXT_RESPONSE      (0x24)
88 #define ISCSI_OPCODE_DATA_IN            (0x25)
89 #define ISCSI_OPCODE_LOGOUT_RESPONSE    (0x26)
90 #define ISCSI_OPCODE_R2T                (0x31)
91 #define ISCSI_OPCODE_ASYNC_MSG          (0x32)
92 #define ISCSI_OPCODE_REJECT             (0x3f)
93 
94 /* iSCSI stages */
95 #define ISCSI_STAGE_SECURITY_NEGOTIATION            (0)
96 #define ISCSI_STAGE_LOGIN_OPERATIONAL_NEGOTIATION   (1)
97 #define ISCSI_STAGE_FULL_FEATURE_PHASE              (3)
98 
99 /* iSCSI CQE errors */
100 #define CQE_ERROR_BITMAP_DATA_DIGEST          (0x08)
101 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN  (0x10)
102 #define CQE_ERROR_BITMAP_DATA_TRUNCATED       (0x20)
103 
104 /*
105  * Union of data bd_opaque/ tq_tid
106  */
107 union bd_opaque_tq_union
108 {
109 	__le16 bd_opaque /* BDs opaque data */;
110 	__le16 tq_tid /* Immediate Data with DIF TQe TID */;
111 };
112 
113 /*
114  * ISCSI SGL entry
115  */
116 struct cqe_error_bitmap
117 {
118 	u8 cqe_error_status_bits;
119 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_MASK         0x7 /* Mark task with DIF error (3 bit): [0]-CRC/checksum, [1]-app tag, [2]-reference tag */
120 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_SHIFT        0
121 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_MASK      0x1 /* Mark task with data digest error (1 bit) */
122 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_SHIFT     3
123 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_MASK  0x1 /* Mark receive on invalid connection */
124 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_SHIFT 4
125 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_MASK   0x1 /* Target Mode - Mark middle task error, data truncated */
126 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_SHIFT  5
127 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_MASK        0x1
128 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_SHIFT       6
129 #define CQE_ERROR_BITMAP_RESERVED2_MASK            0x1
130 #define CQE_ERROR_BITMAP_RESERVED2_SHIFT           7
131 };
132 
133 union cqe_error_status
134 {
135 	u8 error_status /* all error bits as uint8 */;
136 	struct cqe_error_bitmap error_bits /* cqe errors bitmap */;
137 };
138 
139 /*
140  * iSCSI Login Response PDU header
141  */
142 struct data_hdr
143 {
144 	__le32 data[12] /* iscsi header data */;
145 };
146 
147 struct lun_mapper_addr_reserved
148 {
149 	struct regpair lun_mapper_addr /* Lun mapper address */;
150 	u8 reserved0[8];
151 };
152 
153 /*
154  * rdif conetxt for dif on immediate
155  */
156 struct dif_on_immediate_params
157 {
158 	__le32 initial_ref_tag;
159 	__le16 application_tag;
160 	__le16 application_tag_mask;
161 	__le16 flags1;
162 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_MASK             0x1
163 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_SHIFT            0
164 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_MASK           0x1
165 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_SHIFT          1
166 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_MASK           0x1
167 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_SHIFT          2
168 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_MASK              0x1
169 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_SHIFT             3
170 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_MASK            0x1
171 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_SHIFT           4
172 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_MASK            0x1
173 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_SHIFT           5
174 #define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_MASK              0x1 /* 0=512B, 1=4KB */
175 #define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_SHIFT             6
176 #define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTERFACE_MASK          0x1 /* 0=None, 1=DIF */
177 #define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTERFACE_SHIFT         7
178 #define DIF_ON_IMMEDIATE_PARAMS_HOST_INTERFACE_MASK             0x3 /* 0=None, 1=DIF, 2=DIX */
179 #define DIF_ON_IMMEDIATE_PARAMS_HOST_INTERFACE_SHIFT            8
180 #define DIF_ON_IMMEDIATE_PARAMS_REF_TAG_MASK_MASK               0xF /* mask for refernce tag handling */
181 #define DIF_ON_IMMEDIATE_PARAMS_REF_TAG_MASK_SHIFT              10
182 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_WITH_MASK_MASK  0x1 /* Forward application tag with mask */
183 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_WITH_MASK_SHIFT 14
184 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_WITH_MASK_MASK  0x1 /* Forward reference tag with mask */
185 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_WITH_MASK_SHIFT 15
186 	u8 flags0;
187 #define DIF_ON_IMMEDIATE_PARAMS_RESERVED_MASK                   0x1
188 #define DIF_ON_IMMEDIATE_PARAMS_RESERVED_SHIFT                  0
189 #define DIF_ON_IMMEDIATE_PARAMS_IGNORE_APP_TAG_MASK             0x1
190 #define DIF_ON_IMMEDIATE_PARAMS_IGNORE_APP_TAG_SHIFT            1
191 #define DIF_ON_IMMEDIATE_PARAMS_INITIAL_REF_TAG_IS_VALID_MASK   0x1
192 #define DIF_ON_IMMEDIATE_PARAMS_INITIAL_REF_TAG_IS_VALID_SHIFT  2
193 #define DIF_ON_IMMEDIATE_PARAMS_HOST_GUARD_TYPE_MASK            0x1 /* 0 = IP checksum, 1 = CRC */
194 #define DIF_ON_IMMEDIATE_PARAMS_HOST_GUARD_TYPE_SHIFT           3
195 #define DIF_ON_IMMEDIATE_PARAMS_PROTECTION_TYPE_MASK            0x3 /* 1/2/3 - Protection Type */
196 #define DIF_ON_IMMEDIATE_PARAMS_PROTECTION_TYPE_SHIFT           4
197 #define DIF_ON_IMMEDIATE_PARAMS_CRC_SEED_MASK                   0x1 /* 0=0x0000, 1=0xffff */
198 #define DIF_ON_IMMEDIATE_PARAMS_CRC_SEED_SHIFT                  6
199 #define DIF_ON_IMMEDIATE_PARAMS_KEEP_REF_TAG_CONST_MASK         0x1 /* Keep reference tag constant */
200 #define DIF_ON_IMMEDIATE_PARAMS_KEEP_REF_TAG_CONST_SHIFT        7
201 	u8 reserved_zero[5];
202 };
203 
204 /*
205  * iSCSI dif on immediate mode attributes union
206  */
207 union dif_configuration_params
208 {
209 	struct lun_mapper_addr_reserved lun_mapper_address /* lun mapper address */;
210 	struct dif_on_immediate_params def_dif_conf /* default dif on immediate rdif configuration */;
211 };
212 
213 /*
214  * Union of data/r2t sequence number
215  */
216 union iscsi_seq_num
217 {
218 	__le16 data_sn /* data-in sequence number */;
219 	__le16 r2t_sn /* r2t pdu sequence number */;
220 };
221 
222 /*
223  * iSCSI DIF flags
224  */
225 struct iscsi_dif_flags
226 {
227 	u8 flags;
228 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_MASK  0xF /* Protection log interval (9=512 10=1024  11=2048 12=4096 13=8192) */
229 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_SHIFT 0
230 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_MASK             0x1 /* If DIF protection is configured against target (0=no, 1=yes) */
231 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_SHIFT            4
232 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_MASK          0x7 /* If DIF/DIX protection is configured against the host (0=none, 1=DIF, 2=DIX 2 bytes, 3=DIX 4 bytes, 4=DIX 8 bytes) */
233 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_SHIFT         5
234 };
235 
236 /*
237  * The iscsi storm task context of Ystorm
238  */
239 struct ystorm_iscsi_task_state
240 {
241 	struct scsi_cached_sges data_desc;
242 	struct scsi_sgl_params sgl_params;
243 	__le32 exp_r2t_sn /* Initiator mode - Expected R2T PDU index in sequence. [variable, initialized 0] */;
244 	__le32 buffer_offset /* Payload data offset */;
245 	union iscsi_seq_num seq_num /* PDU index in sequence */;
246 	struct iscsi_dif_flags dif_flags /* Dif flags */;
247 	u8 flags;
248 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_MASK      0x1 /* local_completion  */
249 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_SHIFT     0
250 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_MASK         0x1 /* Equals 1 if SGL is predicted and 0 otherwise. */
251 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_SHIFT        1
252 #define YSTORM_ISCSI_TASK_STATE_SET_DIF_OFFSET_MASK  0x1 /* Indication for Ystorm that TDIFs offsetInIo is not synced with buffer_offset */
253 #define YSTORM_ISCSI_TASK_STATE_SET_DIF_OFFSET_SHIFT 2
254 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_MASK       0x1F
255 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_SHIFT      3
256 };
257 
258 /*
259  * The iscsi storm task context of Ystorm
260  */
261 struct ystorm_iscsi_task_rxmit_opt
262 {
263 	__le32 fast_rxmit_sge_offset /* SGE offset from which to continue dummy-read or start fast retransmit */;
264 	__le32 scan_start_buffer_offset /* Starting buffer offset of next retransmit SGL scan */;
265 	__le32 fast_rxmit_buffer_offset /* Buffer offset from which to continue dummy-read or start fast retransmit */;
266 	u8 scan_start_sgl_index /* Starting SGL index of next retransmit SGL scan */;
267 	u8 fast_rxmit_sgl_index /* SGL index from which to continue dummy-read or start fast retransmit */;
268 	__le16 reserved /* reserved */;
269 };
270 
271 /*
272  * iSCSI Common PDU header
273  */
274 struct iscsi_common_hdr
275 {
276 	u8 hdr_status /* Status field of ISCSI header */;
277 	u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */;
278 	u8 hdr_flags /* Flags field of ISCSI header */;
279 	u8 hdr_first_byte;
280 #define ISCSI_COMMON_HDR_OPCODE_MASK         0x3F /* Opcode */
281 #define ISCSI_COMMON_HDR_OPCODE_SHIFT        0
282 #define ISCSI_COMMON_HDR_IMM_MASK            0x1 /* Immediate */
283 #define ISCSI_COMMON_HDR_IMM_SHIFT           6
284 #define ISCSI_COMMON_HDR_RSRV_MASK           0x1 /* first bit of iSCSI PDU header */
285 #define ISCSI_COMMON_HDR_RSRV_SHIFT          7
286 	__le32 hdr_second_dword;
287 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
288 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT  0
289 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
290 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24
291 	struct regpair lun_reserved /* Bytes 8..15 : LUN (if PDU contains a LUN field) or reserved */;
292 	__le32 itt /* ITT - common to all headers */;
293 	__le32 ttt /* bytes 20 to 23 - common ttt to various PDU headers */;
294 	__le32 cmdstat_sn /* bytes 24 to 27 - common cmd_sn (initiator) or stat_sn (target) to various PDU headers */;
295 	__le32 exp_statcmd_sn /* bytes 28 to 31 - common expected stat_sn (initiator) or cmd_sn (target) to various PDU headers */;
296 	__le32 max_cmd_sn /* bytes 32 to 35 - common max cmd_sn to various PDU headers */;
297 	__le32 data[3] /* bytes 36 to 47 */;
298 };
299 
300 /*
301  * iSCSI Command PDU header
302  */
303 struct iscsi_cmd_hdr
304 {
305 	__le16 reserved1 /* reserved */;
306 	u8 flags_attr;
307 #define ISCSI_CMD_HDR_ATTR_MASK           0x7 /* attributes */
308 #define ISCSI_CMD_HDR_ATTR_SHIFT          0
309 #define ISCSI_CMD_HDR_RSRV_MASK           0x3 /* reserved */
310 #define ISCSI_CMD_HDR_RSRV_SHIFT          3
311 #define ISCSI_CMD_HDR_WRITE_MASK          0x1 /* write */
312 #define ISCSI_CMD_HDR_WRITE_SHIFT         5
313 #define ISCSI_CMD_HDR_READ_MASK           0x1 /* read */
314 #define ISCSI_CMD_HDR_READ_SHIFT          6
315 #define ISCSI_CMD_HDR_FINAL_MASK          0x1 /* final */
316 #define ISCSI_CMD_HDR_FINAL_SHIFT         7
317 	u8 hdr_first_byte;
318 #define ISCSI_CMD_HDR_OPCODE_MASK         0x3F /* Opcode */
319 #define ISCSI_CMD_HDR_OPCODE_SHIFT        0
320 #define ISCSI_CMD_HDR_IMM_MASK            0x1 /* Immediate delivery */
321 #define ISCSI_CMD_HDR_IMM_SHIFT           6
322 #define ISCSI_CMD_HDR_RSRV1_MASK          0x1 /* first bit of iSCSI PDU header */
323 #define ISCSI_CMD_HDR_RSRV1_SHIFT         7
324 	__le32 hdr_second_dword;
325 #define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
326 #define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT  0
327 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
328 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_SHIFT 24
329 	struct regpair lun /* Logical Unit Number. [constant, initialized] */;
330 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
331 	__le32 expected_transfer_length /* Expected Data Transfer Length (only 3 bytes are significant) */;
332 	__le32 cmd_sn /* CmdSn. [constant, initialized] */;
333 	__le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */;
334 	__le32 cdb[4] /* CDB. [constant, initialized] */;
335 };
336 
337 /*
338  * iSCSI Command PDU header with Extended CDB (Initiator Mode)
339  */
340 struct iscsi_ext_cdb_cmd_hdr
341 {
342 	__le16 reserved1 /* reserved */;
343 	u8 flags_attr;
344 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_MASK          0x7 /* attributes */
345 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_SHIFT         0
346 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_MASK          0x3 /* reserved */
347 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_SHIFT         3
348 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_MASK         0x1 /* write */
349 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_SHIFT        5
350 #define ISCSI_EXT_CDB_CMD_HDR_READ_MASK          0x1 /* read */
351 #define ISCSI_EXT_CDB_CMD_HDR_READ_SHIFT         6
352 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_MASK         0x1 /* final */
353 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_SHIFT        7
354 	u8 opcode /* opcode. [constant, initialized] */;
355 	__le32 hdr_second_dword;
356 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_MASK  0xFFFFFF /* DataSegmentLength */
357 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_SHIFT 0
358 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_MASK      0xFF /* The Extended CDB size in bytes. Maximum Extended CDB size supported is CDB 64B. */
359 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_SHIFT     24
360 	struct regpair lun /* Logical Unit Number. [constant, initialized] */;
361 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
362 	__le32 expected_transfer_length /* Expected Data Transfer Length (only 3 bytes are significant) */;
363 	__le32 cmd_sn /* CmdSn. [constant, initialized] */;
364 	__le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */;
365 	struct scsi_sge cdb_sge /* Extended CDBs dedicated SGE */;
366 };
367 
368 /*
369  * iSCSI login request PDU header
370  */
371 struct iscsi_login_req_hdr
372 {
373 	u8 version_min /* Version-min */;
374 	u8 version_max /* Version-max */;
375 	u8 flags_attr;
376 #define ISCSI_LOGIN_REQ_HDR_NSG_MASK            0x3 /* Next Stage (NSG) */
377 #define ISCSI_LOGIN_REQ_HDR_NSG_SHIFT           0
378 #define ISCSI_LOGIN_REQ_HDR_CSG_MASK            0x3 /* Current stage (CSG) */
379 #define ISCSI_LOGIN_REQ_HDR_CSG_SHIFT           2
380 #define ISCSI_LOGIN_REQ_HDR_RSRV_MASK           0x3 /* reserved */
381 #define ISCSI_LOGIN_REQ_HDR_RSRV_SHIFT          4
382 #define ISCSI_LOGIN_REQ_HDR_C_MASK              0x1 /* C (Continue) bit */
383 #define ISCSI_LOGIN_REQ_HDR_C_SHIFT             6
384 #define ISCSI_LOGIN_REQ_HDR_T_MASK              0x1 /* T (Transit) bit */
385 #define ISCSI_LOGIN_REQ_HDR_T_SHIFT             7
386 	u8 opcode /* opcode. [constant, initialized] */;
387 	__le32 hdr_second_dword;
388 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
389 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_SHIFT  0
390 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
391 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_SHIFT 24
392 	__le32 isid_tabc /* Session identifier high double word [constant, initialized] */;
393 	__le16 tsih /* TSIH */;
394 	__le16 isid_d /* Session identifier low word [constant, initialized] */;
395 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
396 	__le16 reserved1;
397 	__le16 cid /* Unique Connection ID within the session [constant, initialized] */;
398 	__le32 cmd_sn /* CmdSn. [constant, initialized] */;
399 	__le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */;
400 	__le32 reserved2[4];
401 };
402 
403 /*
404  * iSCSI logout request PDU header
405  */
406 struct iscsi_logout_req_hdr
407 {
408 	__le16 reserved0 /* reserved */;
409 	u8 reason_code /* Reason Code */;
410 	u8 opcode /* opcode. [constant, initialized] */;
411 	__le32 reserved1;
412 	__le32 reserved2[2] /* Reserved */;
413 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
414 	__le16 reserved3 /* Reserved */;
415 	__le16 cid /* Unique Connection ID within the session [constant, initialized] */;
416 	__le32 cmd_sn /* CmdSn. [constant, initialized] */;
417 	__le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */;
418 	__le32 reserved4[4] /* Reserved */;
419 };
420 
421 /*
422  * iSCSI Data-out PDU header
423  */
424 struct iscsi_data_out_hdr
425 {
426 	__le16 reserved1 /* reserved */;
427 	u8 flags_attr;
428 #define ISCSI_DATA_OUT_HDR_RSRV_MASK   0x7F /* reserved */
429 #define ISCSI_DATA_OUT_HDR_RSRV_SHIFT  0
430 #define ISCSI_DATA_OUT_HDR_FINAL_MASK  0x1 /* final */
431 #define ISCSI_DATA_OUT_HDR_FINAL_SHIFT 7
432 	u8 opcode /* opcode */;
433 	__le32 reserved2 /* reserved */;
434 	struct regpair lun /* Logical Unit Number */;
435 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant) */;
436 	__le32 ttt /* Target Transfer Tag (from R2T) */;
437 	__le32 reserved3 /* resrved */;
438 	__le32 exp_stat_sn /* Expected StatSn */;
439 	__le32 reserved4 /* resrved */;
440 	__le32 data_sn /* DataSN - PDU index in sequnece */;
441 	__le32 buffer_offset /* Buffer Offset - offset in task */;
442 	__le32 reserved5 /* resrved */;
443 };
444 
445 /*
446  * iSCSI Data-in PDU header
447  */
448 struct iscsi_data_in_hdr
449 {
450 	u8 status_rsvd /* Status or reserved */;
451 	u8 reserved1 /* reserved */;
452 	u8 flags;
453 #define ISCSI_DATA_IN_HDR_STATUS_MASK     0x1 /* Status */
454 #define ISCSI_DATA_IN_HDR_STATUS_SHIFT    0
455 #define ISCSI_DATA_IN_HDR_UNDERFLOW_MASK  0x1 /* Residual Underflow */
456 #define ISCSI_DATA_IN_HDR_UNDERFLOW_SHIFT 1
457 #define ISCSI_DATA_IN_HDR_OVERFLOW_MASK   0x1 /* Residual Overflow */
458 #define ISCSI_DATA_IN_HDR_OVERFLOW_SHIFT  2
459 #define ISCSI_DATA_IN_HDR_RSRV_MASK       0x7 /* reserved - 0 */
460 #define ISCSI_DATA_IN_HDR_RSRV_SHIFT      3
461 #define ISCSI_DATA_IN_HDR_ACK_MASK        0x1 /* Acknowledge */
462 #define ISCSI_DATA_IN_HDR_ACK_SHIFT       6
463 #define ISCSI_DATA_IN_HDR_FINAL_MASK      0x1 /* final */
464 #define ISCSI_DATA_IN_HDR_FINAL_SHIFT     7
465 	u8 opcode /* opcode */;
466 	__le32 reserved2 /* reserved */;
467 	struct regpair lun /* Logical Unit Number */;
468 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant) */;
469 	__le32 ttt /* Target Transfer Tag (from R2T) */;
470 	__le32 stat_sn /* StatSN or reserved */;
471 	__le32 exp_cmd_sn /* Expected CmdSn */;
472 	__le32 max_cmd_sn /* MaxCmdSn */;
473 	__le32 data_sn /* DataSN - PDU index in sequnece */;
474 	__le32 buffer_offset /* Buffer Offset - offset in task */;
475 	__le32 residual_count /* Residual Count */;
476 };
477 
478 /*
479  * iSCSI R2T PDU header
480  */
481 struct iscsi_r2t_hdr
482 {
483 	u8 reserved0[3] /* reserved */;
484 	u8 opcode /* opcode */;
485 	__le32 reserved2 /* reserved */;
486 	struct regpair lun /* Logical Unit Number */;
487 	__le32 itt /* Initiator Task Tag */;
488 	__le32 ttt /* Target Transfer Tag */;
489 	__le32 stat_sn /* stat sn */;
490 	__le32 exp_cmd_sn /* Expected CmdSn */;
491 	__le32 max_cmd_sn /* Max CmdSn */;
492 	__le32 r2t_sn /* DataSN - PDU index in sequnece */;
493 	__le32 buffer_offset /* Buffer Offset - offset in task */;
494 	__le32 desired_data_trns_len /* Desired data trnsfer len */;
495 };
496 
497 /*
498  * iSCSI NOP-out PDU header
499  */
500 struct iscsi_nop_out_hdr
501 {
502 	__le16 reserved1 /* reserved */;
503 	u8 flags_attr;
504 #define ISCSI_NOP_OUT_HDR_RSRV_MASK    0x7F /* reserved */
505 #define ISCSI_NOP_OUT_HDR_RSRV_SHIFT   0
506 #define ISCSI_NOP_OUT_HDR_CONST1_MASK  0x1 /* const1 */
507 #define ISCSI_NOP_OUT_HDR_CONST1_SHIFT 7
508 	u8 opcode /* opcode */;
509 	__le32 reserved2 /* reserved */;
510 	struct regpair lun /* Logical Unit Number */;
511 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant) */;
512 	__le32 ttt /* Target Transfer Tag (from R2T) */;
513 	__le32 cmd_sn /* CmdSN */;
514 	__le32 exp_stat_sn /* Expected StatSn */;
515 	__le32 reserved3 /* reserved */;
516 	__le32 reserved4 /* reserved */;
517 	__le32 reserved5 /* reserved */;
518 	__le32 reserved6 /* reserved */;
519 };
520 
521 /*
522  * iSCSI NOP-in PDU header
523  */
524 struct iscsi_nop_in_hdr
525 {
526 	__le16 reserved0 /* reserved */;
527 	u8 flags_attr;
528 #define ISCSI_NOP_IN_HDR_RSRV_MASK           0x7F /* reserved */
529 #define ISCSI_NOP_IN_HDR_RSRV_SHIFT          0
530 #define ISCSI_NOP_IN_HDR_CONST1_MASK         0x1 /* const1 */
531 #define ISCSI_NOP_IN_HDR_CONST1_SHIFT        7
532 	u8 opcode /* opcode */;
533 	__le32 hdr_second_dword;
534 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
535 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_SHIFT  0
536 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
537 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_SHIFT 24
538 	struct regpair lun /* Logical Unit Number */;
539 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant) */;
540 	__le32 ttt /* Target Transfer Tag */;
541 	__le32 stat_sn /* stat_sn */;
542 	__le32 exp_cmd_sn /* exp_cmd_sn */;
543 	__le32 max_cmd_sn /* max_cmd_sn */;
544 	__le32 reserved5 /* reserved */;
545 	__le32 reserved6 /* reserved */;
546 	__le32 reserved7 /* reserved */;
547 };
548 
549 /*
550  * iSCSI Login Response PDU header
551  */
552 struct iscsi_login_response_hdr
553 {
554 	u8 version_active /* Version-active */;
555 	u8 version_max /* Version-max */;
556 	u8 flags_attr;
557 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_MASK            0x3 /* Next Stage (NSG) */
558 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_SHIFT           0
559 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_MASK            0x3 /* Current stage (CSG) */
560 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_SHIFT           2
561 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_MASK           0x3 /* reserved */
562 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_SHIFT          4
563 #define ISCSI_LOGIN_RESPONSE_HDR_C_MASK              0x1 /* C (Continue) bit */
564 #define ISCSI_LOGIN_RESPONSE_HDR_C_SHIFT             6
565 #define ISCSI_LOGIN_RESPONSE_HDR_T_MASK              0x1 /* T (Transit) bit */
566 #define ISCSI_LOGIN_RESPONSE_HDR_T_SHIFT             7
567 	u8 opcode /* opcode. [constant, initialized] */;
568 	__le32 hdr_second_dword;
569 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
570 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_SHIFT  0
571 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
572 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
573 	__le32 isid_tabc /* Session identifier high double word [constant, initialized] */;
574 	__le16 tsih /* TSIH */;
575 	__le16 isid_d /* Session identifier low word [constant, initialized] */;
576 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
577 	__le32 reserved1;
578 	__le32 stat_sn /* CmdSn. [constant, initialized] */;
579 	__le32 exp_cmd_sn /* various fields for middle-path PDU. [constant, initialized] */;
580 	__le32 max_cmd_sn /* max_cmd_sn */;
581 	__le16 reserved2;
582 	u8 status_detail /* status_detail */;
583 	u8 status_class /* status_class */;
584 	__le32 reserved4[2];
585 };
586 
587 /*
588  * iSCSI Logout Response PDU header
589  */
590 struct iscsi_logout_response_hdr
591 {
592 	u8 reserved1 /* reserved */;
593 	u8 response /* response */;
594 	u8 flags /* flags and attributes */;
595 	u8 opcode /* opcode. [constant, initialized] */;
596 	__le32 hdr_second_dword;
597 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
598 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT  0
599 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
600 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
601 	__le32 reserved2[2] /* Reserved */;
602 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
603 	__le32 reserved3 /* Reserved */;
604 	__le32 stat_sn /* CmdSN */;
605 	__le32 exp_cmd_sn /* Expected StatSn */;
606 	__le32 max_cmd_sn /* CmdSN */;
607 	__le32 reserved4 /* Reserved */;
608 	__le16 time_2_retain /* Time to Retain  */;
609 	__le16 time_2_wait /* Time to wait */;
610 	__le32 reserved5[1] /* Reserved */;
611 };
612 
613 /*
614  * iSCSI Text Request PDU header
615  */
616 struct iscsi_text_request_hdr
617 {
618 	__le16 reserved0 /* reserved */;
619 	u8 flags_attr;
620 #define ISCSI_TEXT_REQUEST_HDR_RSRV_MASK           0x3F /* reserved */
621 #define ISCSI_TEXT_REQUEST_HDR_RSRV_SHIFT          0
622 #define ISCSI_TEXT_REQUEST_HDR_C_MASK              0x1 /* C (Continue) bit */
623 #define ISCSI_TEXT_REQUEST_HDR_C_SHIFT             6
624 #define ISCSI_TEXT_REQUEST_HDR_F_MASK              0x1 /* F (Final) bit */
625 #define ISCSI_TEXT_REQUEST_HDR_F_SHIFT             7
626 	u8 opcode /* opcode. [constant, initialized] */;
627 	__le32 hdr_second_dword;
628 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
629 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_SHIFT  0
630 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
631 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24
632 	struct regpair lun /* Logical Unit Number */;
633 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
634 	__le32 ttt /* Referenced Task Tag or 0xffffffff */;
635 	__le32 cmd_sn /* cmd_sn */;
636 	__le32 exp_stat_sn /* exp_stat_sn */;
637 	__le32 reserved4[4] /* Reserved */;
638 };
639 
640 /*
641  * iSCSI Text Response PDU header
642  */
643 struct iscsi_text_response_hdr
644 {
645 	__le16 reserved1 /* reserved */;
646 	u8 flags;
647 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_MASK           0x3F /* reserved */
648 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_SHIFT          0
649 #define ISCSI_TEXT_RESPONSE_HDR_C_MASK              0x1 /* C (Continue) bit */
650 #define ISCSI_TEXT_RESPONSE_HDR_C_SHIFT             6
651 #define ISCSI_TEXT_RESPONSE_HDR_F_MASK              0x1 /* F (Final) bit */
652 #define ISCSI_TEXT_RESPONSE_HDR_F_SHIFT             7
653 	u8 opcode /* opcode. [constant, initialized] */;
654 	__le32 hdr_second_dword;
655 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
656 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT  0
657 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
658 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
659 	struct regpair lun /* Logical Unit Number */;
660 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
661 	__le32 ttt /* Target Task Tag */;
662 	__le32 stat_sn /* CmdSN */;
663 	__le32 exp_cmd_sn /* Expected StatSn */;
664 	__le32 max_cmd_sn /* CmdSN */;
665 	__le32 reserved4[3] /* Reserved */;
666 };
667 
668 /*
669  * iSCSI TMF Request PDU header
670  */
671 struct iscsi_tmf_request_hdr
672 {
673 	__le16 reserved0 /* reserved */;
674 	u8 function /* function */;
675 	u8 opcode /* opcode. [constant, initialized] */;
676 	__le32 hdr_second_dword;
677 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
678 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_SHIFT  0
679 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
680 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24
681 	struct regpair lun /* Logical Unit Number */;
682 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
683 	__le32 rtt /* Referenced Task Tag or 0xffffffff */;
684 	__le32 cmd_sn /* cmd_sn */;
685 	__le32 exp_stat_sn /* exp_stat_sn */;
686 	__le32 ref_cmd_sn /* ref_cmd_sn */;
687 	__le32 exp_data_sn /* exp_data_sn */;
688 	__le32 reserved4[2] /* Reserved */;
689 };
690 
691 struct iscsi_tmf_response_hdr
692 {
693 	u8 reserved2 /* reserved2 */;
694 	u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */;
695 	u8 hdr_flags /* Flags field of ISCSI header */;
696 	u8 opcode /* opcode. [constant, initialized] */;
697 	__le32 hdr_second_dword;
698 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
699 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_SHIFT  0
700 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
701 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
702 	struct regpair reserved0;
703 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
704 	__le32 reserved1 /* Reserved */;
705 	__le32 stat_sn /* stat_sn */;
706 	__le32 exp_cmd_sn /* exp_cmd_sn */;
707 	__le32 max_cmd_sn /* max_cmd_sn */;
708 	__le32 reserved4[3] /* Reserved */;
709 };
710 
711 /*
712  * iSCSI Response PDU header
713  */
714 struct iscsi_response_hdr
715 {
716 	u8 hdr_status /* Status field of ISCSI header */;
717 	u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */;
718 	u8 hdr_flags /* Flags field of ISCSI header */;
719 	u8 opcode /* opcode. [constant, initialized] */;
720 	__le32 hdr_second_dword;
721 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
722 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_SHIFT  0
723 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
724 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
725 	struct regpair lun /* Logical Unit Number */;
726 	__le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */;
727 	__le32 snack_tag /* Currently ERL>0 is not supported */;
728 	__le32 stat_sn /* CmdSN */;
729 	__le32 exp_cmd_sn /* Expected StatSn */;
730 	__le32 max_cmd_sn /* CmdSN */;
731 	__le32 exp_data_sn /* exp_data_sn */;
732 	__le32 bi_residual_count /* bi residual count */;
733 	__le32 residual_count /* residual count */;
734 };
735 
736 /*
737  * iSCSI Reject PDU header
738  */
739 struct iscsi_reject_hdr
740 {
741 	u8 reserved4 /* Reserved */;
742 	u8 hdr_reason /* The reject reason */;
743 	u8 hdr_flags /* Flags field of ISCSI header */;
744 	u8 opcode /* opcode. [constant, initialized] */;
745 	__le32 hdr_second_dword;
746 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
747 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_SHIFT  0
748 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
749 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24
750 	struct regpair reserved0;
751 	__le32 all_ones;
752 	__le32 reserved2;
753 	__le32 stat_sn /* stat_sn */;
754 	__le32 exp_cmd_sn /* exp_cmd_sn */;
755 	__le32 max_cmd_sn /* max_cmd_sn */;
756 	__le32 data_sn /* data_sn */;
757 	__le32 reserved3[2] /* reserved3 */;
758 };
759 
760 /*
761  * iSCSI Asynchronous Message PDU header
762  */
763 struct iscsi_async_msg_hdr
764 {
765 	__le16 reserved0 /* reserved */;
766 	u8 flags_attr;
767 #define ISCSI_ASYNC_MSG_HDR_RSRV_MASK           0x7F /* reserved */
768 #define ISCSI_ASYNC_MSG_HDR_RSRV_SHIFT          0
769 #define ISCSI_ASYNC_MSG_HDR_CONST1_MASK         0x1 /* const1 */
770 #define ISCSI_ASYNC_MSG_HDR_CONST1_SHIFT        7
771 	u8 opcode /* opcode */;
772 	__le32 hdr_second_dword;
773 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_MASK   0xFFFFFF /* DataSegmentLength */
774 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_SHIFT  0
775 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_MASK  0xFF /* TotalAHSLength */
776 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_SHIFT 24
777 	struct regpair lun /* Logical Unit Number */;
778 	__le32 all_ones /* should be 0xffffffff */;
779 	__le32 reserved1 /* reserved */;
780 	__le32 stat_sn /* stat_sn */;
781 	__le32 exp_cmd_sn /* exp_cmd_sn */;
782 	__le32 max_cmd_sn /* max_cmd_sn */;
783 	__le16 param1_rsrv /* Parameter1 or Reserved */;
784 	u8 async_vcode /* AsuncVCode */;
785 	u8 async_event /* AsyncEvent */;
786 	__le16 param3_rsrv /* Parameter3 or Reserved */;
787 	__le16 param2_rsrv /* Parameter2 or Reserved */;
788 	__le32 reserved7 /* reserved */;
789 };
790 
791 /*
792  * PDU header part of Ystorm task context
793  */
794 union iscsi_task_hdr
795 {
796 	struct iscsi_common_hdr common /* Command PDU header */;
797 	struct data_hdr data /* Command PDU header */;
798 	struct iscsi_cmd_hdr cmd /* Command PDU header */;
799 	struct iscsi_ext_cdb_cmd_hdr ext_cdb_cmd /* Command PDU header with extended CDB - Initiator Mode */;
800 	struct iscsi_login_req_hdr login_req /* Login request PDU header */;
801 	struct iscsi_logout_req_hdr logout_req /* Logout request PDU header */;
802 	struct iscsi_data_out_hdr data_out /* Data-out PDU header */;
803 	struct iscsi_data_in_hdr data_in /* Data-in PDU header */;
804 	struct iscsi_r2t_hdr r2t /* R2T PDU header */;
805 	struct iscsi_nop_out_hdr nop_out /* NOP-out PDU header */;
806 	struct iscsi_nop_in_hdr nop_in /* NOP-in PDU header */;
807 	struct iscsi_login_response_hdr login_response /* Login response PDU header */;
808 	struct iscsi_logout_response_hdr logout_response /* Logout response PDU header */;
809 	struct iscsi_text_request_hdr text_request /* Text request PDU header */;
810 	struct iscsi_text_response_hdr text_response /* Text response PDU header */;
811 	struct iscsi_tmf_request_hdr tmf_request /* TMF request PDU header */;
812 	struct iscsi_tmf_response_hdr tmf_response /* TMF response PDU header */;
813 	struct iscsi_response_hdr response /* Text response PDU header */;
814 	struct iscsi_reject_hdr reject /* Reject PDU header */;
815 	struct iscsi_async_msg_hdr async_msg /* Asynchronous Message PDU header */;
816 };
817 
818 /*
819  * The iscsi storm task context of Ystorm
820  */
821 struct ystorm_iscsi_task_st_ctx
822 {
823 	struct ystorm_iscsi_task_state state /* iSCSI task parameters and state */;
824 	struct ystorm_iscsi_task_rxmit_opt rxmit_opt /* iSCSI retransmit optimizations parameters */;
825 	union iscsi_task_hdr pdu_hdr /* PDU header - [constant initialized] */;
826 };
827 
828 struct e4_ystorm_iscsi_task_ag_ctx
829 {
830 	u8 reserved /* cdu_validation */;
831 	u8 byte1 /* state */;
832 	__le16 word0 /* icid */;
833 	u8 flags0;
834 #define E4_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK     0xF /* connection_type */
835 #define E4_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT    0
836 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK        0x1 /* exist_in_qm0 */
837 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT       4
838 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK        0x1 /* exist_in_qm1 */
839 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT       5
840 #define E4_YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK       0x1 /* bit2 */
841 #define E4_YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT      6
842 #define E4_YSTORM_ISCSI_TASK_AG_CTX_TTT_VALID_MASK   0x1 /* bit3 */
843 #define E4_YSTORM_ISCSI_TASK_AG_CTX_TTT_VALID_SHIFT  7
844 	u8 flags1;
845 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK         0x3 /* cf0 */
846 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT        0
847 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK         0x3 /* cf1 */
848 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT        2
849 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK  0x3 /* cf2special */
850 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT 4
851 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK       0x1 /* cf0en */
852 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT      6
853 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK       0x1 /* cf1en */
854 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT      7
855 	u8 flags2;
856 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK        0x1 /* bit4 */
857 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT       0
858 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK     0x1 /* rule0en */
859 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT    1
860 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK     0x1 /* rule1en */
861 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT    2
862 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK     0x1 /* rule2en */
863 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT    3
864 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK     0x1 /* rule3en */
865 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT    4
866 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK     0x1 /* rule4en */
867 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT    5
868 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK     0x1 /* rule5en */
869 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT    6
870 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK     0x1 /* rule6en */
871 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT    7
872 	u8 byte2 /* byte2 */;
873 	__le32 TTT /* reg0 */;
874 	u8 byte3 /* byte3 */;
875 	u8 byte4 /* byte4 */;
876 	__le16 word1 /* word1 */;
877 };
878 
879 struct e4_mstorm_iscsi_task_ag_ctx
880 {
881 	u8 cdu_validation /* cdu_validation */;
882 	u8 byte1 /* state */;
883 	__le16 task_cid /* icid */;
884 	u8 flags0;
885 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK     0xF /* connection_type */
886 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT    0
887 #define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK        0x1 /* exist_in_qm0 */
888 #define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT       4
889 #define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK                0x1 /* exist_in_qm1 */
890 #define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT               5
891 #define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK               0x1 /* bit2 */
892 #define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT              6
893 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK   0x1 /* bit3 */
894 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT  7
895 	u8 flags1;
896 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK     0x3 /* cf0 */
897 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT    0
898 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK                 0x3 /* cf1 */
899 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT                2
900 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK                 0x3 /* cf2 */
901 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT                4
902 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK  0x1 /* cf0en */
903 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6
904 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK               0x1 /* cf1en */
905 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT              7
906 	u8 flags2;
907 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK               0x1 /* cf2en */
908 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT              0
909 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK             0x1 /* rule0en */
910 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT            1
911 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK             0x1 /* rule1en */
912 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT            2
913 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK             0x1 /* rule2en */
914 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT            3
915 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK             0x1 /* rule3en */
916 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT            4
917 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK             0x1 /* rule4en */
918 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT            5
919 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK             0x1 /* rule5en */
920 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT            6
921 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK             0x1 /* rule6en */
922 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT            7
923 	u8 byte2 /* byte2 */;
924 	__le32 reg0 /* reg0 */;
925 	u8 byte3 /* byte3 */;
926 	u8 byte4 /* byte4 */;
927 	__le16 word1 /* word1 */;
928 };
929 
930 struct e4_ustorm_iscsi_task_ag_ctx
931 {
932 	u8 reserved /* cdu_validation */;
933 	u8 state /* state */;
934 	__le16 icid /* icid */;
935 	u8 flags0;
936 #define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK        0xF /* connection_type */
937 #define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT       0
938 #define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK           0x1 /* exist_in_qm0 */
939 #define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT          4
940 #define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK                   0x1 /* exist_in_qm1 */
941 #define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT                  5
942 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK          0x3 /* timer0cf */
943 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT         6
944 	u8 flags1;
945 #define E4_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK              0x3 /* timer1cf */
946 #define E4_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT             0
947 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK               0x3 /* timer2cf */
948 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT              2
949 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3_MASK                    0x3 /* timer_stop_all */
950 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT                   4
951 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK           0x3 /* cf4 */
952 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT          6
953 	u8 flags2;
954 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK       0x1 /* cf0en */
955 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT      0
956 #define E4_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK     0x1 /* cf1en */
957 #define E4_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT    1
958 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK            0x1 /* cf2en */
959 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT           2
960 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK                  0x1 /* cf3en */
961 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT                 3
962 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK        0x1 /* cf4en */
963 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT       4
964 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK  0x1 /* rule0en */
965 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5
966 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK                0x1 /* rule1en */
967 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT               6
968 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK    0x1 /* rule2en */
969 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT   7
970 	u8 flags3;
971 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK                0x1 /* rule3en */
972 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT               0
973 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK                0x1 /* rule4en */
974 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT               1
975 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK                0x1 /* rule5en */
976 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT               2
977 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK                0x1 /* rule6en */
978 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT               3
979 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK         0xF /* nibble1 */
980 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT        4
981 	__le32 dif_err_intervals /* reg0 */;
982 	__le32 dif_error_1st_interval /* reg1 */;
983 	__le32 rcv_cont_len /* reg2 */;
984 	__le32 exp_cont_len /* reg3 */;
985 	__le32 total_data_acked /* reg4 */;
986 	__le32 exp_data_acked /* reg5 */;
987 	u8 next_tid_valid /* byte2 */;
988 	u8 byte3 /* byte3 */;
989 	__le16 word1 /* word1 */;
990 	__le16 next_tid /* word2 */;
991 	__le16 word3 /* word3 */;
992 	__le32 hdr_residual_count /* reg6 */;
993 	__le32 exp_r2t_sn /* reg7 */;
994 };
995 
996 /*
997  * The iscsi storm task context of Mstorm
998  */
999 struct mstorm_iscsi_task_st_ctx
1000 {
1001 	struct scsi_cached_sges data_desc /* Union of Data SGL / cached sge */;
1002 	struct scsi_sgl_params sgl_params;
1003 	__le32 rem_task_size /* Remaining task size, used for placement verification */;
1004 	__le32 data_buffer_offset /* Buffer offset */;
1005 	u8 task_type /* Task type, (use: iscsi_task_type enum) */;
1006 	struct iscsi_dif_flags dif_flags /* sizes of host/peer protection intervals + protection log interval */;
1007 	__le16 dif_task_icid /* save tasks CID for validation - dif on immediate flow */;
1008 	struct regpair sense_db /* Pointer to sense data buffer */;
1009 	__le32 expected_itt /* ITT - for target mode validations */;
1010 	__le32 reserved1 /* reserved1 */;
1011 };
1012 
1013 struct iscsi_reg1
1014 {
1015 	__le32 reg1_map;
1016 #define ISCSI_REG1_NUM_SGES_MASK   0xF /* Written to R2tQE */
1017 #define ISCSI_REG1_NUM_SGES_SHIFT  0
1018 #define ISCSI_REG1_RESERVED1_MASK  0xFFFFFFF /* reserved */
1019 #define ISCSI_REG1_RESERVED1_SHIFT 4
1020 };
1021 
1022 struct tqe_opaque
1023 {
1024 	__le16 opaque[2] /* TQe opaque */;
1025 };
1026 
1027 /*
1028  * The iscsi storm task context of Ustorm
1029  */
1030 struct ustorm_iscsi_task_st_ctx
1031 {
1032 	__le32 rem_rcv_len /* Remaining data to be received in bytes. Used in validations */;
1033 	__le32 exp_data_transfer_len /* iSCSI Initiator - The size of the transmitted task, iSCSI Target - the size of the Rx continuation */;
1034 	__le32 exp_data_sn /* Expected data SN */;
1035 	struct regpair lun /* LUN */;
1036 	struct iscsi_reg1 reg1;
1037 	u8 flags2;
1038 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_MASK              0x1 /* Initiator Mode - Mark AHS exist */
1039 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT             0
1040 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK              0x7F
1041 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT             1
1042 	struct iscsi_dif_flags dif_flags /* Dif flags (written to R2T WQE) */;
1043 	__le16 reserved3;
1044 	struct tqe_opaque tqe_opaque_list;
1045 	__le32 reserved5;
1046 	__le32 reserved6;
1047 	__le32 reserved7;
1048 	u8 task_type /* Task Type */;
1049 	u8 error_flags;
1050 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_MASK      0x1 /* Mark task with data digest error (1 bit) */
1051 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_SHIFT     0
1052 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_MASK   0x1 /* Target Mode - Mark middle task error, data truncated */
1053 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_SHIFT  1
1054 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_MASK        0x1
1055 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_SHIFT       2
1056 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_MASK              0x1F
1057 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_SHIFT             3
1058 	u8 flags;
1059 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_MASK              0x3 /* mark task cqe write (for cleanup flow) */
1060 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_SHIFT             0
1061 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_MASK             0x1 /* local completion bit */
1062 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT            2
1063 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK         0x1 /* write R2TQE from Q0 flow */
1064 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT        3
1065 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_MASK  0x1 /* Mark total data acked or disabled */
1066 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_SHIFT 4
1067 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_MASK        0x1 /* Mark HQ scanned or disabled */
1068 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_SHIFT       5
1069 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK          0x1 /* Mark HQ scanned or disabled */
1070 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT         6
1071 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK              0x1
1072 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_SHIFT             7
1073 	u8 cq_rss_number /* Task CQ_RSS number 0.63 */;
1074 };
1075 
1076 /*
1077  * iscsi task context
1078  */
1079 struct e4_iscsi_task_context
1080 {
1081 	struct ystorm_iscsi_task_st_ctx ystorm_st_context /* ystorm storm context */;
1082 	struct e4_ystorm_iscsi_task_ag_ctx ystorm_ag_context /* ystorm aggregative context */;
1083 	struct regpair ystorm_ag_padding[2] /* padding */;
1084 	struct tdif_task_context tdif_context /* tdif context */;
1085 	struct e4_mstorm_iscsi_task_ag_ctx mstorm_ag_context /* mstorm aggregative context */;
1086 	struct regpair mstorm_ag_padding[2] /* padding */;
1087 	struct e4_ustorm_iscsi_task_ag_ctx ustorm_ag_context /* ustorm aggregative context */;
1088 	struct mstorm_iscsi_task_st_ctx mstorm_st_context /* mstorm storm context */;
1089 	struct ustorm_iscsi_task_st_ctx ustorm_st_context /* ustorm storm context */;
1090 	struct rdif_task_context rdif_context /* rdif context */;
1091 };
1092 
1093 struct e5_ystorm_iscsi_task_ag_ctx
1094 {
1095 	u8 reserved /* cdu_validation */;
1096 	u8 byte1 /* state_and_core_id */;
1097 	__le16 word0 /* icid */;
1098 	u8 flags0;
1099 #define E5_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK       0xF /* connection_type */
1100 #define E5_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT      0
1101 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK          0x1 /* exist_in_qm0 */
1102 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT         4
1103 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK          0x1 /* exist_in_qm1 */
1104 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT         5
1105 #define E5_YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK         0x1 /* bit2 */
1106 #define E5_YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT        6
1107 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK          0x1 /* bit3 */
1108 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT         7
1109 	u8 flags1;
1110 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK           0x3 /* cf0 */
1111 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT          0
1112 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK           0x3 /* cf1 */
1113 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT          2
1114 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK    0x3 /* cf2special */
1115 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT   4
1116 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK         0x1 /* cf0en */
1117 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT        6
1118 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK         0x1 /* cf1en */
1119 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT        7
1120 	u8 flags2;
1121 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK          0x1 /* bit4 */
1122 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT         0
1123 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK       0x1 /* rule0en */
1124 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT      1
1125 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK       0x1 /* rule1en */
1126 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT      2
1127 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK       0x1 /* rule2en */
1128 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT      3
1129 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK       0x1 /* rule3en */
1130 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT      4
1131 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK       0x1 /* rule4en */
1132 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT      5
1133 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK       0x1 /* rule5en */
1134 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT      6
1135 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK       0x1 /* rule6en */
1136 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT      7
1137 	u8 flags3;
1138 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK  0x1 /* bit5 */
1139 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT 0
1140 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK  0x3 /* cf3 */
1141 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT 1
1142 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK  0x3 /* cf4 */
1143 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT 3
1144 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK  0x1 /* cf3en */
1145 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT 5
1146 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK  0x1 /* cf4en */
1147 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT 6
1148 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK  0x1 /* rule7en */
1149 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT 7
1150 	__le32 TTT /* reg0 */;
1151 	u8 byte2 /* byte2 */;
1152 	u8 byte3 /* byte3 */;
1153 	u8 byte4 /* byte4 */;
1154 	u8 e4_reserved7 /* byte5 */;
1155 };
1156 
1157 struct e5_mstorm_iscsi_task_ag_ctx
1158 {
1159 	u8 cdu_validation /* cdu_validation */;
1160 	u8 byte1 /* state_and_core_id */;
1161 	__le16 task_cid /* icid */;
1162 	u8 flags0;
1163 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK     0xF /* connection_type */
1164 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT    0
1165 #define E5_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK        0x1 /* exist_in_qm0 */
1166 #define E5_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT       4
1167 #define E5_MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK                0x1 /* exist_in_qm1 */
1168 #define E5_MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT               5
1169 #define E5_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK               0x1 /* bit2 */
1170 #define E5_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT              6
1171 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK   0x1 /* bit3 */
1172 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT  7
1173 	u8 flags1;
1174 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK     0x3 /* cf0 */
1175 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT    0
1176 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK                 0x3 /* cf1 */
1177 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT                2
1178 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK                 0x3 /* cf2 */
1179 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT                4
1180 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK  0x1 /* cf0en */
1181 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6
1182 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK               0x1 /* cf1en */
1183 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT              7
1184 	u8 flags2;
1185 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK               0x1 /* cf2en */
1186 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT              0
1187 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK             0x1 /* rule0en */
1188 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT            1
1189 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK             0x1 /* rule1en */
1190 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT            2
1191 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK             0x1 /* rule2en */
1192 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT            3
1193 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK             0x1 /* rule3en */
1194 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT            4
1195 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK             0x1 /* rule4en */
1196 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT            5
1197 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK             0x1 /* rule5en */
1198 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT            6
1199 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK             0x1 /* rule6en */
1200 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT            7
1201 	u8 flags3;
1202 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK        0x1 /* bit4 */
1203 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT       0
1204 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK        0x3 /* cf3 */
1205 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT       1
1206 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK        0x3 /* cf4 */
1207 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT       3
1208 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK        0x1 /* cf3en */
1209 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT       5
1210 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK        0x1 /* cf4en */
1211 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT       6
1212 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK        0x1 /* rule7en */
1213 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT       7
1214 	__le32 reg0 /* reg0 */;
1215 	u8 byte2 /* byte2 */;
1216 	u8 byte3 /* byte3 */;
1217 	u8 byte4 /* byte4 */;
1218 	u8 e4_reserved7 /* byte5 */;
1219 };
1220 
1221 struct e5_ustorm_iscsi_task_ag_ctx
1222 {
1223 	u8 reserved /* cdu_validation */;
1224 	u8 state_and_core_id /* state_and_core_id */;
1225 	__le16 icid /* icid */;
1226 	u8 flags0;
1227 #define E5_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK        0xF /* connection_type */
1228 #define E5_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT       0
1229 #define E5_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK           0x1 /* exist_in_qm0 */
1230 #define E5_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT          4
1231 #define E5_USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK                   0x1 /* exist_in_qm1 */
1232 #define E5_USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT                  5
1233 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK          0x3 /* timer0cf */
1234 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT         6
1235 	u8 flags1;
1236 #define E5_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK              0x3 /* timer1cf */
1237 #define E5_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT             0
1238 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK               0x3 /* timer2cf */
1239 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT              2
1240 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3_MASK                    0x3 /* timer_stop_all */
1241 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT                   4
1242 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK           0x3 /* dif_error_cf */
1243 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT          6
1244 	u8 flags2;
1245 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK       0x1 /* cf0en */
1246 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT      0
1247 #define E5_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK     0x1 /* cf1en */
1248 #define E5_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT    1
1249 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK            0x1 /* cf2en */
1250 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT           2
1251 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK                  0x1 /* cf3en */
1252 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT                 3
1253 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK        0x1 /* cf4en */
1254 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT       4
1255 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK  0x1 /* rule0en */
1256 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5
1257 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK                0x1 /* rule1en */
1258 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT               6
1259 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK    0x1 /* rule2en */
1260 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT   7
1261 	u8 flags3;
1262 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK                0x1 /* rule3en */
1263 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT               0
1264 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK                0x1 /* rule4en */
1265 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT               1
1266 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK                0x1 /* rule5en */
1267 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT               2
1268 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK                0x1 /* rule6en */
1269 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT               3
1270 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK           0x1 /* bit2 */
1271 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT          4
1272 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK           0x1 /* bit3 */
1273 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT          5
1274 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK           0x1 /* bit4 */
1275 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT          6
1276 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK           0x1 /* rule7en */
1277 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT          7
1278 	u8 flags4;
1279 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK           0x3 /* cf5 */
1280 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT          0
1281 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK           0x1 /* cf5en */
1282 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT          2
1283 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED7_MASK           0x1 /* rule8en */
1284 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED7_SHIFT          3
1285 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK         0xF /* dif_error_type */
1286 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT        4
1287 	u8 next_tid_valid /* byte2 */;
1288 	u8 byte3 /* byte3 */;
1289 	u8 e4_reserved8 /* byte4 */;
1290 	__le32 dif_err_intervals /* dif_err_intervals */;
1291 	__le32 dif_error_1st_interval /* dif_error_1st_interval */;
1292 	__le32 rcv_cont_len /* reg2 */;
1293 	__le32 exp_cont_len /* reg3 */;
1294 	__le32 total_data_acked /* reg4 */;
1295 	__le32 exp_data_acked /* reg5 */;
1296 	__le16 word1 /* word1 */;
1297 	__le16 next_tid /* word2 */;
1298 	__le32 hdr_residual_count /* reg6 */;
1299 	__le32 exp_r2t_sn /* reg7 */;
1300 };
1301 
1302 /*
1303  * iscsi task context
1304  */
1305 struct e5_iscsi_task_context
1306 {
1307 	struct ystorm_iscsi_task_st_ctx ystorm_st_context /* ystorm storm context */;
1308 	struct e5_ystorm_iscsi_task_ag_ctx ystorm_ag_context /* ystorm aggregative context */;
1309 	struct regpair ystorm_ag_padding[2] /* padding */;
1310 	struct tdif_task_context tdif_context /* tdif context */;
1311 	struct e5_mstorm_iscsi_task_ag_ctx mstorm_ag_context /* mstorm aggregative context */;
1312 	struct regpair mstorm_ag_padding[2] /* padding */;
1313 	struct e5_ustorm_iscsi_task_ag_ctx ustorm_ag_context /* ustorm aggregative context */;
1314 	struct mstorm_iscsi_task_st_ctx mstorm_st_context /* mstorm storm context */;
1315 	struct ustorm_iscsi_task_st_ctx ustorm_st_context /* ustorm storm context */;
1316 	struct rdif_task_context rdif_context /* rdif context */;
1317 };
1318 
1319 /*
1320  * ISCSI connection offload params passed by driver to FW in ISCSI offload ramrod
1321  */
1322 struct iscsi_conn_offload_params
1323 {
1324 	struct regpair sq_pbl_addr /* PBL SQ pointer */;
1325 	struct regpair r2tq_pbl_addr /* PBL R2TQ pointer */;
1326 	struct regpair xhq_pbl_addr /* PBL XHQ pointer */;
1327 	struct regpair uhq_pbl_addr /* PBL UHQ pointer */;
1328 	__le32 initial_ack /* Initial ack, received from TCP */;
1329 	__le16 physical_q0 /* Physical QM queue to be tied to logical Q0 */;
1330 	__le16 physical_q1 /* Physical QM queue to be tied to logical Q1 */;
1331 	u8 flags;
1332 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_MASK   0x1 /* TCP connect/terminate option. 0 - TCP on host (option-1); 1 - TCP on chip (option-2). */
1333 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT  0
1334 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK      0x1 /* iSCSI connect mode: 0-iSCSI Initiator, 1-iSCSI Target */
1335 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT     1
1336 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_MASK  0x1 /* Restricted mode: 0 - un-restricted (deviating from the RFC), 1 - restricted (according to the RFC) */
1337 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_SHIFT 2
1338 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK        0x1F /* reserved */
1339 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT       3
1340 	u8 pbl_page_size_log /* Page size with PBEs log; Page Size = 2^(page_size_log+12) */;
1341 	u8 pbe_page_size_log /* PBE page size with log; Page Size = 2^(page_size_log+12) */;
1342 	u8 default_cq /* Default CQ used to write unsolicited data */;
1343 	__le32 stat_sn /* StatSn for Target Mode only: the first Login Response StatSn value for Target mode */;
1344 };
1345 
1346 /*
1347  * iSCSI connection statistics
1348  */
1349 struct iscsi_conn_stats_params
1350 {
1351 	struct regpair iscsi_tcp_tx_packets_cnt /* Counts number of transmitted TCP packets for this iSCSI connection */;
1352 	struct regpair iscsi_tcp_tx_bytes_cnt /* Counts number of transmitted TCP bytes for this iSCSI connection */;
1353 	struct regpair iscsi_tcp_tx_rxmit_cnt /* Counts number of TCP retransmission events for this iSCSI connection */;
1354 	struct regpair iscsi_tcp_rx_packets_cnt /* Counts number of received TCP packets for this iSCSI connection */;
1355 	struct regpair iscsi_tcp_rx_bytes_cnt /* Counts number of received TCP bytes for this iSCSI connection */;
1356 	struct regpair iscsi_tcp_rx_dup_ack_cnt /* Counts number of received TCP duplicate acks for this iSCSI connection */;
1357 	__le32 iscsi_tcp_rx_chksum_err_cnt /* Counts number of received TCP packets with checksum err for this iSCSI connection */;
1358 	__le32 reserved;
1359 };
1360 
1361 /*
1362  * spe message header
1363  */
1364 struct iscsi_slow_path_hdr
1365 {
1366 	u8 op_code /* iscsi bus-drv message opcode */;
1367 	u8 flags;
1368 #define ISCSI_SLOW_PATH_HDR_RESERVED0_MASK   0xF
1369 #define ISCSI_SLOW_PATH_HDR_RESERVED0_SHIFT  0
1370 #define ISCSI_SLOW_PATH_HDR_LAYER_CODE_MASK  0x7 /* protocol layer (L2,L3,L4,L5) */
1371 #define ISCSI_SLOW_PATH_HDR_LAYER_CODE_SHIFT 4
1372 #define ISCSI_SLOW_PATH_HDR_RESERVED1_MASK   0x1
1373 #define ISCSI_SLOW_PATH_HDR_RESERVED1_SHIFT  7
1374 };
1375 
1376 /*
1377  * ISCSI connection update params passed by driver to FW in ISCSI update ramrod
1378  */
1379 struct iscsi_conn_update_ramrod_params
1380 {
1381 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1382 	__le16 conn_id /* ISCSI Connection ID. (MOTI_COHEN : draft for DrvSim sake) */;
1383 	__le32 fw_cid /* Context ID (cid) of the connection. (MOTI_COHEN : draft for DrvSim sake) */;
1384 	u8 flags;
1385 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_MASK           0x1 /* Is header digest enabled */
1386 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_SHIFT          0
1387 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_MASK           0x1 /* Is data digest enabled */
1388 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_SHIFT          1
1389 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_MASK     0x1 /* Initial R2T */
1390 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT    2
1391 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK  0x1 /* Immediate data */
1392 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3
1393 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_MASK  0x1 /* 0 - 512B, 1 - 4K */
1394 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_SHIFT 4
1395 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_MASK  0x1 /* 0 - no DIF, 1 - could be enabled per task */
1396 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_SHIFT 5
1397 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_IMM_EN_MASK   0x1 /* Support DIF on immediate, 1-Yes, 0-No */
1398 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_IMM_EN_SHIFT  6
1399 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_LUN_MAPPER_EN_MASK   0x1 /* valid only if dif_on_imm_en=1 Does this connection has dif configuration per Lun or Default dif configuration */
1400 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_LUN_MAPPER_EN_SHIFT  7
1401 	u8 reserved0[3];
1402 	__le32 max_seq_size /* Maximum sequence size. Valid for TX and RX */;
1403 	__le32 max_send_pdu_length /* Maximum PDU size. Valid for the TX */;
1404 	__le32 max_recv_pdu_length /* Maximum PDU size. Valid for the RX */;
1405 	__le32 first_seq_length /* Initial sequence length */;
1406 	__le32 exp_stat_sn /* ExpStatSn - Option1 Only */;
1407 	union dif_configuration_params dif_on_imme_params /* dif on immediate params - Target mode Only */;
1408 };
1409 
1410 /*
1411  * iSCSI CQ element
1412  */
1413 struct iscsi_cqe_common
1414 {
1415 	__le16 conn_id /* Drivers connection Id */;
1416 	u8 cqe_type /* Indicates CQE type (use enum iscsi_cqes_type) */;
1417 	union cqe_error_status error_bitmap /* CQE error status */;
1418 	__le32 reserved[3];
1419 	union iscsi_task_hdr iscsi_hdr /* iscsi header union */;
1420 };
1421 
1422 /*
1423  * iSCSI CQ element
1424  */
1425 struct iscsi_cqe_solicited
1426 {
1427 	__le16 conn_id /* Drivers connection Id */;
1428 	u8 cqe_type /* Indicates CQE type (use enum iscsi_cqes_type) */;
1429 	union cqe_error_status error_bitmap /* CQE error status */;
1430 	__le16 itid /* initiator itt (Initiator mode) or target ttt (Target mode) */;
1431 	u8 task_type /* Task type */;
1432 	u8 fw_dbg_field /* FW debug params */;
1433 	u8 caused_conn_err /* Equals 1 if this TID caused the connection error, otherwise equals 0. */;
1434 	u8 reserved0[3];
1435 	__le32 data_truncated_bytes /* Target Mode only: Valid only if data_truncated_err equals 1: The remaining bytes till the end of the IO. */;
1436 	union iscsi_task_hdr iscsi_hdr /* iscsi header union */;
1437 };
1438 
1439 /*
1440  * iSCSI CQ element
1441  */
1442 struct iscsi_cqe_unsolicited
1443 {
1444 	__le16 conn_id /* Drivers connection Id */;
1445 	u8 cqe_type /* Indicates CQE type (use enum iscsi_cqes_type) */;
1446 	union cqe_error_status error_bitmap /* CQE error status */;
1447 	__le16 reserved0 /* Reserved */;
1448 	u8 reserved1 /* Reserved */;
1449 	u8 unsol_cqe_type /* Represent this unsolicited CQE position in a sequence of packets belonging to the same unsolicited PDU (use enum iscsi_cqe_unsolicited_type) */;
1450 	__le16 rqe_opaque /* Relevant for Unsolicited CQE only: The opaque data of RQ BDQ */;
1451 	__le16 reserved2[3] /* Reserved */;
1452 	union iscsi_task_hdr iscsi_hdr /* iscsi header union */;
1453 };
1454 
1455 /*
1456  * iSCSI CQ element
1457  */
1458 union iscsi_cqe
1459 {
1460 	struct iscsi_cqe_common cqe_common /* Common CQE */;
1461 	struct iscsi_cqe_solicited cqe_solicited /* Solicited CQE */;
1462 	struct iscsi_cqe_unsolicited cqe_unsolicited /* Unsolicited CQE. relevant only when cqe_opcode == ISCSI_CQE_TYPE_UNSOLICITED */;
1463 };
1464 
1465 /*
1466  * iSCSI CQE type
1467  */
1468 enum iscsi_cqes_type
1469 {
1470 	ISCSI_CQE_TYPE_SOLICITED=1 /* iSCSI CQE with solicited data */,
1471 	ISCSI_CQE_TYPE_UNSOLICITED /* iSCSI CQE with unsolicited data */,
1472 	ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE /* iSCSI CQE with solicited with sense data */,
1473 	ISCSI_CQE_TYPE_TASK_CLEANUP /* iSCSI CQE task cleanup */,
1474 	ISCSI_CQE_TYPE_DUMMY /* iSCSI Dummy CQE */,
1475 	MAX_ISCSI_CQES_TYPE
1476 };
1477 
1478 /*
1479  * iSCSI CQE type
1480  */
1481 enum iscsi_cqe_unsolicited_type
1482 {
1483 	ISCSI_CQE_UNSOLICITED_NONE /* iSCSI CQE with unsolicited data */,
1484 	ISCSI_CQE_UNSOLICITED_SINGLE /* iSCSI CQE with unsolicited data */,
1485 	ISCSI_CQE_UNSOLICITED_FIRST /* iSCSI CQE with unsolicited data */,
1486 	ISCSI_CQE_UNSOLICITED_MIDDLE /* iSCSI CQE with unsolicited data */,
1487 	ISCSI_CQE_UNSOLICITED_LAST /* iSCSI CQE with unsolicited data */,
1488 	MAX_ISCSI_CQE_UNSOLICITED_TYPE
1489 };
1490 
1491 /*
1492  * iscsi debug modes
1493  */
1494 struct iscsi_debug_modes
1495 {
1496 	u8 flags;
1497 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_MASK             0x1 /* Assert on Rx connection error */
1498 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_SHIFT            0
1499 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_MASK                0x1 /* Assert if TCP RESET arrived */
1500 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_SHIFT               1
1501 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_MASK                  0x1 /* Assert if TCP FIN arrived */
1502 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_SHIFT                 2
1503 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_MASK              0x1 /* Assert if cleanup flow */
1504 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_SHIFT             3
1505 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_MASK      0x1 /* Assert if REJECT PDU or ASYNC PDU arrived */
1506 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT     4
1507 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK                  0x1 /* Assert if NOP IN PDU or NOP OUT PDU arrived */
1508 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT                 5
1509 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_OR_DATA_DIGEST_ERROR_MASK  0x1 /* Assert if DIF or data digest error */
1510 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_OR_DATA_DIGEST_ERROR_SHIFT 6
1511 #define ISCSI_DEBUG_MODES_ASSERT_IF_HQ_CORRUPT_MASK                0x1 /* Assert if HQ corruption detected */
1512 #define ISCSI_DEBUG_MODES_ASSERT_IF_HQ_CORRUPT_SHIFT               7
1513 };
1514 
1515 /*
1516  * iSCSI kernel completion queue IDs
1517  */
1518 enum iscsi_eqe_opcode
1519 {
1520 	ISCSI_EVENT_TYPE_INIT_FUNC=0 /* iSCSI response after init Ramrod */,
1521 	ISCSI_EVENT_TYPE_DESTROY_FUNC /* iSCSI response after destroy Ramrod */,
1522 	ISCSI_EVENT_TYPE_OFFLOAD_CONN /* iSCSI response after option 2 offload Ramrod */,
1523 	ISCSI_EVENT_TYPE_UPDATE_CONN /* iSCSI response after update Ramrod */,
1524 	ISCSI_EVENT_TYPE_CLEAR_SQ /* iSCSI response after clear sq Ramrod */,
1525 	ISCSI_EVENT_TYPE_TERMINATE_CONN /* iSCSI response after termination Ramrod */,
1526 	ISCSI_EVENT_TYPE_MAC_UPDATE_CONN /* iSCSI response after MAC address update Ramrod */,
1527 	ISCSI_EVENT_TYPE_COLLECT_STATS_CONN /* iSCSI response after collecting connection statistics Ramrod */,
1528 	ISCSI_EVENT_TYPE_ASYN_CONNECT_COMPLETE /* iSCSI response after option 2 connect completed (A-syn EQE) */,
1529 	ISCSI_EVENT_TYPE_ASYN_TERMINATE_DONE /* iSCSI response after option 2 termination completed (A-syn EQE) */,
1530 	ISCSI_EVENT_TYPE_START_OF_ERROR_TYPES=10 /* Never returned in EQE, used to separate Regular event types from Error event types */,
1531 	ISCSI_EVENT_TYPE_ASYN_ABORT_RCVD /* iSCSI abort response after TCP RST packet recieve (A-syn EQE) */,
1532 	ISCSI_EVENT_TYPE_ASYN_CLOSE_RCVD /* iSCSI response after close receive (A-syn EQE) */,
1533 	ISCSI_EVENT_TYPE_ASYN_SYN_RCVD /* iSCSI response after TCP SYN+ACK packet receive (A-syn EQE) */,
1534 	ISCSI_EVENT_TYPE_ASYN_MAX_RT_TIME /* iSCSI error - tcp max retransmit time (A-syn EQE) */,
1535 	ISCSI_EVENT_TYPE_ASYN_MAX_RT_CNT /* iSCSI error - tcp max retransmit count (A-syn EQE) */,
1536 	ISCSI_EVENT_TYPE_ASYN_MAX_KA_PROBES_CNT /* iSCSI error - tcp ka probes count (A-syn EQE) */,
1537 	ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2 /* iSCSI error - tcp fin wait 2 (A-syn EQE) */,
1538 	ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR /* iSCSI error response (A-syn EQE) */,
1539 	ISCSI_EVENT_TYPE_TCP_CONN_ERROR /* iSCSI error - tcp error (A-syn EQE) */,
1540 	MAX_ISCSI_EQE_OPCODE
1541 };
1542 
1543 /*
1544  * iSCSI EQE and CQE completion status
1545  */
1546 enum iscsi_error_types
1547 {
1548 	ISCSI_STATUS_NONE=0,
1549 	ISCSI_CQE_ERROR_UNSOLICITED_RCV_ON_INVALID_CONN=1,
1550 	ISCSI_CONN_ERROR_TASK_CID_MISMATCH /* iSCSI connection error - Corrupted Task context  */,
1551 	ISCSI_CONN_ERROR_TASK_NOT_VALID /* iSCSI connection error - The task is not valid  */,
1552 	ISCSI_CONN_ERROR_RQ_RING_IS_FULL /* iSCSI connection error - RQ full  */,
1553 	ISCSI_CONN_ERROR_CMDQ_RING_IS_FULL /* iSCSI connection error - CMDQ full (Target only)  */,
1554 	ISCSI_CONN_ERROR_HQE_CACHING_FAILED /* iSCSI connection error - HQ error  */,
1555 	ISCSI_CONN_ERROR_HEADER_DIGEST_ERROR /* iSCSI connection error - Header digest error */,
1556 	ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR /* iSCSI connection error - Local completion bit is not correct   (A-syn EQE) */,
1557 	ISCSI_CONN_ERROR_DATA_OVERRUN /* iSCSI connection error - data overrun */,
1558 	ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR /* iSCSI connection error - out of sges in task context */,
1559 	ISCSI_CONN_ERROR_IP_OPTIONS_ERROR /* TCP connection error - IP option error  */,
1560 	ISCSI_CONN_ERROR_PRS_ERRORS /* TCP connection error - error indication form parser */,
1561 	ISCSI_CONN_ERROR_CONNECT_INVALID_TCP_OPTION /* TCP connection error - tcp options error(option 2 only)  */,
1562 	ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR /* TCP connection error - IP fragmentation error  */,
1563 	ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN /* iSCSI connection error - invalid AHS length (Target only)  */,
1564 	ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE /* iSCSI connection error - invalid AHS type (Target only)  */,
1565 	ISCSI_CONN_ERROR_PROTOCOL_ERR_ITT_OUT_OF_RANGE /* iSCSI connection error - invalid ITT  */,
1566 	ISCSI_CONN_ERROR_PROTOCOL_ERR_TTT_OUT_OF_RANGE /* iSCSI connection error - invalid TTT (Target only)  */,
1567 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_EXCEEDS_PDU_SIZE /* iSCSI connection error - PDU data_seg_len > max receive pdu size */,
1568 	ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE /* iSCSI connection error - invalid PDU opcode */,
1569 	ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE_BEFORE_UPDATE /* iSCSI connection error - invalid PDU opcode before update ramrod (Option 2 only)  */,
1570 	ISCSI_CONN_ERROR_UNVALID_NOPIN_DSL /* iSCSI connection error - NOPIN dsl > 0 and ITT = 0xffffffff (Initiator only)  */,
1571 	ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_CARRIES_NO_DATA /* iSCSI connection error - R2T dsl > 0 (Initiator only)  */,
1572 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SN /* iSCSI connection error - DATA-SN error  */,
1573 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_IN_TTT /* iSCSI connection error - DATA-IN TTT error (Initiator only)  */,
1574 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_OUT_ITT /* iSCSI connection error - DATA-OUT ITT error (Target only)  */,
1575 	ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_TTT /* iSCSI connection error - R2T TTT error (Initiator only)  */,
1576 	ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_BUFFER_OFFSET /* iSCSI connection error - R2T buffer offset error (Initiator only)  */,
1577 	ISCSI_CONN_ERROR_PROTOCOL_ERR_BUFFER_OFFSET_OOO /* iSCSI connection error - DATA PDU buffer offset error  */,
1578 	ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_SN /* iSCSI connection error - R2T SN error (Initiator only)  */,
1579 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 /* iSCSI connection error - R2T desired data transfer length = 0 (Initiator only)  */,
1580 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 /* iSCSI connection error - R2T desired data transfer length less then max burst size (Initiator only)  */,
1581 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_2 /* iSCSI connection error - R2T desired data transfer length + buffer offset > task size (Initiator only)  */,
1582 	ISCSI_CONN_ERROR_PROTOCOL_ERR_LUN /* iSCSI connection error - R2T unvalid LUN (Initiator only)  */,
1583 	ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO /* iSCSI connection error - All data has been already received, however it is not the end of sequence (Initiator only)  */,
1584 	ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO_S_BIT_ONE /* iSCSI connection error - S-bit and final bit = 1 (Initiator only)  */,
1585 	ISCSI_CONN_ERROR_PROTOCOL_ERR_EXP_STAT_SN /* iSCSI connection error - STAT SN error (Initiator only)  */,
1586 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DSL_NOT_ZERO /* iSCSI connection error - TMF or LOGOUT PDUs dsl > 0 (Initiator only)  */,
1587 	ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_DSL /* iSCSI connection error - CMD PDU dsl>0 while immediate data is disabled (Target only)  */,
1588 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG /* iSCSI connection error - Data In overrun (Initiator only)  */,
1589 	ISCSI_CONN_ERROR_PROTOCOL_ERR_OUTSTANDING_R2T_COUNT /* iSCSI connection error - >1 outstanding R2T (Initiator only)  */,
1590 	ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX /* iSCSI connection error - DIF Tx error + DIF error drop is enabled (Target only)  */,
1591 	ISCSI_CONN_ERROR_SENSE_DATA_LENGTH /* iSCSI connection error - Sense data length > 256 (Initiator only)  */,
1592 	ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR /* iSCSI connection error - Data placement error  */,
1593 	ISCSI_CONN_ERROR_INVALID_ITT /* iSCSI connection error - Invalid ITT (Target Only) */,
1594 	ISCSI_ERROR_UNKNOWN /* iSCSI connection error  */,
1595 	MAX_ISCSI_ERROR_TYPES
1596 };
1597 
1598 /*
1599  * iSCSI Ramrod Command IDs
1600  */
1601 enum iscsi_ramrod_cmd_id
1602 {
1603 	ISCSI_RAMROD_CMD_ID_UNUSED=0,
1604 	ISCSI_RAMROD_CMD_ID_INIT_FUNC=1 /* iSCSI function init Ramrod */,
1605 	ISCSI_RAMROD_CMD_ID_DESTROY_FUNC=2 /* iSCSI function destroy Ramrod */,
1606 	ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN=3 /* iSCSI connection offload Ramrod */,
1607 	ISCSI_RAMROD_CMD_ID_UPDATE_CONN=4 /* iSCSI connection update Ramrod  */,
1608 	ISCSI_RAMROD_CMD_ID_TERMINATION_CONN=5 /* iSCSI connection offload Ramrod. Command ID known only to FW and VBD */,
1609 	ISCSI_RAMROD_CMD_ID_CLEAR_SQ=6 /* iSCSI connection clear-sq ramrod.  */,
1610 	ISCSI_RAMROD_CMD_ID_MAC_UPDATE=7 /* iSCSI connection update MAC address ramrod.  */,
1611 	ISCSI_RAMROD_CMD_ID_CONN_STATS=8 /* iSCSI collect connection statistics ramrod.  */,
1612 	MAX_ISCSI_RAMROD_CMD_ID
1613 };
1614 
1615 /*
1616  * ISCSI connection termination request
1617  */
1618 struct iscsi_spe_conn_mac_update
1619 {
1620 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1621 	__le16 conn_id /* ISCSI Connection ID. */;
1622 	__le32 fw_cid /* Context ID (cid) of the connection. */;
1623 	__le16 remote_mac_addr_lo /* new remote mac address lo */;
1624 	__le16 remote_mac_addr_mid /* new remote mac address mid */;
1625 	__le16 remote_mac_addr_hi /* new remote mac address hi */;
1626 	u8 reserved0[2];
1627 };
1628 
1629 /*
1630  * ISCSI and TCP connection(Option 1) offload params passed by driver to FW in ISCSI offload ramrod
1631  */
1632 struct iscsi_spe_conn_offload
1633 {
1634 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1635 	__le16 conn_id /* ISCSI Connection ID. */;
1636 	__le32 fw_cid;
1637 	struct iscsi_conn_offload_params iscsi /* iSCSI session offload params */;
1638 	struct tcp_offload_params tcp /* iSCSI session offload params */;
1639 };
1640 
1641 /*
1642  * ISCSI and TCP connection(Option 2) offload params passed by driver to FW in ISCSI offload ramrod
1643  */
1644 struct iscsi_spe_conn_offload_option2
1645 {
1646 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1647 	__le16 conn_id /* ISCSI Connection ID. */;
1648 	__le32 fw_cid;
1649 	struct iscsi_conn_offload_params iscsi /* iSCSI session offload params */;
1650 	struct tcp_offload_params_opt2 tcp /* iSCSI session offload params */;
1651 };
1652 
1653 /*
1654  * ISCSI collect connection statistics request
1655  */
1656 struct iscsi_spe_conn_statistics
1657 {
1658 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1659 	__le16 conn_id /* ISCSI Connection ID. */;
1660 	__le32 fw_cid /* Context ID (cid) of the connection. */;
1661 	u8 reset_stats /* Indicates whether to reset the connection statistics. */;
1662 	u8 reserved0[7];
1663 	struct regpair stats_cnts_addr /* cmdq and unsolicited counters termination params */;
1664 };
1665 
1666 /*
1667  * ISCSI connection termination request
1668  */
1669 struct iscsi_spe_conn_termination
1670 {
1671 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1672 	__le16 conn_id /* ISCSI Connection ID. */;
1673 	__le32 fw_cid /* Context ID (cid) of the connection. */;
1674 	u8 abortive /* Mark termination as abort(reset) flow */;
1675 	u8 reserved0[7];
1676 	struct regpair queue_cnts_addr /* cmdq and unsolicited counters termination params */;
1677 	struct regpair query_params_addr /* query_params_ptr */;
1678 };
1679 
1680 /*
1681  * iSCSI firmware function destroy parameters
1682  */
1683 struct iscsi_spe_func_dstry
1684 {
1685 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1686 	__le16 reserved0;
1687 	__le32 reserved1;
1688 };
1689 
1690 /*
1691  * iSCSI firmware function init parameters
1692  */
1693 struct iscsi_spe_func_init
1694 {
1695 	struct iscsi_slow_path_hdr hdr /* spe message header. */;
1696 	__le16 half_way_close_timeout /* Half Way Close Timeout in Option 2 Close */;
1697 	u8 num_sq_pages_in_ring /* Number of entries in the SQ PBL. Provided by driver at function init spe */;
1698 	u8 num_r2tq_pages_in_ring /* Number of entries in the R2TQ PBL. Provided by driver at function init spe */;
1699 	u8 num_uhq_pages_in_ring /* Number of entries in the uHQ PBL (xHQ entries is X2). Provided by driver at function init spe */;
1700 	u8 ll2_rx_queue_id /* Queue ID of the Light-L2 Rx Queue */;
1701 	u8 flags;
1702 #define ISCSI_SPE_FUNC_INIT_COUNTERS_EN_MASK  0x1 /* Enable counters - function and connection counters */
1703 #define ISCSI_SPE_FUNC_INIT_COUNTERS_EN_SHIFT 0
1704 #define ISCSI_SPE_FUNC_INIT_RESERVED0_MASK    0x7F /* reserved */
1705 #define ISCSI_SPE_FUNC_INIT_RESERVED0_SHIFT   1
1706 	struct iscsi_debug_modes debug_mode /* Use iscsi_debug_mode flags */;
1707 	__le16 reserved1;
1708 	__le32 reserved2;
1709 	struct scsi_init_func_params func_params /* Common SCSI init params passed by driver to FW in function init ramrod */;
1710 	struct scsi_init_func_queues q_params /* SCSI RQ/CQ firmware function init parameters */;
1711 };
1712 
1713 /*
1714  * iSCSI task type
1715  */
1716 enum iscsi_task_type
1717 {
1718 	ISCSI_TASK_TYPE_INITIATOR_WRITE,
1719 	ISCSI_TASK_TYPE_INITIATOR_READ,
1720 	ISCSI_TASK_TYPE_MIDPATH,
1721 	ISCSI_TASK_TYPE_UNSOLIC,
1722 	ISCSI_TASK_TYPE_EXCHCLEANUP,
1723 	ISCSI_TASK_TYPE_IRRELEVANT,
1724 	ISCSI_TASK_TYPE_TARGET_WRITE,
1725 	ISCSI_TASK_TYPE_TARGET_READ,
1726 	ISCSI_TASK_TYPE_TARGET_RESPONSE,
1727 	ISCSI_TASK_TYPE_LOGIN_RESPONSE,
1728 	ISCSI_TASK_TYPE_TARGET_IMM_W_DIF,
1729 	MAX_ISCSI_TASK_TYPE
1730 };
1731 
1732 /*
1733  * iSCSI DesiredDataTransferLength/ttt union
1734  */
1735 union iscsi_ttt_txlen_union
1736 {
1737 	__le32 desired_tx_len /* desired data transfer length */;
1738 	__le32 ttt /* target transfer tag */;
1739 };
1740 
1741 /*
1742  * iSCSI uHQ element
1743  */
1744 struct iscsi_uhqe
1745 {
1746 	__le32 reg1;
1747 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_MASK     0xFFFFF /* iSCSI payload (doesnt include padding or digest) or AHS length */
1748 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_SHIFT    0
1749 #define ISCSI_UHQE_LOCAL_COMP_MASK          0x1 /* local compleiton flag */
1750 #define ISCSI_UHQE_LOCAL_COMP_SHIFT         20
1751 #define ISCSI_UHQE_TOGGLE_BIT_MASK          0x1 /* toggle bit to protect from uHQ full */
1752 #define ISCSI_UHQE_TOGGLE_BIT_SHIFT         21
1753 #define ISCSI_UHQE_PURE_PAYLOAD_MASK        0x1 /* indicates whether pdu_payload_len contains pure payload length. if not, pdu_payload_len is AHS length */
1754 #define ISCSI_UHQE_PURE_PAYLOAD_SHIFT       22
1755 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_MASK  0x1 /* indicates login pdu */
1756 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_SHIFT 23
1757 #define ISCSI_UHQE_TASK_ID_HI_MASK          0xFF /* most significant byte of task_id */
1758 #define ISCSI_UHQE_TASK_ID_HI_SHIFT         24
1759 	__le32 reg2;
1760 #define ISCSI_UHQE_BUFFER_OFFSET_MASK       0xFFFFFF /* absolute offset in task */
1761 #define ISCSI_UHQE_BUFFER_OFFSET_SHIFT      0
1762 #define ISCSI_UHQE_TASK_ID_LO_MASK          0xFF /* least significant byte of task_id */
1763 #define ISCSI_UHQE_TASK_ID_LO_SHIFT         24
1764 };
1765 
1766 /*
1767  * iSCSI WQ element
1768  */
1769 struct iscsi_wqe
1770 {
1771 	__le16 task_id /* The task identifier (itt) includes all the relevant information required for the task processing */;
1772 	u8 flags;
1773 #define ISCSI_WQE_WQE_TYPE_MASK  0x7 /* Wqe type [use iscsi_wqe_type] */
1774 #define ISCSI_WQE_WQE_TYPE_SHIFT 0
1775 #define ISCSI_WQE_NUM_SGES_MASK  0xF /* The driver will give a hint about sizes of SGEs for better credits evaluation at Xstorm */
1776 #define ISCSI_WQE_NUM_SGES_SHIFT 3
1777 #define ISCSI_WQE_RESPONSE_MASK  0x1 /* 1 if this Wqe triggers a response and advances stat_sn, 0 otherwise */
1778 #define ISCSI_WQE_RESPONSE_SHIFT 7
1779 	struct iscsi_dif_flags prot_flags /* Task data-integrity flags (protection) */;
1780 	__le32 contlen_cdbsize;
1781 #define ISCSI_WQE_CONT_LEN_MASK  0xFFFFFF /* expected/desired data transfer length */
1782 #define ISCSI_WQE_CONT_LEN_SHIFT 0
1783 #define ISCSI_WQE_CDB_SIZE_MASK  0xFF /* Initiator mode only: equals SCSI command CDB size if extended CDB is used, otherwise equals zero.  */
1784 #define ISCSI_WQE_CDB_SIZE_SHIFT 24
1785 };
1786 
1787 /*
1788  * iSCSI wqe type
1789  */
1790 enum iscsi_wqe_type
1791 {
1792 	ISCSI_WQE_TYPE_NORMAL /* iSCSI WQE type normal. excluding status bit in target mode. */,
1793 	ISCSI_WQE_TYPE_TASK_CLEANUP /* iSCSI WQE type task cleanup */,
1794 	ISCSI_WQE_TYPE_MIDDLE_PATH /* iSCSI WQE type middle path */,
1795 	ISCSI_WQE_TYPE_LOGIN /* iSCSI WQE type login */,
1796 	ISCSI_WQE_TYPE_FIRST_R2T_CONT /* iSCSI WQE type First Write Continuation (Target) */,
1797 	ISCSI_WQE_TYPE_NONFIRST_R2T_CONT /* iSCSI WQE type Non-First Write Continuation (Target) */,
1798 	ISCSI_WQE_TYPE_RESPONSE /* iSCSI WQE type SCSI response */,
1799 	MAX_ISCSI_WQE_TYPE
1800 };
1801 
1802 /*
1803  * iSCSI xHQ element
1804  */
1805 struct iscsi_xhqe
1806 {
1807 	union iscsi_ttt_txlen_union ttt_or_txlen /* iSCSI DesiredDataTransferLength/ttt union */;
1808 	__le32 exp_stat_sn /* expected StatSn */;
1809 	struct iscsi_dif_flags prot_flags /* Task data-integrity flags (protection) */;
1810 	u8 total_ahs_length /* Initiator mode only: Total AHS Length. greater than zero if and only if PDU is SCSI command and CDB > 16 */;
1811 	u8 opcode /* Type opcode for command PDU */;
1812 	u8 flags;
1813 #define ISCSI_XHQE_FINAL_MASK       0x1 /* The Final(F) for this PDU */
1814 #define ISCSI_XHQE_FINAL_SHIFT      0
1815 #define ISCSI_XHQE_STATUS_BIT_MASK  0x1 /* Whether this PDU is Data-In PDU with status_bit = 1 */
1816 #define ISCSI_XHQE_STATUS_BIT_SHIFT 1
1817 #define ISCSI_XHQE_NUM_SGES_MASK    0xF /* If Predicted IO equals Min(8, number of SGEs in SGL), otherwise equals 0 */
1818 #define ISCSI_XHQE_NUM_SGES_SHIFT   2
1819 #define ISCSI_XHQE_RESERVED0_MASK   0x3 /* reserved */
1820 #define ISCSI_XHQE_RESERVED0_SHIFT  6
1821 	union iscsi_seq_num seq_num /* R2T/DataSN sequence number */;
1822 	__le16 reserved1;
1823 };
1824 
1825 /*
1826  * Per PF iSCSI receive path statistics - mStorm RAM structure
1827  */
1828 struct mstorm_iscsi_stats_drv
1829 {
1830 	struct regpair iscsi_rx_dropped_PDUs_task_not_valid /* Number of Rx silently dropped PDUs due to task not valid */;
1831 	struct regpair iscsi_rx_dup_ack_cnt /* Received Dup-ACKs - after 3 dup ack, the counter doesnt count the same dup ack */;
1832 };
1833 
1834 /*
1835  * Per PF iSCSI transmit path statistics - pStorm RAM structure
1836  */
1837 struct pstorm_iscsi_stats_drv
1838 {
1839 	struct regpair iscsi_tx_bytes_cnt /* Counts the number of tx bytes that were transmitted */;
1840 	struct regpair iscsi_tx_packet_cnt /* Counts the number of tx packets that were transmitted */;
1841 };
1842 
1843 /*
1844  * Per PF iSCSI receive path statistics - tStorm RAM structure
1845  */
1846 struct tstorm_iscsi_stats_drv
1847 {
1848 	struct regpair iscsi_rx_bytes_cnt /* Counts the number of rx bytes that were received */;
1849 	struct regpair iscsi_rx_packet_cnt /* Counts the number of rx packets that were received */;
1850 	struct regpair iscsi_rx_new_ooo_isle_events_cnt /* Counts the number of new out-of-order isle event */;
1851 	struct regpair iscsi_rx_tcp_payload_bytes_cnt /* Received In-Order TCP Payload Bytes */;
1852 	struct regpair iscsi_rx_tcp_pkt_cnt /* Received In-Order TCP Packets */;
1853 	struct regpair iscsi_rx_pure_ack_cnt /* Received Pure-ACKs */;
1854 	__le32 iscsi_cmdq_threshold_cnt /* Counts the number of times elements in cmdQ reached threshold */;
1855 	__le32 iscsi_rq_threshold_cnt /* Counts the number of times elements in RQQ reached threshold */;
1856 	__le32 iscsi_immq_threshold_cnt /* Counts the number of times elements in immQ reached threshold */;
1857 };
1858 
1859 /*
1860  * Per PF iSCSI receive path statistics - uStorm RAM structure
1861  */
1862 struct ustorm_iscsi_stats_drv
1863 {
1864 	struct regpair iscsi_rx_data_pdu_cnt /* Number of data PDUs that were received */;
1865 	struct regpair iscsi_rx_r2t_pdu_cnt /* Number of R2T PDUs that were received */;
1866 	struct regpair iscsi_rx_total_pdu_cnt /* Number of total PDUs that were received */;
1867 };
1868 
1869 /*
1870  * Per PF iSCSI transmit path statistics - xStorm RAM structure
1871  */
1872 struct xstorm_iscsi_stats_drv
1873 {
1874 	struct regpair iscsi_tx_go_to_slow_start_event_cnt /* Number of times slow start event occurred */;
1875 	struct regpair iscsi_tx_fast_retransmit_event_cnt /* Number of times fast retransmit event occurred */;
1876 	struct regpair iscsi_tx_pure_ack_cnt /* Transmitted Pure-ACKs */;
1877 	struct regpair iscsi_tx_delayed_ack_cnt /* Transmitted Delayed ACKs */;
1878 };
1879 
1880 /*
1881  * Per PF iSCSI transmit path statistics - yStorm RAM structure
1882  */
1883 struct ystorm_iscsi_stats_drv
1884 {
1885 	struct regpair iscsi_tx_data_pdu_cnt /* Number of data PDUs that were transmitted */;
1886 	struct regpair iscsi_tx_r2t_pdu_cnt /* Number of R2T PDUs that were transmitted */;
1887 	struct regpair iscsi_tx_total_pdu_cnt /* Number of total PDUs that were transmitted */;
1888 	struct regpair iscsi_tx_tcp_payload_bytes_cnt /* Transmitted In-Order TCP Payload Bytes */;
1889 	struct regpair iscsi_tx_tcp_pkt_cnt /* Transmitted In-Order TCP Packets */;
1890 };
1891 
1892 struct e4_tstorm_iscsi_task_ag_ctx
1893 {
1894 	u8 byte0 /* cdu_validation */;
1895 	u8 byte1 /* state */;
1896 	__le16 word0 /* icid */;
1897 	u8 flags0;
1898 #define E4_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK  0xF /* connection_type */
1899 #define E4_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0
1900 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
1901 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT    4
1902 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
1903 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT    5
1904 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK     0x1 /* bit2 */
1905 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT    6
1906 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK     0x1 /* bit3 */
1907 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT    7
1908 	u8 flags1;
1909 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK     0x1 /* bit4 */
1910 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT    0
1911 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK     0x1 /* bit5 */
1912 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT    1
1913 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK      0x3 /* timer0cf */
1914 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT     2
1915 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK      0x3 /* timer1cf */
1916 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT     4
1917 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK      0x3 /* timer2cf */
1918 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT     6
1919 	u8 flags2;
1920 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK      0x3 /* timer_stop_all */
1921 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT     0
1922 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK      0x3 /* cf4 */
1923 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT     2
1924 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK      0x3 /* cf5 */
1925 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT     4
1926 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK      0x3 /* cf6 */
1927 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT     6
1928 	u8 flags3;
1929 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK      0x3 /* cf7 */
1930 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT     0
1931 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
1932 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT   2
1933 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
1934 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT   3
1935 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
1936 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT   4
1937 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK    0x1 /* cf3en */
1938 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT   5
1939 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK    0x1 /* cf4en */
1940 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT   6
1941 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK    0x1 /* cf5en */
1942 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT   7
1943 	u8 flags4;
1944 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK    0x1 /* cf6en */
1945 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT   0
1946 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK    0x1 /* cf7en */
1947 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT   1
1948 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
1949 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2
1950 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
1951 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3
1952 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
1953 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4
1954 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
1955 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5
1956 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
1957 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6
1958 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK  0x1 /* rule5en */
1959 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7
1960 	u8 byte2 /* byte2 */;
1961 	__le16 word1 /* word1 */;
1962 	__le32 reg0 /* reg0 */;
1963 	u8 byte3 /* byte3 */;
1964 	u8 byte4 /* byte4 */;
1965 	__le16 word2 /* word2 */;
1966 	__le16 word3 /* word3 */;
1967 	__le16 word4 /* word4 */;
1968 	__le32 reg1 /* reg1 */;
1969 	__le32 reg2 /* reg2 */;
1970 };
1971 
1972 struct e5_tstorm_iscsi_task_ag_ctx
1973 {
1974 	u8 byte0 /* cdu_validation */;
1975 	u8 byte1 /* state_and_core_id */;
1976 	__le16 word0 /* icid */;
1977 	u8 flags0;
1978 #define E5_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK  0xF /* connection_type */
1979 #define E5_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0
1980 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
1981 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT    4
1982 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
1983 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT    5
1984 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK     0x1 /* bit2 */
1985 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT    6
1986 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK     0x1 /* bit3 */
1987 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT    7
1988 	u8 flags1;
1989 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK     0x1 /* bit4 */
1990 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT    0
1991 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK     0x1 /* bit5 */
1992 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT    1
1993 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK      0x3 /* timer0cf */
1994 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT     2
1995 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK      0x3 /* timer1cf */
1996 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT     4
1997 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK      0x3 /* timer2cf */
1998 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT     6
1999 	u8 flags2;
2000 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK      0x3 /* timer_stop_all */
2001 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT     0
2002 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK      0x3 /* cf4 */
2003 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT     2
2004 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK      0x3 /* cf5 */
2005 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT     4
2006 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK      0x3 /* cf6 */
2007 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT     6
2008 	u8 flags3;
2009 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK      0x3 /* cf7 */
2010 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT     0
2011 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
2012 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT   2
2013 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
2014 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT   3
2015 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
2016 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT   4
2017 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK    0x1 /* cf3en */
2018 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT   5
2019 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK    0x1 /* cf4en */
2020 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT   6
2021 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK    0x1 /* cf5en */
2022 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT   7
2023 	u8 flags4;
2024 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK    0x1 /* cf6en */
2025 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT   0
2026 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK    0x1 /* cf7en */
2027 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT   1
2028 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
2029 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2
2030 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
2031 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3
2032 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
2033 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4
2034 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
2035 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5
2036 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
2037 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6
2038 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK  0x1 /* rule5en */
2039 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7
2040 	u8 byte2 /* byte2 */;
2041 	__le16 word1 /* word1 */;
2042 	__le32 reg0 /* reg0 */;
2043 	u8 byte3 /* regpair0 */;
2044 	u8 byte4 /* byte4 */;
2045 	__le16 word2 /* word2 */;
2046 	__le16 word3 /* word3 */;
2047 	__le16 word4 /* word4 */;
2048 	__le32 reg1 /* regpair1 */;
2049 	__le32 reg2 /* reg2 */;
2050 };
2051 
2052 /*
2053  * iSCSI doorbell data
2054  */
2055 struct iscsi_db_data
2056 {
2057 	u8 params;
2058 #define ISCSI_DB_DATA_DEST_MASK         0x3 /* destination of doorbell (use enum db_dest) */
2059 #define ISCSI_DB_DATA_DEST_SHIFT        0
2060 #define ISCSI_DB_DATA_AGG_CMD_MASK      0x3 /* aggregative command to CM (use enum db_agg_cmd_sel) */
2061 #define ISCSI_DB_DATA_AGG_CMD_SHIFT     2
2062 #define ISCSI_DB_DATA_BYPASS_EN_MASK    0x1 /* enable QM bypass */
2063 #define ISCSI_DB_DATA_BYPASS_EN_SHIFT   4
2064 #define ISCSI_DB_DATA_RESERVED_MASK     0x1
2065 #define ISCSI_DB_DATA_RESERVED_SHIFT    5
2066 #define ISCSI_DB_DATA_AGG_VAL_SEL_MASK  0x3 /* aggregative value selection */
2067 #define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6
2068 	u8 agg_flags /* bit for every DQ counter flags in CM context that DQ can increment */;
2069 	__le16 sq_prod;
2070 };
2071 
2072 #endif /* __ISCSI_COMMON__ */
2073