Print this page
8368 remove warlock leftovers from usr/src/uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/ib/ibtl/ibtl_cq.c
+++ new/usr/src/uts/common/io/ib/ibtl/ibtl_cq.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #include <sys/ib/ibtl/impl/ibtl.h>
26 26
27 27 /*
28 28 * ibtl_cq.c
29 29 * These routines implement (most of) the verbs related to
30 30 * Completion Queues.
31 31 */
32 32
33 33 /*
34 34 * Globals
35 35 */
36 36
37 37 static char ibtf_cq[] = "ibtl_cq";
38 38
39 39 /*
40 40 * This file contains code for the TI CQ calls
41 41 */
42 42
43 43 /*
44 44 * ibt_alloc_cq_sched() - Reserve CQ scheduling class resources
45 45 *
46 46 * chan - IBT Channel Handle.
47 47 * load - Expected CQ load in class, 0 = unspecified
48 48 * sched_hdl_p - Returned scheduling handle.
49 49 */
50 50 ibt_status_t
51 51 ibt_alloc_cq_sched(ibt_hca_hdl_t hca_hdl, ibt_cq_sched_attr_t *attr,
52 52 ibt_sched_hdl_t *sched_hdl_p)
53 53 {
54 54 IBTF_DPRINTF_L3(ibtf_cq, "ibt_alloc_cq_sched(%p, %p, %p)",
55 55 hca_hdl, attr, sched_hdl_p);
56 56
57 57 return (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_cq_sched(
58 58 IBTL_HCA2CIHCA(hca_hdl), attr, sched_hdl_p));
59 59 }
60 60
61 61
62 62 /*
63 63 * ibt_free_cq_sched() - Free CQ scheduling class resources
64 64 *
65 65 * chan - IBT Channel Handle.
66 66 * sched_hdl - Scheduling handle returned from ibt_alloc_cq_sched.
67 67 * load - CQ load being removed.
68 68 */
69 69 ibt_status_t
70 70 ibt_free_cq_sched(ibt_hca_hdl_t hca_hdl, ibt_sched_hdl_t sched_hdl)
71 71 {
72 72 IBTF_DPRINTF_L3(ibtf_cq, "ibt_free_cq_sched(%p, %p)",
73 73 hca_hdl, sched_hdl);
74 74
75 75 return (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_free_cq_sched(
76 76 IBTL_HCA2CIHCA(hca_hdl), sched_hdl));
77 77 }
78 78
79 79
80 80 /*
81 81 *
82 82 * ibt_alloc_cq() - Allocate a completion queue
83 83 */
84 84 ibt_status_t
85 85 ibt_alloc_cq(ibt_hca_hdl_t hca_hdl, ibt_cq_attr_t *cq_attr,
86 86 ibt_cq_hdl_t *ibt_cq_p, uint32_t *real_size)
87 87 {
↓ open down ↓ |
87 lines elided |
↑ open up ↑ |
88 88 ibt_status_t status;
89 89 ibt_cq_hdl_t ibt_cq;
90 90
91 91 IBTF_DPRINTF_L3(ibtf_cq, "ibt_alloc_cq(%p, %p)",
92 92 hca_hdl, cq_attr);
93 93
94 94
95 95 ibt_cq = kmem_zalloc(sizeof (struct ibtl_cq_s), KM_SLEEP);
96 96 *ibt_cq_p = ibt_cq;
97 97
98 - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(ibt_cq->cq_in_thread))
99 - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(ibt_cq->cq_ibc_cq_hdl))
100 - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(ibt_cq->cq_hca))
101 98 /*
102 99 * Set the following values before creating CI CQ, to avoid race
103 100 * conditions on async callback.
104 101 */
105 102 ibt_cq->cq_hca = hca_hdl;
106 103
107 104 ibtl_qp_flow_control_enter();
108 105 status = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_cq(
109 106 IBTL_HCA2CIHCA(hca_hdl), ibt_cq, cq_attr, &ibt_cq->cq_ibc_cq_hdl,
110 107 real_size);
111 108 ibtl_qp_flow_control_exit();
112 109
113 110 if (status != IBT_SUCCESS) {
114 111 IBTF_DPRINTF_L2(ibtf_cq, "ibt_alloc_cq: "
115 112 "CI CQ handle allocation failed: status = %d", status);
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
116 113 kmem_free(ibt_cq, sizeof (struct ibtl_cq_s));
117 114 *ibt_cq_p = NULL;
118 115 return (status);
119 116 }
120 117
121 118 if (cq_attr->cq_flags & IBT_CQ_HANDLER_IN_THREAD) {
122 119 ibt_cq->cq_in_thread = 1;
123 120 /* We may want additional CQ threads now. */
124 121 ibtl_another_cq_handler_in_thread();
125 122 }
126 - _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(ibt_cq->cq_in_thread))
127 - _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(ibt_cq->cq_ibc_cq_hdl))
128 - _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(ibt_cq->cq_hca))
129 123
130 124 mutex_init(&ibt_cq->cq_mutex, NULL, MUTEX_DEFAULT, NULL);
131 125
132 126 /* Update the cq resource count */
133 127 atomic_inc_32(&hca_hdl->ha_cq_cnt);
134 128
135 129 return (IBT_SUCCESS);
136 130 }
137 131
138 132
139 133 /*
140 134 * ibt_free_cq() - Free a completion queue
141 135 *
142 136 */
143 137 ibt_status_t
144 138 ibt_free_cq(ibt_cq_hdl_t ibt_cq)
145 139 {
146 140 ibt_status_t status;
147 141 ibtl_hca_t *ibt_hca = ibt_cq->cq_hca;
148 142
149 143 IBTF_DPRINTF_L3(ibtf_cq, "ibt_free_cq(%p)", ibt_cq);
150 144
151 145 ibtl_free_cq_check(ibt_cq);
152 146
153 147 status = ((IBTL_CQ2CIHCAOPS_P(ibt_cq))->ibc_free_cq)
154 148 (IBTL_CQ2CIHCA(ibt_cq), ibt_cq->cq_ibc_cq_hdl);
155 149
156 150 if (status != IBT_SUCCESS) {
157 151 IBTF_DPRINTF_L2(ibtf_cq, "ibt_free_cq: "
158 152 "CI CQ handle de-allocation failed: status = %d", status);
159 153 return (status);
160 154 }
161 155
162 156 /* mutex_destroy(&ibt_cq->cq_mutex); */
163 157 ibtl_free_cq_async_check(ibt_cq);
164 158
165 159 /* Update the cq resource count */
166 160 atomic_dec_32(&ibt_hca->ha_cq_cnt);
167 161
168 162 return (status);
169 163 }
170 164
171 165
172 166 /*
173 167 * ibt_query_cq() - Returns the size of the cq
174 168 */
175 169 ibt_status_t
176 170 ibt_query_cq(ibt_cq_hdl_t ibt_cq, uint32_t *entries_p, uint_t *count_p,
177 171 uint_t *usec_p, ibt_cq_handler_id_t *hid_p)
178 172 {
179 173 IBTF_DPRINTF_L3(ibtf_cq, "ibt_query_cq(%p)", ibt_cq);
180 174
181 175 return (IBTL_CQ2CIHCAOPS_P(ibt_cq)->ibc_query_cq(IBTL_CQ2CIHCA(ibt_cq),
182 176 ibt_cq->cq_ibc_cq_hdl, entries_p, count_p, usec_p, hid_p));
183 177 }
184 178
185 179
186 180 /*
187 181 * ibt_resize_cq() - Change the size of a cq.
188 182 */
189 183 ibt_status_t
190 184 ibt_resize_cq(ibt_cq_hdl_t ibt_cq, uint32_t new_sz, uint32_t *real_sz)
191 185 {
192 186 IBTF_DPRINTF_L3(ibtf_cq, "ibt_resize_cq(%p, %d)", ibt_cq, new_sz);
193 187
194 188 return (IBTL_CQ2CIHCAOPS_P(ibt_cq)->ibc_resize_cq(IBTL_CQ2CIHCA(ibt_cq),
195 189 ibt_cq->cq_ibc_cq_hdl, new_sz, real_sz));
196 190 }
197 191
198 192 ibt_status_t
199 193 ibt_modify_cq(ibt_cq_hdl_t ibt_cq, uint_t count, uint_t usec,
200 194 ibt_cq_handler_id_t hid)
201 195 {
202 196 IBTF_DPRINTF_L3(ibtf_cq, "ibt_modify_cq(%p, %d, %d, %d)", ibt_cq, count,
203 197 usec, hid);
204 198
205 199 return (IBTL_CQ2CIHCAOPS_P(ibt_cq)->ibc_modify_cq(IBTL_CQ2CIHCA(ibt_cq),
206 200 ibt_cq->cq_ibc_cq_hdl, count, usec, hid));
207 201 }
208 202
209 203
210 204 /*
211 205 * ibt_poll_cq()
212 206 * Poll the specified CQ for a work request (WR) completion. If a CQ
213 207 * contains a completed WR, the completed WR at the head of the CQ is
214 208 * returned.
215 209 *
216 210 * ibt_cq The CQ handle.
217 211 *
218 212 * work_completions An array of work completions.
219 213 *
220 214 * num_wc Size of the Work completion array. The
221 215 * requested number of completions.
222 216 *
223 217 * num_polled The actual number of completions returned.
224 218 *
225 219 */
↓ open down ↓ |
87 lines elided |
↑ open up ↑ |
226 220 ibt_status_t
227 221 ibt_poll_cq(ibt_cq_hdl_t ibt_cq, ibt_wc_t *work_completions, uint_t num_wc,
228 222 uint_t *num_polled)
229 223 {
230 224 IBTF_DPRINTF_L4(ibtf_cq, "ibt_poll_cq(%p)", ibt_cq);
231 225
232 226 return (IBTL_CQ2CIHCAOPS_P(ibt_cq)->ibc_poll_cq(IBTL_CQ2CIHCA(ibt_cq),
233 227 ibt_cq->cq_ibc_cq_hdl, work_completions, num_wc, num_polled));
234 228 }
235 229
236 -_NOTE(SCHEME_PROTECTS_DATA("client managed", ibtl_cq_s::cq_clnt_private))
237 -
238 230 /*
239 231 * ibt_set_cq_private - Sets the private data on a given CQ
240 232 *
241 233 * ibt_cq The ibt_cq_hdl_t of the allocated CQ.
242 234 * clnt_private The client private data.
243 235 */
244 236 void
245 237 ibt_set_cq_private(ibt_cq_hdl_t ibt_cq, void *clnt_private)
246 238 {
247 239 ibt_cq->cq_clnt_private = clnt_private;
248 240 }
249 241
250 242
251 243 /*
252 244 * ibt_get_cq_private - Retrieves the private data for a given CQ
253 245 *
254 246 * ibt_cq The ibt_cq_hdl_t of the allocated CQ.
255 247 */
256 248 void *
257 249 ibt_get_cq_private(ibt_cq_hdl_t ibt_cq)
258 250 {
259 251 return (ibt_cq->cq_clnt_private);
260 252 }
261 253
262 254 /*
263 255 * ibt_query_cq_handler_id - Retrieves the attributes of a cq_handler_id.
264 256 */
265 257 ibt_status_t
266 258 ibt_query_cq_handler_id(ibt_hca_hdl_t hca_hdl,
267 259 ibt_cq_handler_id_t hid, ibt_cq_handler_attr_t *attrs)
268 260 {
269 261 IBTF_DPRINTF_L3(ibtf_cq, "ibt_query_cq_handler(%p, %d, %p)",
270 262 hca_hdl, hid, attrs);
271 263
272 264 return (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_query_cq_handler_id(
273 265 IBTL_HCA2CIHCA(hca_hdl), hid, attrs));
274 266 }
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX