examples/kni: improve zeroing statistics
authorDan Gora <dg@adax.com>
Wed, 24 Oct 2018 22:26:31 +0000 (19:26 -0300)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 26 Oct 2018 17:46:29 +0000 (19:46 +0200)
commit85fea26693d6a3cf04a197e5c914e96600672c20
tree83a6c1f518b45ad10d97891a1b5a51d079b55e00
parent0fdec35dba2c7fab5a2d488fe275010f63762bda
examples/kni: improve zeroing statistics

The worker threads incrementing the rx/tx_packets race with the signal
handler from the main thread zeroing the entire statistics structure.
This can cause the statistics to fail to be zeroed, even when there
is no traffic on those interfaces.

Improve zeroing the statistics by only incrementing rx/tx_packets
in worker threads by a non-zero amount.  This limits the race to the
periods in which traffic is actually being received or transmitted.

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
examples/kni/main.c