blob: 80edae03c3138e0737ab63d5529dd0688caadb95 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2016 Parav Pandit <pandit.parav@gmail.com>
*/
#ifndef _CGROUP_RDMA_H
#define _CGROUP_RDMA_H
#include <linux/cgroup.h>
enum rdmacg_resource_type {
RDMACG_RESOURCE_HCA_HANDLE,
RDMACG_RESOURCE_HCA_OBJECT,
RDMACG_RESOURCE_MAX,
};
#ifdef CONFIG_CGROUP_RDMA
struct rdma_cgroup {
struct cgroup_subsys_state css;
/*
* head to keep track of all resource pools
* that belongs to this cgroup.
*/
struct list_head rpools;
};
struct rdmacg_device {
struct list_head dev_node;
struct list_head rpools;
char *name;
};
/*
* APIs for RDMA/IB stack to publish when a device wants to
* participate in resource accounting
*/
void rdmacg_register_device(struct rdmacg_device *device);
void rdmacg_unregister_device(struct rdmacg_device *device);
/* APIs for RDMA/IB stack to charge/uncharge pool specific resources */
int rdmacg_try_charge(struct rdma_cgroup **rdmacg,
struct rdmacg_device *device,
enum rdmacg_resource_type index);
void rdmacg_uncharge(struct rdma_cgroup *cg,
struct rdmacg_device *device,
enum rdmacg_resource_type index);
#endif /* CONFIG_CGROUP_RDMA */
#endif /* _CGROUP_RDMA_H */
|