[ovs-dev] [PATCH 2/4] ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.

Joe Stringer joestringer at nicira.com
Mon Aug 25 03:03:30 UTC 2014


On 23 August 2014 10:47, Ben Pfaff <blp at nicira.com> wrote:

> 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 <blp at nicira.com>
>

That reasoning makes sense to me. 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 I'd expect it to be a no-op.

Acked-by: Joe Stringer <joestringer at nicira.com>



More information about the dev mailing list