diff options
author | Peng Li <lipeng321@huawei.com> | 2021-12-02 11:35:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-12-02 14:53:42 +0300 |
commit | e6d72f6ac2ad4965491354d74b48e35a60abf298 (patch) | |
tree | 11c2987a519316df0abd1828a5cd3bcae79afce6 /drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | |
parent | ce8299b6f76f28326fedce2b4da90888bd97eab2 (diff) | |
download | linux-e6d72f6ac2ad4965491354d74b48e35a60abf298.tar.xz |
net: hns3: extract macro to simplify ring stats update code
As the code to update ring stats is alike for different ring stats
type, this patch extract macro to simplify ring stats update code.
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3_enet.h')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 808405cc0280..2803b2cd7f30 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -660,6 +660,13 @@ static inline bool hns3_nic_resetting(struct net_device *netdev) #define hns3_buf_size(_ring) ((_ring)->buf_size) +#define hns3_ring_stats_update(ring, cnt) do { \ + typeof(ring) (tmp) = (ring); \ + u64_stats_update_begin(&(tmp)->syncp); \ + ((tmp)->stats.cnt)++; \ + u64_stats_update_end(&(tmp)->syncp); \ +} while (0) \ + static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring) { #if (PAGE_SIZE < 8192) |