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