Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 60 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




       tc  qdisc  ...  dev  dev ( parent classid | root) [ handle
       major: ] cbq [ allot bytes ] avpkt bytes bandwidth rate  [
       cell bytes ] [ ewma log ] [ mpu bytes ]

       tc  class  ...  dev  dev  parent  major:[minor]  [ classid
       major:minor ] cbq allot bytes [ bandwidth rate  ]  [  rate
       rate  ] prio priority [ weight weight ] [ minburst packets
       ] [ maxburst packets ] [ ewma log ] [ cell bytes  ]  avpkt
       bytes  [ mpu bytes ] [ bounded isolated ] [ split handle &
       defmap defmap ] [ estimator interval timeconstant ]


       Class Based Queueing is a classful qdisc that implements a
       rich  linksharing hierarchy of classes.  It contains shap­
       ing elements as well as prioritizing capabilities.   Shap­
       ing  is  performed using link idle time calculations based
       on the timing of dequeue events and underlying link  band­


       When  shaping  a  10mbit/s connection to 1mbit/s, the link
       will be idle 90% of the time. If it isn't, it needs to  be
       throttled so that it IS idle 90% of the time.

       During  operations,  the  effective  idletime  is measured
       using an exponential weighted moving average (EWMA), which
       considers  recent  packets to be exponentially more impor­
       tant than past ones. The Unix loadaverage is calculated in
       the same way.

       The  calculated idle time is subtracted from the EWMA mea­
       sured one, the resulting number  is  called  'avgidle'.  A
       perfectly  loaded  link  has  an  avgidle of zero: packets
       arrive exactly at the calculated interval.

       An overloaded link has a negative avgidle and if  it  gets
       too negative, CBQ throttles and is then 'overlimit'.

       Conversely, an idle link might amass a huge avgidle, which
       would then allow infinite bandwidths after a few hours  of
       silence. To prevent this, avgidle is capped at maxidle.

       If overlimit, in theory, the CBQ could throttle itself for
       exactly the amount of time that  was  calculated  to  pass
       between  packets,  and  then pass one packet, and throttle
       again. Due to timer resolution constraints, this  may  not
       be feasible, see the minburst parameter below.

       leaf node, we do the whole thing over again starting  from
       that node.

       The following actions are performed, in order at each node
       we visit, until one sends us to another  node,  or  termi­
       nates the process.

       (i)    Consult filters attached to the class. If sent to a
              leafnode, we are done.  Otherwise, restart.

       (ii)   Consult the defmap for  the  priority  assigned  to
              this  packet,  which depends on the TOS bits. Check
              if the referral is leafless, otherwise restart.

       (iii)  Ask the  defmap  for  instructions  for  the  'best
              effort'  priority.  Check  the answer for leafness,
              otherwise restart.

       (iv)   If none of the above returned with an  instruction,
              enqueue at this node.

       This  algorithm  makes  sure  that a packet always ends up
       somewhere, even while you are busy building your  configu­

       For more details, see tc-cbq-details(8).


       When  dequeuing  for  sending  to  the network device, CBQ
       decides which of its classes will be allowed to  send.  It
       does  so with a Weighted Round Robin process in which each
       class with packets gets a chance to send in turn. The  WRR
       process  starts  by  asking  the  highest priority classes
       (lowest numerically - highest semantically)  for  packets,
       and will continue to do so until they have no more data to
       offer, in which case the process repeats for lower priori­

       Classes by default borrow bandwidth from their siblings. A
       class can be prevented  from  doing  so  by  declaring  it
       'bounded'.  A class can also indicate its unwillingness to
       lend out bandwidth by being 'isolated'.


       The root of a CBQ  qdisc  class  tree  has  the  following

       parent major:minor | root
              This  mandatory  parameter  determines the place of
              to a reasonable value, related to avpkt.

       avpkt bytes
              The average size of a packet is needed  for  calcu­
              lating  maxidle,  and  is also used for making sure
              'allot' has a safe value. Mandatory.

       bandwidth rate
              To determine the idle time, CBQ must know the band­
              width  of  your  underlying  physical interface, or
              parent qdisc. This is a vital parameter, more about
              it later. Mandatory.

       cell   The  cell  size determines he granularity of packet
              transmission  time  calculations.  Has  a  sensible

       mpu    A  zero  sized packet may still take time to trans­
              mit. This value is the lower cap for packet  trans­
              mission  time  calculations  - packets smaller than
              this value are still  deemed  to  have  this  size.
              Defaults to zero.

       ewma log
              When CBQ needs to measure the average idle time, it
              does so  using  an  Exponentially  Weighted  Moving
              Average which smoothes out measurements into a mov­
              ing average.  The  EWMA  LOG  determines  how  much
              smoothing occurs. Lower values imply greater sensi­
              tivity. Must be between 0 and 31. Defaults to 5.

       A CBQ qdisc does not shape out of its own accord. It  only
       needs  to  know  certain  parameters  about the underlying
       link. Actual shaping is done in classes.


       Classes have a host of parameters to configure their oper­

       parent major:minor
              Place  of  this  class  within  the  hierarchy.  If
              attached directly to a qdisc  and  not  to  another
              class, minor can be omitted. Mandatory.

       classid major:minor
              Like qdiscs, classes can be named. The major number
              must be equal to the major number of the  qdisc  to
              which  it  belongs.  Optional,  but  needed if this
              class is going to have children.

              weighted  using  the  renormalized   class   weight
              described  above.  Silently  capped at a minimum of
              3/2 avpkt. Mandatory.

       prio priority
              In the round-robin process, classes with the lowest
              priority  field are tried for packets first. Manda­

       avpkt  See the QDISC section.

       rate rate
              Maximum rate this class and all its  children  com­
              bined can send at. Mandatory.

       bandwidth rate
              This is different from the bandwidth specified when
              creating a CBQ disc! Only used to determine maxidle
              and  offtime, which are only calculated when speci­
              fying maxburst or minburst. Mandatory if specifying
              maxburst or minburst.

              This number of packets is used to calculate maxidle
              so that when avgidle is at maxidle, this number  of
              average  packets  can be burst before avgidle drops
              to 0. Set it higher to be more tolerant of  bursts.
              You  can't  set  maxidle  directly,  only  via this

              As mentioned before, CBQ needs to throttle in  case
              of  overlimit.  The  ideal solution is to do so for
              exactly  the  calculated  idle  time,  and  pass  1
              packet. However, Unix kernels generally have a hard
              time scheduling events shorter than 10ms, so it  is
              better  to  throttle  for a longer period, and then
              pass minburst packets in one  go,  and  then  sleep
              minburst times longer.

              The time to wait is called the offtime. Higher val­
              ues of minburst lead to more  accurate  shaping  in
              the  long term, but to bigger bursts at millisecond
              timescales. Optional.

              Means  that this class will not borrow bandwidth to
              its siblings

       split major:minor & defmap bitmap[/bitmap]
              If consulting filters attached to a class  did  not
              give  a verdict, CBQ can also classify based on the
              packet's priority. There are 16  priorities  avail­
              able, numbered from 0 to 15.

              The  defmap  specifies  which priorities this class
              wants to receive, specified as a bitmap. The  Least
              Significant  Bit  corresponds to priority zero. The
              split parameter tells CBQ at which class the  deci­
              sion  must be made, which should be a (grand)parent
              of the class you are adding.

              As an example, 'tc class add ... classid  10:1  cbq
              ..  split  10:0 defmap c0' configures class 10:0 to
              send packets with priorities 6 and 7 to 10:1.

              The complimentary configuration would then be:  'tc
              class  add  ...  classid  10:2  cbq  ... split 10:0
              defmap 3f' Which would send all packets 0, 1, 2, 3,
              4 and 5 to 10:1.

       estimator interval timeconstant
              CBQ  can  measure  how much bandwidth each class is
              using, which tc filters can use to classify packets
              with. In order to determine the bandwidth it uses a
              very simple  estimator  that  measures  once  every
              interval  microseconds how much traffic has passed.
              This again is a EWMA, for which the  time  constant
              can  be  specified,  also in microseconds. The time
              constant corresponds to  the  sluggishness  of  the
              measurement  or,  conversely, to the sensitivity of
              the average to short  bursts.  Higher  values  mean
              less sensitivity.


       The  actual  bandwidth  of  the underlying link may not be
       known, for example in the case of PPoE or PPTP connections
       which  in  fact  may  send  over a pipe, instead of over a
       physical device. CBQ is quite resilient to major errors in
       the  configured  bandwidth, probably a the cost of coarser

       Default kernels rely on coarse timing information for mak­
       ing  decisions. These may make shaping precise in the long

       o      Sally Floyd, "Notes on Class-Based  Queueing:  Set­
              ting Parameters", 1996

       o      Sally   Floyd   and  Michael  Speer,  "Experimental
              Results for Class-Based Queueing", 1998,  not  pub­




       Alexey  N. Kuznetsov, <kuznet@ms2.inr.ac.ru>. This manpage
       maintained by bert hubert <ahu@ds9a.nl>

iproute2                 16 December 2001                  CBQ(8)



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
You can choose larger fonts by selecting a different themes.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.10 Seconds