gve: fix gve_get_stats()
authorEric Dumazet <edumazet@google.com>
Wed, 6 Oct 2021 00:30:30 +0000 (17:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Oct 2021 14:11:51 +0000 (15:11 +0100)
commit2f57d4975fa027eabd35fdf23a49f8222ef3abf2
tree241e39731a4a09e04fc447085c1eb5f080e166d6
parentd34367991933d28bd7331f67a759be9a8c474014
gve: fix gve_get_stats()

gve_get_stats() can report wrong numbers if/when u64_stats_fetch_retry()
returns true.

What is needed here is to sample values in temporary variables,
and only use them after each loop is ended.

Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Catherine Sullivan <csully@google.com>
Cc: Sagi Shahar <sagis@google.com>
Cc: Jon Olson <jonolson@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Luigi Rizzo <lrizzo@google.com>
Cc: Jeroen de Borst <jeroendb@google.com>
Cc: Tao Liu <xliutaox@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/google/gve/gve_main.c