Commit 20c27ab8 authored by Guangbin Huang's avatar Guangbin Huang Committed by Jiantao Xiao
Browse files

net: hns3: fix setting incorrect phy link ksettings for firmware in resetting process

mainline inclusion
from mainline-v6.1-rc6
commit 510d7b6a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I65DT5
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=510d7b6ae842e59ee00d57e5f07ac15131b6d899



----------------------------------------------------------------------

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: f5f2b3e4 ("net: hns3: add support for imp-controlled PHYs")
Fixes: c5ef83cb ("net: hns3: fix for phy_addr error in hclge_mac_mdio_config")
Fixes: 2312e050 ("net: hns3: Fix for deadlock problem occurring when unregistering ae_algo")
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarHao Lan <lanhao@huawei.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent 9853e2f6
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -3331,6 +3331,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;
}
@@ -12304,9 +12305,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)) {
	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;
	}