Programmable Internetworking & Communication Operating System Docs ... Click Spaces -> Space Directory to see docs for all releases ...
Page tree
Skip to end of metadata
Go to start of metadata

Summary

If we don't limit the user ability to send data, then a large amount of traffic from different users could continuously make the network congested. In order to allocate the network resources to each user fairly and efficiently, the traffic should be limited. For instance, for the flow of a stream at each time interval, we only assign it a portion of the network resources to prevent network congestion caused by excessive burst.


In the ovs mode, user can configure meter to achieve interface and set the speed-limit including ingress and egress.The meter uses the token bucket to evaluate the specifications of the traffic, then makes a policy for the traffic, such as through, remark or drop.

Now we support 1R2C and 2R3C for the token bucket in the ingress meter and egress meter.

Configuration

In different hardware models, the maximum count of meters that PicOS OVS supports is different. User can use the command to check the maximum count.

And from version 2.9.2,meter capability also support pps.

admin@PicOS-OVS$ovs-ofctl meter-features br0
OFPST_METER_FEATURES reply (OF1.4) (xid=0x2):
max_meter:2048 max_bands:1 max_color:3
band_types: drop dscp_remark
capabilities: kbps pps burst stats

Ingress Meter

1R2C:  Add a meter, the type=drop.

Without burst size. Limit the rate as 300000 kbps.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=1,kbps,band=type=drop,rate=300000

With burst size. Limit the rate as 300000 kbps and burst 30000 kbit

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,burst,band=type=drop,rate=300000,burst_size=30000

1R2C:  Add a meter, the type=dscp_remark.

Without burst_size. The prec_level=14.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,band=type=dscp_remark,rate=300000,prec_level=14
root@PicOS-OVS$ovs-ofctl add-meter br0 meter=3,pps,band=type=dscp_remark,rate=300000,prec_level=14

With burst_size. The prec_level=14.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,burst,band=type=dscp_remark,rate=300000,prec_level=14,burst_size=30000
root@PicOS-OVS$ovs-ofctl add-meter br0 meter=3,pps,burst,band=type=dscp_remark,rate=300000,prec_level=14,burst_size=30000

Check the meter configuration

admin@PicOS-OVS$ovs-ofctl dump-meters br0
OFPST_METER_CONFIG reply (OF1.4) (xid=0x2):
meter=2 kbps burst bands=
type=dscp_remark rate=300000 burst_size=30000 prec_level=14
meter=3 pps burst bands=
type=dscp_remark rate=300000 burst_size=30000 prec_level=14
admin@PicOS-OVS$

Modify one meter

root@LNOS-OVS$ovs-ofctl mod-meter br0 meter=2,kbps,burst,band=type=dscp_remark,
rate=400000,prec_level=1,burst_size=10000   
root@LNOS-OVS$
root@LNOS-OVS$ovs-ofctl dump-meters br0
OFPST_METER_CONFIG reply (OF1.4) (xid=0x2):
meter=2 kbps burst bands=
type=dscp_remark rate=400000 burst_size=10000 prec_level=1
root@LNOS-OVS$

Dump meter stats

admin@PicOS-OVS$ovs-ofctl meter-stats br0

Delete one meter or all meters

root@LNOS-OVS$ovs-ofctl del-meter br0 meter=2
root@LNOS-OVS$
root@LNOS-OVS$ovs-ofctl del-meters br0       
root@LNOS-OVS$

Notice: If one meter applies to multiple flow entries, all the flow entries will share the meter rate.

Example: 

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=1,kbps,band=type=drop,rate=300000
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=11,dl_dst=22:00:00:00:00:00,dl_src=22:11:11:11:11:11,dl_type=0x0800,actions=meter:1,output:13
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=12,dl_dst=22:00:00:00:00:00,dl_src=22:11:11:11:11:22,dl_type=0x0800,actions=meter:1,output:13

1.Each in_port  are sent 200M flow to one output port.

The resultthe port te-1/1/13,receive 300M flow,all of flow are green,the 100M red flow are dropped.

2R3C:  

Without burst size.

The first bucket limit the rate as 300000 kbps,if the rate more than it and less then 600000 kbps,the packets dscp value wiil be remarked 14.

The second bucket limit the rate as 600000 kbps, if the rate more than it,then beyond the part will be dropped.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,bands=type=dscp_remark,rate=300000,prec_level=14,type=drop,rate=600000


With burst size. Limit the rate as 300000 kbps , 600000 kbps and burst as 10000 kbit, 20000 kbit.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,burst,bands=type=dscp_remark,rate=300000,burst_size=10000,prec_level=14,type=drop,rate=600000,burst_size=20000

Example: 

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,bands=type=dscp_remark,rate=300000,prec_level=14,type=drop,rate=500000
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=11,dl_dst=22:00:00:00:00:00,dl_src=22:11:11:11:11:11,dl_type=0x0800,actions=meter:2,output:13
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=12,dl_dst=22:00:00:00:00:00,dl_src=22:11:11:11:11:22,dl_type=0x0800,actions=meter:2,output:13

1. Each in_port  are sent 200M  flow to one output port.

The result: the port te-1/1/13 is receive 400M flow,including 300M green flow,and 100M yellow,no red flow.

2. Each in_port  are sent 300M  flow to one output port.

The resultthe port te-1/1/13 is receive 500M flow,including 300M green flow, 200M yellow flow, and 100M red flow are dropped.

Egress Meter

Egress meter need redistribute meter id, and it can't be used by ingress meter. After configuring,need restart the ovs service.

root@LNOS-OVS$ovs-vsctl set-meter-ranges egress-meter=3-4 
  Please reboot for the change to take effect!
root@LNOS-OVS$/etc/init.d/picos restart

Check egress meter configuration

root@LNOS-OVS$ovs-vsctl show-meter-ranges
meter_ranges: 
  egress-meter=3-4 
root@LNOS-OVS$

 

The egress meter configuration is the same as ingress meter.And egress meter is also support 1R2C and 2R3C.

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=3,kbps,bands=type=dscp_remark,rate=300000,prec_level=14,type=drop,rate=500000

root@PicOS-OVS$ovs-ofctl add-meter br0 meter=4,pps,bands=type=dscp_remark,rate=300000,prec_level=14,type=drop,rate=500000

Then put a flow need applying egress meter.

root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=1,ip,nw_src=1.1.1.2,actions=egress_meter:3,output:38
root@PicOS-OVS$ovs-ofctl add-flow br0 in_port=14,ip,nw_src=1.1.1.2,actions=egress_meter:4,output:38

 

Notice: 

1.The meter configure at most two bands now in a meter flow. If only one band is set, 1R2C is effective; otherwise, 2R3C is used, and the rate configured in band1 should be smaller than rate in band2. 

2.If the type of band1 is drop, the type of band2 is invalid.

3.ingress meter use color-blind mode which means the bucket don't care the color of incoming packets.

4.egress meter use color-aware mode which means the bucket can aware the color of incoming packets.

Application:

root@LNOS-OVS$ovs-vsctl set-meter-ranges egress-meter=3-4  
  Please reboot for the change to take effect!
root@LNOS-OVS$/etc/init.d/picos restart
 
Ingress meter:
root@LNOS-OVS$ovs-ofctl add-meter br0 meter=1,kbps,bands=type=dscp_remark,rate=
100000,prec_level=1,type=drop,rate=300000
root@LNOS-OVS$ovs-ofctl add-meter br0 meter=2,kbps,bands=type=dscp_remark,rate=
100000,prec_level=14,type=drop,rate=300000
 
Egress meter:
ovs-ofctl
add-meter br0 meter=3,kbps,bands=type=drop,rate=200000 
 
Add flow:
root@LNOS-OVS$ovs-ofctl add-flow br0 in_port=33,ip,dl_src=22:11:11:11:11:11,act
ions=meter:1,egress_meter:3,output:35 
root@LNOS-OVS$ovs-ofctl add-flow br0 in_port=34,ip,dl_src=22:11:11:11:11:12,act
ions=meter:2,egress_meter:3,output:35 
root@LNOS-OVS$
root@LNOS-OVS$ovs-appctl pica/dump-flows
#0 normal_d permanent flow_id=2 priority=0, actions:drop
#2 normal permanent flow_id=6 ip,in_port=33,dl_src=22:11:11:11:11:11, actions:meter(id=1,band(dscp_remark=1),band(drop)),egress_meter(id=3,band(drop)),35
#3 normal permanent flow_id=7 ip,in_port=34,dl_src=22:11:11:11:11:12, actions:meter(id=2,band(dscp_remark=14),band(drop)),egress_meter(id=3,band(drop)),35
Total 3 flows in HW.
root@LNOS-OVS$

 

Process:

sent 200M flow to port 33,50M flow to 34.

  

 

Resultthe port te-1/1/35 receive 200M flow,including 150M green flow and 50M yellow flow.

Other Result:

1. Each in_port  are sent 90M  flow to one output port.

The resultthe port te-1/1/35 receive 180M flow,all of  flow are green.

2. sent 150M flow to port 33,40M flow to 34.

The result: the port te-1/1/35 receive 190M flow,including 50M yellow flow and 140M green flow. 

3. Each in_port  are sent 150M  flow to one output port.

The resultthe port te-1/1/35 receive 200M flow,including 200M green flow.

4. sent 250M flow to port 33,70M flow to 34.

The resultthe port te-1/1/35 receive 200M flow,including 170M green flow and 30M yellow flow.

5. sent 350M flow to port 33,150M flow to 34.

The resultthe port te-1/1/35 receive 200M flow,including 200M green flow.

6. sent 350M flow to port 33,350M flow to 34.

The resultthe port te-1/1/35 receive 200M flow,including 200M green flow.

 

NOTICE:

1. 

Simply put, the setting of the Meter parameter depends on the speed-limit of the actual traffic.
In principle, the token bucket capacity needs to be greater than or equal to the length of the largest packet and the normal burst of traffic in the network.

For the PICA8 switches, we have a summary of empirical formulas:
1.rate ≤ 100Mbit/s, token bucket capacity (kbits) = rate (Mbit/s) * 1000 (s)
2.rate > 100Mbit/s, token bucket capacity (kbits) = 100000 (kbit/s) * (s)

2.

Now, Ingress meter are supportted all platform, but egress meter just part of platform are supportted,as shown below:

NIAGARA2632XL // NIAGARA2948_6XL // S4048
PRONTO5101 // PRONTO5401 // AS6712_32X
AS5712_54X // AS6701_32X // ARCTICA4806XP
AS5812_54T

 

  • No labels