From: Andy Zhou Date: Thu, 4 Apr 2013 23:35:27 +0000 (-0700) Subject: ovs-appctl: dpif/show display bug fix X-Git-Tag: v1.10.0~19 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=e7169719c9a6923654e098f72510fd54d249dcf2 ovs-appctl: dpif/show display bug fix Fixes a bug where per ofproto moving average stats did not update when there is no active dp flows. Reported-by: Justin Pettit Signed-off-by: Andy Zhou Signed-off-by: Justin Pettit --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b56f9f9d5..d535aadbf 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4274,13 +4274,13 @@ update_stats(struct dpif_backer *backer) const struct dpif_flow_stats *stats; struct dpif_flow_dump dump; const struct nlattr *key; + struct ofproto_dpif *ofproto; size_t key_len; dpif_flow_dump_start(&dump, backer->dpif); while (dpif_flow_dump_next(&dump, &key, &key_len, NULL, NULL, &stats)) { struct flow flow; struct subfacet *subfacet; - struct ofproto_dpif *ofproto; struct ofport_dpif *ofport; uint32_t key_hash; @@ -4291,7 +4291,6 @@ update_stats(struct dpif_backer *backer) ofproto->total_subfacet_count += hmap_count(&ofproto->subfacets); ofproto->n_update_stats++; - update_moving_averages(ofproto); ofport = get_ofp_port(ofproto, flow.in_port); if (ofport && ofport->tnl_port) { @@ -4323,6 +4322,11 @@ update_stats(struct dpif_backer *backer) run_fast_rl(); } dpif_flow_dump_done(&dump); + + HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) { + update_moving_averages(ofproto); + } + } /* Calculates and returns the number of milliseconds of idle time after which diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index d7bd49bf4..4fc563b05 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -1392,8 +1392,8 @@ AT_CHECK([ovs-appctl dpif/show | sed 's/ 10[[0-9]]\{3\}(ms)$/ 10000(ms)/'], [0], br0 (dummy@ovs-dummy): lookups: hit:0 missed:61 flows: cur: 0, avg: 1.000, max: 1, life span: 10000(ms) - hourly avg: add rate: 0.641/min, del rate: 0.635/min - overall avg: add rate: 1.000/min, del rate: 0.984/min + hourly avg: add rate: 0.641/min, del rate: 0.641/min + overall avg: add rate: 1.000/min, del rate: 1.000/min br0 65534/100: (dummy) p1 1/1: (dummy) p2 2/2: (dummy)