From: Ben Pfaff Date: Mon, 31 Mar 2008 16:59:32 +0000 (-0700) Subject: Make the datapath responsible for the controller connection also. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c720cc542a0375c0f2adab47db04cad5d7dae009;p=openvswitch Make the datapath responsible for the controller connection also. --- diff --git a/switch/datapath.c b/switch/datapath.c index 34914dfd..764f8e2a 100644 --- a/switch/datapath.c +++ b/switch/datapath.c @@ -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. */ diff --git a/switch/switch.c b/switch/switch.c index 324084d9..e489b9fa 100644 --- a/switch/switch.c +++ b/switch/switch.c @@ -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(); }