On 6/29/22 10:22, Nikola Ciprich wrote:
> Hello Michal,
> 
>>
>> Oh, I've thought that libvirt-7.0.0 already used ovs-vsctl to set up QoS
>> but it didn't. That was added only in libvirt-7.6.0. Previously, libvirt
>> used 'tc' to set up QoS which was obviously suboptimal, because OVS kept
>> clearing the setting.
>>
>> So, back to the original question, what's the ovs-vsctl equivalent of:
>>
>> tc qdisc del dev eth0 root
>> tc qdisc del dev eth0 ingress
>> tc qdisc add dev eth0 root handle 1: htb default 1
>> tc class add dev eth0 parent 1: classid 1:1 htb rate 128000kbps quantum 10922
>> tc qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10
>> tc filter add dev eth0 parent 1:0 protocol all prio 1 handle 1 fw flowid 1
>> tc qdisc add dev eth0 ingress
>> tc filter add dev eth0 parent ffff: protocol all u32 match u32 0 0 police 
>> rate 128000kbps burst 128000kb mtu 64kb drop flowid :1
>>
>> Libvirt would currently generate:
>>
>> ovs-vsctl --timeout=5 --no-heading --columns=_uuid find queue 
>> 'external-ids:vm-id="c1018351-a229-4209-9faf-42446e0b53e5"' 
>> 'external-ids:ifname="eth0"'
>> ovs-vsctl --timeout=5 --no-heading --columns=_uuid find qos 
>> 'external-ids:vm-id="c1018351-a229-4209-9faf-42446e0b53e5"' 
>> 'external-ids:ifname="eth0"'
>> ovs-vsctl --timeout=5 set port eth0 qos=@qos1 
>> 'external-ids:vm-id="c1018351-a229-4209-9faf-42446e0b53e5"' 
>> 'external-ids:ifname="eth0"' -- --id=@qos1 create qos type=linux-htb 
>> other_config:min-rate=1024000000 queues:0=@queue0 
>> 'external-ids:vm-id="c1018351-a229-4209-9faf-42446e0b53e5"' 
>> 'external-ids:ifname="eth0"' -- --id=@queue0 create queue 
>> other_config:min-rate=1024000000 
>> 'external-ids:vm-id="c1018351-a229-4209-9faf-42446e0b53e5"' 
>> 'external-ids:ifname="eth0"'
>> ovs-vsctl --timeout=5 set Interface eth0 ingress_policing_rate=1024000
>>
>> BTW: there was a fix in libvirt-8.0.0, which could help. It fixed
>> conversion from kibibytes to bits (factor of 8000 vs 8192). Nikola, can
>> you please give it a try?
>>
> 
> we've retested it with newer versions:
> 
> [root@testv1a ~]# virsh version
> Sestaveno vůči knihovně: libvirt 8.1.0
> S použitím knihovny: libvirt 8.1.0
> Používá se API: QEMU 8.1.0
> Spuštěný hypervizor: QEMU 6.1.0
> 
> ovs_version: "2.13.3"
> 
> domiftune testv1-test-3 vnet5 --inbound 12800,0,0 --outbound 12800,0,0
> 
> same result:
> 
> [root@testv1a qemu]# tc class show dev vnet5
> class htb 1:1 parent 1:fffe prio 0 rate 10Mbit ceil 10Mbit burst 9163b cburst 
> 9163b 
> class htb 1:fffe root rate 10Mbit ceil 10Mbit burst 9100b cburst 9100b

Alright, so with a regular TAP, outside of OVS reach I get the following
for the above input:

# tc class show dev vnet0 
class htb 1:1 root leaf 2: prio 0 rate 102400Kbit ceil 102400Kbit burst 1587b 
cburst 1587b 

# tc filter show dev vnet0 ingress 
filter parent ffff: protocol all pref 49152 u32 chain 0 
filter parent ffff: protocol all pref 49152 u32 chain 0 fh 800: ht divisor 1 
filter parent ffff: protocol all pref 49152 u32 chain 0 fh 800::800 order 2048 
key ht 800 bkt 0 flowid :1 not_in_hw 
  match 00000000/00000000 at 0
 police 0x2 rate 102400Kbit burst 12800Kb mtu 64Kb action drop overhead 0b 
        ref 1 bind 1

And 102400Kbit = 12800KiB which is the input value. Therefore, what we
really need here is confirmation from OVS team about the units for QoS.
Unfortunately, it's NOT documented (I don't quite understand why).

I've found an example here [1] where to limit ingress at 10Mbps they
suggest:

ovs-vsctl set interface vif1.0 ingress_policing_rate=10000

which means that the unit for ingress_policing_rate is kbps. Therefore,
12800KiB/s (your input) times 8 (bits in byte) = 102400 (kbit/s) which
is what libvirt generates. So why OVS configures something else?

If only there was a way to tell OVS to not clear QoS set from outside,
we could avoid this regression. But there isn't.

1: https://docs.openvswitch.org/en/latest/faq/qos/

Michal

_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to