Skip to content

Commit 667ce6a

Browse files
Jie Wanggregkh
authored andcommitted
net: hns3: refactor hclge_mac_link_status_wait for interface reuse
commit 08469da upstream. Some nic configurations could only be performed after link is down. So this patch refactor this API for reuse. 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 758dbcf commit 667ce6a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ static void hclge_restore_hw_table(struct hclge_dev *hdev);
7272
static void hclge_sync_promisc_mode(struct hclge_dev *hdev);
7373
static void hclge_sync_fd_table(struct hclge_dev *hdev);
7474
static void hclge_update_fec_stats(struct hclge_dev *hdev);
75+
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
76+
int wait_cnt);
7577

7678
static struct hnae3_ae_algo ae_algo;
7779

@@ -7656,10 +7658,9 @@ static void hclge_phy_link_status_wait(struct hclge_dev *hdev,
76567658
} while (++i < HCLGE_PHY_LINK_STATUS_NUM);
76577659
}
76587660

7659-
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret)
7661+
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
7662+
int wait_cnt)
76607663
{
7661-
#define HCLGE_MAC_LINK_STATUS_NUM 100
7662-
76637664
int link_status;
76647665
int i = 0;
76657666
int ret;
@@ -7672,21 +7673,24 @@ static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret)
76727673
return 0;
76737674

76747675
msleep(HCLGE_LINK_STATUS_MS);
7675-
} while (++i < HCLGE_MAC_LINK_STATUS_NUM);
7676+
} while (++i < wait_cnt);
76767677
return -EBUSY;
76777678
}
76787679

76797680
static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
76807681
bool is_phy)
76817682
{
7683+
#define HCLGE_MAC_LINK_STATUS_NUM 100
7684+
76827685
int link_ret;
76837686

76847687
link_ret = en ? HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN;
76857688

76867689
if (is_phy)
76877690
hclge_phy_link_status_wait(hdev, link_ret);
76887691

7689-
return hclge_mac_link_status_wait(hdev, link_ret);
7692+
return hclge_mac_link_status_wait(hdev, link_ret,
7693+
HCLGE_MAC_LINK_STATUS_NUM);
76907694
}
76917695

76927696
static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en)

0 commit comments

Comments
 (0)