be_cmds.h 34 KB

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