[ovs-dev] [PATCH] datapath: Fix vport tx_packets count.

Jesse Gross jesse at nicira.com
Tue Nov 8 02:58:16 UTC 2011


On Mon, Nov 7, 2011 at 6:52 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
> ---
>  datapath/vport.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/datapath/vport.c b/datapath/vport.c
> index 6fe6042..b8eecf8 100644
> --- a/datapath/vport.c
> +++ b/datapath/vport.c
> @@ -465,7 +465,7 @@ int vport_send(struct vport *vport, struct sk_buff *skb)
>        stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id());
>
>        write_seqcount_begin(&stats->seqlock);
> -       stats->tx_packets++;
> +       stats->tx_packets += (sent != 0);
>        stats->tx_bytes += sent;
>        write_seqcount_end(&stats->seqlock);

Given that this entire thing becomes a no-op in the event that sent is
zero, I think it would be better to put it in one big if block.



More information about the dev mailing list