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