{
    "mode": "man",
    "parameter": "CBQ",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/CBQ/8/json",
    "generated": "2026-08-17T12:05:13Z",
    "synopsis": "tc  qdisc  ...  dev  dev ( parent classid | root) [ handle major: ] cbq [ allot bytes ] avpkt\nbytes bandwidth rate [ cell bytes ] [ ewma log ] [ mpu bytes ]\ntc class ... dev dev parent major:[minor] [ classid major:minor ] cbq allot bytes [ bandwidth\nrate ] [ rate rate ] prio priority [ weight weight ] [ minburst packets ] [ maxburst  packets\n] [ ewma log ] [ cell bytes ] avpkt bytes [ mpu bytes ] [ bounded isolated ] [ split handle &\ndefmap defmap ] [ estimator interval timeconstant ]",
    "sections": {
        "NAME": {
            "content": "CBQ - Class Based Queueing\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "tc  qdisc  ...  dev  dev ( parent classid | root) [ handle major: ] cbq [ allot bytes ] avpkt\nbytes bandwidth rate [ cell bytes ] [ ewma log ] [ mpu bytes ]\n\ntc class ... dev dev parent major:[minor] [ classid major:minor ] cbq allot bytes [ bandwidth\nrate ] [ rate rate ] prio priority [ weight weight ] [ minburst packets ] [ maxburst  packets\n] [ ewma log ] [ cell bytes ] avpkt bytes [ mpu bytes ] [ bounded isolated ] [ split handle &\ndefmap defmap ] [ estimator interval timeconstant ]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Class  Based  Queueing  is  a  classful qdisc that implements a rich linksharing hierarchy of\nclasses. It contains shaping elements as well as prioritizing capabilities. Shaping  is  per‐\nformed using link idle time calculations based on the timing of dequeue events and underlying\nlink bandwidth.\n\n",
            "subsections": []
        },
        "SHAPING ALGORITHM": {
            "content": "When  shaping  a 10mbit/s connection to 1mbit/s, the link will be idle 90% of the time. If it\nisn't, it needs to be throttled so that it IS idle 90% of the time.\n\nDuring operations, the effective idletime is measured using an  exponential  weighted  moving\naverage  (EWMA),  which considers recent packets to be exponentially more important than past\nones. The Unix loadaverage is calculated in the same way.\n\nThe calculated idle time is subtracted from the EWMA measured one, the  resulting  number  is\ncalled  'avgidle'.  A perfectly loaded link has an avgidle of zero: packets arrive exactly at\nthe calculated interval.\n\nAn overloaded link has a negative avgidle and if it gets too negative, CBQ throttles  and  is\nthen 'overlimit'.\n\nConversely,  an  idle  link might amass a huge avgidle, which would then allow infinite band‐\nwidths after a few hours of silence. To prevent this, avgidle is capped at maxidle.\n\nIf overlimit, in theory, the CBQ could throttle itself for exactly the amount  of  time  that\nwas  calculated to pass between packets, and then pass one packet, and throttle again. Due to\ntimer resolution constraints, this may not be feasible, see the minburst parameter below.\n\n",
            "subsections": []
        },
        "CLASSIFICATION": {
            "content": "Within the one CBQ instance many classes may exist. Each of these  classes  contains  another\nqdisc, by default tc-pfifo(8).\n\nWhen  enqueueing a packet, CBQ starts at the root and uses various methods to determine which\nclass should receive the data.\n\nIn the absence of uncommon configuration options, the process is rather easy.  At  each  node\nwe  look  for  an  instruction, and then go to the class the instruction refers us to. If the\nclass found is a barren leaf-node (without children), we enqueue the packet there. If  it  is\nnot yet a leaf node, we do the whole thing over again starting from that node.\n\nThe  following  actions  are performed, in order at each node we visit, until one sends us to\nanother node, or terminates the process.\n\n(i)    Consult filters attached to the class. If sent to a leafnode, we are done.  Otherwise,\nrestart.\n\n(ii)   Consult the defmap for the priority assigned to this packet, which depends on the  TOS\nbits. Check if the referral is leafless, otherwise restart.\n\n(iii)  Ask  the  defmap for instructions for the 'best effort' priority. Check the answer for\nleafness, otherwise restart.\n\n(iv)   If none of the above returned with an instruction, enqueue at this node.\n\nThis algorithm makes sure that a packet always ends up somewhere, even  while  you  are  busy\nbuilding your configuration.\n\nFor more details, see tc-cbq-details(8).\n\n",
            "subsections": []
        },
        "LINK SHARING ALGORITHM": {
            "content": "When  dequeuing  for  sending to the network device, CBQ decides which of its classes will be\nallowed to send. It does so with a Weighted Round Robin process  in  which  each  class  with\npackets  gets a chance to send in turn. The WRR process starts by asking the highest priority\nclasses (lowest numerically - highest semantically) for packets, and will continue to  do  so\nuntil  they  have  no more data to offer, in which case the process repeats for lower priori‐\nties.\n\nClasses by default borrow bandwidth from their siblings. A class can be prevented from  doing\nso  by  declaring it 'bounded'. A class can also indicate its unwillingness to lend out band‐\nwidth by being 'isolated'.\n\n",
            "subsections": []
        },
        "QDISC": {
            "content": "The root of a CBQ qdisc class tree has the following parameters:\n\n\nparent major:minor | root\nThis mandatory parameter determines the place of the CBQ instance, either at the  root\nof an interface or within an existing class.\n\nhandle major:\nLike  all other qdiscs, the CBQ can be assigned a handle. Should consist only of a ma‐\njor number, followed by a colon. Optional, but very useful if classes will  be  gener‐\nated within this qdisc.\n\nallot bytes\nThis  allotment is the 'chunkiness' of link sharing and is used for determining packet\ntransmission time tables. The qdisc allot differs slightly from the class  allot  dis‐\ncussed below. Optional. Defaults to a reasonable value, related to avpkt.\n\navpkt bytes\nThe  average  size of a packet is needed for calculating maxidle, and is also used for\nmaking sure 'allot' has a safe value. Mandatory.\n\nbandwidth rate\nTo determine the idle time, CBQ must know the bandwidth of  your  underlying  physical\ninterface, or parent qdisc. This is a vital parameter, more about it later. Mandatory.\n\ncell   The  cell size determines he granularity of packet transmission time calculations. Has\na sensible default.\n\nmpu    A zero sized packet may still take time to transmit. This value is the lower  cap  for\npacket  transmission  time  calculations  -  packets smaller than this value are still\ndeemed to have this size. Defaults to zero.\n\newma log\nWhen CBQ needs to measure the average idle time, it does  so  using  an  Exponentially\nWeighted Moving Average which smooths out measurements into a moving average. The EWMA\nLOG determines how much smoothing occurs. Lower values imply greater sensitivity. Must\nbe between 0 and 31. Defaults to 5.\n\nA  CBQ  qdisc  does not shape out of its own accord. It only needs to know certain parameters\nabout the underlying link. Actual shaping is done in classes.\n\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "Classes have a host of parameters to configure their operation.\n\n\nparent major:minor\nPlace of this class within the hierarchy. If attached directly to a qdisc and  not  to\nanother class, minor can be omitted. Mandatory.\n\nclassid major:minor\nLike  qdiscs, classes can be named. The major number must be equal to the major number\nof the qdisc to which it belongs. Optional, but needed if this class is going to  have\nchildren.\n\nweight weight\nWhen  dequeuing to the interface, classes are tried for traffic in a round-robin fash‐\nion. Classes with a higher configured qdisc will generally have more traffic to  offer\nduring  each round, so it makes sense to allow it to dequeue more traffic. All weights\nunder a class are normalized, so only the ratios matter. Defaults  to  the  configured\nrate, unless the priority of this class is maximal, in which case it is set to 1.\n\nallot bytes\nAllot  specifies  how many bytes a qdisc can dequeue during each round of the process.\nThis parameter is weighted  using  the  renormalized  class  weight  described  above.\nSilently capped at a minimum of 3/2 avpkt. Mandatory.\n\n\nprio priority\nIn the round-robin process, classes with the lowest priority field are tried for pack‐\nets first. Mandatory.\n\n\navpkt  See the QDISC section.\n\n\nrate rate\nMaximum rate this class and all its children combined can send at. Mandatory.\n\n\nbandwidth rate\nThis  is different from the bandwidth specified when creating a CBQ disc! Only used to\ndetermine maxidle and offtime, which are only calculated when specifying  maxburst  or\nminburst. Mandatory if specifying maxburst or minburst.\n\n\nmaxburst\nThis  number  of packets is used to calculate maxidle so that when avgidle is at maxi‐\ndle, this number of average packets can be burst before avgidle drops  to  0.  Set  it\nhigher  to  be  more tolerant of bursts. You can't set maxidle directly, only via this\nparameter.\n\n\nminburst\nAs mentioned before, CBQ needs to throttle in case of overlimit. The ideal solution is\nto do so for exactly the calculated idle time, and pass 1 packet. However,  Unix  ker‐\nnels  generally  have a hard time scheduling events shorter than 10ms, so it is better\nto throttle for a longer period, and then pass minburst packets in one  go,  and  then\nsleep minburst times longer.\n\nThe  time  to wait is called the offtime. Higher values of minburst lead to more accu‐\nrate shaping in the long term, but to bigger bursts  at  millisecond  timescales.  Op‐\ntional.\n\n\nminidle\nIf  avgidle  is  below 0, we are overlimits and need to wait until avgidle will be big\nenough to send one packet. To prevent a sudden burst from shutting down the link for a\nprolonged period of time, avgidle is reset to minidle if it gets too low.\n\nMinidle is specified in negative microseconds, so 10 means that avgidle is  capped  at\n-10us. Optional.\n\n\nbounded\nSignifies that this class will not borrow bandwidth from its siblings.\n\nisolated\nMeans that this class will not borrow bandwidth to its siblings\n\n\nsplit major:minor & defmap bitmap[/bitmap]\nIf  consulting  filters attached to a class did not give a verdict, CBQ can also clas‐\nsify based on the packet's priority. There are 16 priorities available, numbered  from\n0 to 15.\n\nThe  defmap  specifies  which  priorities  this class wants to receive, specified as a\nbitmap. The Least Significant Bit corresponds to priority zero.  The  split  parameter\ntells CBQ at which class the decision must be made, which should be a (grand)parent of\nthe class you are adding.\n\nAs  an example, 'tc class add ... classid 10:1 cbq .. split 10:0 defmap c0' configures\nclass 10:0 to send packets with priorities 6 and 7 to 10:1.\n\nThe complimentary configuration would then be: 'tc class add ... classid 10:2 cbq  ...\nsplit 10:0 defmap 3f' Which would send all packets 0, 1, 2, 3, 4 and 5 to 10:1.\n\nestimator interval timeconstant\nCBQ  can  measure  how much bandwidth each class is using, which tc filters can use to\nclassify packets with. In order to determine the bandwidth it uses a very simple esti‐\nmator that measures once every interval microseconds how much traffic has passed. This\nagain is a EWMA, for which the time constant can be specified, also  in  microseconds.\nThe  time  constant corresponds to the sluggishness of the measurement or, conversely,\nto the sensitivity of the average to short bursts. Higher values mean  less  sensitiv‐\nity.\n\n",
            "subsections": []
        },
        "BUGS": {
            "content": "The actual bandwidth of the underlying link may not be known, for example in the case of PPoE\nor  PPTP  connections  which in fact may send over a pipe, instead of over a physical device.\nCBQ is quite resilient to major errors in the configured bandwidth, probably a  the  cost  of\ncoarser shaping.\n\nDefault  kernels rely on coarse timing information for making decisions. These may make shap‐\ning precise in the long term, but inaccurate on second long scales.\n\nSee tc-cbq-details(8) for hints on how to improve this.\n\n",
            "subsections": []
        },
        "SOURCES": {
            "content": "o      Sally Floyd and Van Jacobson, \"Link-sharing and Resource Management Models for  Packet\nNetworks\", IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995\n\n\no      Sally Floyd, \"Notes on CBQ and Guaranteed Service\", 1995\n\n\no      Sally Floyd, \"Notes on Class-Based Queueing: Setting Parameters\", 1996\n\n\no      Sally  Floyd and Michael Speer, \"Experimental Results for Class-Based Queueing\", 1998,\nnot published.\n\n\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "tc(8)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Alexey  N.  Kuznetsov,  <kuznet@ms2.inr.ac.ru>.  This  manpage  maintained  by  bert   hubert\n<ahu@ds9a.nl>\n\niproute2                                  16 December 2001                                    CBQ(8)",
            "subsections": []
        }
    },
    "summary": "CBQ - Class Based Queueing",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "tc",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
        }
    ]
}