be_cmds.h 35 KB

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