nes_verbs.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright (c) 2006 - 2008 NetEffect, Inc. 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. struct nes_ucontext {
  40. struct ib_ucontext ibucontext;
  41. struct nes_device *nesdev;
  42. unsigned long mmap_wq_offset;
  43. unsigned long mmap_cq_offset; /* to be removed */
  44. int index; /* rnic index (minor) */
  45. unsigned long allocated_doorbells[BITS_TO_LONGS(NES_MAX_USER_DB_REGIONS)];
  46. u16 mmap_db_index[NES_MAX_USER_DB_REGIONS];
  47. u16 first_free_db;
  48. unsigned long allocated_wqs[BITS_TO_LONGS(NES_MAX_USER_WQ_REGIONS)];
  49. struct nes_qp *mmap_nesqp[NES_MAX_USER_WQ_REGIONS];
  50. u16 first_free_wq;
  51. struct list_head cq_reg_mem_list;
  52. struct list_head qp_reg_mem_list;
  53. u32 mcrqf;
  54. atomic_t usecnt;
  55. };
  56. struct nes_pd {
  57. struct ib_pd ibpd;
  58. u16 pd_id;
  59. atomic_t sqp_count;
  60. u16 mmap_db_index;
  61. };
  62. struct nes_mr {
  63. union {
  64. struct ib_mr ibmr;
  65. struct ib_mw ibmw;
  66. struct ib_fmr ibfmr;
  67. };
  68. struct ib_umem *region;
  69. u16 pbls_used;
  70. u8 mode;
  71. u8 pbl_4k;
  72. };
  73. struct nes_hw_pb {
  74. __le32 pa_low;
  75. __le32 pa_high;
  76. };
  77. struct nes_vpbl {
  78. dma_addr_t pbl_pbase;
  79. struct nes_hw_pb *pbl_vbase;
  80. };
  81. struct nes_root_vpbl {
  82. dma_addr_t pbl_pbase;
  83. struct nes_hw_pb *pbl_vbase;
  84. struct nes_vpbl *leaf_vpbl;
  85. };
  86. struct nes_fmr {
  87. struct nes_mr nesmr;
  88. u32 leaf_pbl_cnt;
  89. struct nes_root_vpbl root_vpbl;
  90. struct ib_qp *ib_qp;
  91. int access_rights;
  92. struct ib_fmr_attr attr;
  93. };
  94. struct nes_av;
  95. struct nes_cq {
  96. struct ib_cq ibcq;
  97. struct nes_hw_cq hw_cq;
  98. u32 polled_completions;
  99. u32 cq_mem_size;
  100. spinlock_t lock;
  101. u8 virtual_cq;
  102. u8 pad[3];
  103. };
  104. struct nes_wq {
  105. spinlock_t lock;
  106. };
  107. struct iw_cm_id;
  108. struct ietf_mpa_frame;
  109. struct nes_qp {
  110. struct ib_qp ibqp;
  111. void *allocated_buffer;
  112. struct iw_cm_id *cm_id;
  113. struct workqueue_struct *wq;
  114. struct work_struct disconn_work;
  115. struct nes_cq *nesscq;
  116. struct nes_cq *nesrcq;
  117. struct nes_pd *nespd;
  118. void *cm_node; /* handle of the node this QP is associated with */
  119. struct ietf_mpa_frame *ietf_frame;
  120. dma_addr_t ietf_frame_pbase;
  121. wait_queue_head_t state_waitq;
  122. unsigned long socket;
  123. struct nes_hw_qp hwqp;
  124. struct work_struct work;
  125. struct work_struct ae_work;
  126. enum ib_qp_state ibqp_state;
  127. u32 iwarp_state;
  128. u32 hte_index;
  129. u32 last_aeq;
  130. u32 qp_mem_size;
  131. atomic_t refcount;
  132. atomic_t close_timer_started;
  133. u32 mmap_sq_db_index;
  134. u32 mmap_rq_db_index;
  135. spinlock_t lock;
  136. struct nes_qp_context *nesqp_context;
  137. dma_addr_t nesqp_context_pbase;
  138. void *pbl_vbase;
  139. dma_addr_t pbl_pbase;
  140. struct page *page;
  141. wait_queue_head_t kick_waitq;
  142. u16 in_disconnect;
  143. u16 private_data_len;
  144. u8 active_conn;
  145. u8 skip_lsmm;
  146. u8 user_mode;
  147. u8 hte_added;
  148. u8 hw_iwarp_state;
  149. u8 flush_issued;
  150. u8 hw_tcp_state;
  151. u8 disconn_pending;
  152. u8 destroyed;
  153. };
  154. #endif /* NES_VERBS_H */