]> 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)
commite3c19a6cc9014e93fb97b8877e9101cf21c13b8b
tree36f896c2133b667725d3726a8abe619e4a3c0a3c
parent0a767ea6d805feb54089ce3ee4b0c1f6ca530eaf
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: 185cdc3e1b8a6 ("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