pvrdma_dev_api.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. * Copyright (c) 2012-2016 VMware, Inc. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of EITHER the GNU General Public License
  6. * version 2 as published by the Free Software Foundation or the BSD
  7. * 2-Clause License. This program is distributed in the hope that it
  8. * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED
  9. * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  10. * See the GNU General Public License version 2 for more details at
  11. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program available in the file COPYING in the main
  15. * directory of this source tree.
  16. *
  17. * The BSD 2-Clause License
  18. *
  19. * Redistribution and use in source and binary forms, with or
  20. * without modification, are permitted provided that the following
  21. * conditions are met:
  22. *
  23. * - Redistributions of source code must retain the above
  24. * copyright notice, this list of conditions and the following
  25. * disclaimer.
  26. *
  27. * - Redistributions in binary form must reproduce the above
  28. * copyright notice, this list of conditions and the following
  29. * disclaimer in the documentation and/or other materials
  30. * provided with the distribution.
  31. *
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  33. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  34. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  35. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  36. * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  37. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  38. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  39. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  40. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  41. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  42. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  43. * OF THE POSSIBILITY OF SUCH DAMAGE.
  44. */
  45. #ifndef __PVRDMA_DEV_API_H__
  46. #define __PVRDMA_DEV_API_H__
  47. #include <linux/types.h>
  48. #include "pvrdma_verbs.h"
  49. /*
  50. * PVRDMA version macros. Some new features require updates to PVRDMA_VERSION.
  51. * These macros allow us to check for different features if necessary.
  52. */
  53. #define PVRDMA_ROCEV1_VERSION 17
  54. #define PVRDMA_ROCEV2_VERSION 18
  55. #define PVRDMA_VERSION PVRDMA_ROCEV2_VERSION
  56. #define PVRDMA_BOARD_ID 1
  57. #define PVRDMA_REV_ID 1
  58. /*
  59. * Masks and accessors for page directory, which is a two-level lookup:
  60. * page directory -> page table -> page. Only one directory for now, but we
  61. * could expand that easily. 9 bits for tables, 9 bits for pages, gives one
  62. * gigabyte for memory regions and so forth.
  63. */
  64. #define PVRDMA_PDIR_SHIFT 18
  65. #define PVRDMA_PTABLE_SHIFT 9
  66. #define PVRDMA_PAGE_DIR_DIR(x) (((x) >> PVRDMA_PDIR_SHIFT) & 0x1)
  67. #define PVRDMA_PAGE_DIR_TABLE(x) (((x) >> PVRDMA_PTABLE_SHIFT) & 0x1ff)
  68. #define PVRDMA_PAGE_DIR_PAGE(x) ((x) & 0x1ff)
  69. #define PVRDMA_PAGE_DIR_MAX_PAGES (1 * 512 * 512)
  70. #define PVRDMA_MAX_FAST_REG_PAGES 128
  71. /*
  72. * Max MSI-X vectors.
  73. */
  74. #define PVRDMA_MAX_INTERRUPTS 3
  75. /* Register offsets within PCI resource on BAR1. */
  76. #define PVRDMA_REG_VERSION 0x00 /* R: Version of device. */
  77. #define PVRDMA_REG_DSRLOW 0x04 /* W: Device shared region low PA. */
  78. #define PVRDMA_REG_DSRHIGH 0x08 /* W: Device shared region high PA. */
  79. #define PVRDMA_REG_CTL 0x0c /* W: PVRDMA_DEVICE_CTL */
  80. #define PVRDMA_REG_REQUEST 0x10 /* W: Indicate device request. */
  81. #define PVRDMA_REG_ERR 0x14 /* R: Device error. */
  82. #define PVRDMA_REG_ICR 0x18 /* R: Interrupt cause. */
  83. #define PVRDMA_REG_IMR 0x1c /* R/W: Interrupt mask. */
  84. #define PVRDMA_REG_MACL 0x20 /* R/W: MAC address low. */
  85. #define PVRDMA_REG_MACH 0x24 /* R/W: MAC address high. */
  86. /* Object flags. */
  87. #define PVRDMA_CQ_FLAG_ARMED_SOL BIT(0) /* Armed for solicited-only. */
  88. #define PVRDMA_CQ_FLAG_ARMED BIT(1) /* Armed. */
  89. #define PVRDMA_MR_FLAG_DMA BIT(0) /* DMA region. */
  90. #define PVRDMA_MR_FLAG_FRMR BIT(1) /* Fast reg memory region. */
  91. /*
  92. * Atomic operation capability (masked versions are extended atomic
  93. * operations.
  94. */
  95. #define PVRDMA_ATOMIC_OP_COMP_SWAP BIT(0) /* Compare and swap. */
  96. #define PVRDMA_ATOMIC_OP_FETCH_ADD BIT(1) /* Fetch and add. */
  97. #define PVRDMA_ATOMIC_OP_MASK_COMP_SWAP BIT(2) /* Masked compare and swap. */
  98. #define PVRDMA_ATOMIC_OP_MASK_FETCH_ADD BIT(3) /* Masked fetch and add. */
  99. /*
  100. * Base Memory Management Extension flags to support Fast Reg Memory Regions
  101. * and Fast Reg Work Requests. Each flag represents a verb operation and we
  102. * must support all of them to qualify for the BMME device cap.
  103. */
  104. #define PVRDMA_BMME_FLAG_LOCAL_INV BIT(0) /* Local Invalidate. */
  105. #define PVRDMA_BMME_FLAG_REMOTE_INV BIT(1) /* Remote Invalidate. */
  106. #define PVRDMA_BMME_FLAG_FAST_REG_WR BIT(2) /* Fast Reg Work Request. */
  107. /*
  108. * GID types. The interpretation of the gid_types bit field in the device
  109. * capabilities will depend on the device mode. For now, the device only
  110. * supports RoCE as mode, so only the different GID types for RoCE are
  111. * defined.
  112. */
  113. #define PVRDMA_GID_TYPE_FLAG_ROCE_V1 BIT(0)
  114. #define PVRDMA_GID_TYPE_FLAG_ROCE_V2 BIT(1)
  115. /*
  116. * Version checks. This checks whether each version supports specific
  117. * capabilities from the device.
  118. */
  119. #define PVRDMA_IS_VERSION17(_dev) \
  120. (_dev->dsr_version == PVRDMA_ROCEV1_VERSION && \
  121. _dev->dsr->caps.gid_types == PVRDMA_GID_TYPE_FLAG_ROCE_V1)
  122. #define PVRDMA_IS_VERSION18(_dev) \
  123. (_dev->dsr_version >= PVRDMA_ROCEV2_VERSION && \
  124. (_dev->dsr->caps.gid_types == PVRDMA_GID_TYPE_FLAG_ROCE_V1 || \
  125. _dev->dsr->caps.gid_types == PVRDMA_GID_TYPE_FLAG_ROCE_V2)) \
  126. #define PVRDMA_SUPPORTED(_dev) \
  127. ((_dev->dsr->caps.mode == PVRDMA_DEVICE_MODE_ROCE) && \
  128. (PVRDMA_IS_VERSION17(_dev) || PVRDMA_IS_VERSION18(_dev)))
  129. /*
  130. * Get capability values based on device version.
  131. */
  132. #define PVRDMA_GET_CAP(_dev, _old_val, _val) \
  133. ((PVRDMA_IS_VERSION18(_dev)) ? _val : _old_val)
  134. enum pvrdma_pci_resource {
  135. PVRDMA_PCI_RESOURCE_MSIX, /* BAR0: MSI-X, MMIO. */
  136. PVRDMA_PCI_RESOURCE_REG, /* BAR1: Registers, MMIO. */
  137. PVRDMA_PCI_RESOURCE_UAR, /* BAR2: UAR pages, MMIO, 64-bit. */
  138. PVRDMA_PCI_RESOURCE_LAST, /* Last. */
  139. };
  140. enum pvrdma_device_ctl {
  141. PVRDMA_DEVICE_CTL_ACTIVATE, /* Activate device. */
  142. PVRDMA_DEVICE_CTL_UNQUIESCE, /* Unquiesce device. */
  143. PVRDMA_DEVICE_CTL_RESET, /* Reset device. */
  144. };
  145. enum pvrdma_intr_vector {
  146. PVRDMA_INTR_VECTOR_RESPONSE, /* Command response. */
  147. PVRDMA_INTR_VECTOR_ASYNC, /* Async events. */
  148. PVRDMA_INTR_VECTOR_CQ, /* CQ notification. */
  149. /* Additional CQ notification vectors. */
  150. };
  151. enum pvrdma_intr_cause {
  152. PVRDMA_INTR_CAUSE_RESPONSE = (1 << PVRDMA_INTR_VECTOR_RESPONSE),
  153. PVRDMA_INTR_CAUSE_ASYNC = (1 << PVRDMA_INTR_VECTOR_ASYNC),
  154. PVRDMA_INTR_CAUSE_CQ = (1 << PVRDMA_INTR_VECTOR_CQ),
  155. };
  156. enum pvrdma_gos_bits {
  157. PVRDMA_GOS_BITS_UNK, /* Unknown. */
  158. PVRDMA_GOS_BITS_32, /* 32-bit. */
  159. PVRDMA_GOS_BITS_64, /* 64-bit. */
  160. };
  161. enum pvrdma_gos_type {
  162. PVRDMA_GOS_TYPE_UNK, /* Unknown. */
  163. PVRDMA_GOS_TYPE_LINUX, /* Linux. */
  164. };
  165. enum pvrdma_device_mode {
  166. PVRDMA_DEVICE_MODE_ROCE, /* RoCE. */
  167. PVRDMA_DEVICE_MODE_IWARP, /* iWarp. */
  168. PVRDMA_DEVICE_MODE_IB, /* InfiniBand. */
  169. };
  170. struct pvrdma_gos_info {
  171. u32 gos_bits:2; /* W: PVRDMA_GOS_BITS_ */
  172. u32 gos_type:4; /* W: PVRDMA_GOS_TYPE_ */
  173. u32 gos_ver:16; /* W: Guest OS version. */
  174. u32 gos_misc:10; /* W: Other. */
  175. u32 pad; /* Pad to 8-byte alignment. */
  176. };
  177. struct pvrdma_device_caps {
  178. u64 fw_ver; /* R: Query device. */
  179. __be64 node_guid;
  180. __be64 sys_image_guid;
  181. u64 max_mr_size;
  182. u64 page_size_cap;
  183. u64 atomic_arg_sizes; /* EX verbs. */
  184. u32 ex_comp_mask; /* EX verbs. */
  185. u32 device_cap_flags2; /* EX verbs. */
  186. u32 max_fa_bit_boundary; /* EX verbs. */
  187. u32 log_max_atomic_inline_arg; /* EX verbs. */
  188. u32 vendor_id;
  189. u32 vendor_part_id;
  190. u32 hw_ver;
  191. u32 max_qp;
  192. u32 max_qp_wr;
  193. u32 device_cap_flags;
  194. u32 max_sge;
  195. u32 max_sge_rd;
  196. u32 max_cq;
  197. u32 max_cqe;
  198. u32 max_mr;
  199. u32 max_pd;
  200. u32 max_qp_rd_atom;
  201. u32 max_ee_rd_atom;
  202. u32 max_res_rd_atom;
  203. u32 max_qp_init_rd_atom;
  204. u32 max_ee_init_rd_atom;
  205. u32 max_ee;
  206. u32 max_rdd;
  207. u32 max_mw;
  208. u32 max_raw_ipv6_qp;
  209. u32 max_raw_ethy_qp;
  210. u32 max_mcast_grp;
  211. u32 max_mcast_qp_attach;
  212. u32 max_total_mcast_qp_attach;
  213. u32 max_ah;
  214. u32 max_fmr;
  215. u32 max_map_per_fmr;
  216. u32 max_srq;
  217. u32 max_srq_wr;
  218. u32 max_srq_sge;
  219. u32 max_uar;
  220. u32 gid_tbl_len;
  221. u16 max_pkeys;
  222. u8 local_ca_ack_delay;
  223. u8 phys_port_cnt;
  224. u8 mode; /* PVRDMA_DEVICE_MODE_ */
  225. u8 atomic_ops; /* PVRDMA_ATOMIC_OP_* bits */
  226. u8 bmme_flags; /* FRWR Mem Mgmt Extensions */
  227. u8 gid_types; /* PVRDMA_GID_TYPE_FLAG_ */
  228. u32 max_fast_reg_page_list_len;
  229. };
  230. struct pvrdma_ring_page_info {
  231. u32 num_pages; /* Num pages incl. header. */
  232. u32 reserved; /* Reserved. */
  233. u64 pdir_dma; /* Page directory PA. */
  234. };
  235. #pragma pack(push, 1)
  236. struct pvrdma_device_shared_region {
  237. u32 driver_version; /* W: Driver version. */
  238. u32 pad; /* Pad to 8-byte align. */
  239. struct pvrdma_gos_info gos_info; /* W: Guest OS information. */
  240. u64 cmd_slot_dma; /* W: Command slot address. */
  241. u64 resp_slot_dma; /* W: Response slot address. */
  242. struct pvrdma_ring_page_info async_ring_pages;
  243. /* W: Async ring page info. */
  244. struct pvrdma_ring_page_info cq_ring_pages;
  245. /* W: CQ ring page info. */
  246. u32 uar_pfn; /* W: UAR pageframe. */
  247. u32 pad2; /* Pad to 8-byte align. */
  248. struct pvrdma_device_caps caps; /* R: Device capabilities. */
  249. };
  250. #pragma pack(pop)
  251. /* Event types. Currently a 1:1 mapping with enum ib_event. */
  252. enum pvrdma_eqe_type {
  253. PVRDMA_EVENT_CQ_ERR,
  254. PVRDMA_EVENT_QP_FATAL,
  255. PVRDMA_EVENT_QP_REQ_ERR,
  256. PVRDMA_EVENT_QP_ACCESS_ERR,
  257. PVRDMA_EVENT_COMM_EST,
  258. PVRDMA_EVENT_SQ_DRAINED,
  259. PVRDMA_EVENT_PATH_MIG,
  260. PVRDMA_EVENT_PATH_MIG_ERR,
  261. PVRDMA_EVENT_DEVICE_FATAL,
  262. PVRDMA_EVENT_PORT_ACTIVE,
  263. PVRDMA_EVENT_PORT_ERR,
  264. PVRDMA_EVENT_LID_CHANGE,
  265. PVRDMA_EVENT_PKEY_CHANGE,
  266. PVRDMA_EVENT_SM_CHANGE,
  267. PVRDMA_EVENT_SRQ_ERR,
  268. PVRDMA_EVENT_SRQ_LIMIT_REACHED,
  269. PVRDMA_EVENT_QP_LAST_WQE_REACHED,
  270. PVRDMA_EVENT_CLIENT_REREGISTER,
  271. PVRDMA_EVENT_GID_CHANGE,
  272. };
  273. /* Event queue element. */
  274. struct pvrdma_eqe {
  275. u32 type; /* Event type. */
  276. u32 info; /* Handle, other. */
  277. };
  278. /* CQ notification queue element. */
  279. struct pvrdma_cqne {
  280. u32 info; /* Handle */
  281. };
  282. enum {
  283. PVRDMA_CMD_FIRST,
  284. PVRDMA_CMD_QUERY_PORT = PVRDMA_CMD_FIRST,
  285. PVRDMA_CMD_QUERY_PKEY,
  286. PVRDMA_CMD_CREATE_PD,
  287. PVRDMA_CMD_DESTROY_PD,
  288. PVRDMA_CMD_CREATE_MR,
  289. PVRDMA_CMD_DESTROY_MR,
  290. PVRDMA_CMD_CREATE_CQ,
  291. PVRDMA_CMD_RESIZE_CQ,
  292. PVRDMA_CMD_DESTROY_CQ,
  293. PVRDMA_CMD_CREATE_QP,
  294. PVRDMA_CMD_MODIFY_QP,
  295. PVRDMA_CMD_QUERY_QP,
  296. PVRDMA_CMD_DESTROY_QP,
  297. PVRDMA_CMD_CREATE_UC,
  298. PVRDMA_CMD_DESTROY_UC,
  299. PVRDMA_CMD_CREATE_BIND,
  300. PVRDMA_CMD_DESTROY_BIND,
  301. PVRDMA_CMD_CREATE_SRQ,
  302. PVRDMA_CMD_MODIFY_SRQ,
  303. PVRDMA_CMD_QUERY_SRQ,
  304. PVRDMA_CMD_DESTROY_SRQ,
  305. PVRDMA_CMD_MAX,
  306. };
  307. enum {
  308. PVRDMA_CMD_FIRST_RESP = (1 << 31),
  309. PVRDMA_CMD_QUERY_PORT_RESP = PVRDMA_CMD_FIRST_RESP,
  310. PVRDMA_CMD_QUERY_PKEY_RESP,
  311. PVRDMA_CMD_CREATE_PD_RESP,
  312. PVRDMA_CMD_DESTROY_PD_RESP_NOOP,
  313. PVRDMA_CMD_CREATE_MR_RESP,
  314. PVRDMA_CMD_DESTROY_MR_RESP_NOOP,
  315. PVRDMA_CMD_CREATE_CQ_RESP,
  316. PVRDMA_CMD_RESIZE_CQ_RESP,
  317. PVRDMA_CMD_DESTROY_CQ_RESP_NOOP,
  318. PVRDMA_CMD_CREATE_QP_RESP,
  319. PVRDMA_CMD_MODIFY_QP_RESP,
  320. PVRDMA_CMD_QUERY_QP_RESP,
  321. PVRDMA_CMD_DESTROY_QP_RESP,
  322. PVRDMA_CMD_CREATE_UC_RESP,
  323. PVRDMA_CMD_DESTROY_UC_RESP_NOOP,
  324. PVRDMA_CMD_CREATE_BIND_RESP_NOOP,
  325. PVRDMA_CMD_DESTROY_BIND_RESP_NOOP,
  326. PVRDMA_CMD_CREATE_SRQ_RESP,
  327. PVRDMA_CMD_MODIFY_SRQ_RESP,
  328. PVRDMA_CMD_QUERY_SRQ_RESP,
  329. PVRDMA_CMD_DESTROY_SRQ_RESP,
  330. PVRDMA_CMD_MAX_RESP,
  331. };
  332. struct pvrdma_cmd_hdr {
  333. u64 response; /* Key for response lookup. */
  334. u32 cmd; /* PVRDMA_CMD_ */
  335. u32 reserved; /* Reserved. */
  336. };
  337. struct pvrdma_cmd_resp_hdr {
  338. u64 response; /* From cmd hdr. */
  339. u32 ack; /* PVRDMA_CMD_XXX_RESP */
  340. u8 err; /* Error. */
  341. u8 reserved[3]; /* Reserved. */
  342. };
  343. struct pvrdma_cmd_query_port {
  344. struct pvrdma_cmd_hdr hdr;
  345. u8 port_num;
  346. u8 reserved[7];
  347. };
  348. struct pvrdma_cmd_query_port_resp {
  349. struct pvrdma_cmd_resp_hdr hdr;
  350. struct pvrdma_port_attr attrs;
  351. };
  352. struct pvrdma_cmd_query_pkey {
  353. struct pvrdma_cmd_hdr hdr;
  354. u8 port_num;
  355. u8 index;
  356. u8 reserved[6];
  357. };
  358. struct pvrdma_cmd_query_pkey_resp {
  359. struct pvrdma_cmd_resp_hdr hdr;
  360. u16 pkey;
  361. u8 reserved[6];
  362. };
  363. struct pvrdma_cmd_create_uc {
  364. struct pvrdma_cmd_hdr hdr;
  365. u32 pfn; /* UAR page frame number */
  366. u8 reserved[4];
  367. };
  368. struct pvrdma_cmd_create_uc_resp {
  369. struct pvrdma_cmd_resp_hdr hdr;
  370. u32 ctx_handle;
  371. u8 reserved[4];
  372. };
  373. struct pvrdma_cmd_destroy_uc {
  374. struct pvrdma_cmd_hdr hdr;
  375. u32 ctx_handle;
  376. u8 reserved[4];
  377. };
  378. struct pvrdma_cmd_create_pd {
  379. struct pvrdma_cmd_hdr hdr;
  380. u32 ctx_handle;
  381. u8 reserved[4];
  382. };
  383. struct pvrdma_cmd_create_pd_resp {
  384. struct pvrdma_cmd_resp_hdr hdr;
  385. u32 pd_handle;
  386. u8 reserved[4];
  387. };
  388. struct pvrdma_cmd_destroy_pd {
  389. struct pvrdma_cmd_hdr hdr;
  390. u32 pd_handle;
  391. u8 reserved[4];
  392. };
  393. struct pvrdma_cmd_create_mr {
  394. struct pvrdma_cmd_hdr hdr;
  395. u64 start;
  396. u64 length;
  397. u64 pdir_dma;
  398. u32 pd_handle;
  399. u32 access_flags;
  400. u32 flags;
  401. u32 nchunks;
  402. };
  403. struct pvrdma_cmd_create_mr_resp {
  404. struct pvrdma_cmd_resp_hdr hdr;
  405. u32 mr_handle;
  406. u32 lkey;
  407. u32 rkey;
  408. u8 reserved[4];
  409. };
  410. struct pvrdma_cmd_destroy_mr {
  411. struct pvrdma_cmd_hdr hdr;
  412. u32 mr_handle;
  413. u8 reserved[4];
  414. };
  415. struct pvrdma_cmd_create_cq {
  416. struct pvrdma_cmd_hdr hdr;
  417. u64 pdir_dma;
  418. u32 ctx_handle;
  419. u32 cqe;
  420. u32 nchunks;
  421. u8 reserved[4];
  422. };
  423. struct pvrdma_cmd_create_cq_resp {
  424. struct pvrdma_cmd_resp_hdr hdr;
  425. u32 cq_handle;
  426. u32 cqe;
  427. };
  428. struct pvrdma_cmd_resize_cq {
  429. struct pvrdma_cmd_hdr hdr;
  430. u32 cq_handle;
  431. u32 cqe;
  432. };
  433. struct pvrdma_cmd_resize_cq_resp {
  434. struct pvrdma_cmd_resp_hdr hdr;
  435. u32 cqe;
  436. u8 reserved[4];
  437. };
  438. struct pvrdma_cmd_destroy_cq {
  439. struct pvrdma_cmd_hdr hdr;
  440. u32 cq_handle;
  441. u8 reserved[4];
  442. };
  443. struct pvrdma_cmd_create_srq {
  444. struct pvrdma_cmd_hdr hdr;
  445. u64 pdir_dma;
  446. u32 pd_handle;
  447. u32 nchunks;
  448. struct pvrdma_srq_attr attrs;
  449. u8 srq_type;
  450. u8 reserved[7];
  451. };
  452. struct pvrdma_cmd_create_srq_resp {
  453. struct pvrdma_cmd_resp_hdr hdr;
  454. u32 srqn;
  455. u8 reserved[4];
  456. };
  457. struct pvrdma_cmd_modify_srq {
  458. struct pvrdma_cmd_hdr hdr;
  459. u32 srq_handle;
  460. u32 attr_mask;
  461. struct pvrdma_srq_attr attrs;
  462. };
  463. struct pvrdma_cmd_query_srq {
  464. struct pvrdma_cmd_hdr hdr;
  465. u32 srq_handle;
  466. u8 reserved[4];
  467. };
  468. struct pvrdma_cmd_query_srq_resp {
  469. struct pvrdma_cmd_resp_hdr hdr;
  470. struct pvrdma_srq_attr attrs;
  471. };
  472. struct pvrdma_cmd_destroy_srq {
  473. struct pvrdma_cmd_hdr hdr;
  474. u32 srq_handle;
  475. u8 reserved[4];
  476. };
  477. struct pvrdma_cmd_create_qp {
  478. struct pvrdma_cmd_hdr hdr;
  479. u64 pdir_dma;
  480. u32 pd_handle;
  481. u32 send_cq_handle;
  482. u32 recv_cq_handle;
  483. u32 srq_handle;
  484. u32 max_send_wr;
  485. u32 max_recv_wr;
  486. u32 max_send_sge;
  487. u32 max_recv_sge;
  488. u32 max_inline_data;
  489. u32 lkey;
  490. u32 access_flags;
  491. u16 total_chunks;
  492. u16 send_chunks;
  493. u16 max_atomic_arg;
  494. u8 sq_sig_all;
  495. u8 qp_type;
  496. u8 is_srq;
  497. u8 reserved[3];
  498. };
  499. struct pvrdma_cmd_create_qp_resp {
  500. struct pvrdma_cmd_resp_hdr hdr;
  501. u32 qpn;
  502. u32 max_send_wr;
  503. u32 max_recv_wr;
  504. u32 max_send_sge;
  505. u32 max_recv_sge;
  506. u32 max_inline_data;
  507. };
  508. struct pvrdma_cmd_modify_qp {
  509. struct pvrdma_cmd_hdr hdr;
  510. u32 qp_handle;
  511. u32 attr_mask;
  512. struct pvrdma_qp_attr attrs;
  513. };
  514. struct pvrdma_cmd_query_qp {
  515. struct pvrdma_cmd_hdr hdr;
  516. u32 qp_handle;
  517. u32 attr_mask;
  518. };
  519. struct pvrdma_cmd_query_qp_resp {
  520. struct pvrdma_cmd_resp_hdr hdr;
  521. struct pvrdma_qp_attr attrs;
  522. };
  523. struct pvrdma_cmd_destroy_qp {
  524. struct pvrdma_cmd_hdr hdr;
  525. u32 qp_handle;
  526. u8 reserved[4];
  527. };
  528. struct pvrdma_cmd_destroy_qp_resp {
  529. struct pvrdma_cmd_resp_hdr hdr;
  530. u32 events_reported;
  531. u8 reserved[4];
  532. };
  533. struct pvrdma_cmd_create_bind {
  534. struct pvrdma_cmd_hdr hdr;
  535. u32 mtu;
  536. u32 vlan;
  537. u32 index;
  538. u8 new_gid[16];
  539. u8 gid_type;
  540. u8 reserved[3];
  541. };
  542. struct pvrdma_cmd_destroy_bind {
  543. struct pvrdma_cmd_hdr hdr;
  544. u32 index;
  545. u8 dest_gid[16];
  546. u8 reserved[4];
  547. };
  548. union pvrdma_cmd_req {
  549. struct pvrdma_cmd_hdr hdr;
  550. struct pvrdma_cmd_query_port query_port;
  551. struct pvrdma_cmd_query_pkey query_pkey;
  552. struct pvrdma_cmd_create_uc create_uc;
  553. struct pvrdma_cmd_destroy_uc destroy_uc;
  554. struct pvrdma_cmd_create_pd create_pd;
  555. struct pvrdma_cmd_destroy_pd destroy_pd;
  556. struct pvrdma_cmd_create_mr create_mr;
  557. struct pvrdma_cmd_destroy_mr destroy_mr;
  558. struct pvrdma_cmd_create_cq create_cq;
  559. struct pvrdma_cmd_resize_cq resize_cq;
  560. struct pvrdma_cmd_destroy_cq destroy_cq;
  561. struct pvrdma_cmd_create_qp create_qp;
  562. struct pvrdma_cmd_modify_qp modify_qp;
  563. struct pvrdma_cmd_query_qp query_qp;
  564. struct pvrdma_cmd_destroy_qp destroy_qp;
  565. struct pvrdma_cmd_create_bind create_bind;
  566. struct pvrdma_cmd_destroy_bind destroy_bind;
  567. struct pvrdma_cmd_create_srq create_srq;
  568. struct pvrdma_cmd_modify_srq modify_srq;
  569. struct pvrdma_cmd_query_srq query_srq;
  570. struct pvrdma_cmd_destroy_srq destroy_srq;
  571. };
  572. union pvrdma_cmd_resp {
  573. struct pvrdma_cmd_resp_hdr hdr;
  574. struct pvrdma_cmd_query_port_resp query_port_resp;
  575. struct pvrdma_cmd_query_pkey_resp query_pkey_resp;
  576. struct pvrdma_cmd_create_uc_resp create_uc_resp;
  577. struct pvrdma_cmd_create_pd_resp create_pd_resp;
  578. struct pvrdma_cmd_create_mr_resp create_mr_resp;
  579. struct pvrdma_cmd_create_cq_resp create_cq_resp;
  580. struct pvrdma_cmd_resize_cq_resp resize_cq_resp;
  581. struct pvrdma_cmd_create_qp_resp create_qp_resp;
  582. struct pvrdma_cmd_query_qp_resp query_qp_resp;
  583. struct pvrdma_cmd_destroy_qp_resp destroy_qp_resp;
  584. struct pvrdma_cmd_create_srq_resp create_srq_resp;
  585. struct pvrdma_cmd_query_srq_resp query_srq_resp;
  586. };
  587. #endif /* __PVRDMA_DEV_API_H__ */