Until now, when it processes OFPT_PORT_MOD message, Open vSwitch has waited
for ports to notify it that their status has changed before it sends a
port status update to controllers.

Also, Open vSwitch never sent port config updates at all for port
modifications other than OFPPC_PORT_DOWN.  I guess that this is a relic
from the era when there was only one controller, since presumably the
controller already knew that it changed the port configuration.  But in the
multi-controller world, it makes sense to send such port status updates,
and I couldn't quickly find anything in OF1.3 or OF1.4 that said they
shouldn't be sent.

Signed-off-by: Ben Pfaff <b...@nicira.com>
Reported-by: Kmindg G <kmi...@gmail.com>
---
 AUTHORS           |    1 +
 ofproto/ofproto.c |   25 +++++++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index c557303..2fda8d7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -197,6 +197,7 @@ John Hurley             john.hur...@netronome.com
 Kevin Mancuso           kevin.manc...@rackspace.com
 Kiran Shanbhog          ki...@vmware.com
 Kirill Kabardin
+Kmindg G                kmi...@gmail.com
 Koichi Yagishita        yagishita.koi...@jrc.co.jp
 Konstantin Khorenko     khore...@openvz.org
 Kris zhang              zhang.k...@gmail.com
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 62c97a2..48e10ca 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2986,22 +2986,23 @@ update_port_config(struct ofport *port,
                    enum ofputil_port_config config,
                    enum ofputil_port_config mask)
 {
-    enum ofputil_port_config old_config = port->pp.config;
-    enum ofputil_port_config toggle;
-
-    toggle = (config ^ port->pp.config) & mask;
-    if (toggle & OFPUTIL_PC_PORT_DOWN) {
-        if (config & OFPUTIL_PC_PORT_DOWN) {
-            netdev_turn_flags_off(port->netdev, NETDEV_UP, NULL);
-        } else {
-            netdev_turn_flags_on(port->netdev, NETDEV_UP, NULL);
-        }
+    enum ofputil_port_config toggle = (config ^ port->pp.config) & mask;
+
+    if (toggle & OFPUTIL_PC_PORT_DOWN
+        && (config & OFPUTIL_PC_PORT_DOWN
+            ? netdev_turn_flags_off(port->netdev, NETDEV_UP, NULL)
+            : netdev_turn_flags_on(port->netdev, NETDEV_UP, NULL))) {
+        /* We tried to bring the port up or down, but it failed, so don't
+         * update the "down" bit. */
         toggle &= ~OFPUTIL_PC_PORT_DOWN;
     }
 
-    port->pp.config ^= toggle;
-    if (port->pp.config != old_config) {
+    if (toggle) {
+        enum ofputil_port_config old_config = port->pp.config;
+        port->pp.config ^= toggle;
         port->ofproto->ofproto_class->port_reconfigured(port, old_config);
+        connmgr_send_port_status(port->ofproto->connmgr, &port->pp,
+                                 OFPPR_MODIFY);
     }
 }
 
-- 
1.7.10.4

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

Reply via email to