[dpdk-dev] ixgbevf: fix link status for PF up/down events

Message ID 1434465528-12907-1-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sergio Gonzalez Monroy June 16, 2015, 2:38 p.m. UTC
  Current ixgbe VF base driver only really read the status register when:
 - get_link_status is true
 - link reset
 - mailbox timeout.

We only set get_link_status to true when we start the PF/VF, so
following calls to ixgbe_dev_link_update will just keep the old link
status unless the link has been reset.

Because of this behaviour, when the link status of the PF changes after
the VF has been initialized, we do not read the current status register
from the nic and instead we just keep the old link status.

Fix the problem by setting this field to true before calling
ixgbe_check_link function from base driver. We don't need to check after
this call for get_link_status anymore, so remove it.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Comments

Thomas Monjalon June 22, 2015, 10:17 a.m. UTC | #1
2015-06-16 15:38, Sergio Gonzalez Monroy:
> Current ixgbe VF base driver only really read the status register when:
>  - get_link_status is true
>  - link reset
>  - mailbox timeout.
> 
> We only set get_link_status to true when we start the PF/VF, so
> following calls to ixgbe_dev_link_update will just keep the old link
> status unless the link has been reset.
> 
> Because of this behaviour, when the link status of the PF changes after
> the VF has been initialized, we do not read the current status register
> from the nic and instead we just keep the old link status.
> 
> Fix the problem by setting this field to true before calling
> ixgbe_check_link function from base driver. We don't need to check after
> this call for get_link_status anymore, so remove it.
> 
> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7414a2e..4affb01 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2128,11 +2128,14 @@  ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	memset(&old, 0, sizeof(old));
 	rte_ixgbe_dev_atomic_read_link_status(dev, &old);
 
+	hw->mac.get_link_status = true;
+
 	/* check if it needs to wait to complete, if lsc interrupt is enabled */
 	if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0)
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, 0);
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, 1);
+
 	if (diag != 0) {
 		link.link_speed = ETH_LINK_SPEED_100;
 		link.link_duplex = ETH_LINK_HALF_DUPLEX;
@@ -2142,12 +2145,6 @@  ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 		return 0;
 	}
 
-	if (link_speed == IXGBE_LINK_SPEED_UNKNOWN &&
-	    !hw->mac.get_link_status) {
-		memcpy(&link, &old, sizeof(link));
-		return -1;
-	}
-
 	if (link_up == 0) {
 		rte_ixgbe_dev_atomic_write_link_status(dev, &link);
 		if (link.link_status == old.link_status)