Make the datapath responsible for the controller connection also.
authorBen Pfaff <blp@nicira.com>
Mon, 31 Mar 2008 16:59:32 +0000 (09:59 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 1 Apr 2008 16:52:59 +0000 (09:52 -0700)
switch/datapath.c
switch/switch.c

index 34914dfd04c3b40b643c157436a48531f76c7b92..764f8e2a402102462b5214b8b7fee6eb9a600d59 100644 (file)
@@ -249,6 +249,17 @@ dp_run(struct datapath *dp)
         }
     }
     buffer_delete(buffer);
+
+    for (i = 0; i < 50; i++) {
+        struct buffer *buffer = controller_recv(dp->cc);
+        if (!buffer) {
+            break;
+        }
+        fwd_control_input(dp, buffer->data, buffer->size);
+        buffer_delete(buffer);
+    }
+
+    controller_run(dp->cc);
 }
 
 void
@@ -259,6 +270,7 @@ dp_wait(struct datapath *dp)
     LIST_FOR_EACH (p, struct sw_port, node, &dp->port_list) {
         netdev_recv_wait(p->netdev);
     }
+    controller_recv_wait(dp->cc);
 }
 
 /* Delete 'p' from switch. */
index 324084d908179ff8f9ccd46c1588719531f42c94..e489b9fabfe7eebe70c85d34dbbf9f4dff7038f8 100644 (file)
@@ -93,10 +93,7 @@ main(int argc, char *argv[])
 
     for (;;) {
         dp_run(dp);
-        controller_run(cc);
-        
         dp_wait(dp);
-        controller_run_wait(cc);
         poll_block();
     }