Before this patch, stats for 'facet->rule' were handled differently than stats which 'facet' resubmitted into. The former were maintained in 'facet' until it was destroyed, while the latter were pushed regularly in facet_push_stats().
This inconsistent behavior was not only confusing, it was often incorrect. In some circumstances, if a facet changed rules, it could carry the statistics from the entirety of its lifetime from the old rule to the new one. This patch remedies the issue by handling all rule stats in facet_push_stats(). Signed-off-by: Ethan Jackson <et...@nicira.com> --- ofproto/ofproto-dpif.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 6ec1c23..db4023b 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4810,9 +4810,6 @@ facet_flush_stats(struct facet *facet) netflow_expire(ofproto->netflow, &facet->nf_flow, &expired); } - facet->rule->packet_count += facet->packet_count; - facet->rule->byte_count += facet->byte_count; - /* Reset counters to prevent double counting if 'facet' ever gets * reinstalled. */ facet_reset_counters(facet); @@ -5194,6 +5191,7 @@ facet_push_stats(struct facet *facet) facet->prev_byte_count = facet->byte_count; facet->prev_used = facet->used; + rule_credit_stats(facet->rule, &stats); flow_push_stats(facet, &stats); update_mirror_stats(ofproto_dpif_cast(facet->rule->up.ofproto), @@ -5711,7 +5709,6 @@ static void rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes) { struct rule_dpif *rule = rule_dpif_cast(rule_); - struct facet *facet; /* push_all_stats() can handle flow misses which, when using the learn * action, can cause rules to be added and deleted. This can corrupt our @@ -5723,14 +5720,6 @@ rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes) * in facets. This counts, for example, facets that have expired. */ *packets = rule->packet_count; *bytes = rule->byte_count; - - /* Add any statistics that are tracked by facets. This includes - * statistical data recently updated by ofproto_update_stats() as well as - * stats for packets that were executed "by hand" via dpif_execute(). */ - LIST_FOR_EACH (facet, list_node, &rule->facets) { - *packets += facet->packet_count; - *bytes += facet->byte_count; - } } static void -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev