mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
virnetdevbandwidth.c: Put a limit to "quantum"
The "quantum" attribute of HTB is documented as: Number of bytes to serve from this class before the scheduler moves to the next class. Since v1.3.2-rc1~225 we compute what we think is the appropriate value and pass it on the TC command line. But kernel and subsequently TC use uint32_t to store this value. If we compute value outside of this type then TC fails and prints usage which we then interpret as an error message. Needlessly long error message. While there's not much we can do about the latter, we can put a cap on the value and stop tickling this behavior of TC. Fixes: 065054daa71f645fc83aff0271f194d326208616 Resolves: https://issues.redhat.com/browse/RHEL-34112 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
948d496d25
commit
ac9c3c0b2c
@ -46,6 +46,7 @@ virNetDevBandwidthCmdAddOptimalQuantum(virCommand *cmd,
|
|||||||
const virNetDevBandwidthRate *rate)
|
const virNetDevBandwidthRate *rate)
|
||||||
{
|
{
|
||||||
const unsigned long long mtu = 1500;
|
const unsigned long long mtu = 1500;
|
||||||
|
const unsigned long long r2q_limit = UINT32_MAX;
|
||||||
unsigned long long r2q;
|
unsigned long long r2q;
|
||||||
|
|
||||||
/* When two or more classes compete for unused bandwidth they are each
|
/* When two or more classes compete for unused bandwidth they are each
|
||||||
@ -60,6 +61,11 @@ virNetDevBandwidthCmdAddOptimalQuantum(virCommand *cmd,
|
|||||||
if (!r2q)
|
if (!r2q)
|
||||||
r2q = 1;
|
r2q = 1;
|
||||||
|
|
||||||
|
/* But there's an internal limit in TC (well, kernel's implementation of
|
||||||
|
* HTB) for quantum: it has to fit into u32. Put a cap there. */
|
||||||
|
if (r2q > r2q_limit)
|
||||||
|
r2q = r2q_limit;
|
||||||
|
|
||||||
virCommandAddArg(cmd, "quantum");
|
virCommandAddArg(cmd, "quantum");
|
||||||
virCommandAddArgFormat(cmd, "%llu", r2q);
|
virCommandAddArgFormat(cmd, "%llu", r2q);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user