Merge tag 'pm+acpi-4.6-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6-block.git] / Documentation / cgroup-v1 / net_cls.txt
CommitLineData
077f02f1
RR
1Network classifier cgroup
2-------------------------
3
4The Network classifier cgroup provides an interface to
5tag network packets with a class identifier (classid).
6
7The Traffic Controller (tc) can be used to assign
8different priorities to packets from different cgroups.
82a37132
DB
9Also, Netfilter (iptables) can use this tag to perform
10actions on such packets.
077f02f1
RR
11
12Creating a net_cls cgroups instance creates a net_cls.classid file.
13This net_cls.classid value is initialized to 0.
14
15You can write hexadecimal values to net_cls.classid; the format for these
16values is 0xAAAABBBB; AAAA is the major handle number and BBBB
17is the minor handle number.
18Reading net_cls.classid yields a decimal result.
19
20Example:
21mkdir /sys/fs/cgroup/net_cls
22mount -t cgroup -onet_cls net_cls /sys/fs/cgroup/net_cls
23mkdir /sys/fs/cgroup/net_cls/0
24echo 0x100001 > /sys/fs/cgroup/net_cls/0/net_cls.classid
25 - setting a 10:1 handle.
26
27cat /sys/fs/cgroup/net_cls/0/net_cls.classid
281048577
29
30configuring tc:
31tc qdisc add dev eth0 root handle 10: htb
32
33tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit
34 - creating traffic class 10:1
35
36tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup
82a37132
DB
37
38configuring iptables, basic example:
39iptables -A OUTPUT -m cgroup ! --cgroup 0x100001 -j DROP