net: hns3: refactor hclge_mac_link_status_wait for interface reuse
commit 08469dacfad25428b66549716811807203744f4f 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 <wangjie125@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Link: https://lore.kernel.org/r/20230807113452.474224-3-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
b564f32fb3
commit
70660e6faa
@@ -71,6 +71,8 @@ static int hclge_set_default_loopback(struct hclge_dev *hdev);
|
|||||||
static void hclge_sync_mac_table(struct hclge_dev *hdev);
|
static void hclge_sync_mac_table(struct hclge_dev *hdev);
|
||||||
static void hclge_restore_hw_table(struct hclge_dev *hdev);
|
static void hclge_restore_hw_table(struct hclge_dev *hdev);
|
||||||
static void hclge_sync_promisc_mode(struct hclge_dev *hdev);
|
static void hclge_sync_promisc_mode(struct hclge_dev *hdev);
|
||||||
|
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
|
||||||
|
int wait_cnt);
|
||||||
|
|
||||||
static struct hnae3_ae_algo ae_algo;
|
static struct hnae3_ae_algo ae_algo;
|
||||||
|
|
||||||
@@ -6647,10 +6649,9 @@ static void hclge_phy_link_status_wait(struct hclge_dev *hdev,
|
|||||||
} while (++i < HCLGE_PHY_LINK_STATUS_NUM);
|
} while (++i < HCLGE_PHY_LINK_STATUS_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
#define HCLGE_MAC_LINK_STATUS_NUM 100
|
|
||||||
|
|
||||||
int link_status;
|
int link_status;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -6663,13 +6664,15 @@ static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
msleep(HCLGE_LINK_STATUS_MS);
|
msleep(HCLGE_LINK_STATUS_MS);
|
||||||
} while (++i < HCLGE_MAC_LINK_STATUS_NUM);
|
} while (++i < wait_cnt);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
|
static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
|
||||||
bool is_phy)
|
bool is_phy)
|
||||||
{
|
{
|
||||||
|
#define HCLGE_MAC_LINK_STATUS_NUM 100
|
||||||
|
|
||||||
int link_ret;
|
int link_ret;
|
||||||
|
|
||||||
link_ret = en ? HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN;
|
link_ret = en ? HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN;
|
||||||
@@ -6677,7 +6680,8 @@ static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
|
|||||||
if (is_phy)
|
if (is_phy)
|
||||||
hclge_phy_link_status_wait(hdev, link_ret);
|
hclge_phy_link_status_wait(hdev, link_ret);
|
||||||
|
|
||||||
return hclge_mac_link_status_wait(hdev, link_ret);
|
return hclge_mac_link_status_wait(hdev, link_ret,
|
||||||
|
HCLGE_MAC_LINK_STATUS_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en)
|
static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en)
|
||||||
|
Reference in New Issue
Block a user