Begin forwarded message: From: Dave Burton <da...@infinite.io> Subject: [PATCH] ixgbe: reset need link config flag on start Date: January 16, 2020 at 11:29:47 AM CST To: dev@dpdk.org Cc: sta...@dpdk.org, Dave Burton <da...@infinite.io> [Resending; original sent on Jan 16, 2020, never seen on public lists] [NB: I do not have DPDK 19.x on my systems, and I understand some context may have changed in 19.08.x, although not the diffs] There is a race condition in the ixgbe PMD between ixgbe_dev_link_update_share() and ixgbe_dev_stop(). If this is a fiber phy and the link goes down, the IXGBE_FLAG_NEED_LINK_CONFIG flag is set and a callback is set for 10us later. If ixgbe_dev_stop() is called prior to this alarm firing, it cancels the alarm, but does not reset the flag. Thereafter, the link is forever reported down, since the short-circuit flag remains set. This patch resets the flag in ixgbe_dev_start (when it matters) just after it has done the same work as the alarm callback would have. This was tested on DPDK 18.11.3. Signed-off-by: Dave Burton <da...@infinite.io> --- drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..64d7928ce 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2543,6 +2543,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev) *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct ixgbe_interrupt *intr = + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); uint32_t intr_vector = 0; int err, link_up = 0, negotiate = 0; uint32_t speed = 0; @@ -2768,6 +2770,14 @@ ixgbe_dev_start(struct rte_eth_dev *dev) skip_link_setup: + /* + * There is a race between ixgbe_dev_link_update_share + * and ixgbe_dev_stop: if ixgbe_dev_stop is called before + * the alarm callback, this flag remains set, and + * ixgbe_dev_link_update_share will no longer sample status. + */ + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; + if (rte_intr_allow_others(intr_handle)) { /* check if lsc interrupt is enabled */ if (dev->data->dev_conf.intr_conf.lsc != 0) -- 2.19.1