[ovs-dev] [PATCH] ofproto-dpif-upcall: Do not call dpif_handlers_set() when there is no handler/revalidator configuration change.

Alex Wang alexw at nicira.com
Fri May 9 21:17:34 UTC 2014


dpif_handlers_set(), which dumps all vport from datapath, should not be
called constantly.

Found by inspection.

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 ofproto/ofproto-dpif-upcall.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index a2159af..e1117ba 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -379,8 +379,6 @@ void
 udpif_set_threads(struct udpif *udpif, size_t n_handlers,
                   size_t n_revalidators)
 {
-    int error;
-
     ovs_assert(udpif);
     ovs_assert(n_handlers && n_revalidators);
 
@@ -390,14 +388,16 @@ udpif_set_threads(struct udpif *udpif, size_t n_handlers,
         udpif_stop_threads(udpif);
     }
 
-    error = dpif_handlers_set(udpif->dpif, n_handlers);
-    if (error) {
-        VLOG_ERR("failed to configure handlers in dpif %s: %s",
-                 dpif_name(udpif->dpif), ovs_strerror(error));
-        return;
-    }
-
     if (!udpif->handlers && !udpif->revalidators) {
+        int error;
+
+        error = dpif_handlers_set(udpif->dpif, n_handlers);
+        if (error) {
+            VLOG_ERR("failed to configure handlers in dpif %s: %s",
+                     dpif_name(udpif->dpif), ovs_strerror(error));
+            return;
+        }
+
         udpif_start_threads(udpif, n_handlers, n_revalidators);
     }
     ovsrcu_quiesce_end();
-- 
1.7.9.5




More information about the dev mailing list