Configuring Flow Handling Mode
PicOS supports set-flow-handling-mode from version 2.7.1. If the flow is integrated and can be installed directly, there is no need for set-flow-handling-mode, and whatever mode it is, it should be installed. But If the hardware does not support the actions, or the flow is not an exact match, it will not be installed directly. This is where we need set-flow-handling-mode, to decide what to do with the flow, whether to install the flow and how to install it.
The command is:
admin@PicOS-OVS$ovs-vsctl set-flow-handling-mode [mode]
Mode value: [enable_packet_driven, hardware_flow_only, software_flow_allowed], and default value is software_flow_allowed.
After setting a particular flow handling mode, the switch should be rebooted to make the mode effective.
admin@PicOS-OVS$ovs-vsctl show-flow-handling-mode
Direct Flows
These flows can be installed directly to the hardware table whatever mode it is.
Example 1
admin@XorPlus$ovs-ofctl add-flow br0 in_port=9,ip,actions=push_vlan:0x8100,set_field:19-\>vlan_vid,output:11 admin@PicOS-OVS$ admin@PicOS-OVS$ovs-appctl pica/dump-flows #96 normal permanent flow_id=18 ip,in_port=9, actions:push_vlan(vid=19),mod_vlan_pcp(pcp=0),11 normal_d permanent internal flow_id=7 priority=0, actions:drop Total 1 flows in HW. admin@PicOS-OVS$
Example 2
admin@XorPlus$ovs-ofctl add-flow br0 in_port=9,dl_vlan=19,dl_dst=22:22:22:22:22:22,tcp,actions=set_field:3.3.3.3-\>nw_dst,set_field:800-\>tp_dst,11 admin@PicOS-OVS$ admin@PicOS-OVS$ovs-appctl pica/dump-flows normal_d permanent internal flow_id=7 priority=0, actions:drop #98 normal permanent flow_id=20 tcp,in_port=9,dl_vlan=19,dl_dst=22:22:22:22:22:22, actions:set(ipv4(dst=3.3.3.3)),set(tcp(dst=800)),11 Total 1 flows in HW. admin@PicOS-OVS$
Regardless of whatever flow handling mode is currently in effect, direct flows will always be installed to the hardware table directly.
Packet-driven-flows
The packet-driven status is as follows:
set-flow-handling-mode = hardware_flow_only
This mode forbids the flow installation if the hardware does not support the actions or the flow is not an exact match.
Example
admin@PicOS-OVS$ovs-ofctl add-flow br0 in_port=9,tcp,dl_vlan=19,actions=set_field:192.168.1.1-\>nw_src,set_field:0x123-\>tp_src,11 OFPT_ERROR (OF1.4) (xid=0x2): OFPBAC_MATCH_INCONSISTENT OFPT_FLOW_MOD (OF1.4) (xid=0x2): (***truncated to 64 bytes from 136***) 00000000Â 05 0e 00 88 00 00 00 02-00 00 00 00 00 00 00 00 |................| 00000010Â 00 00 00 00 00 00 00 00-00 00 00 00 00 00 80 00 |................| 00000020Â ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................| 00000030Â 00 01 00 1d 80 00 00 04-00 00 00 09 80 00 0a 02 |................| admin@PicOS-OVS$
In hardware_flow_only mode, configuring packet-driven flows will return an error.
Â
set-flow-handling-mode = software_flow_allowed
This mode forbids the flow installation if the hardware does not support the actions. This mode permits the flow installation TO_CPU if the hardware supports the action but the flow is not exact an match. The item will be submitted to the CPU for further actions .
Example
admin@PicOS-OVS$ovs-ofctl add-flow br0 in_port=9,ip,dl_vlan=199,actions=push_mpls:0x8847,set_field:299-\>mpls_label,11 admin@PicOS-OVS$ovs-appctl pica/dump-flows #1 normal_d permanent flow_id=12 priority=0, actions:drop #2 normal_u permanent flow_id=16 ip,in_port=9,dl_vlan=199, actions:To_CPU(for_packet_driven) Total 2 flows in HW. admin@PicOS-OVS$
Packets which match this flow will be submitted to cpu, and it will not be forwarded at line-speed.
Â
set-packet-driven-mode = enable_packet_driven
This mode forbids the flow installation if the hardware does not support the actions. This mode permits the flow installation TO_CPU if the hardware supports the actions but the flow is not an exact match. The item will be submitted to the CPU. The CPU will modify the match and make it exact by parsing, then install the exact flow.
Example
admin@PicOS-OVS$ovs-ofctl add-flow br0 in_port=9,dl_dst=22:22:22:22:22:22,udp,actions=set_field:192.168.100.2-\>nw_dst,set_field:200-\>udp_dst,11 admin@PicOS-OVS$ admin@PicOS-OVS$ovs-appctl pica/dump-flows #1 normal_d permanent flow_id=12 priority=0, actions:drop #3 normal_u permanent flow_id=17 udp,in_port=9,dl_dst=22:22:22:22:22:22, actions:To_CPU(for_packet_driven) Total 2 flows in HW. admin@PicOS-OVS$
The packets matching this flow are checked in the hardware table, if there is no exact match, the packets are forwarded to the CPU. The CPU will modify the match and install the exact match flow on to the hardware table.
admin@PicOS-OVS$ovs-appctl pica/dump-flows #2 normal flow_id=11 priority=1048560,udp,in_port=9,vlan_tci=0x0000/0x1fff,dl_dst=22:22:22:22:22:22,nw_dst=2.2.2.2,nw_frag=no,tp_src=63,tp_dst=63, actions:set(ipv4(dst=192.168.100.2)),set(udp(dst=200)),11 #0 normal_d permanent flow_id=2 priority=0, actions:drop #1 normal_u permanent flow_id=11 udp,in_port=9,dl_dst=22:22:22:22:22:22, actions:To_CPU(for_packet_driven) Total 3 flows in HW. admin@PicOS-OVS$
Packets can then be transmitted at line-speed since there is now an exact match flow entry in the hardware table.
Â
Copyright © 2024 Pica8 Inc. All Rights Reserved.