device.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. /*
  2. * Copyright (c) 2013, Mellanox Technologies 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. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef MLX5_DEVICE_H
  33. #define MLX5_DEVICE_H
  34. #include <linux/types.h>
  35. #include <rdma/ib_verbs.h>
  36. #if defined(__LITTLE_ENDIAN)
  37. #define MLX5_SET_HOST_ENDIANNESS 0
  38. #elif defined(__BIG_ENDIAN)
  39. #define MLX5_SET_HOST_ENDIANNESS 0x80
  40. #else
  41. #error Host endianness not defined
  42. #endif
  43. /* helper macros */
  44. #define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
  45. #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
  46. #define __mlx5_bit_off(typ, fld) ((unsigned)(unsigned long)(&(__mlx5_nullp(typ)->fld)))
  47. #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
  48. #define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
  49. #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
  50. #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
  51. #define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
  52. #define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
  53. #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
  54. #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
  55. #define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
  56. #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
  57. #define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
  58. /* insert a value to a struct */
  59. #define MLX5_SET(typ, p, fld, v) do { \
  60. BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
  61. *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
  62. cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
  63. (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
  64. << __mlx5_dw_bit_off(typ, fld))); \
  65. } while (0)
  66. #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
  67. __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
  68. __mlx5_mask(typ, fld))
  69. #define MLX5_GET_PR(typ, p, fld) ({ \
  70. u32 ___t = MLX5_GET(typ, p, fld); \
  71. pr_debug(#fld " = 0x%x\n", ___t); \
  72. ___t; \
  73. })
  74. #define MLX5_SET64(typ, p, fld, v) do { \
  75. BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
  76. BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
  77. *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
  78. } while (0)
  79. #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
  80. enum {
  81. MLX5_MAX_COMMANDS = 32,
  82. MLX5_CMD_DATA_BLOCK_SIZE = 512,
  83. MLX5_PCI_CMD_XPORT = 7,
  84. MLX5_MKEY_BSF_OCTO_SIZE = 4,
  85. MLX5_MAX_PSVS = 4,
  86. };
  87. enum {
  88. MLX5_EXTENDED_UD_AV = 0x80000000,
  89. };
  90. enum {
  91. MLX5_CQ_STATE_ARMED = 9,
  92. MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
  93. MLX5_CQ_STATE_FIRED = 0xa,
  94. };
  95. enum {
  96. MLX5_STAT_RATE_OFFSET = 5,
  97. };
  98. enum {
  99. MLX5_INLINE_SEG = 0x80000000,
  100. };
  101. enum {
  102. MLX5_MIN_PKEY_TABLE_SIZE = 128,
  103. MLX5_MAX_LOG_PKEY_TABLE = 5,
  104. };
  105. enum {
  106. MLX5_PERM_LOCAL_READ = 1 << 2,
  107. MLX5_PERM_LOCAL_WRITE = 1 << 3,
  108. MLX5_PERM_REMOTE_READ = 1 << 4,
  109. MLX5_PERM_REMOTE_WRITE = 1 << 5,
  110. MLX5_PERM_ATOMIC = 1 << 6,
  111. MLX5_PERM_UMR_EN = 1 << 7,
  112. };
  113. enum {
  114. MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
  115. MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
  116. MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
  117. MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
  118. MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
  119. };
  120. enum {
  121. MLX5_ACCESS_MODE_PA = 0,
  122. MLX5_ACCESS_MODE_MTT = 1,
  123. MLX5_ACCESS_MODE_KLM = 2
  124. };
  125. enum {
  126. MLX5_MKEY_REMOTE_INVAL = 1 << 24,
  127. MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
  128. MLX5_MKEY_BSF_EN = 1 << 30,
  129. MLX5_MKEY_LEN64 = 1 << 31,
  130. };
  131. enum {
  132. MLX5_EN_RD = (u64)1,
  133. MLX5_EN_WR = (u64)2
  134. };
  135. enum {
  136. MLX5_BF_REGS_PER_PAGE = 4,
  137. MLX5_MAX_UAR_PAGES = 1 << 8,
  138. MLX5_NON_FP_BF_REGS_PER_PAGE = 2,
  139. MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_NON_FP_BF_REGS_PER_PAGE,
  140. };
  141. enum {
  142. MLX5_MKEY_MASK_LEN = 1ull << 0,
  143. MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
  144. MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
  145. MLX5_MKEY_MASK_PD = 1ull << 7,
  146. MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
  147. MLX5_MKEY_MASK_EN_SIGERR = 1ull << 9,
  148. MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
  149. MLX5_MKEY_MASK_KEY = 1ull << 13,
  150. MLX5_MKEY_MASK_QPN = 1ull << 14,
  151. MLX5_MKEY_MASK_LR = 1ull << 17,
  152. MLX5_MKEY_MASK_LW = 1ull << 18,
  153. MLX5_MKEY_MASK_RR = 1ull << 19,
  154. MLX5_MKEY_MASK_RW = 1ull << 20,
  155. MLX5_MKEY_MASK_A = 1ull << 21,
  156. MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
  157. MLX5_MKEY_MASK_FREE = 1ull << 29,
  158. };
  159. enum mlx5_event {
  160. MLX5_EVENT_TYPE_COMP = 0x0,
  161. MLX5_EVENT_TYPE_PATH_MIG = 0x01,
  162. MLX5_EVENT_TYPE_COMM_EST = 0x02,
  163. MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
  164. MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
  165. MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
  166. MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
  167. MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
  168. MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
  169. MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
  170. MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
  171. MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
  172. MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
  173. MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
  174. MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
  175. MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
  176. MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
  177. MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
  178. MLX5_EVENT_TYPE_CMD = 0x0a,
  179. MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
  180. };
  181. enum {
  182. MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
  183. MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
  184. MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
  185. MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
  186. MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
  187. MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
  188. MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
  189. };
  190. enum {
  191. MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
  192. MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
  193. MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
  194. MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
  195. MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
  196. MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
  197. MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
  198. MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
  199. MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
  200. MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23,
  201. MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
  202. MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
  203. MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
  204. MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
  205. MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
  206. MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
  207. MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
  208. MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
  209. MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
  210. };
  211. enum {
  212. MLX5_OPCODE_NOP = 0x00,
  213. MLX5_OPCODE_SEND_INVAL = 0x01,
  214. MLX5_OPCODE_RDMA_WRITE = 0x08,
  215. MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
  216. MLX5_OPCODE_SEND = 0x0a,
  217. MLX5_OPCODE_SEND_IMM = 0x0b,
  218. MLX5_OPCODE_RDMA_READ = 0x10,
  219. MLX5_OPCODE_ATOMIC_CS = 0x11,
  220. MLX5_OPCODE_ATOMIC_FA = 0x12,
  221. MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
  222. MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
  223. MLX5_OPCODE_BIND_MW = 0x18,
  224. MLX5_OPCODE_CONFIG_CMD = 0x1f,
  225. MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
  226. MLX5_RECV_OPCODE_SEND = 0x01,
  227. MLX5_RECV_OPCODE_SEND_IMM = 0x02,
  228. MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
  229. MLX5_CQE_OPCODE_ERROR = 0x1e,
  230. MLX5_CQE_OPCODE_RESIZE = 0x16,
  231. MLX5_OPCODE_SET_PSV = 0x20,
  232. MLX5_OPCODE_GET_PSV = 0x21,
  233. MLX5_OPCODE_CHECK_PSV = 0x22,
  234. MLX5_OPCODE_RGET_PSV = 0x26,
  235. MLX5_OPCODE_RCHECK_PSV = 0x27,
  236. MLX5_OPCODE_UMR = 0x25,
  237. };
  238. enum {
  239. MLX5_SET_PORT_RESET_QKEY = 0,
  240. MLX5_SET_PORT_GUID0 = 16,
  241. MLX5_SET_PORT_NODE_GUID = 17,
  242. MLX5_SET_PORT_SYS_GUID = 18,
  243. MLX5_SET_PORT_GID_TABLE = 19,
  244. MLX5_SET_PORT_PKEY_TABLE = 20,
  245. };
  246. enum {
  247. MLX5_MAX_PAGE_SHIFT = 31
  248. };
  249. enum {
  250. MLX5_ADAPTER_PAGE_SHIFT = 12,
  251. MLX5_ADAPTER_PAGE_SIZE = 1 << MLX5_ADAPTER_PAGE_SHIFT,
  252. };
  253. enum {
  254. MLX5_CAP_OFF_CMDIF_CSUM = 46,
  255. };
  256. enum {
  257. HCA_CAP_OPMOD_GET_MAX = 0,
  258. HCA_CAP_OPMOD_GET_CUR = 1,
  259. };
  260. struct mlx5_inbox_hdr {
  261. __be16 opcode;
  262. u8 rsvd[4];
  263. __be16 opmod;
  264. };
  265. struct mlx5_outbox_hdr {
  266. u8 status;
  267. u8 rsvd[3];
  268. __be32 syndrome;
  269. };
  270. struct mlx5_cmd_query_adapter_mbox_in {
  271. struct mlx5_inbox_hdr hdr;
  272. u8 rsvd[8];
  273. };
  274. struct mlx5_cmd_query_adapter_mbox_out {
  275. struct mlx5_outbox_hdr hdr;
  276. u8 rsvd0[24];
  277. u8 intapin;
  278. u8 rsvd1[13];
  279. __be16 vsd_vendor_id;
  280. u8 vsd[208];
  281. u8 vsd_psid[16];
  282. };
  283. struct mlx5_cmd_init_hca_mbox_in {
  284. struct mlx5_inbox_hdr hdr;
  285. u8 rsvd0[2];
  286. __be16 profile;
  287. u8 rsvd1[4];
  288. };
  289. struct mlx5_cmd_init_hca_mbox_out {
  290. struct mlx5_outbox_hdr hdr;
  291. u8 rsvd[8];
  292. };
  293. struct mlx5_cmd_teardown_hca_mbox_in {
  294. struct mlx5_inbox_hdr hdr;
  295. u8 rsvd0[2];
  296. __be16 profile;
  297. u8 rsvd1[4];
  298. };
  299. struct mlx5_cmd_teardown_hca_mbox_out {
  300. struct mlx5_outbox_hdr hdr;
  301. u8 rsvd[8];
  302. };
  303. struct mlx5_cmd_layout {
  304. u8 type;
  305. u8 rsvd0[3];
  306. __be32 inlen;
  307. __be64 in_ptr;
  308. __be32 in[4];
  309. __be32 out[4];
  310. __be64 out_ptr;
  311. __be32 outlen;
  312. u8 token;
  313. u8 sig;
  314. u8 rsvd1;
  315. u8 status_own;
  316. };
  317. struct health_buffer {
  318. __be32 assert_var[5];
  319. __be32 rsvd0[3];
  320. __be32 assert_exit_ptr;
  321. __be32 assert_callra;
  322. __be32 rsvd1[2];
  323. __be32 fw_ver;
  324. __be32 hw_id;
  325. __be32 rsvd2;
  326. u8 irisc_index;
  327. u8 synd;
  328. __be16 ext_sync;
  329. };
  330. struct mlx5_init_seg {
  331. __be32 fw_rev;
  332. __be32 cmdif_rev_fw_sub;
  333. __be32 rsvd0[2];
  334. __be32 cmdq_addr_h;
  335. __be32 cmdq_addr_l_sz;
  336. __be32 cmd_dbell;
  337. __be32 rsvd1[121];
  338. struct health_buffer health;
  339. __be32 rsvd2[884];
  340. __be32 health_counter;
  341. __be32 rsvd3[1019];
  342. __be64 ieee1588_clk;
  343. __be32 ieee1588_clk_type;
  344. __be32 clr_intx;
  345. };
  346. struct mlx5_eqe_comp {
  347. __be32 reserved[6];
  348. __be32 cqn;
  349. };
  350. struct mlx5_eqe_qp_srq {
  351. __be32 reserved[6];
  352. __be32 qp_srq_n;
  353. };
  354. struct mlx5_eqe_cq_err {
  355. __be32 cqn;
  356. u8 reserved1[7];
  357. u8 syndrome;
  358. };
  359. struct mlx5_eqe_port_state {
  360. u8 reserved0[8];
  361. u8 port;
  362. };
  363. struct mlx5_eqe_gpio {
  364. __be32 reserved0[2];
  365. __be64 gpio_event;
  366. };
  367. struct mlx5_eqe_congestion {
  368. u8 type;
  369. u8 rsvd0;
  370. u8 congestion_level;
  371. };
  372. struct mlx5_eqe_stall_vl {
  373. u8 rsvd0[3];
  374. u8 port_vl;
  375. };
  376. struct mlx5_eqe_cmd {
  377. __be32 vector;
  378. __be32 rsvd[6];
  379. };
  380. struct mlx5_eqe_page_req {
  381. u8 rsvd0[2];
  382. __be16 func_id;
  383. __be32 num_pages;
  384. __be32 rsvd1[5];
  385. };
  386. union ev_data {
  387. __be32 raw[7];
  388. struct mlx5_eqe_cmd cmd;
  389. struct mlx5_eqe_comp comp;
  390. struct mlx5_eqe_qp_srq qp_srq;
  391. struct mlx5_eqe_cq_err cq_err;
  392. struct mlx5_eqe_port_state port;
  393. struct mlx5_eqe_gpio gpio;
  394. struct mlx5_eqe_congestion cong;
  395. struct mlx5_eqe_stall_vl stall_vl;
  396. struct mlx5_eqe_page_req req_pages;
  397. } __packed;
  398. struct mlx5_eqe {
  399. u8 rsvd0;
  400. u8 type;
  401. u8 rsvd1;
  402. u8 sub_type;
  403. __be32 rsvd2[7];
  404. union ev_data data;
  405. __be16 rsvd3;
  406. u8 signature;
  407. u8 owner;
  408. } __packed;
  409. struct mlx5_cmd_prot_block {
  410. u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
  411. u8 rsvd0[48];
  412. __be64 next;
  413. __be32 block_num;
  414. u8 rsvd1;
  415. u8 token;
  416. u8 ctrl_sig;
  417. u8 sig;
  418. };
  419. struct mlx5_err_cqe {
  420. u8 rsvd0[32];
  421. __be32 srqn;
  422. u8 rsvd1[18];
  423. u8 vendor_err_synd;
  424. u8 syndrome;
  425. __be32 s_wqe_opcode_qpn;
  426. __be16 wqe_counter;
  427. u8 signature;
  428. u8 op_own;
  429. };
  430. struct mlx5_cqe64 {
  431. u8 rsvd0[17];
  432. u8 ml_path;
  433. u8 rsvd20[4];
  434. __be16 slid;
  435. __be32 flags_rqpn;
  436. u8 rsvd28[4];
  437. __be32 srqn;
  438. __be32 imm_inval_pkey;
  439. u8 rsvd40[4];
  440. __be32 byte_cnt;
  441. __be64 timestamp;
  442. __be32 sop_drop_qpn;
  443. __be16 wqe_counter;
  444. u8 signature;
  445. u8 op_own;
  446. };
  447. struct mlx5_sig_err_cqe {
  448. u8 rsvd0[16];
  449. __be32 expected_trans_sig;
  450. __be32 actual_trans_sig;
  451. __be32 expected_reftag;
  452. __be32 actual_reftag;
  453. __be16 syndrome;
  454. u8 rsvd22[2];
  455. __be32 mkey;
  456. __be64 err_offset;
  457. u8 rsvd30[8];
  458. __be32 qpn;
  459. u8 rsvd38[2];
  460. u8 signature;
  461. u8 op_own;
  462. };
  463. struct mlx5_wqe_srq_next_seg {
  464. u8 rsvd0[2];
  465. __be16 next_wqe_index;
  466. u8 signature;
  467. u8 rsvd1[11];
  468. };
  469. union mlx5_ext_cqe {
  470. struct ib_grh grh;
  471. u8 inl[64];
  472. };
  473. struct mlx5_cqe128 {
  474. union mlx5_ext_cqe inl_grh;
  475. struct mlx5_cqe64 cqe64;
  476. };
  477. struct mlx5_srq_ctx {
  478. u8 state_log_sz;
  479. u8 rsvd0[3];
  480. __be32 flags_xrcd;
  481. __be32 pgoff_cqn;
  482. u8 rsvd1[4];
  483. u8 log_pg_sz;
  484. u8 rsvd2[7];
  485. __be32 pd;
  486. __be16 lwm;
  487. __be16 wqe_cnt;
  488. u8 rsvd3[8];
  489. __be64 db_record;
  490. };
  491. struct mlx5_create_srq_mbox_in {
  492. struct mlx5_inbox_hdr hdr;
  493. __be32 input_srqn;
  494. u8 rsvd0[4];
  495. struct mlx5_srq_ctx ctx;
  496. u8 rsvd1[208];
  497. __be64 pas[0];
  498. };
  499. struct mlx5_create_srq_mbox_out {
  500. struct mlx5_outbox_hdr hdr;
  501. __be32 srqn;
  502. u8 rsvd[4];
  503. };
  504. struct mlx5_destroy_srq_mbox_in {
  505. struct mlx5_inbox_hdr hdr;
  506. __be32 srqn;
  507. u8 rsvd[4];
  508. };
  509. struct mlx5_destroy_srq_mbox_out {
  510. struct mlx5_outbox_hdr hdr;
  511. u8 rsvd[8];
  512. };
  513. struct mlx5_query_srq_mbox_in {
  514. struct mlx5_inbox_hdr hdr;
  515. __be32 srqn;
  516. u8 rsvd0[4];
  517. };
  518. struct mlx5_query_srq_mbox_out {
  519. struct mlx5_outbox_hdr hdr;
  520. u8 rsvd0[8];
  521. struct mlx5_srq_ctx ctx;
  522. u8 rsvd1[32];
  523. __be64 pas[0];
  524. };
  525. struct mlx5_arm_srq_mbox_in {
  526. struct mlx5_inbox_hdr hdr;
  527. __be32 srqn;
  528. __be16 rsvd;
  529. __be16 lwm;
  530. };
  531. struct mlx5_arm_srq_mbox_out {
  532. struct mlx5_outbox_hdr hdr;
  533. u8 rsvd[8];
  534. };
  535. struct mlx5_cq_context {
  536. u8 status;
  537. u8 cqe_sz_flags;
  538. u8 st;
  539. u8 rsvd3;
  540. u8 rsvd4[6];
  541. __be16 page_offset;
  542. __be32 log_sz_usr_page;
  543. __be16 cq_period;
  544. __be16 cq_max_count;
  545. __be16 rsvd20;
  546. __be16 c_eqn;
  547. u8 log_pg_sz;
  548. u8 rsvd25[7];
  549. __be32 last_notified_index;
  550. __be32 solicit_producer_index;
  551. __be32 consumer_counter;
  552. __be32 producer_counter;
  553. u8 rsvd48[8];
  554. __be64 db_record_addr;
  555. };
  556. struct mlx5_create_cq_mbox_in {
  557. struct mlx5_inbox_hdr hdr;
  558. __be32 input_cqn;
  559. u8 rsvdx[4];
  560. struct mlx5_cq_context ctx;
  561. u8 rsvd6[192];
  562. __be64 pas[0];
  563. };
  564. struct mlx5_create_cq_mbox_out {
  565. struct mlx5_outbox_hdr hdr;
  566. __be32 cqn;
  567. u8 rsvd0[4];
  568. };
  569. struct mlx5_destroy_cq_mbox_in {
  570. struct mlx5_inbox_hdr hdr;
  571. __be32 cqn;
  572. u8 rsvd0[4];
  573. };
  574. struct mlx5_destroy_cq_mbox_out {
  575. struct mlx5_outbox_hdr hdr;
  576. u8 rsvd0[8];
  577. };
  578. struct mlx5_query_cq_mbox_in {
  579. struct mlx5_inbox_hdr hdr;
  580. __be32 cqn;
  581. u8 rsvd0[4];
  582. };
  583. struct mlx5_query_cq_mbox_out {
  584. struct mlx5_outbox_hdr hdr;
  585. u8 rsvd0[8];
  586. struct mlx5_cq_context ctx;
  587. u8 rsvd6[16];
  588. __be64 pas[0];
  589. };
  590. struct mlx5_modify_cq_mbox_in {
  591. struct mlx5_inbox_hdr hdr;
  592. __be32 cqn;
  593. __be32 field_select;
  594. struct mlx5_cq_context ctx;
  595. u8 rsvd[192];
  596. __be64 pas[0];
  597. };
  598. struct mlx5_modify_cq_mbox_out {
  599. struct mlx5_outbox_hdr hdr;
  600. u8 rsvd[8];
  601. };
  602. struct mlx5_enable_hca_mbox_in {
  603. struct mlx5_inbox_hdr hdr;
  604. u8 rsvd[8];
  605. };
  606. struct mlx5_enable_hca_mbox_out {
  607. struct mlx5_outbox_hdr hdr;
  608. u8 rsvd[8];
  609. };
  610. struct mlx5_disable_hca_mbox_in {
  611. struct mlx5_inbox_hdr hdr;
  612. u8 rsvd[8];
  613. };
  614. struct mlx5_disable_hca_mbox_out {
  615. struct mlx5_outbox_hdr hdr;
  616. u8 rsvd[8];
  617. };
  618. struct mlx5_eq_context {
  619. u8 status;
  620. u8 ec_oi;
  621. u8 st;
  622. u8 rsvd2[7];
  623. __be16 page_pffset;
  624. __be32 log_sz_usr_page;
  625. u8 rsvd3[7];
  626. u8 intr;
  627. u8 log_page_size;
  628. u8 rsvd4[15];
  629. __be32 consumer_counter;
  630. __be32 produser_counter;
  631. u8 rsvd5[16];
  632. };
  633. struct mlx5_create_eq_mbox_in {
  634. struct mlx5_inbox_hdr hdr;
  635. u8 rsvd0[3];
  636. u8 input_eqn;
  637. u8 rsvd1[4];
  638. struct mlx5_eq_context ctx;
  639. u8 rsvd2[8];
  640. __be64 events_mask;
  641. u8 rsvd3[176];
  642. __be64 pas[0];
  643. };
  644. struct mlx5_create_eq_mbox_out {
  645. struct mlx5_outbox_hdr hdr;
  646. u8 rsvd0[3];
  647. u8 eq_number;
  648. u8 rsvd1[4];
  649. };
  650. struct mlx5_destroy_eq_mbox_in {
  651. struct mlx5_inbox_hdr hdr;
  652. u8 rsvd0[3];
  653. u8 eqn;
  654. u8 rsvd1[4];
  655. };
  656. struct mlx5_destroy_eq_mbox_out {
  657. struct mlx5_outbox_hdr hdr;
  658. u8 rsvd[8];
  659. };
  660. struct mlx5_map_eq_mbox_in {
  661. struct mlx5_inbox_hdr hdr;
  662. __be64 mask;
  663. u8 mu;
  664. u8 rsvd0[2];
  665. u8 eqn;
  666. u8 rsvd1[24];
  667. };
  668. struct mlx5_map_eq_mbox_out {
  669. struct mlx5_outbox_hdr hdr;
  670. u8 rsvd[8];
  671. };
  672. struct mlx5_query_eq_mbox_in {
  673. struct mlx5_inbox_hdr hdr;
  674. u8 rsvd0[3];
  675. u8 eqn;
  676. u8 rsvd1[4];
  677. };
  678. struct mlx5_query_eq_mbox_out {
  679. struct mlx5_outbox_hdr hdr;
  680. u8 rsvd[8];
  681. struct mlx5_eq_context ctx;
  682. };
  683. struct mlx5_mkey_seg {
  684. /* This is a two bit field occupying bits 31-30.
  685. * bit 31 is always 0,
  686. * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
  687. */
  688. u8 status;
  689. u8 pcie_control;
  690. u8 flags;
  691. u8 version;
  692. __be32 qpn_mkey7_0;
  693. u8 rsvd1[4];
  694. __be32 flags_pd;
  695. __be64 start_addr;
  696. __be64 len;
  697. __be32 bsfs_octo_size;
  698. u8 rsvd2[16];
  699. __be32 xlt_oct_size;
  700. u8 rsvd3[3];
  701. u8 log2_page_size;
  702. u8 rsvd4[4];
  703. };
  704. struct mlx5_query_special_ctxs_mbox_in {
  705. struct mlx5_inbox_hdr hdr;
  706. u8 rsvd[8];
  707. };
  708. struct mlx5_query_special_ctxs_mbox_out {
  709. struct mlx5_outbox_hdr hdr;
  710. __be32 dump_fill_mkey;
  711. __be32 reserved_lkey;
  712. };
  713. struct mlx5_create_mkey_mbox_in {
  714. struct mlx5_inbox_hdr hdr;
  715. __be32 input_mkey_index;
  716. u8 rsvd0[4];
  717. struct mlx5_mkey_seg seg;
  718. u8 rsvd1[16];
  719. __be32 xlat_oct_act_size;
  720. __be32 rsvd2;
  721. u8 rsvd3[168];
  722. __be64 pas[0];
  723. };
  724. struct mlx5_create_mkey_mbox_out {
  725. struct mlx5_outbox_hdr hdr;
  726. __be32 mkey;
  727. u8 rsvd[4];
  728. };
  729. struct mlx5_destroy_mkey_mbox_in {
  730. struct mlx5_inbox_hdr hdr;
  731. __be32 mkey;
  732. u8 rsvd[4];
  733. };
  734. struct mlx5_destroy_mkey_mbox_out {
  735. struct mlx5_outbox_hdr hdr;
  736. u8 rsvd[8];
  737. };
  738. struct mlx5_query_mkey_mbox_in {
  739. struct mlx5_inbox_hdr hdr;
  740. __be32 mkey;
  741. };
  742. struct mlx5_query_mkey_mbox_out {
  743. struct mlx5_outbox_hdr hdr;
  744. __be64 pas[0];
  745. };
  746. struct mlx5_modify_mkey_mbox_in {
  747. struct mlx5_inbox_hdr hdr;
  748. __be32 mkey;
  749. __be64 pas[0];
  750. };
  751. struct mlx5_modify_mkey_mbox_out {
  752. struct mlx5_outbox_hdr hdr;
  753. u8 rsvd[8];
  754. };
  755. struct mlx5_dump_mkey_mbox_in {
  756. struct mlx5_inbox_hdr hdr;
  757. };
  758. struct mlx5_dump_mkey_mbox_out {
  759. struct mlx5_outbox_hdr hdr;
  760. __be32 mkey;
  761. };
  762. struct mlx5_mad_ifc_mbox_in {
  763. struct mlx5_inbox_hdr hdr;
  764. __be16 remote_lid;
  765. u8 rsvd0;
  766. u8 port;
  767. u8 rsvd1[4];
  768. u8 data[256];
  769. };
  770. struct mlx5_mad_ifc_mbox_out {
  771. struct mlx5_outbox_hdr hdr;
  772. u8 rsvd[8];
  773. u8 data[256];
  774. };
  775. struct mlx5_access_reg_mbox_in {
  776. struct mlx5_inbox_hdr hdr;
  777. u8 rsvd0[2];
  778. __be16 register_id;
  779. __be32 arg;
  780. __be32 data[0];
  781. };
  782. struct mlx5_access_reg_mbox_out {
  783. struct mlx5_outbox_hdr hdr;
  784. u8 rsvd[8];
  785. __be32 data[0];
  786. };
  787. #define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
  788. enum {
  789. MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
  790. };
  791. struct mlx5_allocate_psv_in {
  792. struct mlx5_inbox_hdr hdr;
  793. __be32 npsv_pd;
  794. __be32 rsvd_psv0;
  795. };
  796. struct mlx5_allocate_psv_out {
  797. struct mlx5_outbox_hdr hdr;
  798. u8 rsvd[8];
  799. __be32 psv_idx[4];
  800. };
  801. struct mlx5_destroy_psv_in {
  802. struct mlx5_inbox_hdr hdr;
  803. __be32 psv_number;
  804. u8 rsvd[4];
  805. };
  806. struct mlx5_destroy_psv_out {
  807. struct mlx5_outbox_hdr hdr;
  808. u8 rsvd[8];
  809. };
  810. #endif /* MLX5_DEVICE_H */