Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 1 | /* |
Tatyana Nikolova | c5488c5 | 2011-11-28 14:22:29 -0600 | [diff] [blame] | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 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 | |
| 35 | #ifndef NES_VERBS_H |
| 36 | #define NES_VERBS_H |
| 37 | |
| 38 | struct nes_device; |
| 39 | |
| 40 | #define NES_MAX_USER_DB_REGIONS 4096 |
| 41 | #define NES_MAX_USER_WQ_REGIONS 4096 |
| 42 | |
Don Wood | 8b1c9dc | 2009-09-05 20:36:38 -0700 | [diff] [blame] | 43 | #define NES_TERM_SENT 0x01 |
| 44 | #define NES_TERM_RCVD 0x02 |
| 45 | #define NES_TERM_DONE 0x04 |
| 46 | |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 47 | struct nes_ucontext { |
| 48 | struct ib_ucontext ibucontext; |
| 49 | struct nes_device *nesdev; |
| 50 | unsigned long mmap_wq_offset; |
| 51 | unsigned long mmap_cq_offset; /* to be removed */ |
| 52 | int index; /* rnic index (minor) */ |
| 53 | unsigned long allocated_doorbells[BITS_TO_LONGS(NES_MAX_USER_DB_REGIONS)]; |
| 54 | u16 mmap_db_index[NES_MAX_USER_DB_REGIONS]; |
| 55 | u16 first_free_db; |
| 56 | unsigned long allocated_wqs[BITS_TO_LONGS(NES_MAX_USER_WQ_REGIONS)]; |
| 57 | struct nes_qp *mmap_nesqp[NES_MAX_USER_WQ_REGIONS]; |
| 58 | u16 first_free_wq; |
| 59 | struct list_head cq_reg_mem_list; |
| 60 | struct list_head qp_reg_mem_list; |
| 61 | u32 mcrqf; |
| 62 | atomic_t usecnt; |
| 63 | }; |
| 64 | |
| 65 | struct nes_pd { |
| 66 | struct ib_pd ibpd; |
| 67 | u16 pd_id; |
| 68 | atomic_t sqp_count; |
| 69 | u16 mmap_db_index; |
| 70 | }; |
| 71 | |
| 72 | struct nes_mr { |
| 73 | union { |
| 74 | struct ib_mr ibmr; |
| 75 | struct ib_mw ibmw; |
| 76 | struct ib_fmr ibfmr; |
| 77 | }; |
| 78 | struct ib_umem *region; |
| 79 | u16 pbls_used; |
| 80 | u8 mode; |
| 81 | u8 pbl_4k; |
| 82 | }; |
| 83 | |
| 84 | struct nes_hw_pb { |
| 85 | __le32 pa_low; |
| 86 | __le32 pa_high; |
| 87 | }; |
| 88 | |
| 89 | struct nes_vpbl { |
| 90 | dma_addr_t pbl_pbase; |
| 91 | struct nes_hw_pb *pbl_vbase; |
| 92 | }; |
| 93 | |
| 94 | struct nes_root_vpbl { |
| 95 | dma_addr_t pbl_pbase; |
| 96 | struct nes_hw_pb *pbl_vbase; |
| 97 | struct nes_vpbl *leaf_vpbl; |
| 98 | }; |
| 99 | |
| 100 | struct nes_fmr { |
| 101 | struct nes_mr nesmr; |
| 102 | u32 leaf_pbl_cnt; |
| 103 | struct nes_root_vpbl root_vpbl; |
| 104 | struct ib_qp *ib_qp; |
| 105 | int access_rights; |
| 106 | struct ib_fmr_attr attr; |
| 107 | }; |
| 108 | |
| 109 | struct nes_av; |
| 110 | |
| 111 | struct nes_cq { |
| 112 | struct ib_cq ibcq; |
| 113 | struct nes_hw_cq hw_cq; |
| 114 | u32 polled_completions; |
| 115 | u32 cq_mem_size; |
| 116 | spinlock_t lock; |
| 117 | u8 virtual_cq; |
| 118 | u8 pad[3]; |
Miroslaw Walukiewicz | 5d1af5c | 2009-04-21 16:16:48 -0700 | [diff] [blame] | 119 | u32 mcrqf; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | struct nes_wq { |
| 123 | spinlock_t lock; |
| 124 | }; |
| 125 | |
Don Wood | 873fcdd | 2009-09-05 20:36:37 -0700 | [diff] [blame] | 126 | struct disconn_work { |
| 127 | struct work_struct work; |
| 128 | struct nes_qp *nesqp; |
| 129 | }; |
| 130 | |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 131 | struct iw_cm_id; |
| 132 | struct ietf_mpa_frame; |
| 133 | |
| 134 | struct nes_qp { |
| 135 | struct ib_qp ibqp; |
| 136 | void *allocated_buffer; |
| 137 | struct iw_cm_id *cm_id; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 138 | struct nes_cq *nesscq; |
| 139 | struct nes_cq *nesrcq; |
| 140 | struct nes_pd *nespd; |
| 141 | void *cm_node; /* handle of the node this QP is associated with */ |
Tatyana Nikolova | 615eb71 | 2011-09-25 20:17:46 +0530 | [diff] [blame] | 142 | void *ietf_frame; |
| 143 | u8 ietf_frame_size; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 144 | dma_addr_t ietf_frame_pbase; |
Faisal Latif | c12e56e | 2009-03-12 14:34:59 -0700 | [diff] [blame] | 145 | struct ib_mr *lsmm_mr; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 146 | struct nes_hw_qp hwqp; |
| 147 | struct work_struct work; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 148 | enum ib_qp_state ibqp_state; |
| 149 | u32 iwarp_state; |
| 150 | u32 hte_index; |
| 151 | u32 last_aeq; |
| 152 | u32 qp_mem_size; |
| 153 | atomic_t refcount; |
| 154 | atomic_t close_timer_started; |
| 155 | u32 mmap_sq_db_index; |
| 156 | u32 mmap_rq_db_index; |
| 157 | spinlock_t lock; |
Faisal Latif | 0f0bee8 | 2011-09-25 20:34:00 -0500 | [diff] [blame] | 158 | spinlock_t pau_lock; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 159 | struct nes_qp_context *nesqp_context; |
| 160 | dma_addr_t nesqp_context_pbase; |
| 161 | void *pbl_vbase; |
| 162 | dma_addr_t pbl_pbase; |
| 163 | struct page *page; |
Don Wood | 8b1c9dc | 2009-09-05 20:36:38 -0700 | [diff] [blame] | 164 | struct timer_list terminate_timer; |
| 165 | enum ib_event_type terminate_eventtype; |
Faisal Latif | 0f0bee8 | 2011-09-25 20:34:00 -0500 | [diff] [blame] | 166 | struct sk_buff_head pau_list; |
| 167 | u32 pau_rcv_nxt; |
Chien Tung | d14152d | 2009-12-09 15:21:56 -0800 | [diff] [blame] | 168 | u16 active_conn:1; |
| 169 | u16 skip_lsmm:1; |
| 170 | u16 user_mode:1; |
| 171 | u16 hte_added:1; |
| 172 | u16 flush_issued:1; |
| 173 | u16 destroyed:1; |
Chien Tung | d14152d | 2009-12-09 15:21:56 -0800 | [diff] [blame] | 174 | u16 sig_all:1; |
Faisal Latif | 0f0bee8 | 2011-09-25 20:34:00 -0500 | [diff] [blame] | 175 | u16 pau_mode:1; |
| 176 | u16 rsvd:8; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 177 | u16 private_data_len; |
Don Wood | 4b281fa | 2009-09-05 20:36:38 -0700 | [diff] [blame] | 178 | u16 term_sq_flush_code; |
| 179 | u16 term_rq_flush_code; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 180 | u8 hw_iwarp_state; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 181 | u8 hw_tcp_state; |
Don Wood | 8b1c9dc | 2009-09-05 20:36:38 -0700 | [diff] [blame] | 182 | u8 term_flags; |
Faisal Latif | d2fa9b26 | 2009-12-09 15:54:28 -0800 | [diff] [blame] | 183 | u8 sq_kmapped; |
Faisal Latif | 0f0bee8 | 2011-09-25 20:34:00 -0500 | [diff] [blame] | 184 | u8 pau_busy; |
| 185 | u8 pau_pending; |
| 186 | u8 pau_state; |
Tatyana Nikolova | 43adff3 | 2014-03-11 14:20:17 -0500 | [diff] [blame] | 187 | __u64 nesuqp_addr; |
Glenn Streiff | 3c2d774 | 2008-02-04 20:20:45 -0800 | [diff] [blame] | 188 | }; |
| 189 | #endif /* NES_VERBS_H */ |