summaryrefslogtreecommitdiff
path: root/tests/ofproto-dpif.at
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2015-08-03 18:43:53 -0700
committerEthan Jackson <ethan@nicira.com>2015-08-13 13:06:59 -0700
commit43b2f131a229238619ed9ae9ee64092fcae092ca (patch)
treeae3f2765c296ebd95b96ed3d16eed5dd211da006 /tests/ofproto-dpif.at
parentb763749871d126fbf524b915c246264caba2a764 (diff)
downloadopenvswitch-43b2f131a229238619ed9ae9ee64092fcae092ca.tar.gz
ofproto: Allow in-place modifications of datapath flows.
There are certain use cases (such as bond rebalancing) where a datapath flow's actions may change, while it's wildcard pattern remains the same. Before this patch, revalidators would note the change, delete the flow, and wait for the handlers to install an updated version. This is inefficient, as many packets could get punted to userspace before the new flow is finally installed. To improve the situation, this patch implements in place modification of datapath flows. If the revalidators detect the only change to a given ukey is its actions, instead of deleting it, it does a put with the MODIFY flag set. Signed-off-by: Ethan J. Jackson <ethan@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Diffstat (limited to 'tests/ofproto-dpif.at')
-rw-r--r--tests/ofproto-dpif.at40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 58c426b0a..121f84d70 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -6985,3 +6985,43 @@ recirc_id=0,ip,in_port=1,dl_vlan=10,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
+
+# Tests in place modification of installed datapath flows.
+AT_SETUP([ofproto-dpif - in place modification])
+OVS_VSWITCHD_START(
+ [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
+AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
+
+AT_CHECK([ovs-ofctl del-flows br0])
+AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
+
+ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
+
+ovs-appctl time/stop
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
+done
+
+AT_CHECK([ovs-appctl dpif/dump-flows br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
+recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
+])
+
+AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
+
+ovs-appctl time/warp 500
+ovs-appctl time/warp 500
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
+done
+
+AT_CHECK([ovs-appctl dpif/dump-flows br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
+recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
+])
+
+AT_CHECK([cat ovs-vswitchd.log | grep 'modify' | STRIP_UFID ], [0], [dnl
+dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP