From: Jesse Gross Date: Fri, 14 Aug 2009 20:47:28 +0000 (-0700) Subject: ofproto: Make current packet counts more accurate. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3137fe852171f8e87a49ef0939a52d91ea09720;hp=97b7b2f410e487f59ae3690213cfc8de0c8b88fb;p=openvswitch ofproto: Make current packet counts more accurate. When the stats for a currently active flow are requested this ensures that the packets not handled by the kernel are counted immediately. Before, these packets would only be counted once the kernel flow expired and the counts were combined. --- diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 9836e0f8..94c4bfe3 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -2420,19 +2420,22 @@ query_stats(struct ofproto *p, struct rule *rule, struct odp_flow *odp_flows; size_t n_odp_flows; + packet_count = rule->packet_count; + byte_count = rule->byte_count; + n_odp_flows = rule->cr.wc.wildcards ? list_size(&rule->list) : 1; odp_flows = xcalloc(1, n_odp_flows * sizeof *odp_flows); if (rule->cr.wc.wildcards) { size_t i = 0; LIST_FOR_EACH (subrule, struct rule, list, &rule->list) { odp_flows[i++].key = subrule->cr.flow; + packet_count += subrule->packet_count; + byte_count += subrule->byte_count; } } else { odp_flows[0].key = rule->cr.flow; } - packet_count = rule->packet_count; - byte_count = rule->byte_count; if (!dpif_flow_get_multiple(&p->dpif, odp_flows, n_odp_flows)) { size_t i; for (i = 0; i < n_odp_flows; i++) {