]> git.baikalelectronics.ru Git - kernel.git/commit
net: qualcomm: rmnet: don't over-count statistics
authorAlex Elder <elder@linaro.org>
Fri, 11 Jun 2021 18:26:00 +0000 (13:26 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Jun 2021 19:13:38 +0000 (12:13 -0700)
commit853daec94a8c7d1e698f1ed7e797d9399dad68e1
tree36f896c2133b667725d3726a8abe619e4a3c0a3c
parentaf464f041843cdaf49ab72f04518c0dab9e9ac3b
net: qualcomm: rmnet: don't over-count statistics

The purpose of the loop using u64_stats_fetch_*_irq() is to ensure
statistics on a given CPU are collected atomically. If one of the
statistics values gets updated within the begin/retry window, the
loop will run again.

Currently the statistics totals are updated inside that window.
This means that if the loop ever retries, the statistics for the
CPU will be counted more than once.

Fix this by taking a snapshot of a CPU's statistics inside the
protected window, and then updating the counters with the snapshot
values after exiting the loop.

(Also add a newline at the end of this file...)

Fixes: bc1455524846e ("net: qualcomm: rmnet: Add support for 64 bit stats")
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c