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_srq.c
+++ new/usr/src/uts/common/io/ib/ibtl/ibtl_srq.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_srq.c
29 29 * These routines implement (most of) the verbs related to
30 30 * Shared Receive Queues.
31 31 */
32 32
33 33 /*
34 34 * Globals
35 35 */
36 36
37 37 static char ibtf_srq[] = "ibtl_srq";
38 38
39 39 /*
40 40 * This file contains code for the TI SRQ calls
41 41 */
42 42
43 43 /*
44 44 *
45 45 * ibt_alloc_srq() - Allocate a completion queue
46 46 */
47 47 ibt_status_t
48 48 ibt_alloc_srq(ibt_hca_hdl_t hca_hdl, ibt_srq_flags_t flags, ibt_pd_hdl_t pd,
49 49 ibt_srq_sizes_t *srq_sizes, ibt_srq_hdl_t *ibt_srq_p,
50 50 ibt_srq_sizes_t *real_sizes_p)
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
51 51 {
52 52 ibt_status_t status;
53 53 ibt_srq_hdl_t ibt_srq;
54 54
55 55 IBTF_DPRINTF_L3(ibtf_srq, "ibt_alloc_srq(%p, %p)",
56 56 hca_hdl, srq_sizes);
57 57
58 58 ibt_srq = kmem_zalloc(sizeof (struct ibtl_srq_s), KM_SLEEP);
59 59 *ibt_srq_p = ibt_srq;
60 60
61 - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(ibt_srq->srq_ibc_srq_hdl))
62 - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(ibt_srq->srq_hca))
63 61 /*
64 62 * Set the following values before creating CI SRQ, to avoid race
65 63 * conditions on async callback.
66 64 */
67 65 ibt_srq->srq_hca = hca_hdl;
68 66
69 67 status = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_srq(
70 68 IBTL_HCA2CIHCA(hca_hdl), flags, ibt_srq, pd, srq_sizes,
71 69 &ibt_srq->srq_ibc_srq_hdl, real_sizes_p);
72 70
73 71 if (status != IBT_SUCCESS) {
74 72 IBTF_DPRINTF_L2(ibtf_srq, "ibt_alloc_srq: "
75 73 "CI SRQ handle allocation failed: status = %d", status);
76 74 kmem_free(ibt_srq, sizeof (struct ibtl_srq_s));
77 75 *ibt_srq_p = NULL;
78 76 return (status);
79 77 }
80 78
81 - _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(ibt_srq->srq_ibc_srq_hdl))
82 - _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(ibt_srq->srq_hca))
83 -
84 79 /* Update the srq resource count */
85 80 atomic_inc_32(&hca_hdl->ha_srq_cnt);
86 81
87 82 return (IBT_SUCCESS);
88 83 }
89 84
90 85
91 86 /*
92 87 * ibt_free_srq() - Free a shared receive queue
93 88 *
94 89 */
95 90 ibt_status_t
96 91 ibt_free_srq(ibt_srq_hdl_t ibt_srq)
97 92 {
98 93 ibt_status_t status;
99 94 ibtl_hca_t *ibt_hca = ibt_srq->srq_hca;
100 95
101 96 IBTF_DPRINTF_L3(ibtf_srq, "ibt_free_srq(%p)", ibt_srq);
102 97
103 98 status = ((IBTL_SRQ2CIHCAOPS_P(ibt_srq))->ibc_free_srq)
104 99 (IBTL_SRQ2CIHCA(ibt_srq), ibt_srq->srq_ibc_srq_hdl);
105 100
106 101 if (status != IBT_SUCCESS) {
107 102 IBTF_DPRINTF_L2(ibtf_srq, "ibt_free_srq: "
108 103 "CI SRQ handle de-allocation failed: status = %d", status);
109 104 return (status);
110 105 }
111 106
112 107 ibtl_free_srq_async_check(ibt_srq);
113 108
114 109 /* Update the srq resource count */
115 110 atomic_dec_32(&ibt_hca->ha_srq_cnt);
116 111
117 112 return (status);
118 113 }
119 114
120 115
121 116 /*
122 117 * ibt_query_srq() - Returns the size of the srq
123 118 */
124 119 ibt_status_t
125 120 ibt_query_srq(ibt_srq_hdl_t ibt_srq, ibt_pd_hdl_t *pd_p,
126 121 ibt_srq_sizes_t *sizes_p, uint_t *limit)
127 122 {
128 123 IBTF_DPRINTF_L3(ibtf_srq, "ibt_query_srq(%p)", ibt_srq);
129 124
130 125 return (IBTL_SRQ2CIHCAOPS_P(ibt_srq)->ibc_query_srq(
131 126 IBTL_SRQ2CIHCA(ibt_srq), ibt_srq->srq_ibc_srq_hdl, pd_p,
132 127 sizes_p, limit));
133 128 }
134 129
135 130
136 131 /*
137 132 * ibt_resize_srq() - Change the size of a srq.
138 133 */
139 134 ibt_status_t
140 135 ibt_modify_srq(ibt_srq_hdl_t ibt_srq, ibt_srq_modify_flags_t flags,
141 136 uint_t size, uint_t limit, uint_t *real_size_p)
↓ open down ↓ |
48 lines elided |
↑ open up ↑ |
142 137 {
143 138 IBTF_DPRINTF_L3(ibtf_srq, "ibt_modify_srq(%p, %d, %d, %d)",
144 139 ibt_srq, flags, size, limit);
145 140
146 141 return (IBTL_SRQ2CIHCAOPS_P(ibt_srq)->ibc_modify_srq(
147 142 IBTL_SRQ2CIHCA(ibt_srq), ibt_srq->srq_ibc_srq_hdl,
148 143 flags, size, limit, real_size_p));
149 144 }
150 145
151 146
152 -_NOTE(SCHEME_PROTECTS_DATA("client managed", ibtl_srq_s::srq_clnt_private))
153 -
154 147 /*
155 148 * ibt_set_srq_private - Sets the private data on a given SRQ
156 149 *
157 150 * ibt_srq The ibt_srq_hdl_t of the allocated SRQ.
158 151 * clnt_private The client private data.
159 152 */
160 153 void
161 154 ibt_set_srq_private(ibt_srq_hdl_t ibt_srq, void *clnt_private)
162 155 {
163 156 ibt_srq->srq_clnt_private = clnt_private;
164 157 }
165 158
166 159
167 160 /*
168 161 * ibt_get_srq_private - Retrieves the private data for a given SRQ
169 162 *
170 163 * ibt_srq The ibt_srq_hdl_t of the allocated SRQ.
171 164 */
172 165 void *
173 166 ibt_get_srq_private(ibt_srq_hdl_t ibt_srq)
174 167 {
175 168 return (ibt_srq->srq_clnt_private);
176 169 }
177 170
178 171 /*
179 172 * Function:
180 173 * ibt_post_srq
181 174 * Input:
182 175 * srq - SRQ.
183 176 * wr_list - Address of array[size] of work requests.
184 177 * size - Number of work requests.
185 178 * Output:
186 179 * posted - Address to return the number of work requests
187 180 * successfully posted. May be NULL.
188 181 * Description:
189 182 * Post one or more receive work requests to the SRQ.
190 183 */
191 184
192 185 ibt_status_t
193 186 ibt_post_srq(ibt_srq_hdl_t srq, ibt_recv_wr_t *wr_list, uint_t size,
194 187 uint_t *posted)
195 188 {
196 189 IBTF_DPRINTF_L4(ibtf_srq, "ibt_post_srq(%p, %p, %d)",
197 190 srq, wr_list, size);
198 191
199 192 return (IBTL_SRQ2CIHCAOPS_P(srq)->ibc_post_srq(IBTL_SRQ2CIHCA(srq),
200 193 srq->srq_ibc_srq_hdl, wr_list, size, posted));
201 194 }
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX