From: Andy Zhou Date: Thu, 4 Apr 2013 23:35:27 +0000 (-0700) Subject: ovs-appctl: dpif/show display bug fix X-Git-Tag: sliver-openvswitch-1.10.90-3~17^2~105 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=3af56aefe0a496210dd6b57a0d8e93224e36dc00 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 47830c19e..8f0042426 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4264,13 +4264,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; @@ -4281,7 +4281,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) { @@ -4313,6 +4312,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 06ebf23ae..b1d2f2600 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -1937,8 +1937,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)