It has been observed that when we upgrade openvswitch with
thousands of openflow flows already established and there is heavy
traffic going through the switch, restoring flows can take a very
long time (8 minutes in one use case) with CPU running at 100%.
This can make the upgrade very expensive.

This commit starts vswitchd with packet processing from the datapath
disabled. Once the flows are restored, it enables packet processing.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshe...@nicira.com>
---
 utilities/ovs-ctl.in |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 1f10491..127cd1b 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -330,6 +330,11 @@ init_restore_scripts () {
     trap 'rm -f "${script_interfaces}" "${script_flows}" "${script_ofports}"' 0
 }
 
+dpif_packet_receive () {
+    # Setting to enable or disable packet processing from datapath.
+    ovs_vsctl set open_vswitch . other_config:dpif-packet-receive="$1"
+}
+
 force_reload_kmod () {
     ifaces=`internal_interfaces`
     action "Detected internal interfaces: $ifaces" true
@@ -370,9 +375,13 @@ force_reload_kmod () {
         action "Removing openvswitch module" rmmod openvswitch
     fi
 
+    # Start vswitchd with packet processing from datapath disabled.
+    dpif_packet_receive "false"
     start_forwarding
 
+    # Restore saved flows and then enable packet processing from the datapath.
     restore_flows
+    dpif_packet_receive "true"
 
     restore_interfaces
 
@@ -414,10 +423,14 @@ restart () {
     restore_ofports
 
     stop_forwarding
+
+    # Start vswitchd with packet processing from datapath disabled.
+    dpif_packet_receive "false"
     start_forwarding
 
-    # Restore the saved flows.
+    # Restore saved flows and then enable packet processing from the datapath.
     restore_flows
+    dpif_packet_receive "true"
 
     # Restore the interfaces if required. Return true even if restore fails.
     restore_interfaces || true
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to