DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dave Burton <daveb@infinite.io>
To: dev@dpdk.org, stable@dpdk.org
Cc: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com
Subject: [dpdk-dev] [PATCH] ixgbe: reset need link config flag on start
Date: Mon, 3 Feb 2020 14:28:57 -0600	[thread overview]
Message-ID: <DC3C762A-F0C1-430B-9ECD-1029FC24A6E7@infinite.io> (raw)
In-Reply-To: <20200116172947.45353-1-daveb@infinite.io>



Begin forwarded message:

From: Dave Burton <daveb@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: stable@dpdk.org, Dave Burton <daveb@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 <daveb@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



           reply	other threads:[~2020-02-03 20:29 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200116172947.45353-1-daveb@infinite.io>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DC3C762A-F0C1-430B-9ECD-1029FC24A6E7@infinite.io \
    --to=daveb@infinite.io \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).