From: Jian Shen shenjian15@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
For some boards the fibre port supports autoneg, and the firmware handles the autoneg speed and user speed separately.
step 1: user disables autoneg, and set the mac speed A, the driver will update the mac speed to A. step 2: user enables autoneg, and the negotiated speed is B, the driver will update the mac speed to B. step 3: user disable the autoneg, and set the mac speed B, the driver will discard the set mac speed B command, because the speed is not changed by step 2. But for firmware, it will change the mac speed to A by step 1 when received disable autoneg command. In this case, the port can't link up.
This patch fixes it by skip mac speed and duplex modification checking for fibre port support autoneg.
Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
Signed-off-by: Jian Shen shenjian15@huawei.com Reviewed-by: Peng Li lipeng321@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 33f7045..0ff69b0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2481,10 +2481,12 @@ static int hclge_cfg_mac_speed_dup_hw(struct hclge_dev *hdev, int speed,
int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex) { + struct hclge_mac *mac = &hdev->hw.mac; int ret;
duplex = hclge_check_speed_dup(duplex, speed); - if (hdev->hw.mac.speed == speed && hdev->hw.mac.duplex == duplex) + if (!mac->support_autoneg && mac->speed == speed && + mac->duplex == duplex) return 0;
ret = hclge_cfg_mac_speed_dup_hw(hdev, speed, duplex);