]> git.proxmox.com Git - mirror_ovs.git/commit - ofproto/ofproto-dpif-xlate.c
ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.
authorBen Pfaff <blp@nicira.com>
Fri, 22 Aug 2014 22:18:33 +0000 (15:18 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 25 Aug 2014 15:53:30 +0000 (08:53 -0700)
commitbc3885835b181e79cf9eec66153a3486fccdc2e6
treed7c7e3c986af94fea3e1daecbbad4717b802ad12
parent549d38611ec0b2f1571700e110830565a80dd568
ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.

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?

More broadly, the xlate_push_stats handles two functions - pushing stats
and implementing side-effects from actions. If there are no packets, the
stats shouldn't need updating. If there were no packets, then no packets
could have hit actions for things such as mac learning/openflow learning,
so xlate_push_stats() should be a no-op.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto/ofproto-dpif-xlate.c