Unverified Commit d6a1520b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3239 net: hns: fix fake link up

Merge Pull Request from: @ci-robot 
 
PR sync from: Yonglong Liu <liuyonglong@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/GRAMZGYOMGJBGJ2Z4PHKKGGANSMYNUMD/ 
This patch set fix fake link up problem and modify the driver
version.

Yonglong Liu (2):
  net: hns: fix fake link up on xge port
  net: hns: update hns version to 23.12.1


-- 
2.17.1
 
https://gitee.com/openeuler/kernel/issues/I8K7Q8 
 
Link:https://gitee.com/openeuler/kernel/pulls/3239

 

Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 86a8557e 46bb9fe6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
#include <linux/phy.h>
#include <linux/types.h>

#define HNAE_DRIVER_VERSION "23.7.1"
#define HNAE_DRIVER_VERSION "23.12.1"
#define HNAE_DRIVER_NAME "hns"
#define HNAE_COPYRIGHT "Copyright(c) 2015 Huawei Corporation."
#define HNAE_DRIVER_STRING "Hisilicon Network Subsystem Driver"
+29 −0
Original line number Diff line number Diff line
@@ -66,6 +66,27 @@ static enum mac_mode hns_get_enet_interface(const struct hns_mac_cb *mac_cb)
	}
}

static u32 hns_mac_link_anti_shake(struct mac_driver *mac_ctrl_drv)
{
#define HNS_MAC_LINK_WAIT_TIME 5
#define HNS_MAC_LINK_WAIT_CNT 40

	u32 link_status = 0;
	int i;

	if (!mac_ctrl_drv->get_link_status)
		return link_status;

	for (i = 0; i < HNS_MAC_LINK_WAIT_CNT; i++) {
		msleep(HNS_MAC_LINK_WAIT_TIME);
		mac_ctrl_drv->get_link_status(mac_ctrl_drv, &link_status);
		if (!link_status)
			break;
	}

	return link_status;
}

void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status)
{
	struct mac_driver *mac_ctrl_drv;
@@ -83,6 +104,14 @@ void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status)
							       &sfp_prsnt);
		if (!ret)
			*link_status = *link_status && sfp_prsnt;

		/* for FIBER port, it may have a fake link up.
		 * when the link status changes from down to up, we need to do
		 * anti-shake. the anti-shake time is base on tests.
		 * only FIBER port need to do this.
		 */
		if (*link_status && !mac_cb->link)
			*link_status = hns_mac_link_anti_shake(mac_ctrl_drv);
	}

	mac_cb->link = *link_status;
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@

#define MDIO_DRV_NAME "Hi-HNS_MDIO"
#define MDIO_BUS_NAME "Hisilicon MII Bus"
#define MDIO_MOD_VERSION "23.7.1"
#define MDIO_MOD_VERSION "23.12.1"

#define MDIO_TIMEOUT			1000000