bfi_ms.h 22 KB

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