Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / drivers / infiniband / core / restrack.h
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3  * Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved.
4  */
5
6 #ifndef _RDMA_CORE_RESTRACK_H_
7 #define _RDMA_CORE_RESTRACK_H_
8
9 #include <linux/mutex.h>
10
11 /**
12  * struct rdma_restrack_root - main resource tracking management
13  * entity, per-device
14  */
15 struct rdma_restrack_root {
16         /**
17          * @xa: Array of XArray structure to hold restrack entries.
18          */
19         struct xarray xa;
20         /**
21          * @next_id: Next ID to support cyclic allocation
22          */
23         u32 next_id;
24 };
25
26 int rdma_restrack_init(struct ib_device *dev);
27 void rdma_restrack_clean(struct ib_device *dev);
28 void rdma_restrack_attach_task(struct rdma_restrack_entry *res,
29                                struct task_struct *task);
30 bool rdma_is_visible_in_pid_ns(struct rdma_restrack_entry *res);
31 #endif /* _RDMA_CORE_RESTRACK_H_ */