Skip to contentSkip to conversation

net/ixgbe:fix wrong link status

dpdk-dev Applied Zhang Xiao 3 participants 6 messages Sep 2, 2019 – Nov 4, 2019 Network drivers

lore
Share & tools
lore

Zhang Xiao

author
#0 lore raw

The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
index 87d2ad0..fc06a1a 100644
@@ -2864,6 +2864,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2894,6 +2895,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -3967,6 +3969,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	u32 speed = 0;
 	int wait = 1;
 	bool autoneg = false;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
 	link.link_status = ETH_LINK_DOWN;
@@ -3999,6 +4002,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
 		return rte_eth_linkstatus_set(dev, &link);
Signature · 1 line
2.7.4
Reviewed-by
#1 lore raw
Quoted 65 lines

-----Original Message-----
From: Zhang, Xiao
Sent: Monday, September 2, 2019 7:52 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>; Zhang, Xiao <[email protected]>; [email protected]
Subject: net/ixgbe:fix wrong link status

The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +3 -0
index 87d2ad0..fc06a1a 100644
@@ -2864,6 +2864,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2894,6 +2895,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -3967,6 +3969,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev
 *dev,
 	u32 speed = 0;
 	int wait = 1;
 	bool autoneg = false;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
 	link.link_status = ETH_LINK_DOWN;
@@ -3999,6 +4002,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev
 *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;

return rte_eth_linkstatus_set(dev, &link);
--
2.7.4

#2 lore raw
In reply to Zhang Xiao

Hi, Xiao

Quoted 1 line · Zhang Xiao

The link status for 82599eb got from link status register was not correct,

So there is a HW issue, right?

Thanks,
Xiaolong

Quoted 54 lines

check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

---
drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++

1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
index 87d2ad0..fc06a1a 100644
@@ -2864,6 +2864,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2894,6 +2895,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -3967,6 +3969,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	u32 speed = 0;
 	int wait = 1;
 	bool autoneg = false;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
 	link.link_status = ETH_LINK_DOWN;
@@ -3999,6 +4002,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
 		return rte_eth_linkstatus_set(dev, &link);
Signature · 1 line
2.7.4
#3 lore raw
In reply to Zhang Xiao

Hi, Xiao

This patch failed to apply on top of dpdk-next-net-intel/for-next-net, could you help to do a rebase?

Thanks,
Xiaolong

Quoted 55 lines · Zhang Xiao

The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

---
drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++

1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
index 87d2ad0..fc06a1a 100644
@@ -2864,6 +2864,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2894,6 +2895,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -3967,6 +3969,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	u32 speed = 0;
 	int wait = 1;
 	bool autoneg = false;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
 	link.link_status = ETH_LINK_DOWN;
@@ -3999,6 +4002,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
 		return rte_eth_linkstatus_set(dev, &link);
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 1/1 net/ixgbe:fix wrong link status

In reply to Zhang Xiao

The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

---
v2
Rebase the patch to latest master code.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
index dbce7a8..3202c28 100644
@@ -2904,6 +2904,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2934,6 +2935,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -4108,6 +4110,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	int link_up;
 	int diag;
 	int wait = 1;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
 	link.link_status = ETH_LINK_DOWN;
@@ -4135,6 +4138,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
 			intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
Signature · 1 line
2.7.4
Acked-by on v2 1/1 Applied
#5 lore raw
Quoted 59 lines · Xiao Zhang

The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

---
v2
Rebase the patch to latest master code.
---
drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++

1 file changed, 7 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
index dbce7a8..3202c28 100644
@@ -2904,6 +2904,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -2934,6 +2935,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
+		ixgbe_dev_link_update(dev, 0);
 	}
 
 	return 0;
@@ -4108,6 +4110,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	int link_up;
 	int diag;
 	int wait = 1;
+	u32 esdp_reg;
 
 	memset(&link, 0, sizeof(link));
 	link.link_status = ETH_LINK_DOWN;
@@ -4135,6 +4138,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
+	esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
+	if ((esdp_reg & IXGBE_ESDP_SDP3))
+		link_up = 0;
+
 	if (link_up == 0) {
 		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
 			intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
Signature · 1 line
2.7.4

Applied to dpdk-next-net-intel. Thanks.