Commit dff655e8 authored by Jijie Shao's avatar Jijie Shao Committed by David S. Miller

net: hns3: fix VF wrong speed and duplex issue

If PF is down, firmware will returns 10 Mbit/s rate and half-duplex mode
when PF queries the port information from firmware.

After imp reset command is executed, PF status changes to down,
and PF will query link status and updates port information
from firmware in a periodic scheduled task.

However, there is a low probability that port information is updated
when PF is down, and then PF link status changes to up.
In this case, PF synchronizes incorrect rate and duplex mode to VF.

This patch fixes it by updating port information before
PF synchronizes the rate and duplex to the VF
when PF changes to up.

Fixes: 18b6e31f ("net: hns3: PF add support for pushing link status to VFs")
Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65e98bb5
...@@ -61,6 +61,7 @@ static void hclge_sync_fd_table(struct hclge_dev *hdev); ...@@ -61,6 +61,7 @@ static void hclge_sync_fd_table(struct hclge_dev *hdev);
static void hclge_update_fec_stats(struct hclge_dev *hdev); static void hclge_update_fec_stats(struct hclge_dev *hdev);
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret, static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
int wait_cnt); int wait_cnt);
static int hclge_update_port_info(struct hclge_dev *hdev);
static struct hnae3_ae_algo ae_algo; static struct hnae3_ae_algo ae_algo;
...@@ -3041,6 +3042,9 @@ static void hclge_update_link_status(struct hclge_dev *hdev) ...@@ -3041,6 +3042,9 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
if (state != hdev->hw.mac.link) { if (state != hdev->hw.mac.link) {
hdev->hw.mac.link = state; hdev->hw.mac.link = state;
if (state == HCLGE_LINK_STATUS_UP)
hclge_update_port_info(hdev);
client->ops->link_status_change(handle, state); client->ops->link_status_change(handle, state);
hclge_config_mac_tnl_int(hdev, state); hclge_config_mac_tnl_int(hdev, state);
if (rclient && rclient->ops->link_status_change) if (rclient && rclient->ops->link_status_change)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment