patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
To: <stable@dpdk.org>
Cc: Kevin Traynor <ktraynor@redhat.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [PATCH 21.11 3/3] net/mlx5: fix initial link status detection
Date: Tue, 8 Mar 2022 17:10:44 +0200	[thread overview]
Message-ID: <20220308151044.1012413-4-dkozlyuk@nvidia.com> (raw)
In-Reply-To: <20220308151044.1012413-1-dkozlyuk@nvidia.com>

[ upstream commit 655c3c26c11e7a6f1b5421afe40b06d580b8f2dd ]

Link status change takes time that depends on the HW and the kernel.
It was checked immediately after the change was issued at probing.
If the port had beed down before probing, a "down" state may be read,
while the port would be "up" imminently.
After that, DPDK reported the port as "down" mistakenly
and "ifconfig $DEV up" did not trigger an LSC event,
because from the system's perspective the port was "up" already.

Install Netlink event handler at port probe before requesting the port
to come up in order to receive LSC event even if it comes up
between probe and start.

Fixes: b6499434b83e ("net/mlx5: fix link status initialization")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 069d5f8807..6c76a30e8c 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1665,13 +1665,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	/* Bring Ethernet device up. */
 	DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
 		eth_dev->data->port_id);
-	mlx5_set_link_up(eth_dev);
-	/*
-	 * Even though the interrupt handler is not installed yet,
-	 * interrupts will still trigger on the async_fd from
-	 * Verbs context returned by ibv_open_device().
-	 */
+	/* Read link status in case it is up and there will be no event. */
 	mlx5_link_update(eth_dev, 0);
+	/* Watch LSC interrupts between port probe and port start. */
+	priv->sh->port[priv->dev_port - 1].nl_ih_port_id =
+							eth_dev->data->port_id;
+	mlx5_set_link_up(eth_dev);
 	/* Detect minimal data bytes to inline. */
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
-- 
2.25.1


  parent reply	other threads:[~2022-03-08 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 15:10 [PATCH 21.11 0/3] net/mlx5: fix link state detection Dmitry Kozlyuk
2022-03-08 15:10 ` [PATCH 21.11 1/3] common/mlx5: add Netlink event helpers Dmitry Kozlyuk
2022-03-08 15:10 ` [PATCH 21.11 2/3] net/mlx5: fix link status change detection Dmitry Kozlyuk
2022-03-08 15:10 ` Dmitry Kozlyuk [this message]
2022-03-10 12:19 ` [PATCH 21.11 0/3] net/mlx5: fix link state detection Kevin Traynor

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=20220308151044.1012413-4-dkozlyuk@nvidia.com \
    --to=dkozlyuk@nvidia.com \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.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).