2020-03-05 01:49:06

by Huazhong Tan

[permalink] [raw]
Subject: [PATCH net] net: hns3: fix a not link up issue when fibre port supports autoneg

From: Jian Shen <[email protected]>

When fibre port supports auto-negotiation, the IMP(Intelligent
Management Process) processes the speed of auto-negotiation
and the user's speed separately.
For below case, the port will get a not link up problem.
step 1: disables auto-negotiation and sets speed to A, then
the driver's MAC speed will be updated to A.
step 2: enables auto-negotiation and MAC gets negotiated
speed B, then the driver's MAC speed will be updated to B
through querying in periodical task.
step 3: MAC gets new negotiated speed A.
step 4: disables auto-negotiation and sets speed to B before
periodical task query new MAC speed A, the driver will ignore
the speed configuration.

This patch fixes it by skipping speed and duplex checking when
fibre port supports auto-negotiation.

Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
Signed-off-by: Jian Shen <[email protected]>
Signed-off-by: Huazhong Tan <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 492bc94..acf0c29f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2446,10 +2446,12 @@ static int hclge_cfg_mac_speed_dup_hw(struct hclge_dev *hdev, int speed,

int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex)
{
+ struct hclge_mac *mac = &hdev->hw.mac;
int ret;

duplex = hclge_check_speed_dup(duplex, speed);
- if (hdev->hw.mac.speed == speed && hdev->hw.mac.duplex == duplex)
+ if (!mac->support_autoneg && mac->speed == speed &&
+ mac->duplex == duplex)
return 0;

ret = hclge_cfg_mac_speed_dup_hw(hdev, speed, duplex);
--
2.7.4


2020-03-05 20:06:15

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net] net: hns3: fix a not link up issue when fibre port supports autoneg

From: Huazhong Tan <[email protected]>
Date: Thu, 5 Mar 2020 09:47:53 +0800

> From: Jian Shen <[email protected]>
>
> When fibre port supports auto-negotiation, the IMP(Intelligent
> Management Process) processes the speed of auto-negotiation
> and the user's speed separately.
> For below case, the port will get a not link up problem.
> step 1: disables auto-negotiation and sets speed to A, then
> the driver's MAC speed will be updated to A.
> step 2: enables auto-negotiation and MAC gets negotiated
> speed B, then the driver's MAC speed will be updated to B
> through querying in periodical task.
> step 3: MAC gets new negotiated speed A.
> step 4: disables auto-negotiation and sets speed to B before
> periodical task query new MAC speed A, the driver will ignore
> the speed configuration.
>
> This patch fixes it by skipping speed and duplex checking when
> fibre port supports auto-negotiation.
>
> Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
> Signed-off-by: Jian Shen <[email protected]>
> Signed-off-by: Huazhong Tan <[email protected]>

Applied and queued up for -stable, thanks.