blob: c432e99942aff0671d4c9dece1e94fb1b3227ed2 [file] [log] [blame]
Neil Horman5bc14212011-11-22 05:10:51 +00001/*
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
21struct cgroup_netprio_state
22{
23 struct cgroup_subsys_state css;
24 u32 prioidx;
25};
26
27struct netprio_map {
28 struct rcu_head rcu;
29 u32 priomap_len;
30 u32 priomap[];
31};
32
33#ifdef CONFIG_CGROUPS
34
35#ifndef CONFIG_NETPRIO_CGROUP
36extern int net_prio_subsys_id;
37#endif
38
39extern void sock_update_netprioidx(struct sock *sk);
40
41static 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)
55#define skb_update_prio(skb)
56
57static inline struct cgroup_netprio_state
58 *task_netprio_state(struct task_struct *p)
59{
60 return NULL;
61}
62
63#endif
64
65#endif /* _NET_CLS_CGROUP_H */