blob: 85e086cba639bfd5779237a8db5054cad9956931 [file] [log] [blame]
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001/* QLogic qed NIC Driver
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02002 * Copyright (c) 2015-2017 QLogic Corporation
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03003 *
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02004 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and /or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030031 */
32
33#ifndef __ISCSI_COMMON__
34#define __ISCSI_COMMON__
35/**********************/
36/* ISCSI FW CONSTANTS */
37/**********************/
38
39/* iSCSI HSI constants */
40#define ISCSI_DEFAULT_MTU (1500)
41
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030042/* KWQ (kernel work queue) layer codes */
43#define ISCSI_SLOW_PATH_LAYER_CODE (6)
44
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030045/* iSCSI parameter defaults */
46#define ISCSI_DEFAULT_HEADER_DIGEST (0)
47#define ISCSI_DEFAULT_DATA_DIGEST (0)
48#define ISCSI_DEFAULT_INITIAL_R2T (1)
49#define ISCSI_DEFAULT_IMMEDIATE_DATA (1)
50#define ISCSI_DEFAULT_MAX_PDU_LENGTH (0x2000)
51#define ISCSI_DEFAULT_FIRST_BURST_LENGTH (0x10000)
52#define ISCSI_DEFAULT_MAX_BURST_LENGTH (0x40000)
53#define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T (1)
54
55/* iSCSI parameter limits */
56#define ISCSI_MIN_VAL_MAX_PDU_LENGTH (0x200)
57#define ISCSI_MAX_VAL_MAX_PDU_LENGTH (0xffffff)
58#define ISCSI_MIN_VAL_BURST_LENGTH (0x200)
59#define ISCSI_MAX_VAL_BURST_LENGTH (0xffffff)
60#define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1)
61#define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff)
62
Mintz, Yuvalbe086e72017-03-11 18:39:18 +020063#define ISCSI_AHS_CNTL_SIZE 4
64
65#define ISCSI_WQE_NUM_SGES_SLOWIO (0xf)
66
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030067/* iSCSI reserved params */
68#define ISCSI_ITT_ALL_ONES (0xffffffff)
69#define ISCSI_TTT_ALL_ONES (0xffffffff)
70
71#define ISCSI_OPTION_1_OFF_CHIP_TCP 1
72#define ISCSI_OPTION_2_ON_CHIP_TCP 2
73
74#define ISCSI_INITIATOR_MODE 0
75#define ISCSI_TARGET_MODE 1
76
77/* iSCSI request op codes */
Mintz, Yuval7b6859f2017-05-18 19:41:04 +030078#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)
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030085
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
108struct cqe_error_bitmap {
109 u8 cqe_error_status_bits;
110#define CQE_ERROR_BITMAP_DIF_ERR_BITS_MASK 0x7
111#define CQE_ERROR_BITMAP_DIF_ERR_BITS_SHIFT 0
112#define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_MASK 0x1
113#define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_SHIFT 3
114#define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_MASK 0x1
115#define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_SHIFT 4
116#define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_MASK 0x1
117#define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_SHIFT 5
118#define CQE_ERROR_BITMAP_UNDER_RUN_ERR_MASK 0x1
119#define CQE_ERROR_BITMAP_UNDER_RUN_ERR_SHIFT 6
120#define CQE_ERROR_BITMAP_RESERVED2_MASK 0x1
121#define CQE_ERROR_BITMAP_RESERVED2_SHIFT 7
122};
123
124union cqe_error_status {
125 u8 error_status;
126 struct cqe_error_bitmap error_bits;
127};
128
129struct data_hdr {
130 __le32 data[12];
131};
132
133struct iscsi_async_msg_hdr {
134 __le16 reserved0;
135 u8 flags_attr;
136#define ISCSI_ASYNC_MSG_HDR_RSRV_MASK 0x7F
137#define ISCSI_ASYNC_MSG_HDR_RSRV_SHIFT 0
138#define ISCSI_ASYNC_MSG_HDR_CONST1_MASK 0x1
139#define ISCSI_ASYNC_MSG_HDR_CONST1_SHIFT 7
140 u8 opcode;
141 __le32 hdr_second_dword;
142#define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
143#define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_SHIFT 0
144#define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_MASK 0xFF
145#define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_SHIFT 24
146 struct regpair lun;
147 __le32 all_ones;
148 __le32 reserved1;
149 __le32 stat_sn;
150 __le32 exp_cmd_sn;
151 __le32 max_cmd_sn;
152 __le16 param1_rsrv;
153 u8 async_vcode;
154 u8 async_event;
155 __le16 param3_rsrv;
156 __le16 param2_rsrv;
157 __le32 reserved7;
158};
159
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300160struct iscsi_cmd_hdr {
161 __le16 reserved1;
162 u8 flags_attr;
Mintz, Yuval7b6859f2017-05-18 19:41:04 +0300163#define ISCSI_CMD_HDR_ATTR_MASK 0x7
164#define ISCSI_CMD_HDR_ATTR_SHIFT 0
165#define ISCSI_CMD_HDR_RSRV_MASK 0x3
166#define ISCSI_CMD_HDR_RSRV_SHIFT 3
167#define ISCSI_CMD_HDR_WRITE_MASK 0x1
168#define ISCSI_CMD_HDR_WRITE_SHIFT 5
169#define ISCSI_CMD_HDR_READ_MASK 0x1
170#define ISCSI_CMD_HDR_READ_SHIFT 6
171#define ISCSI_CMD_HDR_FINAL_MASK 0x1
172#define ISCSI_CMD_HDR_FINAL_SHIFT 7
173 u8 hdr_first_byte;
174#define ISCSI_CMD_HDR_OPCODE_MASK 0x3F
175#define ISCSI_CMD_HDR_OPCODE_SHIFT 0
176#define ISCSI_CMD_HDR_IMM_MASK 0x1
177#define ISCSI_CMD_HDR_IMM_SHIFT 6
178#define ISCSI_CMD_HDR_RSRV1_MASK 0x1
179#define ISCSI_CMD_HDR_RSRV1_SHIFT 7
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300180 __le32 hdr_second_dword;
181#define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
182#define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT 0
183#define ISCSI_CMD_HDR_TOTAL_AHS_LEN_MASK 0xFF
184#define ISCSI_CMD_HDR_TOTAL_AHS_LEN_SHIFT 24
185 struct regpair lun;
186 __le32 itt;
187 __le32 expected_transfer_length;
188 __le32 cmd_sn;
189 __le32 exp_stat_sn;
190 __le32 cdb[4];
191};
192
193struct iscsi_common_hdr {
194 u8 hdr_status;
195 u8 hdr_response;
196 u8 hdr_flags;
197 u8 hdr_first_byte;
198#define ISCSI_COMMON_HDR_OPCODE_MASK 0x3F
199#define ISCSI_COMMON_HDR_OPCODE_SHIFT 0
200#define ISCSI_COMMON_HDR_IMM_MASK 0x1
201#define ISCSI_COMMON_HDR_IMM_SHIFT 6
202#define ISCSI_COMMON_HDR_RSRV_MASK 0x1
203#define ISCSI_COMMON_HDR_RSRV_SHIFT 7
204 __le32 hdr_second_dword;
205#define ISCSI_COMMON_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
206#define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT 0
207#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK 0xFF
208#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200209 struct regpair lun_reserved;
210 __le32 itt;
211 __le32 ttt;
212 __le32 cmdstat_sn;
213 __le32 exp_statcmd_sn;
214 __le32 max_cmd_sn;
215 __le32 data[3];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300216};
217
218struct iscsi_conn_offload_params {
219 struct regpair sq_pbl_addr;
220 struct regpair r2tq_pbl_addr;
221 struct regpair xhq_pbl_addr;
222 struct regpair uhq_pbl_addr;
223 __le32 initial_ack;
224 __le16 physical_q0;
225 __le16 physical_q1;
226 u8 flags;
227#define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_MASK 0x1
228#define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT 0
229#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK 0x1
230#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT 1
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200231#define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_MASK 0x1
232#define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_SHIFT 2
233#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK 0x1F
234#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT 3
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300235 u8 pbl_page_size_log;
236 u8 pbe_page_size_log;
237 u8 default_cq;
238 __le32 stat_sn;
239};
240
241struct iscsi_slow_path_hdr {
242 u8 op_code;
243 u8 flags;
244#define ISCSI_SLOW_PATH_HDR_RESERVED0_MASK 0xF
245#define ISCSI_SLOW_PATH_HDR_RESERVED0_SHIFT 0
246#define ISCSI_SLOW_PATH_HDR_LAYER_CODE_MASK 0x7
247#define ISCSI_SLOW_PATH_HDR_LAYER_CODE_SHIFT 4
248#define ISCSI_SLOW_PATH_HDR_RESERVED1_MASK 0x1
249#define ISCSI_SLOW_PATH_HDR_RESERVED1_SHIFT 7
250};
251
252struct iscsi_conn_update_ramrod_params {
253 struct iscsi_slow_path_hdr hdr;
254 __le16 conn_id;
255 __le32 fw_cid;
256 u8 flags;
257#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_MASK 0x1
258#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_SHIFT 0
259#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_MASK 0x1
260#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_SHIFT 1
261#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_MASK 0x1
262#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT 2
263#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK 0x1
264#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200265#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_MASK 0x1
266#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_SHIFT 4
267#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_MASK 0x1
268#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_SHIFT 5
269#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_MASK 0x3
270#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_SHIFT 6
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300271 u8 reserved0[3];
272 __le32 max_seq_size;
273 __le32 max_send_pdu_length;
274 __le32 max_recv_pdu_length;
275 __le32 first_seq_length;
276 __le32 exp_stat_sn;
277};
278
279struct iscsi_ext_cdb_cmd_hdr {
280 __le16 reserved1;
281 u8 flags_attr;
282#define ISCSI_EXT_CDB_CMD_HDR_ATTR_MASK 0x7
283#define ISCSI_EXT_CDB_CMD_HDR_ATTR_SHIFT 0
284#define ISCSI_EXT_CDB_CMD_HDR_RSRV_MASK 0x3
285#define ISCSI_EXT_CDB_CMD_HDR_RSRV_SHIFT 3
286#define ISCSI_EXT_CDB_CMD_HDR_WRITE_MASK 0x1
287#define ISCSI_EXT_CDB_CMD_HDR_WRITE_SHIFT 5
288#define ISCSI_EXT_CDB_CMD_HDR_READ_MASK 0x1
289#define ISCSI_EXT_CDB_CMD_HDR_READ_SHIFT 6
290#define ISCSI_EXT_CDB_CMD_HDR_FINAL_MASK 0x1
291#define ISCSI_EXT_CDB_CMD_HDR_FINAL_SHIFT 7
292 u8 opcode;
293 __le32 hdr_second_dword;
294#define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
295#define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_SHIFT 0
296#define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_MASK 0xFF
297#define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_SHIFT 24
298 struct regpair lun;
299 __le32 itt;
300 __le32 expected_transfer_length;
301 __le32 cmd_sn;
302 __le32 exp_stat_sn;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200303 struct scsi_sge cdb_sge;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300304};
305
306struct iscsi_login_req_hdr {
307 u8 version_min;
308 u8 version_max;
309 u8 flags_attr;
310#define ISCSI_LOGIN_REQ_HDR_NSG_MASK 0x3
311#define ISCSI_LOGIN_REQ_HDR_NSG_SHIFT 0
312#define ISCSI_LOGIN_REQ_HDR_CSG_MASK 0x3
313#define ISCSI_LOGIN_REQ_HDR_CSG_SHIFT 2
314#define ISCSI_LOGIN_REQ_HDR_RSRV_MASK 0x3
315#define ISCSI_LOGIN_REQ_HDR_RSRV_SHIFT 4
316#define ISCSI_LOGIN_REQ_HDR_C_MASK 0x1
317#define ISCSI_LOGIN_REQ_HDR_C_SHIFT 6
318#define ISCSI_LOGIN_REQ_HDR_T_MASK 0x1
319#define ISCSI_LOGIN_REQ_HDR_T_SHIFT 7
320 u8 opcode;
321 __le32 hdr_second_dword;
322#define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
323#define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_SHIFT 0
324#define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_MASK 0xFF
325#define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_SHIFT 24
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300326 __le32 isid_tabc;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300327 __le16 tsih;
328 __le16 isid_d;
329 __le32 itt;
330 __le16 reserved1;
331 __le16 cid;
332 __le32 cmd_sn;
333 __le32 exp_stat_sn;
334 __le32 reserved2[4];
335};
336
337struct iscsi_logout_req_hdr {
338 __le16 reserved0;
339 u8 reason_code;
340 u8 opcode;
341 __le32 reserved1;
342 __le32 reserved2[2];
343 __le32 itt;
344 __le16 reserved3;
345 __le16 cid;
346 __le32 cmd_sn;
347 __le32 exp_stat_sn;
348 __le32 reserved4[4];
349};
350
351struct iscsi_data_out_hdr {
352 __le16 reserved1;
353 u8 flags_attr;
354#define ISCSI_DATA_OUT_HDR_RSRV_MASK 0x7F
355#define ISCSI_DATA_OUT_HDR_RSRV_SHIFT 0
356#define ISCSI_DATA_OUT_HDR_FINAL_MASK 0x1
357#define ISCSI_DATA_OUT_HDR_FINAL_SHIFT 7
358 u8 opcode;
359 __le32 reserved2;
360 struct regpair lun;
361 __le32 itt;
362 __le32 ttt;
363 __le32 reserved3;
364 __le32 exp_stat_sn;
365 __le32 reserved4;
366 __le32 data_sn;
367 __le32 buffer_offset;
368 __le32 reserved5;
369};
370
371struct iscsi_data_in_hdr {
372 u8 status_rsvd;
373 u8 reserved1;
374 u8 flags;
375#define ISCSI_DATA_IN_HDR_STATUS_MASK 0x1
376#define ISCSI_DATA_IN_HDR_STATUS_SHIFT 0
377#define ISCSI_DATA_IN_HDR_UNDERFLOW_MASK 0x1
378#define ISCSI_DATA_IN_HDR_UNDERFLOW_SHIFT 1
379#define ISCSI_DATA_IN_HDR_OVERFLOW_MASK 0x1
380#define ISCSI_DATA_IN_HDR_OVERFLOW_SHIFT 2
381#define ISCSI_DATA_IN_HDR_RSRV_MASK 0x7
382#define ISCSI_DATA_IN_HDR_RSRV_SHIFT 3
383#define ISCSI_DATA_IN_HDR_ACK_MASK 0x1
384#define ISCSI_DATA_IN_HDR_ACK_SHIFT 6
385#define ISCSI_DATA_IN_HDR_FINAL_MASK 0x1
386#define ISCSI_DATA_IN_HDR_FINAL_SHIFT 7
387 u8 opcode;
388 __le32 reserved2;
389 struct regpair lun;
390 __le32 itt;
391 __le32 ttt;
392 __le32 stat_sn;
393 __le32 exp_cmd_sn;
394 __le32 max_cmd_sn;
395 __le32 data_sn;
396 __le32 buffer_offset;
397 __le32 residual_count;
398};
399
400struct iscsi_r2t_hdr {
401 u8 reserved0[3];
402 u8 opcode;
403 __le32 reserved2;
404 struct regpair lun;
405 __le32 itt;
406 __le32 ttt;
407 __le32 stat_sn;
408 __le32 exp_cmd_sn;
409 __le32 max_cmd_sn;
410 __le32 r2t_sn;
411 __le32 buffer_offset;
412 __le32 desired_data_trns_len;
413};
414
415struct iscsi_nop_out_hdr {
416 __le16 reserved1;
417 u8 flags_attr;
418#define ISCSI_NOP_OUT_HDR_RSRV_MASK 0x7F
419#define ISCSI_NOP_OUT_HDR_RSRV_SHIFT 0
420#define ISCSI_NOP_OUT_HDR_CONST1_MASK 0x1
421#define ISCSI_NOP_OUT_HDR_CONST1_SHIFT 7
422 u8 opcode;
423 __le32 reserved2;
424 struct regpair lun;
425 __le32 itt;
426 __le32 ttt;
427 __le32 cmd_sn;
428 __le32 exp_stat_sn;
429 __le32 reserved3;
430 __le32 reserved4;
431 __le32 reserved5;
432 __le32 reserved6;
433};
434
435struct iscsi_nop_in_hdr {
436 __le16 reserved0;
437 u8 flags_attr;
438#define ISCSI_NOP_IN_HDR_RSRV_MASK 0x7F
439#define ISCSI_NOP_IN_HDR_RSRV_SHIFT 0
440#define ISCSI_NOP_IN_HDR_CONST1_MASK 0x1
441#define ISCSI_NOP_IN_HDR_CONST1_SHIFT 7
442 u8 opcode;
443 __le32 hdr_second_dword;
444#define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
445#define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_SHIFT 0
446#define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_MASK 0xFF
447#define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_SHIFT 24
448 struct regpair lun;
449 __le32 itt;
450 __le32 ttt;
451 __le32 stat_sn;
452 __le32 exp_cmd_sn;
453 __le32 max_cmd_sn;
454 __le32 reserved5;
455 __le32 reserved6;
456 __le32 reserved7;
457};
458
459struct iscsi_login_response_hdr {
460 u8 version_active;
461 u8 version_max;
462 u8 flags_attr;
463#define ISCSI_LOGIN_RESPONSE_HDR_NSG_MASK 0x3
464#define ISCSI_LOGIN_RESPONSE_HDR_NSG_SHIFT 0
465#define ISCSI_LOGIN_RESPONSE_HDR_CSG_MASK 0x3
466#define ISCSI_LOGIN_RESPONSE_HDR_CSG_SHIFT 2
467#define ISCSI_LOGIN_RESPONSE_HDR_RSRV_MASK 0x3
468#define ISCSI_LOGIN_RESPONSE_HDR_RSRV_SHIFT 4
469#define ISCSI_LOGIN_RESPONSE_HDR_C_MASK 0x1
470#define ISCSI_LOGIN_RESPONSE_HDR_C_SHIFT 6
471#define ISCSI_LOGIN_RESPONSE_HDR_T_MASK 0x1
472#define ISCSI_LOGIN_RESPONSE_HDR_T_SHIFT 7
473 u8 opcode;
474 __le32 hdr_second_dword;
475#define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
476#define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0
477#define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF
478#define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300479 __le32 isid_tabc;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300480 __le16 tsih;
481 __le16 isid_d;
482 __le32 itt;
483 __le32 reserved1;
484 __le32 stat_sn;
485 __le32 exp_cmd_sn;
486 __le32 max_cmd_sn;
487 __le16 reserved2;
488 u8 status_detail;
489 u8 status_class;
490 __le32 reserved4[2];
491};
492
493struct iscsi_logout_response_hdr {
494 u8 reserved1;
495 u8 response;
496 u8 flags;
497 u8 opcode;
498 __le32 hdr_second_dword;
499#define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
500#define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0
501#define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF
502#define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
503 __le32 reserved2[2];
504 __le32 itt;
505 __le32 reserved3;
506 __le32 stat_sn;
507 __le32 exp_cmd_sn;
508 __le32 max_cmd_sn;
509 __le32 reserved4;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200510 __le16 time_2_retain;
511 __le16 time_2_wait;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300512 __le32 reserved5[1];
513};
514
515struct iscsi_text_request_hdr {
516 __le16 reserved0;
517 u8 flags_attr;
518#define ISCSI_TEXT_REQUEST_HDR_RSRV_MASK 0x3F
519#define ISCSI_TEXT_REQUEST_HDR_RSRV_SHIFT 0
520#define ISCSI_TEXT_REQUEST_HDR_C_MASK 0x1
521#define ISCSI_TEXT_REQUEST_HDR_C_SHIFT 6
522#define ISCSI_TEXT_REQUEST_HDR_F_MASK 0x1
523#define ISCSI_TEXT_REQUEST_HDR_F_SHIFT 7
524 u8 opcode;
525 __le32 hdr_second_dword;
526#define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
527#define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0
528#define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF
529#define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24
530 struct regpair lun;
531 __le32 itt;
532 __le32 ttt;
533 __le32 cmd_sn;
534 __le32 exp_stat_sn;
535 __le32 reserved4[4];
536};
537
538struct iscsi_text_response_hdr {
539 __le16 reserved1;
540 u8 flags;
541#define ISCSI_TEXT_RESPONSE_HDR_RSRV_MASK 0x3F
542#define ISCSI_TEXT_RESPONSE_HDR_RSRV_SHIFT 0
543#define ISCSI_TEXT_RESPONSE_HDR_C_MASK 0x1
544#define ISCSI_TEXT_RESPONSE_HDR_C_SHIFT 6
545#define ISCSI_TEXT_RESPONSE_HDR_F_MASK 0x1
546#define ISCSI_TEXT_RESPONSE_HDR_F_SHIFT 7
547 u8 opcode;
548 __le32 hdr_second_dword;
549#define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
550#define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0
551#define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF
552#define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
553 struct regpair lun;
554 __le32 itt;
555 __le32 ttt;
556 __le32 stat_sn;
557 __le32 exp_cmd_sn;
558 __le32 max_cmd_sn;
559 __le32 reserved4[3];
560};
561
562struct iscsi_tmf_request_hdr {
563 __le16 reserved0;
564 u8 function;
565 u8 opcode;
566 __le32 hdr_second_dword;
567#define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
568#define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0
569#define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF
570#define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24
571 struct regpair lun;
572 __le32 itt;
573 __le32 rtt;
574 __le32 cmd_sn;
575 __le32 exp_stat_sn;
576 __le32 ref_cmd_sn;
577 __le32 exp_data_sn;
578 __le32 reserved4[2];
579};
580
581struct iscsi_tmf_response_hdr {
582 u8 reserved2;
583 u8 hdr_response;
584 u8 hdr_flags;
585 u8 opcode;
586 __le32 hdr_second_dword;
587#define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
588#define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0
589#define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF
590#define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
591 struct regpair reserved0;
592 __le32 itt;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200593 __le32 reserved1;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300594 __le32 stat_sn;
595 __le32 exp_cmd_sn;
596 __le32 max_cmd_sn;
597 __le32 reserved4[3];
598};
599
600struct iscsi_response_hdr {
601 u8 hdr_status;
602 u8 hdr_response;
603 u8 hdr_flags;
604 u8 opcode;
605 __le32 hdr_second_dword;
606#define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
607#define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0
608#define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF
609#define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
610 struct regpair lun;
611 __le32 itt;
612 __le32 snack_tag;
613 __le32 stat_sn;
614 __le32 exp_cmd_sn;
615 __le32 max_cmd_sn;
616 __le32 exp_data_sn;
617 __le32 bi_residual_count;
618 __le32 residual_count;
619};
620
621struct iscsi_reject_hdr {
622 u8 reserved4;
623 u8 hdr_reason;
624 u8 hdr_flags;
625 u8 opcode;
626 __le32 hdr_second_dword;
627#define ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
628#define ISCSI_REJECT_HDR_DATA_SEG_LEN_SHIFT 0
629#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK 0xFF
630#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24
631 struct regpair reserved0;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200632 __le32 all_ones;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300633 __le32 reserved2;
634 __le32 stat_sn;
635 __le32 exp_cmd_sn;
636 __le32 max_cmd_sn;
637 __le32 data_sn;
638 __le32 reserved3[2];
639};
640
641union iscsi_task_hdr {
642 struct iscsi_common_hdr common;
643 struct data_hdr data;
644 struct iscsi_cmd_hdr cmd;
645 struct iscsi_ext_cdb_cmd_hdr ext_cdb_cmd;
646 struct iscsi_login_req_hdr login_req;
647 struct iscsi_logout_req_hdr logout_req;
648 struct iscsi_data_out_hdr data_out;
649 struct iscsi_data_in_hdr data_in;
650 struct iscsi_r2t_hdr r2t;
651 struct iscsi_nop_out_hdr nop_out;
652 struct iscsi_nop_in_hdr nop_in;
653 struct iscsi_login_response_hdr login_response;
654 struct iscsi_logout_response_hdr logout_response;
655 struct iscsi_text_request_hdr text_request;
656 struct iscsi_text_response_hdr text_response;
657 struct iscsi_tmf_request_hdr tmf_request;
658 struct iscsi_tmf_response_hdr tmf_response;
659 struct iscsi_response_hdr response;
660 struct iscsi_reject_hdr reject;
661 struct iscsi_async_msg_hdr async_msg;
662};
663
664struct iscsi_cqe_common {
665 __le16 conn_id;
666 u8 cqe_type;
667 union cqe_error_status error_bitmap;
668 __le32 reserved[3];
669 union iscsi_task_hdr iscsi_hdr;
670};
671
672struct iscsi_cqe_solicited {
673 __le16 conn_id;
674 u8 cqe_type;
675 union cqe_error_status error_bitmap;
676 __le16 itid;
677 u8 task_type;
678 u8 fw_dbg_field;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200679 u8 caused_conn_err;
680 u8 reserved0[3];
681 __le32 reserved1[1];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300682 union iscsi_task_hdr iscsi_hdr;
683};
684
685struct iscsi_cqe_unsolicited {
686 __le16 conn_id;
687 u8 cqe_type;
688 union cqe_error_status error_bitmap;
689 __le16 reserved0;
690 u8 reserved1;
691 u8 unsol_cqe_type;
692 struct regpair rqe_opaque;
693 union iscsi_task_hdr iscsi_hdr;
694};
695
696union iscsi_cqe {
697 struct iscsi_cqe_common cqe_common;
698 struct iscsi_cqe_solicited cqe_solicited;
699 struct iscsi_cqe_unsolicited cqe_unsolicited;
700};
701
702enum iscsi_cqes_type {
703 ISCSI_CQE_TYPE_SOLICITED = 1,
704 ISCSI_CQE_TYPE_UNSOLICITED,
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300705 ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300706 ISCSI_CQE_TYPE_TASK_CLEANUP,
707 ISCSI_CQE_TYPE_DUMMY,
708 MAX_ISCSI_CQES_TYPE
709};
710
711enum iscsi_cqe_unsolicited_type {
712 ISCSI_CQE_UNSOLICITED_NONE,
713 ISCSI_CQE_UNSOLICITED_SINGLE,
714 ISCSI_CQE_UNSOLICITED_FIRST,
715 ISCSI_CQE_UNSOLICITED_MIDDLE,
716 ISCSI_CQE_UNSOLICITED_LAST,
717 MAX_ISCSI_CQE_UNSOLICITED_TYPE
718};
719
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300720
721struct iscsi_debug_modes {
722 u8 flags;
723#define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_MASK 0x1
724#define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_SHIFT 0
725#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_MASK 0x1
726#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_SHIFT 1
727#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_MASK 0x1
728#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_SHIFT 2
729#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_MASK 0x1
730#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_SHIFT 3
731#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_MASK 0x1
732#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT 4
733#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK 0x1
734#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT 5
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200735#define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_MASK 0x1
736#define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_SHIFT 6
737#define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_MASK 0x1
738#define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_SHIFT 7
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300739};
740
741struct iscsi_dif_flags {
742 u8 flags;
743#define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_MASK 0xF
744#define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_SHIFT 0
745#define ISCSI_DIF_FLAGS_DIF_TO_PEER_MASK 0x1
746#define ISCSI_DIF_FLAGS_DIF_TO_PEER_SHIFT 4
747#define ISCSI_DIF_FLAGS_HOST_INTERFACE_MASK 0x7
748#define ISCSI_DIF_FLAGS_HOST_INTERFACE_SHIFT 5
749};
750
751enum iscsi_eqe_opcode {
752 ISCSI_EVENT_TYPE_INIT_FUNC = 0,
753 ISCSI_EVENT_TYPE_DESTROY_FUNC,
754 ISCSI_EVENT_TYPE_OFFLOAD_CONN,
755 ISCSI_EVENT_TYPE_UPDATE_CONN,
756 ISCSI_EVENT_TYPE_CLEAR_SQ,
757 ISCSI_EVENT_TYPE_TERMINATE_CONN,
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300758 ISCSI_EVENT_TYPE_MAC_UPDATE_CONN,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300759 ISCSI_EVENT_TYPE_ASYN_CONNECT_COMPLETE,
760 ISCSI_EVENT_TYPE_ASYN_TERMINATE_DONE,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300761 RESERVED9,
762 ISCSI_EVENT_TYPE_START_OF_ERROR_TYPES = 10,
763 ISCSI_EVENT_TYPE_ASYN_ABORT_RCVD,
764 ISCSI_EVENT_TYPE_ASYN_CLOSE_RCVD,
765 ISCSI_EVENT_TYPE_ASYN_SYN_RCVD,
766 ISCSI_EVENT_TYPE_ASYN_MAX_RT_TIME,
767 ISCSI_EVENT_TYPE_ASYN_MAX_RT_CNT,
768 ISCSI_EVENT_TYPE_ASYN_MAX_KA_PROBES_CNT,
769 ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2,
770 ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR,
771 ISCSI_EVENT_TYPE_TCP_CONN_ERROR,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300772 MAX_ISCSI_EQE_OPCODE
773};
774
775enum iscsi_error_types {
776 ISCSI_STATUS_NONE = 0,
777 ISCSI_CQE_ERROR_UNSOLICITED_RCV_ON_INVALID_CONN = 1,
778 ISCSI_CONN_ERROR_TASK_CID_MISMATCH,
779 ISCSI_CONN_ERROR_TASK_NOT_VALID,
780 ISCSI_CONN_ERROR_RQ_RING_IS_FULL,
781 ISCSI_CONN_ERROR_CMDQ_RING_IS_FULL,
782 ISCSI_CONN_ERROR_HQE_CACHING_FAILED,
783 ISCSI_CONN_ERROR_HEADER_DIGEST_ERROR,
784 ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR,
785 ISCSI_CONN_ERROR_DATA_OVERRUN,
786 ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR,
Mintz, Yuval7b6859f2017-05-18 19:41:04 +0300787 ISCSI_CONN_ERROR_IP_OPTIONS_ERROR,
788 ISCSI_CONN_ERROR_PRS_ERRORS,
789 ISCSI_CONN_ERROR_CONNECT_INVALID_TCP_OPTION,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300790 ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR,
791 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN,
792 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE,
793 ISCSI_CONN_ERROR_PROTOCOL_ERR_ITT_OUT_OF_RANGE,
794 ISCSI_CONN_ERROR_PROTOCOL_ERR_TTT_OUT_OF_RANGE,
795 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_EXCEEDS_PDU_SIZE,
796 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE,
797 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE_BEFORE_UPDATE,
798 ISCSI_CONN_ERROR_UNVALID_NOPIN_DSL,
799 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_CARRIES_NO_DATA,
800 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SN,
801 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_IN_TTT,
802 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_OUT_ITT,
803 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_TTT,
804 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_BUFFER_OFFSET,
805 ISCSI_CONN_ERROR_PROTOCOL_ERR_BUFFER_OFFSET_OOO,
806 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_SN,
807 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0,
808 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1,
809 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_2,
810 ISCSI_CONN_ERROR_PROTOCOL_ERR_LUN,
811 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO,
812 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO_S_BIT_ONE,
813 ISCSI_CONN_ERROR_PROTOCOL_ERR_EXP_STAT_SN,
814 ISCSI_CONN_ERROR_PROTOCOL_ERR_DSL_NOT_ZERO,
815 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_DSL,
816 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG,
817 ISCSI_CONN_ERROR_PROTOCOL_ERR_OUTSTANDING_R2T_COUNT,
818 ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX,
819 ISCSI_CONN_ERROR_SENSE_DATA_LENGTH,
820 ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR,
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200821 ISCSI_CONN_ERROR_INVALID_ITT,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300822 ISCSI_ERROR_UNKNOWN,
823 MAX_ISCSI_ERROR_TYPES
824};
825
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300826
827enum iscsi_ramrod_cmd_id {
828 ISCSI_RAMROD_CMD_ID_UNUSED = 0,
829 ISCSI_RAMROD_CMD_ID_INIT_FUNC = 1,
830 ISCSI_RAMROD_CMD_ID_DESTROY_FUNC = 2,
831 ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN = 3,
832 ISCSI_RAMROD_CMD_ID_UPDATE_CONN = 4,
833 ISCSI_RAMROD_CMD_ID_TERMINATION_CONN = 5,
834 ISCSI_RAMROD_CMD_ID_CLEAR_SQ = 6,
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300835 ISCSI_RAMROD_CMD_ID_MAC_UPDATE = 7,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300836 MAX_ISCSI_RAMROD_CMD_ID
837};
838
839struct iscsi_reg1 {
840 __le32 reg1_map;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200841#define ISCSI_REG1_NUM_SGES_MASK 0xF
842#define ISCSI_REG1_NUM_SGES_SHIFT 0
843#define ISCSI_REG1_RESERVED1_MASK 0xFFFFFFF
844#define ISCSI_REG1_RESERVED1_SHIFT 4
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300845};
846
847union iscsi_seq_num {
848 __le16 data_sn;
849 __le16 r2t_sn;
850};
851
Yuval Mintz05fafbf2016-08-19 09:33:31 +0300852struct iscsi_spe_conn_mac_update {
853 struct iscsi_slow_path_hdr hdr;
854 __le16 conn_id;
855 __le32 fw_cid;
856 __le16 remote_mac_addr_lo;
857 __le16 remote_mac_addr_mid;
858 __le16 remote_mac_addr_hi;
859 u8 reserved0[2];
860};
861
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300862struct iscsi_spe_conn_offload {
863 struct iscsi_slow_path_hdr hdr;
864 __le16 conn_id;
865 __le32 fw_cid;
866 struct iscsi_conn_offload_params iscsi;
867 struct tcp_offload_params tcp;
868};
869
870struct iscsi_spe_conn_offload_option2 {
871 struct iscsi_slow_path_hdr hdr;
872 __le16 conn_id;
873 __le32 fw_cid;
874 struct iscsi_conn_offload_params iscsi;
875 struct tcp_offload_params_opt2 tcp;
876};
877
878struct iscsi_spe_conn_termination {
879 struct iscsi_slow_path_hdr hdr;
880 __le16 conn_id;
881 __le32 fw_cid;
882 u8 abortive;
883 u8 reserved0[7];
884 struct regpair queue_cnts_addr;
885 struct regpair query_params_addr;
886};
887
888struct iscsi_spe_func_dstry {
889 struct iscsi_slow_path_hdr hdr;
890 __le16 reserved0;
891 __le32 reserved1;
892};
893
894struct iscsi_spe_func_init {
895 struct iscsi_slow_path_hdr hdr;
896 __le16 half_way_close_timeout;
897 u8 num_sq_pages_in_ring;
898 u8 num_r2tq_pages_in_ring;
899 u8 num_uhq_pages_in_ring;
900 u8 ll2_rx_queue_id;
901 u8 ooo_enable;
902 struct iscsi_debug_modes debug_mode;
903 __le16 reserved1;
904 __le32 reserved2;
905 __le32 reserved3;
906 __le32 reserved4;
907 struct scsi_init_func_params func_params;
908 struct scsi_init_func_queues q_params;
909};
910
911struct ystorm_iscsi_task_state {
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200912 struct scsi_cached_sges data_desc;
913 struct scsi_sgl_params sgl_params;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300914 __le32 exp_r2t_sn;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200915 __le32 buffer_offset;
916 union iscsi_seq_num seq_num;
917 struct iscsi_dif_flags dif_flags;
918 u8 flags;
919#define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_MASK 0x1
920#define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_SHIFT 0
921#define YSTORM_ISCSI_TASK_STATE_SLOW_IO_MASK 0x1
922#define YSTORM_ISCSI_TASK_STATE_SLOW_IO_SHIFT 1
923#define YSTORM_ISCSI_TASK_STATE_RESERVED0_MASK 0x3F
924#define YSTORM_ISCSI_TASK_STATE_RESERVED0_SHIFT 2
925};
926
927struct ystorm_iscsi_task_rxmit_opt {
928 __le32 fast_rxmit_sge_offset;
929 __le32 scan_start_buffer_offset;
930 __le32 fast_rxmit_buffer_offset;
931 u8 scan_start_sgl_index;
932 u8 fast_rxmit_sgl_index;
933 __le16 reserved;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300934};
935
936struct ystorm_iscsi_task_st_ctx {
937 struct ystorm_iscsi_task_state state;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200938 struct ystorm_iscsi_task_rxmit_opt rxmit_opt;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300939 union iscsi_task_hdr pdu_hdr;
940};
941
942struct ystorm_iscsi_task_ag_ctx {
943 u8 reserved;
944 u8 byte1;
945 __le16 word0;
946 u8 flags0;
947#define YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF
948#define YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0
949#define YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1
950#define YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4
951#define YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1
952#define YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5
953#define YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1
954#define YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6
955#define YSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1
956#define YSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7
957 u8 flags1;
958#define YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3
959#define YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 0
960#define YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3
961#define YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2
962#define YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK 0x3
963#define YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT 4
964#define YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1
965#define YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 6
966#define YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1
967#define YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7
968 u8 flags2;
969#define YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1
970#define YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0
971#define YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1
972#define YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1
973#define YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1
974#define YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2
975#define YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1
976#define YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3
977#define YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1
978#define YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4
979#define YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1
980#define YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5
981#define YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1
982#define YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6
983#define YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1
984#define YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7
985 u8 byte2;
986 __le32 TTT;
987 u8 byte3;
988 u8 byte4;
989 __le16 word1;
990};
991
992struct mstorm_iscsi_task_ag_ctx {
993 u8 cdu_validation;
994 u8 byte1;
995 __le16 task_cid;
996 u8 flags0;
997#define MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF
998#define MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0
999#define MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1
1000#define MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4
1001#define MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1
1002#define MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5
1003#define MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1
1004#define MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6
1005#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1
1006#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT 7
1007 u8 flags1;
1008#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK 0x3
1009#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT 0
1010#define MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3
1011#define MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2
1012#define MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3
1013#define MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 4
1014#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK 0x1
1015#define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6
1016#define MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1
1017#define MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7
1018 u8 flags2;
1019#define MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1
1020#define MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 0
1021#define MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1
1022#define MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1
1023#define MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1
1024#define MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2
1025#define MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1
1026#define MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3
1027#define MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1
1028#define MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4
1029#define MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1
1030#define MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5
1031#define MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1
1032#define MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6
1033#define MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1
1034#define MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7
1035 u8 byte2;
1036 __le32 reg0;
1037 u8 byte3;
1038 u8 byte4;
1039 __le16 word1;
1040};
1041
1042struct ustorm_iscsi_task_ag_ctx {
1043 u8 reserved;
1044 u8 state;
1045 __le16 icid;
1046 u8 flags0;
1047#define USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF
1048#define USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0
1049#define USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1
1050#define USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4
1051#define USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1
1052#define USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5
1053#define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3
1054#define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6
1055 u8 flags1;
1056#define USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK 0x3
1057#define USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT 0
1058#define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK 0x3
1059#define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT 2
1060#define USTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3
1061#define USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 4
1062#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK 0x3
1063#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT 6
1064 u8 flags2;
1065#define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK 0x1
1066#define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT 0
1067#define USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK 0x1
1068#define USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT 1
1069#define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK 0x1
1070#define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT 2
1071#define USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1
1072#define USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 3
1073#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK 0x1
1074#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT 4
1075#define USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK 0x1
1076#define USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5
1077#define USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1
1078#define USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 6
1079#define USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK 0x1
1080#define USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT 7
1081 u8 flags3;
1082#define USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1
1083#define USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 0
1084#define USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1
1085#define USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 1
1086#define USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1
1087#define USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 2
1088#define USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1
1089#define USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 3
1090#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK 0xF
1091#define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT 4
1092 __le32 dif_err_intervals;
1093 __le32 dif_error_1st_interval;
1094 __le32 rcv_cont_len;
1095 __le32 exp_cont_len;
1096 __le32 total_data_acked;
1097 __le32 exp_data_acked;
1098 u8 next_tid_valid;
1099 u8 byte3;
1100 __le16 word1;
1101 __le16 next_tid;
1102 __le16 word3;
1103 __le32 hdr_residual_count;
1104 __le32 exp_r2t_sn;
1105};
1106
1107struct mstorm_iscsi_task_st_ctx {
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001108 struct scsi_cached_sges data_desc;
1109 struct scsi_sgl_params sgl_params;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001110 __le32 rem_task_size;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001111 __le32 data_buffer_offset;
1112 u8 task_type;
1113 struct iscsi_dif_flags dif_flags;
1114 u8 reserved0[2];
1115 struct regpair sense_db;
1116 __le32 expected_itt;
1117 __le32 reserved1;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001118};
1119
1120struct ustorm_iscsi_task_st_ctx {
1121 __le32 rem_rcv_len;
1122 __le32 exp_data_transfer_len;
1123 __le32 exp_data_sn;
1124 struct regpair lun;
1125 struct iscsi_reg1 reg1;
1126 u8 flags2;
1127#define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_MASK 0x1
1128#define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT 0
1129#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK 0x7F
1130#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT 1
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001131 struct iscsi_dif_flags dif_flags;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001132 __le16 reserved3;
1133 __le32 reserved4;
1134 __le32 reserved5;
1135 __le32 reserved6;
1136 __le32 reserved7;
1137 u8 task_type;
1138 u8 error_flags;
1139#define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_MASK 0x1
1140#define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_SHIFT 0
1141#define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_MASK 0x1
1142#define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_SHIFT 1
1143#define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_MASK 0x1
1144#define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_SHIFT 2
1145#define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_MASK 0x1F
1146#define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_SHIFT 3
1147 u8 flags;
1148#define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_MASK 0x3
1149#define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_SHIFT 0
1150#define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_MASK 0x1
1151#define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT 2
1152#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK 0x1
1153#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT 3
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001154#define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_MASK 0x1
1155#define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_SHIFT 4
1156#define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_MASK 0x1
1157#define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_SHIFT 5
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001158#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK 0x1
1159#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT 6
1160#define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK 0x1
1161#define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_SHIFT 7
1162 u8 cq_rss_number;
1163};
1164
1165struct iscsi_task_context {
1166 struct ystorm_iscsi_task_st_ctx ystorm_st_context;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001167 struct ystorm_iscsi_task_ag_ctx ystorm_ag_context;
1168 struct regpair ystorm_ag_padding[2];
1169 struct tdif_task_context tdif_context;
1170 struct mstorm_iscsi_task_ag_ctx mstorm_ag_context;
1171 struct regpair mstorm_ag_padding[2];
1172 struct ustorm_iscsi_task_ag_ctx ustorm_ag_context;
1173 struct mstorm_iscsi_task_st_ctx mstorm_st_context;
1174 struct ustorm_iscsi_task_st_ctx ustorm_st_context;
1175 struct rdif_task_context rdif_context;
1176};
1177
1178enum iscsi_task_type {
1179 ISCSI_TASK_TYPE_INITIATOR_WRITE,
1180 ISCSI_TASK_TYPE_INITIATOR_READ,
1181 ISCSI_TASK_TYPE_MIDPATH,
1182 ISCSI_TASK_TYPE_UNSOLIC,
1183 ISCSI_TASK_TYPE_EXCHCLEANUP,
1184 ISCSI_TASK_TYPE_IRRELEVANT,
1185 ISCSI_TASK_TYPE_TARGET_WRITE,
1186 ISCSI_TASK_TYPE_TARGET_READ,
1187 ISCSI_TASK_TYPE_TARGET_RESPONSE,
1188 ISCSI_TASK_TYPE_LOGIN_RESPONSE,
1189 MAX_ISCSI_TASK_TYPE
1190};
1191
1192union iscsi_ttt_txlen_union {
1193 __le32 desired_tx_len;
1194 __le32 ttt;
1195};
1196
1197struct iscsi_uhqe {
1198 __le32 reg1;
1199#define ISCSI_UHQE_PDU_PAYLOAD_LEN_MASK 0xFFFFF
1200#define ISCSI_UHQE_PDU_PAYLOAD_LEN_SHIFT 0
1201#define ISCSI_UHQE_LOCAL_COMP_MASK 0x1
1202#define ISCSI_UHQE_LOCAL_COMP_SHIFT 20
1203#define ISCSI_UHQE_TOGGLE_BIT_MASK 0x1
1204#define ISCSI_UHQE_TOGGLE_BIT_SHIFT 21
1205#define ISCSI_UHQE_PURE_PAYLOAD_MASK 0x1
1206#define ISCSI_UHQE_PURE_PAYLOAD_SHIFT 22
1207#define ISCSI_UHQE_LOGIN_RESPONSE_PDU_MASK 0x1
1208#define ISCSI_UHQE_LOGIN_RESPONSE_PDU_SHIFT 23
1209#define ISCSI_UHQE_TASK_ID_HI_MASK 0xFF
1210#define ISCSI_UHQE_TASK_ID_HI_SHIFT 24
1211 __le32 reg2;
1212#define ISCSI_UHQE_BUFFER_OFFSET_MASK 0xFFFFFF
1213#define ISCSI_UHQE_BUFFER_OFFSET_SHIFT 0
1214#define ISCSI_UHQE_TASK_ID_LO_MASK 0xFF
1215#define ISCSI_UHQE_TASK_ID_LO_SHIFT 24
1216};
1217
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001218
1219struct iscsi_wqe {
1220 __le16 task_id;
1221 u8 flags;
1222#define ISCSI_WQE_WQE_TYPE_MASK 0x7
1223#define ISCSI_WQE_WQE_TYPE_SHIFT 0
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001224#define ISCSI_WQE_NUM_SGES_MASK 0xF
1225#define ISCSI_WQE_NUM_SGES_SHIFT 3
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001226#define ISCSI_WQE_RESPONSE_MASK 0x1
1227#define ISCSI_WQE_RESPONSE_SHIFT 7
1228 struct iscsi_dif_flags prot_flags;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001229 __le32 contlen_cdbsize;
1230#define ISCSI_WQE_CONT_LEN_MASK 0xFFFFFF
1231#define ISCSI_WQE_CONT_LEN_SHIFT 0
1232#define ISCSI_WQE_CDB_SIZE_MASK 0xFF
1233#define ISCSI_WQE_CDB_SIZE_SHIFT 24
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001234};
1235
1236enum iscsi_wqe_type {
1237 ISCSI_WQE_TYPE_NORMAL,
1238 ISCSI_WQE_TYPE_TASK_CLEANUP,
1239 ISCSI_WQE_TYPE_MIDDLE_PATH,
1240 ISCSI_WQE_TYPE_LOGIN,
1241 ISCSI_WQE_TYPE_FIRST_R2T_CONT,
1242 ISCSI_WQE_TYPE_NONFIRST_R2T_CONT,
1243 ISCSI_WQE_TYPE_RESPONSE,
1244 MAX_ISCSI_WQE_TYPE
1245};
1246
1247struct iscsi_xhqe {
1248 union iscsi_ttt_txlen_union ttt_or_txlen;
1249 __le32 exp_stat_sn;
1250 struct iscsi_dif_flags prot_flags;
1251 u8 total_ahs_length;
1252 u8 opcode;
1253 u8 flags;
Mintz, Yuvalbe086e72017-03-11 18:39:18 +02001254#define ISCSI_XHQE_FINAL_MASK 0x1
1255#define ISCSI_XHQE_FINAL_SHIFT 0
1256#define ISCSI_XHQE_STATUS_BIT_MASK 0x1
1257#define ISCSI_XHQE_STATUS_BIT_SHIFT 1
1258#define ISCSI_XHQE_NUM_SGES_MASK 0xF
1259#define ISCSI_XHQE_NUM_SGES_SHIFT 2
1260#define ISCSI_XHQE_RESERVED0_MASK 0x3
1261#define ISCSI_XHQE_RESERVED0_SHIFT 6
1262 union iscsi_seq_num seq_num;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001263 __le16 reserved1;
1264};
1265
1266struct mstorm_iscsi_stats_drv {
1267 struct regpair iscsi_rx_dropped_pdus_task_not_valid;
1268};
1269
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001270struct pstorm_iscsi_stats_drv {
1271 struct regpair iscsi_tx_bytes_cnt;
1272 struct regpair iscsi_tx_packet_cnt;
1273};
1274
1275struct tstorm_iscsi_stats_drv {
1276 struct regpair iscsi_rx_bytes_cnt;
1277 struct regpair iscsi_rx_packet_cnt;
1278 struct regpair iscsi_rx_new_ooo_isle_events_cnt;
1279 __le32 iscsi_cmdq_threshold_cnt;
1280 __le32 iscsi_rq_threshold_cnt;
1281 __le32 iscsi_immq_threshold_cnt;
1282};
1283
1284struct ustorm_iscsi_stats_drv {
1285 struct regpair iscsi_rx_data_pdu_cnt;
1286 struct regpair iscsi_rx_r2t_pdu_cnt;
1287 struct regpair iscsi_rx_total_pdu_cnt;
1288};
1289
1290struct xstorm_iscsi_stats_drv {
1291 struct regpair iscsi_tx_go_to_slow_start_event_cnt;
1292 struct regpair iscsi_tx_fast_retransmit_event_cnt;
1293};
1294
1295struct ystorm_iscsi_stats_drv {
1296 struct regpair iscsi_tx_data_pdu_cnt;
1297 struct regpair iscsi_tx_r2t_pdu_cnt;
1298 struct regpair iscsi_tx_total_pdu_cnt;
1299};
1300
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001301struct tstorm_iscsi_task_ag_ctx {
1302 u8 byte0;
1303 u8 byte1;
1304 __le16 word0;
1305 u8 flags0;
1306#define TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF
1307#define TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0
1308#define TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1
1309#define TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4
1310#define TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1
1311#define TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5
1312#define TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK 0x1
1313#define TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT 6
1314#define TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1
1315#define TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7
1316 u8 flags1;
1317#define TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1
1318#define TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0
1319#define TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK 0x1
1320#define TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT 1
1321#define TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3
1322#define TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 2
1323#define TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3
1324#define TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 4
1325#define TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3
1326#define TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 6
1327 u8 flags2;
1328#define TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3
1329#define TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 0
1330#define TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK 0x3
1331#define TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT 2
1332#define TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK 0x3
1333#define TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT 4
1334#define TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK 0x3
1335#define TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT 6
1336 u8 flags3;
1337#define TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK 0x3
1338#define TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT 0
1339#define TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1
1340#define TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 2
1341#define TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1
1342#define TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 3
1343#define TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1
1344#define TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 4
1345#define TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1
1346#define TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 5
1347#define TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK 0x1
1348#define TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT 6
1349#define TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK 0x1
1350#define TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT 7
1351 u8 flags4;
1352#define TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK 0x1
1353#define TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT 0
1354#define TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK 0x1
1355#define TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT 1
1356#define TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1
1357#define TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2
1358#define TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1
1359#define TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3
1360#define TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1
1361#define TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4
1362#define TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1
1363#define TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5
1364#define TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1
1365#define TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6
1366#define TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1
1367#define TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7
1368 u8 byte2;
1369 __le16 word1;
1370 __le32 reg0;
1371 u8 byte3;
1372 u8 byte4;
1373 __le16 word2;
1374 __le16 word3;
1375 __le16 word4;
1376 __le32 reg1;
1377 __le32 reg2;
1378};
Mintz, Yuval7b6859f2017-05-18 19:41:04 +03001379struct iscsi_db_data {
1380 u8 params;
1381#define ISCSI_DB_DATA_DEST_MASK 0x3
1382#define ISCSI_DB_DATA_DEST_SHIFT 0
1383#define ISCSI_DB_DATA_AGG_CMD_MASK 0x3
1384#define ISCSI_DB_DATA_AGG_CMD_SHIFT 2
1385#define ISCSI_DB_DATA_BYPASS_EN_MASK 0x1
1386#define ISCSI_DB_DATA_BYPASS_EN_SHIFT 4
1387#define ISCSI_DB_DATA_RESERVED_MASK 0x1
1388#define ISCSI_DB_DATA_RESERVED_SHIFT 5
1389#define ISCSI_DB_DATA_AGG_VAL_SEL_MASK 0x3
1390#define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6
1391 u8 agg_flags;
1392 __le16 sq_prod;
1393};
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001394
1395#endif /* __ISCSI_COMMON__ */