title: How to priotize packets using tc and cgroups
body: <p>I am trying to prioritize the packets that are generated from a certain process group so that they'll be picked first to be transmitted from the PC. I aim to do this by using cgroups and tc, but it seems not to work. </p>
  
  <p>First I set up cgroups on ubuntu as follows,</p>
  
  <pre><code>modprobe cls_cgroup # load this module to get net_cls
  
  mkdir /sys/fs/cgroup/net_cls  # mount point
  
  mount -t cgroup net_cls -onet_cls /sys/fs/cgroup/net_cls/
  
  mkdir /sys/fs/cgroup/net_cls/foo # new cgroup
  
  echo 0x00010001 &gt; /sys/fs/cgroup/foo/net_cls.classid  # echo in a class id
  
  echo 2348 &gt; /sys/fs/cgroup/net_cls/foo/tasks # echo in pid of firefox
  
  tc qdisc add dev eth0 root handle 1: pri
  
  tc qdisc add dev eth0 parent 1:1 handle 10: sfq
  
  tc qdisc add dev eth0 parent 1:2 handle 20: sfq
  
  tc qdisc add dev eth0 parent 1:3 handle 30: sfq
  </code></pre>
  
  <p>and after browsing in firefox and running,</p>
  
  <pre><code>tc -s qdisc ls dev eth0
  </code></pre>
  
  <p>I get,</p>
  
  <pre><code>qdisc prio 1: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
   Sent 29351 bytes 154 pkt (dropped 0, overlimits 0 requeues 0) 
   backlog 0b 0p requeues 0 
  qdisc sfq 10: parent 1:1 limit 127p quantum 1514b divisor 1024 
   Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
   backlog 0b 0p requeues 0 
  qdisc sfq 20: parent 1:2 limit 127p quantum 1514b divisor 1024 
   Sent 27873 bytes 143 pkt (dropped 0, overlimits 0 requeues 0) 
   backlog 0b 0p requeues 0 
  qdisc sfq 30: parent 1:3 limit 127p quantum 1514b divisor 1024 
   Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
   backlog 0b 0p requeues 0 
  </code></pre>
  
  <p>Instead I want the traffic to flow in handle 10, what am I doing wrong?</p>