nes_verbs.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved.
  3. * Copyright (c) 2005 Open Grid Computing, Inc. 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. * OpenIB.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 NES_VERBS_H
  35. #define NES_VERBS_H
  36. struct nes_device;
  37. #define NES_MAX_USER_DB_REGIONS 4096
  38. #define NES_MAX_USER_WQ_REGIONS 4096
  39. #define NES_TERM_SENT 0x01
  40. #define NES_TERM_RCVD 0x02
  41. #define NES_TERM_DONE 0x04
  42. struct nes_ucontext {
  43. struct ib_ucontext ibucontext;
  44. struct nes_device *nesdev;
  45. unsigned long mmap_wq_offset;
  46. unsigned long mmap_cq_offset; /* to be removed */
  47. int index; /* rnic index (minor) */
  48. unsigned long allocated_doorbells[BITS_TO_LONGS(NES_MAX_USER_DB_REGIONS)];
  49. u16 mmap_db_index[NES_MAX_USER_DB_REGIONS];
  50. u16 first_free_db;
  51. unsigned long allocated_wqs[BITS_TO_LONGS(NES_MAX_USER_WQ_REGIONS)];
  52. struct nes_qp *mmap_nesqp[NES_MAX_USER_WQ_REGIONS];
  53. u16 first_free_wq;
  54. struct list_head cq_reg_mem_list;
  55. struct list_head qp_reg_mem_list;
  56. u32 mcrqf;
  57. atomic_t usecnt;
  58. };
  59. struct nes_pd {
  60. struct ib_pd ibpd;
  61. u16 pd_id;
  62. atomic_t sqp_count;
  63. u16 mmap_db_index;
  64. };
  65. struct nes_mr {
  66. union {
  67. struct ib_mr ibmr;
  68. struct ib_mw ibmw;
  69. struct ib_fmr ibfmr;
  70. };
  71. struct ib_umem *region;
  72. u16 pbls_used;
  73. u8 mode;
  74. u8 pbl_4k;
  75. __le64 *pages;
  76. dma_addr_t paddr;
  77. u32 max_pages;
  78. u32 npages;
  79. };
  80. struct nes_hw_pb {
  81. __le32 pa_low;
  82. __le32 pa_high;
  83. };
  84. struct nes_vpbl {
  85. dma_addr_t pbl_pbase;
  86. struct nes_hw_pb *pbl_vbase;
  87. };
  88. struct nes_root_vpbl {
  89. dma_addr_t pbl_pbase;
  90. struct nes_hw_pb *pbl_vbase;
  91. struct nes_vpbl *leaf_vpbl;
  92. };
  93. struct nes_fmr {
  94. struct nes_mr nesmr;
  95. u32 leaf_pbl_cnt;
  96. struct nes_root_vpbl root_vpbl;
  97. struct ib_qp *ib_qp;
  98. int access_rights;
  99. struct ib_fmr_attr attr;
  100. };
  101. struct nes_av;
  102. struct nes_cq {
  103. struct ib_cq ibcq;
  104. struct nes_hw_cq hw_cq;
  105. u32 polled_completions;
  106. u32 cq_mem_size;
  107. spinlock_t lock;
  108. u8 virtual_cq;
  109. u8 pad[3];
  110. u32 mcrqf;
  111. };
  112. struct nes_wq {
  113. spinlock_t lock;
  114. };
  115. struct disconn_work {
  116. struct work_struct work;
  117. struct nes_qp *nesqp;
  118. };
  119. struct iw_cm_id;
  120. struct ietf_mpa_frame;
  121. struct nes_qp {
  122. struct ib_qp ibqp;
  123. void *allocated_buffer;
  124. struct iw_cm_id *cm_id;
  125. struct nes_cq *nesscq;
  126. struct nes_cq *nesrcq;
  127. struct nes_pd *nespd;
  128. void *cm_node; /* handle of the node this QP is associated with */
  129. void *ietf_frame;
  130. u8 ietf_frame_size;
  131. dma_addr_t ietf_frame_pbase;
  132. struct ib_mr *lsmm_mr;
  133. struct nes_hw_qp hwqp;
  134. struct work_struct work;
  135. enum ib_qp_state ibqp_state;
  136. u32 iwarp_state;
  137. u32 hte_index;
  138. u32 last_aeq;
  139. u32 qp_mem_size;
  140. atomic_t refcount;
  141. atomic_t close_timer_started;
  142. u32 mmap_sq_db_index;
  143. u32 mmap_rq_db_index;
  144. spinlock_t lock;
  145. spinlock_t pau_lock;
  146. struct nes_qp_context *nesqp_context;
  147. dma_addr_t nesqp_context_pbase;
  148. void *pbl_vbase;
  149. dma_addr_t pbl_pbase;
  150. struct page *page;
  151. struct timer_list terminate_timer;
  152. enum ib_event_type terminate_eventtype;
  153. struct sk_buff_head pau_list;
  154. u32 pau_rcv_nxt;
  155. u16 active_conn:1;
  156. u16 skip_lsmm:1;
  157. u16 user_mode:1;
  158. u16 hte_added:1;
  159. u16 flush_issued:1;
  160. u16 destroyed:1;
  161. u16 sig_all:1;
  162. u16 pau_mode:1;
  163. u16 rsvd:8;
  164. u16 private_data_len;
  165. u16 term_sq_flush_code;
  166. u16 term_rq_flush_code;
  167. u8 hw_iwarp_state;
  168. u8 hw_tcp_state;
  169. u8 term_flags;
  170. u8 sq_kmapped;
  171. u8 pau_busy;
  172. u8 pau_pending;
  173. u8 pau_state;
  174. __u64 nesuqp_addr;
  175. struct completion sq_drained;
  176. struct completion rq_drained;
  177. };
  178. struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
  179. u64 addr, u64 size, int acc, u64 *iova_start);
  180. #endif /* NES_VERBS_H */