[ovs-dev] [PATCH] vswitchd, ofproto: New other_config setting: "dp-desc".

Felician Nemeth nemethf at tmit.bme.hu
Tue Dec 18 14:40:05 UTC 2012


Signed-off-by: Felician Nemeth <nemethf at tmit.bme.hu>
---
 ofproto/ofproto.c    |   12 ++++++++++++
 ofproto/ofproto.h    |    2 ++
 vswitchd/bridge.c    |   14 ++++++++++++++
 vswitchd/vswitch.xml |    6 ++++++
 4 files changed, 34 insertions(+)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f95d6ef..db68a1e 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -597,6 +597,18 @@ ofproto_set_mac_table_config(struct ofproto *ofproto, unsigned idle_time,
     }
 }
 
+const char *
+ofproto_get_dp_desc(struct ofproto *p)
+{
+    return p->dp_desc;
+}
+
+void
+ofproto_set_dp_desc(struct ofproto *p, const char *dp_desc)
+{
+    ofproto_set_desc(p, NULL, NULL, NULL, NULL, dp_desc);
+}
+
 void
 ofproto_set_desc(struct ofproto *p,
                  const char *mfr_desc, const char *hw_desc,
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index dc5d9ce..66184af 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -231,6 +231,8 @@ void ofproto_set_flow_eviction_threshold(struct ofproto *, unsigned threshold);
 void ofproto_set_forward_bpdu(struct ofproto *, bool forward_bpdu);
 void ofproto_set_mac_table_config(struct ofproto *, unsigned idle_time,
                                   size_t max_entries);
+const char *ofproto_get_dp_desc(struct ofproto *);
+void ofproto_set_dp_desc(struct ofproto *, const char *dp_desc);
 void ofproto_set_desc(struct ofproto *,
                       const char *mfr_desc, const char *hw_desc,
                       const char *sw_desc, const char *serial_desc,
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d23caf2..42aef41 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -186,6 +186,7 @@ static void bridge_configure_mac_table(struct bridge *);
 static void bridge_configure_sflow(struct bridge *, int *sflow_bridge_number);
 static void bridge_configure_stp(struct bridge *);
 static void bridge_configure_tables(struct bridge *);
+static void bridge_configure_dp_desc(struct bridge *);
 static void bridge_configure_remotes(struct bridge *,
                                      const struct sockaddr_in *managers,
                                      size_t n_managers);
@@ -597,6 +598,7 @@ bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg)
         bridge_configure_sflow(br, &sflow_bridge_number);
         bridge_configure_stp(br);
         bridge_configure_tables(br);
+        bridge_configure_dp_desc(br);
     }
     free(managers);
 
@@ -2901,6 +2903,18 @@ bridge_configure_tables(struct bridge *br)
                      br->cfg->key_flow_tables[j]);
     }
 }
+
+static void
+bridge_configure_dp_desc(struct bridge *br)
+{
+    const char *dp_desc;
+
+    dp_desc = smap_get(&br->cfg->other_config, "dp-desc");
+    if (dp_desc && strcmp(dp_desc, ofproto_get_dp_desc(br->ofproto))) {
+        VLOG_INFO("bridge %s: using dp_desc %s", br->name, dp_desc);
+        ofproto_set_dp_desc(br->ofproto, dp_desc);
+    }
+}
 
 /* Port functions. */
 
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index c78899f..2ca746e 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -439,6 +439,12 @@
         value.  May not be all-zero.
       </column>
 
+      <column name="other_config" key="dp-desc">
+        Human readable description of datapath.  It it a maxumum 256
+        byte-long free-form string to describe the datapath for
+        debugging purposes, e.g., "switch3 in room 3120".
+      </column>
+
       <column name="other_config" key="disable-in-band"
               type='{"type": "boolean"}'>
         If set to <code>true</code>, disable in-band control on the bridge
-- 
1.7.10.4




More information about the dev mailing list