Hi Jinsheng,

I have tested the patch and have some questions, could you please help to confirm?
1) For inbound, how to check it from the openvswitch side? tc will still show the statistics, is that expected?
2) For outbound, the peak is ignored. I just can not understand the "ingress_policing_burst: 2048", how can it come from the setting "outbound.burst : 256"?
3) Is the output from tc command expected?

Test inbound:
1. start vm with setting as below:
 <interface type='bridge'>
      <source bridge='ovsbr0'/>
      <virtualport type='openvswitch'/>

<bandwidth>

        <inbound average='100' peak='200' burst='256'/>

      </bandwidth>

...

</interface>

2. 

# virsh domiftune rhel vnet5

inbound.average: 100

inbound.peak   : 200

inbound.burst  : 256

inbound.floor  : 0

outbound.average: 0

outbound.peak  : 0

outbound.burst : 0

# ip l

17: vnet5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc htb master ovs-system state UNKNOWN mode DEFAULT group default qlen 1000

    link/ether fe:54:00:4d:43:5a brd ff:ff:ff:ff:ff:ff

# ovs-vsctl show interface

…...

ingress_policing_burst: 0

ingress_policing_kpkts_burst: 0

ingress_policing_kpkts_rate: 0

ingress_policing_rate: 0

…...

name                : vnet5


#  tc -d class show  dev vnet5

class htb 1:1 parent 1:fffe prio 0 quantum 10240 rate 819200bit ceil 1638Kbit linklayer ethernet burst 256Kb/1 mpu 0b cburst 256Kb/1 mpu 0b level 0 

class htb 1:fffe root rate 1638Kbit ceil 1638Kbit linklayer ethernet burst 1499b/1 mpu 0b cburst 1499b/1 mpu 0b level 7 

#  tc -d filter show dev vnet5 parent ffff:

(no outputs)

For outbound:

# virsh dumpxml rhel | grep /bandwidth -B2

 <bandwidth>

        <outbound average='100' peak='200' burst='256'/>

      </bandwidth>

# virsh domiftune rhel vnet9

inbound.average: 0

inbound.peak   : 0

inbound.burst  : 0

inbound.floor  : 0

outbound.average: 100

outbound.peak  : 200

outbound.burst : 256

# ovs-vsctl list interface

ingress_policing_burst: 2048

ingress_policing_kpkts_burst: 0

ingress_policing_kpkts_rate: 0

ingress_policing_rate: 800

...

# tc -d filter show dev vnet9 parent ffff:

filter protocol all pref 49 basic chain 0 

filter protocol all pref 49 basic chain 0 handle 0x1 

action order 1:  police 0x1 rate 800Kbit burst 256Kb mtu 64Kb action drop/pipe overhead 0b linklayer unspec 

ref 1 bind 1

# tc -d class show  dev vnet9

(no outputs)



-------
Best Regards,
Yalan Zhang
IRC: yalzhang


On Mon, Jul 12, 2021 at 3:43 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 7/9/21 3:31 PM, Jinsheng Zhang (张金生)-云服务集团 wrote:
> Here is my signed-off-by line
>
> Signed-off-by: zhangjl02@inspur.com
>
> Thanks again for reminding:) .

Perfect.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

and pushed. Congratulations on your first libvirt contribution!

Michal