X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto-dpif-upcall.c;h=1622888a3289b8290131b034c0243699de75e6fb;hb=e96a5c24e853c005c62937c1826d4dac8d8c009a;hp=bd781edb20ce26f2bd011c9899cc0b6f877829cd;hpb=e4b79342001c74b829afde60f060a9ae2e95d340;p=sliver-openvswitch.git diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index bd781edb2..1622888a3 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -230,6 +230,7 @@ static void *udpif_revalidator(void *); static uint64_t udpif_get_n_flows(struct udpif *); static void revalidate_udumps(struct revalidator *, struct list *udumps); static void revalidator_sweep(struct revalidator *); +static void revalidator_purge(struct revalidator *); static void upcall_unixctl_show(struct unixctl_conn *conn, int argc, const char *argv[], void *aux); static void upcall_unixctl_disable_megaflows(struct unixctl_conn *, int argc, @@ -332,7 +333,6 @@ udpif_set_threads(struct udpif *udpif, size_t n_handlers, for (i = 0; i < udpif->n_revalidators; i++) { struct revalidator *revalidator = &udpif->revalidators[i]; struct udpif_flow_dump *udump, *next_udump; - struct udpif_key *ukey, *next_ukey; LIST_FOR_EACH_SAFE (udump, next_udump, list_node, &revalidator->udumps) { @@ -340,10 +340,9 @@ udpif_set_threads(struct udpif *udpif, size_t n_handlers, free(udump); } - HMAP_FOR_EACH_SAFE (ukey, next_ukey, hmap_node, - &revalidator->ukeys) { - ukey_delete(revalidator, ukey); - } + /* Delete ukeys, and delete all flows from the datapath to prevent + * double-counting stats. */ + revalidator_purge(revalidator); hmap_destroy(&revalidator->ukeys); ovs_mutex_destroy(&revalidator->mutex); @@ -1547,7 +1546,7 @@ revalidate_udumps(struct revalidator *revalidator, struct list *udumps) } static void -revalidator_sweep(struct revalidator *revalidator) +revalidator_sweep__(struct revalidator *revalidator, bool purge) { struct dump_op ops[REVALIDATE_MAX_BATCH]; struct udpif_key *ukey, *next; @@ -1556,7 +1555,7 @@ revalidator_sweep(struct revalidator *revalidator) n_ops = 0; HMAP_FOR_EACH_SAFE (ukey, next, hmap_node, &revalidator->ukeys) { - if (ukey->mark) { + if (!purge && ukey->mark) { ukey->mark = false; } else { struct dump_op *op = &ops[n_ops++]; @@ -1576,6 +1575,18 @@ revalidator_sweep(struct revalidator *revalidator) push_dump_ops(revalidator, ops, n_ops); } } + +static void +revalidator_sweep(struct revalidator *revalidator) +{ + revalidator_sweep__(revalidator, false); +} + +static void +revalidator_purge(struct revalidator *revalidator) +{ + revalidator_sweep__(revalidator, true); +} static void upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,