net: hns3: fix setting incorrect phy link ksettings for firmware in resetting process
authorGuangbin Huang <huangguangbin2@huawei.com>
Mon, 14 Nov 2022 08:20:48 +0000 (16:20 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 15 Nov 2022 12:29:26 +0000 (13:29 +0100)
Currently, if driver is in phy-imp(phy controlled by imp firmware) mode, as
driver did not update phy link ksettings after initialization process or
not update advertising when getting phy link ksettings from firmware, it
may set incorrect phy link ksettings for firmware in resetting process.
So fix it.

Fixes: f5f2b3e4dcc0 ("net: hns3: add support for imp-controlled PHYs")
Fixes: c5ef83cbb1e9 ("net: hns3: fix for phy_addr error in hclge_mac_mdio_config")
Fixes: 2312e050f42b ("net: hns3: Fix for deadlock problem occurring when unregistering ae_algo")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Hao Lan <lanhao@huawei.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index e34ac9c..4e54f91 100644 (file)
@@ -3443,6 +3443,7 @@ static int hclge_update_tp_port_info(struct hclge_dev *hdev)
        hdev->hw.mac.autoneg = cmd.base.autoneg;
        hdev->hw.mac.speed = cmd.base.speed;
        hdev->hw.mac.duplex = cmd.base.duplex;
+       linkmode_copy(hdev->hw.mac.advertising, cmd.link_modes.advertising);
 
        return 0;
 }
@@ -11586,9 +11587,12 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
        if (ret)
                goto err_msi_irq_uninit;
 
-       if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER &&
-           !hnae3_dev_phy_imp_supported(hdev)) {
-               ret = hclge_mac_mdio_config(hdev);
+       if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER) {
+               if (hnae3_dev_phy_imp_supported(hdev))
+                       ret = hclge_update_tp_port_info(hdev);
+               else
+                       ret = hclge_mac_mdio_config(hdev);
+
                if (ret)
                        goto err_msi_irq_uninit;
        }