diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-08-21 19:40:12 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-09-22 18:22:53 -0400 |
commit | c1a0b23bf477c2e1068905f4e2b5c3cee139e853 (patch) | |
tree | 68357e32e8b6542647f639da8ca3859b4cb3b59b /include/rdma/ib_sa.h | |
parent | 2439a6e65ff09729c3b4215f134dc5cd4e8a30c0 (diff) |
IB/sa: Require SA registration
Require users to register with SA module, to prevent the sa_query
module text from going away while an SA query callback is still
running. Update all in-tree users for the new interface.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'include/rdma/ib_sa.h')
-rw-r--r-- | include/rdma/ib_sa.h | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index c99e4420fd7e..58bb5f716fe3 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. |
4 | * Copyright (c) 2006 Intel Corporation. All rights reserved. | ||
4 | * | 5 | * |
5 | * This software is available to you under a choice of one of two | 6 | * 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 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -36,8 +37,11 @@ | |||
36 | #ifndef IB_SA_H | 37 | #ifndef IB_SA_H |
37 | #define IB_SA_H | 38 | #define IB_SA_H |
38 | 39 | ||
40 | #include <linux/completion.h> | ||
39 | #include <linux/compiler.h> | 41 | #include <linux/compiler.h> |
40 | 42 | ||
43 | #include <asm/atomic.h> | ||
44 | |||
41 | #include <rdma/ib_verbs.h> | 45 | #include <rdma/ib_verbs.h> |
42 | #include <rdma/ib_mad.h> | 46 | #include <rdma/ib_mad.h> |
43 | 47 | ||
@@ -250,11 +254,28 @@ struct ib_sa_service_rec { | |||
250 | u64 data64[2]; | 254 | u64 data64[2]; |
251 | }; | 255 | }; |
252 | 256 | ||
257 | struct ib_sa_client { | ||
258 | atomic_t users; | ||
259 | struct completion comp; | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * ib_sa_register_client - Register an SA client. | ||
264 | */ | ||
265 | void ib_sa_register_client(struct ib_sa_client *client); | ||
266 | |||
267 | /** | ||
268 | * ib_sa_unregister_client - Deregister an SA client. | ||
269 | * @client: Client object to deregister. | ||
270 | */ | ||
271 | void ib_sa_unregister_client(struct ib_sa_client *client); | ||
272 | |||
253 | struct ib_sa_query; | 273 | struct ib_sa_query; |
254 | 274 | ||
255 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); | 275 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); |
256 | 276 | ||
257 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | 277 | int ib_sa_path_rec_get(struct ib_sa_client *client, |
278 | struct ib_device *device, u8 port_num, | ||
258 | struct ib_sa_path_rec *rec, | 279 | struct ib_sa_path_rec *rec, |
259 | ib_sa_comp_mask comp_mask, | 280 | ib_sa_comp_mask comp_mask, |
260 | int timeout_ms, gfp_t gfp_mask, | 281 | int timeout_ms, gfp_t gfp_mask, |
@@ -264,7 +285,8 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | |||
264 | void *context, | 285 | void *context, |
265 | struct ib_sa_query **query); | 286 | struct ib_sa_query **query); |
266 | 287 | ||
267 | int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | 288 | int ib_sa_mcmember_rec_query(struct ib_sa_client *client, |
289 | struct ib_device *device, u8 port_num, | ||
268 | u8 method, | 290 | u8 method, |
269 | struct ib_sa_mcmember_rec *rec, | 291 | struct ib_sa_mcmember_rec *rec, |
270 | ib_sa_comp_mask comp_mask, | 292 | ib_sa_comp_mask comp_mask, |
@@ -275,7 +297,8 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | |||
275 | void *context, | 297 | void *context, |
276 | struct ib_sa_query **query); | 298 | struct ib_sa_query **query); |
277 | 299 | ||
278 | int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | 300 | int ib_sa_service_rec_query(struct ib_sa_client *client, |
301 | struct ib_device *device, u8 port_num, | ||
279 | u8 method, | 302 | u8 method, |
280 | struct ib_sa_service_rec *rec, | 303 | struct ib_sa_service_rec *rec, |
281 | ib_sa_comp_mask comp_mask, | 304 | ib_sa_comp_mask comp_mask, |
@@ -288,6 +311,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
288 | 311 | ||
289 | /** | 312 | /** |
290 | * ib_sa_mcmember_rec_set - Start an MCMember set query | 313 | * ib_sa_mcmember_rec_set - Start an MCMember set query |
314 | * @client:SA client | ||
291 | * @device:device to send query on | 315 | * @device:device to send query on |
292 | * @port_num: port number to send query on | 316 | * @port_num: port number to send query on |
293 | * @rec:MCMember Record to send in query | 317 | * @rec:MCMember Record to send in query |
@@ -311,7 +335,8 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
311 | * cancel the query. | 335 | * cancel the query. |
312 | */ | 336 | */ |
313 | static inline int | 337 | static inline int |
314 | ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | 338 | ib_sa_mcmember_rec_set(struct ib_sa_client *client, |
339 | struct ib_device *device, u8 port_num, | ||
315 | struct ib_sa_mcmember_rec *rec, | 340 | struct ib_sa_mcmember_rec *rec, |
316 | ib_sa_comp_mask comp_mask, | 341 | ib_sa_comp_mask comp_mask, |
317 | int timeout_ms, gfp_t gfp_mask, | 342 | int timeout_ms, gfp_t gfp_mask, |
@@ -321,7 +346,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
321 | void *context, | 346 | void *context, |
322 | struct ib_sa_query **query) | 347 | struct ib_sa_query **query) |
323 | { | 348 | { |
324 | return ib_sa_mcmember_rec_query(device, port_num, | 349 | return ib_sa_mcmember_rec_query(client, device, port_num, |
325 | IB_MGMT_METHOD_SET, | 350 | IB_MGMT_METHOD_SET, |
326 | rec, comp_mask, | 351 | rec, comp_mask, |
327 | timeout_ms, gfp_mask, callback, | 352 | timeout_ms, gfp_mask, callback, |
@@ -330,6 +355,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
330 | 355 | ||
331 | /** | 356 | /** |
332 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query | 357 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query |
358 | * @client:SA client | ||
333 | * @device:device to send query on | 359 | * @device:device to send query on |
334 | * @port_num: port number to send query on | 360 | * @port_num: port number to send query on |
335 | * @rec:MCMember Record to send in query | 361 | * @rec:MCMember Record to send in query |
@@ -353,7 +379,8 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
353 | * cancel the query. | 379 | * cancel the query. |
354 | */ | 380 | */ |
355 | static inline int | 381 | static inline int |
356 | ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | 382 | ib_sa_mcmember_rec_delete(struct ib_sa_client *client, |
383 | struct ib_device *device, u8 port_num, | ||
357 | struct ib_sa_mcmember_rec *rec, | 384 | struct ib_sa_mcmember_rec *rec, |
358 | ib_sa_comp_mask comp_mask, | 385 | ib_sa_comp_mask comp_mask, |
359 | int timeout_ms, gfp_t gfp_mask, | 386 | int timeout_ms, gfp_t gfp_mask, |
@@ -363,7 +390,7 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | |||
363 | void *context, | 390 | void *context, |
364 | struct ib_sa_query **query) | 391 | struct ib_sa_query **query) |
365 | { | 392 | { |
366 | return ib_sa_mcmember_rec_query(device, port_num, | 393 | return ib_sa_mcmember_rec_query(client, device, port_num, |
367 | IB_SA_METHOD_DELETE, | 394 | IB_SA_METHOD_DELETE, |
368 | rec, comp_mask, | 395 | rec, comp_mask, |
369 | timeout_ms, gfp_mask, callback, | 396 | timeout_ms, gfp_mask, callback, |