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