From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Yuanhan Liu <yliu@fridaylinux.org>
Cc: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 2/2] net/mlx4: fix assertion failure on link update
Date: Thu, 31 Aug 2017 11:44:54 +0200 [thread overview]
Message-ID: <920ba896c2de57ba6e93fa46d3831fba6e9a4cbc.1504172212.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1504172212.git.adrien.mazarguil@6wind.com>
[ backported from upstream commit 2d449f7c52de93a5978b03ea541e454fe87f801b ]
The interrupt handler can sometimes be triggered for reasons other than a
link status event. An assertion failure happen when such events occur while
an asynchronous link status update is already scheduled.
Address this issue using the same approach as its mlx5 counterpart,
commit a9f2fbc42f0c ("net/mlx5: fix inconsistent link status")
Fixes: c4da6caa426d ("mlx4: handle link status interrupts")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
drivers/net/mlx4/mlx4.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 22af742..e17d371 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5386,6 +5386,7 @@ priv_dev_link_status_handler(struct priv *priv, struct rte_eth_dev *dev)
{
struct ibv_async_event event;
int port_change = 0;
+ struct rte_eth_link *link = &dev->data->dev_link;
int ret = 0;
/* Read all message and acknowledge them. */
@@ -5401,21 +5402,20 @@ priv_dev_link_status_handler(struct priv *priv, struct rte_eth_dev *dev)
event.event_type, event.element.port_num);
ibv_ack_async_event(&event);
}
-
- if (port_change ^ priv->pending_alarm) {
- struct rte_eth_link *link = &dev->data->dev_link;
-
- priv->pending_alarm = 0;
- mlx4_link_update(dev, 0);
- if (((link->link_speed == 0) && link->link_status) ||
- ((link->link_speed != 0) && !link->link_status)) {
+ if (!port_change)
+ return ret;
+ mlx4_link_update(dev, 0);
+ if (((link->link_speed == 0) && link->link_status) ||
+ ((link->link_speed != 0) && !link->link_status)) {
+ if (!priv->pending_alarm) {
/* Inconsistent status, check again later. */
priv->pending_alarm = 1;
rte_eal_alarm_set(MLX4_ALARM_TIMEOUT_US,
mlx4_dev_link_status_handler,
dev);
- } else
- ret = 1;
+ }
+ } else {
+ ret = 1;
}
return ret;
}
@@ -5435,6 +5435,7 @@ mlx4_dev_link_status_handler(void *arg)
priv_lock(priv);
assert(priv->pending_alarm == 1);
+ priv->pending_alarm = 0;
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
--
2.1.4
next prev parent reply other threads:[~2017-08-31 9:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 12:18 [dpdk-stable] please help backporting some patches to LTS release 16.11.3 Yuanhan Liu
2017-08-31 9:44 ` [dpdk-stable] [PATCH 0/2] back-ported Mellanox fixes for stable Adrien Mazarguil
2017-08-31 9:44 ` [dpdk-stable] [PATCH 1/2] net/mlx: remove link update lock Adrien Mazarguil
2017-08-31 9:44 ` Adrien Mazarguil [this message]
2017-09-01 2:00 ` [dpdk-stable] [PATCH 0/2] back-ported Mellanox fixes for stable Yuanhan Liu
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=920ba896c2de57ba6e93fa46d3831fba6e9a4cbc.1504172212.git.adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=stable@dpdk.org \
--cc=yliu@fridaylinux.org \
/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).