[ovs-dev] [PATCH] Reapplying the dscp changes.

Mehak Mahajan mmahajan at nicira.com
Thu Jun 21 04:24:34 UTC 2012


This patch reapplies the changes that were reverted with the commit 59efa47
(Revert DSCP update changes.). It also addresses the problem introduced by
the original commits, cd8fca2 ((jsonrpc: Correctly setting the dscp value
before reconnect.) and b2e18d (No need to restart DB / OVS on changing
dscp value.), that caused numerous unit test failures on some systems (as
diagnosed by valgrind).

Signed-off-by: Mehak Mahajan <mmahajan at nicira.com>
---
 lib/jsonrpc.c        |    6 +++++-
 lib/rconn.c          |    6 ++++++
 lib/rconn.h          |    1 +
 ofproto/connmgr.c    |    6 ++++++
 vswitchd/vswitch.xml |   14 ++++++--------
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index 5c3359c..5761369 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -793,6 +793,7 @@ jsonrpc_session_open_unreliably(struct jsonrpc *jsonrpc)
     reconnect_set_name(s->reconnect, jsonrpc_get_name(jsonrpc));
     reconnect_set_max_tries(s->reconnect, 0);
     reconnect_connected(s->reconnect, time_msec());
+    s->dscp = 0;
     s->rpc = jsonrpc;
     s->stream = NULL;
     s->pstream = NULL;
@@ -1058,5 +1059,8 @@ void
 jsonrpc_session_set_dscp(struct jsonrpc_session *s,
                          uint8_t dscp)
 {
-    s->dscp = dscp;
+    if (s->dscp != dscp) {
+        s->dscp = dscp;
+        jsonrpc_session_force_reconnect(s);
+    }
 }
diff --git a/lib/rconn.c b/lib/rconn.c
index 2ddfc69..3241ab8 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -226,6 +226,12 @@ rconn_set_dscp(struct rconn *rc, uint8_t dscp)
     rc->dscp = dscp;
 }
 
+uint8_t
+rconn_get_dscp(const struct rconn *rc)
+{
+    return rc->dscp;
+}
+
 void
 rconn_set_probe_interval(struct rconn *rc, int probe_interval)
 {
diff --git a/lib/rconn.h b/lib/rconn.h
index 2b1332c..e4b73fc 100644
--- a/lib/rconn.h
+++ b/lib/rconn.h
@@ -40,6 +40,7 @@ struct rconn_packet_counter;
 struct rconn *rconn_create(int inactivity_probe_interval,
 			   int max_backoff, uint8_t dscp);
 void rconn_set_dscp(struct rconn *rc, uint8_t dscp);
+uint8_t rconn_get_dscp(const struct rconn *rc);
 void rconn_set_max_backoff(struct rconn *, int max_backoff);
 int rconn_get_max_backoff(const struct rconn *);
 void rconn_set_probe_interval(struct rconn *, int inactivity_probe_interval);
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index a0315b2..8cdaa1f 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1114,6 +1114,12 @@ ofconn_reconfigure(struct ofconn *ofconn, const struct ofproto_controller *c)
     rconn_set_probe_interval(ofconn->rconn, probe_interval);
 
     ofconn_set_rate_limit(ofconn, c->rate_limit, c->burst_limit);
+
+    /* If dscp value changed reconnect. */
+    if (c->dscp != rconn_get_dscp(ofconn->rconn)) {
+        rconn_set_dscp(ofconn->rconn, c->dscp);
+        rconn_reconnect(ofconn->rconn);
+    }
 }
 
 /* Returns true if it makes sense for 'ofconn' to receive and process OpenFlow
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 32d4c59..15f162a 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2756,10 +2756,9 @@
         Service (QoS) on IP networks.
 
         The DSCP value specified here is used when establishing the connection
-        between the controller and the Open vSwitch.  The connection must be
-        reset for the new DSCP values to take effect.  If no value is
-        specified, a default value of 48 is chosen.  Valid DSCP values must be
-        in the range 0 to 63.
+        between the controller and the Open vSwitch.  If no value is specified,
+        a default value of 48 is chosen.  Valid DSCP values must be in the
+        range 0 to 63.
       </column>
     </group>
 
@@ -3003,10 +3002,9 @@
         Service (QoS) on IP networks.
 
         The DSCP value specified here is used when establishing the connection
-        between the manager and the Open vSwitch.  The connection must be
-        reset for the new DSCP values to take effect.  If no value is
-        specified, a default value of 48 is chosen.  Valid DSCP values must be
-        in the range 0 to 63.
+        between the manager and the Open vSwitch.  If no value is specified, a
+        default value of 48 is chosen.  Valid DSCP values must be in the range
+        0 to 63.
       </column>
     </group>
 
-- 
1.7.2.5




More information about the dev mailing list