blob: 9b64b36035763d3af7203cfca909523a934daa34 [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
Jayamohan Kallickalef9e1b92013-04-05 20:38:27 -0700759struct amap_default_pdu_context_ext {
760 u8 rsvd0[16]; /* dword 0 */
761 u8 ring_size[4]; /* dword 0 */
762 u8 rsvd1[12]; /* dword 0 */
763 u8 rsvd2[22]; /* dword 1 */
764 u8 rx_pdid[9]; /* dword 1 */
765 u8 rx_pdid_valid; /* dword 1 */
766 u8 default_buffer_size[16]; /* dword 2 */
767 u8 cq_id_recv[16]; /* dword 2 */
768 u8 rsvd3[32]; /* dword 3 */
769} __packed;
770
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530771struct be_defq_create_req {
772 struct be_cmd_req_hdr hdr;
773 u16 num_pages;
774 u8 ulp_num;
775 u8 rsvd0;
776 struct be_default_pdu_context context;
777 struct phys_addr pages[8];
778} __packed;
779
780struct be_defq_create_resp {
781 struct be_cmd_req_hdr hdr;
782 u16 id;
783 u16 rsvd0;
784} __packed;
785
786struct be_post_sgl_pages_req {
787 struct be_cmd_req_hdr hdr;
788 u16 num_pages;
789 u16 page_offset;
790 u32 rsvd0;
791 struct phys_addr pages[26];
792 u32 rsvd1;
793} __packed;
794
795struct be_wrbq_create_req {
796 struct be_cmd_req_hdr hdr;
797 u16 num_pages;
798 u8 ulp_num;
799 u8 rsvd0;
800 struct phys_addr pages[8];
801} __packed;
802
803struct be_wrbq_create_resp {
804 struct be_cmd_resp_hdr resp_hdr;
805 u16 cid;
806 u16 rsvd0;
807} __packed;
808
809#define SOL_CID_MASK 0x0000FFC0
810#define SOL_CODE_MASK 0x0000003F
811#define SOL_WRB_INDEX_MASK 0x00FF0000
812#define SOL_CMD_WND_MASK 0xFF000000
813#define SOL_RES_CNT_MASK 0x7FFFFFFF
814#define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
815#define SOL_HW_STS_MASK 0x000000FF
816#define SOL_STS_MASK 0x0000FF00
817#define SOL_RESP_MASK 0x00FF0000
818#define SOL_FLAGS_MASK 0x7F000000
819#define SOL_S_MASK 0x80000000
820
821struct sol_cqe {
822 u32 dw[4];
823};
824
825struct amap_sol_cqe {
826 u8 hw_sts[8]; /* dword 0 */
827 u8 i_sts[8]; /* dword 0 */
828 u8 i_resp[8]; /* dword 0 */
829 u8 i_flags[7]; /* dword 0 */
830 u8 s; /* dword 0 */
831 u8 i_exp_cmd_sn[32]; /* dword 1 */
832 u8 code[6]; /* dword 2 */
833 u8 cid[10]; /* dword 2 */
834 u8 wrb_index[8]; /* dword 2 */
835 u8 i_cmd_wnd[8]; /* dword 2 */
836 u8 i_res_cnt[31]; /* dword 3 */
837 u8 valid; /* dword 3 */
838} __packed;
839
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530840#define SOL_ICD_INDEX_MASK 0x0003FFC0
841struct amap_sol_cqe_ring {
842 u8 hw_sts[8]; /* dword 0 */
843 u8 i_sts[8]; /* dword 0 */
844 u8 i_resp[8]; /* dword 0 */
845 u8 i_flags[7]; /* dword 0 */
846 u8 s; /* dword 0 */
847 u8 i_exp_cmd_sn[32]; /* dword 1 */
848 u8 code[6]; /* dword 2 */
849 u8 icd_index[12]; /* dword 2 */
850 u8 rsvd[6]; /* dword 2 */
851 u8 i_cmd_wnd[8]; /* dword 2 */
852 u8 i_res_cnt[31]; /* dword 3 */
853 u8 valid; /* dword 3 */
854} __packed;
855
John Soni Jose73133262012-10-20 04:44:49 +0530856struct amap_sol_cqe_v2 {
857 u8 hw_sts[8]; /* dword 0 */
858 u8 i_sts[8]; /* dword 0 */
859 u8 wrb_index[16]; /* dword 0 */
860 u8 i_exp_cmd_sn[32]; /* dword 1 */
861 u8 code[6]; /* dword 2 */
862 u8 cmd_cmpl; /* dword 2 */
863 u8 rsvd0; /* dword 2 */
864 u8 i_cmd_wnd[8]; /* dword 2 */
865 u8 cid[13]; /* dword 2 */
866 u8 u; /* dword 2 */
867 u8 o; /* dword 2 */
868 u8 s; /* dword 2 */
869 u8 i_res_cnt[31]; /* dword 3 */
870 u8 valid; /* dword 3 */
871} __packed;
872
873struct common_sol_cqe {
874 u32 exp_cmdsn;
875 u32 res_cnt;
876 u16 wrb_index;
877 u16 cid;
878 u8 hw_sts;
879 u8 cmd_wnd;
880 u8 res_flag; /* the s feild of structure */
881 u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */
882 u8 i_flags; /* for skh or the u and o feilds */
883 u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */
884};
885
886/*** iSCSI ack/driver message completions ***/
887struct amap_it_dmsg_cqe {
888 u8 ack_num[32]; /* DWORD 0 */
889 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
890 u8 code[6]; /* DWORD 2 */
891 u8 cid[10]; /* DWORD 2 */
892 u8 wrb_idx[8]; /* DWORD 2 */
893 u8 rsvd0[8]; /* DWORD 2*/
894 u8 rsvd1[31]; /* DWORD 3*/
895 u8 valid; /* DWORD 3 */
896} __packed;
897
898struct amap_it_dmsg_cqe_v2 {
899 u8 ack_num[32]; /* DWORD 0 */
900 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */
901 u8 code[6]; /* DWORD 2 */
902 u8 rsvd0[10]; /* DWORD 2 */
903 u8 wrb_idx[16]; /* DWORD 2 */
904 u8 rsvd1[16]; /* DWORD 3 */
905 u8 cid[13]; /* DWORD 3 */
906 u8 rsvd2[2]; /* DWORD 3 */
907 u8 valid; /* DWORD 3 */
908} __packed;
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530909
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530910
911/**
912 * Post WRB Queue Doorbell Register used by the host Storage
913 * stack to notify the
914 * controller of a posted Work Request Block
915 */
Jayamohan Kallickalef9e1b92013-04-05 20:38:27 -0700916#define DB_WRB_POST_CID_MASK 0xFFFF /* bits 0 - 16 */
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530917#define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */
918
919#define DB_DEF_PDU_WRB_INDEX_SHIFT 16
920#define DB_DEF_PDU_NUM_POSTED_SHIFT 24
921
922struct fragnum_bits_for_sgl_cra_in {
923 struct be_cmd_req_hdr hdr;
924 u32 num_bits;
925} __packed;
926
927struct iscsi_cleanup_req {
928 struct be_cmd_req_hdr hdr;
929 u16 chute;
930 u8 hdr_ring_id;
931 u8 data_ring_id;
932
933} __packed;
934
935struct eq_delay {
936 u32 eq_id;
937 u32 phase;
938 u32 delay_multiplier;
939} __packed;
940
941struct be_eq_delay_params_in {
942 struct be_cmd_req_hdr hdr;
943 u32 num_eq;
944 struct eq_delay delay[8];
945} __packed;
946
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530947struct tcp_connect_and_offload_in {
948 struct be_cmd_req_hdr hdr;
Mike Christie0e438952012-04-03 23:41:51 -0500949 struct ip_addr_format ip_address;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530950 u16 tcp_port;
951 u16 cid;
952 u16 cq_id;
953 u16 defq_id;
954 struct phys_addr dataout_template_pa;
955 u16 hdr_ring_id;
956 u16 data_ring_id;
957 u8 do_offload;
958 u8 rsvd0[3];
959} __packed;
960
961struct tcp_connect_and_offload_out {
962 struct be_cmd_resp_hdr hdr;
963 u32 connection_handle;
964 u16 cid;
965 u16 rsvd0;
966
967} __packed;
968
969struct be_mcc_wrb_context {
970 struct MCC_WRB *wrb;
971 int *users_final_status;
972} __packed;
973
974#define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */
975#define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */
976#define DB_DEF_PDU_REARM_SHIFT 14
977#define DB_DEF_PDU_EVENT_SHIFT 15
978#define DB_DEF_PDU_CQPROC_SHIFT 16
979
980struct dmsg_cqe {
981 u32 dw[4];
982} __packed;
983
984struct tcp_upload_params_in {
985 struct be_cmd_req_hdr hdr;
986 u16 id;
987 u16 upload_type;
988 u32 reset_seq;
989} __packed;
990
991struct tcp_upload_params_out {
992 u32 dw[32];
993} __packed;
994
995union tcp_upload_params {
996 struct tcp_upload_params_in request;
997 struct tcp_upload_params_out response;
998} __packed;
999
1000struct be_ulp_fw_cfg {
1001 u32 ulp_mode;
1002 u32 etx_base;
1003 u32 etx_count;
1004 u32 sq_base;
1005 u32 sq_count;
1006 u32 rq_base;
1007 u32 rq_count;
1008 u32 dq_base;
1009 u32 dq_count;
1010 u32 lro_base;
1011 u32 lro_count;
1012 u32 icd_base;
1013 u32 icd_count;
1014};
1015
1016struct be_fw_cfg {
1017 struct be_cmd_req_hdr hdr;
1018 u32 be_config_number;
1019 u32 asic_revision;
1020 u32 phys_port;
1021 u32 function_mode;
1022 struct be_ulp_fw_cfg ulp[2];
1023 u32 function_caps;
1024} __packed;
1025
Mike Christie0e438952012-04-03 23:41:51 -05001026struct be_cmd_get_all_if_id_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301027 struct be_cmd_req_hdr hdr;
1028 u32 if_count;
1029 u32 if_hndl_list[1];
1030} __packed;
1031
1032#define ISCSI_OPCODE_SCSI_DATA_OUT 5
John Soni Josec62eef02012-04-03 23:41:52 -05001033#define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301034#define OPCODE_COMMON_MODIFY_EQ_DELAY 41
1035#define OPCODE_COMMON_ISCSI_CLEANUP 59
1036#define OPCODE_COMMON_TCP_UPLOAD 56
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301037#define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301038#define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301039#define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6
1040#define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7
1041#define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14
John Soni Jose9aef4202012-08-20 23:00:08 +05301042#define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301043#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301044#define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301045#define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52
Jayamohan Kallickalffce3e22012-04-03 23:41:50 -05001046#define OPCODE_COMMON_WRITE_FLASH 96
1047#define OPCODE_COMMON_READ_FLASH 97
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +05301048
1049/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
1050#define CMD_ISCSI_COMMAND_INVALIDATE 1
1051#define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
1052#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301053
1054#define INI_WR_CMD 1 /* Initiator write command */
1055#define INI_TMF_CMD 2 /* Initiator TMF command */
1056#define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */
1057#define INI_RD_CMD 5 /* Initiator requesting to send
1058 * a read command
1059 */
1060#define TGT_CTX_UPDT_CMD 7 /* Target context update */
1061#define TGT_STS_CMD 8 /* Target R2T and other BHS
1062 * where only the status number
1063 * need to be updated
1064 */
1065#define TGT_DATAIN_CMD 9 /* Target Data-Ins in response
1066 * to read command
1067 */
1068#define TGT_SOS_PDU 10 /* Target:standalone status
1069 * response
1070 */
1071#define TGT_DM_CMD 11 /* Indicates that the bhs
1072 * preparedby
1073 * driver should not be touched
1074 */
1075/* --- CMD_CHUTE_TYPE --- */
1076#define CMD_CONNECTION_CHUTE_0 1
1077#define CMD_CONNECTION_CHUTE_1 2
1078#define CMD_CONNECTION_CHUTE_2 3
1079
1080#define EQ_MAJOR_CODE_COMPLETION 0
1081
1082#define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
1083#define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
1084
1085/* --- CONNECTION_UPLOAD_PARAMS --- */
1086/* These parameters are used to define the type of upload desired. */
1087#define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */
1088#define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with
1089 * reset
1090 */
1091#define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without
1092 * reset
1093 */
1094#define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset,
1095 * sequence number by driver */
1096
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301097/* Returns the number of items in the field array. */
1098#define BE_NUMBER_OF_FIELD(_type_, _field_) \
1099 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1100
1101/**
1102 * Different types of iSCSI completions to host driver for both initiator
1103 * and taget mode
1104 * of operation.
1105 */
1106#define SOL_CMD_COMPLETE 1 /* Solicited command completed
1107 * normally
1108 */
1109#define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got
1110 * invalidated internally due
1111 * to Data Digest error
1112 */
1113#define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated
1114 * internally
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001115 * due to a received PDU
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301116 * size > DSL
1117 */
1118#define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated
1119 * internally due ti received
1120 * PDU sequence size >
1121 * FBL/MBL.
1122 */
1123#define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001124 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301125 * PDU Hdr that has
1126 * AHS */
1127#define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated
1128 * internally due to Hdr Digest
1129 * error
1130 */
1131#define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated
1132 * internally
1133 * due to a bad opcode in the
1134 * pdu hdr
1135 */
1136#define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001137 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301138 * ITT/TTT that does not belong
1139 * to this Connection
1140 */
1141#define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001142 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301143 * ITT/TTT value > Max
1144 * Supported ITTs/TTTs
1145 */
1146#define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated
1147 * internally due to an
1148 * incoming TCP RST
1149 */
1150#define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated
1151 * internally due to timeout on
1152 * tcp segment 12 retransmit
1153 * attempts failed
1154 */
1155#define CXN_KILLED_RST_SENT 12 /* Connection got invalidated
1156 * internally due to TCP RST
1157 * sent by the Tx side
1158 */
1159#define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated
1160 * internally due to an
1161 * incoming TCP FIN.
1162 */
1163#define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated
1164 * internally due to bad
1165 * unsolicited PDU Unsolicited
1166 * PDUs are PDUs with
1167 * ITT=0xffffffff
1168 */
1169#define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated
1170 * internally due to bad WRB
1171 * index.
1172 */
1173#define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001174 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301175 * command has residual
1176 * over run bytes.
1177 */
1178#define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001179 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301180 * command has residual under
1181 * run bytes.
1182 */
1183#define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001184 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301185 * PDU has an invalid StatusSN
1186 */
1187#define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001188 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301189 * an R2T with some invalid
1190 * fields in it
1191 */
1192#define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated
1193 * internally due to received
1194 * PDU has an invalid LUN.
1195 */
1196#define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated
1197 * internally due to the
1198 * corresponding ICD not in a
1199 * valid state
1200 */
1201#define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due
1202 * to received PDU has an
1203 * invalid ITT.
1204 */
1205#define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due
1206 * to received sequence buffer
1207 * offset is out of order.
1208 */
1209#define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated
1210 * internally due to a
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001211 * received PDU has an invalid
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301212 * DataSN
1213 */
1214#define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation
1215 * completion notify.
1216 */
1217#define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation
1218 * completion
1219 * with data PDU index.
1220 */
1221#define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation
1222 * completionnotifify.
1223 */
1224#define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/
1225#define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +05301226#define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301227 * error notify.
1228 */
1229#define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based
1230 * notification.
1231 */
1232#define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
1233 * internally due to command
1234 * and data are not on same
1235 * connection.
1236 */
1237#define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got
1238 * invalidated internally due
1239 * to DIF error
1240 */
1241#define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated
1242 * internally due to incoming
1243 * TCP SYN
1244 */
1245#define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated
1246 * internally due to an
1247 * incoming Unsolicited PDU
1248 * that has immediate data on
1249 * the cxn
1250 */
1251
Jayamohan Kallickale9b91192010-07-22 04:24:53 +05301252int beiscsi_pci_soft_reset(struct beiscsi_hba *phba);
1253int be_chk_reset_complete(struct beiscsi_hba *phba);
1254
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301255void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1256 bool embedded, u8 sge_cnt);
1257
1258void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1259 u8 subsystem, u8 opcode, int cmd_len);
1260
1261#endif /* !BEISCSI_CMDS_H */