Documentation_cgroups_net_cls

来源:互联网 发布:中国的软件行业 编辑:程序博客网 时间:2024/04/30 10:57
Chinese translated version of Documentation/pcmcia/devicetable




If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.




Chinese maintainer:  530999000@qq.com
---------------------------------------------------------------------
Documentation/pcmcia/devicetable的中文翻译








如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。




中文版维护者: 王明达   530999000@qq.com
中文版翻译者: 王明达   530999000@qq.com
中文版校译者: 王明达   530999000@qq.com








以下为正文
---------------------------------------------------------------------


Network classifier cgroup


网络分类的cgroup
-------------------------


The Network classifier cgroup provides an interface to
tag network packets with a class identifier (classid).


cgroup的网络分类器提供了一个接口来标签网络数据包的类标识符(classid)。


The Traffic Controller (tc) can be used to assign
different priorities to packets from different cgroups.


流量控制器(TC),可以从不同的cgroup用来分配不同的优先级数据包。


Creating a net_cls cgroups instance creates a net_cls.classid file.
This net_cls.classid value is initialized to 0.


创建一个的cgroup的net_cls实例创建一个net_cls.classid文件。此net_cls.classid
值被初始化为0。


You can write hexadecimal values to net_cls.classid; the format for these
values is 0xAAAABBBB; AAAA is the major handle number and BBBB
is the minor handle number.
Reading net_cls.classid yields a decimal result.


你可以写十六进制值给net_cls.classid;这些格式的值是0xAAAABBBB; AAAA是主要的
手柄数量BBBB是小手柄号码。读net_cls.classid产生一个十进制的结果。


Example:
mkdir /sys/fs/cgroup/net_cls
mount -t cgroup -onet_cls net_cls /sys/fs/cgroup/net_cls
mkdir /sys/fs/cgroup/net_cls/0
echo 0x100001 >  /sys/fs/cgroup/net_cls/0/net_cls.classid
- setting a 10:1 handle.


cat /sys/fs/cgroup/net_cls/0/net_cls.classid
1048577


configuring tc:
tc qdisc add dev eth0 root handle 10: htb


tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit
 - creating traffic class 10:1


tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup