blob: a338625868e5b8c30d2a01595a317f4133b3f7d7 [file] [log] [blame]
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301/**
John Soni Jose5faf17b2012-10-20 04:45:27 +05302 * Copyright (C) 2005 - 2012 Emulex
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05303 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation. The full GNU General
8 * Public License is included in this distribution in the file called COPYING.
9 *
10 * Contact Information:
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -070011 * linux-drivers@emulex.com
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053012 *
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -070013 * Emulex
14 * 3333 Susan Street
15 * Costa Mesa, CA 92626
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053016 */
17
18#ifndef BEISCSI_CMDS_H
19#define BEISCSI_CMDS_H
20
21/**
22 * The driver sends configuration and managements command requests to the
23 * firmware in the BE. These requests are communicated to the processor
24 * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one
25 * WRB inside a MAILBOX.
Jayamohan Kallickal2f635882012-04-03 23:41:45 -050026 * The commands are serviced by the ARM processor in the OneConnect's MPU.
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053027 */
28struct be_sge {
29 u32 pa_lo;
30 u32 pa_hi;
31 u32 len;
32};
33
34#define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */
35#define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */
36struct be_mcc_wrb {
37 u32 embedded; /* dword 0 */
38 u32 payload_length; /* dword 1 */
39 u32 tag0; /* dword 2 */
40 u32 tag1; /* dword 3 */
41 u32 rsvd; /* dword 4 */
42 union {
43 u8 embedded_payload[236]; /* used by embedded cmds */
44 struct be_sge sgl[19]; /* used by non-embedded cmds */
45 } payload;
46};
47
48#define CQE_FLAGS_VALID_MASK (1 << 31)
49#define CQE_FLAGS_ASYNC_MASK (1 << 30)
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +053050#define CQE_FLAGS_COMPLETED_MASK (1 << 28)
51#define CQE_FLAGS_CONSUMED_MASK (1 << 27)
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053052
53/* Completion Status */
54#define MCC_STATUS_SUCCESS 0x0
Jayamohan Kallickala8081e32013-04-05 20:38:22 -070055#define MCC_STATUS_FAILED 0x1
56#define MCC_STATUS_ILLEGAL_REQUEST 0x2
57#define MCC_STATUS_ILLEGAL_FIELD 0x3
58#define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053059
60#define CQE_STATUS_COMPL_MASK 0xFFFF
61#define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
62#define CQE_STATUS_EXTD_MASK 0xFFFF
Jayamohan Kallickalb38c1e82010-07-22 04:28:13 +053063#define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */
John Soni Josee175def2012-10-20 04:45:40 +053064#define CQE_STATUS_ADDL_MASK 0xFF00
65#define CQE_STATUS_MASK 0xFF
66#define CQE_STATUS_ADDL_SHIFT 0x08
67#define CQE_STATUS_WRB_MASK 0xFF0000
68#define CQE_STATUS_WRB_SHIFT 16
69#define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
70#define BEISCSI_FW_MBX_TIMEOUT 100
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053071
John Soni Joseeaae5262012-10-20 04:43:44 +053072/* MBOX Command VER */
73#define MBX_CMD_VER2 0x02
74
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053075struct be_mcc_compl {
76 u32 status; /* dword 0 */
77 u32 tag0; /* dword 1 */
78 u32 tag1; /* dword 2 */
79 u32 flags; /* dword 3 */
80};
81
82/********* Mailbox door bell *************/
83/**
84 * Used for driver communication with the FW.
85 * The software must write this register twice to post any command. First,
86 * it writes the register with hi=1 and the upper bits of the physical address
87 * for the MAILBOX structure. Software must poll the ready bit until this
88 * is acknowledged. Then, sotware writes the register with hi=0 with the lower
89 * bits in the address. It must poll the ready bit until the command is
90 * complete. Upon completion, the MAILBOX will contain a valid completion
91 * queue entry.
92 */
93#define MPU_MAILBOX_DB_OFFSET 0x160
94#define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */
95#define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */
96
97/********** MPU semphore ******************/
98#define MPU_EP_SEMAPHORE_OFFSET 0xac
99#define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
100#define EP_SEMAPHORE_POST_ERR_MASK 0x1
101#define EP_SEMAPHORE_POST_ERR_SHIFT 31
102
103/********** MCC door bell ************/
104#define DB_MCCQ_OFFSET 0x140
105#define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */
106/* Number of entries posted */
107#define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */
108
109/* MPU semphore POST stage values */
110#define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */
111
112/**
113 * When the async bit of mcc_compl is set, the last 4 bytes of
114 * mcc_compl is interpreted as follows:
115 */
116#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
117#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
118#define ASYNC_EVENT_CODE_LINK_STATE 0x1
119struct be_async_event_trailer {
120 u32 code;
121};
122
123enum {
124 ASYNC_EVENT_LINK_DOWN = 0x0,
125 ASYNC_EVENT_LINK_UP = 0x1
126};
127
128/**
129 * When the event code of an async trailer is link-state, the mcc_compl
130 * must be interpreted as follows
131 */
132struct be_async_event_link_state {
133 u8 physical_port;
134 u8 port_link_status;
135 u8 port_duplex;
136 u8 port_speed;
137 u8 port_fault;
138 u8 rsvd0[7];
139 struct be_async_event_trailer trailer;
140} __packed;
141
142struct be_mcc_mailbox {
143 struct be_mcc_wrb wrb;
144 struct be_mcc_compl compl;
145};
146
147/* Type of subsystems supported by FW */
148#define CMD_SUBSYSTEM_COMMON 0x1
149#define CMD_SUBSYSTEM_ISCSI 0x2
150#define CMD_SUBSYSTEM_ETH 0x3
151#define CMD_SUBSYSTEM_ISCSI_INI 0x6
152#define CMD_COMMON_TCP_UPLOAD 0x1
153
154/**
155 * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON
156 * These opcodes are unique for each subsystem defined above
157 */
158#define OPCODE_COMMON_CQ_CREATE 12
159#define OPCODE_COMMON_EQ_CREATE 13
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530160#define OPCODE_COMMON_MCC_CREATE 21
161#define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530162#define OPCODE_COMMON_GET_FW_VERSION 35
163#define OPCODE_COMMON_MODIFY_EQ_DELAY 41
164#define OPCODE_COMMON_FIRMWARE_CONFIG 42
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530165#define OPCODE_COMMON_MCC_DESTROY 53
166#define OPCODE_COMMON_CQ_DESTROY 54
167#define OPCODE_COMMON_EQ_DESTROY 55
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530168#define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
169#define OPCODE_COMMON_FUNCTION_RESET 61
170
171/**
172 * LIST of opcodes that are common between Initiator and Target
173 * used by CMD_SUBSYSTEM_ISCSI
174 * These opcodes are unique for each subsystem defined above
175 */
176#define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2
177#define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3
178#define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530179#define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14
Mike Christie0e438952012-04-03 23:41:51 -0500180#define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17
181#define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530182#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21
183#define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22
184#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
185#define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24
186#define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530187#define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
188#define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530189#define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530190#define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530191#define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530192
193struct be_cmd_req_hdr {
194 u8 opcode; /* dword 0 */
195 u8 subsystem; /* dword 0 */
196 u8 port_number; /* dword 0 */
197 u8 domain; /* dword 0 */
198 u32 timeout; /* dword 1 */
199 u32 request_length; /* dword 2 */
John Soni Joseeaae5262012-10-20 04:43:44 +0530200 u8 version; /* dword 3 */
201 u8 rsvd0[3]; /* dword 3 */
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530202};
203
204struct be_cmd_resp_hdr {
205 u32 info; /* dword 0 */
206 u32 status; /* dword 1 */
207 u32 response_length; /* dword 2 */
208 u32 actual_resp_len; /* dword 3 */
209};
210
211struct phys_addr {
212 u32 lo;
213 u32 hi;
214};
215
216/**************************
217 * BE Command definitions *
218 **************************/
219
220/**
221 * Pseudo amap definition in which each bit of the actual structure is defined
222 * as a byte - used to calculate offset/shift/mask of each field
223 */
224struct amap_eq_context {
225 u8 cidx[13]; /* dword 0 */
226 u8 rsvd0[3]; /* dword 0 */
227 u8 epidx[13]; /* dword 0 */
228 u8 valid; /* dword 0 */
229 u8 rsvd1; /* dword 0 */
230 u8 size; /* dword 0 */
231 u8 pidx[13]; /* dword 1 */
232 u8 rsvd2[3]; /* dword 1 */
233 u8 pd[10]; /* dword 1 */
234 u8 count[3]; /* dword 1 */
235 u8 solevent; /* dword 1 */
236 u8 stalled; /* dword 1 */
237 u8 armed; /* dword 1 */
238 u8 rsvd3[4]; /* dword 2 */
239 u8 func[8]; /* dword 2 */
240 u8 rsvd4; /* dword 2 */
241 u8 delaymult[10]; /* dword 2 */
242 u8 rsvd5[2]; /* dword 2 */
243 u8 phase[2]; /* dword 2 */
244 u8 nodelay; /* dword 2 */
245 u8 rsvd6[4]; /* dword 2 */
246 u8 rsvd7[32]; /* dword 3 */
247} __packed;
248
249struct be_cmd_req_eq_create {
250 struct be_cmd_req_hdr hdr; /* dw[4] */
251 u16 num_pages; /* sword */
252 u16 rsvd0; /* sword */
253 u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */
254 struct phys_addr pages[8];
255} __packed;
256
257struct be_cmd_resp_eq_create {
258 struct be_cmd_resp_hdr resp_hdr;
259 u16 eq_id; /* sword */
260 u16 rsvd0; /* sword */
261} __packed;
262
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530263struct mgmt_chap_format {
264 u32 flags;
265 u8 intr_chap_name[256];
266 u8 intr_secret[16];
267 u8 target_chap_name[256];
268 u8 target_secret[16];
269 u16 intr_chap_name_length;
270 u16 intr_secret_length;
271 u16 target_chap_name_length;
272 u16 target_secret_length;
273} __packed;
274
275struct mgmt_auth_method_format {
276 u8 auth_method_type;
277 u8 padding[3];
278 struct mgmt_chap_format chap;
279} __packed;
280
281struct mgmt_conn_login_options {
282 u8 flags;
283 u8 header_digest;
284 u8 data_digest;
285 u8 rsvd0;
286 u32 max_recv_datasegment_len_ini;
287 u32 max_recv_datasegment_len_tgt;
288 u32 tcp_mss;
289 u32 tcp_window_size;
290 struct mgmt_auth_method_format auth_data;
291} __packed;
292
Mike Christie0e438952012-04-03 23:41:51 -0500293struct ip_addr_format {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530294 u16 size_of_structure;
295 u8 reserved;
296 u8 ip_type;
Mike Christie0e438952012-04-03 23:41:51 -0500297 u8 addr[16];
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530298 u32 rsvd0;
299} __packed;
300
Mike Christie0e438952012-04-03 23:41:51 -0500301struct mgmt_conn_info {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530302 u32 connection_handle;
303 u32 connection_status;
304 u16 src_port;
305 u16 dest_port;
306 u16 dest_port_redirected;
307 u16 cid;
308 u32 estimated_throughput;
Mike Christie0e438952012-04-03 23:41:51 -0500309 struct ip_addr_format src_ipaddr;
310 struct ip_addr_format dest_ipaddr;
311 struct ip_addr_format dest_ipaddr_redirected;
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530312 struct mgmt_conn_login_options negotiated_login_options;
313} __packed;
314
315struct mgmt_session_login_options {
316 u8 flags;
317 u8 error_recovery_level;
318 u16 rsvd0;
319 u32 first_burst_length;
320 u32 max_burst_length;
321 u16 max_connections;
322 u16 max_outstanding_r2t;
323 u16 default_time2wait;
324 u16 default_time2retain;
325} __packed;
326
327struct mgmt_session_info {
328 u32 session_handle;
329 u32 status;
330 u8 isid[6];
331 u16 tsih;
332 u32 session_flags;
333 u16 conn_count;
334 u16 pad;
335 u8 target_name[224];
336 u8 initiator_iscsiname[224];
337 struct mgmt_session_login_options negotiated_login_options;
338 struct mgmt_conn_info conn_list[1];
339} __packed;
340
Mike Christie0e438952012-04-03 23:41:51 -0500341struct be_cmd_get_session_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530342 struct be_cmd_req_hdr hdr;
343 u32 session_handle;
344} __packed;
345
Mike Christie0e438952012-04-03 23:41:51 -0500346struct be_cmd_get_session_resp {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530347 struct be_cmd_resp_hdr hdr;
348 struct mgmt_session_info session_info;
349} __packed;
350
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530351struct mac_addr {
Mike Christie0e438952012-04-03 23:41:51 -0500352 u16 size_of_structure;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530353 u8 addr[ETH_ALEN];
354} __packed;
355
Mike Christie0e438952012-04-03 23:41:51 -0500356struct be_cmd_get_boot_target_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530357 struct be_cmd_req_hdr hdr;
358} __packed;
359
Mike Christie0e438952012-04-03 23:41:51 -0500360struct be_cmd_get_boot_target_resp {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530361 struct be_cmd_resp_hdr hdr;
362 u32 boot_session_count;
363 int boot_session_handle;
364};
365
John Soni Jose9aef4202012-08-20 23:00:08 +0530366struct be_cmd_reopen_session_req {
367 struct be_cmd_req_hdr hdr;
368#define BE_REOPEN_ALL_SESSIONS 0x00
369#define BE_REOPEN_BOOT_SESSIONS 0x01
370#define BE_REOPEN_A_SESSION 0x02
371 u16 reopen_type;
372 u16 rsvd;
373 u32 session_handle;
374} __packed;
375
376struct be_cmd_reopen_session_resp {
377 struct be_cmd_resp_hdr hdr;
378 u32 rsvd;
379 u32 session_handle;
380} __packed;
381
382
Mike Christie0e438952012-04-03 23:41:51 -0500383struct be_cmd_mac_query_req {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530384 struct be_cmd_req_hdr hdr;
385 u8 type;
386 u8 permanent;
387 u16 if_id;
388} __packed;
389
Mike Christie0e438952012-04-03 23:41:51 -0500390struct be_cmd_get_mac_resp {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530391 struct be_cmd_resp_hdr hdr;
392 struct mac_addr mac;
393};
394
Mike Christie0e438952012-04-03 23:41:51 -0500395struct be_ip_addr_subnet_format {
396 u16 size_of_structure;
397 u8 ip_type;
398 u8 ipv6_prefix_length;
399 u8 addr[16];
400 u8 subnet_mask[16];
401 u32 rsvd0;
402} __packed;
403
404struct be_cmd_get_if_info_req {
405 struct be_cmd_req_hdr hdr;
406 u32 interface_hndl;
407 u32 ip_type;
408} __packed;
409
410struct be_cmd_get_if_info_resp {
411 struct be_cmd_req_hdr hdr;
412 u32 interface_hndl;
413 u32 vlan_priority;
414 u32 ip_addr_count;
415 u32 dhcp_state;
416 struct be_ip_addr_subnet_format ip_addr;
417} __packed;
418
419struct be_ip_addr_record {
420 u32 action;
421 u32 interface_hndl;
422 struct be_ip_addr_subnet_format ip_addr;
423 u32 status;
424} __packed;
425
426struct be_ip_addr_record_params {
427 u32 record_entry_count;
428 struct be_ip_addr_record ip_record;
429} __packed;
430
431struct be_cmd_set_ip_addr_req {
432 struct be_cmd_req_hdr hdr;
433 struct be_ip_addr_record_params ip_params;
434} __packed;
435
436
437struct be_cmd_set_dhcp_req {
438 struct be_cmd_req_hdr hdr;
439 u32 interface_hndl;
440 u32 ip_type;
441 u32 flags;
442 u32 retry_count;
443} __packed;
444
445struct be_cmd_rel_dhcp_req {
446 struct be_cmd_req_hdr hdr;
447 u32 interface_hndl;
448 u32 ip_type;
449} __packed;
450
451struct be_cmd_set_def_gateway_req {
452 struct be_cmd_req_hdr hdr;
453 u32 action;
454 struct ip_addr_format ip_addr;
455} __packed;
456
457struct be_cmd_get_def_gateway_req {
458 struct be_cmd_req_hdr hdr;
459 u32 ip_type;
460} __packed;
461
462struct be_cmd_get_def_gateway_resp {
463 struct be_cmd_req_hdr hdr;
464 struct ip_addr_format ip_addr;
465} __packed;
466
John Soni Jose6f722382012-08-20 23:00:43 +0530467#define BEISCSI_VLAN_DISABLE 0xFFFF
468struct be_cmd_set_vlan_req {
469 struct be_cmd_req_hdr hdr;
470 u32 interface_hndl;
471 u32 vlan_priority;
472} __packed;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530473/******************** Create CQ ***************************/
474/**
475 * Pseudo amap definition in which each bit of the actual structure is defined
476 * as a byte - used to calculate offset/shift/mask of each field
477 */
478struct amap_cq_context {
479 u8 cidx[11]; /* dword 0 */
480 u8 rsvd0; /* dword 0 */
481 u8 coalescwm[2]; /* dword 0 */
482 u8 nodelay; /* dword 0 */
483 u8 epidx[11]; /* dword 0 */
484 u8 rsvd1; /* dword 0 */
485 u8 count[2]; /* dword 0 */
486 u8 valid; /* dword 0 */
487 u8 solevent; /* dword 0 */
488 u8 eventable; /* dword 0 */
489 u8 pidx[11]; /* dword 1 */
490 u8 rsvd2; /* dword 1 */
491 u8 pd[10]; /* dword 1 */
492 u8 eqid[8]; /* dword 1 */
493 u8 stalled; /* dword 1 */
494 u8 armed; /* dword 1 */
495 u8 rsvd3[4]; /* dword 2 */
496 u8 func[8]; /* dword 2 */
497 u8 rsvd4[20]; /* dword 2 */
498 u8 rsvd5[32]; /* dword 3 */
499} __packed;
500
John Soni Joseeaae5262012-10-20 04:43:44 +0530501struct amap_cq_context_v2 {
502 u8 rsvd0[12]; /* dword 0 */
503 u8 coalescwm[2]; /* dword 0 */
504 u8 nodelay; /* dword 0 */
505 u8 rsvd1[12]; /* dword 0 */
506 u8 count[2]; /* dword 0 */
507 u8 valid; /* dword 0 */
508 u8 rsvd2; /* dword 0 */
509 u8 eventable; /* dword 0 */
510 u8 eqid[16]; /* dword 1 */
511 u8 rsvd3[15]; /* dword 1 */
512 u8 armed; /* dword 1 */
513 u8 cqecount[16];/* dword 2 */
514 u8 rsvd4[16]; /* dword 2 */
515 u8 rsvd5[32]; /* dword 3 */
516};
517
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530518struct be_cmd_req_cq_create {
519 struct be_cmd_req_hdr hdr;
520 u16 num_pages;
John Soni Joseeaae5262012-10-20 04:43:44 +0530521 u8 page_size;
522 u8 rsvd0;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530523 u8 context[sizeof(struct amap_cq_context) / 8];
524 struct phys_addr pages[4];
525} __packed;
526
527struct be_cmd_resp_cq_create {
528 struct be_cmd_resp_hdr hdr;
529 u16 cq_id;
530 u16 rsvd0;
531} __packed;
532
533/******************** Create MCCQ ***************************/
534/**
535 * Pseudo amap definition in which each bit of the actual structure is defined
536 * as a byte - used to calculate offset/shift/mask of each field
537 */
538struct amap_mcc_context {
539 u8 con_index[14];
540 u8 rsvd0[2];
541 u8 ring_size[4];
542 u8 fetch_wrb;
543 u8 fetch_r2t;
544 u8 cq_id[10];
545 u8 prod_index[14];
546 u8 fid[8];
547 u8 pdid[9];
548 u8 valid;
549 u8 rsvd1[32];
550 u8 rsvd2[32];
551} __packed;
552
553struct be_cmd_req_mcc_create {
554 struct be_cmd_req_hdr hdr;
555 u16 num_pages;
556 u16 rsvd0;
557 u8 context[sizeof(struct amap_mcc_context) / 8];
558 struct phys_addr pages[8];
559} __packed;
560
561struct be_cmd_resp_mcc_create {
562 struct be_cmd_resp_hdr hdr;
563 u16 id;
564 u16 rsvd0;
565} __packed;
566
567/******************** Q Destroy ***************************/
568/* Type of Queue to be destroyed */
569enum {
570 QTYPE_EQ = 1,
571 QTYPE_CQ,
572 QTYPE_MCCQ,
573 QTYPE_WRBQ,
574 QTYPE_DPDUQ,
575 QTYPE_SGL
576};
577
578struct be_cmd_req_q_destroy {
579 struct be_cmd_req_hdr hdr;
580 u16 id;
581 u16 bypass_flush; /* valid only for rx q destroy */
582} __packed;
583
584struct macaddr {
585 u8 byte[ETH_ALEN];
586};
587
588struct be_cmd_req_mcast_mac_config {
589 struct be_cmd_req_hdr hdr;
590 u16 num_mac;
591 u8 promiscuous;
592 u8 interface_id;
593 struct macaddr mac[32];
594} __packed;
595
596static inline void *embedded_payload(struct be_mcc_wrb *wrb)
597{
598 return wrb->payload.embedded_payload;
599}
600
601static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
602{
603 return &wrb->payload.sgl[0];
604}
605
606/******************** Modify EQ Delay *******************/
607struct be_cmd_req_modify_eq_delay {
608 struct be_cmd_req_hdr hdr;
609 u32 num_eq;
610 struct {
611 u32 eq_id;
612 u32 phase;
613 u32 delay_multiplier;
614 } delay[8];
615} __packed;
616
617/******************** Get MAC ADDR *******************/
618
619#define ETH_ALEN 6
620
Mike Christie0e438952012-04-03 23:41:51 -0500621struct be_cmd_get_nic_conf_req {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530622 struct be_cmd_req_hdr hdr;
623 u32 nic_port_count;
624 u32 speed;
625 u32 max_speed;
626 u32 link_state;
627 u32 max_frame_size;
628 u16 size_of_structure;
629 u8 mac_address[ETH_ALEN];
630 u32 rsvd[23];
631};
632
Mike Christie0e438952012-04-03 23:41:51 -0500633struct be_cmd_get_nic_conf_resp {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530634 struct be_cmd_resp_hdr hdr;
635 u32 nic_port_count;
636 u32 speed;
637 u32 max_speed;
638 u32 link_state;
639 u32 max_frame_size;
640 u16 size_of_structure;
641 u8 mac_address[6];
642 u32 rsvd[23];
643};
644
John Soni Jose21771992012-04-03 23:41:49 -0500645#define BEISCSI_ALIAS_LEN 32
646
647struct be_cmd_hba_name {
648 struct be_cmd_req_hdr hdr;
649 u16 flags;
650 u16 rsvd0;
651 u8 initiator_name[ISCSI_NAME_LEN];
652 u8 initiator_alias[BEISCSI_ALIAS_LEN];
653} __packed;
654
John Soni Josec62eef02012-04-03 23:41:52 -0500655struct be_cmd_ntwk_link_status_req {
656 struct be_cmd_req_hdr hdr;
657 u32 rsvd0;
658} __packed;
659
660/*** Port Speed Values ***/
661#define BE2ISCSI_LINK_SPEED_ZERO 0x00
662#define BE2ISCSI_LINK_SPEED_10MBPS 0x01
663#define BE2ISCSI_LINK_SPEED_100MBPS 0x02
664#define BE2ISCSI_LINK_SPEED_1GBPS 0x03
665#define BE2ISCSI_LINK_SPEED_10GBPS 0x04
666struct be_cmd_ntwk_link_status_resp {
667 struct be_cmd_resp_hdr hdr;
668 u8 phys_port;
669 u8 mac_duplex;
670 u8 mac_speed;
671 u8 mac_fault;
672 u8 mgmt_mac_duplex;
673 u8 mgmt_mac_speed;
674 u16 qos_link_speed;
675 u32 logical_link_speed;
676} __packed;
John Soni Jose21771992012-04-03 23:41:49 -0500677
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530678int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
679 struct be_queue_info *eq, int eq_delay);
680
681int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
682 struct be_queue_info *cq, struct be_queue_info *eq,
683 bool sol_evts, bool no_delay,
684 int num_cqe_dma_coalesce);
685
686int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
687 int type);
Jayamohan Kallickal35e66012009-10-23 11:53:49 +0530688int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530689 struct be_queue_info *mccq,
690 struct be_queue_info *cq);
691
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530692int be_poll_mcc(struct be_ctrl_info *ctrl);
Jayamohan Kallickal03a12312010-07-22 04:17:16 +0530693int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530694 struct beiscsi_hba *phba);
John Soni Jose21771992012-04-03 23:41:49 -0500695unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
John Soni Josec62eef02012-04-03 23:41:52 -0500696unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530697
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530698void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
John Soni Josee175def2012-10-20 04:45:40 +0530699
700int beiscsi_mccq_compl(struct beiscsi_hba *phba,
701 uint32_t tag, struct be_mcc_wrb **wrb, void *cmd_va);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530702/*ISCSI Functuions */
703int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
Jayamohan Kallickal0283fbb2013-04-05 20:38:21 -0700704int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530705
706struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530707struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
708int be_mcc_notify_wait(struct beiscsi_hba *phba);
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530709void be_mcc_notify(struct beiscsi_hba *phba);
710unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
711void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
712 struct be_async_event_link_state *evt);
713int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
714 struct be_mcc_compl *compl);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530715
716int be_mbox_notify(struct be_ctrl_info *ctrl);
717
718int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
719 struct be_queue_info *cq,
720 struct be_queue_info *dq, int length,
721 int entry_size);
722
723int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
724 struct be_dma_mem *q_mem, u32 page_offset,
725 u32 num_pages);
726
Jayamohan Kallickale5285862011-10-07 19:31:08 -0500727int beiscsi_cmd_reset_function(struct beiscsi_hba *phba);
728
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530729int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
730 struct be_queue_info *wrbq);
731
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530732bool is_link_state_evt(u32 trailer);
733
John Soni Jose6f722382012-08-20 23:00:43 +0530734/* Configuration Functions */
735int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
736
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530737struct be_default_pdu_context {
738 u32 dw[4];
739} __packed;
740
741struct amap_be_default_pdu_context {
742 u8 dbuf_cindex[13]; /* dword 0 */
743 u8 rsvd0[3]; /* dword 0 */
744 u8 ring_size[4]; /* dword 0 */
745 u8 ring_state[4]; /* dword 0 */
746 u8 rsvd1[8]; /* dword 0 */
747 u8 dbuf_pindex[13]; /* dword 1 */
748 u8 rsvd2; /* dword 1 */
749 u8 pci_func_id[8]; /* dword 1 */
750 u8 rx_pdid[9]; /* dword 1 */
751 u8 rx_pdid_valid; /* dword 1 */
752 u8 default_buffer_size[16]; /* dword 2 */
753 u8 cq_id_recv[10]; /* dword 2 */
754 u8 rx_pdid_not_valid; /* dword 2 */
755 u8 rsvd3[5]; /* dword 2 */
756 u8 rsvd4[32]; /* dword 3 */
757} __packed;
758
759struct be_defq_create_req {
760 struct be_cmd_req_hdr hdr;
761 u16 num_pages;
762 u8 ulp_num;
763 u8 rsvd0;
764 struct be_default_pdu_context context;
765 struct phys_addr pages[8];
766} __packed;
767
768struct be_defq_create_resp {
769 struct be_cmd_req_hdr hdr;
770 u16 id;
771 u16 rsvd0;
772} __packed;
773
774struct be_post_sgl_pages_req {
775 struct be_cmd_req_hdr hdr;
776 u16 num_pages;
777 u16 page_offset;
778 u32 rsvd0;
779 struct phys_addr pages[26];
780 u32 rsvd1;
781} __packed;
782
783struct be_wrbq_create_req {
784 struct be_cmd_req_hdr hdr;
785 u16 num_pages;
786 u8 ulp_num;
787 u8 rsvd0;
788 struct phys_addr pages[8];
789} __packed;
790
791struct be_wrbq_create_resp {
792 struct be_cmd_resp_hdr resp_hdr;
793 u16 cid;
794 u16 rsvd0;
795} __packed;
796
797#define SOL_CID_MASK 0x0000FFC0
798#define SOL_CODE_MASK 0x0000003F
799#define SOL_WRB_INDEX_MASK 0x00FF0000
800#define SOL_CMD_WND_MASK 0xFF000000
801#define SOL_RES_CNT_MASK 0x7FFFFFFF
802#define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
803#define SOL_HW_STS_MASK 0x000000FF
804#define SOL_STS_MASK 0x0000FF00
805#define SOL_RESP_MASK 0x00FF0000
806#define SOL_FLAGS_MASK 0x7F000000
807#define SOL_S_MASK 0x80000000
808
809struct sol_cqe {
810 u32 dw[4];
811};
812
813struct amap_sol_cqe {
814 u8 hw_sts[8]; /* dword 0 */
815 u8 i_sts[8]; /* dword 0 */
816 u8 i_resp[8]; /* dword 0 */
817 u8 i_flags[7]; /* dword 0 */
818 u8 s; /* dword 0 */
819 u8 i_exp_cmd_sn[32]; /* dword 1 */
820 u8 code[6]; /* dword 2 */
821 u8 cid[10]; /* dword 2 */
822 u8 wrb_index[8]; /* dword 2 */
823 u8 i_cmd_wnd[8]; /* dword 2 */
824 u8 i_res_cnt[31]; /* dword 3 */
825 u8 valid; /* dword 3 */
826} __packed;
827
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530828#define SOL_ICD_INDEX_MASK 0x0003FFC0
829struct amap_sol_cqe_ring {
830 u8 hw_sts[8]; /* dword 0 */
831 u8 i_sts[8]; /* dword 0 */
832 u8 i_resp[8]; /* dword 0 */
833 u8 i_flags[7]; /* dword 0 */
834 u8 s; /* dword 0 */
835 u8 i_exp_cmd_sn[32]; /* dword 1 */
836 u8 code[6]; /* dword 2 */
837 u8 icd_index[12]; /* dword 2 */
838 u8 rsvd[6]; /* dword 2 */
839 u8 i_cmd_wnd[8]; /* dword 2 */
840 u8 i_res_cnt[31]; /* dword 3 */
841 u8 valid; /* dword 3 */
842} __packed;
843
John Soni Jose73133262012-10-20 04:44:49 +0530844struct amap_sol_cqe_v2 {
845 u8 hw_sts[8]; /* dword 0 */
846 u8 i_sts[8]; /* dword 0 */
847 u8 wrb_index[16]; /* dword 0 */
848 u8 i_exp_cmd_sn[32]; /* dword 1 */
849 u8 code[6]; /* dword 2 */
850 u8 cmd_cmpl; /* dword 2 */
851 u8 rsvd0; /* dword 2 */
852 u8 i_cmd_wnd[8]; /* dword 2 */
853 u8 cid[13]; /* dword 2 */
854 u8 u; /* dword 2 */
855 u8 o; /* dword 2 */
856 u8 s; /* dword 2 */
857 u8 i_res_cnt[31]; /* dword 3 */
858 u8 valid; /* dword 3 */
859} __packed;
860
861struct common_sol_cqe {
862 u32 exp_cmdsn;
863 u32 res_cnt;
864 u16 wrb_index;
865 u16 cid;
866 u8 hw_sts;
867 u8 cmd_wnd;
868 u8 res_flag; /* the s feild of structure */
869 u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */
870 u8 i_flags; /* for skh or the u and o feilds */
871 u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */
872};
873
874/*** iSCSI ack/driver message completions ***/
875struct amap_it_dmsg_cqe {
876 u8 ack_num[32]; /* DWORD 0 */
877 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
878 u8 code[6]; /* DWORD 2 */
879 u8 cid[10]; /* DWORD 2 */
880 u8 wrb_idx[8]; /* DWORD 2 */
881 u8 rsvd0[8]; /* DWORD 2*/
882 u8 rsvd1[31]; /* DWORD 3*/
883 u8 valid; /* DWORD 3 */
884} __packed;
885
886struct amap_it_dmsg_cqe_v2 {
887 u8 ack_num[32]; /* DWORD 0 */
888 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
889 u8 code[6]; /* DWORD 2 */
890 u8 rsvd0[10]; /* DWORD 2 */
891 u8 wrb_idx[16]; /* DWORD 2 */
892 u8 rsvd1[16]; /* DWORD 3 */
893 u8 cid[13]; /* DWORD 3 */
894 u8 rsvd2[2]; /* DWORD 3 */
895 u8 valid; /* DWORD 3 */
896} __packed;
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530897
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530898
899/**
900 * Post WRB Queue Doorbell Register used by the host Storage
901 * stack to notify the
902 * controller of a posted Work Request Block
903 */
904#define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */
905#define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */
906
907#define DB_DEF_PDU_WRB_INDEX_SHIFT 16
908#define DB_DEF_PDU_NUM_POSTED_SHIFT 24
909
910struct fragnum_bits_for_sgl_cra_in {
911 struct be_cmd_req_hdr hdr;
912 u32 num_bits;
913} __packed;
914
915struct iscsi_cleanup_req {
916 struct be_cmd_req_hdr hdr;
917 u16 chute;
918 u8 hdr_ring_id;
919 u8 data_ring_id;
920
921} __packed;
922
923struct eq_delay {
924 u32 eq_id;
925 u32 phase;
926 u32 delay_multiplier;
927} __packed;
928
929struct be_eq_delay_params_in {
930 struct be_cmd_req_hdr hdr;
931 u32 num_eq;
932 struct eq_delay delay[8];
933} __packed;
934
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530935struct tcp_connect_and_offload_in {
936 struct be_cmd_req_hdr hdr;
Mike Christie0e438952012-04-03 23:41:51 -0500937 struct ip_addr_format ip_address;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530938 u16 tcp_port;
939 u16 cid;
940 u16 cq_id;
941 u16 defq_id;
942 struct phys_addr dataout_template_pa;
943 u16 hdr_ring_id;
944 u16 data_ring_id;
945 u8 do_offload;
946 u8 rsvd0[3];
947} __packed;
948
949struct tcp_connect_and_offload_out {
950 struct be_cmd_resp_hdr hdr;
951 u32 connection_handle;
952 u16 cid;
953 u16 rsvd0;
954
955} __packed;
956
957struct be_mcc_wrb_context {
958 struct MCC_WRB *wrb;
959 int *users_final_status;
960} __packed;
961
962#define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */
963#define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */
964#define DB_DEF_PDU_REARM_SHIFT 14
965#define DB_DEF_PDU_EVENT_SHIFT 15
966#define DB_DEF_PDU_CQPROC_SHIFT 16
967
968struct dmsg_cqe {
969 u32 dw[4];
970} __packed;
971
972struct tcp_upload_params_in {
973 struct be_cmd_req_hdr hdr;
974 u16 id;
975 u16 upload_type;
976 u32 reset_seq;
977} __packed;
978
979struct tcp_upload_params_out {
980 u32 dw[32];
981} __packed;
982
983union tcp_upload_params {
984 struct tcp_upload_params_in request;
985 struct tcp_upload_params_out response;
986} __packed;
987
988struct be_ulp_fw_cfg {
989 u32 ulp_mode;
990 u32 etx_base;
991 u32 etx_count;
992 u32 sq_base;
993 u32 sq_count;
994 u32 rq_base;
995 u32 rq_count;
996 u32 dq_base;
997 u32 dq_count;
998 u32 lro_base;
999 u32 lro_count;
1000 u32 icd_base;
1001 u32 icd_count;
1002};
1003
1004struct be_fw_cfg {
1005 struct be_cmd_req_hdr hdr;
1006 u32 be_config_number;
1007 u32 asic_revision;
1008 u32 phys_port;
1009 u32 function_mode;
1010 struct be_ulp_fw_cfg ulp[2];
1011 u32 function_caps;
1012} __packed;
1013
Mike Christie0e438952012-04-03 23:41:51 -05001014struct be_cmd_get_all_if_id_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301015 struct be_cmd_req_hdr hdr;
1016 u32 if_count;
1017 u32 if_hndl_list[1];
1018} __packed;
1019
1020#define ISCSI_OPCODE_SCSI_DATA_OUT 5
John Soni Josec62eef02012-04-03 23:41:52 -05001021#define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301022#define OPCODE_COMMON_MODIFY_EQ_DELAY 41
1023#define OPCODE_COMMON_ISCSI_CLEANUP 59
1024#define OPCODE_COMMON_TCP_UPLOAD 56
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301025#define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301026#define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301027#define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6
1028#define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7
1029#define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14
John Soni Jose9aef4202012-08-20 23:00:08 +05301030#define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301031#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301032#define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301033#define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52
Jayamohan Kallickalffce3e22012-04-03 23:41:50 -05001034#define OPCODE_COMMON_WRITE_FLASH 96
1035#define OPCODE_COMMON_READ_FLASH 97
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301036
1037/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
1038#define CMD_ISCSI_COMMAND_INVALIDATE 1
1039#define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
1040#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301041
1042#define INI_WR_CMD 1 /* Initiator write command */
1043#define INI_TMF_CMD 2 /* Initiator TMF command */
1044#define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */
1045#define INI_RD_CMD 5 /* Initiator requesting to send
1046 * a read command
1047 */
1048#define TGT_CTX_UPDT_CMD 7 /* Target context update */
1049#define TGT_STS_CMD 8 /* Target R2T and other BHS
1050 * where only the status number
1051 * need to be updated
1052 */
1053#define TGT_DATAIN_CMD 9 /* Target Data-Ins in response
1054 * to read command
1055 */
1056#define TGT_SOS_PDU 10 /* Target:standalone status
1057 * response
1058 */
1059#define TGT_DM_CMD 11 /* Indicates that the bhs
1060 * preparedby
1061 * driver should not be touched
1062 */
1063/* --- CMD_CHUTE_TYPE --- */
1064#define CMD_CONNECTION_CHUTE_0 1
1065#define CMD_CONNECTION_CHUTE_1 2
1066#define CMD_CONNECTION_CHUTE_2 3
1067
1068#define EQ_MAJOR_CODE_COMPLETION 0
1069
1070#define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
1071#define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
1072
1073/* --- CONNECTION_UPLOAD_PARAMS --- */
1074/* These parameters are used to define the type of upload desired. */
1075#define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */
1076#define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with
1077 * reset
1078 */
1079#define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without
1080 * reset
1081 */
1082#define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset,
1083 * sequence number by driver */
1084
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301085/* Returns the number of items in the field array. */
1086#define BE_NUMBER_OF_FIELD(_type_, _field_) \
1087 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1088
1089/**
1090 * Different types of iSCSI completions to host driver for both initiator
1091 * and taget mode
1092 * of operation.
1093 */
1094#define SOL_CMD_COMPLETE 1 /* Solicited command completed
1095 * normally
1096 */
1097#define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got
1098 * invalidated internally due
1099 * to Data Digest error
1100 */
1101#define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated
1102 * internally
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001103 * due to a received PDU
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301104 * size > DSL
1105 */
1106#define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated
1107 * internally due ti received
1108 * PDU sequence size >
1109 * FBL/MBL.
1110 */
1111#define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001112 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301113 * PDU Hdr that has
1114 * AHS */
1115#define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated
1116 * internally due to Hdr Digest
1117 * error
1118 */
1119#define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated
1120 * internally
1121 * due to a bad opcode in the
1122 * pdu hdr
1123 */
1124#define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001125 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301126 * ITT/TTT that does not belong
1127 * to this Connection
1128 */
1129#define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001130 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301131 * ITT/TTT value > Max
1132 * Supported ITTs/TTTs
1133 */
1134#define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated
1135 * internally due to an
1136 * incoming TCP RST
1137 */
1138#define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated
1139 * internally due to timeout on
1140 * tcp segment 12 retransmit
1141 * attempts failed
1142 */
1143#define CXN_KILLED_RST_SENT 12 /* Connection got invalidated
1144 * internally due to TCP RST
1145 * sent by the Tx side
1146 */
1147#define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated
1148 * internally due to an
1149 * incoming TCP FIN.
1150 */
1151#define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated
1152 * internally due to bad
1153 * unsolicited PDU Unsolicited
1154 * PDUs are PDUs with
1155 * ITT=0xffffffff
1156 */
1157#define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated
1158 * internally due to bad WRB
1159 * index.
1160 */
1161#define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001162 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301163 * command has residual
1164 * over run bytes.
1165 */
1166#define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001167 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301168 * command has residual under
1169 * run bytes.
1170 */
1171#define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001172 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301173 * PDU has an invalid StatusSN
1174 */
1175#define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001176 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301177 * an R2T with some invalid
1178 * fields in it
1179 */
1180#define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated
1181 * internally due to received
1182 * PDU has an invalid LUN.
1183 */
1184#define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated
1185 * internally due to the
1186 * corresponding ICD not in a
1187 * valid state
1188 */
1189#define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due
1190 * to received PDU has an
1191 * invalid ITT.
1192 */
1193#define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due
1194 * to received sequence buffer
1195 * offset is out of order.
1196 */
1197#define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated
1198 * internally due to a
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001199 * received PDU has an invalid
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301200 * DataSN
1201 */
1202#define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation
1203 * completion notify.
1204 */
1205#define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation
1206 * completion
1207 * with data PDU index.
1208 */
1209#define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation
1210 * completionnotifify.
1211 */
1212#define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/
1213#define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +05301214#define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301215 * error notify.
1216 */
1217#define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based
1218 * notification.
1219 */
1220#define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
1221 * internally due to command
1222 * and data are not on same
1223 * connection.
1224 */
1225#define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got
1226 * invalidated internally due
1227 * to DIF error
1228 */
1229#define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated
1230 * internally due to incoming
1231 * TCP SYN
1232 */
1233#define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated
1234 * internally due to an
1235 * incoming Unsolicited PDU
1236 * that has immediate data on
1237 * the cxn
1238 */
1239
Jayamohan Kallickale9b91192010-07-22 04:24:53 +05301240int beiscsi_pci_soft_reset(struct beiscsi_hba *phba);
1241int be_chk_reset_complete(struct beiscsi_hba *phba);
1242
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301243void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1244 bool embedded, u8 sge_cnt);
1245
1246void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1247 u8 subsystem, u8 opcode, int cmd_len);
1248
1249#endif /* !BEISCSI_CMDS_H */