net: hns3: fix incorrect components info of ethtool --reset command
authorJie Wang <wangjie125@huawei.com>
Fri, 26 Nov 2021 12:03:18 +0000 (20:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:54 +0000 (09:04 +0100)
[ Upstream commit 82229c4dbb8a2780f05fa1bab29c97ef7bcd21bb ]

Currently, HNS3 driver doesn't clear the reset flags of components after
successfully executing reset, it causes userspace info of
"Components reset" and "Components not reset" is incorrect.

So fix this problem by clear corresponding reset flag after reset process.

Fixes: ddccc5e368a3 ("net: hns3: add support for triggering reset by ethtool")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

index 5ebd96f..526fb56 100644 (file)
@@ -985,6 +985,7 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
        struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);
        const struct hnae3_ae_ops *ops = h->ae_algo->ops;
        const struct hns3_reset_type_map *rst_type_map;
+       enum ethtool_reset_flags rst_flags;
        u32 i, size;
 
        if (ops->ae_dev_resetting && ops->ae_dev_resetting(h))
@@ -1004,6 +1005,7 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
        for (i = 0; i < size; i++) {
                if (rst_type_map[i].rst_flags == *flags) {
                        rst_type = rst_type_map[i].rst_type;
+                       rst_flags = rst_type_map[i].rst_flags;
                        break;
                }
        }
@@ -1019,6 +1021,8 @@ static int hns3_set_reset(struct net_device *netdev, u32 *flags)
 
        ops->reset_event(h->pdev, h);
 
+       *flags &= ~rst_flags;
+
        return 0;
 }