be_cmds.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. /**
  2. * Copyright (C) 2005 - 2009 ServerEngines
  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@serverengines.com
  12. *
  13. * ServerEngines
  14. * 209 N. Fair Oaks Ave
  15. * Sunnyvale, CA 94085
  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 BladeEngine'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. u8 embedded_payload[236]; /* used by embedded cmds */
  41. struct be_sge sgl[19]; /* used by non-embedded cmds */
  42. } payload;
  43. };
  44. #define CQE_FLAGS_VALID_MASK (1 << 31)
  45. #define CQE_FLAGS_ASYNC_MASK (1 << 30)
  46. /* Completion Status */
  47. #define MCC_STATUS_SUCCESS 0x0
  48. #define CQE_STATUS_COMPL_MASK 0xFFFF
  49. #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
  50. #define CQE_STATUS_EXTD_MASK 0xFFFF
  51. #define CQE_STATUS_EXTD_SHIFT 0 /* bits 0 - 15 */
  52. struct be_mcc_compl {
  53. u32 status; /* dword 0 */
  54. u32 tag0; /* dword 1 */
  55. u32 tag1; /* dword 2 */
  56. u32 flags; /* dword 3 */
  57. };
  58. /********* Mailbox door bell *************/
  59. /**
  60. * Used for driver communication with the FW.
  61. * The software must write this register twice to post any command. First,
  62. * it writes the register with hi=1 and the upper bits of the physical address
  63. * for the MAILBOX structure. Software must poll the ready bit until this
  64. * is acknowledged. Then, sotware writes the register with hi=0 with the lower
  65. * bits in the address. It must poll the ready bit until the command is
  66. * complete. Upon completion, the MAILBOX will contain a valid completion
  67. * queue entry.
  68. */
  69. #define MPU_MAILBOX_DB_OFFSET 0x160
  70. #define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */
  71. #define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */
  72. /********** MPU semphore ******************/
  73. #define MPU_EP_SEMAPHORE_OFFSET 0xac
  74. #define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
  75. #define EP_SEMAPHORE_POST_ERR_MASK 0x1
  76. #define EP_SEMAPHORE_POST_ERR_SHIFT 31
  77. /********** MCC door bell ************/
  78. #define DB_MCCQ_OFFSET 0x140
  79. #define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */
  80. /* Number of entries posted */
  81. #define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */
  82. /* MPU semphore POST stage values */
  83. #define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */
  84. /**
  85. * When the async bit of mcc_compl is set, the last 4 bytes of
  86. * mcc_compl is interpreted as follows:
  87. */
  88. #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  89. #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
  90. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  91. struct be_async_event_trailer {
  92. u32 code;
  93. };
  94. enum {
  95. ASYNC_EVENT_LINK_DOWN = 0x0,
  96. ASYNC_EVENT_LINK_UP = 0x1
  97. };
  98. /**
  99. * When the event code of an async trailer is link-state, the mcc_compl
  100. * must be interpreted as follows
  101. */
  102. struct be_async_event_link_state {
  103. u8 physical_port;
  104. u8 port_link_status;
  105. u8 port_duplex;
  106. u8 port_speed;
  107. u8 port_fault;
  108. u8 rsvd0[7];
  109. struct be_async_event_trailer trailer;
  110. } __packed;
  111. struct be_mcc_mailbox {
  112. struct be_mcc_wrb wrb;
  113. struct be_mcc_compl compl;
  114. };
  115. /* Type of subsystems supported by FW */
  116. #define CMD_SUBSYSTEM_COMMON 0x1
  117. #define CMD_SUBSYSTEM_ISCSI 0x2
  118. #define CMD_SUBSYSTEM_ETH 0x3
  119. #define CMD_SUBSYSTEM_ISCSI_INI 0x6
  120. #define CMD_COMMON_TCP_UPLOAD 0x1
  121. /**
  122. * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON
  123. * These opcodes are unique for each subsystem defined above
  124. */
  125. #define OPCODE_COMMON_CQ_CREATE 12
  126. #define OPCODE_COMMON_EQ_CREATE 13
  127. #define OPCODE_COMMON_MCC_CREATE 21
  128. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  129. #define OPCODE_COMMON_GET_FW_VERSION 35
  130. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  131. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  132. #define OPCODE_COMMON_MCC_DESTROY 53
  133. #define OPCODE_COMMON_CQ_DESTROY 54
  134. #define OPCODE_COMMON_EQ_DESTROY 55
  135. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  136. #define OPCODE_COMMON_FUNCTION_RESET 61
  137. /**
  138. * LIST of opcodes that are common between Initiator and Target
  139. * used by CMD_SUBSYSTEM_ISCSI
  140. * These opcodes are unique for each subsystem defined above
  141. */
  142. #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2
  143. #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3
  144. #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7
  145. #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
  146. #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64
  147. #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65
  148. #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66
  149. #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67
  150. struct be_cmd_req_hdr {
  151. u8 opcode; /* dword 0 */
  152. u8 subsystem; /* dword 0 */
  153. u8 port_number; /* dword 0 */
  154. u8 domain; /* dword 0 */
  155. u32 timeout; /* dword 1 */
  156. u32 request_length; /* dword 2 */
  157. u32 rsvd; /* dword 3 */
  158. };
  159. struct be_cmd_resp_hdr {
  160. u32 info; /* dword 0 */
  161. u32 status; /* dword 1 */
  162. u32 response_length; /* dword 2 */
  163. u32 actual_resp_len; /* dword 3 */
  164. };
  165. struct phys_addr {
  166. u32 lo;
  167. u32 hi;
  168. };
  169. /**************************
  170. * BE Command definitions *
  171. **************************/
  172. /**
  173. * Pseudo amap definition in which each bit of the actual structure is defined
  174. * as a byte - used to calculate offset/shift/mask of each field
  175. */
  176. struct amap_eq_context {
  177. u8 cidx[13]; /* dword 0 */
  178. u8 rsvd0[3]; /* dword 0 */
  179. u8 epidx[13]; /* dword 0 */
  180. u8 valid; /* dword 0 */
  181. u8 rsvd1; /* dword 0 */
  182. u8 size; /* dword 0 */
  183. u8 pidx[13]; /* dword 1 */
  184. u8 rsvd2[3]; /* dword 1 */
  185. u8 pd[10]; /* dword 1 */
  186. u8 count[3]; /* dword 1 */
  187. u8 solevent; /* dword 1 */
  188. u8 stalled; /* dword 1 */
  189. u8 armed; /* dword 1 */
  190. u8 rsvd3[4]; /* dword 2 */
  191. u8 func[8]; /* dword 2 */
  192. u8 rsvd4; /* dword 2 */
  193. u8 delaymult[10]; /* dword 2 */
  194. u8 rsvd5[2]; /* dword 2 */
  195. u8 phase[2]; /* dword 2 */
  196. u8 nodelay; /* dword 2 */
  197. u8 rsvd6[4]; /* dword 2 */
  198. u8 rsvd7[32]; /* dword 3 */
  199. } __packed;
  200. struct be_cmd_req_eq_create {
  201. struct be_cmd_req_hdr hdr; /* dw[4] */
  202. u16 num_pages; /* sword */
  203. u16 rsvd0; /* sword */
  204. u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */
  205. struct phys_addr pages[8];
  206. } __packed;
  207. struct be_cmd_resp_eq_create {
  208. struct be_cmd_resp_hdr resp_hdr;
  209. u16 eq_id; /* sword */
  210. u16 rsvd0; /* sword */
  211. } __packed;
  212. struct mac_addr {
  213. u16 size_of_struct;
  214. u8 addr[ETH_ALEN];
  215. } __packed;
  216. struct be_cmd_req_mac_query {
  217. struct be_cmd_req_hdr hdr;
  218. u8 type;
  219. u8 permanent;
  220. u16 if_id;
  221. } __packed;
  222. struct be_cmd_resp_mac_query {
  223. struct be_cmd_resp_hdr hdr;
  224. struct mac_addr mac;
  225. };
  226. /******************** Create CQ ***************************/
  227. /**
  228. * Pseudo amap definition in which each bit of the actual structure is defined
  229. * as a byte - used to calculate offset/shift/mask of each field
  230. */
  231. struct amap_cq_context {
  232. u8 cidx[11]; /* dword 0 */
  233. u8 rsvd0; /* dword 0 */
  234. u8 coalescwm[2]; /* dword 0 */
  235. u8 nodelay; /* dword 0 */
  236. u8 epidx[11]; /* dword 0 */
  237. u8 rsvd1; /* dword 0 */
  238. u8 count[2]; /* dword 0 */
  239. u8 valid; /* dword 0 */
  240. u8 solevent; /* dword 0 */
  241. u8 eventable; /* dword 0 */
  242. u8 pidx[11]; /* dword 1 */
  243. u8 rsvd2; /* dword 1 */
  244. u8 pd[10]; /* dword 1 */
  245. u8 eqid[8]; /* dword 1 */
  246. u8 stalled; /* dword 1 */
  247. u8 armed; /* dword 1 */
  248. u8 rsvd3[4]; /* dword 2 */
  249. u8 func[8]; /* dword 2 */
  250. u8 rsvd4[20]; /* dword 2 */
  251. u8 rsvd5[32]; /* dword 3 */
  252. } __packed;
  253. struct be_cmd_req_cq_create {
  254. struct be_cmd_req_hdr hdr;
  255. u16 num_pages;
  256. u16 rsvd0;
  257. u8 context[sizeof(struct amap_cq_context) / 8];
  258. struct phys_addr pages[4];
  259. } __packed;
  260. struct be_cmd_resp_cq_create {
  261. struct be_cmd_resp_hdr hdr;
  262. u16 cq_id;
  263. u16 rsvd0;
  264. } __packed;
  265. /******************** Create MCCQ ***************************/
  266. /**
  267. * Pseudo amap definition in which each bit of the actual structure is defined
  268. * as a byte - used to calculate offset/shift/mask of each field
  269. */
  270. struct amap_mcc_context {
  271. u8 con_index[14];
  272. u8 rsvd0[2];
  273. u8 ring_size[4];
  274. u8 fetch_wrb;
  275. u8 fetch_r2t;
  276. u8 cq_id[10];
  277. u8 prod_index[14];
  278. u8 fid[8];
  279. u8 pdid[9];
  280. u8 valid;
  281. u8 rsvd1[32];
  282. u8 rsvd2[32];
  283. } __packed;
  284. struct be_cmd_req_mcc_create {
  285. struct be_cmd_req_hdr hdr;
  286. u16 num_pages;
  287. u16 rsvd0;
  288. u8 context[sizeof(struct amap_mcc_context) / 8];
  289. struct phys_addr pages[8];
  290. } __packed;
  291. struct be_cmd_resp_mcc_create {
  292. struct be_cmd_resp_hdr hdr;
  293. u16 id;
  294. u16 rsvd0;
  295. } __packed;
  296. /******************** Q Destroy ***************************/
  297. /* Type of Queue to be destroyed */
  298. enum {
  299. QTYPE_EQ = 1,
  300. QTYPE_CQ,
  301. QTYPE_MCCQ,
  302. QTYPE_WRBQ,
  303. QTYPE_DPDUQ,
  304. QTYPE_SGL
  305. };
  306. struct be_cmd_req_q_destroy {
  307. struct be_cmd_req_hdr hdr;
  308. u16 id;
  309. u16 bypass_flush; /* valid only for rx q destroy */
  310. } __packed;
  311. struct macaddr {
  312. u8 byte[ETH_ALEN];
  313. };
  314. struct be_cmd_req_mcast_mac_config {
  315. struct be_cmd_req_hdr hdr;
  316. u16 num_mac;
  317. u8 promiscuous;
  318. u8 interface_id;
  319. struct macaddr mac[32];
  320. } __packed;
  321. static inline void *embedded_payload(struct be_mcc_wrb *wrb)
  322. {
  323. return wrb->payload.embedded_payload;
  324. }
  325. static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
  326. {
  327. return &wrb->payload.sgl[0];
  328. }
  329. /******************** Modify EQ Delay *******************/
  330. struct be_cmd_req_modify_eq_delay {
  331. struct be_cmd_req_hdr hdr;
  332. u32 num_eq;
  333. struct {
  334. u32 eq_id;
  335. u32 phase;
  336. u32 delay_multiplier;
  337. } delay[8];
  338. } __packed;
  339. /******************** Get MAC ADDR *******************/
  340. #define ETH_ALEN 6
  341. struct be_cmd_req_get_mac_addr {
  342. struct be_cmd_req_hdr hdr;
  343. u32 nic_port_count;
  344. u32 speed;
  345. u32 max_speed;
  346. u32 link_state;
  347. u32 max_frame_size;
  348. u16 size_of_structure;
  349. u8 mac_address[ETH_ALEN];
  350. u32 rsvd[23];
  351. };
  352. struct be_cmd_resp_get_mac_addr {
  353. struct be_cmd_resp_hdr hdr;
  354. u32 nic_port_count;
  355. u32 speed;
  356. u32 max_speed;
  357. u32 link_state;
  358. u32 max_frame_size;
  359. u16 size_of_structure;
  360. u8 mac_address[6];
  361. u32 rsvd[23];
  362. };
  363. int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
  364. struct be_queue_info *eq, int eq_delay);
  365. int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
  366. struct be_queue_info *cq, struct be_queue_info *eq,
  367. bool sol_evts, bool no_delay,
  368. int num_cqe_dma_coalesce);
  369. int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
  370. int type);
  371. int be_poll_mcc(struct be_ctrl_info *ctrl);
  372. unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl);
  373. int be_cmd_get_mac_addr(struct be_ctrl_info *ctrl, u8 *mac_addr);
  374. /*ISCSI Functuions */
  375. int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
  376. struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
  377. int be_mbox_notify(struct be_ctrl_info *ctrl);
  378. int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
  379. struct be_queue_info *cq,
  380. struct be_queue_info *dq, int length,
  381. int entry_size);
  382. int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
  383. struct be_dma_mem *q_mem, u32 page_offset,
  384. u32 num_pages);
  385. int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
  386. struct be_queue_info *wrbq);
  387. struct be_default_pdu_context {
  388. u32 dw[4];
  389. } __packed;
  390. struct amap_be_default_pdu_context {
  391. u8 dbuf_cindex[13]; /* dword 0 */
  392. u8 rsvd0[3]; /* dword 0 */
  393. u8 ring_size[4]; /* dword 0 */
  394. u8 ring_state[4]; /* dword 0 */
  395. u8 rsvd1[8]; /* dword 0 */
  396. u8 dbuf_pindex[13]; /* dword 1 */
  397. u8 rsvd2; /* dword 1 */
  398. u8 pci_func_id[8]; /* dword 1 */
  399. u8 rx_pdid[9]; /* dword 1 */
  400. u8 rx_pdid_valid; /* dword 1 */
  401. u8 default_buffer_size[16]; /* dword 2 */
  402. u8 cq_id_recv[10]; /* dword 2 */
  403. u8 rx_pdid_not_valid; /* dword 2 */
  404. u8 rsvd3[5]; /* dword 2 */
  405. u8 rsvd4[32]; /* dword 3 */
  406. } __packed;
  407. struct be_defq_create_req {
  408. struct be_cmd_req_hdr hdr;
  409. u16 num_pages;
  410. u8 ulp_num;
  411. u8 rsvd0;
  412. struct be_default_pdu_context context;
  413. struct phys_addr pages[8];
  414. } __packed;
  415. struct be_defq_create_resp {
  416. struct be_cmd_req_hdr hdr;
  417. u16 id;
  418. u16 rsvd0;
  419. } __packed;
  420. struct be_post_sgl_pages_req {
  421. struct be_cmd_req_hdr hdr;
  422. u16 num_pages;
  423. u16 page_offset;
  424. u32 rsvd0;
  425. struct phys_addr pages[26];
  426. u32 rsvd1;
  427. } __packed;
  428. struct be_wrbq_create_req {
  429. struct be_cmd_req_hdr hdr;
  430. u16 num_pages;
  431. u8 ulp_num;
  432. u8 rsvd0;
  433. struct phys_addr pages[8];
  434. } __packed;
  435. struct be_wrbq_create_resp {
  436. struct be_cmd_resp_hdr resp_hdr;
  437. u16 cid;
  438. u16 rsvd0;
  439. } __packed;
  440. #define SOL_CID_MASK 0x0000FFC0
  441. #define SOL_CODE_MASK 0x0000003F
  442. #define SOL_WRB_INDEX_MASK 0x00FF0000
  443. #define SOL_CMD_WND_MASK 0xFF000000
  444. #define SOL_RES_CNT_MASK 0x7FFFFFFF
  445. #define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF
  446. #define SOL_HW_STS_MASK 0x000000FF
  447. #define SOL_STS_MASK 0x0000FF00
  448. #define SOL_RESP_MASK 0x00FF0000
  449. #define SOL_FLAGS_MASK 0x7F000000
  450. #define SOL_S_MASK 0x80000000
  451. struct sol_cqe {
  452. u32 dw[4];
  453. };
  454. struct amap_sol_cqe {
  455. u8 hw_sts[8]; /* dword 0 */
  456. u8 i_sts[8]; /* dword 0 */
  457. u8 i_resp[8]; /* dword 0 */
  458. u8 i_flags[7]; /* dword 0 */
  459. u8 s; /* dword 0 */
  460. u8 i_exp_cmd_sn[32]; /* dword 1 */
  461. u8 code[6]; /* dword 2 */
  462. u8 cid[10]; /* dword 2 */
  463. u8 wrb_index[8]; /* dword 2 */
  464. u8 i_cmd_wnd[8]; /* dword 2 */
  465. u8 i_res_cnt[31]; /* dword 3 */
  466. u8 valid; /* dword 3 */
  467. } __packed;
  468. /**
  469. * Post WRB Queue Doorbell Register used by the host Storage
  470. * stack to notify the
  471. * controller of a posted Work Request Block
  472. */
  473. #define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */
  474. #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */
  475. #define DB_DEF_PDU_WRB_INDEX_SHIFT 16
  476. #define DB_DEF_PDU_NUM_POSTED_SHIFT 24
  477. struct fragnum_bits_for_sgl_cra_in {
  478. struct be_cmd_req_hdr hdr;
  479. u32 num_bits;
  480. } __packed;
  481. struct iscsi_cleanup_req {
  482. struct be_cmd_req_hdr hdr;
  483. u16 chute;
  484. u8 hdr_ring_id;
  485. u8 data_ring_id;
  486. } __packed;
  487. struct eq_delay {
  488. u32 eq_id;
  489. u32 phase;
  490. u32 delay_multiplier;
  491. } __packed;
  492. struct be_eq_delay_params_in {
  493. struct be_cmd_req_hdr hdr;
  494. u32 num_eq;
  495. struct eq_delay delay[8];
  496. } __packed;
  497. struct ip_address_format {
  498. u16 size_of_structure;
  499. u8 reserved;
  500. u8 ip_type;
  501. u8 ip_address[16];
  502. u32 rsvd0;
  503. } __packed;
  504. struct tcp_connect_and_offload_in {
  505. struct be_cmd_req_hdr hdr;
  506. struct ip_address_format ip_address;
  507. u16 tcp_port;
  508. u16 cid;
  509. u16 cq_id;
  510. u16 defq_id;
  511. struct phys_addr dataout_template_pa;
  512. u16 hdr_ring_id;
  513. u16 data_ring_id;
  514. u8 do_offload;
  515. u8 rsvd0[3];
  516. } __packed;
  517. struct tcp_connect_and_offload_out {
  518. struct be_cmd_resp_hdr hdr;
  519. u32 connection_handle;
  520. u16 cid;
  521. u16 rsvd0;
  522. } __packed;
  523. struct be_mcc_wrb_context {
  524. struct MCC_WRB *wrb;
  525. int *users_final_status;
  526. } __packed;
  527. #define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */
  528. #define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */
  529. #define DB_DEF_PDU_REARM_SHIFT 14
  530. #define DB_DEF_PDU_EVENT_SHIFT 15
  531. #define DB_DEF_PDU_CQPROC_SHIFT 16
  532. struct dmsg_cqe {
  533. u32 dw[4];
  534. } __packed;
  535. struct tcp_upload_params_in {
  536. struct be_cmd_req_hdr hdr;
  537. u16 id;
  538. u16 upload_type;
  539. u32 reset_seq;
  540. } __packed;
  541. struct tcp_upload_params_out {
  542. u32 dw[32];
  543. } __packed;
  544. union tcp_upload_params {
  545. struct tcp_upload_params_in request;
  546. struct tcp_upload_params_out response;
  547. } __packed;
  548. struct be_ulp_fw_cfg {
  549. u32 ulp_mode;
  550. u32 etx_base;
  551. u32 etx_count;
  552. u32 sq_base;
  553. u32 sq_count;
  554. u32 rq_base;
  555. u32 rq_count;
  556. u32 dq_base;
  557. u32 dq_count;
  558. u32 lro_base;
  559. u32 lro_count;
  560. u32 icd_base;
  561. u32 icd_count;
  562. };
  563. struct be_fw_cfg {
  564. struct be_cmd_req_hdr hdr;
  565. u32 be_config_number;
  566. u32 asic_revision;
  567. u32 phys_port;
  568. u32 function_mode;
  569. struct be_ulp_fw_cfg ulp[2];
  570. u32 function_caps;
  571. } __packed;
  572. #define CMD_ISCSI_COMMAND_INVALIDATE 1
  573. #define ISCSI_OPCODE_SCSI_DATA_OUT 5
  574. #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
  575. #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
  576. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  577. #define OPCODE_COMMON_ISCSI_CLEANUP 59
  578. #define OPCODE_COMMON_TCP_UPLOAD 56
  579. #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
  580. /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
  581. #define CMD_ISCSI_CONNECTION_INVALIDATE 1
  582. #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 2
  583. #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
  584. #define INI_WR_CMD 1 /* Initiator write command */
  585. #define INI_TMF_CMD 2 /* Initiator TMF command */
  586. #define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */
  587. #define INI_RD_CMD 5 /* Initiator requesting to send
  588. * a read command
  589. */
  590. #define TGT_CTX_UPDT_CMD 7 /* Target context update */
  591. #define TGT_STS_CMD 8 /* Target R2T and other BHS
  592. * where only the status number
  593. * need to be updated
  594. */
  595. #define TGT_DATAIN_CMD 9 /* Target Data-Ins in response
  596. * to read command
  597. */
  598. #define TGT_SOS_PDU 10 /* Target:standalone status
  599. * response
  600. */
  601. #define TGT_DM_CMD 11 /* Indicates that the bhs
  602. * preparedby
  603. * driver should not be touched
  604. */
  605. /* --- CMD_CHUTE_TYPE --- */
  606. #define CMD_CONNECTION_CHUTE_0 1
  607. #define CMD_CONNECTION_CHUTE_1 2
  608. #define CMD_CONNECTION_CHUTE_2 3
  609. #define EQ_MAJOR_CODE_COMPLETION 0
  610. #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0
  611. #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1
  612. /* --- CONNECTION_UPLOAD_PARAMS --- */
  613. /* These parameters are used to define the type of upload desired. */
  614. #define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */
  615. #define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with
  616. * reset
  617. */
  618. #define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without
  619. * reset
  620. */
  621. #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset,
  622. * sequence number by driver */
  623. /* Returns byte size of given field with a structure. */
  624. /* Returns the number of items in the field array. */
  625. #define BE_NUMBER_OF_FIELD(_type_, _field_) \
  626. (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
  627. /**
  628. * Different types of iSCSI completions to host driver for both initiator
  629. * and taget mode
  630. * of operation.
  631. */
  632. #define SOL_CMD_COMPLETE 1 /* Solicited command completed
  633. * normally
  634. */
  635. #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got
  636. * invalidated internally due
  637. * to Data Digest error
  638. */
  639. #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated
  640. * internally
  641. * due to a recieved PDU
  642. * size > DSL
  643. */
  644. #define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated
  645. * internally due ti received
  646. * PDU sequence size >
  647. * FBL/MBL.
  648. */
  649. #define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated
  650. * internally due to a recieved
  651. * PDU Hdr that has
  652. * AHS */
  653. #define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated
  654. * internally due to Hdr Digest
  655. * error
  656. */
  657. #define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated
  658. * internally
  659. * due to a bad opcode in the
  660. * pdu hdr
  661. */
  662. #define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated
  663. * internally due to a recieved
  664. * ITT/TTT that does not belong
  665. * to this Connection
  666. */
  667. #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated
  668. * internally due to recieved
  669. * ITT/TTT value > Max
  670. * Supported ITTs/TTTs
  671. */
  672. #define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated
  673. * internally due to an
  674. * incoming TCP RST
  675. */
  676. #define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated
  677. * internally due to timeout on
  678. * tcp segment 12 retransmit
  679. * attempts failed
  680. */
  681. #define CXN_KILLED_RST_SENT 12 /* Connection got invalidated
  682. * internally due to TCP RST
  683. * sent by the Tx side
  684. */
  685. #define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated
  686. * internally due to an
  687. * incoming TCP FIN.
  688. */
  689. #define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated
  690. * internally due to bad
  691. * unsolicited PDU Unsolicited
  692. * PDUs are PDUs with
  693. * ITT=0xffffffff
  694. */
  695. #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated
  696. * internally due to bad WRB
  697. * index.
  698. */
  699. #define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated
  700. * internally due to recived
  701. * command has residual
  702. * over run bytes.
  703. */
  704. #define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated
  705. * internally due to recived
  706. * command has residual under
  707. * run bytes.
  708. */
  709. #define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated
  710. * internally due to a recieved
  711. * PDU has an invalid StatusSN
  712. */
  713. #define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated
  714. * internally due to a recieved
  715. * an R2T with some invalid
  716. * fields in it
  717. */
  718. #define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated
  719. * internally due to received
  720. * PDU has an invalid LUN.
  721. */
  722. #define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated
  723. * internally due to the
  724. * corresponding ICD not in a
  725. * valid state
  726. */
  727. #define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due
  728. * to received PDU has an
  729. * invalid ITT.
  730. */
  731. #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due
  732. * to received sequence buffer
  733. * offset is out of order.
  734. */
  735. #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated
  736. * internally due to a
  737. * recieved PDU has an invalid
  738. * DataSN
  739. */
  740. #define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation
  741. * completion notify.
  742. */
  743. #define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation
  744. * completion
  745. * with data PDU index.
  746. */
  747. #define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation
  748. * completionnotifify.
  749. */
  750. #define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/
  751. #define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/
  752. #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest
  753. * error notify.
  754. */
  755. #define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based
  756. * notification.
  757. */
  758. #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated
  759. * internally due to command
  760. * and data are not on same
  761. * connection.
  762. */
  763. #define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got
  764. * invalidated internally due
  765. * to DIF error
  766. */
  767. #define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated
  768. * internally due to incoming
  769. * TCP SYN
  770. */
  771. #define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated
  772. * internally due to an
  773. * incoming Unsolicited PDU
  774. * that has immediate data on
  775. * the cxn
  776. */
  777. void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
  778. bool embedded, u8 sge_cnt);
  779. void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
  780. u8 subsystem, u8 opcode, int cmd_len);
  781. #endif /* !BEISCSI_CMDS_H */