Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1714818
| From | Salil Mehta <salil.mehta@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net-next 1/3] net: hns3: Fixes the missing u64_stats_fetch_begin_irq in 64-bit stats fetch |
| Date | 2017-08-18 13:40 +0200 |
| Message-ID | <ufNN8-346-9@gated-at.bofh.it> (permalink) |
| References | <ufNN7-346-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch fixes the missing u64_stats_fetch_begin_irq() while trying to
atomically do 64-bit RX/TX fetch. We did not get any error during test
as our SoC is 64-bit so all of these seq/lock operations results in NOOP.
As such, this seq lock supports has been added for the sake of completion
if this code ever runs on 32-bit platform and we are trying to do 64-bit
stats fetch.
Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for
hip08 SoC")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
index 9589b7e..b12730a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
@@ -1054,6 +1054,7 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
/* fetch the tx stats */
ring = priv->ring_data[idx].ring;
do {
+ start = u64_stats_fetch_begin_irq(&ring->syncp);
tx_bytes += ring->stats.tx_bytes;
tx_pkts += ring->stats.tx_pkts;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
@@ -1061,6 +1062,7 @@ hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
/* fetch the rx stats */
ring = priv->ring_data[idx + queue_num].ring;
do {
+ start = u64_stats_fetch_begin_irq(&ring->syncp);
rx_bytes += ring->stats.rx_bytes;
rx_pkts += ring->stats.rx_pkts;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next 0/3] Misc. Bug fixes for HNS3 Ethernet Driver Salil Mehta <salil.mehta@huawei.com> - 2017-08-18 13:40 +0200 [PATCH net-next 3/3] net: hns3: Fixes the static check warning due to missing unsupp L3 proto check Salil Mehta <salil.mehta@huawei.com> - 2017-08-18 13:40 +0200 [PATCH net-next 1/3] net: hns3: Fixes the missing u64_stats_fetch_begin_irq in 64-bit stats fetch Salil Mehta <salil.mehta@huawei.com> - 2017-08-18 13:40 +0200 [PATCH net-next 2/3] net: hns3: Fixes the static checker error warning in hns3_get_link_ksettings() Salil Mehta <salil.mehta@huawei.com> - 2017-08-18 13:40 +0200 Re: [PATCH net-next 0/3] Misc. Bug fixes for HNS3 Ethernet Driver David Miller <davem@davemloft.net> - 2017-08-18 19:40 +0200
csiph-web