t4fw_ri_api.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. /*
  2. * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. * - Redistributions in binary form must reproduce the above
  18. * copyright notice, this list of conditions and the following
  19. * disclaimer in the documentation and/or other materials
  20. * provided with the distribution.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  26. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29. * SOFTWARE.
  30. */
  31. #ifndef _T4FW_RI_API_H_
  32. #define _T4FW_RI_API_H_
  33. #include "t4fw_api.h"
  34. enum fw_ri_wr_opcode {
  35. FW_RI_RDMA_WRITE = 0x0, /* IETF RDMAP v1.0 ... */
  36. FW_RI_READ_REQ = 0x1,
  37. FW_RI_READ_RESP = 0x2,
  38. FW_RI_SEND = 0x3,
  39. FW_RI_SEND_WITH_INV = 0x4,
  40. FW_RI_SEND_WITH_SE = 0x5,
  41. FW_RI_SEND_WITH_SE_INV = 0x6,
  42. FW_RI_TERMINATE = 0x7,
  43. FW_RI_RDMA_INIT = 0x8, /* CHELSIO RI specific ... */
  44. FW_RI_BIND_MW = 0x9,
  45. FW_RI_FAST_REGISTER = 0xa,
  46. FW_RI_LOCAL_INV = 0xb,
  47. FW_RI_QP_MODIFY = 0xc,
  48. FW_RI_BYPASS = 0xd,
  49. FW_RI_RECEIVE = 0xe,
  50. FW_RI_SGE_EC_CR_RETURN = 0xf,
  51. FW_RI_WRITE_IMMEDIATE = FW_RI_RDMA_INIT
  52. };
  53. enum fw_ri_wr_flags {
  54. FW_RI_COMPLETION_FLAG = 0x01,
  55. FW_RI_NOTIFICATION_FLAG = 0x02,
  56. FW_RI_SOLICITED_EVENT_FLAG = 0x04,
  57. FW_RI_READ_FENCE_FLAG = 0x08,
  58. FW_RI_LOCAL_FENCE_FLAG = 0x10,
  59. FW_RI_RDMA_READ_INVALIDATE = 0x20,
  60. FW_RI_RDMA_WRITE_WITH_IMMEDIATE = 0x40
  61. };
  62. enum fw_ri_mpa_attrs {
  63. FW_RI_MPA_RX_MARKER_ENABLE = 0x01,
  64. FW_RI_MPA_TX_MARKER_ENABLE = 0x02,
  65. FW_RI_MPA_CRC_ENABLE = 0x04,
  66. FW_RI_MPA_IETF_ENABLE = 0x08
  67. };
  68. enum fw_ri_qp_caps {
  69. FW_RI_QP_RDMA_READ_ENABLE = 0x01,
  70. FW_RI_QP_RDMA_WRITE_ENABLE = 0x02,
  71. FW_RI_QP_BIND_ENABLE = 0x04,
  72. FW_RI_QP_FAST_REGISTER_ENABLE = 0x08,
  73. FW_RI_QP_STAG0_ENABLE = 0x10
  74. };
  75. enum fw_ri_addr_type {
  76. FW_RI_ZERO_BASED_TO = 0x00,
  77. FW_RI_VA_BASED_TO = 0x01
  78. };
  79. enum fw_ri_mem_perms {
  80. FW_RI_MEM_ACCESS_REM_WRITE = 0x01,
  81. FW_RI_MEM_ACCESS_REM_READ = 0x02,
  82. FW_RI_MEM_ACCESS_REM = 0x03,
  83. FW_RI_MEM_ACCESS_LOCAL_WRITE = 0x04,
  84. FW_RI_MEM_ACCESS_LOCAL_READ = 0x08,
  85. FW_RI_MEM_ACCESS_LOCAL = 0x0C
  86. };
  87. enum fw_ri_stag_type {
  88. FW_RI_STAG_NSMR = 0x00,
  89. FW_RI_STAG_SMR = 0x01,
  90. FW_RI_STAG_MW = 0x02,
  91. FW_RI_STAG_MW_RELAXED = 0x03
  92. };
  93. enum fw_ri_data_op {
  94. FW_RI_DATA_IMMD = 0x81,
  95. FW_RI_DATA_DSGL = 0x82,
  96. FW_RI_DATA_ISGL = 0x83
  97. };
  98. enum fw_ri_sgl_depth {
  99. FW_RI_SGL_DEPTH_MAX_SQ = 16,
  100. FW_RI_SGL_DEPTH_MAX_RQ = 4
  101. };
  102. struct fw_ri_dsge_pair {
  103. __be32 len[2];
  104. __be64 addr[2];
  105. };
  106. struct fw_ri_dsgl {
  107. __u8 op;
  108. __u8 r1;
  109. __be16 nsge;
  110. __be32 len0;
  111. __be64 addr0;
  112. #ifndef C99_NOT_SUPPORTED
  113. struct fw_ri_dsge_pair sge[0];
  114. #endif
  115. };
  116. struct fw_ri_sge {
  117. __be32 stag;
  118. __be32 len;
  119. __be64 to;
  120. };
  121. struct fw_ri_isgl {
  122. __u8 op;
  123. __u8 r1;
  124. __be16 nsge;
  125. __be32 r2;
  126. #ifndef C99_NOT_SUPPORTED
  127. struct fw_ri_sge sge[0];
  128. #endif
  129. };
  130. struct fw_ri_immd {
  131. __u8 op;
  132. __u8 r1;
  133. __be16 r2;
  134. __be32 immdlen;
  135. #ifndef C99_NOT_SUPPORTED
  136. __u8 data[0];
  137. #endif
  138. };
  139. struct fw_ri_tpte {
  140. __be32 valid_to_pdid;
  141. __be32 locread_to_qpid;
  142. __be32 nosnoop_pbladdr;
  143. __be32 len_lo;
  144. __be32 va_hi;
  145. __be32 va_lo_fbo;
  146. __be32 dca_mwbcnt_pstag;
  147. __be32 len_hi;
  148. };
  149. #define FW_RI_TPTE_VALID_S 31
  150. #define FW_RI_TPTE_VALID_M 0x1
  151. #define FW_RI_TPTE_VALID_V(x) ((x) << FW_RI_TPTE_VALID_S)
  152. #define FW_RI_TPTE_VALID_G(x) \
  153. (((x) >> FW_RI_TPTE_VALID_S) & FW_RI_TPTE_VALID_M)
  154. #define FW_RI_TPTE_VALID_F FW_RI_TPTE_VALID_V(1U)
  155. #define FW_RI_TPTE_STAGKEY_S 23
  156. #define FW_RI_TPTE_STAGKEY_M 0xff
  157. #define FW_RI_TPTE_STAGKEY_V(x) ((x) << FW_RI_TPTE_STAGKEY_S)
  158. #define FW_RI_TPTE_STAGKEY_G(x) \
  159. (((x) >> FW_RI_TPTE_STAGKEY_S) & FW_RI_TPTE_STAGKEY_M)
  160. #define FW_RI_TPTE_STAGSTATE_S 22
  161. #define FW_RI_TPTE_STAGSTATE_M 0x1
  162. #define FW_RI_TPTE_STAGSTATE_V(x) ((x) << FW_RI_TPTE_STAGSTATE_S)
  163. #define FW_RI_TPTE_STAGSTATE_G(x) \
  164. (((x) >> FW_RI_TPTE_STAGSTATE_S) & FW_RI_TPTE_STAGSTATE_M)
  165. #define FW_RI_TPTE_STAGSTATE_F FW_RI_TPTE_STAGSTATE_V(1U)
  166. #define FW_RI_TPTE_STAGTYPE_S 20
  167. #define FW_RI_TPTE_STAGTYPE_M 0x3
  168. #define FW_RI_TPTE_STAGTYPE_V(x) ((x) << FW_RI_TPTE_STAGTYPE_S)
  169. #define FW_RI_TPTE_STAGTYPE_G(x) \
  170. (((x) >> FW_RI_TPTE_STAGTYPE_S) & FW_RI_TPTE_STAGTYPE_M)
  171. #define FW_RI_TPTE_PDID_S 0
  172. #define FW_RI_TPTE_PDID_M 0xfffff
  173. #define FW_RI_TPTE_PDID_V(x) ((x) << FW_RI_TPTE_PDID_S)
  174. #define FW_RI_TPTE_PDID_G(x) \
  175. (((x) >> FW_RI_TPTE_PDID_S) & FW_RI_TPTE_PDID_M)
  176. #define FW_RI_TPTE_PERM_S 28
  177. #define FW_RI_TPTE_PERM_M 0xf
  178. #define FW_RI_TPTE_PERM_V(x) ((x) << FW_RI_TPTE_PERM_S)
  179. #define FW_RI_TPTE_PERM_G(x) \
  180. (((x) >> FW_RI_TPTE_PERM_S) & FW_RI_TPTE_PERM_M)
  181. #define FW_RI_TPTE_REMINVDIS_S 27
  182. #define FW_RI_TPTE_REMINVDIS_M 0x1
  183. #define FW_RI_TPTE_REMINVDIS_V(x) ((x) << FW_RI_TPTE_REMINVDIS_S)
  184. #define FW_RI_TPTE_REMINVDIS_G(x) \
  185. (((x) >> FW_RI_TPTE_REMINVDIS_S) & FW_RI_TPTE_REMINVDIS_M)
  186. #define FW_RI_TPTE_REMINVDIS_F FW_RI_TPTE_REMINVDIS_V(1U)
  187. #define FW_RI_TPTE_ADDRTYPE_S 26
  188. #define FW_RI_TPTE_ADDRTYPE_M 1
  189. #define FW_RI_TPTE_ADDRTYPE_V(x) ((x) << FW_RI_TPTE_ADDRTYPE_S)
  190. #define FW_RI_TPTE_ADDRTYPE_G(x) \
  191. (((x) >> FW_RI_TPTE_ADDRTYPE_S) & FW_RI_TPTE_ADDRTYPE_M)
  192. #define FW_RI_TPTE_ADDRTYPE_F FW_RI_TPTE_ADDRTYPE_V(1U)
  193. #define FW_RI_TPTE_MWBINDEN_S 25
  194. #define FW_RI_TPTE_MWBINDEN_M 0x1
  195. #define FW_RI_TPTE_MWBINDEN_V(x) ((x) << FW_RI_TPTE_MWBINDEN_S)
  196. #define FW_RI_TPTE_MWBINDEN_G(x) \
  197. (((x) >> FW_RI_TPTE_MWBINDEN_S) & FW_RI_TPTE_MWBINDEN_M)
  198. #define FW_RI_TPTE_MWBINDEN_F FW_RI_TPTE_MWBINDEN_V(1U)
  199. #define FW_RI_TPTE_PS_S 20
  200. #define FW_RI_TPTE_PS_M 0x1f
  201. #define FW_RI_TPTE_PS_V(x) ((x) << FW_RI_TPTE_PS_S)
  202. #define FW_RI_TPTE_PS_G(x) \
  203. (((x) >> FW_RI_TPTE_PS_S) & FW_RI_TPTE_PS_M)
  204. #define FW_RI_TPTE_QPID_S 0
  205. #define FW_RI_TPTE_QPID_M 0xfffff
  206. #define FW_RI_TPTE_QPID_V(x) ((x) << FW_RI_TPTE_QPID_S)
  207. #define FW_RI_TPTE_QPID_G(x) \
  208. (((x) >> FW_RI_TPTE_QPID_S) & FW_RI_TPTE_QPID_M)
  209. #define FW_RI_TPTE_NOSNOOP_S 30
  210. #define FW_RI_TPTE_NOSNOOP_M 0x1
  211. #define FW_RI_TPTE_NOSNOOP_V(x) ((x) << FW_RI_TPTE_NOSNOOP_S)
  212. #define FW_RI_TPTE_NOSNOOP_G(x) \
  213. (((x) >> FW_RI_TPTE_NOSNOOP_S) & FW_RI_TPTE_NOSNOOP_M)
  214. #define FW_RI_TPTE_NOSNOOP_F FW_RI_TPTE_NOSNOOP_V(1U)
  215. #define FW_RI_TPTE_PBLADDR_S 0
  216. #define FW_RI_TPTE_PBLADDR_M 0x1fffffff
  217. #define FW_RI_TPTE_PBLADDR_V(x) ((x) << FW_RI_TPTE_PBLADDR_S)
  218. #define FW_RI_TPTE_PBLADDR_G(x) \
  219. (((x) >> FW_RI_TPTE_PBLADDR_S) & FW_RI_TPTE_PBLADDR_M)
  220. #define FW_RI_TPTE_DCA_S 24
  221. #define FW_RI_TPTE_DCA_M 0x1f
  222. #define FW_RI_TPTE_DCA_V(x) ((x) << FW_RI_TPTE_DCA_S)
  223. #define FW_RI_TPTE_DCA_G(x) \
  224. (((x) >> FW_RI_TPTE_DCA_S) & FW_RI_TPTE_DCA_M)
  225. #define FW_RI_TPTE_MWBCNT_PSTAG_S 0
  226. #define FW_RI_TPTE_MWBCNT_PSTAG_M 0xffffff
  227. #define FW_RI_TPTE_MWBCNT_PSTAT_V(x) \
  228. ((x) << FW_RI_TPTE_MWBCNT_PSTAG_S)
  229. #define FW_RI_TPTE_MWBCNT_PSTAG_G(x) \
  230. (((x) >> FW_RI_TPTE_MWBCNT_PSTAG_S) & FW_RI_TPTE_MWBCNT_PSTAG_M)
  231. enum fw_ri_res_type {
  232. FW_RI_RES_TYPE_SQ,
  233. FW_RI_RES_TYPE_RQ,
  234. FW_RI_RES_TYPE_CQ,
  235. FW_RI_RES_TYPE_SRQ,
  236. };
  237. enum fw_ri_res_op {
  238. FW_RI_RES_OP_WRITE,
  239. FW_RI_RES_OP_RESET,
  240. };
  241. struct fw_ri_res {
  242. union fw_ri_restype {
  243. struct fw_ri_res_sqrq {
  244. __u8 restype;
  245. __u8 op;
  246. __be16 r3;
  247. __be32 eqid;
  248. __be32 r4[2];
  249. __be32 fetchszm_to_iqid;
  250. __be32 dcaen_to_eqsize;
  251. __be64 eqaddr;
  252. } sqrq;
  253. struct fw_ri_res_cq {
  254. __u8 restype;
  255. __u8 op;
  256. __be16 r3;
  257. __be32 iqid;
  258. __be32 r4[2];
  259. __be32 iqandst_to_iqandstindex;
  260. __be16 iqdroprss_to_iqesize;
  261. __be16 iqsize;
  262. __be64 iqaddr;
  263. __be32 iqns_iqro;
  264. __be32 r6_lo;
  265. __be64 r7;
  266. } cq;
  267. struct fw_ri_res_srq {
  268. __u8 restype;
  269. __u8 op;
  270. __be16 r3;
  271. __be32 eqid;
  272. __be32 r4[2];
  273. __be32 fetchszm_to_iqid;
  274. __be32 dcaen_to_eqsize;
  275. __be64 eqaddr;
  276. __be32 srqid;
  277. __be32 pdid;
  278. __be32 hwsrqsize;
  279. __be32 hwsrqaddr;
  280. } srq;
  281. } u;
  282. };
  283. struct fw_ri_res_wr {
  284. __be32 op_nres;
  285. __be32 len16_pkd;
  286. __u64 cookie;
  287. #ifndef C99_NOT_SUPPORTED
  288. struct fw_ri_res res[0];
  289. #endif
  290. };
  291. #define FW_RI_RES_WR_NRES_S 0
  292. #define FW_RI_RES_WR_NRES_M 0xff
  293. #define FW_RI_RES_WR_NRES_V(x) ((x) << FW_RI_RES_WR_NRES_S)
  294. #define FW_RI_RES_WR_NRES_G(x) \
  295. (((x) >> FW_RI_RES_WR_NRES_S) & FW_RI_RES_WR_NRES_M)
  296. #define FW_RI_RES_WR_FETCHSZM_S 26
  297. #define FW_RI_RES_WR_FETCHSZM_M 0x1
  298. #define FW_RI_RES_WR_FETCHSZM_V(x) ((x) << FW_RI_RES_WR_FETCHSZM_S)
  299. #define FW_RI_RES_WR_FETCHSZM_G(x) \
  300. (((x) >> FW_RI_RES_WR_FETCHSZM_S) & FW_RI_RES_WR_FETCHSZM_M)
  301. #define FW_RI_RES_WR_FETCHSZM_F FW_RI_RES_WR_FETCHSZM_V(1U)
  302. #define FW_RI_RES_WR_STATUSPGNS_S 25
  303. #define FW_RI_RES_WR_STATUSPGNS_M 0x1
  304. #define FW_RI_RES_WR_STATUSPGNS_V(x) ((x) << FW_RI_RES_WR_STATUSPGNS_S)
  305. #define FW_RI_RES_WR_STATUSPGNS_G(x) \
  306. (((x) >> FW_RI_RES_WR_STATUSPGNS_S) & FW_RI_RES_WR_STATUSPGNS_M)
  307. #define FW_RI_RES_WR_STATUSPGNS_F FW_RI_RES_WR_STATUSPGNS_V(1U)
  308. #define FW_RI_RES_WR_STATUSPGRO_S 24
  309. #define FW_RI_RES_WR_STATUSPGRO_M 0x1
  310. #define FW_RI_RES_WR_STATUSPGRO_V(x) ((x) << FW_RI_RES_WR_STATUSPGRO_S)
  311. #define FW_RI_RES_WR_STATUSPGRO_G(x) \
  312. (((x) >> FW_RI_RES_WR_STATUSPGRO_S) & FW_RI_RES_WR_STATUSPGRO_M)
  313. #define FW_RI_RES_WR_STATUSPGRO_F FW_RI_RES_WR_STATUSPGRO_V(1U)
  314. #define FW_RI_RES_WR_FETCHNS_S 23
  315. #define FW_RI_RES_WR_FETCHNS_M 0x1
  316. #define FW_RI_RES_WR_FETCHNS_V(x) ((x) << FW_RI_RES_WR_FETCHNS_S)
  317. #define FW_RI_RES_WR_FETCHNS_G(x) \
  318. (((x) >> FW_RI_RES_WR_FETCHNS_S) & FW_RI_RES_WR_FETCHNS_M)
  319. #define FW_RI_RES_WR_FETCHNS_F FW_RI_RES_WR_FETCHNS_V(1U)
  320. #define FW_RI_RES_WR_FETCHRO_S 22
  321. #define FW_RI_RES_WR_FETCHRO_M 0x1
  322. #define FW_RI_RES_WR_FETCHRO_V(x) ((x) << FW_RI_RES_WR_FETCHRO_S)
  323. #define FW_RI_RES_WR_FETCHRO_G(x) \
  324. (((x) >> FW_RI_RES_WR_FETCHRO_S) & FW_RI_RES_WR_FETCHRO_M)
  325. #define FW_RI_RES_WR_FETCHRO_F FW_RI_RES_WR_FETCHRO_V(1U)
  326. #define FW_RI_RES_WR_HOSTFCMODE_S 20
  327. #define FW_RI_RES_WR_HOSTFCMODE_M 0x3
  328. #define FW_RI_RES_WR_HOSTFCMODE_V(x) ((x) << FW_RI_RES_WR_HOSTFCMODE_S)
  329. #define FW_RI_RES_WR_HOSTFCMODE_G(x) \
  330. (((x) >> FW_RI_RES_WR_HOSTFCMODE_S) & FW_RI_RES_WR_HOSTFCMODE_M)
  331. #define FW_RI_RES_WR_CPRIO_S 19
  332. #define FW_RI_RES_WR_CPRIO_M 0x1
  333. #define FW_RI_RES_WR_CPRIO_V(x) ((x) << FW_RI_RES_WR_CPRIO_S)
  334. #define FW_RI_RES_WR_CPRIO_G(x) \
  335. (((x) >> FW_RI_RES_WR_CPRIO_S) & FW_RI_RES_WR_CPRIO_M)
  336. #define FW_RI_RES_WR_CPRIO_F FW_RI_RES_WR_CPRIO_V(1U)
  337. #define FW_RI_RES_WR_ONCHIP_S 18
  338. #define FW_RI_RES_WR_ONCHIP_M 0x1
  339. #define FW_RI_RES_WR_ONCHIP_V(x) ((x) << FW_RI_RES_WR_ONCHIP_S)
  340. #define FW_RI_RES_WR_ONCHIP_G(x) \
  341. (((x) >> FW_RI_RES_WR_ONCHIP_S) & FW_RI_RES_WR_ONCHIP_M)
  342. #define FW_RI_RES_WR_ONCHIP_F FW_RI_RES_WR_ONCHIP_V(1U)
  343. #define FW_RI_RES_WR_PCIECHN_S 16
  344. #define FW_RI_RES_WR_PCIECHN_M 0x3
  345. #define FW_RI_RES_WR_PCIECHN_V(x) ((x) << FW_RI_RES_WR_PCIECHN_S)
  346. #define FW_RI_RES_WR_PCIECHN_G(x) \
  347. (((x) >> FW_RI_RES_WR_PCIECHN_S) & FW_RI_RES_WR_PCIECHN_M)
  348. #define FW_RI_RES_WR_IQID_S 0
  349. #define FW_RI_RES_WR_IQID_M 0xffff
  350. #define FW_RI_RES_WR_IQID_V(x) ((x) << FW_RI_RES_WR_IQID_S)
  351. #define FW_RI_RES_WR_IQID_G(x) \
  352. (((x) >> FW_RI_RES_WR_IQID_S) & FW_RI_RES_WR_IQID_M)
  353. #define FW_RI_RES_WR_DCAEN_S 31
  354. #define FW_RI_RES_WR_DCAEN_M 0x1
  355. #define FW_RI_RES_WR_DCAEN_V(x) ((x) << FW_RI_RES_WR_DCAEN_S)
  356. #define FW_RI_RES_WR_DCAEN_G(x) \
  357. (((x) >> FW_RI_RES_WR_DCAEN_S) & FW_RI_RES_WR_DCAEN_M)
  358. #define FW_RI_RES_WR_DCAEN_F FW_RI_RES_WR_DCAEN_V(1U)
  359. #define FW_RI_RES_WR_DCACPU_S 26
  360. #define FW_RI_RES_WR_DCACPU_M 0x1f
  361. #define FW_RI_RES_WR_DCACPU_V(x) ((x) << FW_RI_RES_WR_DCACPU_S)
  362. #define FW_RI_RES_WR_DCACPU_G(x) \
  363. (((x) >> FW_RI_RES_WR_DCACPU_S) & FW_RI_RES_WR_DCACPU_M)
  364. #define FW_RI_RES_WR_FBMIN_S 23
  365. #define FW_RI_RES_WR_FBMIN_M 0x7
  366. #define FW_RI_RES_WR_FBMIN_V(x) ((x) << FW_RI_RES_WR_FBMIN_S)
  367. #define FW_RI_RES_WR_FBMIN_G(x) \
  368. (((x) >> FW_RI_RES_WR_FBMIN_S) & FW_RI_RES_WR_FBMIN_M)
  369. #define FW_RI_RES_WR_FBMAX_S 20
  370. #define FW_RI_RES_WR_FBMAX_M 0x7
  371. #define FW_RI_RES_WR_FBMAX_V(x) ((x) << FW_RI_RES_WR_FBMAX_S)
  372. #define FW_RI_RES_WR_FBMAX_G(x) \
  373. (((x) >> FW_RI_RES_WR_FBMAX_S) & FW_RI_RES_WR_FBMAX_M)
  374. #define FW_RI_RES_WR_CIDXFTHRESHO_S 19
  375. #define FW_RI_RES_WR_CIDXFTHRESHO_M 0x1
  376. #define FW_RI_RES_WR_CIDXFTHRESHO_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESHO_S)
  377. #define FW_RI_RES_WR_CIDXFTHRESHO_G(x) \
  378. (((x) >> FW_RI_RES_WR_CIDXFTHRESHO_S) & FW_RI_RES_WR_CIDXFTHRESHO_M)
  379. #define FW_RI_RES_WR_CIDXFTHRESHO_F FW_RI_RES_WR_CIDXFTHRESHO_V(1U)
  380. #define FW_RI_RES_WR_CIDXFTHRESH_S 16
  381. #define FW_RI_RES_WR_CIDXFTHRESH_M 0x7
  382. #define FW_RI_RES_WR_CIDXFTHRESH_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESH_S)
  383. #define FW_RI_RES_WR_CIDXFTHRESH_G(x) \
  384. (((x) >> FW_RI_RES_WR_CIDXFTHRESH_S) & FW_RI_RES_WR_CIDXFTHRESH_M)
  385. #define FW_RI_RES_WR_EQSIZE_S 0
  386. #define FW_RI_RES_WR_EQSIZE_M 0xffff
  387. #define FW_RI_RES_WR_EQSIZE_V(x) ((x) << FW_RI_RES_WR_EQSIZE_S)
  388. #define FW_RI_RES_WR_EQSIZE_G(x) \
  389. (((x) >> FW_RI_RES_WR_EQSIZE_S) & FW_RI_RES_WR_EQSIZE_M)
  390. #define FW_RI_RES_WR_IQANDST_S 15
  391. #define FW_RI_RES_WR_IQANDST_M 0x1
  392. #define FW_RI_RES_WR_IQANDST_V(x) ((x) << FW_RI_RES_WR_IQANDST_S)
  393. #define FW_RI_RES_WR_IQANDST_G(x) \
  394. (((x) >> FW_RI_RES_WR_IQANDST_S) & FW_RI_RES_WR_IQANDST_M)
  395. #define FW_RI_RES_WR_IQANDST_F FW_RI_RES_WR_IQANDST_V(1U)
  396. #define FW_RI_RES_WR_IQANUS_S 14
  397. #define FW_RI_RES_WR_IQANUS_M 0x1
  398. #define FW_RI_RES_WR_IQANUS_V(x) ((x) << FW_RI_RES_WR_IQANUS_S)
  399. #define FW_RI_RES_WR_IQANUS_G(x) \
  400. (((x) >> FW_RI_RES_WR_IQANUS_S) & FW_RI_RES_WR_IQANUS_M)
  401. #define FW_RI_RES_WR_IQANUS_F FW_RI_RES_WR_IQANUS_V(1U)
  402. #define FW_RI_RES_WR_IQANUD_S 12
  403. #define FW_RI_RES_WR_IQANUD_M 0x3
  404. #define FW_RI_RES_WR_IQANUD_V(x) ((x) << FW_RI_RES_WR_IQANUD_S)
  405. #define FW_RI_RES_WR_IQANUD_G(x) \
  406. (((x) >> FW_RI_RES_WR_IQANUD_S) & FW_RI_RES_WR_IQANUD_M)
  407. #define FW_RI_RES_WR_IQANDSTINDEX_S 0
  408. #define FW_RI_RES_WR_IQANDSTINDEX_M 0xfff
  409. #define FW_RI_RES_WR_IQANDSTINDEX_V(x) ((x) << FW_RI_RES_WR_IQANDSTINDEX_S)
  410. #define FW_RI_RES_WR_IQANDSTINDEX_G(x) \
  411. (((x) >> FW_RI_RES_WR_IQANDSTINDEX_S) & FW_RI_RES_WR_IQANDSTINDEX_M)
  412. #define FW_RI_RES_WR_IQDROPRSS_S 15
  413. #define FW_RI_RES_WR_IQDROPRSS_M 0x1
  414. #define FW_RI_RES_WR_IQDROPRSS_V(x) ((x) << FW_RI_RES_WR_IQDROPRSS_S)
  415. #define FW_RI_RES_WR_IQDROPRSS_G(x) \
  416. (((x) >> FW_RI_RES_WR_IQDROPRSS_S) & FW_RI_RES_WR_IQDROPRSS_M)
  417. #define FW_RI_RES_WR_IQDROPRSS_F FW_RI_RES_WR_IQDROPRSS_V(1U)
  418. #define FW_RI_RES_WR_IQGTSMODE_S 14
  419. #define FW_RI_RES_WR_IQGTSMODE_M 0x1
  420. #define FW_RI_RES_WR_IQGTSMODE_V(x) ((x) << FW_RI_RES_WR_IQGTSMODE_S)
  421. #define FW_RI_RES_WR_IQGTSMODE_G(x) \
  422. (((x) >> FW_RI_RES_WR_IQGTSMODE_S) & FW_RI_RES_WR_IQGTSMODE_M)
  423. #define FW_RI_RES_WR_IQGTSMODE_F FW_RI_RES_WR_IQGTSMODE_V(1U)
  424. #define FW_RI_RES_WR_IQPCIECH_S 12
  425. #define FW_RI_RES_WR_IQPCIECH_M 0x3
  426. #define FW_RI_RES_WR_IQPCIECH_V(x) ((x) << FW_RI_RES_WR_IQPCIECH_S)
  427. #define FW_RI_RES_WR_IQPCIECH_G(x) \
  428. (((x) >> FW_RI_RES_WR_IQPCIECH_S) & FW_RI_RES_WR_IQPCIECH_M)
  429. #define FW_RI_RES_WR_IQDCAEN_S 11
  430. #define FW_RI_RES_WR_IQDCAEN_M 0x1
  431. #define FW_RI_RES_WR_IQDCAEN_V(x) ((x) << FW_RI_RES_WR_IQDCAEN_S)
  432. #define FW_RI_RES_WR_IQDCAEN_G(x) \
  433. (((x) >> FW_RI_RES_WR_IQDCAEN_S) & FW_RI_RES_WR_IQDCAEN_M)
  434. #define FW_RI_RES_WR_IQDCAEN_F FW_RI_RES_WR_IQDCAEN_V(1U)
  435. #define FW_RI_RES_WR_IQDCACPU_S 6
  436. #define FW_RI_RES_WR_IQDCACPU_M 0x1f
  437. #define FW_RI_RES_WR_IQDCACPU_V(x) ((x) << FW_RI_RES_WR_IQDCACPU_S)
  438. #define FW_RI_RES_WR_IQDCACPU_G(x) \
  439. (((x) >> FW_RI_RES_WR_IQDCACPU_S) & FW_RI_RES_WR_IQDCACPU_M)
  440. #define FW_RI_RES_WR_IQINTCNTTHRESH_S 4
  441. #define FW_RI_RES_WR_IQINTCNTTHRESH_M 0x3
  442. #define FW_RI_RES_WR_IQINTCNTTHRESH_V(x) \
  443. ((x) << FW_RI_RES_WR_IQINTCNTTHRESH_S)
  444. #define FW_RI_RES_WR_IQINTCNTTHRESH_G(x) \
  445. (((x) >> FW_RI_RES_WR_IQINTCNTTHRESH_S) & FW_RI_RES_WR_IQINTCNTTHRESH_M)
  446. #define FW_RI_RES_WR_IQO_S 3
  447. #define FW_RI_RES_WR_IQO_M 0x1
  448. #define FW_RI_RES_WR_IQO_V(x) ((x) << FW_RI_RES_WR_IQO_S)
  449. #define FW_RI_RES_WR_IQO_G(x) \
  450. (((x) >> FW_RI_RES_WR_IQO_S) & FW_RI_RES_WR_IQO_M)
  451. #define FW_RI_RES_WR_IQO_F FW_RI_RES_WR_IQO_V(1U)
  452. #define FW_RI_RES_WR_IQCPRIO_S 2
  453. #define FW_RI_RES_WR_IQCPRIO_M 0x1
  454. #define FW_RI_RES_WR_IQCPRIO_V(x) ((x) << FW_RI_RES_WR_IQCPRIO_S)
  455. #define FW_RI_RES_WR_IQCPRIO_G(x) \
  456. (((x) >> FW_RI_RES_WR_IQCPRIO_S) & FW_RI_RES_WR_IQCPRIO_M)
  457. #define FW_RI_RES_WR_IQCPRIO_F FW_RI_RES_WR_IQCPRIO_V(1U)
  458. #define FW_RI_RES_WR_IQESIZE_S 0
  459. #define FW_RI_RES_WR_IQESIZE_M 0x3
  460. #define FW_RI_RES_WR_IQESIZE_V(x) ((x) << FW_RI_RES_WR_IQESIZE_S)
  461. #define FW_RI_RES_WR_IQESIZE_G(x) \
  462. (((x) >> FW_RI_RES_WR_IQESIZE_S) & FW_RI_RES_WR_IQESIZE_M)
  463. #define FW_RI_RES_WR_IQNS_S 31
  464. #define FW_RI_RES_WR_IQNS_M 0x1
  465. #define FW_RI_RES_WR_IQNS_V(x) ((x) << FW_RI_RES_WR_IQNS_S)
  466. #define FW_RI_RES_WR_IQNS_G(x) \
  467. (((x) >> FW_RI_RES_WR_IQNS_S) & FW_RI_RES_WR_IQNS_M)
  468. #define FW_RI_RES_WR_IQNS_F FW_RI_RES_WR_IQNS_V(1U)
  469. #define FW_RI_RES_WR_IQRO_S 30
  470. #define FW_RI_RES_WR_IQRO_M 0x1
  471. #define FW_RI_RES_WR_IQRO_V(x) ((x) << FW_RI_RES_WR_IQRO_S)
  472. #define FW_RI_RES_WR_IQRO_G(x) \
  473. (((x) >> FW_RI_RES_WR_IQRO_S) & FW_RI_RES_WR_IQRO_M)
  474. #define FW_RI_RES_WR_IQRO_F FW_RI_RES_WR_IQRO_V(1U)
  475. struct fw_ri_rdma_write_wr {
  476. __u8 opcode;
  477. __u8 flags;
  478. __u16 wrid;
  479. __u8 r1[3];
  480. __u8 len16;
  481. /*
  482. * Use union for immediate data to be consistent with stack's 32 bit
  483. * data and iWARP spec's 64 bit data.
  484. */
  485. union {
  486. struct {
  487. __be32 imm_data32;
  488. u32 reserved;
  489. } ib_imm_data;
  490. __be64 imm_data64;
  491. } iw_imm_data;
  492. __be32 plen;
  493. __be32 stag_sink;
  494. __be64 to_sink;
  495. #ifndef C99_NOT_SUPPORTED
  496. union {
  497. struct fw_ri_immd immd_src[0];
  498. struct fw_ri_isgl isgl_src[0];
  499. } u;
  500. #endif
  501. };
  502. struct fw_ri_send_wr {
  503. __u8 opcode;
  504. __u8 flags;
  505. __u16 wrid;
  506. __u8 r1[3];
  507. __u8 len16;
  508. __be32 sendop_pkd;
  509. __be32 stag_inv;
  510. __be32 plen;
  511. __be32 r3;
  512. __be64 r4;
  513. #ifndef C99_NOT_SUPPORTED
  514. union {
  515. struct fw_ri_immd immd_src[0];
  516. struct fw_ri_isgl isgl_src[0];
  517. } u;
  518. #endif
  519. };
  520. #define FW_RI_SEND_WR_SENDOP_S 0
  521. #define FW_RI_SEND_WR_SENDOP_M 0xf
  522. #define FW_RI_SEND_WR_SENDOP_V(x) ((x) << FW_RI_SEND_WR_SENDOP_S)
  523. #define FW_RI_SEND_WR_SENDOP_G(x) \
  524. (((x) >> FW_RI_SEND_WR_SENDOP_S) & FW_RI_SEND_WR_SENDOP_M)
  525. struct fw_ri_rdma_write_cmpl_wr {
  526. __u8 opcode;
  527. __u8 flags;
  528. __u16 wrid;
  529. __u8 r1[3];
  530. __u8 len16;
  531. __u8 r2;
  532. __u8 flags_send;
  533. __u16 wrid_send;
  534. __be32 stag_inv;
  535. __be32 plen;
  536. __be32 stag_sink;
  537. __be64 to_sink;
  538. union fw_ri_cmpl {
  539. struct fw_ri_immd_cmpl {
  540. __u8 op;
  541. __u8 r1[6];
  542. __u8 immdlen;
  543. __u8 data[16];
  544. } immd_src;
  545. struct fw_ri_isgl isgl_src;
  546. } u_cmpl;
  547. __be64 r3;
  548. #ifndef C99_NOT_SUPPORTED
  549. union fw_ri_write {
  550. struct fw_ri_immd immd_src[0];
  551. struct fw_ri_isgl isgl_src[0];
  552. } u;
  553. #endif
  554. };
  555. struct fw_ri_rdma_read_wr {
  556. __u8 opcode;
  557. __u8 flags;
  558. __u16 wrid;
  559. __u8 r1[3];
  560. __u8 len16;
  561. __be64 r2;
  562. __be32 stag_sink;
  563. __be32 to_sink_hi;
  564. __be32 to_sink_lo;
  565. __be32 plen;
  566. __be32 stag_src;
  567. __be32 to_src_hi;
  568. __be32 to_src_lo;
  569. __be32 r5;
  570. };
  571. struct fw_ri_recv_wr {
  572. __u8 opcode;
  573. __u8 r1;
  574. __u16 wrid;
  575. __u8 r2[3];
  576. __u8 len16;
  577. struct fw_ri_isgl isgl;
  578. };
  579. struct fw_ri_bind_mw_wr {
  580. __u8 opcode;
  581. __u8 flags;
  582. __u16 wrid;
  583. __u8 r1[3];
  584. __u8 len16;
  585. __u8 qpbinde_to_dcacpu;
  586. __u8 pgsz_shift;
  587. __u8 addr_type;
  588. __u8 mem_perms;
  589. __be32 stag_mr;
  590. __be32 stag_mw;
  591. __be32 r3;
  592. __be64 len_mw;
  593. __be64 va_fbo;
  594. __be64 r4;
  595. };
  596. #define FW_RI_BIND_MW_WR_QPBINDE_S 6
  597. #define FW_RI_BIND_MW_WR_QPBINDE_M 0x1
  598. #define FW_RI_BIND_MW_WR_QPBINDE_V(x) ((x) << FW_RI_BIND_MW_WR_QPBINDE_S)
  599. #define FW_RI_BIND_MW_WR_QPBINDE_G(x) \
  600. (((x) >> FW_RI_BIND_MW_WR_QPBINDE_S) & FW_RI_BIND_MW_WR_QPBINDE_M)
  601. #define FW_RI_BIND_MW_WR_QPBINDE_F FW_RI_BIND_MW_WR_QPBINDE_V(1U)
  602. #define FW_RI_BIND_MW_WR_NS_S 5
  603. #define FW_RI_BIND_MW_WR_NS_M 0x1
  604. #define FW_RI_BIND_MW_WR_NS_V(x) ((x) << FW_RI_BIND_MW_WR_NS_S)
  605. #define FW_RI_BIND_MW_WR_NS_G(x) \
  606. (((x) >> FW_RI_BIND_MW_WR_NS_S) & FW_RI_BIND_MW_WR_NS_M)
  607. #define FW_RI_BIND_MW_WR_NS_F FW_RI_BIND_MW_WR_NS_V(1U)
  608. #define FW_RI_BIND_MW_WR_DCACPU_S 0
  609. #define FW_RI_BIND_MW_WR_DCACPU_M 0x1f
  610. #define FW_RI_BIND_MW_WR_DCACPU_V(x) ((x) << FW_RI_BIND_MW_WR_DCACPU_S)
  611. #define FW_RI_BIND_MW_WR_DCACPU_G(x) \
  612. (((x) >> FW_RI_BIND_MW_WR_DCACPU_S) & FW_RI_BIND_MW_WR_DCACPU_M)
  613. struct fw_ri_fr_nsmr_wr {
  614. __u8 opcode;
  615. __u8 flags;
  616. __u16 wrid;
  617. __u8 r1[3];
  618. __u8 len16;
  619. __u8 qpbinde_to_dcacpu;
  620. __u8 pgsz_shift;
  621. __u8 addr_type;
  622. __u8 mem_perms;
  623. __be32 stag;
  624. __be32 len_hi;
  625. __be32 len_lo;
  626. __be32 va_hi;
  627. __be32 va_lo_fbo;
  628. };
  629. #define FW_RI_FR_NSMR_WR_QPBINDE_S 6
  630. #define FW_RI_FR_NSMR_WR_QPBINDE_M 0x1
  631. #define FW_RI_FR_NSMR_WR_QPBINDE_V(x) ((x) << FW_RI_FR_NSMR_WR_QPBINDE_S)
  632. #define FW_RI_FR_NSMR_WR_QPBINDE_G(x) \
  633. (((x) >> FW_RI_FR_NSMR_WR_QPBINDE_S) & FW_RI_FR_NSMR_WR_QPBINDE_M)
  634. #define FW_RI_FR_NSMR_WR_QPBINDE_F FW_RI_FR_NSMR_WR_QPBINDE_V(1U)
  635. #define FW_RI_FR_NSMR_WR_NS_S 5
  636. #define FW_RI_FR_NSMR_WR_NS_M 0x1
  637. #define FW_RI_FR_NSMR_WR_NS_V(x) ((x) << FW_RI_FR_NSMR_WR_NS_S)
  638. #define FW_RI_FR_NSMR_WR_NS_G(x) \
  639. (((x) >> FW_RI_FR_NSMR_WR_NS_S) & FW_RI_FR_NSMR_WR_NS_M)
  640. #define FW_RI_FR_NSMR_WR_NS_F FW_RI_FR_NSMR_WR_NS_V(1U)
  641. #define FW_RI_FR_NSMR_WR_DCACPU_S 0
  642. #define FW_RI_FR_NSMR_WR_DCACPU_M 0x1f
  643. #define FW_RI_FR_NSMR_WR_DCACPU_V(x) ((x) << FW_RI_FR_NSMR_WR_DCACPU_S)
  644. #define FW_RI_FR_NSMR_WR_DCACPU_G(x) \
  645. (((x) >> FW_RI_FR_NSMR_WR_DCACPU_S) & FW_RI_FR_NSMR_WR_DCACPU_M)
  646. struct fw_ri_fr_nsmr_tpte_wr {
  647. __u8 opcode;
  648. __u8 flags;
  649. __u16 wrid;
  650. __u8 r1[3];
  651. __u8 len16;
  652. __be32 r2;
  653. __be32 stag;
  654. struct fw_ri_tpte tpte;
  655. __u64 pbl[2];
  656. };
  657. struct fw_ri_inv_lstag_wr {
  658. __u8 opcode;
  659. __u8 flags;
  660. __u16 wrid;
  661. __u8 r1[3];
  662. __u8 len16;
  663. __be32 r2;
  664. __be32 stag_inv;
  665. };
  666. enum fw_ri_type {
  667. FW_RI_TYPE_INIT,
  668. FW_RI_TYPE_FINI,
  669. FW_RI_TYPE_TERMINATE
  670. };
  671. enum fw_ri_init_p2ptype {
  672. FW_RI_INIT_P2PTYPE_RDMA_WRITE = FW_RI_RDMA_WRITE,
  673. FW_RI_INIT_P2PTYPE_READ_REQ = FW_RI_READ_REQ,
  674. FW_RI_INIT_P2PTYPE_SEND = FW_RI_SEND,
  675. FW_RI_INIT_P2PTYPE_SEND_WITH_INV = FW_RI_SEND_WITH_INV,
  676. FW_RI_INIT_P2PTYPE_SEND_WITH_SE = FW_RI_SEND_WITH_SE,
  677. FW_RI_INIT_P2PTYPE_SEND_WITH_SE_INV = FW_RI_SEND_WITH_SE_INV,
  678. FW_RI_INIT_P2PTYPE_DISABLED = 0xf,
  679. };
  680. enum fw_ri_init_rqeqid_srq {
  681. FW_RI_INIT_RQEQID_SRQ = 1 << 31,
  682. };
  683. struct fw_ri_wr {
  684. __be32 op_compl;
  685. __be32 flowid_len16;
  686. __u64 cookie;
  687. union fw_ri {
  688. struct fw_ri_init {
  689. __u8 type;
  690. __u8 mpareqbit_p2ptype;
  691. __u8 r4[2];
  692. __u8 mpa_attrs;
  693. __u8 qp_caps;
  694. __be16 nrqe;
  695. __be32 pdid;
  696. __be32 qpid;
  697. __be32 sq_eqid;
  698. __be32 rq_eqid;
  699. __be32 scqid;
  700. __be32 rcqid;
  701. __be32 ord_max;
  702. __be32 ird_max;
  703. __be32 iss;
  704. __be32 irs;
  705. __be32 hwrqsize;
  706. __be32 hwrqaddr;
  707. __be64 r5;
  708. union fw_ri_init_p2p {
  709. struct fw_ri_rdma_write_wr write;
  710. struct fw_ri_rdma_read_wr read;
  711. struct fw_ri_send_wr send;
  712. } u;
  713. } init;
  714. struct fw_ri_fini {
  715. __u8 type;
  716. __u8 r3[7];
  717. __be64 r4;
  718. } fini;
  719. struct fw_ri_terminate {
  720. __u8 type;
  721. __u8 r3[3];
  722. __be32 immdlen;
  723. __u8 termmsg[40];
  724. } terminate;
  725. } u;
  726. };
  727. #define FW_RI_WR_MPAREQBIT_S 7
  728. #define FW_RI_WR_MPAREQBIT_M 0x1
  729. #define FW_RI_WR_MPAREQBIT_V(x) ((x) << FW_RI_WR_MPAREQBIT_S)
  730. #define FW_RI_WR_MPAREQBIT_G(x) \
  731. (((x) >> FW_RI_WR_MPAREQBIT_S) & FW_RI_WR_MPAREQBIT_M)
  732. #define FW_RI_WR_MPAREQBIT_F FW_RI_WR_MPAREQBIT_V(1U)
  733. #define FW_RI_WR_P2PTYPE_S 0
  734. #define FW_RI_WR_P2PTYPE_M 0xf
  735. #define FW_RI_WR_P2PTYPE_V(x) ((x) << FW_RI_WR_P2PTYPE_S)
  736. #define FW_RI_WR_P2PTYPE_G(x) \
  737. (((x) >> FW_RI_WR_P2PTYPE_S) & FW_RI_WR_P2PTYPE_M)
  738. #endif /* _T4FW_RI_API_H_ */