diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/infiniband/include/ib_sa.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/infiniband/include/ib_sa.h')
-rw-r--r-- | drivers/infiniband/include/ib_sa.h | 308 |
1 files changed, 308 insertions, 0 deletions
diff --git a/drivers/infiniband/include/ib_sa.h b/drivers/infiniband/include/ib_sa.h new file mode 100644 index 000000000000..f4f747707b30 --- /dev/null +++ b/drivers/infiniband/include/ib_sa.h | |||
@@ -0,0 +1,308 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | ||
3 | * | ||
4 | * This software is available to you under a choice of one of two | ||
5 | * licenses. You may choose to be licensed under the terms of the GNU | ||
6 | * General Public License (GPL) Version 2, available from the file | ||
7 | * COPYING in the main directory of this source tree, or the | ||
8 | * OpenIB.org BSD license below: | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or | ||
11 | * without modification, are permitted provided that the following | ||
12 | * conditions are met: | ||
13 | * | ||
14 | * - Redistributions of source code must retain the above | ||
15 | * copyright notice, this list of conditions and the following | ||
16 | * disclaimer. | ||
17 | * | ||
18 | * - Redistributions in binary form must reproduce the above | ||
19 | * copyright notice, this list of conditions and the following | ||
20 | * disclaimer in the documentation and/or other materials | ||
21 | * provided with the distribution. | ||
22 | * | ||
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
30 | * SOFTWARE. | ||
31 | * | ||
32 | * $Id: ib_sa.h 1389 2004-12-27 22:56:47Z roland $ | ||
33 | */ | ||
34 | |||
35 | #ifndef IB_SA_H | ||
36 | #define IB_SA_H | ||
37 | |||
38 | #include <linux/compiler.h> | ||
39 | |||
40 | #include <ib_verbs.h> | ||
41 | #include <ib_mad.h> | ||
42 | |||
43 | enum { | ||
44 | IB_SA_CLASS_VERSION = 2, /* IB spec version 1.1/1.2 */ | ||
45 | |||
46 | IB_SA_METHOD_DELETE = 0x15 | ||
47 | }; | ||
48 | |||
49 | enum ib_sa_selector { | ||
50 | IB_SA_GTE = 0, | ||
51 | IB_SA_LTE = 1, | ||
52 | IB_SA_EQ = 2, | ||
53 | /* | ||
54 | * The meaning of "best" depends on the attribute: for | ||
55 | * example, for MTU best will return the largest available | ||
56 | * MTU, while for packet life time, best will return the | ||
57 | * smallest available life time. | ||
58 | */ | ||
59 | IB_SA_BEST = 3 | ||
60 | }; | ||
61 | |||
62 | enum ib_sa_rate { | ||
63 | IB_SA_RATE_2_5_GBPS = 2, | ||
64 | IB_SA_RATE_5_GBPS = 5, | ||
65 | IB_SA_RATE_10_GBPS = 3, | ||
66 | IB_SA_RATE_20_GBPS = 6, | ||
67 | IB_SA_RATE_30_GBPS = 4, | ||
68 | IB_SA_RATE_40_GBPS = 7, | ||
69 | IB_SA_RATE_60_GBPS = 8, | ||
70 | IB_SA_RATE_80_GBPS = 9, | ||
71 | IB_SA_RATE_120_GBPS = 10 | ||
72 | }; | ||
73 | |||
74 | static inline int ib_sa_rate_enum_to_int(enum ib_sa_rate rate) | ||
75 | { | ||
76 | switch (rate) { | ||
77 | case IB_SA_RATE_2_5_GBPS: return 1; | ||
78 | case IB_SA_RATE_5_GBPS: return 2; | ||
79 | case IB_SA_RATE_10_GBPS: return 4; | ||
80 | case IB_SA_RATE_20_GBPS: return 8; | ||
81 | case IB_SA_RATE_30_GBPS: return 12; | ||
82 | case IB_SA_RATE_40_GBPS: return 16; | ||
83 | case IB_SA_RATE_60_GBPS: return 24; | ||
84 | case IB_SA_RATE_80_GBPS: return 32; | ||
85 | case IB_SA_RATE_120_GBPS: return 48; | ||
86 | default: return -1; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | typedef u64 __bitwise ib_sa_comp_mask; | ||
91 | |||
92 | #define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n)) | ||
93 | |||
94 | /* | ||
95 | * Structures for SA records are named "struct ib_sa_xxx_rec." No | ||
96 | * attempt is made to pack structures to match the physical layout of | ||
97 | * SA records in SA MADs; all packing and unpacking is handled by the | ||
98 | * SA query code. | ||
99 | * | ||
100 | * For a record with structure ib_sa_xxx_rec, the naming convention | ||
101 | * for the component mask value for field yyy is IB_SA_XXX_REC_YYY (we | ||
102 | * never use different abbreviations or otherwise change the spelling | ||
103 | * of xxx/yyy between ib_sa_xxx_rec.yyy and IB_SA_XXX_REC_YYY). | ||
104 | * | ||
105 | * Reserved rows are indicated with comments to help maintainability. | ||
106 | */ | ||
107 | |||
108 | /* reserved: 0 */ | ||
109 | /* reserved: 1 */ | ||
110 | #define IB_SA_PATH_REC_DGID IB_SA_COMP_MASK( 2) | ||
111 | #define IB_SA_PATH_REC_SGID IB_SA_COMP_MASK( 3) | ||
112 | #define IB_SA_PATH_REC_DLID IB_SA_COMP_MASK( 4) | ||
113 | #define IB_SA_PATH_REC_SLID IB_SA_COMP_MASK( 5) | ||
114 | #define IB_SA_PATH_REC_RAW_TRAFFIC IB_SA_COMP_MASK( 6) | ||
115 | /* reserved: 7 */ | ||
116 | #define IB_SA_PATH_REC_FLOW_LABEL IB_SA_COMP_MASK( 8) | ||
117 | #define IB_SA_PATH_REC_HOP_LIMIT IB_SA_COMP_MASK( 9) | ||
118 | #define IB_SA_PATH_REC_TRAFFIC_CLASS IB_SA_COMP_MASK(10) | ||
119 | #define IB_SA_PATH_REC_REVERSIBLE IB_SA_COMP_MASK(11) | ||
120 | #define IB_SA_PATH_REC_NUMB_PATH IB_SA_COMP_MASK(12) | ||
121 | #define IB_SA_PATH_REC_PKEY IB_SA_COMP_MASK(13) | ||
122 | /* reserved: 14 */ | ||
123 | #define IB_SA_PATH_REC_SL IB_SA_COMP_MASK(15) | ||
124 | #define IB_SA_PATH_REC_MTU_SELECTOR IB_SA_COMP_MASK(16) | ||
125 | #define IB_SA_PATH_REC_MTU IB_SA_COMP_MASK(17) | ||
126 | #define IB_SA_PATH_REC_RATE_SELECTOR IB_SA_COMP_MASK(18) | ||
127 | #define IB_SA_PATH_REC_RATE IB_SA_COMP_MASK(19) | ||
128 | #define IB_SA_PATH_REC_PACKET_LIFE_TIME_SELECTOR IB_SA_COMP_MASK(20) | ||
129 | #define IB_SA_PATH_REC_PACKET_LIFE_TIME IB_SA_COMP_MASK(21) | ||
130 | #define IB_SA_PATH_REC_PREFERENCE IB_SA_COMP_MASK(22) | ||
131 | |||
132 | struct ib_sa_path_rec { | ||
133 | /* reserved */ | ||
134 | /* reserved */ | ||
135 | union ib_gid dgid; | ||
136 | union ib_gid sgid; | ||
137 | u16 dlid; | ||
138 | u16 slid; | ||
139 | int raw_traffic; | ||
140 | /* reserved */ | ||
141 | u32 flow_label; | ||
142 | u8 hop_limit; | ||
143 | u8 traffic_class; | ||
144 | int reversible; | ||
145 | u8 numb_path; | ||
146 | u16 pkey; | ||
147 | /* reserved */ | ||
148 | u8 sl; | ||
149 | u8 mtu_selector; | ||
150 | enum ib_mtu mtu; | ||
151 | u8 rate_selector; | ||
152 | u8 rate; | ||
153 | u8 packet_life_time_selector; | ||
154 | u8 packet_life_time; | ||
155 | u8 preference; | ||
156 | }; | ||
157 | |||
158 | #define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0) | ||
159 | #define IB_SA_MCMEMBER_REC_PORT_GID IB_SA_COMP_MASK( 1) | ||
160 | #define IB_SA_MCMEMBER_REC_QKEY IB_SA_COMP_MASK( 2) | ||
161 | #define IB_SA_MCMEMBER_REC_MLID IB_SA_COMP_MASK( 3) | ||
162 | #define IB_SA_MCMEMBER_REC_MTU_SELECTOR IB_SA_COMP_MASK( 4) | ||
163 | #define IB_SA_MCMEMBER_REC_MTU IB_SA_COMP_MASK( 5) | ||
164 | #define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS IB_SA_COMP_MASK( 6) | ||
165 | #define IB_SA_MCMEMBER_REC_PKEY IB_SA_COMP_MASK( 7) | ||
166 | #define IB_SA_MCMEMBER_REC_RATE_SELECTOR IB_SA_COMP_MASK( 8) | ||
167 | #define IB_SA_MCMEMBER_REC_RATE IB_SA_COMP_MASK( 9) | ||
168 | #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR IB_SA_COMP_MASK(10) | ||
169 | #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME IB_SA_COMP_MASK(11) | ||
170 | #define IB_SA_MCMEMBER_REC_SL IB_SA_COMP_MASK(12) | ||
171 | #define IB_SA_MCMEMBER_REC_FLOW_LABEL IB_SA_COMP_MASK(13) | ||
172 | #define IB_SA_MCMEMBER_REC_HOP_LIMIT IB_SA_COMP_MASK(14) | ||
173 | #define IB_SA_MCMEMBER_REC_SCOPE IB_SA_COMP_MASK(15) | ||
174 | #define IB_SA_MCMEMBER_REC_JOIN_STATE IB_SA_COMP_MASK(16) | ||
175 | #define IB_SA_MCMEMBER_REC_PROXY_JOIN IB_SA_COMP_MASK(17) | ||
176 | |||
177 | struct ib_sa_mcmember_rec { | ||
178 | union ib_gid mgid; | ||
179 | union ib_gid port_gid; | ||
180 | u32 qkey; | ||
181 | u16 mlid; | ||
182 | u8 mtu_selector; | ||
183 | enum ib_mtu mtu; | ||
184 | u8 traffic_class; | ||
185 | u16 pkey; | ||
186 | u8 rate_selector; | ||
187 | u8 rate; | ||
188 | u8 packet_life_time_selector; | ||
189 | u8 packet_life_time; | ||
190 | u8 sl; | ||
191 | u32 flow_label; | ||
192 | u8 hop_limit; | ||
193 | u8 scope; | ||
194 | u8 join_state; | ||
195 | int proxy_join; | ||
196 | }; | ||
197 | |||
198 | struct ib_sa_query; | ||
199 | |||
200 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); | ||
201 | |||
202 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | ||
203 | struct ib_sa_path_rec *rec, | ||
204 | ib_sa_comp_mask comp_mask, | ||
205 | int timeout_ms, int gfp_mask, | ||
206 | void (*callback)(int status, | ||
207 | struct ib_sa_path_rec *resp, | ||
208 | void *context), | ||
209 | void *context, | ||
210 | struct ib_sa_query **query); | ||
211 | |||
212 | int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | ||
213 | u8 method, | ||
214 | struct ib_sa_mcmember_rec *rec, | ||
215 | ib_sa_comp_mask comp_mask, | ||
216 | int timeout_ms, int gfp_mask, | ||
217 | void (*callback)(int status, | ||
218 | struct ib_sa_mcmember_rec *resp, | ||
219 | void *context), | ||
220 | void *context, | ||
221 | struct ib_sa_query **query); | ||
222 | |||
223 | /** | ||
224 | * ib_sa_mcmember_rec_set - Start an MCMember set query | ||
225 | * @device:device to send query on | ||
226 | * @port_num: port number to send query on | ||
227 | * @rec:MCMember Record to send in query | ||
228 | * @comp_mask:component mask to send in query | ||
229 | * @timeout_ms:time to wait for response | ||
230 | * @gfp_mask:GFP mask to use for internal allocations | ||
231 | * @callback:function called when query completes, times out or is | ||
232 | * canceled | ||
233 | * @context:opaque user context passed to callback | ||
234 | * @sa_query:query context, used to cancel query | ||
235 | * | ||
236 | * Send an MCMember Set query to the SA (eg to join a multicast | ||
237 | * group). The callback function will be called when the query | ||
238 | * completes (or fails); status is 0 for a successful response, -EINTR | ||
239 | * if the query is canceled, -ETIMEDOUT is the query timed out, or | ||
240 | * -EIO if an error occurred sending the query. The resp parameter of | ||
241 | * the callback is only valid if status is 0. | ||
242 | * | ||
243 | * If the return value of ib_sa_mcmember_rec_set() is negative, it is | ||
244 | * an error code. Otherwise it is a query ID that can be used to | ||
245 | * cancel the query. | ||
246 | */ | ||
247 | static inline int | ||
248 | ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | ||
249 | struct ib_sa_mcmember_rec *rec, | ||
250 | ib_sa_comp_mask comp_mask, | ||
251 | int timeout_ms, int gfp_mask, | ||
252 | void (*callback)(int status, | ||
253 | struct ib_sa_mcmember_rec *resp, | ||
254 | void *context), | ||
255 | void *context, | ||
256 | struct ib_sa_query **query) | ||
257 | { | ||
258 | return ib_sa_mcmember_rec_query(device, port_num, | ||
259 | IB_MGMT_METHOD_SET, | ||
260 | rec, comp_mask, | ||
261 | timeout_ms, gfp_mask, callback, | ||
262 | context, query); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query | ||
267 | * @device:device to send query on | ||
268 | * @port_num: port number to send query on | ||
269 | * @rec:MCMember Record to send in query | ||
270 | * @comp_mask:component mask to send in query | ||
271 | * @timeout_ms:time to wait for response | ||
272 | * @gfp_mask:GFP mask to use for internal allocations | ||
273 | * @callback:function called when query completes, times out or is | ||
274 | * canceled | ||
275 | * @context:opaque user context passed to callback | ||
276 | * @sa_query:query context, used to cancel query | ||
277 | * | ||
278 | * Send an MCMember Delete query to the SA (eg to leave a multicast | ||
279 | * group). The callback function will be called when the query | ||
280 | * completes (or fails); status is 0 for a successful response, -EINTR | ||
281 | * if the query is canceled, -ETIMEDOUT is the query timed out, or | ||
282 | * -EIO if an error occurred sending the query. The resp parameter of | ||
283 | * the callback is only valid if status is 0. | ||
284 | * | ||
285 | * If the return value of ib_sa_mcmember_rec_delete() is negative, it | ||
286 | * is an error code. Otherwise it is a query ID that can be used to | ||
287 | * cancel the query. | ||
288 | */ | ||
289 | static inline int | ||
290 | ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | ||
291 | struct ib_sa_mcmember_rec *rec, | ||
292 | ib_sa_comp_mask comp_mask, | ||
293 | int timeout_ms, int gfp_mask, | ||
294 | void (*callback)(int status, | ||
295 | struct ib_sa_mcmember_rec *resp, | ||
296 | void *context), | ||
297 | void *context, | ||
298 | struct ib_sa_query **query) | ||
299 | { | ||
300 | return ib_sa_mcmember_rec_query(device, port_num, | ||
301 | IB_SA_METHOD_DELETE, | ||
302 | rec, comp_mask, | ||
303 | timeout_ms, gfp_mask, callback, | ||
304 | context, query); | ||
305 | } | ||
306 | |||
307 | |||
308 | #endif /* IB_SA_H */ | ||