revalidator: Fix ukey stats cache updating.
[sliver-openvswitch.git] / ofproto / ofproto-dpif-upcall.c
index 84afc56..2c37781 100644 (file)
@@ -342,7 +342,7 @@ static void
 udpif_start_threads(struct udpif *udpif, size_t n_handlers,
                     size_t n_revalidators)
 {
-    if (udpif && (!udpif->handlers && !udpif->revalidators)) {
+    if (udpif && n_handlers && n_revalidators) {
         size_t i;
 
         udpif->n_handlers = n_handlers;
@@ -1245,7 +1245,6 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey,
     push.n_bytes = stats->n_bytes > ukey->stats.n_bytes
         ? stats->n_bytes - ukey->stats.n_bytes
         : 0;
-    ukey->stats = *stats;
 
     if (!ukey->flow_exists) {
         /* Don't bother revalidating if the flow was already deleted. */
@@ -1258,6 +1257,8 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey,
         goto exit;
     }
 
+    /* We will push the stats, so update the ukey stats cache. */
+    ukey->stats = *stats;
     if (!push.n_packets && !udpif->need_revalidate) {
         ok = true;
         goto exit;