lartc.org : Linux Advanced Routing & Traffic Control
(Answer) (Category) lartc.org FAQ :
bit or byte ?
If you have to specify a rate or a number of bytes, tc acceps the following :
  • For rate :
    • kbps = 1024 bps
    • mbps = 1024 * 1024 bps
    • kbit = 1024 /8 bps
    • mbit = 1024 * 1024 /8 bps
    • bps = bytes per second
  • For bytes :
    • kb = 1024 bytes
    • k = 1024 bytes
    • mb = 1024 * 1024 bytes
    • m = 1024 * 1024 bytes
    • mbit = 1024 * 1024 / 8 bytes
    • b = bytes

So as long as there is bit, it's bit, in all other cases, it's byte.

If tc prints, it uses the following :

  • For rate :
    • Mbit = bytes / 1024 / 1024
    • Kbit = bytes / 1024
    • bps = bytes
  • For bytes :
    • Mb = bytes / 1024 / 1024
    • Kb = bytes / 1024
    • b = bytes

stef.coene@docum.org
This was snipped from an answer about tcng and tc on the LARTC mailing list. The full text of my reply is available here:
  http://mailman.ds9a.nl/pipermail/lartc/2003q4/010826.html
[snip]
You have not actually found a bug, but rather a historical strangeness about the Linux traffic control system. For reasons of which I'm ignorant, the syntax for the "tc" command uses bps for bytes/second. So, 64000 bytes/second is actually 512 kilobits/second ("512 kbps" in common usage), but is 512 kbit to the "tc" tool. Here's a brief chart:
                      tc syntax       tcng syntax
                  +----------------+----------------+
     bytes/second |      bps       |      Bps       |
      bits/second |      bit       |      bps       |
 kilobytes/second |     kbps       |     kBps       |
  kilobits/second |     kbit       |     kbps       |
                  +----------------+----------------+
Note that the tcng syntax is exactly the same sort of syntax we use in general when discussing speed of WAN links. "It's a 512 kbps line" means it's 512 kilobits per second, but this would be 64000 bytes per second if we were writing a "tc" command line.
[snip]
mabrown-lartc@securepipe.com
[Append to This Answer]
Previous: (Answer) TC + Squid
Next: (Category) IMQ device
This document is: http://qos.dyndns.org:3389/cgi-bin/fom?file=74
[Search] [Appearance]
This is a Faq-O-Matic 2.719.