From: Zhu Yanjun <[email protected]>
Date: Thu, 5 Sep 2019 05:15:42 -0400
> When testing with a background iperf pushing 1Gbit/sec traffic and running
> both ifconfig and netstat to collect statistics, some deadlocks occurred.
>
> Ifconfig and netstat will call nv_get_stats64 to get software xmit/recv
> statistics. In the commit f5d827aece36 ("forcedeth: implement
> ndo_get_stats64() API"), the normal tx/rx variables is to collect tx/rx
> statistics. The fix is to replace normal tx/rx variables with per
> cpu 64-bit variable to collect xmit/recv statistics. The per cpu variable
> will avoid deadlocks and provide fast efficient statistics updates.
>
> In nv_probe, the per cpu variable is initialized. In nv_remove, this
> per cpu variable is freed.
>
> In xmit/recv process, this per cpu variable will be updated.
>
> In nv_get_stats64, this per cpu variable on each cpu is added up. Then
> the driver can get xmit/recv packets statistics.
>
> A test runs for several days with this commit, the deadlocks disappear
> and the performance is better.
>
> Tested:
...
> Fixes: f5d827aece36 ("forcedeth: implement ndo_get_stats64() API")
> CC: Joe Jin <[email protected]>
> CC: JUNXIAO_BI <[email protected]>
> Reported-and-tested-by: Nan san <[email protected]>
> Signed-off-by: Zhu Yanjun <[email protected]>
Applied.