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().
Reported-by: Tmusic <Tmusic987@gmail.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
netflow_expire(ofproto->netflow, &facet->nf_flow, &expired);
}
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);
/* Reset counters to prevent double counting if 'facet' ever gets
* reinstalled. */
facet_reset_counters(facet);
facet->prev_byte_count = facet->byte_count;
facet->prev_used = facet->used;
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),
flow_push_stats(facet, &stats);
update_mirror_stats(ofproto_dpif_cast(facet->rule->up.ofproto),
rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes)
{
struct rule_dpif *rule = rule_dpif_cast(rule_);
rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes)
{
struct rule_dpif *rule = rule_dpif_cast(rule_);
/* 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
/* 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
* in facets. This counts, for example, facets that have expired. */
*packets = rule->packet_count;
*bytes = rule->byte_count;
* 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;
- }