Skip to contentSkip to conversation

net/ixgbe: fix link status when link is NACK

PATCH Superseded Yanglong Wu 3 participants 6 messages Jul 23, 2018 – Jul 26, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ixgbe: fix link status when link is NACK

Link status should be set as down when link is NACK.

Fixes dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +4 -5
index 997683d3b..378ead4b4 100644
@@ -3933,12 +3933,10 @@ ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 	}
 
 	if (no_pflink_check) {
-		if (*speed == IXGBE_LINK_SPEED_UNKNOWN)
+		if (*speed == IXGBE_LINK_SPEED_UNKNOWN) {
 			mac->get_link_status = true;
-		else
-			mac->get_link_status = false;
-
-		goto out;
+			goto out;
+		}
 	}
 	/* if the read failed it could just be a mailbox collision, best wait
 	 * until we are called again and don't report an error
@@ -4013,6 +4011,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	if (diag != 0) {
 		link.link_speed = ETH_SPEED_NUM_100M;
 		link.link_duplex = ETH_LINK_FULL_DUPLEX;
+		link.link_status = ETH_LINK_DOWN;
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/1 net/ixgbe: fix link status when link is NACK

Link status should be set as down when link is NACK.

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

---
v2:
no need to set link status again

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +3 -5
index 997683d3b..3ffc72b40 100644
@@ -3933,12 +3933,10 @@ ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 	}
 
 	if (no_pflink_check) {
-		if (*speed == IXGBE_LINK_SPEED_UNKNOWN)
+		if (*speed == IXGBE_LINK_SPEED_UNKNOWN) {
 			mac->get_link_status = true;
-		else
-			mac->get_link_status = false;
-
-		goto out;
+			goto out;
+		}
 	}
 	/* if the read failed it could just be a mailbox collision, best wait
 	 * until we are called again and don't report an error
Signature · 1 line
2.11.0
#2 lore raw

Hi Yanglang:

Quoted 31 lines

-----Original Message-----
From: Wu, Yanglong
Sent: Tuesday, July 24, 2018 3:31 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wang, Dong1 <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [PATCH v2] net/ixgbe: fix link status when link is NACK

Link status should be set as down when link is NACK.

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

---
v2:
no need to set link status again

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 997683d3b..3ffc72b40 100644
@@ -3933,12 +3933,10 @@ ixgbevf_check_link(struct ixgbe_hw *hw,
 ixgbe_link_speed *speed,
 	}
 
 	if (no_pflink_check) {

drivers/net/ixgbe/ixgbe_ethdev.c ixgbevf_check_link(struct ixgbe_hw *hw, · line 3941

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +3 -5
-		if (*speed == IXGBE_LINK_SPEED_UNKNOWN)
+		if (*speed == IXGBE_LINK_SPEED_UNKNOWN) {
 			mac->get_link_status = true;
-		else
-			mac->get_link_status = false;
-
-		goto out;
+			goto out;
+		}
 	}

Sorry, I can't understand this change combined with your commit log, could you explain more?
Btw, no_fplink_check = 1 means wait_to_complete = 0,
but in the case when *speed != IXGBE_LINK_SPEED_UNKNOWN , you will still go msg.read which I guess is not suppose be called in the case wait_to_complete = 0, is it right?

Quoted 4 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 	/* if the read failed it could just be a mailbox collision, best wait

* until we are called again and don't report an error
--
2.11.0

#3 lore raw

PATCH v3 1/1 net/ixgbe: fix ixgbevf link status

In reply to Yanglong Wu

ixgbevf can't get right link status unless
it check PF link status in wait mode.

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

---
v3:
change to wait mode in ixgbevf
---
v2:
no need to set link status again

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
index 26b192737..b90b352e3 100644
@@ -4006,7 +4006,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		wait = 0;
 
 	if (vf)
-		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
+		/* ixgbevf need to wait to get link status */
+		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
 
Signature · 1 line
2.11.0
#4 lore raw

Re: [PATCH v3] net/ixgbe: fix ixgbevf link status

Hi Yanglong,

I think the risk (or bug) is in ixgbevf_check_link(), not how to invoke this function(). Anyone who call ixgbevf_check_link() with "wait = 0", they must can't get right link status when 82599 use DA Cable.

In ixgbevf kernel driver, ixgbe_check_mac_link_vf(), "wait" didn't be referenced.

What about reference to ixgbevf kernel driver, don't use "wait" parameter in ixgbevf_check_link()?

Regards,
Dong

-----Original Message-----
From: Wu, Yanglong
Sent: Thursday, July 26, 2018 10:25
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wang, Dong1 <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [PATCH v3] net/ixgbe: fix ixgbevf link status

ixgbevf can't get right link status unless it check PF link status in wait mode.

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

---
v3:
change to wait mode in ixgbevf
---
v2:
no need to set link status again

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
index 26b192737..b90b352e3 100644
@@ -4006,7 +4006,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		wait = 0;
 
 	if (vf)
-		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
+		/* ixgbevf need to wait to get link status */
+		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
 

--
2.11.0

#5 lore raw

Re: [PATCH v3] net/ixgbe: fix ixgbevf link status

In reply to Yanglong Wu
Quoted 31 lines

-----Original Message-----
From: Wu, Yanglong
Sent: Thursday, July 26, 2018 10:25 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wang, Dong1 <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [PATCH v3] net/ixgbe: fix ixgbevf link status

ixgbevf can't get right link status unless it check PF link status in wait mode.

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

---
v3:
change to wait mode in ixgbevf
---
v2:
no need to set link status again

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 26b192737..b90b352e3 100644

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_link_update_share(struct rte_eth_dev · line 4011

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
@@ -4006,7 +4006,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev
 *dev,
 		wait = 0;
 
 	if (vf)
-		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
+		/* ixgbevf need to wait to get link status */
+		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);

Sorry, I mislead you in our offline talk.
I think to implement a no_wait ops with a wait method may confuse the user, because an application may call rte_eth_link_get_nowait in the data path, we should not do any time consume tasks. So maybe the reasonable way is return -ENOTSUP for a nowait request since ixgbevf can't support this due to hardware limitation.
And also the parameter " wait_to_complete" can be omitted in ixgbevf_check_link, since the nowait implementation is not correct and should be removed.

Quoted 5 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -1
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
 
--

2.11.0