From c720cc542a0375c0f2adab47db04cad5d7dae009 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 31 Mar 2008 09:59:32 -0700 Subject: [PATCH] Make the datapath responsible for the controller connection also. --- switch/datapath.c | 12 ++++++++++++ switch/switch.c | 3 --- 2 files changed, 12 insertions(+), 3 deletions(-) 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(); } -- 2.30.2