ehca_qes.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * Hardware request structures
  5. *
  6. * Authors: Waleri Fomin <fomin@de.ibm.com>
  7. * Reinhard Ernst <rernst@de.ibm.com>
  8. * Christoph Raisch <raisch@de.ibm.com>
  9. *
  10. * Copyright (c) 2005 IBM Corporation
  11. *
  12. * All rights reserved.
  13. *
  14. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  15. * BSD.
  16. *
  17. * OpenIB BSD License
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. *
  25. * Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials
  28. * provided with the distribution.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  36. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  37. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  38. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGE.
  41. */
  42. #ifndef _EHCA_QES_H_
  43. #define _EHCA_QES_H_
  44. #include "ehca_tools.h"
  45. /* virtual scatter gather entry to specify remote addresses with length */
  46. struct ehca_vsgentry {
  47. u64 vaddr;
  48. u32 lkey;
  49. u32 length;
  50. };
  51. #define GRH_FLAG_MASK EHCA_BMASK_IBM( 7, 7)
  52. #define GRH_IPVERSION_MASK EHCA_BMASK_IBM( 0, 3)
  53. #define GRH_TCLASS_MASK EHCA_BMASK_IBM( 4, 12)
  54. #define GRH_FLOWLABEL_MASK EHCA_BMASK_IBM(13, 31)
  55. #define GRH_PAYLEN_MASK EHCA_BMASK_IBM(32, 47)
  56. #define GRH_NEXTHEADER_MASK EHCA_BMASK_IBM(48, 55)
  57. #define GRH_HOPLIMIT_MASK EHCA_BMASK_IBM(56, 63)
  58. /*
  59. * Unreliable Datagram Address Vector Format
  60. * see IBTA Vol1 chapter 8.3 Global Routing Header
  61. */
  62. struct ehca_ud_av {
  63. u8 sl;
  64. u8 lnh;
  65. u16 dlid;
  66. u8 reserved1;
  67. u8 reserved2;
  68. u8 reserved3;
  69. u8 slid_path_bits;
  70. u8 reserved4;
  71. u8 ipd;
  72. u8 reserved5;
  73. u8 pmtu;
  74. u32 reserved6;
  75. u64 reserved7;
  76. union {
  77. struct {
  78. u64 word_0; /* always set to 6 */
  79. /*should be 0x1B for IB transport */
  80. u64 word_1;
  81. u64 word_2;
  82. u64 word_3;
  83. u64 word_4;
  84. } grh;
  85. struct {
  86. u32 wd_0;
  87. u32 wd_1;
  88. /* DWord_1 --> SGID */
  89. u32 sgid_wd3;
  90. u32 sgid_wd2;
  91. u32 sgid_wd1;
  92. u32 sgid_wd0;
  93. /* DWord_3 --> DGID */
  94. u32 dgid_wd3;
  95. u32 dgid_wd2;
  96. u32 dgid_wd1;
  97. u32 dgid_wd0;
  98. } grh_l;
  99. };
  100. };
  101. /* maximum number of sg entries allowed in a WQE */
  102. #define MAX_WQE_SG_ENTRIES 252
  103. #define WQE_OPTYPE_SEND 0x80
  104. #define WQE_OPTYPE_RDMAREAD 0x40
  105. #define WQE_OPTYPE_RDMAWRITE 0x20
  106. #define WQE_OPTYPE_CMPSWAP 0x10
  107. #define WQE_OPTYPE_FETCHADD 0x08
  108. #define WQE_OPTYPE_BIND 0x04
  109. #define WQE_WRFLAG_REQ_SIGNAL_COM 0x80
  110. #define WQE_WRFLAG_FENCE 0x40
  111. #define WQE_WRFLAG_IMM_DATA_PRESENT 0x20
  112. #define WQE_WRFLAG_SOLIC_EVENT 0x10
  113. #define WQEF_CACHE_HINT 0x80
  114. #define WQEF_CACHE_HINT_RD_WR 0x40
  115. #define WQEF_TIMED_WQE 0x20
  116. #define WQEF_PURGE 0x08
  117. #define WQEF_HIGH_NIBBLE 0xF0
  118. #define MW_BIND_ACCESSCTRL_R_WRITE 0x40
  119. #define MW_BIND_ACCESSCTRL_R_READ 0x20
  120. #define MW_BIND_ACCESSCTRL_R_ATOMIC 0x10
  121. struct ehca_wqe {
  122. u64 work_request_id;
  123. u8 optype;
  124. u8 wr_flag;
  125. u16 pkeyi;
  126. u8 wqef;
  127. u8 nr_of_data_seg;
  128. u16 wqe_provided_slid;
  129. u32 destination_qp_number;
  130. u32 resync_psn_sqp;
  131. u32 local_ee_context_qkey;
  132. u32 immediate_data;
  133. union {
  134. struct {
  135. u64 remote_virtual_address;
  136. u32 rkey;
  137. u32 reserved;
  138. u64 atomic_1st_op_dma_len;
  139. u64 atomic_2nd_op;
  140. struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];
  141. } nud;
  142. struct {
  143. u64 ehca_ud_av_ptr;
  144. u64 reserved1;
  145. u64 reserved2;
  146. u64 reserved3;
  147. struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];
  148. } ud_avp;
  149. struct {
  150. struct ehca_ud_av ud_av;
  151. struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES -
  152. 2];
  153. } ud_av;
  154. struct {
  155. u64 reserved0;
  156. u64 reserved1;
  157. u64 reserved2;
  158. u64 reserved3;
  159. struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];
  160. } all_rcv;
  161. struct {
  162. u64 reserved;
  163. u32 rkey;
  164. u32 old_rkey;
  165. u64 reserved1;
  166. u64 reserved2;
  167. u64 virtual_address;
  168. u32 reserved3;
  169. u32 length;
  170. u32 reserved4;
  171. u16 reserved5;
  172. u8 reserved6;
  173. u8 lr_ctl;
  174. u32 lkey;
  175. u32 reserved7;
  176. u64 reserved8;
  177. u64 reserved9;
  178. u64 reserved10;
  179. u64 reserved11;
  180. } bind;
  181. struct {
  182. u64 reserved12;
  183. u64 reserved13;
  184. u32 size;
  185. u32 start;
  186. } inline_data;
  187. } u;
  188. };
  189. #define WC_SEND_RECEIVE EHCA_BMASK_IBM(0, 0)
  190. #define WC_IMM_DATA EHCA_BMASK_IBM(1, 1)
  191. #define WC_GRH_PRESENT EHCA_BMASK_IBM(2, 2)
  192. #define WC_SE_BIT EHCA_BMASK_IBM(3, 3)
  193. #define WC_STATUS_ERROR_BIT 0x80000000
  194. #define WC_STATUS_REMOTE_ERROR_FLAGS 0x0000F800
  195. #define WC_STATUS_PURGE_BIT 0x10
  196. #define WC_SEND_RECEIVE_BIT 0x80
  197. struct ehca_cqe {
  198. u64 work_request_id;
  199. u8 optype;
  200. u8 w_completion_flags;
  201. u16 reserved1;
  202. u32 nr_bytes_transferred;
  203. u32 immediate_data;
  204. u32 local_qp_number;
  205. u8 freed_resource_count;
  206. u8 service_level;
  207. u16 wqe_count;
  208. u32 qp_token;
  209. u32 qkey_ee_token;
  210. u32 remote_qp_number;
  211. u16 dlid;
  212. u16 rlid;
  213. u16 reserved2;
  214. u16 pkey_index;
  215. u32 cqe_timestamp;
  216. u32 wqe_timestamp;
  217. u8 wqe_timestamp_valid;
  218. u8 reserved3;
  219. u8 reserved4;
  220. u8 cqe_flags;
  221. u32 status;
  222. };
  223. struct ehca_eqe {
  224. u64 entry;
  225. };
  226. struct ehca_mrte {
  227. u64 starting_va;
  228. u64 length; /* length of memory region in bytes*/
  229. u32 pd;
  230. u8 key_instance;
  231. u8 pagesize;
  232. u8 mr_control;
  233. u8 local_remote_access_ctrl;
  234. u8 reserved[0x20 - 0x18];
  235. u64 at_pointer[4];
  236. };
  237. #endif /*_EHCA_QES_H_*/