blob: c560e9dbe7a94b05d7e1da9e21248691e7b06f03 [file] [log] [blame]
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301/**
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -07002 * Copyright (C) 2005 - 2011 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
55
56#define CQE_STATUS_COMPL_MASK 0xFFFF
57#define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
58#define CQE_STATUS_EXTD_MASK 0xFFFF
Jayamohan Kallickalb38c1e82010-07-22 04:28:13 +053059#define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053060
John Soni Joseeaae5262012-10-20 04:43:44 +053061/* MBOX Command VER */
62#define MBX_CMD_VER2 0x02
63
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053064struct be_mcc_compl {
65 u32 status; /* dword 0 */
66 u32 tag0; /* dword 1 */
67 u32 tag1; /* dword 2 */
68 u32 flags; /* dword 3 */
69};
70
71/********* Mailbox door bell *************/
72/**
73 * Used for driver communication with the FW.
74 * The software must write this register twice to post any command. First,
75 * it writes the register with hi=1 and the upper bits of the physical address
76 * for the MAILBOX structure. Software must poll the ready bit until this
77 * is acknowledged. Then, sotware writes the register with hi=0 with the lower
78 * bits in the address. It must poll the ready bit until the command is
79 * complete. Upon completion, the MAILBOX will contain a valid completion
80 * queue entry.
81 */
82#define MPU_MAILBOX_DB_OFFSET 0x160
83#define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */
84#define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */
85
86/********** MPU semphore ******************/
87#define MPU_EP_SEMAPHORE_OFFSET 0xac
88#define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
89#define EP_SEMAPHORE_POST_ERR_MASK 0x1
90#define EP_SEMAPHORE_POST_ERR_SHIFT 31
91
92/********** MCC door bell ************/
93#define DB_MCCQ_OFFSET 0x140
94#define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */
95/* Number of entries posted */
96#define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */
97
98/* MPU semphore POST stage values */
99#define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */
100
101/**
102 * When the async bit of mcc_compl is set, the last 4 bytes of
103 * mcc_compl is interpreted as follows:
104 */
105#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
106#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
107#define ASYNC_EVENT_CODE_LINK_STATE 0x1
108struct be_async_event_trailer {
109 u32 code;
110};
111
112enum {
113 ASYNC_EVENT_LINK_DOWN = 0x0,
114 ASYNC_EVENT_LINK_UP = 0x1
115};
116
117/**
118 * When the event code of an async trailer is link-state, the mcc_compl
119 * must be interpreted as follows
120 */
121struct be_async_event_link_state {
122 u8 physical_port;
123 u8 port_link_status;
124 u8 port_duplex;
125 u8 port_speed;
126 u8 port_fault;
127 u8 rsvd0[7];
128 struct be_async_event_trailer trailer;
129} __packed;
130
131struct be_mcc_mailbox {
132 struct be_mcc_wrb wrb;
133 struct be_mcc_compl compl;
134};
135
136/* Type of subsystems supported by FW */
137#define CMD_SUBSYSTEM_COMMON 0x1
138#define CMD_SUBSYSTEM_ISCSI 0x2
139#define CMD_SUBSYSTEM_ETH 0x3
140#define CMD_SUBSYSTEM_ISCSI_INI 0x6
141#define CMD_COMMON_TCP_UPLOAD 0x1
142
143/**
144 * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON
145 * These opcodes are unique for each subsystem defined above
146 */
147#define OPCODE_COMMON_CQ_CREATE 12
148#define OPCODE_COMMON_EQ_CREATE 13
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530149#define OPCODE_COMMON_MCC_CREATE 21
150#define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530151#define OPCODE_COMMON_GET_FW_VERSION 35
152#define OPCODE_COMMON_MODIFY_EQ_DELAY 41
153#define OPCODE_COMMON_FIRMWARE_CONFIG 42
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530154#define OPCODE_COMMON_MCC_DESTROY 53
155#define OPCODE_COMMON_CQ_DESTROY 54
156#define OPCODE_COMMON_EQ_DESTROY 55
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530157#define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
158#define OPCODE_COMMON_FUNCTION_RESET 61
159
160/**
161 * LIST of opcodes that are common between Initiator and Target
162 * used by CMD_SUBSYSTEM_ISCSI
163 * These opcodes are unique for each subsystem defined above
164 */
165#define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2
166#define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3
167#define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530168#define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14
Mike Christie0e438952012-04-03 23:41:51 -0500169#define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17
170#define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530171#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21
172#define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22
173#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
174#define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24
175#define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530176#define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
177#define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530178#define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530179#define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +0530180#define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530181
182struct be_cmd_req_hdr {
183 u8 opcode; /* dword 0 */
184 u8 subsystem; /* dword 0 */
185 u8 port_number; /* dword 0 */
186 u8 domain; /* dword 0 */
187 u32 timeout; /* dword 1 */
188 u32 request_length; /* dword 2 */
John Soni Joseeaae5262012-10-20 04:43:44 +0530189 u8 version; /* dword 3 */
190 u8 rsvd0[3]; /* dword 3 */
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530191};
192
193struct be_cmd_resp_hdr {
194 u32 info; /* dword 0 */
195 u32 status; /* dword 1 */
196 u32 response_length; /* dword 2 */
197 u32 actual_resp_len; /* dword 3 */
198};
199
200struct phys_addr {
201 u32 lo;
202 u32 hi;
203};
204
205/**************************
206 * BE Command definitions *
207 **************************/
208
209/**
210 * Pseudo amap definition in which each bit of the actual structure is defined
211 * as a byte - used to calculate offset/shift/mask of each field
212 */
213struct amap_eq_context {
214 u8 cidx[13]; /* dword 0 */
215 u8 rsvd0[3]; /* dword 0 */
216 u8 epidx[13]; /* dword 0 */
217 u8 valid; /* dword 0 */
218 u8 rsvd1; /* dword 0 */
219 u8 size; /* dword 0 */
220 u8 pidx[13]; /* dword 1 */
221 u8 rsvd2[3]; /* dword 1 */
222 u8 pd[10]; /* dword 1 */
223 u8 count[3]; /* dword 1 */
224 u8 solevent; /* dword 1 */
225 u8 stalled; /* dword 1 */
226 u8 armed; /* dword 1 */
227 u8 rsvd3[4]; /* dword 2 */
228 u8 func[8]; /* dword 2 */
229 u8 rsvd4; /* dword 2 */
230 u8 delaymult[10]; /* dword 2 */
231 u8 rsvd5[2]; /* dword 2 */
232 u8 phase[2]; /* dword 2 */
233 u8 nodelay; /* dword 2 */
234 u8 rsvd6[4]; /* dword 2 */
235 u8 rsvd7[32]; /* dword 3 */
236} __packed;
237
238struct be_cmd_req_eq_create {
239 struct be_cmd_req_hdr hdr; /* dw[4] */
240 u16 num_pages; /* sword */
241 u16 rsvd0; /* sword */
242 u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */
243 struct phys_addr pages[8];
244} __packed;
245
246struct be_cmd_resp_eq_create {
247 struct be_cmd_resp_hdr resp_hdr;
248 u16 eq_id; /* sword */
249 u16 rsvd0; /* sword */
250} __packed;
251
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530252struct mgmt_chap_format {
253 u32 flags;
254 u8 intr_chap_name[256];
255 u8 intr_secret[16];
256 u8 target_chap_name[256];
257 u8 target_secret[16];
258 u16 intr_chap_name_length;
259 u16 intr_secret_length;
260 u16 target_chap_name_length;
261 u16 target_secret_length;
262} __packed;
263
264struct mgmt_auth_method_format {
265 u8 auth_method_type;
266 u8 padding[3];
267 struct mgmt_chap_format chap;
268} __packed;
269
270struct mgmt_conn_login_options {
271 u8 flags;
272 u8 header_digest;
273 u8 data_digest;
274 u8 rsvd0;
275 u32 max_recv_datasegment_len_ini;
276 u32 max_recv_datasegment_len_tgt;
277 u32 tcp_mss;
278 u32 tcp_window_size;
279 struct mgmt_auth_method_format auth_data;
280} __packed;
281
Mike Christie0e438952012-04-03 23:41:51 -0500282struct ip_addr_format {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530283 u16 size_of_structure;
284 u8 reserved;
285 u8 ip_type;
Mike Christie0e438952012-04-03 23:41:51 -0500286 u8 addr[16];
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530287 u32 rsvd0;
288} __packed;
289
Mike Christie0e438952012-04-03 23:41:51 -0500290struct mgmt_conn_info {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530291 u32 connection_handle;
292 u32 connection_status;
293 u16 src_port;
294 u16 dest_port;
295 u16 dest_port_redirected;
296 u16 cid;
297 u32 estimated_throughput;
Mike Christie0e438952012-04-03 23:41:51 -0500298 struct ip_addr_format src_ipaddr;
299 struct ip_addr_format dest_ipaddr;
300 struct ip_addr_format dest_ipaddr_redirected;
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530301 struct mgmt_conn_login_options negotiated_login_options;
302} __packed;
303
304struct mgmt_session_login_options {
305 u8 flags;
306 u8 error_recovery_level;
307 u16 rsvd0;
308 u32 first_burst_length;
309 u32 max_burst_length;
310 u16 max_connections;
311 u16 max_outstanding_r2t;
312 u16 default_time2wait;
313 u16 default_time2retain;
314} __packed;
315
316struct mgmt_session_info {
317 u32 session_handle;
318 u32 status;
319 u8 isid[6];
320 u16 tsih;
321 u32 session_flags;
322 u16 conn_count;
323 u16 pad;
324 u8 target_name[224];
325 u8 initiator_iscsiname[224];
326 struct mgmt_session_login_options negotiated_login_options;
327 struct mgmt_conn_info conn_list[1];
328} __packed;
329
Mike Christie0e438952012-04-03 23:41:51 -0500330struct be_cmd_get_session_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530331 struct be_cmd_req_hdr hdr;
332 u32 session_handle;
333} __packed;
334
Mike Christie0e438952012-04-03 23:41:51 -0500335struct be_cmd_get_session_resp {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530336 struct be_cmd_resp_hdr hdr;
337 struct mgmt_session_info session_info;
338} __packed;
339
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530340struct mac_addr {
Mike Christie0e438952012-04-03 23:41:51 -0500341 u16 size_of_structure;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530342 u8 addr[ETH_ALEN];
343} __packed;
344
Mike Christie0e438952012-04-03 23:41:51 -0500345struct be_cmd_get_boot_target_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530346 struct be_cmd_req_hdr hdr;
347} __packed;
348
Mike Christie0e438952012-04-03 23:41:51 -0500349struct be_cmd_get_boot_target_resp {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530350 struct be_cmd_resp_hdr hdr;
351 u32 boot_session_count;
352 int boot_session_handle;
353};
354
John Soni Jose9aef4202012-08-20 23:00:08 +0530355struct be_cmd_reopen_session_req {
356 struct be_cmd_req_hdr hdr;
357#define BE_REOPEN_ALL_SESSIONS 0x00
358#define BE_REOPEN_BOOT_SESSIONS 0x01
359#define BE_REOPEN_A_SESSION 0x02
360 u16 reopen_type;
361 u16 rsvd;
362 u32 session_handle;
363} __packed;
364
365struct be_cmd_reopen_session_resp {
366 struct be_cmd_resp_hdr hdr;
367 u32 rsvd;
368 u32 session_handle;
369} __packed;
370
371
Mike Christie0e438952012-04-03 23:41:51 -0500372struct be_cmd_mac_query_req {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530373 struct be_cmd_req_hdr hdr;
374 u8 type;
375 u8 permanent;
376 u16 if_id;
377} __packed;
378
Mike Christie0e438952012-04-03 23:41:51 -0500379struct be_cmd_get_mac_resp {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530380 struct be_cmd_resp_hdr hdr;
381 struct mac_addr mac;
382};
383
Mike Christie0e438952012-04-03 23:41:51 -0500384struct be_ip_addr_subnet_format {
385 u16 size_of_structure;
386 u8 ip_type;
387 u8 ipv6_prefix_length;
388 u8 addr[16];
389 u8 subnet_mask[16];
390 u32 rsvd0;
391} __packed;
392
393struct be_cmd_get_if_info_req {
394 struct be_cmd_req_hdr hdr;
395 u32 interface_hndl;
396 u32 ip_type;
397} __packed;
398
399struct be_cmd_get_if_info_resp {
400 struct be_cmd_req_hdr hdr;
401 u32 interface_hndl;
402 u32 vlan_priority;
403 u32 ip_addr_count;
404 u32 dhcp_state;
405 struct be_ip_addr_subnet_format ip_addr;
406} __packed;
407
408struct be_ip_addr_record {
409 u32 action;
410 u32 interface_hndl;
411 struct be_ip_addr_subnet_format ip_addr;
412 u32 status;
413} __packed;
414
415struct be_ip_addr_record_params {
416 u32 record_entry_count;
417 struct be_ip_addr_record ip_record;
418} __packed;
419
420struct be_cmd_set_ip_addr_req {
421 struct be_cmd_req_hdr hdr;
422 struct be_ip_addr_record_params ip_params;
423} __packed;
424
425
426struct be_cmd_set_dhcp_req {
427 struct be_cmd_req_hdr hdr;
428 u32 interface_hndl;
429 u32 ip_type;
430 u32 flags;
431 u32 retry_count;
432} __packed;
433
434struct be_cmd_rel_dhcp_req {
435 struct be_cmd_req_hdr hdr;
436 u32 interface_hndl;
437 u32 ip_type;
438} __packed;
439
440struct be_cmd_set_def_gateway_req {
441 struct be_cmd_req_hdr hdr;
442 u32 action;
443 struct ip_addr_format ip_addr;
444} __packed;
445
446struct be_cmd_get_def_gateway_req {
447 struct be_cmd_req_hdr hdr;
448 u32 ip_type;
449} __packed;
450
451struct be_cmd_get_def_gateway_resp {
452 struct be_cmd_req_hdr hdr;
453 struct ip_addr_format ip_addr;
454} __packed;
455
John Soni Jose6f72238e2012-08-20 23:00:43 +0530456#define BEISCSI_VLAN_DISABLE 0xFFFF
457struct be_cmd_set_vlan_req {
458 struct be_cmd_req_hdr hdr;
459 u32 interface_hndl;
460 u32 vlan_priority;
461} __packed;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530462/******************** Create CQ ***************************/
463/**
464 * Pseudo amap definition in which each bit of the actual structure is defined
465 * as a byte - used to calculate offset/shift/mask of each field
466 */
467struct amap_cq_context {
468 u8 cidx[11]; /* dword 0 */
469 u8 rsvd0; /* dword 0 */
470 u8 coalescwm[2]; /* dword 0 */
471 u8 nodelay; /* dword 0 */
472 u8 epidx[11]; /* dword 0 */
473 u8 rsvd1; /* dword 0 */
474 u8 count[2]; /* dword 0 */
475 u8 valid; /* dword 0 */
476 u8 solevent; /* dword 0 */
477 u8 eventable; /* dword 0 */
478 u8 pidx[11]; /* dword 1 */
479 u8 rsvd2; /* dword 1 */
480 u8 pd[10]; /* dword 1 */
481 u8 eqid[8]; /* dword 1 */
482 u8 stalled; /* dword 1 */
483 u8 armed; /* dword 1 */
484 u8 rsvd3[4]; /* dword 2 */
485 u8 func[8]; /* dword 2 */
486 u8 rsvd4[20]; /* dword 2 */
487 u8 rsvd5[32]; /* dword 3 */
488} __packed;
489
John Soni Joseeaae5262012-10-20 04:43:44 +0530490struct amap_cq_context_v2 {
491 u8 rsvd0[12]; /* dword 0 */
492 u8 coalescwm[2]; /* dword 0 */
493 u8 nodelay; /* dword 0 */
494 u8 rsvd1[12]; /* dword 0 */
495 u8 count[2]; /* dword 0 */
496 u8 valid; /* dword 0 */
497 u8 rsvd2; /* dword 0 */
498 u8 eventable; /* dword 0 */
499 u8 eqid[16]; /* dword 1 */
500 u8 rsvd3[15]; /* dword 1 */
501 u8 armed; /* dword 1 */
502 u8 cqecount[16];/* dword 2 */
503 u8 rsvd4[16]; /* dword 2 */
504 u8 rsvd5[32]; /* dword 3 */
505};
506
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530507struct be_cmd_req_cq_create {
508 struct be_cmd_req_hdr hdr;
509 u16 num_pages;
John Soni Joseeaae5262012-10-20 04:43:44 +0530510 u8 page_size;
511 u8 rsvd0;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530512 u8 context[sizeof(struct amap_cq_context) / 8];
513 struct phys_addr pages[4];
514} __packed;
515
516struct be_cmd_resp_cq_create {
517 struct be_cmd_resp_hdr hdr;
518 u16 cq_id;
519 u16 rsvd0;
520} __packed;
521
522/******************** Create MCCQ ***************************/
523/**
524 * Pseudo amap definition in which each bit of the actual structure is defined
525 * as a byte - used to calculate offset/shift/mask of each field
526 */
527struct amap_mcc_context {
528 u8 con_index[14];
529 u8 rsvd0[2];
530 u8 ring_size[4];
531 u8 fetch_wrb;
532 u8 fetch_r2t;
533 u8 cq_id[10];
534 u8 prod_index[14];
535 u8 fid[8];
536 u8 pdid[9];
537 u8 valid;
538 u8 rsvd1[32];
539 u8 rsvd2[32];
540} __packed;
541
542struct be_cmd_req_mcc_create {
543 struct be_cmd_req_hdr hdr;
544 u16 num_pages;
545 u16 rsvd0;
546 u8 context[sizeof(struct amap_mcc_context) / 8];
547 struct phys_addr pages[8];
548} __packed;
549
550struct be_cmd_resp_mcc_create {
551 struct be_cmd_resp_hdr hdr;
552 u16 id;
553 u16 rsvd0;
554} __packed;
555
556/******************** Q Destroy ***************************/
557/* Type of Queue to be destroyed */
558enum {
559 QTYPE_EQ = 1,
560 QTYPE_CQ,
561 QTYPE_MCCQ,
562 QTYPE_WRBQ,
563 QTYPE_DPDUQ,
564 QTYPE_SGL
565};
566
567struct be_cmd_req_q_destroy {
568 struct be_cmd_req_hdr hdr;
569 u16 id;
570 u16 bypass_flush; /* valid only for rx q destroy */
571} __packed;
572
573struct macaddr {
574 u8 byte[ETH_ALEN];
575};
576
577struct be_cmd_req_mcast_mac_config {
578 struct be_cmd_req_hdr hdr;
579 u16 num_mac;
580 u8 promiscuous;
581 u8 interface_id;
582 struct macaddr mac[32];
583} __packed;
584
585static inline void *embedded_payload(struct be_mcc_wrb *wrb)
586{
587 return wrb->payload.embedded_payload;
588}
589
590static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
591{
592 return &wrb->payload.sgl[0];
593}
594
595/******************** Modify EQ Delay *******************/
596struct be_cmd_req_modify_eq_delay {
597 struct be_cmd_req_hdr hdr;
598 u32 num_eq;
599 struct {
600 u32 eq_id;
601 u32 phase;
602 u32 delay_multiplier;
603 } delay[8];
604} __packed;
605
606/******************** Get MAC ADDR *******************/
607
608#define ETH_ALEN 6
609
Mike Christie0e438952012-04-03 23:41:51 -0500610struct be_cmd_get_nic_conf_req {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530611 struct be_cmd_req_hdr hdr;
612 u32 nic_port_count;
613 u32 speed;
614 u32 max_speed;
615 u32 link_state;
616 u32 max_frame_size;
617 u16 size_of_structure;
618 u8 mac_address[ETH_ALEN];
619 u32 rsvd[23];
620};
621
Mike Christie0e438952012-04-03 23:41:51 -0500622struct be_cmd_get_nic_conf_resp {
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530623 struct be_cmd_resp_hdr hdr;
624 u32 nic_port_count;
625 u32 speed;
626 u32 max_speed;
627 u32 link_state;
628 u32 max_frame_size;
629 u16 size_of_structure;
630 u8 mac_address[6];
631 u32 rsvd[23];
632};
633
John Soni Jose21771992012-04-03 23:41:49 -0500634#define BEISCSI_ALIAS_LEN 32
635
636struct be_cmd_hba_name {
637 struct be_cmd_req_hdr hdr;
638 u16 flags;
639 u16 rsvd0;
640 u8 initiator_name[ISCSI_NAME_LEN];
641 u8 initiator_alias[BEISCSI_ALIAS_LEN];
642} __packed;
643
John Soni Josec62eef02012-04-03 23:41:52 -0500644struct be_cmd_ntwk_link_status_req {
645 struct be_cmd_req_hdr hdr;
646 u32 rsvd0;
647} __packed;
648
649/*** Port Speed Values ***/
650#define BE2ISCSI_LINK_SPEED_ZERO 0x00
651#define BE2ISCSI_LINK_SPEED_10MBPS 0x01
652#define BE2ISCSI_LINK_SPEED_100MBPS 0x02
653#define BE2ISCSI_LINK_SPEED_1GBPS 0x03
654#define BE2ISCSI_LINK_SPEED_10GBPS 0x04
655struct be_cmd_ntwk_link_status_resp {
656 struct be_cmd_resp_hdr hdr;
657 u8 phys_port;
658 u8 mac_duplex;
659 u8 mac_speed;
660 u8 mac_fault;
661 u8 mgmt_mac_duplex;
662 u8 mgmt_mac_speed;
663 u16 qos_link_speed;
664 u32 logical_link_speed;
665} __packed;
John Soni Jose21771992012-04-03 23:41:49 -0500666
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530667int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
668 struct be_queue_info *eq, int eq_delay);
669
670int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
671 struct be_queue_info *cq, struct be_queue_info *eq,
672 bool sol_evts, bool no_delay,
673 int num_cqe_dma_coalesce);
674
675int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
676 int type);
Jayamohan Kallickal35e66012009-10-23 11:53:49 +0530677int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530678 struct be_queue_info *mccq,
679 struct be_queue_info *cq);
680
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530681int be_poll_mcc(struct be_ctrl_info *ctrl);
Jayamohan Kallickal03a12312010-07-22 04:17:16 +0530682int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530683 struct beiscsi_hba *phba);
John Soni Jose21771992012-04-03 23:41:49 -0500684unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
John Soni Josec62eef02012-04-03 23:41:52 -0500685unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530686
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530687void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530688/*ISCSI Functuions */
689int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
690
691struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530692struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
693int be_mcc_notify_wait(struct beiscsi_hba *phba);
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530694void be_mcc_notify(struct beiscsi_hba *phba);
695unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
696void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
697 struct be_async_event_link_state *evt);
698int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
699 struct be_mcc_compl *compl);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530700
701int be_mbox_notify(struct be_ctrl_info *ctrl);
702
703int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
704 struct be_queue_info *cq,
705 struct be_queue_info *dq, int length,
706 int entry_size);
707
708int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
709 struct be_dma_mem *q_mem, u32 page_offset,
710 u32 num_pages);
711
Jayamohan Kallickale5285862011-10-07 19:31:08 -0500712int beiscsi_cmd_reset_function(struct beiscsi_hba *phba);
713
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530714int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
715 struct be_queue_info *wrbq);
716
Jayamohan Kallickal756d29c2010-01-05 05:10:46 +0530717bool is_link_state_evt(u32 trailer);
718
John Soni Jose6f72238e2012-08-20 23:00:43 +0530719/* Configuration Functions */
720int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
721
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530722struct be_default_pdu_context {
723 u32 dw[4];
724} __packed;
725
726struct amap_be_default_pdu_context {
727 u8 dbuf_cindex[13]; /* dword 0 */
728 u8 rsvd0[3]; /* dword 0 */
729 u8 ring_size[4]; /* dword 0 */
730 u8 ring_state[4]; /* dword 0 */
731 u8 rsvd1[8]; /* dword 0 */
732 u8 dbuf_pindex[13]; /* dword 1 */
733 u8 rsvd2; /* dword 1 */
734 u8 pci_func_id[8]; /* dword 1 */
735 u8 rx_pdid[9]; /* dword 1 */
736 u8 rx_pdid_valid; /* dword 1 */
737 u8 default_buffer_size[16]; /* dword 2 */
738 u8 cq_id_recv[10]; /* dword 2 */
739 u8 rx_pdid_not_valid; /* dword 2 */
740 u8 rsvd3[5]; /* dword 2 */
741 u8 rsvd4[32]; /* dword 3 */
742} __packed;
743
744struct be_defq_create_req {
745 struct be_cmd_req_hdr hdr;
746 u16 num_pages;
747 u8 ulp_num;
748 u8 rsvd0;
749 struct be_default_pdu_context context;
750 struct phys_addr pages[8];
751} __packed;
752
753struct be_defq_create_resp {
754 struct be_cmd_req_hdr hdr;
755 u16 id;
756 u16 rsvd0;
757} __packed;
758
759struct be_post_sgl_pages_req {
760 struct be_cmd_req_hdr hdr;
761 u16 num_pages;
762 u16 page_offset;
763 u32 rsvd0;
764 struct phys_addr pages[26];
765 u32 rsvd1;
766} __packed;
767
768struct be_wrbq_create_req {
769 struct be_cmd_req_hdr hdr;
770 u16 num_pages;
771 u8 ulp_num;
772 u8 rsvd0;
773 struct phys_addr pages[8];
774} __packed;
775
776struct be_wrbq_create_resp {
777 struct be_cmd_resp_hdr resp_hdr;
778 u16 cid;
779 u16 rsvd0;
780} __packed;
781
782#define SOL_CID_MASK 0x0000FFC0
783#define SOL_CODE_MASK 0x0000003F
784#define SOL_WRB_INDEX_MASK 0x00FF0000
785#define SOL_CMD_WND_MASK 0xFF000000
786#define SOL_RES_CNT_MASK 0x7FFFFFFF
787#define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
788#define SOL_HW_STS_MASK 0x000000FF
789#define SOL_STS_MASK 0x0000FF00
790#define SOL_RESP_MASK 0x00FF0000
791#define SOL_FLAGS_MASK 0x7F000000
792#define SOL_S_MASK 0x80000000
793
794struct sol_cqe {
795 u32 dw[4];
796};
797
798struct amap_sol_cqe {
799 u8 hw_sts[8]; /* dword 0 */
800 u8 i_sts[8]; /* dword 0 */
801 u8 i_resp[8]; /* dword 0 */
802 u8 i_flags[7]; /* dword 0 */
803 u8 s; /* dword 0 */
804 u8 i_exp_cmd_sn[32]; /* dword 1 */
805 u8 code[6]; /* dword 2 */
806 u8 cid[10]; /* dword 2 */
807 u8 wrb_index[8]; /* dword 2 */
808 u8 i_cmd_wnd[8]; /* dword 2 */
809 u8 i_res_cnt[31]; /* dword 3 */
810 u8 valid; /* dword 3 */
811} __packed;
812
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530813#define SOL_ICD_INDEX_MASK 0x0003FFC0
814struct amap_sol_cqe_ring {
815 u8 hw_sts[8]; /* dword 0 */
816 u8 i_sts[8]; /* dword 0 */
817 u8 i_resp[8]; /* dword 0 */
818 u8 i_flags[7]; /* dword 0 */
819 u8 s; /* dword 0 */
820 u8 i_exp_cmd_sn[32]; /* dword 1 */
821 u8 code[6]; /* dword 2 */
822 u8 icd_index[12]; /* dword 2 */
823 u8 rsvd[6]; /* dword 2 */
824 u8 i_cmd_wnd[8]; /* dword 2 */
825 u8 i_res_cnt[31]; /* dword 3 */
826 u8 valid; /* dword 3 */
827} __packed;
828
829
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530830
831/**
832 * Post WRB Queue Doorbell Register used by the host Storage
833 * stack to notify the
834 * controller of a posted Work Request Block
835 */
836#define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */
837#define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */
838
839#define DB_DEF_PDU_WRB_INDEX_SHIFT 16
840#define DB_DEF_PDU_NUM_POSTED_SHIFT 24
841
842struct fragnum_bits_for_sgl_cra_in {
843 struct be_cmd_req_hdr hdr;
844 u32 num_bits;
845} __packed;
846
847struct iscsi_cleanup_req {
848 struct be_cmd_req_hdr hdr;
849 u16 chute;
850 u8 hdr_ring_id;
851 u8 data_ring_id;
852
853} __packed;
854
855struct eq_delay {
856 u32 eq_id;
857 u32 phase;
858 u32 delay_multiplier;
859} __packed;
860
861struct be_eq_delay_params_in {
862 struct be_cmd_req_hdr hdr;
863 u32 num_eq;
864 struct eq_delay delay[8];
865} __packed;
866
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530867struct tcp_connect_and_offload_in {
868 struct be_cmd_req_hdr hdr;
Mike Christie0e438952012-04-03 23:41:51 -0500869 struct ip_addr_format ip_address;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530870 u16 tcp_port;
871 u16 cid;
872 u16 cq_id;
873 u16 defq_id;
874 struct phys_addr dataout_template_pa;
875 u16 hdr_ring_id;
876 u16 data_ring_id;
877 u8 do_offload;
878 u8 rsvd0[3];
879} __packed;
880
881struct tcp_connect_and_offload_out {
882 struct be_cmd_resp_hdr hdr;
883 u32 connection_handle;
884 u16 cid;
885 u16 rsvd0;
886
887} __packed;
888
889struct be_mcc_wrb_context {
890 struct MCC_WRB *wrb;
891 int *users_final_status;
892} __packed;
893
894#define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */
895#define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */
896#define DB_DEF_PDU_REARM_SHIFT 14
897#define DB_DEF_PDU_EVENT_SHIFT 15
898#define DB_DEF_PDU_CQPROC_SHIFT 16
899
900struct dmsg_cqe {
901 u32 dw[4];
902} __packed;
903
904struct tcp_upload_params_in {
905 struct be_cmd_req_hdr hdr;
906 u16 id;
907 u16 upload_type;
908 u32 reset_seq;
909} __packed;
910
911struct tcp_upload_params_out {
912 u32 dw[32];
913} __packed;
914
915union tcp_upload_params {
916 struct tcp_upload_params_in request;
917 struct tcp_upload_params_out response;
918} __packed;
919
920struct be_ulp_fw_cfg {
921 u32 ulp_mode;
922 u32 etx_base;
923 u32 etx_count;
924 u32 sq_base;
925 u32 sq_count;
926 u32 rq_base;
927 u32 rq_count;
928 u32 dq_base;
929 u32 dq_count;
930 u32 lro_base;
931 u32 lro_count;
932 u32 icd_base;
933 u32 icd_count;
934};
935
936struct be_fw_cfg {
937 struct be_cmd_req_hdr hdr;
938 u32 be_config_number;
939 u32 asic_revision;
940 u32 phys_port;
941 u32 function_mode;
942 struct be_ulp_fw_cfg ulp[2];
943 u32 function_caps;
944} __packed;
945
Mike Christie0e438952012-04-03 23:41:51 -0500946struct be_cmd_get_all_if_id_req {
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530947 struct be_cmd_req_hdr hdr;
948 u32 if_count;
949 u32 if_hndl_list[1];
950} __packed;
951
952#define ISCSI_OPCODE_SCSI_DATA_OUT 5
John Soni Josec62eef02012-04-03 23:41:52 -0500953#define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530954#define OPCODE_COMMON_MODIFY_EQ_DELAY 41
955#define OPCODE_COMMON_ISCSI_CLEANUP 59
956#define OPCODE_COMMON_TCP_UPLOAD 56
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530957#define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530958#define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530959#define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6
960#define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7
961#define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14
John Soni Jose9aef4202012-08-20 23:00:08 +0530962#define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530963#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530964#define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530965#define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52
Jayamohan Kallickalffce3e22012-04-03 23:41:50 -0500966#define OPCODE_COMMON_WRITE_FLASH 96
967#define OPCODE_COMMON_READ_FLASH 97
Jayamohan Kallickalc7acc5b2010-07-22 04:29:18 +0530968
969/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
970#define CMD_ISCSI_COMMAND_INVALIDATE 1
971#define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
972#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530973
974#define INI_WR_CMD 1 /* Initiator write command */
975#define INI_TMF_CMD 2 /* Initiator TMF command */
976#define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */
977#define INI_RD_CMD 5 /* Initiator requesting to send
978 * a read command
979 */
980#define TGT_CTX_UPDT_CMD 7 /* Target context update */
981#define TGT_STS_CMD 8 /* Target R2T and other BHS
982 * where only the status number
983 * need to be updated
984 */
985#define TGT_DATAIN_CMD 9 /* Target Data-Ins in response
986 * to read command
987 */
988#define TGT_SOS_PDU 10 /* Target:standalone status
989 * response
990 */
991#define TGT_DM_CMD 11 /* Indicates that the bhs
992 * preparedby
993 * driver should not be touched
994 */
995/* --- CMD_CHUTE_TYPE --- */
996#define CMD_CONNECTION_CHUTE_0 1
997#define CMD_CONNECTION_CHUTE_1 2
998#define CMD_CONNECTION_CHUTE_2 3
999
1000#define EQ_MAJOR_CODE_COMPLETION 0
1001
1002#define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
1003#define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
1004
1005/* --- CONNECTION_UPLOAD_PARAMS --- */
1006/* These parameters are used to define the type of upload desired. */
1007#define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */
1008#define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with
1009 * reset
1010 */
1011#define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without
1012 * reset
1013 */
1014#define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset,
1015 * sequence number by driver */
1016
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301017/* Returns the number of items in the field array. */
1018#define BE_NUMBER_OF_FIELD(_type_, _field_) \
1019 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1020
1021/**
1022 * Different types of iSCSI completions to host driver for both initiator
1023 * and taget mode
1024 * of operation.
1025 */
1026#define SOL_CMD_COMPLETE 1 /* Solicited command completed
1027 * normally
1028 */
1029#define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got
1030 * invalidated internally due
1031 * to Data Digest error
1032 */
1033#define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated
1034 * internally
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001035 * due to a received PDU
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301036 * size > DSL
1037 */
1038#define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated
1039 * internally due ti received
1040 * PDU sequence size >
1041 * FBL/MBL.
1042 */
1043#define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001044 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301045 * PDU Hdr that has
1046 * AHS */
1047#define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated
1048 * internally due to Hdr Digest
1049 * error
1050 */
1051#define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated
1052 * internally
1053 * due to a bad opcode in the
1054 * pdu hdr
1055 */
1056#define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001057 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301058 * ITT/TTT that does not belong
1059 * to this Connection
1060 */
1061#define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001062 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301063 * ITT/TTT value > Max
1064 * Supported ITTs/TTTs
1065 */
1066#define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated
1067 * internally due to an
1068 * incoming TCP RST
1069 */
1070#define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated
1071 * internally due to timeout on
1072 * tcp segment 12 retransmit
1073 * attempts failed
1074 */
1075#define CXN_KILLED_RST_SENT 12 /* Connection got invalidated
1076 * internally due to TCP RST
1077 * sent by the Tx side
1078 */
1079#define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated
1080 * internally due to an
1081 * incoming TCP FIN.
1082 */
1083#define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated
1084 * internally due to bad
1085 * unsolicited PDU Unsolicited
1086 * PDUs are PDUs with
1087 * ITT=0xffffffff
1088 */
1089#define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated
1090 * internally due to bad WRB
1091 * index.
1092 */
1093#define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001094 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301095 * command has residual
1096 * over run bytes.
1097 */
1098#define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001099 * internally due to received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301100 * command has residual under
1101 * run bytes.
1102 */
1103#define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001104 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301105 * PDU has an invalid StatusSN
1106 */
1107#define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001108 * internally due to a received
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301109 * an R2T with some invalid
1110 * fields in it
1111 */
1112#define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated
1113 * internally due to received
1114 * PDU has an invalid LUN.
1115 */
1116#define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated
1117 * internally due to the
1118 * corresponding ICD not in a
1119 * valid state
1120 */
1121#define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due
1122 * to received PDU has an
1123 * invalid ITT.
1124 */
1125#define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due
1126 * to received sequence buffer
1127 * offset is out of order.
1128 */
1129#define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated
1130 * internally due to a
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001131 * received PDU has an invalid
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301132 * DataSN
1133 */
1134#define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation
1135 * completion notify.
1136 */
1137#define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation
1138 * completion
1139 * with data PDU index.
1140 */
1141#define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation
1142 * completionnotifify.
1143 */
1144#define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/
1145#define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/
Jayamohan Kallickal457ff3b2010-07-22 04:16:00 +05301146#define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301147 * error notify.
1148 */
1149#define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based
1150 * notification.
1151 */
1152#define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
1153 * internally due to command
1154 * and data are not on same
1155 * connection.
1156 */
1157#define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got
1158 * invalidated internally due
1159 * to DIF error
1160 */
1161#define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated
1162 * internally due to incoming
1163 * TCP SYN
1164 */
1165#define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated
1166 * internally due to an
1167 * incoming Unsolicited PDU
1168 * that has immediate data on
1169 * the cxn
1170 */
1171
Jayamohan Kallickale9b91192010-07-22 04:24:53 +05301172int beiscsi_pci_soft_reset(struct beiscsi_hba *phba);
1173int be_chk_reset_complete(struct beiscsi_hba *phba);
1174
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301175void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1176 bool embedded, u8 sge_cnt);
1177
1178void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1179 u8 subsystem, u8 opcode, int cmd_len);
1180
1181#endif /* !BEISCSI_CMDS_H */