xref: /openbmc/linux/drivers/infiniband/core/sa.h (revision 1fb7f897)
1faec2f7bSSean Hefty /*
2faec2f7bSSean Hefty  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
343506d95SRoland Dreier  * Copyright (c) 2005 Voltaire, Inc.  All rights reserved.
4faec2f7bSSean Hefty  * Copyright (c) 2006 Intel Corporation.  All rights reserved.
5faec2f7bSSean Hefty  *
6faec2f7bSSean Hefty  * This software is available to you under a choice of one of two
7faec2f7bSSean Hefty  * licenses.  You may choose to be licensed under the terms of the GNU
8faec2f7bSSean Hefty  * General Public License (GPL) Version 2, available from the file
9faec2f7bSSean Hefty  * COPYING in the main directory of this source tree, or the
10faec2f7bSSean Hefty  * OpenIB.org BSD license below:
11faec2f7bSSean Hefty  *
12faec2f7bSSean Hefty  *     Redistribution and use in source and binary forms, with or
13faec2f7bSSean Hefty  *     without modification, are permitted provided that the following
14faec2f7bSSean Hefty  *     conditions are met:
15faec2f7bSSean Hefty  *
16faec2f7bSSean Hefty  *      - Redistributions of source code must retain the above
17faec2f7bSSean Hefty  *        copyright notice, this list of conditions and the following
18faec2f7bSSean Hefty  *        disclaimer.
19faec2f7bSSean Hefty  *
20faec2f7bSSean Hefty  *      - Redistributions in binary form must reproduce the above
21faec2f7bSSean Hefty  *        copyright notice, this list of conditions and the following
22faec2f7bSSean Hefty  *        disclaimer in the documentation and/or other materials
23faec2f7bSSean Hefty  *        provided with the distribution.
24faec2f7bSSean Hefty  *
25faec2f7bSSean Hefty  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26faec2f7bSSean Hefty  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27faec2f7bSSean Hefty  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28faec2f7bSSean Hefty  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29faec2f7bSSean Hefty  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30faec2f7bSSean Hefty  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31faec2f7bSSean Hefty  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32faec2f7bSSean Hefty  * SOFTWARE.
33faec2f7bSSean Hefty  */
34faec2f7bSSean Hefty 
35faec2f7bSSean Hefty #ifndef SA_H
36faec2f7bSSean Hefty #define SA_H
37faec2f7bSSean Hefty 
38faec2f7bSSean Hefty #include <rdma/ib_sa.h>
39faec2f7bSSean Hefty 
ib_sa_client_get(struct ib_sa_client * client)40faec2f7bSSean Hefty static inline void ib_sa_client_get(struct ib_sa_client *client)
41faec2f7bSSean Hefty {
42faec2f7bSSean Hefty 	atomic_inc(&client->users);
43faec2f7bSSean Hefty }
44faec2f7bSSean Hefty 
ib_sa_client_put(struct ib_sa_client * client)45faec2f7bSSean Hefty static inline void ib_sa_client_put(struct ib_sa_client *client)
46faec2f7bSSean Hefty {
47faec2f7bSSean Hefty 	if (atomic_dec_and_test(&client->users))
48faec2f7bSSean Hefty 		complete(&client->comp);
49faec2f7bSSean Hefty }
50faec2f7bSSean Hefty 
51faec2f7bSSean Hefty int ib_sa_mcmember_rec_query(struct ib_sa_client *client,
52*1fb7f897SMark Bloch 			     struct ib_device *device, u32 port_num, u8 method,
53faec2f7bSSean Hefty 			     struct ib_sa_mcmember_rec *rec,
54dbace111SLeon Romanovsky 			     ib_sa_comp_mask comp_mask,
55dbace111SLeon Romanovsky 			     unsigned long timeout_ms, gfp_t gfp_mask,
56faec2f7bSSean Hefty 			     void (*callback)(int status,
57faec2f7bSSean Hefty 					      struct ib_sa_mcmember_rec *resp,
58faec2f7bSSean Hefty 					      void *context),
599549c2bdSLeon Romanovsky 			     void *context, struct ib_sa_query **sa_query);
60faec2f7bSSean Hefty 
61faec2f7bSSean Hefty int mcast_init(void);
62faec2f7bSSean Hefty void mcast_cleanup(void);
63faec2f7bSSean Hefty 
64faec2f7bSSean Hefty #endif /* SA_H */
65