t4fw_api_stor.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /*
  2. * This file is part of the Chelsio FCoE driver for Linux.
  3. *
  4. * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef _T4FW_API_STOR_H_
  35. #define _T4FW_API_STOR_H_
  36. /******************************************************************************
  37. * R E T U R N V A L U E S
  38. ********************************/
  39. enum fw_fcoe_link_sub_op {
  40. FCOE_LINK_DOWN = 0x0,
  41. FCOE_LINK_UP = 0x1,
  42. FCOE_LINK_COND = 0x2,
  43. };
  44. enum fw_fcoe_link_status {
  45. FCOE_LINKDOWN = 0x0,
  46. FCOE_LINKUP = 0x1,
  47. };
  48. enum fw_ofld_prot {
  49. PROT_FCOE = 0x1,
  50. PROT_ISCSI = 0x2,
  51. };
  52. enum rport_type_fcoe {
  53. FLOGI_VFPORT = 0x1, /* 0xfffffe */
  54. FDISC_VFPORT = 0x2, /* 0xfffffe */
  55. NS_VNPORT = 0x3, /* 0xfffffc */
  56. REG_FC4_VNPORT = 0x4, /* any FC4 type VN_PORT */
  57. REG_VNPORT = 0x5, /* 0xfffxxx - non FC4 port in switch */
  58. FDMI_VNPORT = 0x6, /* 0xfffffa */
  59. FAB_CTLR_VNPORT = 0x7, /* 0xfffffd */
  60. };
  61. enum event_cause_fcoe {
  62. PLOGI_ACC_RCVD = 0x01,
  63. PLOGI_RJT_RCVD = 0x02,
  64. PLOGI_RCVD = 0x03,
  65. PLOGO_RCVD = 0x04,
  66. PRLI_ACC_RCVD = 0x05,
  67. PRLI_RJT_RCVD = 0x06,
  68. PRLI_RCVD = 0x07,
  69. PRLO_RCVD = 0x08,
  70. NPORT_ID_CHGD = 0x09,
  71. FLOGO_RCVD = 0x0a,
  72. CLR_VIRT_LNK_RCVD = 0x0b,
  73. FLOGI_ACC_RCVD = 0x0c,
  74. FLOGI_RJT_RCVD = 0x0d,
  75. FDISC_ACC_RCVD = 0x0e,
  76. FDISC_RJT_RCVD = 0x0f,
  77. FLOGI_TMO_MAX_RETRY = 0x10,
  78. IMPL_LOGO_ADISC_ACC = 0x11,
  79. IMPL_LOGO_ADISC_RJT = 0x12,
  80. IMPL_LOGO_ADISC_CNFLT = 0x13,
  81. PRLI_TMO = 0x14,
  82. ADISC_TMO = 0x15,
  83. RSCN_DEV_LOST = 0x16,
  84. SCR_ACC_RCVD = 0x17,
  85. ADISC_RJT_RCVD = 0x18,
  86. LOGO_SNT = 0x19,
  87. PROTO_ERR_IMPL_LOGO = 0x1a,
  88. };
  89. enum fcoe_cmn_type {
  90. FCOE_ELS,
  91. FCOE_CT,
  92. FCOE_SCSI_CMD,
  93. FCOE_UNSOL_ELS,
  94. };
  95. enum fw_wr_stor_opcodes {
  96. FW_RDEV_WR = 0x38,
  97. FW_FCOE_ELS_CT_WR = 0x30,
  98. FW_SCSI_WRITE_WR = 0x31,
  99. FW_SCSI_READ_WR = 0x32,
  100. FW_SCSI_CMD_WR = 0x33,
  101. FW_SCSI_ABRT_CLS_WR = 0x34,
  102. };
  103. struct fw_rdev_wr {
  104. __be32 op_to_immdlen;
  105. __be32 alloc_to_len16;
  106. __be64 cookie;
  107. u8 protocol;
  108. u8 event_cause;
  109. u8 cur_state;
  110. u8 prev_state;
  111. __be32 flags_to_assoc_flowid;
  112. union rdev_entry {
  113. struct fcoe_rdev_entry {
  114. __be32 flowid;
  115. u8 protocol;
  116. u8 event_cause;
  117. u8 flags;
  118. u8 rjt_reason;
  119. u8 cur_login_st;
  120. u8 prev_login_st;
  121. __be16 rcv_fr_sz;
  122. u8 rd_xfer_rdy_to_rport_type;
  123. u8 vft_to_qos;
  124. u8 org_proc_assoc_to_acc_rsp_code;
  125. u8 enh_disc_to_tgt;
  126. u8 wwnn[8];
  127. u8 wwpn[8];
  128. __be16 iqid;
  129. u8 fc_oui[3];
  130. u8 r_id[3];
  131. } fcoe_rdev;
  132. struct iscsi_rdev_entry {
  133. __be32 flowid;
  134. u8 protocol;
  135. u8 event_cause;
  136. u8 flags;
  137. u8 r3;
  138. __be16 iscsi_opts;
  139. __be16 tcp_opts;
  140. __be16 ip_opts;
  141. __be16 max_rcv_len;
  142. __be16 max_snd_len;
  143. __be16 first_brst_len;
  144. __be16 max_brst_len;
  145. __be16 r4;
  146. __be16 def_time2wait;
  147. __be16 def_time2ret;
  148. __be16 nop_out_intrvl;
  149. __be16 non_scsi_to;
  150. __be16 isid;
  151. __be16 tsid;
  152. __be16 port;
  153. __be16 tpgt;
  154. u8 r5[6];
  155. __be16 iqid;
  156. } iscsi_rdev;
  157. } u;
  158. };
  159. #define FW_RDEV_WR_FLOWID_GET(x) (((x) >> 8) & 0xfffff)
  160. #define FW_RDEV_WR_ASSOC_FLOWID_GET(x) (((x) >> 0) & 0xfffff)
  161. #define FW_RDEV_WR_RPORT_TYPE_GET(x) (((x) >> 0) & 0x1f)
  162. #define FW_RDEV_WR_NPIV_GET(x) (((x) >> 6) & 0x1)
  163. #define FW_RDEV_WR_CLASS_GET(x) (((x) >> 4) & 0x3)
  164. #define FW_RDEV_WR_TASK_RETRY_ID_GET(x) (((x) >> 5) & 0x1)
  165. #define FW_RDEV_WR_RETRY_GET(x) (((x) >> 4) & 0x1)
  166. #define FW_RDEV_WR_CONF_CMPL_GET(x) (((x) >> 3) & 0x1)
  167. #define FW_RDEV_WR_INI_GET(x) (((x) >> 1) & 0x1)
  168. #define FW_RDEV_WR_TGT_GET(x) (((x) >> 0) & 0x1)
  169. struct fw_fcoe_els_ct_wr {
  170. __be32 op_immdlen;
  171. __be32 flowid_len16;
  172. u64 cookie;
  173. __be16 iqid;
  174. u8 tmo_val;
  175. u8 els_ct_type;
  176. u8 ctl_pri;
  177. u8 cp_en_class;
  178. __be16 xfer_cnt;
  179. u8 fl_to_sp;
  180. u8 l_id[3];
  181. u8 r5;
  182. u8 r_id[3];
  183. __be64 rsp_dmaaddr;
  184. __be32 rsp_dmalen;
  185. __be32 r6;
  186. };
  187. #define FW_FCOE_ELS_CT_WR_OPCODE(x) ((x) << 24)
  188. #define FW_FCOE_ELS_CT_WR_OPCODE_GET(x) (((x) >> 24) & 0xff)
  189. #define FW_FCOE_ELS_CT_WR_IMMDLEN(x) ((x) << 0)
  190. #define FW_FCOE_ELS_CT_WR_IMMDLEN_GET(x) (((x) >> 0) & 0xff)
  191. #define FW_FCOE_ELS_CT_WR_SP(x) ((x) << 0)
  192. struct fw_scsi_write_wr {
  193. __be32 op_immdlen;
  194. __be32 flowid_len16;
  195. u64 cookie;
  196. __be16 iqid;
  197. u8 tmo_val;
  198. u8 use_xfer_cnt;
  199. union fw_scsi_write_priv {
  200. struct fcoe_write_priv {
  201. u8 ctl_pri;
  202. u8 cp_en_class;
  203. u8 r3_lo[2];
  204. } fcoe;
  205. struct iscsi_write_priv {
  206. u8 r3[4];
  207. } iscsi;
  208. } u;
  209. __be32 xfer_cnt;
  210. __be32 ini_xfer_cnt;
  211. __be64 rsp_dmaaddr;
  212. __be32 rsp_dmalen;
  213. __be32 r4;
  214. };
  215. #define FW_SCSI_WRITE_WR_IMMDLEN(x) ((x) << 0)
  216. struct fw_scsi_read_wr {
  217. __be32 op_immdlen;
  218. __be32 flowid_len16;
  219. u64 cookie;
  220. __be16 iqid;
  221. u8 tmo_val;
  222. u8 use_xfer_cnt;
  223. union fw_scsi_read_priv {
  224. struct fcoe_read_priv {
  225. u8 ctl_pri;
  226. u8 cp_en_class;
  227. u8 r3_lo[2];
  228. } fcoe;
  229. struct iscsi_read_priv {
  230. u8 r3[4];
  231. } iscsi;
  232. } u;
  233. __be32 xfer_cnt;
  234. __be32 ini_xfer_cnt;
  235. __be64 rsp_dmaaddr;
  236. __be32 rsp_dmalen;
  237. __be32 r4;
  238. };
  239. #define FW_SCSI_READ_WR_IMMDLEN(x) ((x) << 0)
  240. struct fw_scsi_cmd_wr {
  241. __be32 op_immdlen;
  242. __be32 flowid_len16;
  243. u64 cookie;
  244. __be16 iqid;
  245. u8 tmo_val;
  246. u8 r3;
  247. union fw_scsi_cmd_priv {
  248. struct fcoe_cmd_priv {
  249. u8 ctl_pri;
  250. u8 cp_en_class;
  251. u8 r4_lo[2];
  252. } fcoe;
  253. struct iscsi_cmd_priv {
  254. u8 r4[4];
  255. } iscsi;
  256. } u;
  257. u8 r5[8];
  258. __be64 rsp_dmaaddr;
  259. __be32 rsp_dmalen;
  260. __be32 r6;
  261. };
  262. #define FW_SCSI_CMD_WR_IMMDLEN(x) ((x) << 0)
  263. #define SCSI_ABORT 0
  264. #define SCSI_CLOSE 1
  265. struct fw_scsi_abrt_cls_wr {
  266. __be32 op_immdlen;
  267. __be32 flowid_len16;
  268. u64 cookie;
  269. __be16 iqid;
  270. u8 tmo_val;
  271. u8 sub_opcode_to_chk_all_io;
  272. u8 r3[4];
  273. u64 t_cookie;
  274. };
  275. #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x) ((x) << 2)
  276. #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE_GET(x) (((x) >> 2) & 0x3f)
  277. #define FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(x) ((x) << 0)
  278. enum fw_cmd_stor_opcodes {
  279. FW_FCOE_RES_INFO_CMD = 0x31,
  280. FW_FCOE_LINK_CMD = 0x32,
  281. FW_FCOE_VNP_CMD = 0x33,
  282. FW_FCOE_SPARAMS_CMD = 0x35,
  283. FW_FCOE_STATS_CMD = 0x37,
  284. FW_FCOE_FCF_CMD = 0x38,
  285. };
  286. struct fw_fcoe_res_info_cmd {
  287. __be32 op_to_read;
  288. __be32 retval_len16;
  289. __be16 e_d_tov;
  290. __be16 r_a_tov_seq;
  291. __be16 r_a_tov_els;
  292. __be16 r_r_tov;
  293. __be32 max_xchgs;
  294. __be32 max_ssns;
  295. __be32 used_xchgs;
  296. __be32 used_ssns;
  297. __be32 max_fcfs;
  298. __be32 max_vnps;
  299. __be32 used_fcfs;
  300. __be32 used_vnps;
  301. };
  302. struct fw_fcoe_link_cmd {
  303. __be32 op_to_portid;
  304. __be32 retval_len16;
  305. __be32 sub_opcode_fcfi;
  306. u8 r3;
  307. u8 lstatus;
  308. __be16 flags;
  309. u8 r4;
  310. u8 set_vlan;
  311. __be16 vlan_id;
  312. __be32 vnpi_pkd;
  313. __be16 r6;
  314. u8 phy_mac[6];
  315. u8 vnport_wwnn[8];
  316. u8 vnport_wwpn[8];
  317. };
  318. #define FW_FCOE_LINK_CMD_PORTID(x) ((x) << 0)
  319. #define FW_FCOE_LINK_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  320. #define FW_FCOE_LINK_CMD_SUB_OPCODE(x) ((x) << 24U)
  321. #define FW_FCOE_LINK_CMD_FCFI(x) ((x) << 0)
  322. #define FW_FCOE_LINK_CMD_FCFI_GET(x) (((x) >> 0) & 0xffffff)
  323. #define FW_FCOE_LINK_CMD_VNPI_GET(x) (((x) >> 0) & 0xfffff)
  324. struct fw_fcoe_vnp_cmd {
  325. __be32 op_to_fcfi;
  326. __be32 alloc_to_len16;
  327. __be32 gen_wwn_to_vnpi;
  328. __be32 vf_id;
  329. __be16 iqid;
  330. u8 vnport_mac[6];
  331. u8 vnport_wwnn[8];
  332. u8 vnport_wwpn[8];
  333. u8 cmn_srv_parms[16];
  334. u8 clsp_word_0_1[8];
  335. };
  336. #define FW_FCOE_VNP_CMD_FCFI(x) ((x) << 0)
  337. #define FW_FCOE_VNP_CMD_ALLOC (1U << 31)
  338. #define FW_FCOE_VNP_CMD_FREE (1U << 30)
  339. #define FW_FCOE_VNP_CMD_MODIFY (1U << 29)
  340. #define FW_FCOE_VNP_CMD_GEN_WWN (1U << 22)
  341. #define FW_FCOE_VNP_CMD_VFID_EN (1U << 20)
  342. #define FW_FCOE_VNP_CMD_VNPI(x) ((x) << 0)
  343. #define FW_FCOE_VNP_CMD_VNPI_GET(x) (((x) >> 0) & 0xfffff)
  344. struct fw_fcoe_sparams_cmd {
  345. __be32 op_to_portid;
  346. __be32 retval_len16;
  347. u8 r3[7];
  348. u8 cos;
  349. u8 lport_wwnn[8];
  350. u8 lport_wwpn[8];
  351. u8 cmn_srv_parms[16];
  352. u8 cls_srv_parms[16];
  353. };
  354. #define FW_FCOE_SPARAMS_CMD_PORTID(x) ((x) << 0)
  355. struct fw_fcoe_stats_cmd {
  356. __be32 op_to_flowid;
  357. __be32 free_to_len16;
  358. union fw_fcoe_stats {
  359. struct fw_fcoe_stats_ctl {
  360. u8 nstats_port;
  361. u8 port_valid_ix;
  362. __be16 r6;
  363. __be32 r7;
  364. __be64 stat0;
  365. __be64 stat1;
  366. __be64 stat2;
  367. __be64 stat3;
  368. __be64 stat4;
  369. __be64 stat5;
  370. } ctl;
  371. struct fw_fcoe_port_stats {
  372. __be64 tx_bcast_bytes;
  373. __be64 tx_bcast_frames;
  374. __be64 tx_mcast_bytes;
  375. __be64 tx_mcast_frames;
  376. __be64 tx_ucast_bytes;
  377. __be64 tx_ucast_frames;
  378. __be64 tx_drop_frames;
  379. __be64 tx_offload_bytes;
  380. __be64 tx_offload_frames;
  381. __be64 rx_bcast_bytes;
  382. __be64 rx_bcast_frames;
  383. __be64 rx_mcast_bytes;
  384. __be64 rx_mcast_frames;
  385. __be64 rx_ucast_bytes;
  386. __be64 rx_ucast_frames;
  387. __be64 rx_err_frames;
  388. } port_stats;
  389. struct fw_fcoe_fcf_stats {
  390. __be32 fip_tx_bytes;
  391. __be32 fip_tx_fr;
  392. __be64 fcf_ka;
  393. __be64 mcast_adv_rcvd;
  394. __be16 ucast_adv_rcvd;
  395. __be16 sol_sent;
  396. __be16 vlan_req;
  397. __be16 vlan_rpl;
  398. __be16 clr_vlink;
  399. __be16 link_down;
  400. __be16 link_up;
  401. __be16 logo;
  402. __be16 flogi_req;
  403. __be16 flogi_rpl;
  404. __be16 fdisc_req;
  405. __be16 fdisc_rpl;
  406. __be16 fka_prd_chg;
  407. __be16 fc_map_chg;
  408. __be16 vfid_chg;
  409. u8 no_fka_req;
  410. u8 no_vnp;
  411. } fcf_stats;
  412. struct fw_fcoe_pcb_stats {
  413. __be64 tx_bytes;
  414. __be64 tx_frames;
  415. __be64 rx_bytes;
  416. __be64 rx_frames;
  417. __be32 vnp_ka;
  418. __be32 unsol_els_rcvd;
  419. __be64 unsol_cmd_rcvd;
  420. __be16 implicit_logo;
  421. __be16 flogi_inv_sparm;
  422. __be16 fdisc_inv_sparm;
  423. __be16 flogi_rjt;
  424. __be16 fdisc_rjt;
  425. __be16 no_ssn;
  426. __be16 mac_flt_fail;
  427. __be16 inv_fr_rcvd;
  428. } pcb_stats;
  429. struct fw_fcoe_scb_stats {
  430. __be64 tx_bytes;
  431. __be64 tx_frames;
  432. __be64 rx_bytes;
  433. __be64 rx_frames;
  434. __be32 host_abrt_req;
  435. __be32 adap_auto_abrt;
  436. __be32 adap_abrt_rsp;
  437. __be32 host_ios_req;
  438. __be16 ssn_offl_ios;
  439. __be16 ssn_not_rdy_ios;
  440. u8 rx_data_ddp_err;
  441. u8 ddp_flt_set_err;
  442. __be16 rx_data_fr_err;
  443. u8 bad_st_abrt_req;
  444. u8 no_io_abrt_req;
  445. u8 abort_tmo;
  446. u8 abort_tmo_2;
  447. __be32 abort_req;
  448. u8 no_ppod_res_tmo;
  449. u8 bp_tmo;
  450. u8 adap_auto_cls;
  451. u8 no_io_cls_req;
  452. __be32 host_cls_req;
  453. __be64 unsol_cmd_rcvd;
  454. __be32 plogi_req_rcvd;
  455. __be32 prli_req_rcvd;
  456. __be16 logo_req_rcvd;
  457. __be16 prlo_req_rcvd;
  458. __be16 plogi_rjt_rcvd;
  459. __be16 prli_rjt_rcvd;
  460. __be32 adisc_req_rcvd;
  461. __be32 rscn_rcvd;
  462. __be32 rrq_req_rcvd;
  463. __be32 unsol_els_rcvd;
  464. u8 adisc_rjt_rcvd;
  465. u8 scr_rjt;
  466. u8 ct_rjt;
  467. u8 inval_bls_rcvd;
  468. __be32 ba_rjt_rcvd;
  469. } scb_stats;
  470. } u;
  471. };
  472. #define FW_FCOE_STATS_CMD_FLOWID(x) ((x) << 0)
  473. #define FW_FCOE_STATS_CMD_FREE (1U << 30)
  474. #define FW_FCOE_STATS_CMD_NSTATS(x) ((x) << 4)
  475. #define FW_FCOE_STATS_CMD_PORT(x) ((x) << 0)
  476. #define FW_FCOE_STATS_CMD_PORT_VALID (1U << 7)
  477. #define FW_FCOE_STATS_CMD_IX(x) ((x) << 0)
  478. struct fw_fcoe_fcf_cmd {
  479. __be32 op_to_fcfi;
  480. __be32 retval_len16;
  481. __be16 priority_pkd;
  482. u8 mac[6];
  483. u8 name_id[8];
  484. u8 fabric[8];
  485. __be16 vf_id;
  486. __be16 max_fcoe_size;
  487. u8 vlan_id;
  488. u8 fc_map[3];
  489. __be32 fka_adv;
  490. __be32 r6;
  491. u8 r7_hi;
  492. u8 fpma_to_portid;
  493. u8 spma_mac[6];
  494. __be64 r8;
  495. };
  496. #define FW_FCOE_FCF_CMD_FCFI(x) ((x) << 0)
  497. #define FW_FCOE_FCF_CMD_FCFI_GET(x) (((x) >> 0) & 0xfffff)
  498. #define FW_FCOE_FCF_CMD_PRIORITY_GET(x) (((x) >> 0) & 0xff)
  499. #define FW_FCOE_FCF_CMD_FPMA_GET(x) (((x) >> 6) & 0x1)
  500. #define FW_FCOE_FCF_CMD_SPMA_GET(x) (((x) >> 5) & 0x1)
  501. #define FW_FCOE_FCF_CMD_LOGIN_GET(x) (((x) >> 4) & 0x1)
  502. #define FW_FCOE_FCF_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  503. #endif /* _T4FW_API_STOR_H_ */