Skip to content

Commit 59bad91

Browse files
Jie Wanggregkh
authored andcommitted
net: hns3: add wait until mac link down
commit 6265e24 upstream. In some configure flow of hns3 driver, for example, change mtu, it will disable MAC through firmware before configuration. But firmware disables MAC asynchronously. The rx traffic may be not stopped in this case. So fixes it by waiting until mac link is down. Fixes: a9775bb ("net: hns3: fix set and get link ksettings issue") Signed-off-by: Jie Wang <[email protected]> Signed-off-by: Jijie Shao <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 667ce6a commit 59bad91

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7569,6 +7569,8 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
75697569

75707570
static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
75717571
{
7572+
#define HCLGE_LINK_STATUS_WAIT_CNT 3
7573+
75727574
struct hclge_desc desc;
75737575
struct hclge_config_mac_mode_cmd *req =
75747576
(struct hclge_config_mac_mode_cmd *)desc.data;
@@ -7593,9 +7595,15 @@ static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
75937595
req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en);
75947596

75957597
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
7596-
if (ret)
7598+
if (ret) {
75977599
dev_err(&hdev->pdev->dev,
75987600
"mac enable fail, ret =%d.\n", ret);
7601+
return;
7602+
}
7603+
7604+
if (!enable)
7605+
hclge_mac_link_status_wait(hdev, HCLGE_LINK_STATUS_DOWN,
7606+
HCLGE_LINK_STATUS_WAIT_CNT);
75997607
}
76007608

76017609
static int hclge_config_switch_param(struct hclge_dev *hdev, int vfid,

0 commit comments

Comments
 (0)