diff options
author | Mark Starovoytov <mstarovoitov@marvell.com> | 2020-07-20 21:32:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-20 18:07:38 -0700 |
commit | d7d8bb9286134bcc57941c38ed2d69c50fc59511 (patch) | |
tree | ef2de013ce741f71b758a8fc3fc15722d892fac8 /drivers/net/ethernet/aquantia/atlantic/aq_ring.h | |
parent | 508f2e3dce454843ffd689bb2cf0739a954dd1e9 (diff) |
net: atlantic: use u64_stats_update_* to protect access to 64-bit stats
This patch adds u64_stats_update_* usage to protect access to 64-bit stats,
where necessary.
This is necessary for per-ring stats, because they are updated by the
driver directly, so there is a possibility for a partial read.
Other stats require no additional protection, e.g.:
* all MACSec stats are fetched directly from HW (under semaphore);
* nic/ndev stats (aq_stats_s) are fetched directly from FW (under mutex).
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic/aq_ring.h')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_ring.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h index 0cd761ba47a3..c92c3a0651a9 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * aQuantia Corporation Network Driver - * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved +/* Atlantic Network Driver + * + * Copyright (C) 2014-2019 aQuantia Corporation + * Copyright (C) 2019-2020 Marvell International Ltd. */ /* File aq_ring.h: Declaration of functions for Rx/Tx rings. */ @@ -88,6 +89,7 @@ struct __packed aq_ring_buff_s { }; struct aq_ring_stats_rx_s { + struct u64_stats_sync syncp; /* must be first */ u64 errors; u64 packets; u64 bytes; @@ -99,6 +101,7 @@ struct aq_ring_stats_rx_s { }; struct aq_ring_stats_tx_s { + struct u64_stats_sync syncp; /* must be first */ u64 errors; u64 packets; u64 bytes; |