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