[ovs-dev] [PATCH] ofproto-dpif-governor: Dispense with governor name.

Ethan Jackson ethan at nicira.com
Fri Jun 7 20:55:32 UTC 2013


In almost all cases, ovs-vswitchd runs with a single datapath, and
therefore a single governor.  Therefore, it's usually clear from
context what governor log messages are referring to making the name
redundant.  This patch removes it.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 ofproto/ofproto-dpif-governor.c |   20 ++++++++------------
 ofproto/ofproto-dpif-governor.h |    2 +-
 ofproto/ofproto-dpif.c          |    2 +-
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/ofproto/ofproto-dpif-governor.c b/ofproto/ofproto-dpif-governor.c
index 75379d1..459f871 100644
--- a/ofproto/ofproto-dpif-governor.c
+++ b/ofproto/ofproto-dpif-governor.c
@@ -53,13 +53,11 @@ enum { MAX_ELAPSED = 5000 }; /* In milliseconds. */
 
 static void governor_new_generation(struct governor *, unsigned int size);
 
-/* Creates and returns a new governor named 'name' (which is used only for log
- * messages). */
+/* Creates and returns a new governor. */
 struct governor *
-governor_create(const char *name)
+governor_create(void)
 {
     struct governor *g = xzalloc(sizeof *g);
-    g->name = xstrdup(name);
     governor_new_generation(g, MIN_SIZE);
     return g;
 }
@@ -69,8 +67,7 @@ void
 governor_destroy(struct governor *g)
 {
     if (g) {
-        VLOG_INFO("%s: disengaging", g->name);
-        free(g->name);
+        VLOG_INFO("disengaging");
         free(g->table);
         free(g);
     }
@@ -182,13 +179,12 @@ governor_new_generation(struct governor *g, unsigned int size)
     /* Allocate new table, if necessary. */
     if (g->size != size) {
         if (!g->size) {
-            VLOG_INFO("%s: engaging governor with %u kB hash table",
-                      g->name, size / 1024);
+            VLOG_INFO("engaging governor with %u kB hash table", size / 1024);
         } else {
-            VLOG_INFO("%s: processed %u packets in %.2f s, "
+            VLOG_INFO("processed %u packets in %.2f s, "
                       "%s hash table to %u kB "
                       "(%u hashes, %u setups, %u shortcuts)",
-                      g->name, g->n_packets,
+                      g->n_packets,
                       (time_msec() - g->start) / 1000.0,
                       size > g->size ? "enlarging" : "shrinking",
                       size / 1024,
@@ -199,9 +195,9 @@ governor_new_generation(struct governor *g, unsigned int size)
         g->table = xmalloc(size * sizeof *g->table);
         g->size = size;
     } else {
-        VLOG_DBG("%s: processed %u packets in %.2f s with %u kB hash table "
+        VLOG_DBG("processed %u packets in %.2f s with %u kB hash table "
                  "(%u hashes, %u setups, %u shortcuts)",
-                 g->name, g->n_packets, (time_msec() - g->start) / 1000.0,
+                 g->n_packets, (time_msec() - g->start) / 1000.0,
                  size / 1024, g->n_flows, g->n_setups, g->n_shortcuts);
     }
 
diff --git a/ofproto/ofproto-dpif-governor.h b/ofproto/ofproto-dpif-governor.h
index 6dbd0d5..7e6ec92 100644
--- a/ofproto/ofproto-dpif-governor.h
+++ b/ofproto/ofproto-dpif-governor.h
@@ -45,7 +45,7 @@ struct governor {
     unsigned int n_shortcuts;   /* Number of flows set up based on history. */
 };
 
-struct governor *governor_create(const char *name);
+struct governor *governor_create(void);
 void governor_destroy(struct governor *);
 
 void governor_run(struct governor *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index d0b0aad..d5cfc16 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3694,7 +3694,7 @@ flow_miss_should_make_facet(struct flow_miss *miss, uint32_t hash)
             return true;
         }
 
-        backer->governor = governor_create(dpif_name(backer->dpif));
+        backer->governor = governor_create();
     }
 
     return governor_should_install_flow(backer->governor, hash,
-- 
1.7.9.5




More information about the dev mailing list