Commit | Line | Data |
---|---|---|
5bc1421e NH |
1 | /* |
2 | * netprio_cgroup.h Control Group Priority set | |
3 | * | |
4 | * | |
5 | * Authors: Neil Horman <nhorman@tuxdriver.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the Free | |
9 | * Software Foundation; either version 2 of the License, or (at your option) | |
10 | * any later version. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef _NETPRIO_CGROUP_H | |
15 | #define _NETPRIO_CGROUP_H | |
16 | #include <linux/module.h> | |
17 | #include <linux/cgroup.h> | |
18 | #include <linux/hardirq.h> | |
19 | #include <linux/rcupdate.h> | |
20 | ||
5bc1421e NH |
21 | |
22 | struct netprio_map { | |
23 | struct rcu_head rcu; | |
24 | u32 priomap_len; | |
25 | u32 priomap[]; | |
26 | }; | |
27 | ||
28 | #ifdef CONFIG_CGROUPS | |
29 | ||
8c215228 NH |
30 | struct cgroup_netprio_state { |
31 | struct cgroup_subsys_state css; | |
32 | u32 prioidx; | |
33 | }; | |
34 | ||
5bc1421e NH |
35 | #ifndef CONFIG_NETPRIO_CGROUP |
36 | extern int net_prio_subsys_id; | |
37 | #endif | |
38 | ||
39 | extern void sock_update_netprioidx(struct sock *sk); | |
40 | ||
41 | static inline struct cgroup_netprio_state | |
42 | *task_netprio_state(struct task_struct *p) | |
43 | { | |
44 | #if IS_ENABLED(CONFIG_NETPRIO_CGROUP) | |
45 | return container_of(task_subsys_state(p, net_prio_subsys_id), | |
46 | struct cgroup_netprio_state, css); | |
47 | #else | |
48 | return NULL; | |
49 | #endif | |
50 | } | |
51 | ||
52 | #else | |
53 | ||
54 | #define sock_update_netprioidx(sk) | |
5bc1421e NH |
55 | #endif |
56 | ||
57 | #endif /* _NET_CLS_CGROUP_H */ |