2 * Copyright (C) 2016 Parav Pandit <pandit.parav@gmail.com>
4 * This file is subject to the terms and conditions of version 2 of the GNU
5 * General Public License. See the file COPYING in the main directory of the
6 * Linux distribution for more details.
10 #define _CGROUP_RDMA_H
12 #include <linux/cgroup.h>
14 enum rdmacg_resource_type
{
15 RDMACG_RESOURCE_HCA_HANDLE
,
16 RDMACG_RESOURCE_HCA_OBJECT
,
20 #ifdef CONFIG_CGROUP_RDMA
23 struct cgroup_subsys_state css
;
26 * head to keep track of all resource pools
27 * that belongs to this cgroup.
29 struct list_head rpools
;
32 struct rdmacg_device
{
33 struct list_head dev_node
;
34 struct list_head rpools
;
39 * APIs for RDMA/IB stack to publish when a device wants to
40 * participate in resource accounting
42 int rdmacg_register_device(struct rdmacg_device
*device
);
43 void rdmacg_unregister_device(struct rdmacg_device
*device
);
45 /* APIs for RDMA/IB stack to charge/uncharge pool specific resources */
46 int rdmacg_try_charge(struct rdma_cgroup
**rdmacg
,
47 struct rdmacg_device
*device
,
48 enum rdmacg_resource_type index
);
49 void rdmacg_uncharge(struct rdma_cgroup
*cg
,
50 struct rdmacg_device
*device
,
51 enum rdmacg_resource_type index
);
52 #endif /* CONFIG_CGROUP_RDMA */
53 #endif /* _CGROUP_RDMA_H */