docs: Clarify 'burst' units for QoS

The burst attribute for bandwidth specifies how much bytes can be
transmitted in a single burst. Therefore, the unit is in
multiples of 1024 (thus kibibytes) not SI-like 1000. It has
always been like that.

The 'tc' output is still confusing though, for instance:

  # tc class add dev $DEV parent 1: classid 1:1 htb rate 1000kbps burst 2097152
  # tc class show dev vnet2
  class htb 1:1 root rate 8Mbit ceil 8Mbit burst 2Mb cburst 1600b

Please note that 2097152 = 2*1024*1024. Even the man page is
confusing. From tc(8):

  kb or k        Kilobytes
  mb or m        Megabytes

But I guess this is because 'tc' predates IEC standardisation of
binary multiples and thus can't change without breaking scripts
parsing its output.

And while at it, adjust _virNetDevBandwidthRate struct member
description, to make it obvious which members use SI/IEC units.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2022-01-03 15:56:43 +01:00
parent d2a9c24b84
commit f3b422d9cc
2 changed files with 5 additions and 5 deletions

View File

@ -634,7 +634,7 @@
</dd>
<dt><code>burst</code></dt>
<dd>
Optional attribute which specifies the amount of kilobytes that
Optional attribute which specifies the amount of kibibytes that
can be transmitted in a single burst at <code>peak</code> speed.
</dd>
<dt><code>floor</code></dt>

View File

@ -23,10 +23,10 @@
typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate;
struct _virNetDevBandwidthRate {
unsigned long long average; /* kbytes/s */
unsigned long long peak; /* kbytes/s */
unsigned long long floor; /* kbytes/s */
unsigned long long burst; /* kbytes */
unsigned long long average; /* kilobytes/s */
unsigned long long peak; /* kilobytes/s */
unsigned long long floor; /* kilobytes/s */
unsigned long long burst; /* kibibytes */
};
typedef struct _virNetDevBandwidth virNetDevBandwidth;