Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / infiniband / core / restrack.h
blob6a04fc41f738010a90d96f88dbcc88bc36d3a289
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3 * Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved.
4 */
6 #ifndef _RDMA_CORE_RESTRACK_H_
7 #define _RDMA_CORE_RESTRACK_H_
9 #include <linux/mutex.h>
11 /**
12 * struct rdma_restrack_root - main resource tracking management
13 * entity, per-device
15 struct rdma_restrack_root {
16 /**
17 * @xa: Array of XArray structure to hold restrack entries.
19 struct xarray xa;
20 /**
21 * @next_id: Next ID to support cyclic allocation
23 u32 next_id;
26 int rdma_restrack_init(struct ib_device *dev);
27 void rdma_restrack_clean(struct ib_device *dev);
28 void rdma_restrack_add(struct rdma_restrack_entry *res);
29 void rdma_restrack_del(struct rdma_restrack_entry *res);
30 void rdma_restrack_new(struct rdma_restrack_entry *res,
31 enum rdma_restrack_type type);
32 void rdma_restrack_set_name(struct rdma_restrack_entry *res,
33 const char *caller);
34 void rdma_restrack_parent_name(struct rdma_restrack_entry *dst,
35 const struct rdma_restrack_entry *parent);
36 #endif /* _RDMA_CORE_RESTRACK_H_ */