net: hns3: fix pfc packet number incorrect after querying pfc parameters
authorJie Wang <wangjie125@huawei.com>
Wed, 10 Nov 2021 13:42:51 +0000 (21:42 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Nov 2021 14:20:43 +0000 (14:20 +0000)
commit0b653a81a26d66ffe526a54c2177e24fb1400301
tree210f1a08c7a70a1f7308cfc4655efc9e7dd26a9c
parentbeb27ca451a57a1c0e52b5268703f3c3173c1f8c
net: hns3: fix pfc packet number incorrect after querying pfc parameters

Currently, driver will send command to firmware to query pfc packet number
when user uses dcb tool to get pfc parameters. However, the periodic
service task will also periodically query and record MAC statistics,
including pfc packet number.

As the hardware registers of statistics is cleared after reading, it will
cause pfc packet number of MAC statistics are not correct after using dcb
tool to get pfc parameters.

To fix this problem, when user uses dcb tool to get pfc parameters, driver
updates MAC statistics firstly and then get pfc packet number from MAC
statistics.

Fixes: 64fd2300fcc1 ("net: hns3: add support for querying pfc puase packets statistic")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h