From: Yuanhan Liu <yliu@fridaylinux.org>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
Yongseok Koh <yskoh@mellanox.com>,
Shahaf Shuler <shahafs@mellanox.com>,
Yuanhan Liu <yliu@fridaylinux.org>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: fix link speed
Date: Mon, 5 Feb 2018 20:01:44 +0800 [thread overview]
Message-ID: <1517832104-2800-1-git-send-email-yliu@fridaylinux.org> (raw)
When the link is down, mlx5 kernel driver reports the link speed as -1
(UNKNOWN_SPEED). We need turn it to 0 for such case, otherwise, it
will be re-queried again due to the link_speed is not 0, due to following
code:
1201 if (((link->link_speed == 0) && link->link_status) ||
1202 ((link->link_speed != 0) && !link->link_status)) {
1203 /*
1204 * Inconsistent status. Event likely occurred before the
1205 * kernel netdevice exposes the new status.
1206 */
Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
Cc: stable@dpdk.org
Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org>
---
drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 6665076..492ca07 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -808,6 +808,10 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
return -1;
}
dev_link.link_speed = ecmd->speed;
+ if (link_speed == -1)
+ dev_link.link_speed = 0;
+ else
+ dev_link.link_speed = link_speed;
sc = ecmd->link_mode_masks[0] |
((uint64_t)ecmd->link_mode_masks[1] << 32);
priv->link_speed_capa = 0;
--
2.7.4
next reply other threads:[~2018-02-05 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 12:01 Yuanhan Liu [this message]
2018-02-05 12:28 ` Nélio Laranjeiro
2018-02-05 13:39 ` Shahaf Shuler
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=1517832104-2800-1-git-send-email-yliu@fridaylinux.org \
--to=yliu@fridaylinux.org \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=nelio.laranjeiro@6wind.com \
--cc=shahafs@mellanox.com \
--cc=stable@dpdk.org \
--cc=yskoh@mellanox.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).