netprio_cgroup.h (51e4e7faba786d33e5e33f8776c5027a1c8d6fb7) netprio_cgroup.h (8a8e04df4747661daaee77e98e102d99c9e09b98)
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

--- 16 unchanged lines hidden (view full) ---

25 u32 priomap[];
26};
27
28struct cgroup_netprio_state {
29 struct cgroup_subsys_state css;
30 u32 prioidx;
31};
32
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

--- 16 unchanged lines hidden (view full) ---

25 u32 priomap[];
26};
27
28struct cgroup_netprio_state {
29 struct cgroup_subsys_state css;
30 u32 prioidx;
31};
32
33#ifndef CONFIG_NETPRIO_CGROUP
34extern int net_prio_subsys_id;
35#endif
36
37extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
38
39#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
40
41static inline u32 task_netprioidx(struct task_struct *p)
42{
43 struct cgroup_netprio_state *state;
44 u32 idx;

--- 5 unchanged lines hidden (view full) ---

50 rcu_read_unlock();
51 return idx;
52}
53
54#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
55
56static inline u32 task_netprioidx(struct task_struct *p)
57{
33extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
34
35#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
36
37static inline u32 task_netprioidx(struct task_struct *p)
38{
39 struct cgroup_netprio_state *state;
40 u32 idx;

--- 5 unchanged lines hidden (view full) ---

46 rcu_read_unlock();
47 return idx;
48}
49
50#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
51
52static inline u32 task_netprioidx(struct task_struct *p)
53{
58 struct cgroup_netprio_state *state;
59 int subsys_id;
54 struct cgroup_subsys_state *css;
60 u32 idx = 0;
61
62 rcu_read_lock();
55 u32 idx = 0;
56
57 rcu_read_lock();
63 subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
64 rcu_read_lock_held());
65 if (subsys_id >= 0) {
66 state = container_of(task_subsys_state(p, subsys_id),
67 struct cgroup_netprio_state, css);
68 idx = state->prioidx;
69 }
58 css = task_subsys_state(p, net_prio_subsys_id);
59 if (css)
60 idx = container_of(css,
61 struct cgroup_netprio_state, css)->prioidx;
70 rcu_read_unlock();
71 return idx;
72}
73#endif
74
75#else /* !CONFIG_NETPRIO_CGROUP */
76
77static inline u32 task_netprioidx(struct task_struct *p)
78{
79 return 0;
80}
81
82#define sock_update_netprioidx(sk, task)
83
84#endif /* CONFIG_NETPRIO_CGROUP */
85
86#endif /* _NET_CLS_CGROUP_H */
62 rcu_read_unlock();
63 return idx;
64}
65#endif
66
67#else /* !CONFIG_NETPRIO_CGROUP */
68
69static inline u32 task_netprioidx(struct task_struct *p)
70{
71 return 0;
72}
73
74#define sock_update_netprioidx(sk, task)
75
76#endif /* CONFIG_NETPRIO_CGROUP */
77
78#endif /* _NET_CLS_CGROUP_H */