From: Ethan Jackson Date: Sat, 23 Mar 2013 22:11:21 +0000 (-0700) Subject: ofproto-dpif: Push statistics in rule_get_stats(). X-Git-Tag: sliver-openvswitch-1.10.90-1~10^2~39 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=bf1e8ff9835871eb4927d5a0dbc7af19901d37ce ofproto-dpif: Push statistics in rule_get_stats(). As time goes on, and flow tables become more complicated, the tradeoff between keeping up to date statistics, and the CPU resources needed to maintain them, will become more important. Commit 5c0243a (ofproto-dpif: xlate actions once with subfacets.) delayed the reporting of some statistics in an effort to achieve higher flow setup performance. Future commits will continue in the same direction. This patch helps to alleviate the issue, by pushing statistics rule_get_stats(), when users actually want them. Presumably, this happens rarely, and thus will not have a negative impact on ovs-vswitchd performance. Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 18c5b7dea..b8db91dfd 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5425,9 +5425,14 @@ rule_destruct(struct rule *rule_) static void rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes) { + struct ofproto_dpif *ofproto = ofproto_dpif_cast(rule_->ofproto); struct rule_dpif *rule = rule_dpif_cast(rule_); struct facet *facet; + HMAP_FOR_EACH (facet, hmap_node, &ofproto->facets) { + facet_push_stats(facet); + } + /* Start from historical data for 'rule' itself that are no longer tracked * in facets. This counts, for example, facets that have expired. */ *packets = rule->packet_count;