net: hns3: fix port duplex configure error in IMP reset
authorJie Wang <wangjie125@huawei.com>
Thu, 7 Mar 2024 01:01:14 +0000 (09:01 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Mar 2024 12:01:32 +0000 (12:01 +0000)
Currently, the mac port is fixed to configured as full dplex mode in
hclge_mac_init() when driver initialization or reset restore. Users may
change the mode to half duplex with ethtool,  so it may cause the user
configuration dropped after reset.

To fix it, don't change the duplex mode when resetting.

Fixes: 2d03eacc0b7e ("net: hns3: Only update mac configuation when necessary")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index 349e4a1946ab0462c68348c0f3e5918a93662814..b4afb66efe5c5c242e01670128c3ae069bdcaeda 100644 (file)
@@ -2903,7 +2903,10 @@ static int hclge_mac_init(struct hclge_dev *hdev)
        int ret;
 
        hdev->support_sfp_query = true;
-       hdev->hw.mac.duplex = HCLGE_MAC_FULL;
+
+       if (!test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
+               hdev->hw.mac.duplex = HCLGE_MAC_FULL;
+
        ret = hclge_cfg_mac_speed_dup_hw(hdev, hdev->hw.mac.speed,
                                         hdev->hw.mac.duplex, hdev->hw.mac.lane_num);
        if (ret)