ofproto-dpif: Flush flows before dpif_recv_set_mask().
authorJesse Gross <jesse@nicira.com>
Fri, 16 Sep 2011 16:50:35 +0000 (09:50 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 23 Sep 2011 22:27:48 +0000 (15:27 -0700)
Now that upcalls from the kernel use unicast sockets, we need to
tell the kernel where to send them explicitly.  This means that
when the switch is restarted it's necessary to take control of any
existing objects, which is done when the dpif listen mask becomes
non-zero.  Since we're going to blow away the flows anyways, we
might as well do it before going through the trouble of updating
all of them.

ofproto/ofproto-dpif.c

index bd976f760d398f558f8e96045b81d2dac953ada8..47a9d29efb8a1269ea5ddff613b000c655976aad 100644 (file)
@@ -465,6 +465,9 @@ construct(struct ofproto *ofproto_, int *n_tablesp)
     ofproto->max_ports = dpif_get_max_ports(ofproto->dpif);
     ofproto->n_matches = 0;
 
+    dpif_flow_flush(ofproto->dpif);
+    dpif_recv_purge(ofproto->dpif);
+
     error = dpif_recv_set_mask(ofproto->dpif,
                                ((1u << DPIF_UC_MISS) |
                                 (1u << DPIF_UC_ACTION) |
@@ -474,8 +477,6 @@ construct(struct ofproto *ofproto_, int *n_tablesp)
         dpif_close(ofproto->dpif);
         return error;
     }
-    dpif_flow_flush(ofproto->dpif);
-    dpif_recv_purge(ofproto->dpif);
 
     ofproto->netflow = NULL;
     ofproto->sflow = NULL;