From: Guangbin Huang huangguangbin2@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
------------------------------
Now when use ethtool to get link ksettings parameters, if HCLGE_STATE_DOWN state bit is set to 1, driver will call hclge_update_port_info() function to update port info, because the periodic service task is disabled. If the periodic service task is enabled, it calls hclge_update_port_info() function every second. However, the net open flow is as follow: step 1: call net open hook step 2: clear HCLGE_STATE_DOWN state bit step 3: enable the periodic service task if hclge_get_media_type() function is called between step 2 and step 3, then it will not call hclge_update_port_info(), it may cause some problem as port info is not correct. So this patch modifies hclge_get_media_type() function to call hclge_update_port_info() in any case to fix this problem. Fixes: ad9f310c7c8d ("net: hns3: fix set and get link ksettings issue")
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Reviewed-by: Peng Li lipeng321@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Junxin Chen chenjunxin1@huawei.com Signed-off-by: Shengzui You youshengzui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 0d8cb52ddc42..3bd6d1bfe7cf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -9755,8 +9755,7 @@ static void hclge_get_media_type(struct hnae3_handle *handle, u8 *media_type, * the port information per second. Query the port information before * return the media type, ensure getting the correct media information. */ - if (test_bit(HCLGE_STATE_DOWN, &hdev->state)) - hclge_update_port_info(hdev); + hclge_update_port_info(hdev);
if (media_type) *media_type = hdev->hw.mac.media_type;