blob: 7df34fea28882a657c1cf815d53a3dabd0b0871e [file] [log] [blame]
Glenn Streiff3c2d7742008-02-04 20:20:45 -08001/*
Chien Tungcd6853d2009-03-06 15:12:10 -08002 * Copyright (c) 2006 - 2009 Intel-NE, Inc. All rights reserved.
Glenn Streiff3c2d7742008-02-04 20:20:45 -08003 * 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
38struct nes_device;
39
40#define NES_MAX_USER_DB_REGIONS 4096
41#define NES_MAX_USER_WQ_REGIONS 4096
42
43struct nes_ucontext {
44 struct ib_ucontext ibucontext;
45 struct nes_device *nesdev;
46 unsigned long mmap_wq_offset;
47 unsigned long mmap_cq_offset; /* to be removed */
48 int index; /* rnic index (minor) */
49 unsigned long allocated_doorbells[BITS_TO_LONGS(NES_MAX_USER_DB_REGIONS)];
50 u16 mmap_db_index[NES_MAX_USER_DB_REGIONS];
51 u16 first_free_db;
52 unsigned long allocated_wqs[BITS_TO_LONGS(NES_MAX_USER_WQ_REGIONS)];
53 struct nes_qp *mmap_nesqp[NES_MAX_USER_WQ_REGIONS];
54 u16 first_free_wq;
55 struct list_head cq_reg_mem_list;
56 struct list_head qp_reg_mem_list;
57 u32 mcrqf;
58 atomic_t usecnt;
59};
60
61struct nes_pd {
62 struct ib_pd ibpd;
63 u16 pd_id;
64 atomic_t sqp_count;
65 u16 mmap_db_index;
66};
67
68struct nes_mr {
69 union {
70 struct ib_mr ibmr;
71 struct ib_mw ibmw;
72 struct ib_fmr ibfmr;
73 };
74 struct ib_umem *region;
75 u16 pbls_used;
76 u8 mode;
77 u8 pbl_4k;
78};
79
80struct nes_hw_pb {
81 __le32 pa_low;
82 __le32 pa_high;
83};
84
85struct nes_vpbl {
86 dma_addr_t pbl_pbase;
87 struct nes_hw_pb *pbl_vbase;
88};
89
90struct nes_root_vpbl {
91 dma_addr_t pbl_pbase;
92 struct nes_hw_pb *pbl_vbase;
93 struct nes_vpbl *leaf_vpbl;
94};
95
96struct nes_fmr {
97 struct nes_mr nesmr;
98 u32 leaf_pbl_cnt;
99 struct nes_root_vpbl root_vpbl;
100 struct ib_qp *ib_qp;
101 int access_rights;
102 struct ib_fmr_attr attr;
103};
104
105struct nes_av;
106
107struct nes_cq {
108 struct ib_cq ibcq;
109 struct nes_hw_cq hw_cq;
110 u32 polled_completions;
111 u32 cq_mem_size;
112 spinlock_t lock;
113 u8 virtual_cq;
114 u8 pad[3];
Miroslaw Walukiewicz5d1af5c2009-04-21 16:16:48 -0700115 u32 mcrqf;
Glenn Streiff3c2d7742008-02-04 20:20:45 -0800116};
117
118struct nes_wq {
119 spinlock_t lock;
120};
121
Don Wood873fcdd2009-09-05 20:36:37 -0700122struct disconn_work {
123 struct work_struct work;
124 struct nes_qp *nesqp;
125};
126
Glenn Streiff3c2d7742008-02-04 20:20:45 -0800127struct iw_cm_id;
128struct ietf_mpa_frame;
129
130struct nes_qp {
131 struct ib_qp ibqp;
132 void *allocated_buffer;
133 struct iw_cm_id *cm_id;
134 struct workqueue_struct *wq;
Glenn Streiff3c2d7742008-02-04 20:20:45 -0800135 struct nes_cq *nesscq;
136 struct nes_cq *nesrcq;
137 struct nes_pd *nespd;
138 void *cm_node; /* handle of the node this QP is associated with */
139 struct ietf_mpa_frame *ietf_frame;
140 dma_addr_t ietf_frame_pbase;
141 wait_queue_head_t state_waitq;
Faisal Latifc12e56e2009-03-12 14:34:59 -0700142 struct ib_mr *lsmm_mr;
Glenn Streiff3c2d7742008-02-04 20:20:45 -0800143 unsigned long socket;
144 struct nes_hw_qp hwqp;
145 struct work_struct work;
146 struct work_struct ae_work;
147 enum ib_qp_state ibqp_state;
148 u32 iwarp_state;
149 u32 hte_index;
150 u32 last_aeq;
151 u32 qp_mem_size;
152 atomic_t refcount;
153 atomic_t close_timer_started;
154 u32 mmap_sq_db_index;
155 u32 mmap_rq_db_index;
156 spinlock_t lock;
157 struct nes_qp_context *nesqp_context;
158 dma_addr_t nesqp_context_pbase;
159 void *pbl_vbase;
160 dma_addr_t pbl_pbase;
161 struct page *page;
162 wait_queue_head_t kick_waitq;
163 u16 in_disconnect;
164 u16 private_data_len;
165 u8 active_conn;
166 u8 skip_lsmm;
167 u8 user_mode;
168 u8 hte_added;
169 u8 hw_iwarp_state;
170 u8 flush_issued;
171 u8 hw_tcp_state;
Glenn Streiff3c2d7742008-02-04 20:20:45 -0800172 u8 destroyed;
173};
174#endif /* NES_VERBS_H */