DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: "Xueming(Steven) Li" <xuemingl@mellanox.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v3] net/mlx5: fix wrong representor port link status
Date: Fri, 28 Sep 2018 00:13:38 +0000	[thread overview]
Message-ID: <569C2065-BD59-43F9-96C0-4BE7C1F40779@mellanox.com> (raw)
In-Reply-To: <1537345657-171431-1-git-send-email-xuemingl@mellanox.com>


> On Sep 19, 2018, at 1:27 AM, Xueming Li <xuemingl@mellanox.com> wrote:
> 
> 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: 2b7302638898 ("net/mlx5: probe all port representors")
> Cc: adrien.mazarguil@6wind.com
> 
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks

> drivers/net/mlx5/mlx5_ethdev.c | 36 ++++++++++++++++++++++--------------
> 1 file changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index 34c5b95..5515fdb 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -627,16 +627,19 @@ 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));
> 		return ret;
> 	}
> -	memset(&dev_link, 0, sizeof(dev_link));
> -	dev_link.link_status = ((ifr.ifr_flags & IFF_UP) &&
> -				(ifr.ifr_flags & IFF_RUNNING));
> -	ifr.ifr_data = (void *)&edata;
> +	dev_link = (struct rte_eth_link) {
> +		.link_status = ((ifr.ifr_flags & IFF_UP) &&
> +				(ifr.ifr_flags & IFF_RUNNING)),
> +	};
> +	ifr = (struct ifreq) {
> +		.ifr_data = (void *)&edata,
> +	};
> 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1);
> 	if (ret) {
> 		DRV_LOG(WARNING,
> @@ -666,8 +669,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,16 +702,19 @@ 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));
> 		return ret;
> 	}
> -	memset(&dev_link, 0, sizeof(dev_link));
> -	dev_link.link_status = ((ifr.ifr_flags & IFF_UP) &&
> -				(ifr.ifr_flags & IFF_RUNNING));
> -	ifr.ifr_data = (void *)&gcmd;
> +	dev_link = (struct rte_eth_link) {
> +		.link_status = ((ifr.ifr_flags & IFF_UP) &&
> +				(ifr.ifr_flags & IFF_RUNNING)),
> +	};
> +	ifr = (struct ifreq) {
> +		.ifr_data = (void *)&gcmd,
> +	};
> 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1);
> 	if (ret) {
> 		DRV_LOG(DEBUG,
> @@ -775,8 +782,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
> 

  reply	other threads:[~2018-09-28  0:13 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 ` [dpdk-dev] [PATCH v2] " Xueming Li
2018-09-14 16:43   ` 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 [this message]
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=569C2065-BD59-43F9-96C0-4BE7C1F40779@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    --cc=xuemingl@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).