From: Sergio Gonzalez Monroy Date: Tue, 16 Jun 2015 14:38:48 +0000 (+0100) Subject: ixgbevf: fix link status for PF up/down events X-Git-Tag: spdx-start~9031 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=1c2bbcdfd79e85d8417c1fa031e0a3acfb792d4f ixgbevf: fix link status for PF up/down events 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 --- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 10be88e783..d39640bdac 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)