net: hns3: After setting the loopback, add the status of getting MAC
After setting the serdes loopback, you need to determine the status of the MAC negotiation. If a status exception is obtained after 200ms, a timeout error is returned. Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
28673b33c7
commit
350fda0a0a
|
@ -5237,8 +5237,15 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en,
|
|||
{
|
||||
#define HCLGE_SERDES_RETRY_MS 10
|
||||
#define HCLGE_SERDES_RETRY_NUM 100
|
||||
|
||||
#define HCLGE_MAC_LINK_STATUS_MS 20
|
||||
#define HCLGE_MAC_LINK_STATUS_NUM 10
|
||||
#define HCLGE_MAC_LINK_STATUS_DOWN 0
|
||||
#define HCLGE_MAC_LINK_STATUS_UP 1
|
||||
|
||||
struct hclge_serdes_lb_cmd *req;
|
||||
struct hclge_desc desc;
|
||||
int mac_link_ret = 0;
|
||||
int ret, i = 0;
|
||||
u8 loop_mode_b;
|
||||
|
||||
|
@ -5261,8 +5268,10 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en,
|
|||
if (en) {
|
||||
req->enable = loop_mode_b;
|
||||
req->mask = loop_mode_b;
|
||||
mac_link_ret = HCLGE_MAC_LINK_STATUS_UP;
|
||||
} else {
|
||||
req->mask = loop_mode_b;
|
||||
mac_link_ret = HCLGE_MAC_LINK_STATUS_DOWN;
|
||||
}
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
|
||||
|
@ -5294,7 +5303,19 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en,
|
|||
}
|
||||
|
||||
hclge_cfg_mac_mode(hdev, en);
|
||||
return 0;
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
/* serdes Internal loopback, independent of the network cable.*/
|
||||
msleep(HCLGE_MAC_LINK_STATUS_MS);
|
||||
ret = hclge_get_mac_link_status(hdev);
|
||||
if (ret == mac_link_ret)
|
||||
return 0;
|
||||
} while (++i < HCLGE_MAC_LINK_STATUS_NUM);
|
||||
|
||||
dev_err(&hdev->pdev->dev, "config mac mode timeout\n");
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static int hclge_tqp_enable(struct hclge_dev *hdev, int tqp_id,
|
||||
|
|
Loading…
Reference in New Issue