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