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 v2] net/mlx5: fix wrong representor port link status
Date: Fri, 14 Sep 2018 16:43:00 +0000	[thread overview]
Message-ID: <2413B4CB-1001-4F58-9F08-CCA446378571@mellanox.com> (raw)
In-Reply-To: <1536906477-118136-1-git-send-email-xuemingl@mellanox.com>


> On Sep 13, 2018, at 11:27 PM, 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: 5a4b8e2612c5 ("net/mlx5: probe all port representors")

Wrong commit SHA.
Please always check it by running 
        ./devtools/check-git-log.sh -$n
        ./devtools/checkpatches.sh -n$n

> 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;

It would be enough to be done like:

ifr = {
	.ifr_data = (void *)&edata,
};

And please do the same for dev_link even though it isn't relevant in the patch.

> 	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))) {

What does this change mean?
Is it allowed for representors?

> 		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));

Same here for dev_link and ifr.

Thanks,
Yongseok

> 	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
> 

  reply	other threads:[~2018-09-14 16:43 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 [this message]
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=2413B4CB-1001-4F58-9F08-CCA446378571@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).