Signed-off-by: Ben Pfaff <b...@nicira.com> --- ofproto/ofproto-dpif.c | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index c800386..63ce1c2 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3818,6 +3818,28 @@ facet_is_controller_flow(struct facet *facet) return false; } +/* Passes 'facet''s information to the NetFlow module, to send out a NetFlow + * record. The caller must: + * + * - Ensure that 'facet''s ofproto has NetFlow configured. + * + * - Ensure that !facet_is_controller_flow(facet). + * + * - Bring 'facet''s statistics up to date and sync them with the datapath. + */ +static void +facet_send_netflow_record(struct facet *facet) +{ + struct ofproto_dpif *ofproto = ofproto_dpif_cast(facet->rule->up.ofproto); + struct ofexpired expired; + + expired.flow = facet->flow; + expired.packet_count = facet->packet_count; + expired.byte_count = facet->byte_count; + expired.used = facet->used; + netflow_expire(ofproto->netflow, &facet->nf_flow, &expired); +} + /* Folds all of 'facet''s statistics into its rule. Also updates the * accounting ofhook and emits a NetFlow expiration if appropriate. All of * 'facet''s statistics in the datapath should have been zeroed and folded into @@ -3840,12 +3862,7 @@ facet_flush_stats(struct facet *facet) } if (ofproto->netflow && !facet_is_controller_flow(facet)) { - struct ofexpired expired; - expired.flow = facet->flow; - expired.packet_count = facet->packet_count; - expired.byte_count = facet->byte_count; - expired.used = facet->used; - netflow_expire(ofproto->netflow, &facet->nf_flow, &expired); + facet_send_netflow_record(facet); } facet->rule->packet_count += facet->packet_count; @@ -6525,7 +6542,6 @@ send_active_timeout(struct ofproto_dpif *ofproto, struct facet *facet) if (!facet_is_controller_flow(facet) && netflow_active_timeout_expired(ofproto->netflow, &facet->nf_flow)) { struct subfacet *subfacet; - struct ofexpired expired; LIST_FOR_EACH (subfacet, list_node, &facet->subfacets) { if (subfacet->path == SF_FAST_PATH) { @@ -6536,11 +6552,7 @@ send_active_timeout(struct ofproto_dpif *ofproto, struct facet *facet) } } - expired.flow = facet->flow; - expired.packet_count = facet->packet_count; - expired.byte_count = facet->byte_count; - expired.used = facet->used; - netflow_expire(ofproto->netflow, &facet->nf_flow, &expired); + facet_send_netflow_record(facet); } } -- 1.7.2.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev