Hi Stephen:

Thanks for the suggestion of using per-cpu statistics. In this part of
code, there are two major reasons
not to use per-cpu variable for calculating Tx packets:

1. The update of ring->bytes and ring ->packets are protected with irq
version's spin lock in the current code logic. Although BH
     is disabled and it is safe to use per-cpu variable, i don't see
much more benefit of using it if it is still under irq version's spin
lock protection.

2. This driver requires update each ring's bytes and packets; The
number of rings are decided dynamically. so in order to use per-cpu
     variable, we need to track allocation and free every time when
the sizes of rings change that might have some performance concerns.

For Rx packets, using per-cpu variable is possible.

Thanks
Jmqiao

On Thu, Jul 20, 2017 at 4:44 PM, Stephen Hemminger
<step...@networkplumber.org> wrote:
> On Wed, 19 Jul 2017 01:18:40 +0100
> "Jianming.qiao" <jqiao...@gmail.com> wrote:
>
>> Signed-off-by: Jianming.qiao <kiki-g...@hotmail.com>
>
> You may want to consider using per-cpu statistics.
>

Reply via email to