Configuring QoS scheduler


PicOS OVS Supports qos/queue

1, PicOS OVS support configure qos scheduler type: SP, RR, WRR, WFQ

2, In the PicOS switch, there are 7 queues in ASIC with priority 0~7 (In the current version, P3922/P3780/3920, only support queues 0~3). Queue 7 being the highest priority and queue 0 being the lowest priority. 

 

Command:

Add qos

ovs-vsctl -- set port <interface name> qos=@<qos name1> -- --id=@<qos name1> create qos type=<scheduler type> queues:<queue value1>=@<queue name1> [queues:<queue value2>=@<queue name2>] -- --id=@<queue name1> create queue other-config:min-rate=<bps> other-config:max-rate=<bps> other-config:weight=<weight> [-- --id=@<queue name2> create queue other-config:min-rate=<bps> other-config:max-rate=<bps> other-config:weight=<weight>]

List qos and queue table

ovs-vsctl list qos
ovs-vsctl list queue

Check qos config in interface

ovs-appctl qos/show <interface>
ovs-ofctl queue-get-config br0 [port]

Check queue counter

ovs-ofctl queue-stats <bridge> [port]

Clear queue and qos

ovs-vsctl clear port <interface> qos
ovs-vsctl --all destroy qos 
ovs-vsctl --all destroy queue      

 

 SP

In SP ( short for Strict Priority) mode.

1, The SP queue has priority to be scheduled when work with others queue whether the queue priority is high or not.

2, If different flows from different input ports and enter the different queue on the one output port, and low priority queue has congestion, this time maybe appear Head-of-line blocking.

Example:

Flow (dl_src is 22:11:11:11:11:11) will be forwarded to queue 0 of port 3

Flow (dl_src is 22:11:11:11:11:12) will be forwarded to queue 7 of port 3.
Min and max rate of queue 0 and queue 7 is set as 10M

root@PicOS-OVS# ovs-ofctl del-flows br0
root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=1,dl_src=22:11:11:11:11:11,actions=set_queue:0,output=3 
root@PicOS-OVS# ovs-ofctl add-flow br0 in_port=2,dl_src=22:11:11:11:11:12,actions=set_queue:7,output=3
root@PicOS-OVS# ovs-vsctl -- set port ge-1/1/3 qos=@newqos -- --id=@newqos create qos type=PRONTO_STRICT queues:0=@newqueue queues:7=@newqueue1 -- --id=@newqueue create queue other-config:min-rate=10000000 other-config:max-rate=10000000 -- --id=@newqueue1 create queue other-config:min-rate=10000000 other-config:max-rate=10000000

 

RR

RR(short for   Round Robin) is a scheduler mode of Qos. It uses a round robin scheduling algorithm between the queues and can avoid the lowest priority queues not being serviced for long time when traffic congestion happens.

Example:

Add qos on interface te-1/1/5, and configure queue2 and queue3

ovs-vsctl -- set port te-1/1/5 qos=@newqos -- --id=@newqos create qos type=PRONTO_ROUND_ROBIN queues:2=@newqueue queues:3=@newqueue1 -- --id=@newqueue create queue other-config:min-rate=100000000 other-config:max-rate=200000000 -- --id=@newqueue1 create queue other-config:min-rate=150000000 other-config:max-rate=400000000

 

WRR

WRR(short for  Weighted Round Robin)is a scheduler mode of Qos. It uses a round robin scheduling algorithm between the queues and can avoid the lowest priority queues not being serviced for long time when traffic congestion happens. When you use WRR scheduling mode, you can define your own weighted value for each queue to  distribute different service time for queue.Generaly,greater the weight, longer the serviced time. 

Example:

1.1  Create a qos and add two queues (0 and 3)to qos for port te-1/1/3

root@PicOS-OVS$ovs-vsctl -- set port te-1/1/3 qos=@newqos -- --id=@newqos create qos type=PRONTO_WEIGHTED_ROUND_ROBIN queues:0=@newqueue queues:3=@newqueue1 -- --id=@newqueue create queue other-config=min-rate=200000000,weight=3  -- --id=@newqueue1 create queue other-config=min-rate=200000000,weight=3   
b41dbaab-dc60-40ff-8a11-7a241bfd5a5c
f7c5e8ff-f81f-4e69-9096-9b1251f29618
5d57cffb-b9b7-4324-9402-034ab9fac050
root@PicOS-OVS$


1.2  Flow config

root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=1,dl_src=22:11:11:11:11:11,actions=set_queue:0,output=3 
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=2,dl_src=22:11:11:11:11:12,actions=set_queue:3,output=3
root@PicOS-OVS$ovs-ofctl dump-flows br0
OFPST_FLOW reply (OF1.4) (xid=0x2):
 flow_id=18, cookie=0x0, duration=422.520s, table=0, n_packets=n/a, n_bytes=0, in_port=2,dl_src=22:11:11:11:11:12 actions=set_queue:3,output:3
 flow_id=17, cookie=0x0, duration=426.136s, table=0, n_packets=n/a, n_bytes=0, in_port=1,dl_src=22:11:11:11:11:11 actions=set_queue:0,output:3
root@PicOS-OVS$
root@PicOS-OVS$ovs-appctl pica/dump-flows
#10 normal permanent flow_id=17 in_port=1,dl_src=22:11:11:11:11:11, actions:3
#6 normal_d permanent flow_id=13 priority=0, actions:drop
#8 normal permanent flow_id=18 in_port=2,dl_src=22:11:11:11:11:12, actions:set(skb_priority(0x3)),3
Total 3 flows in HW.
root@PicOS-OVS$
 

notice: queue 0 is the default queue,the HW flow don't display it.


1.3 Result

Firstly,both the queue 0 and queue 7  should provides minimum bandwidth guarantee (200M)  during congestion, then each queue distribute the remaining packets according the queue weight . 

 

2 Check qos

root@PicOS-OVS$ovs-vsctl list qos
_uuid               : b41dbaab-dc60-40ff-8a11-7a241bfd5a5c
external_ids        : {}
other_config        : {}
queues              : {0=f7c5e8ff-f81f-4e69-9096-9b1251f29618, 3=5d57cffb-b9b7-4324-9402-034ab9fac050}
type                : PRONTO_WEIGHTED_ROUND_ROBIN
root@PicOS-OVS$

 

3 Check one queue according to its queue-uuid.

root@PicOS-OVS$ovs-vsctl list queue 5d57cffb-b9b7-4324-9402-034ab9fac050
_uuid               : 5d57cffb-b9b7-4324-9402-034ab9fac050
dscp                : []
external_ids        : {}
other_config        : {min-rate="200000000", weight="3"}
root@PicOS-OVS$


4 Check qos of a port from hardware

root@PicOS-OVS$ovs-appctl qos/show te-1/1/3
QoS: te-1/1/3 PRONTO_WEIGHTED_ROUND_ROBIN
Default:
        burst: 0
        max-rate: 0
        min-rate: 200000000
        weight: 3
        tx_packets: 0
        tx_bytes: 0
        tx_errors: 0
Queue 3:
        burst: 0
        max-rate: 0
        min-rate: 200000000
        weight: 3
        tx_packets: 0
        tx_bytes: 0
        tx_errors: 0
root@PicOS-OVS$

 

Reset one queue according to queue-uuid

root@PicOS-OVS$ovs-vsctl set queue f7c5e8ff-f81f-4e69-9096-9b1251f29618 other-config=min-rate=100000000,weight=2                            
root@PicOS-OVS$
root@PicOS-OVS$ovs-appctl qos/show te-1/1/3                                    
QoS: te-1/1/3 PRONTO_WEIGHTED_ROUND_ROBIN
Default:
        burst: 0
        max-rate: 0
        min-rate: 100000000
        weight: 2
        tx_packets: 0
        tx_bytes: 0
        tx_errors: 0
Queue 3:
        burst: 0
        max-rate: 0
        min-rate: 200000000
        weight: 3
        tx_packets: 0
        tx_bytes: 0
        tx_errors: 0
root@PicOS-OVS$
 

 

6 Remove one queue from qos according qos-uuid and queue-key.

root@PicOS-OVS$ovs-vsctl remove qos b41dbaab-dc60-40ff-8a11-7a241bfd5a5c queue 3
root@PicOS-OVS$
root@PicOS-OVS$ovs-appctl qos/show te-1/1/3                                    
QoS: te-1/1/3 PRONTO_WEIGHTED_ROUND_ROBIN
Default:
        burst: 0
        max-rate: 0
        min-rate: 100000000
        weight: 2
        tx_packets: 0
        tx_bytes: 0
        tx_errors: 0

root@PicOS-OVS$ovs-vsctl destroy queue 5d57cffb-b9b7-4324-9402-034ab9fac050
root@PicOS-OVS$
root@PicOS-OVS$ovs-vsctl list queue
_uuid               : f7c5e8ff-f81f-4e69-9096-9b1251f29618
dscp                : []
external_ids        : {}
other_config        : {min-rate="100000000", weight="2"}
 

 

7 Add one new queue to qos according qos-uuid

root@PicOS-OVS$ovs-vsctl set qos b41dbaab-dc60-40ff-8a11-7a241bfd5a5c queues:1=
@newqueue1 -- --id=@newqueue1 create queue other-config:weight=3
02273a2b-f556-454f-959f-96290dac7642
root@PicOS-OVS$
root@PicOS-OVS$ovs-vsctl list qos
_uuid               : b41dbaab-dc60-40ff-8a11-7a241bfd5a5c
external_ids        : {}
other_config        : {}
queues              : {0=f7c5e8ff-f81f-4e69-9096-9b1251f29618, 1=02273a2b-f556-454f-959f-96290dac7642}
type                : PRONTO_WEIGHTED_ROUND_ROBIN

 

8 Remove all queues from qos

root@PicOS-OVS$ovs-vsctl clear qos b41dbaab-dc60-40ff-8a11-7a241bfd5a5c queues  
root@PicOS-OVS$ovs-vsctl --all destroy queue
root@PicOS-OVS$
root@PicOS-OVS$ovs-vsctl list queue
root@PicOS-OVS$
root@PicOS-OVS$ovs-appctl qos/show te-1/1/3
QoS: te-1/1/3 PRONTO_STRICT
root@PicOS-OVS$


9 Remove qos

root@PicOS-OVS$ovs-vsctl clear port te-1/1/3 qos         
root@PicOS-OVS$ovs-vsctl --all destroy qos      
root@PicOS-OVS$


WFQ

The full name of WFQ is Weighted Fair Queuing. It is similar to WRR. The only difference between WFQ and WRR is that the scheduling mode in WRR is by packets but in WFQ is by bytes.

Example

ovs-vsctl -- set port te-1/1/4 qos=@newqos -- --id=@newqos create qos type=PRONTO_WEIGHTED_FAIR_QUEUING queues:1=@newqueue queues:7=@newqueue1 -- --id=@newqueue create queue
other-config=min-rate=300000000,weight=5  -- --id=@newqueue1 create queue other-config=min-rate=100000000,weight=5

Copyright © 2024 Pica8 Inc. All Rights Reserved.