i40iw_verbs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*******************************************************************************
  2. *
  3. * Copyright (c) 2015-2016 Intel Corporation. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenFabrics.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. *
  33. *******************************************************************************/
  34. #ifndef I40IW_VERBS_H
  35. #define I40IW_VERBS_H
  36. struct i40iw_ucontext {
  37. struct ib_ucontext ibucontext;
  38. struct i40iw_device *iwdev;
  39. struct list_head cq_reg_mem_list;
  40. spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
  41. struct list_head qp_reg_mem_list;
  42. spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
  43. };
  44. struct i40iw_pd {
  45. struct ib_pd ibpd;
  46. struct i40iw_sc_pd sc_pd;
  47. atomic_t usecount;
  48. };
  49. struct i40iw_hmc_pble {
  50. union {
  51. u32 idx;
  52. dma_addr_t addr;
  53. };
  54. };
  55. struct i40iw_cq_mr {
  56. struct i40iw_hmc_pble cq_pbl;
  57. dma_addr_t shadow;
  58. };
  59. struct i40iw_qp_mr {
  60. struct i40iw_hmc_pble sq_pbl;
  61. struct i40iw_hmc_pble rq_pbl;
  62. dma_addr_t shadow;
  63. struct page *sq_page;
  64. };
  65. struct i40iw_pbl {
  66. struct list_head list;
  67. union {
  68. struct i40iw_qp_mr qp_mr;
  69. struct i40iw_cq_mr cq_mr;
  70. };
  71. bool pbl_allocated;
  72. u64 user_base;
  73. struct i40iw_pble_alloc pble_alloc;
  74. struct i40iw_mr *iwmr;
  75. };
  76. #define MAX_SAVE_PAGE_ADDRS 4
  77. struct i40iw_mr {
  78. union {
  79. struct ib_mr ibmr;
  80. struct ib_mw ibmw;
  81. struct ib_fmr ibfmr;
  82. };
  83. struct ib_umem *region;
  84. u16 type;
  85. u32 page_cnt;
  86. u32 npages;
  87. u32 stag;
  88. u64 length;
  89. u64 pgaddrmem[MAX_SAVE_PAGE_ADDRS];
  90. struct i40iw_pbl iwpbl;
  91. };
  92. struct i40iw_cq {
  93. struct ib_cq ibcq;
  94. struct i40iw_sc_cq sc_cq;
  95. u16 cq_head;
  96. u16 cq_size;
  97. u16 cq_number;
  98. bool user_mode;
  99. u32 polled_completions;
  100. u32 cq_mem_size;
  101. struct i40iw_dma_mem kmem;
  102. spinlock_t lock; /* for poll cq */
  103. struct i40iw_pbl *iwpbl;
  104. };
  105. struct disconn_work {
  106. struct work_struct work;
  107. struct i40iw_qp *iwqp;
  108. };
  109. struct iw_cm_id;
  110. struct ietf_mpa_frame;
  111. struct i40iw_ud_file;
  112. struct i40iw_qp_kmode {
  113. struct i40iw_dma_mem dma_mem;
  114. u64 *wrid_mem;
  115. };
  116. struct i40iw_qp {
  117. struct ib_qp ibqp;
  118. struct i40iw_sc_qp sc_qp;
  119. struct i40iw_device *iwdev;
  120. struct i40iw_cq *iwscq;
  121. struct i40iw_cq *iwrcq;
  122. struct i40iw_pd *iwpd;
  123. struct i40iw_qp_host_ctx_info ctx_info;
  124. struct i40iwarp_offload_info iwarp_info;
  125. void *allocated_buffer;
  126. atomic_t refcount;
  127. struct iw_cm_id *cm_id;
  128. void *cm_node;
  129. struct ib_mr *lsmm_mr;
  130. struct work_struct work;
  131. enum ib_qp_state ibqp_state;
  132. u32 iwarp_state;
  133. u32 qp_mem_size;
  134. u32 last_aeq;
  135. atomic_t close_timer_started;
  136. spinlock_t lock; /* for post work requests */
  137. struct i40iw_qp_context *iwqp_context;
  138. void *pbl_vbase;
  139. dma_addr_t pbl_pbase;
  140. struct page *page;
  141. u8 active_conn:1;
  142. u8 user_mode:1;
  143. u8 hte_added:1;
  144. u8 flush_issued:1;
  145. u8 destroyed:1;
  146. u8 sig_all:1;
  147. u8 pau_mode:1;
  148. u8 rsvd:1;
  149. u16 term_sq_flush_code;
  150. u16 term_rq_flush_code;
  151. u8 hw_iwarp_state;
  152. u8 hw_tcp_state;
  153. struct i40iw_qp_kmode kqp;
  154. struct i40iw_dma_mem host_ctx;
  155. struct timer_list terminate_timer;
  156. struct i40iw_pbl *iwpbl;
  157. struct i40iw_dma_mem q2_ctx_mem;
  158. struct i40iw_dma_mem ietf_mem;
  159. struct completion sq_drained;
  160. struct completion rq_drained;
  161. };
  162. #endif