From: Xueming Li <xuemingl@mellanox.com>
To: Shahaf Shuler <shahafs@mellanox.com>, Yongseok Koh <yskoh@mellanox.com>
Cc: Xueming Li <xuemingl@mellanox.com>,
dev@dpdk.org, adrien.mazarguil@6wind.com
Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix wrong representor port link status
Date: Fri, 14 Sep 2018 14:27:57 +0800 [thread overview]
Message-ID: <1536906477-118136-1-git-send-email-xuemingl@mellanox.com> (raw)
In-Reply-To: <1536216636-15673-1-git-send-email-xuemingl@mellanox.com>
Current code uses PF links status for representor port, not the representor
interface itself. This caused wrong representor port link status when
toggling linterface up or down.
Fixes: 5a4b8e2612c5 ("net/mlx5: probe all port representors")
Cc: adrien.mazarguil@6wind.com
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
drivers/net/mlx5/mlx5_ethdev.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 34c5b95..7391ab8 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -627,7 +627,7 @@ struct ethtool_link_settings {
int link_speed = 0;
int ret;
- ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1);
+ ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0);
if (ret) {
DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
dev->data->port_id, strerror(rte_errno));
@@ -636,6 +636,7 @@ struct ethtool_link_settings {
memset(&dev_link, 0, sizeof(dev_link));
dev_link.link_status = ((ifr.ifr_flags & IFF_UP) &&
(ifr.ifr_flags & IFF_RUNNING));
+ memset(&ifr, 0, sizeof(ifr));
ifr.ifr_data = (void *)&edata;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1);
if (ret) {
@@ -666,8 +667,9 @@ struct ethtool_link_settings {
ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX);
dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
ETH_LINK_SPEED_FIXED);
- if ((dev_link.link_speed && !dev_link.link_status) ||
- (!dev_link.link_speed && dev_link.link_status)) {
+ if (!priv->representor &&
+ ((dev_link.link_speed && !dev_link.link_status) ||
+ (!dev_link.link_speed && dev_link.link_status))) {
rte_errno = EAGAIN;
return -rte_errno;
}
@@ -698,7 +700,7 @@ struct ethtool_link_settings {
uint64_t sc;
int ret;
- ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1);
+ ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0);
if (ret) {
DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
dev->data->port_id, strerror(rte_errno));
@@ -707,6 +709,7 @@ struct ethtool_link_settings {
memset(&dev_link, 0, sizeof(dev_link));
dev_link.link_status = ((ifr.ifr_flags & IFF_UP) &&
(ifr.ifr_flags & IFF_RUNNING));
+ memset(&ifr, 0, sizeof(ifr));
ifr.ifr_data = (void *)&gcmd;
ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1);
if (ret) {
@@ -775,8 +778,9 @@ struct ethtool_link_settings {
ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX);
dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
ETH_LINK_SPEED_FIXED);
- if ((dev_link.link_speed && !dev_link.link_status) ||
- (!dev_link.link_speed && dev_link.link_status)) {
+ if (!priv->representor &&
+ ((dev_link.link_speed && !dev_link.link_status) ||
+ (!dev_link.link_speed && dev_link.link_status))) {
rte_errno = EAGAIN;
return -rte_errno;
}
--
1.8.3.1
next prev parent reply other threads:[~2018-09-14 6:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 6:50 [dpdk-dev] [PATCH] " Xueming Li
2018-09-14 6:27 ` Xueming Li [this message]
2018-09-14 16:43 ` [dpdk-dev] [PATCH v2] " Yongseok Koh
2018-09-15 5:23 ` Xueming(Steven) Li
2018-09-19 8:27 ` [dpdk-dev] [PATCH v3] " Xueming Li
2018-09-28 0:13 ` Yongseok Koh
2018-10-04 20:42 ` Thomas Monjalon
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=1536906477-118136-1-git-send-email-xuemingl@mellanox.com \
--to=xuemingl@mellanox.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=shahafs@mellanox.com \
--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).