aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netprio_cgroup.h
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2011-11-22 00:10:51 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-22 15:22:23 -0500
commit5bc1421e34ecfe0bd4b26dc3232b7d5e25179144 (patch)
tree783ed95187915c06757a260b637308919b35d5a0 /include/net/netprio_cgroup.h
parent202ff1c26c768efeead20b388556eda265dc8352 (diff)
net: add network priority cgroup infrastructure (v4)
This patch adds in the infrastructure code to create the network priority cgroup. The cgroup, in addition to the standard processes file creates two control files: 1) prioidx - This is a read-only file that exports the index of this cgroup. This is a value that is both arbitrary and unique to a cgroup in this subsystem, and is used to index the per-device priority map 2) priomap - This is a writeable file. On read it reports a table of 2-tuples <name:priority> where name is the name of a network interface and priority is indicates the priority assigned to frames egresessing on the named interface and originating from a pid in this cgroup This cgroup allows for skb priority to be set prior to a root qdisc getting selected. This is benenficial for DCB enabled systems, in that it allows for any application to use dcb configured priorities so without application modification Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> CC: Robert Love <robert.w.love@intel.com> CC: "David S. Miller" <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/netprio_cgroup.h')
-rw-r--r--include/net/netprio_cgroup.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
new file mode 100644
index 00000000000..c432e99942a
--- /dev/null
+++ b/include/net/netprio_cgroup.h
@@ -0,0 +1,65 @@
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
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 */