Skip to content

Commit

Permalink
gve: Fix u64_stats_sync to initialize start
Browse files Browse the repository at this point in the history
u64_stats_fetch_begin needs to initialize start.

Signed-off-by: Catherine Sullivan <csully@google.com>
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Catherine Sullivan authored and David S. Miller committed Jul 3, 2019
1 parent d62962b commit 3c13ce7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/google/gve/gve_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ gve_get_ethtool_stats(struct net_device *netdev,
ring < priv->rx_cfg.num_queues; ring++) {
if (priv->rx) {
do {
u64_stats_fetch_begin(&priv->rx[ring].statss);
start =
u64_stats_fetch_begin(&priv->rx[ring].statss);
rx_pkts += priv->rx[ring].rpackets;
rx_bytes += priv->rx[ring].rbytes;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
Expand All @@ -113,7 +114,8 @@ gve_get_ethtool_stats(struct net_device *netdev,
ring < priv->tx_cfg.num_queues; ring++) {
if (priv->tx) {
do {
u64_stats_fetch_begin(&priv->tx[ring].statss);
start =
u64_stats_fetch_begin(&priv->tx[ring].statss);
tx_pkts += priv->tx[ring].pkt_done;
tx_bytes += priv->tx[ring].bytes_done;
} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/google/gve/gve_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
do {
u64_stats_fetch_begin(&priv->rx[ring].statss);
start =
u64_stats_fetch_begin(&priv->rx[ring].statss);
s->rx_packets += priv->rx[ring].rpackets;
s->rx_bytes += priv->rx[ring].rbytes;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
Expand All @@ -45,7 +46,8 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
if (priv->tx) {
for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
do {
u64_stats_fetch_begin(&priv->tx[ring].statss);
start =
u64_stats_fetch_begin(&priv->tx[ring].statss);
s->tx_packets += priv->tx[ring].pkt_done;
s->tx_bytes += priv->tx[ring].bytes_done;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
Expand Down

0 comments on commit 3c13ce7

Please sign in to comment.