From 9a6f823702c8aac69dd053c74068d2186b3d373e Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 20 Feb 2020 16:54:53 +0800 Subject: [PATCH] net: hns3: skip mac speed and duplex modification checking for fibre port support autoneg 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 Reviewed-by: Peng Li Reviewed-by: Zhong Zhaohui Signed-off-by: Yang Yingliang --- 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 33f7045ca460..0ff69b038fe9 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); -- GitLab