xlate_push_stats() mostly does nothing if 'stats->n_packets' is 0.  This
commit allows it to skip more complicated internal logic in that case.

The one case I see in which xlate_push_stats() does do something if
'stats->n_packets' is 0 is in the case of a cached fin_timeout translation.
That translation changes the idle and hard timeouts of a flow if tcp_flags
has FIN or RST set, even if n_packets is 0.  But I don't think that can
happen anyway; how would FIN or RST be set without receiving a packet?

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 ofproto/ofproto-dpif-xlate.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index dbfda08..ccf0991 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -4291,6 +4291,10 @@ xlate_push_stats(struct xlate_cache *xcache, bool 
may_learn,
     struct xc_entry *entry;
     struct ofpbuf entries = xcache->entries;
 
+    if (!stats->n_packets) {
+        return;
+    }
+
     XC_ENTRY_FOR_EACH (entry, entries, xcache) {
         switch (entry->type) {
         case XC_RULE:
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to