bfi_ms.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFI_MS_H__
  18. #define __BFI_MS_H__
  19. #include "bfi.h"
  20. #include "bfa_fc.h"
  21. #include "bfa_defs_svc.h"
  22. #pragma pack(1)
  23. enum bfi_iocfc_h2i_msgs {
  24. BFI_IOCFC_H2I_CFG_REQ = 1,
  25. BFI_IOCFC_H2I_SET_INTR_REQ = 2,
  26. BFI_IOCFC_H2I_UPDATEQ_REQ = 3,
  27. };
  28. enum bfi_iocfc_i2h_msgs {
  29. BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1),
  30. BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3),
  31. };
  32. struct bfi_iocfc_cfg_s {
  33. u8 num_cqs; /* Number of CQs to be used */
  34. u8 sense_buf_len; /* SCSI sense length */
  35. u16 rsvd_1;
  36. u32 endian_sig; /* endian signature of host */
  37. /*
  38. * Request and response circular queue base addresses, size and
  39. * shadow index pointers.
  40. */
  41. union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS];
  42. union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS];
  43. __be16 req_cq_elems[BFI_IOC_MAX_CQS];
  44. union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS];
  45. union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS];
  46. __be16 rsp_cq_elems[BFI_IOC_MAX_CQS];
  47. union bfi_addr_u stats_addr; /* DMA-able address for stats */
  48. union bfi_addr_u cfgrsp_addr; /* config response dma address */
  49. union bfi_addr_u ioim_snsbase; /* IO sense buffer base address */
  50. struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
  51. };
  52. /*
  53. * Boot target wwn information for this port. This contains either the stored
  54. * or discovered boot target port wwns for the port.
  55. */
  56. struct bfi_iocfc_bootwwns {
  57. wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
  58. u8 nwwns;
  59. u8 rsvd[7];
  60. };
  61. struct bfi_iocfc_cfgrsp_s {
  62. struct bfa_iocfc_fwcfg_s fwcfg;
  63. struct bfa_iocfc_intr_attr_s intr_attr;
  64. struct bfi_iocfc_bootwwns bootwwns;
  65. struct bfi_pbc_s pbc_cfg;
  66. };
  67. /*
  68. * BFI_IOCFC_H2I_CFG_REQ message
  69. */
  70. struct bfi_iocfc_cfg_req_s {
  71. struct bfi_mhdr_s mh;
  72. union bfi_addr_u ioc_cfg_dma_addr;
  73. };
  74. /*
  75. * BFI_IOCFC_I2H_CFG_REPLY message
  76. */
  77. struct bfi_iocfc_cfg_reply_s {
  78. struct bfi_mhdr_s mh; /* Common msg header */
  79. u8 cfg_success; /* cfg reply status */
  80. u8 lpu_bm; /* LPUs assigned for this IOC */
  81. u8 rsvd[2];
  82. };
  83. /*
  84. * BFI_IOCFC_H2I_SET_INTR_REQ message
  85. */
  86. struct bfi_iocfc_set_intr_req_s {
  87. struct bfi_mhdr_s mh; /* common msg header */
  88. u8 coalesce; /* enable intr coalescing */
  89. u8 rsvd[3];
  90. __be16 delay; /* delay timer 0..1125us */
  91. __be16 latency; /* latency timer 0..225us */
  92. };
  93. /*
  94. * BFI_IOCFC_H2I_UPDATEQ_REQ message
  95. */
  96. struct bfi_iocfc_updateq_req_s {
  97. struct bfi_mhdr_s mh; /* common msg header */
  98. u32 reqq_ba; /* reqq base addr */
  99. u32 rspq_ba; /* rspq base addr */
  100. u32 reqq_sci; /* reqq shadow ci */
  101. u32 rspq_spi; /* rspq shadow pi */
  102. };
  103. /*
  104. * BFI_IOCFC_I2H_UPDATEQ_RSP message
  105. */
  106. struct bfi_iocfc_updateq_rsp_s {
  107. struct bfi_mhdr_s mh; /* common msg header */
  108. u8 status; /* updateq status */
  109. u8 rsvd[3];
  110. };
  111. /*
  112. * H2I Messages
  113. */
  114. union bfi_iocfc_h2i_msg_u {
  115. struct bfi_mhdr_s mh;
  116. struct bfi_iocfc_cfg_req_s cfg_req;
  117. struct bfi_iocfc_updateq_req_s updateq_req;
  118. u32 mboxmsg[BFI_IOC_MSGSZ];
  119. };
  120. /*
  121. * I2H Messages
  122. */
  123. union bfi_iocfc_i2h_msg_u {
  124. struct bfi_mhdr_s mh;
  125. struct bfi_iocfc_cfg_reply_s cfg_reply;
  126. struct bfi_iocfc_updateq_rsp_s updateq_rsp;
  127. u32 mboxmsg[BFI_IOC_MSGSZ];
  128. };
  129. enum bfi_fcport_h2i {
  130. BFI_FCPORT_H2I_ENABLE_REQ = (1),
  131. BFI_FCPORT_H2I_DISABLE_REQ = (2),
  132. BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
  133. BFI_FCPORT_H2I_STATS_GET_REQ = (4),
  134. BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
  135. };
  136. enum bfi_fcport_i2h {
  137. BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
  138. BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
  139. BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
  140. BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
  141. BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
  142. BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
  143. BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
  144. BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
  145. BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
  146. };
  147. /*
  148. * Generic REQ type
  149. */
  150. struct bfi_fcport_req_s {
  151. struct bfi_mhdr_s mh; /* msg header */
  152. u32 msgtag; /* msgtag for reply */
  153. };
  154. /*
  155. * Generic RSP type
  156. */
  157. struct bfi_fcport_rsp_s {
  158. struct bfi_mhdr_s mh; /* common msg header */
  159. u8 status; /* port enable status */
  160. u8 rsvd[3];
  161. struct bfa_port_cfg_s port_cfg;/* port configuration */
  162. u32 msgtag; /* msgtag for reply */
  163. };
  164. /*
  165. * BFI_FCPORT_H2I_ENABLE_REQ
  166. */
  167. struct bfi_fcport_enable_req_s {
  168. struct bfi_mhdr_s mh; /* msg header */
  169. u32 rsvd1;
  170. wwn_t nwwn; /* node wwn of physical port */
  171. wwn_t pwwn; /* port wwn of physical port */
  172. struct bfa_port_cfg_s port_cfg; /* port configuration */
  173. union bfi_addr_u stats_dma_addr; /* DMA address for stats */
  174. u32 msgtag; /* msgtag for reply */
  175. u8 use_flash_cfg; /* get prot cfg from flash */
  176. u8 rsvd2[3];
  177. };
  178. /*
  179. * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
  180. */
  181. struct bfi_fcport_set_svc_params_req_s {
  182. struct bfi_mhdr_s mh; /* msg header */
  183. __be16 tx_bbcredit; /* Tx credits */
  184. u16 rsvd;
  185. };
  186. /*
  187. * BFI_FCPORT_I2H_EVENT
  188. */
  189. struct bfi_fcport_event_s {
  190. struct bfi_mhdr_s mh; /* common msg header */
  191. struct bfa_port_link_s link_state;
  192. };
  193. /*
  194. * BFI_FCPORT_I2H_TRUNK_SCN
  195. */
  196. struct bfi_fcport_trunk_link_s {
  197. wwn_t trunk_wwn;
  198. u8 fctl; /* bfa_trunk_link_fctl_t */
  199. u8 state; /* bfa_trunk_link_state_t */
  200. u8 speed; /* bfa_port_speed_t */
  201. u8 rsvd;
  202. __be32 deskew;
  203. };
  204. #define BFI_FCPORT_MAX_LINKS 2
  205. struct bfi_fcport_trunk_scn_s {
  206. struct bfi_mhdr_s mh;
  207. u8 trunk_state; /* bfa_trunk_state_t */
  208. u8 trunk_speed; /* bfa_port_speed_t */
  209. u8 rsvd_a[2];
  210. struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
  211. };
  212. /*
  213. * fcport H2I message
  214. */
  215. union bfi_fcport_h2i_msg_u {
  216. struct bfi_mhdr_s *mhdr;
  217. struct bfi_fcport_enable_req_s *penable;
  218. struct bfi_fcport_req_s *pdisable;
  219. struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
  220. struct bfi_fcport_req_s *pstatsget;
  221. struct bfi_fcport_req_s *pstatsclear;
  222. };
  223. /*
  224. * fcport I2H message
  225. */
  226. union bfi_fcport_i2h_msg_u {
  227. struct bfi_msg_s *msg;
  228. struct bfi_fcport_rsp_s *penable_rsp;
  229. struct bfi_fcport_rsp_s *pdisable_rsp;
  230. struct bfi_fcport_rsp_s *psetsvcparams_rsp;
  231. struct bfi_fcport_rsp_s *pstatsget_rsp;
  232. struct bfi_fcport_rsp_s *pstatsclear_rsp;
  233. struct bfi_fcport_event_s *event;
  234. struct bfi_fcport_trunk_scn_s *trunk_scn;
  235. };
  236. enum bfi_fcxp_h2i {
  237. BFI_FCXP_H2I_SEND_REQ = 1,
  238. };
  239. enum bfi_fcxp_i2h {
  240. BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
  241. };
  242. #define BFA_FCXP_MAX_SGES 2
  243. /*
  244. * FCXP send request structure
  245. */
  246. struct bfi_fcxp_send_req_s {
  247. struct bfi_mhdr_s mh; /* Common msg header */
  248. __be16 fcxp_tag; /* driver request tag */
  249. __be16 max_frmsz; /* max send frame size */
  250. __be16 vf_id; /* vsan tag if applicable */
  251. u16 rport_fw_hndl; /* FW Handle for the remote port */
  252. u8 class; /* FC class used for req/rsp */
  253. u8 rsp_timeout; /* timeout in secs, 0-no response */
  254. u8 cts; /* continue sequence */
  255. u8 lp_tag; /* lport tag */
  256. struct fchs_s fchs; /* request FC header structure */
  257. __be32 req_len; /* request payload length */
  258. __be32 rsp_maxlen; /* max response length expected */
  259. struct bfi_sge_s req_sge[BFA_FCXP_MAX_SGES]; /* request buf */
  260. struct bfi_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; /* response buf */
  261. };
  262. /*
  263. * FCXP send response structure
  264. */
  265. struct bfi_fcxp_send_rsp_s {
  266. struct bfi_mhdr_s mh; /* Common msg header */
  267. __be16 fcxp_tag; /* send request tag */
  268. u8 req_status; /* request status */
  269. u8 rsvd;
  270. __be32 rsp_len; /* actual response length */
  271. __be32 residue_len; /* residual response length */
  272. struct fchs_s fchs; /* response FC header structure */
  273. };
  274. enum bfi_uf_h2i {
  275. BFI_UF_H2I_BUF_POST = 1,
  276. };
  277. enum bfi_uf_i2h {
  278. BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
  279. };
  280. #define BFA_UF_MAX_SGES 2
  281. struct bfi_uf_buf_post_s {
  282. struct bfi_mhdr_s mh; /* Common msg header */
  283. u16 buf_tag; /* buffer tag */
  284. __be16 buf_len; /* total buffer length */
  285. struct bfi_sge_s sge[BFA_UF_MAX_SGES]; /* buffer DMA SGEs */
  286. };
  287. struct bfi_uf_frm_rcvd_s {
  288. struct bfi_mhdr_s mh; /* Common msg header */
  289. u16 buf_tag; /* buffer tag */
  290. u16 rsvd;
  291. u16 frm_len; /* received frame length */
  292. u16 xfr_len; /* tranferred length */
  293. };
  294. enum bfi_lps_h2i_msgs {
  295. BFI_LPS_H2I_LOGIN_REQ = 1,
  296. BFI_LPS_H2I_LOGOUT_REQ = 2,
  297. BFI_LPS_H2I_N2N_PID_REQ = 3,
  298. };
  299. enum bfi_lps_i2h_msgs {
  300. BFI_LPS_H2I_LOGIN_RSP = BFA_I2HM(1),
  301. BFI_LPS_H2I_LOGOUT_RSP = BFA_I2HM(2),
  302. BFI_LPS_H2I_CVL_EVENT = BFA_I2HM(3),
  303. };
  304. struct bfi_lps_login_req_s {
  305. struct bfi_mhdr_s mh; /* common msg header */
  306. u8 lp_tag;
  307. u8 alpa;
  308. __be16 pdu_size;
  309. wwn_t pwwn;
  310. wwn_t nwwn;
  311. u8 fdisc;
  312. u8 auth_en;
  313. u8 rsvd[2];
  314. };
  315. struct bfi_lps_login_rsp_s {
  316. struct bfi_mhdr_s mh; /* common msg header */
  317. u8 lp_tag;
  318. u8 status;
  319. u8 lsrjt_rsn;
  320. u8 lsrjt_expl;
  321. wwn_t port_name;
  322. wwn_t node_name;
  323. __be16 bb_credit;
  324. u8 f_port;
  325. u8 npiv_en;
  326. u32 lp_pid:24;
  327. u32 auth_req:8;
  328. mac_t lp_mac;
  329. mac_t fcf_mac;
  330. u8 ext_status;
  331. u8 brcd_switch; /* attached peer is brcd switch */
  332. };
  333. struct bfi_lps_logout_req_s {
  334. struct bfi_mhdr_s mh; /* common msg header */
  335. u8 lp_tag;
  336. u8 rsvd[3];
  337. wwn_t port_name;
  338. };
  339. struct bfi_lps_logout_rsp_s {
  340. struct bfi_mhdr_s mh; /* common msg header */
  341. u8 lp_tag;
  342. u8 status;
  343. u8 rsvd[2];
  344. };
  345. struct bfi_lps_cvl_event_s {
  346. struct bfi_mhdr_s mh; /* common msg header */
  347. u8 lp_tag;
  348. u8 rsvd[3];
  349. };
  350. struct bfi_lps_n2n_pid_req_s {
  351. struct bfi_mhdr_s mh; /* common msg header */
  352. u8 lp_tag;
  353. u32 lp_pid:24;
  354. };
  355. union bfi_lps_h2i_msg_u {
  356. struct bfi_mhdr_s *msg;
  357. struct bfi_lps_login_req_s *login_req;
  358. struct bfi_lps_logout_req_s *logout_req;
  359. struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
  360. };
  361. union bfi_lps_i2h_msg_u {
  362. struct bfi_msg_s *msg;
  363. struct bfi_lps_login_rsp_s *login_rsp;
  364. struct bfi_lps_logout_rsp_s *logout_rsp;
  365. struct bfi_lps_cvl_event_s *cvl_event;
  366. };
  367. enum bfi_rport_h2i_msgs {
  368. BFI_RPORT_H2I_CREATE_REQ = 1,
  369. BFI_RPORT_H2I_DELETE_REQ = 2,
  370. BFI_RPORT_H2I_SET_SPEED_REQ = 3,
  371. };
  372. enum bfi_rport_i2h_msgs {
  373. BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
  374. BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
  375. BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
  376. };
  377. struct bfi_rport_create_req_s {
  378. struct bfi_mhdr_s mh; /* common msg header */
  379. u16 bfa_handle; /* host rport handle */
  380. __be16 max_frmsz; /* max rcv pdu size */
  381. u32 pid:24, /* remote port ID */
  382. lp_tag:8; /* local port tag */
  383. u32 local_pid:24, /* local port ID */
  384. cisc:8;
  385. u8 fc_class; /* supported FC classes */
  386. u8 vf_en; /* virtual fabric enable */
  387. u16 vf_id; /* virtual fabric ID */
  388. };
  389. struct bfi_rport_create_rsp_s {
  390. struct bfi_mhdr_s mh; /* common msg header */
  391. u8 status; /* rport creation status */
  392. u8 rsvd[3];
  393. u16 bfa_handle; /* host rport handle */
  394. u16 fw_handle; /* firmware rport handle */
  395. struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
  396. };
  397. struct bfa_rport_speed_req_s {
  398. struct bfi_mhdr_s mh; /* common msg header */
  399. u16 fw_handle; /* firmware rport handle */
  400. u8 speed; /* rport's speed via RPSC */
  401. u8 rsvd;
  402. };
  403. struct bfi_rport_delete_req_s {
  404. struct bfi_mhdr_s mh; /* common msg header */
  405. u16 fw_handle; /* firmware rport handle */
  406. u16 rsvd;
  407. };
  408. struct bfi_rport_delete_rsp_s {
  409. struct bfi_mhdr_s mh; /* common msg header */
  410. u16 bfa_handle; /* host rport handle */
  411. u8 status; /* rport deletion status */
  412. u8 rsvd;
  413. };
  414. struct bfi_rport_qos_scn_s {
  415. struct bfi_mhdr_s mh; /* common msg header */
  416. u16 bfa_handle; /* host rport handle */
  417. u16 rsvd;
  418. struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
  419. struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
  420. };
  421. union bfi_rport_h2i_msg_u {
  422. struct bfi_msg_s *msg;
  423. struct bfi_rport_create_req_s *create_req;
  424. struct bfi_rport_delete_req_s *delete_req;
  425. struct bfi_rport_speed_req_s *speed_req;
  426. };
  427. union bfi_rport_i2h_msg_u {
  428. struct bfi_msg_s *msg;
  429. struct bfi_rport_create_rsp_s *create_rsp;
  430. struct bfi_rport_delete_rsp_s *delete_rsp;
  431. struct bfi_rport_qos_scn_s *qos_scn_evt;
  432. };
  433. /*
  434. * Initiator mode I-T nexus interface defines.
  435. */
  436. enum bfi_itnim_h2i {
  437. BFI_ITNIM_H2I_CREATE_REQ = 1, /* i-t nexus creation */
  438. BFI_ITNIM_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
  439. };
  440. enum bfi_itnim_i2h {
  441. BFI_ITNIM_I2H_CREATE_RSP = BFA_I2HM(1),
  442. BFI_ITNIM_I2H_DELETE_RSP = BFA_I2HM(2),
  443. BFI_ITNIM_I2H_SLER_EVENT = BFA_I2HM(3),
  444. };
  445. struct bfi_itnim_create_req_s {
  446. struct bfi_mhdr_s mh; /* common msg header */
  447. u16 fw_handle; /* f/w handle for itnim */
  448. u8 class; /* FC class for IO */
  449. u8 seq_rec; /* sequence recovery support */
  450. u8 msg_no; /* seq id of the msg */
  451. };
  452. struct bfi_itnim_create_rsp_s {
  453. struct bfi_mhdr_s mh; /* common msg header */
  454. u16 bfa_handle; /* bfa handle for itnim */
  455. u8 status; /* fcp request status */
  456. u8 seq_id; /* seq id of the msg */
  457. };
  458. struct bfi_itnim_delete_req_s {
  459. struct bfi_mhdr_s mh; /* common msg header */
  460. u16 fw_handle; /* f/w itnim handle */
  461. u8 seq_id; /* seq id of the msg */
  462. u8 rsvd;
  463. };
  464. struct bfi_itnim_delete_rsp_s {
  465. struct bfi_mhdr_s mh; /* common msg header */
  466. u16 bfa_handle; /* bfa handle for itnim */
  467. u8 status; /* fcp request status */
  468. u8 seq_id; /* seq id of the msg */
  469. };
  470. struct bfi_itnim_sler_event_s {
  471. struct bfi_mhdr_s mh; /* common msg header */
  472. u16 bfa_handle; /* bfa handle for itnim */
  473. u16 rsvd;
  474. };
  475. union bfi_itnim_h2i_msg_u {
  476. struct bfi_itnim_create_req_s *create_req;
  477. struct bfi_itnim_delete_req_s *delete_req;
  478. struct bfi_msg_s *msg;
  479. };
  480. union bfi_itnim_i2h_msg_u {
  481. struct bfi_itnim_create_rsp_s *create_rsp;
  482. struct bfi_itnim_delete_rsp_s *delete_rsp;
  483. struct bfi_itnim_sler_event_s *sler_event;
  484. struct bfi_msg_s *msg;
  485. };
  486. /*
  487. * Initiator mode IO interface defines.
  488. */
  489. enum bfi_ioim_h2i {
  490. BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
  491. BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
  492. };
  493. enum bfi_ioim_i2h {
  494. BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
  495. BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
  496. };
  497. /*
  498. * IO command DIF info
  499. */
  500. struct bfi_ioim_dif_s {
  501. u32 dif_info[4];
  502. };
  503. /*
  504. * FCP IO messages overview
  505. *
  506. * @note
  507. * - Max CDB length supported is 64 bytes.
  508. * - SCSI Linked commands and SCSI bi-directional Commands not
  509. * supported.
  510. *
  511. */
  512. struct bfi_ioim_req_s {
  513. struct bfi_mhdr_s mh; /* Common msg header */
  514. __be16 io_tag; /* I/O tag */
  515. u16 rport_hdl; /* itnim/rport firmware handle */
  516. struct fcp_cmnd_s cmnd; /* IO request info */
  517. /*
  518. * SG elements array within the IO request must be double word
  519. * aligned. This aligment is required to optimize SGM setup for the IO.
  520. */
  521. struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
  522. u8 io_timeout;
  523. u8 dif_en;
  524. u8 rsvd_a[2];
  525. struct bfi_ioim_dif_s dif;
  526. };
  527. /*
  528. * This table shows various IO status codes from firmware and their
  529. * meaning. Host driver can use these status codes to further process
  530. * IO completions.
  531. *
  532. * BFI_IOIM_STS_OK : IO completed with error free SCSI &
  533. * transport status.
  534. * io-tag can be reused.
  535. *
  536. * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
  537. * - io-tag can be reused.
  538. *
  539. * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
  540. * host request.
  541. * - io-tag cannot be reused yet.
  542. *
  543. * BFI_IOIM_STS_ABORTED : IO was aborted successfully
  544. * internally by f/w.
  545. * - io-tag cannot be reused yet.
  546. *
  547. * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
  548. * in the firmware and
  549. * - io-tag cannot be reused yet.
  550. *
  551. * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
  552. * with sequence level error
  553. * logic and hence host needs to retry
  554. * this IO with a different IO tag
  555. * - io-tag cannot be used yet.
  556. *
  557. * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
  558. * is required because 2 consecutive ABTS
  559. * timedout and host needs logout and
  560. * re-login with the target
  561. * - io-tag cannot be used yet.
  562. *
  563. * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
  564. * but the data tranferred is less than
  565. * the fcp data length in the command.
  566. * ex. SCSI INQUIRY where transferred
  567. * data length and residue count in FCP
  568. * response accounts for total fcp-dl
  569. * - io-tag can be reused.
  570. *
  571. * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
  572. * but the data transerred is more than
  573. * fcp data length in the command. ex.
  574. * TAPE IOs where blocks can of unequal
  575. * lengths.
  576. * - io-tag can be reused.
  577. *
  578. * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
  579. * during abort process
  580. * - io-tag can be reused.
  581. *
  582. * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
  583. * ex target sent more data than
  584. * requested, or there was data frame
  585. * loss and other reasons
  586. * - io-tag cannot be used yet.
  587. *
  588. * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
  589. * CRC err or Ref Tag err or App tag err.
  590. * - io-tag can be reused.
  591. *
  592. * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
  593. * Management command from the host
  594. * - io-tag can be reused.
  595. *
  596. * BFI_IOIM_STS_UTAG : Firmware does not know about this
  597. * io_tag.
  598. * - io-tag can be reused.
  599. */
  600. enum bfi_ioim_status {
  601. BFI_IOIM_STS_OK = 0,
  602. BFI_IOIM_STS_HOST_ABORTED = 1,
  603. BFI_IOIM_STS_ABORTED = 2,
  604. BFI_IOIM_STS_TIMEDOUT = 3,
  605. BFI_IOIM_STS_RES_FREE = 4,
  606. BFI_IOIM_STS_SQER_NEEDED = 5,
  607. BFI_IOIM_STS_PROTO_ERR = 6,
  608. BFI_IOIM_STS_UTAG = 7,
  609. BFI_IOIM_STS_PATHTOV = 8,
  610. };
  611. #define BFI_IOIM_SNSLEN (256)
  612. /*
  613. * I/O response message
  614. */
  615. struct bfi_ioim_rsp_s {
  616. struct bfi_mhdr_s mh; /* common msg header */
  617. __be16 io_tag; /* completed IO tag */
  618. u16 bfa_rport_hndl; /* releated rport handle */
  619. u8 io_status; /* IO completion status */
  620. u8 reuse_io_tag; /* IO tag can be reused */
  621. u16 abort_tag; /* host abort request tag */
  622. u8 scsi_status; /* scsi status from target */
  623. u8 sns_len; /* scsi sense length */
  624. u8 resid_flags; /* IO residue flags */
  625. u8 rsvd_a;
  626. __be32 residue; /* IO residual length in bytes */
  627. u32 rsvd_b[3];
  628. };
  629. struct bfi_ioim_abort_req_s {
  630. struct bfi_mhdr_s mh; /* Common msg header */
  631. __be16 io_tag; /* I/O tag */
  632. u16 abort_tag; /* unique request tag */
  633. };
  634. /*
  635. * Initiator mode task management command interface defines.
  636. */
  637. enum bfi_tskim_h2i {
  638. BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
  639. BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
  640. };
  641. enum bfi_tskim_i2h {
  642. BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
  643. };
  644. struct bfi_tskim_req_s {
  645. struct bfi_mhdr_s mh; /* Common msg header */
  646. __be16 tsk_tag; /* task management tag */
  647. u16 itn_fhdl; /* itn firmware handle */
  648. struct scsi_lun lun; /* LU number */
  649. u8 tm_flags; /* see enum fcp_tm_cmnd */
  650. u8 t_secs; /* Timeout value in seconds */
  651. u8 rsvd[2];
  652. };
  653. struct bfi_tskim_abortreq_s {
  654. struct bfi_mhdr_s mh; /* Common msg header */
  655. __be16 tsk_tag; /* task management tag */
  656. u16 rsvd;
  657. };
  658. enum bfi_tskim_status {
  659. /*
  660. * Following are FCP-4 spec defined status codes,
  661. * **DO NOT CHANGE THEM **
  662. */
  663. BFI_TSKIM_STS_OK = 0,
  664. BFI_TSKIM_STS_NOT_SUPP = 4,
  665. BFI_TSKIM_STS_FAILED = 5,
  666. /*
  667. * Defined by BFA
  668. */
  669. BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
  670. BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
  671. };
  672. struct bfi_tskim_rsp_s {
  673. struct bfi_mhdr_s mh; /* Common msg header */
  674. __be16 tsk_tag; /* task mgmt cmnd tag */
  675. u8 tsk_status; /* @ref bfi_tskim_status */
  676. u8 rsvd;
  677. };
  678. #pragma pack()
  679. #endif /* __BFI_MS_H__ */