Skip to content

Commit a9775bb

Browse files
Guangbin Huangdavem330
authored andcommitted
net: hns3: fix set and get link ksettings issue
When device is not open, the service task which update the port information per second is not running. In this case, the port capabilities, including speed ability, autoneg ability, media type, may be incorrect. Then get/set link ksetting may fail. This patch fixes it by updating the port information before getting/ setting link ksettings when device is not open, and start timer task immediately by setting delay time to 0 when device opens. Fixes: 46a3df9 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 944de48 commit a9775bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6765,7 +6765,7 @@ static void hclge_set_timer_task(struct hnae3_handle *handle, bool enable)
67656765
struct hclge_dev *hdev = vport->back;
67666766

67676767
if (enable) {
6768-
hclge_task_schedule(hdev, round_jiffies_relative(HZ));
6768+
hclge_task_schedule(hdev, 0);
67696769
} else {
67706770
/* Set the DOWN flag here to disable link updating */
67716771
set_bit(HCLGE_STATE_DOWN, &hdev->state);
@@ -8979,6 +8979,12 @@ static void hclge_get_media_type(struct hnae3_handle *handle, u8 *media_type,
89798979
struct hclge_vport *vport = hclge_get_vport(handle);
89808980
struct hclge_dev *hdev = vport->back;
89818981

8982+
/* When nic is down, the service task is not running, doesn't update
8983+
* the port information per second. Query the port information before
8984+
* return the media type, ensure getting the correct media information.
8985+
*/
8986+
hclge_update_port_info(hdev);
8987+
89828988
if (media_type)
89838989
*media_type = hdev->hw.mac.media_type;
89848990

0 commit comments

Comments
 (0)