This source file includes following definitions.
- embedded_payload
- nonembedded_sgl
1
2
3
4
5
6
7
8
9
10 #ifndef BEISCSI_CMDS_H
11 #define BEISCSI_CMDS_H
12
13
14
15
16
17
18
19
20 struct be_sge {
21 __le32 pa_lo;
22 __le32 pa_hi;
23 __le32 len;
24 };
25
26 struct be_mcc_wrb {
27 u32 emb_sgecnt_special;
28
29
30
31
32
33 #define MCC_WRB_EMBEDDED_MASK 1
34 #define MCC_WRB_SGE_CNT_SHIFT 3
35 #define MCC_WRB_SGE_CNT_MASK 0x1F
36 u32 payload_length;
37 u32 tag0;
38 u32 tag1;
39 u32 rsvd;
40 union {
41 #define EMBED_MBX_MAX_PAYLOAD_SIZE 220
42 u8 embedded_payload[236];
43 struct be_sge sgl[19];
44 } payload;
45 };
46
47 #define CQE_FLAGS_VALID_MASK (1 << 31)
48 #define CQE_FLAGS_ASYNC_MASK (1 << 30)
49 #define CQE_FLAGS_COMPLETED_MASK (1 << 28)
50 #define CQE_FLAGS_CONSUMED_MASK (1 << 27)
51
52
53 #define MCC_STATUS_SUCCESS 0x0
54 #define MCC_STATUS_FAILED 0x1
55 #define MCC_STATUS_ILLEGAL_REQUEST 0x2
56 #define MCC_STATUS_ILLEGAL_FIELD 0x3
57 #define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
58 #define MCC_STATUS_INVALID_LENGTH 0x74
59
60 #define CQE_STATUS_COMPL_MASK 0xFFFF
61 #define CQE_STATUS_COMPL_SHIFT 0
62 #define CQE_STATUS_EXTD_MASK 0xFFFF
63 #define CQE_STATUS_EXTD_SHIFT 16
64 #define CQE_STATUS_ADDL_MASK 0xFF00
65 #define CQE_STATUS_ADDL_SHIFT 8
66 #define CQE_STATUS_MASK 0xFF
67 #define CQE_STATUS_WRB_MASK 0xFF0000
68 #define CQE_STATUS_WRB_SHIFT 16
69
70 #define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
71 #define BEISCSI_FW_MBX_TIMEOUT 100
72
73
74 #define MBX_CMD_VER1 0x01
75 #define MBX_CMD_VER2 0x02
76
77 struct be_mcc_compl {
78 u32 status;
79 u32 tag0;
80 u32 tag1;
81 u32 flags;
82 };
83
84
85
86
87
88
89
90
91
92
93
94
95 #define MPU_MAILBOX_DB_OFFSET 0x160
96 #define MPU_MAILBOX_DB_RDY_MASK 0x1
97 #define MPU_MAILBOX_DB_HI_MASK 0x2
98
99
100 #define SLIPORT_SOFTRESET_OFFSET 0x5c
101 #define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac
102 #define SLIPORT_SEMAPHORE_OFFSET_SH 0x94
103 #define POST_STAGE_MASK 0x0000FFFF
104 #define POST_ERROR_BIT 0x80000000
105 #define POST_ERR_RECOVERY_CODE_MASK 0xF000
106
107
108 #define SLIPORT_SOFTRESET_SR_MASK 0x00000080
109
110
111 #define POST_STAGE_AWAITING_HOST_RDY 0x1
112 #define POST_STAGE_HOST_RDY 0x2
113 #define POST_STAGE_BE_RESET 0x3
114 #define POST_STAGE_ARMFW_RDY 0xC000
115 #define POST_STAGE_RECOVERABLE_ERR 0xE000
116
117
118 #define DB_MCCQ_OFFSET 0x140
119 #define DB_MCCQ_RING_ID_MASK 0xFFFF
120
121 #define DB_MCCQ_NUM_POSTED_SHIFT 16
122
123
124
125
126
127 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8
128 #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
129 #define ASYNC_EVENT_CODE_LINK_STATE 0x1
130 #define ASYNC_EVENT_CODE_ISCSI 0x4
131 #define ASYNC_EVENT_CODE_SLI 0x11
132
133 #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16
134 #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF
135
136
137 #define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4
138 #define ASYNC_EVENT_NEW_ISCSI_CONN 0x5
139 #define ASYNC_EVENT_NEW_TCP_CONN 0x7
140
141
142 #define ASYNC_SLI_EVENT_TYPE_MISCONFIGURED 0x9
143 #define ASYNC_SLI_LINK_EFFECT_VALID(le) (le & 0x80)
144 #define ASYNC_SLI_LINK_EFFECT_SEV(le) ((le >> 1) & 0x03)
145 #define ASYNC_SLI_LINK_EFFECT_STATE(le) (le & 0x01)
146
147 struct be_async_event_trailer {
148 u32 code;
149 };
150
151 enum {
152 ASYNC_EVENT_LINK_DOWN = 0x0,
153 ASYNC_EVENT_LINK_UP = 0x1,
154 };
155
156
157
158
159
160 struct be_async_event_link_state {
161 u8 physical_port;
162 u8 port_link_status;
163
164
165
166
167
168
169 #define BE_ASYNC_LINK_UP_MASK 0x01
170 u8 port_duplex;
171 u8 port_speed;
172
173 #define BE2ISCSI_LINK_SPEED_10MBPS 0x01
174 #define BE2ISCSI_LINK_SPEED_100MBPS 0x02
175 #define BE2ISCSI_LINK_SPEED_1GBPS 0x03
176 #define BE2ISCSI_LINK_SPEED_10GBPS 0x04
177 #define BE2ISCSI_LINK_SPEED_25GBPS 0x06
178 #define BE2ISCSI_LINK_SPEED_40GBPS 0x07
179 u8 port_fault;
180 u8 event_reason;
181 u16 qos_link_speed;
182 u32 event_tag;
183 struct be_async_event_trailer trailer;
184 } __packed;
185
186
187
188
189 struct be_async_event_sli {
190 u32 event_data1;
191 u32 event_data2;
192 u32 reserved;
193 u32 trailer;
194 } __packed;
195
196 struct be_mcc_mailbox {
197 struct be_mcc_wrb wrb;
198 struct be_mcc_compl compl;
199 };
200
201
202 #define CMD_SUBSYSTEM_COMMON 0x1
203 #define CMD_SUBSYSTEM_ISCSI 0x2
204 #define CMD_SUBSYSTEM_ETH 0x3
205 #define CMD_SUBSYSTEM_ISCSI_INI 0x6
206 #define CMD_COMMON_TCP_UPLOAD 0x1
207
208
209
210
211
212 #define OPCODE_COMMON_CQ_CREATE 12
213 #define OPCODE_COMMON_EQ_CREATE 13
214 #define OPCODE_COMMON_MCC_CREATE 21
215 #define OPCODE_COMMON_MCC_CREATE_EXT 90
216 #define OPCODE_COMMON_ADD_TEMPLATE_HEADER_BUFFERS 24
217 #define OPCODE_COMMON_REMOVE_TEMPLATE_HEADER_BUFFERS 25
218 #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
219 #define OPCODE_COMMON_GET_FW_VERSION 35
220 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
221 #define OPCODE_COMMON_FIRMWARE_CONFIG 42
222 #define OPCODE_COMMON_MCC_DESTROY 53
223 #define OPCODE_COMMON_CQ_DESTROY 54
224 #define OPCODE_COMMON_EQ_DESTROY 55
225 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
226 #define OPCODE_COMMON_FUNCTION_RESET 61
227 #define OPCODE_COMMON_GET_PORT_NAME 77
228 #define OPCODE_COMMON_SET_HOST_DATA 93
229 #define OPCODE_COMMON_SET_FEATURES 191
230
231
232
233
234
235
236 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2
237 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3
238 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7
239 #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14
240 #define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17
241 #define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18
242 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21
243 #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22
244 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
245 #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24
246 #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25
247 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
248 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64
249 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65
250 #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66
251 #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67
252
253 struct be_cmd_req_hdr {
254 u8 opcode;
255 u8 subsystem;
256 u8 port_number;
257 u8 domain;
258 u32 timeout;
259 u32 request_length;
260 u8 version;
261 u8 rsvd0[3];
262 };
263
264 struct be_cmd_resp_hdr {
265 u32 info;
266 u32 status;
267 u32 response_length;
268 u32 actual_resp_len;
269 };
270
271 struct phys_addr {
272 u32 lo;
273 u32 hi;
274 };
275
276 struct virt_addr {
277 u32 lo;
278 u32 hi;
279 };
280
281
282
283
284
285
286
287
288 struct amap_eq_context {
289 u8 cidx[13];
290 u8 rsvd0[3];
291 u8 epidx[13];
292 u8 valid;
293 u8 rsvd1;
294 u8 size;
295 u8 pidx[13];
296 u8 rsvd2[3];
297 u8 pd[10];
298 u8 count[3];
299 u8 solevent;
300 u8 stalled;
301 u8 armed;
302 u8 rsvd3[4];
303 u8 func[8];
304 u8 rsvd4;
305 u8 delaymult[10];
306 u8 rsvd5[2];
307 u8 phase[2];
308 u8 nodelay;
309 u8 rsvd6[4];
310 u8 rsvd7[32];
311 } __packed;
312
313 struct be_cmd_req_eq_create {
314 struct be_cmd_req_hdr hdr;
315 u16 num_pages;
316 u16 rsvd0;
317 u8 context[sizeof(struct amap_eq_context) / 8];
318 struct phys_addr pages[8];
319 } __packed;
320
321 struct be_cmd_resp_eq_create {
322 struct be_cmd_resp_hdr resp_hdr;
323 u16 eq_id;
324 u16 rsvd0;
325 } __packed;
326
327 struct be_set_eqd {
328 u32 eq_id;
329 u32 phase;
330 u32 delay_multiplier;
331 } __packed;
332
333 struct mgmt_chap_format {
334 u32 flags;
335 u8 intr_chap_name[256];
336 u8 intr_secret[16];
337 u8 target_chap_name[256];
338 u8 target_secret[16];
339 u16 intr_chap_name_length;
340 u16 intr_secret_length;
341 u16 target_chap_name_length;
342 u16 target_secret_length;
343 } __packed;
344
345 struct mgmt_auth_method_format {
346 u8 auth_method_type;
347 u8 padding[3];
348 struct mgmt_chap_format chap;
349 } __packed;
350
351 struct be_cmd_req_logout_fw_sess {
352 struct be_cmd_req_hdr hdr;
353 uint32_t session_handle;
354 } __packed;
355
356 struct be_cmd_resp_logout_fw_sess {
357 struct be_cmd_resp_hdr hdr;
358 uint32_t session_status;
359 #define BE_SESS_STATUS_CLOSE 0x20
360 } __packed;
361
362 struct mgmt_conn_login_options {
363 u8 flags;
364 u8 header_digest;
365 u8 data_digest;
366 u8 rsvd0;
367 u32 max_recv_datasegment_len_ini;
368 u32 max_recv_datasegment_len_tgt;
369 u32 tcp_mss;
370 u32 tcp_window_size;
371 struct mgmt_auth_method_format auth_data;
372 } __packed;
373
374 struct ip_addr_format {
375 u16 size_of_structure;
376 u8 reserved;
377 u8 ip_type;
378 #define BEISCSI_IP_TYPE_V4 0x1
379 #define BEISCSI_IP_TYPE_STATIC_V4 0x3
380 #define BEISCSI_IP_TYPE_DHCP_V4 0x5
381
382 #define BEISCSI_IP_TYPE_V6 0x10
383 #define BEISCSI_IP_TYPE_ROUTABLE_V6 0x30
384 #define BEISCSI_IP_TYPE_LINK_LOCAL_V6 0x50
385 #define BEISCSI_IP_TYPE_AUTO_V6 0x90
386 u8 addr[16];
387 u32 rsvd0;
388 } __packed;
389
390 struct mgmt_conn_info {
391 u32 connection_handle;
392 u32 connection_status;
393 u16 src_port;
394 u16 dest_port;
395 u16 dest_port_redirected;
396 u16 cid;
397 u32 estimated_throughput;
398 struct ip_addr_format src_ipaddr;
399 struct ip_addr_format dest_ipaddr;
400 struct ip_addr_format dest_ipaddr_redirected;
401 struct mgmt_conn_login_options negotiated_login_options;
402 } __packed;
403
404 struct mgmt_session_login_options {
405 u8 flags;
406 u8 error_recovery_level;
407 u16 rsvd0;
408 u32 first_burst_length;
409 u32 max_burst_length;
410 u16 max_connections;
411 u16 max_outstanding_r2t;
412 u16 default_time2wait;
413 u16 default_time2retain;
414 } __packed;
415
416 struct mgmt_session_info {
417 u32 session_handle;
418 u32 status;
419 u8 isid[6];
420 u16 tsih;
421 u32 session_flags;
422 u16 conn_count;
423 u16 pad;
424 u8 target_name[224];
425 u8 initiator_iscsiname[224];
426 struct mgmt_session_login_options negotiated_login_options;
427 struct mgmt_conn_info conn_list[1];
428 } __packed;
429
430 struct be_cmd_get_session_req {
431 struct be_cmd_req_hdr hdr;
432 u32 session_handle;
433 } __packed;
434
435 struct be_cmd_get_session_resp {
436 struct be_cmd_resp_hdr hdr;
437 struct mgmt_session_info session_info;
438 } __packed;
439
440 struct mac_addr {
441 u16 size_of_structure;
442 u8 addr[ETH_ALEN];
443 } __packed;
444
445 struct be_cmd_get_boot_target_req {
446 struct be_cmd_req_hdr hdr;
447 } __packed;
448
449 struct be_cmd_get_boot_target_resp {
450 struct be_cmd_resp_hdr hdr;
451 u32 boot_session_count;
452 u32 boot_session_handle;
453
454
455
456
457 #define BE_BOOT_INVALID_SHANDLE 0xffffffff
458 };
459
460 struct be_cmd_reopen_session_req {
461 struct be_cmd_req_hdr hdr;
462 #define BE_REOPEN_ALL_SESSIONS 0x00
463 #define BE_REOPEN_BOOT_SESSIONS 0x01
464 #define BE_REOPEN_A_SESSION 0x02
465 u16 reopen_type;
466 u16 rsvd;
467 u32 session_handle;
468 } __packed;
469
470 struct be_cmd_reopen_session_resp {
471 struct be_cmd_resp_hdr hdr;
472 u32 rsvd;
473 u32 session_handle;
474 } __packed;
475
476
477 struct be_cmd_mac_query_req {
478 struct be_cmd_req_hdr hdr;
479 u8 type;
480 u8 permanent;
481 u16 if_id;
482 } __packed;
483
484 struct be_cmd_get_mac_resp {
485 struct be_cmd_resp_hdr hdr;
486 struct mac_addr mac;
487 };
488
489 struct be_ip_addr_subnet_format {
490 u16 size_of_structure;
491 u8 ip_type;
492 u8 ipv6_prefix_length;
493 u8 addr[16];
494 u8 subnet_mask[16];
495 u32 rsvd0;
496 } __packed;
497
498 struct be_cmd_get_if_info_req {
499 struct be_cmd_req_hdr hdr;
500 u32 interface_hndl;
501 u32 ip_type;
502 } __packed;
503
504 struct be_cmd_get_if_info_resp {
505 struct be_cmd_req_hdr hdr;
506 u32 interface_hndl;
507 u32 vlan_priority;
508 u32 ip_addr_count;
509 u32 dhcp_state;
510 struct be_ip_addr_subnet_format ip_addr;
511 } __packed;
512
513 struct be_ip_addr_record {
514 u32 action;
515 u32 interface_hndl;
516 struct be_ip_addr_subnet_format ip_addr;
517 u32 status;
518 } __packed;
519
520 struct be_ip_addr_record_params {
521 u32 record_entry_count;
522 struct be_ip_addr_record ip_record;
523 } __packed;
524
525 struct be_cmd_set_ip_addr_req {
526 struct be_cmd_req_hdr hdr;
527 struct be_ip_addr_record_params ip_params;
528 } __packed;
529
530
531 struct be_cmd_set_dhcp_req {
532 struct be_cmd_req_hdr hdr;
533 u32 interface_hndl;
534 u32 ip_type;
535 u32 flags;
536 u32 retry_count;
537 } __packed;
538
539 struct be_cmd_rel_dhcp_req {
540 struct be_cmd_req_hdr hdr;
541 u32 interface_hndl;
542 u32 ip_type;
543 } __packed;
544
545 struct be_cmd_set_def_gateway_req {
546 struct be_cmd_req_hdr hdr;
547 u32 action;
548 struct ip_addr_format ip_addr;
549 } __packed;
550
551 struct be_cmd_get_def_gateway_req {
552 struct be_cmd_req_hdr hdr;
553 u32 ip_type;
554 } __packed;
555
556 struct be_cmd_get_def_gateway_resp {
557 struct be_cmd_req_hdr hdr;
558 struct ip_addr_format ip_addr;
559 } __packed;
560
561 #define BEISCSI_VLAN_DISABLE 0xFFFF
562 struct be_cmd_set_vlan_req {
563 struct be_cmd_req_hdr hdr;
564 u32 interface_hndl;
565 u32 vlan_priority;
566 } __packed;
567
568
569
570
571
572 struct amap_cq_context {
573 u8 cidx[11];
574 u8 rsvd0;
575 u8 coalescwm[2];
576 u8 nodelay;
577 u8 epidx[11];
578 u8 rsvd1;
579 u8 count[2];
580 u8 valid;
581 u8 solevent;
582 u8 eventable;
583 u8 pidx[11];
584 u8 rsvd2;
585 u8 pd[10];
586 u8 eqid[8];
587 u8 stalled;
588 u8 armed;
589 u8 rsvd3[4];
590 u8 func[8];
591 u8 rsvd4[20];
592 u8 rsvd5[32];
593 } __packed;
594
595 struct amap_cq_context_v2 {
596 u8 rsvd0[12];
597 u8 coalescwm[2];
598 u8 nodelay;
599 u8 rsvd1[12];
600 u8 count[2];
601 u8 valid;
602 u8 rsvd2;
603 u8 eventable;
604 u8 eqid[16];
605 u8 rsvd3[15];
606 u8 armed;
607 u8 cqecount[16];
608 u8 rsvd4[16];
609 u8 rsvd5[32];
610 };
611
612 struct be_cmd_req_cq_create {
613 struct be_cmd_req_hdr hdr;
614 u16 num_pages;
615 u8 page_size;
616 u8 rsvd0;
617 u8 context[sizeof(struct amap_cq_context) / 8];
618 struct phys_addr pages[4];
619 } __packed;
620
621 struct be_cmd_resp_cq_create {
622 struct be_cmd_resp_hdr hdr;
623 u16 cq_id;
624 u16 rsvd0;
625 } __packed;
626
627
628
629
630
631
632 struct amap_mcc_context {
633 u8 con_index[14];
634 u8 rsvd0[2];
635 u8 ring_size[4];
636 u8 fetch_wrb;
637 u8 fetch_r2t;
638 u8 cq_id[10];
639 u8 prod_index[14];
640 u8 fid[8];
641 u8 pdid[9];
642 u8 valid;
643 u8 rsvd1[32];
644 u8 rsvd2[32];
645 } __packed;
646
647 struct be_cmd_req_mcc_create_ext {
648 struct be_cmd_req_hdr hdr;
649 u16 num_pages;
650 u16 rsvd0;
651 u32 async_evt_bitmap;
652 u8 context[sizeof(struct amap_mcc_context) / 8];
653 struct phys_addr pages[8];
654 } __packed;
655
656 struct be_cmd_resp_mcc_create {
657 struct be_cmd_resp_hdr hdr;
658 u16 id;
659 u16 rsvd0;
660 } __packed;
661
662
663
664 enum {
665 QTYPE_EQ = 1,
666 QTYPE_CQ,
667 QTYPE_MCCQ,
668 QTYPE_WRBQ,
669 QTYPE_DPDUQ,
670 QTYPE_SGL
671 };
672
673 struct be_cmd_req_q_destroy {
674 struct be_cmd_req_hdr hdr;
675 u16 id;
676 u16 bypass_flush;
677 } __packed;
678
679 struct macaddr {
680 u8 byte[ETH_ALEN];
681 };
682
683 struct be_cmd_req_mcast_mac_config {
684 struct be_cmd_req_hdr hdr;
685 u16 num_mac;
686 u8 promiscuous;
687 u8 interface_id;
688 struct macaddr mac[32];
689 } __packed;
690
691 static inline void *embedded_payload(struct be_mcc_wrb *wrb)
692 {
693 return wrb->payload.embedded_payload;
694 }
695
696 static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
697 {
698 return &wrb->payload.sgl[0];
699 }
700
701
702 struct be_cmd_req_modify_eq_delay {
703 struct be_cmd_req_hdr hdr;
704 __le32 num_eq;
705 struct {
706 __le32 eq_id;
707 __le32 phase;
708 __le32 delay_multiplier;
709 } delay[MAX_CPUS];
710 } __packed;
711
712
713
714 struct be_cmd_get_nic_conf_resp {
715 struct be_cmd_resp_hdr hdr;
716 u32 nic_port_count;
717 u32 speed;
718 u32 max_speed;
719 u32 link_state;
720 u32 max_frame_size;
721 u16 size_of_structure;
722 u8 mac_address[ETH_ALEN];
723 } __packed;
724
725
726
727 struct be_cmd_hba_name {
728 struct be_cmd_req_hdr hdr;
729 u16 flags;
730 u16 rsvd0;
731 u8 initiator_name[ISCSI_NAME_LEN];
732 #define BE_INI_ALIAS_LEN 32
733 u8 initiator_alias[BE_INI_ALIAS_LEN];
734 } __packed;
735
736
737 #define BE_CMD_SET_HOST_PARAM_ID 0x2
738 #define BE_CMD_MAX_DRV_VERSION 0x30
739 struct be_sethost_req {
740 u32 param_id;
741 u32 param_len;
742 u32 param_data[32];
743 };
744
745 struct be_sethost_resp {
746 u32 rsvd0;
747 };
748
749 struct be_cmd_set_host_data {
750 union {
751 struct be_cmd_req_hdr req_hdr;
752 struct be_cmd_resp_hdr resp_hdr;
753 } h;
754 union {
755 struct be_sethost_req req;
756 struct be_sethost_resp resp;
757 } param;
758 } __packed;
759
760
761 #define BE_CMD_SET_FEATURE_UER 0x10
762 #define BE_CMD_UER_SUPP_BIT 0x1
763 struct be_uer_req {
764 u32 uer;
765 u32 rsvd;
766 };
767
768 struct be_uer_resp {
769 u32 uer;
770 u16 ue2rp;
771 u16 ue2sr;
772 };
773
774 struct be_cmd_set_features {
775 union {
776 struct be_cmd_req_hdr req_hdr;
777 struct be_cmd_resp_hdr resp_hdr;
778 } h;
779 u32 feature;
780 u32 param_len;
781 union {
782 struct be_uer_req req;
783 struct be_uer_resp resp;
784 u32 rsvd[2];
785 } param;
786 } __packed;
787
788 int beiscsi_cmd_function_reset(struct beiscsi_hba *phba);
789
790 int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load);
791
792 int beiscsi_check_fw_rdy(struct beiscsi_hba *phba);
793
794 int beiscsi_init_sliport(struct beiscsi_hba *phba);
795
796 int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num);
797
798 int beiscsi_detect_ue(struct beiscsi_hba *phba);
799
800 int beiscsi_detect_tpe(struct beiscsi_hba *phba);
801
802 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
803 struct be_queue_info *eq, int eq_delay);
804
805 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
806 struct be_queue_info *cq, struct be_queue_info *eq,
807 bool sol_evts, bool no_delay,
808 int num_cqe_dma_coalesce);
809
810 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
811 int type);
812 int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
813 struct be_queue_info *mccq,
814 struct be_queue_info *cq);
815
816 void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag);
817
818 int beiscsi_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
819 int num);
820 int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
821 unsigned int tag,
822 struct be_mcc_wrb **wrb,
823 struct be_dma_mem *mbx_cmd_mem);
824 int __beiscsi_mcc_compl_status(struct beiscsi_hba *phba,
825 unsigned int tag,
826 struct be_mcc_wrb **wrb,
827 struct be_dma_mem *mbx_cmd_mem);
828 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
829 void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
830 struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
831 unsigned int *ref_tag);
832 void beiscsi_process_async_event(struct beiscsi_hba *phba,
833 struct be_mcc_compl *compl);
834 int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
835 struct be_mcc_compl *compl);
836
837 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
838 struct be_queue_info *cq,
839 struct be_queue_info *dq, int length,
840 int entry_size, uint8_t is_header,
841 uint8_t ulp_num);
842
843 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl,
844 struct be_dma_mem *q_mem);
845
846 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl);
847
848 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
849 struct be_dma_mem *q_mem, u32 page_offset,
850 u32 num_pages);
851
852 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
853 struct be_queue_info *wrbq,
854 struct hwi_wrb_context *pwrb_context,
855 uint8_t ulp_num);
856
857
858 int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
859
860 int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl,
861 struct beiscsi_hba *phba);
862
863 int beiscsi_get_fw_config(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba);
864
865 int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba);
866
867 int beiscsi_set_uer_feature(struct beiscsi_hba *phba);
868 int beiscsi_set_host_data(struct beiscsi_hba *phba);
869
870 struct be_default_pdu_context {
871 u32 dw[4];
872 } __packed;
873
874 struct amap_be_default_pdu_context {
875 u8 dbuf_cindex[13];
876 u8 rsvd0[3];
877 u8 ring_size[4];
878 u8 ring_state[4];
879 u8 rsvd1[8];
880 u8 dbuf_pindex[13];
881 u8 rsvd2;
882 u8 pci_func_id[8];
883 u8 rx_pdid[9];
884 u8 rx_pdid_valid;
885 u8 default_buffer_size[16];
886 u8 cq_id_recv[10];
887 u8 rx_pdid_not_valid;
888 u8 rsvd3[5];
889 u8 rsvd4[32];
890 } __packed;
891
892 struct amap_default_pdu_context_ext {
893 u8 rsvd0[16];
894 u8 ring_size[4];
895 u8 rsvd1[12];
896 u8 rsvd2[22];
897 u8 rx_pdid[9];
898 u8 rx_pdid_valid;
899 u8 default_buffer_size[16];
900 u8 cq_id_recv[16];
901 u8 rsvd3[32];
902 } __packed;
903
904 struct be_defq_create_req {
905 struct be_cmd_req_hdr hdr;
906 u16 num_pages;
907 u8 ulp_num;
908 #define BEISCSI_DUAL_ULP_AWARE_BIT 0
909 #define BEISCSI_BIND_Q_TO_ULP_BIT 1
910 u8 dua_feature;
911 struct be_default_pdu_context context;
912 struct phys_addr pages[8];
913 } __packed;
914
915 struct be_defq_create_resp {
916 struct be_cmd_req_hdr hdr;
917 u16 id;
918 u8 rsvd0;
919 u8 ulp_num;
920 u32 doorbell_offset;
921 u16 register_set;
922 u16 doorbell_format;
923 } __packed;
924
925 struct be_post_template_pages_req {
926 struct be_cmd_req_hdr hdr;
927 u16 num_pages;
928 #define BEISCSI_TEMPLATE_HDR_TYPE_ISCSI 0x1
929 u16 type;
930 struct phys_addr scratch_pa;
931 struct virt_addr scratch_va;
932 struct virt_addr pages_va;
933 struct phys_addr pages[16];
934 } __packed;
935
936 struct be_remove_template_pages_req {
937 struct be_cmd_req_hdr hdr;
938 u16 type;
939 u16 rsvd0;
940 } __packed;
941
942 struct be_post_sgl_pages_req {
943 struct be_cmd_req_hdr hdr;
944 u16 num_pages;
945 u16 page_offset;
946 u32 rsvd0;
947 struct phys_addr pages[26];
948 u32 rsvd1;
949 } __packed;
950
951 struct be_wrbq_create_req {
952 struct be_cmd_req_hdr hdr;
953 u16 num_pages;
954 u8 ulp_num;
955 u8 dua_feature;
956 struct phys_addr pages[8];
957 } __packed;
958
959 struct be_wrbq_create_resp {
960 struct be_cmd_resp_hdr resp_hdr;
961 u16 cid;
962 u8 rsvd0;
963 u8 ulp_num;
964 u32 doorbell_offset;
965 u16 register_set;
966 u16 doorbell_format;
967 } __packed;
968
969 #define SOL_CID_MASK 0x0000FFC0
970 #define SOL_CODE_MASK 0x0000003F
971 #define SOL_WRB_INDEX_MASK 0x00FF0000
972 #define SOL_CMD_WND_MASK 0xFF000000
973 #define SOL_RES_CNT_MASK 0x7FFFFFFF
974 #define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
975 #define SOL_HW_STS_MASK 0x000000FF
976 #define SOL_STS_MASK 0x0000FF00
977 #define SOL_RESP_MASK 0x00FF0000
978 #define SOL_FLAGS_MASK 0x7F000000
979 #define SOL_S_MASK 0x80000000
980
981 struct sol_cqe {
982 u32 dw[4];
983 };
984
985 struct amap_sol_cqe {
986 u8 hw_sts[8];
987 u8 i_sts[8];
988 u8 i_resp[8];
989 u8 i_flags[7];
990 u8 s;
991 u8 i_exp_cmd_sn[32];
992 u8 code[6];
993 u8 cid[10];
994 u8 wrb_index[8];
995 u8 i_cmd_wnd[8];
996 u8 i_res_cnt[31];
997 u8 valid;
998 } __packed;
999
1000 #define SOL_ICD_INDEX_MASK 0x0003FFC0
1001 struct amap_sol_cqe_ring {
1002 u8 hw_sts[8];
1003 u8 i_sts[8];
1004 u8 i_resp[8];
1005 u8 i_flags[7];
1006 u8 s;
1007 u8 i_exp_cmd_sn[32];
1008 u8 code[6];
1009 u8 icd_index[12];
1010 u8 rsvd[6];
1011 u8 i_cmd_wnd[8];
1012 u8 i_res_cnt[31];
1013 u8 valid;
1014 } __packed;
1015
1016 struct amap_sol_cqe_v2 {
1017 u8 hw_sts[8];
1018 u8 i_sts[8];
1019 u8 wrb_index[16];
1020 u8 i_exp_cmd_sn[32];
1021 u8 code[6];
1022 u8 cmd_cmpl;
1023 u8 rsvd0;
1024 u8 i_cmd_wnd[8];
1025 u8 cid[13];
1026 u8 u;
1027 u8 o;
1028 u8 s;
1029 u8 i_res_cnt[31];
1030 u8 valid;
1031 } __packed;
1032
1033 struct common_sol_cqe {
1034 u32 exp_cmdsn;
1035 u32 res_cnt;
1036 u16 wrb_index;
1037 u16 cid;
1038 u8 hw_sts;
1039 u8 cmd_wnd;
1040 u8 res_flag;
1041 u8 i_resp;
1042 u8 i_flags;
1043 u8 i_sts;
1044 };
1045
1046
1047 struct amap_it_dmsg_cqe {
1048 u8 ack_num[32];
1049 u8 pdu_bytes_rcvd[32];
1050 u8 code[6];
1051 u8 cid[10];
1052 u8 wrb_idx[8];
1053 u8 rsvd0[8];
1054 u8 rsvd1[31];
1055 u8 valid;
1056 } __packed;
1057
1058 struct amap_it_dmsg_cqe_v2 {
1059 u8 ack_num[32];
1060 u8 pdu_bytes_rcvd[32];
1061 u8 code[6];
1062 u8 rsvd0[10];
1063 u8 wrb_idx[16];
1064 u8 rsvd1[16];
1065 u8 cid[13];
1066 u8 rsvd2[2];
1067 u8 valid;
1068 } __packed;
1069
1070
1071
1072
1073
1074
1075
1076 #define DB_WRB_POST_CID_MASK 0xFFFF
1077 #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF
1078
1079 #define DB_DEF_PDU_WRB_INDEX_SHIFT 16
1080 #define DB_DEF_PDU_NUM_POSTED_SHIFT 24
1081
1082 struct fragnum_bits_for_sgl_cra_in {
1083 struct be_cmd_req_hdr hdr;
1084 u32 num_bits;
1085 } __packed;
1086
1087 struct iscsi_cleanup_req {
1088 struct be_cmd_req_hdr hdr;
1089 u16 chute;
1090 u8 hdr_ring_id;
1091 u8 data_ring_id;
1092 } __packed;
1093
1094 struct iscsi_cleanup_req_v1 {
1095 struct be_cmd_req_hdr hdr;
1096 u16 chute;
1097 u16 rsvd1;
1098 u16 hdr_ring_id;
1099 u16 rsvd2;
1100 u16 data_ring_id;
1101 u16 rsvd3;
1102 } __packed;
1103
1104 struct eq_delay {
1105 u32 eq_id;
1106 u32 phase;
1107 u32 delay_multiplier;
1108 } __packed;
1109
1110 struct be_eq_delay_params_in {
1111 struct be_cmd_req_hdr hdr;
1112 u32 num_eq;
1113 struct eq_delay delay[8];
1114 } __packed;
1115
1116 struct tcp_connect_and_offload_in {
1117 struct be_cmd_req_hdr hdr;
1118 struct ip_addr_format ip_address;
1119 u16 tcp_port;
1120 u16 cid;
1121 u16 cq_id;
1122 u16 defq_id;
1123 struct phys_addr dataout_template_pa;
1124 u16 hdr_ring_id;
1125 u16 data_ring_id;
1126 u8 do_offload;
1127 u8 rsvd0[3];
1128 } __packed;
1129
1130 struct tcp_connect_and_offload_in_v1 {
1131 struct be_cmd_req_hdr hdr;
1132 struct ip_addr_format ip_address;
1133 u16 tcp_port;
1134 u16 cid;
1135 u16 cq_id;
1136 u16 defq_id;
1137 struct phys_addr dataout_template_pa;
1138 u16 hdr_ring_id;
1139 u16 data_ring_id;
1140 u8 do_offload;
1141 u8 ifd_state;
1142 u8 rsvd0[2];
1143 u16 tcp_window_size;
1144 u8 tcp_window_scale_count;
1145 u8 rsvd1;
1146 u32 tcp_mss:24;
1147 u8 rsvd2;
1148 } __packed;
1149
1150 struct tcp_connect_and_offload_out {
1151 struct be_cmd_resp_hdr hdr;
1152 u32 connection_handle;
1153 u16 cid;
1154 u16 rsvd0;
1155
1156 } __packed;
1157
1158 #define DB_DEF_PDU_RING_ID_MASK 0x3FFF
1159 #define DB_DEF_PDU_CQPROC_MASK 0x3FFF
1160 #define DB_DEF_PDU_REARM_SHIFT 14
1161 #define DB_DEF_PDU_EVENT_SHIFT 15
1162 #define DB_DEF_PDU_CQPROC_SHIFT 16
1163
1164 struct be_invalidate_connection_params_in {
1165 struct be_cmd_req_hdr hdr;
1166 u32 session_handle;
1167 u16 cid;
1168 u16 unused;
1169 #define BE_CLEANUP_TYPE_INVALIDATE 0x8001
1170 #define BE_CLEANUP_TYPE_ISSUE_TCP_RST 0x8002
1171 u16 cleanup_type;
1172 u16 save_cfg;
1173 } __packed;
1174
1175 struct be_invalidate_connection_params_out {
1176 u32 session_handle;
1177 u16 cid;
1178 u16 unused;
1179 } __packed;
1180
1181 union be_invalidate_connection_params {
1182 struct be_invalidate_connection_params_in req;
1183 struct be_invalidate_connection_params_out resp;
1184 } __packed;
1185
1186 struct be_tcp_upload_params_in {
1187 struct be_cmd_req_hdr hdr;
1188 u16 id;
1189 #define BE_UPLOAD_TYPE_GRACEFUL 1
1190
1191 #define BE_UPLOAD_TYPE_ABORT_RESET 2
1192
1193 #define BE_UPLOAD_TYPE_ABORT 3
1194
1195 #define BE_UPLOAD_TYPE_ABORT_WITH_SEQ 4
1196 u16 upload_type;
1197 u32 reset_seq;
1198 } __packed;
1199
1200 struct be_tcp_upload_params_out {
1201 u32 dw[32];
1202 } __packed;
1203
1204 union be_tcp_upload_params {
1205 struct be_tcp_upload_params_in request;
1206 struct be_tcp_upload_params_out response;
1207 } __packed;
1208
1209 struct be_ulp_fw_cfg {
1210 #define BEISCSI_ULP_ISCSI_INI_MODE 0x10
1211 u32 ulp_mode;
1212 u32 etx_base;
1213 u32 etx_count;
1214 u32 sq_base;
1215 u32 sq_count;
1216 u32 rq_base;
1217 u32 rq_count;
1218 u32 dq_base;
1219 u32 dq_count;
1220 u32 lro_base;
1221 u32 lro_count;
1222 u32 icd_base;
1223 u32 icd_count;
1224 };
1225
1226 struct be_ulp_chain_icd {
1227 u32 chain_base;
1228 u32 chain_count;
1229 };
1230
1231 struct be_fw_cfg {
1232 struct be_cmd_req_hdr hdr;
1233 u32 be_config_number;
1234 u32 asic_revision;
1235 u32 phys_port;
1236 #define BEISCSI_FUNC_ISCSI_INI_MODE 0x10
1237 #define BEISCSI_FUNC_DUA_MODE 0x800
1238 u32 function_mode;
1239 struct be_ulp_fw_cfg ulp[2];
1240 u32 function_caps;
1241 u32 cqid_base;
1242 u32 cqid_count;
1243 u32 eqid_base;
1244 u32 eqid_count;
1245 struct be_ulp_chain_icd chain_icd[2];
1246 } __packed;
1247
1248 struct be_cmd_get_all_if_id_req {
1249 struct be_cmd_req_hdr hdr;
1250 u32 if_count;
1251 u32 if_hndl_list[1];
1252 } __packed;
1253
1254 struct be_cmd_get_port_name {
1255 union {
1256 struct be_cmd_req_hdr req_hdr;
1257 struct be_cmd_resp_hdr resp_hdr;
1258 } h;
1259 union {
1260 struct {
1261 u32 reserved;
1262 } req;
1263 struct {
1264 u32 port_names;
1265 } resp;
1266 } p;
1267 } __packed;
1268
1269 #define ISCSI_OPCODE_SCSI_DATA_OUT 5
1270 #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
1271 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
1272 #define OPCODE_COMMON_ISCSI_CLEANUP 59
1273 #define OPCODE_COMMON_TCP_UPLOAD 56
1274 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
1275 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
1276 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6
1277 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7
1278 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14
1279 #define OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET 24
1280 #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
1281 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
1282 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
1283 #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52
1284 #define OPCODE_COMMON_WRITE_FLASH 96
1285 #define OPCODE_COMMON_READ_FLASH 97
1286
1287 #define CMD_ISCSI_COMMAND_INVALIDATE 1
1288
1289 #define INI_WR_CMD 1
1290 #define INI_TMF_CMD 2
1291 #define INI_NOPOUT_CMD 3
1292 #define INI_RD_CMD 5
1293
1294
1295 #define TGT_CTX_UPDT_CMD 7
1296 #define TGT_DM_CMD 11
1297
1298
1299
1300
1301
1302 #define BE_NUMBER_OF_FIELD(_type_, _field_) \
1303 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
1304
1305
1306
1307
1308
1309
1310 #define SOL_CMD_COMPLETE 1
1311
1312
1313 #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2
1314
1315
1316
1317 #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3
1318
1319
1320
1321
1322 #define CXN_KILLED_BURST_LEN_MISMATCH 4
1323
1324
1325
1326
1327 #define CXN_KILLED_AHS_RCVD 5
1328
1329
1330
1331 #define CXN_KILLED_HDR_DIGEST_ERR 6
1332
1333
1334
1335 #define CXN_KILLED_UNKNOWN_HDR 7
1336
1337
1338
1339
1340 #define CXN_KILLED_STALE_ITT_TTT_RCVD 8
1341
1342
1343
1344
1345 #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9
1346
1347
1348
1349
1350 #define CXN_KILLED_RST_RCVD 10
1351
1352
1353
1354 #define CXN_KILLED_TIMED_OUT 11
1355
1356
1357
1358
1359 #define CXN_KILLED_RST_SENT 12
1360
1361
1362
1363 #define CXN_KILLED_FIN_RCVD 13
1364
1365
1366
1367 #define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14
1368
1369
1370
1371
1372
1373 #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15
1374
1375
1376
1377 #define CXN_KILLED_OVER_RUN_RESIDUAL 16
1378
1379
1380
1381
1382 #define CXN_KILLED_UNDER_RUN_RESIDUAL 17
1383
1384
1385
1386
1387 #define CMD_KILLED_INVALID_STATSN_RCVD 18
1388
1389
1390
1391 #define CMD_KILLED_INVALID_R2T_RCVD 19
1392
1393
1394
1395
1396 #define CMD_CXN_KILLED_LUN_INVALID 20
1397
1398
1399
1400 #define CMD_CXN_KILLED_ICD_INVALID 21
1401
1402
1403
1404
1405 #define CMD_CXN_KILLED_ITT_INVALID 22
1406
1407
1408
1409 #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23
1410
1411
1412
1413 #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24
1414
1415
1416
1417
1418 #define CXN_INVALIDATE_NOTIFY 25
1419
1420
1421 #define CXN_INVALIDATE_INDEX_NOTIFY 26
1422
1423
1424
1425 #define CMD_INVALIDATED_NOTIFY 27
1426
1427
1428 #define UNSOL_HDR_NOTIFY 28
1429 #define UNSOL_DATA_NOTIFY 29
1430 #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30
1431
1432
1433 #define DRIVERMSG_NOTIFY 31
1434
1435
1436 #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32
1437
1438
1439
1440
1441 #define SOL_CMD_KILLED_DIF_ERR 33
1442
1443
1444
1445 #define CXN_KILLED_SYN_RCVD 34
1446
1447
1448
1449 #define CXN_KILLED_IMM_DATA_RCVD 35
1450
1451
1452
1453
1454
1455
1456 void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, u32 payload_len,
1457 bool embedded, u8 sge_cnt);
1458
1459 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
1460 u8 subsystem, u8 opcode, u32 cmd_len);
1461 #endif