DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down
@ 2019-08-05  8:02 Xiaoyu Min
  2019-08-05 13:39 ` Slava Ovsiienko
  2019-08-05 15:16 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyu Min @ 2019-08-05  8:02 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh, Viacheslav Ovsiienko; +Cc: dev, stable

When the link is down, the link speed returned by ethtool is
UINT32_MAX and the link status is 0.

In this case, the DPDK ethdev link speed should be set to
ETH_SPEED_NUM_NONE.
Otherwise since link speed is non-zero but link status is zero, this
is an inconsistent situation and -EAGAIN is returned, which is not right.

Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 9629cfb333..33a32fc2fa 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -908,7 +908,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			dev->data->port_id, strerror(rte_errno));
 		return ret;
 	}
-	dev_link.link_speed = ecmd->speed;
+	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ? ETH_SPEED_NUM_NONE :
+							    ecmd->speed;
 	sc = ecmd->link_mode_masks[0] |
 		((uint64_t)ecmd->link_mode_masks[1] << 32);
 	priv->link_speed_capa = 0;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down
  2019-08-05  8:02 [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down Xiaoyu Min
@ 2019-08-05 13:39 ` Slava Ovsiienko
  2019-08-05 15:16 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2019-08-05 13:39 UTC (permalink / raw)
  To: Jack Min, Shahaf Shuler, Yongseok Koh; +Cc: dev, stable

> -----Original Message-----
> From: Xiaoyu Min <jackmin@mellanox.com>
> Sent: Monday, August 5, 2019 11:02
> To: Shahaf Shuler <shahafs@mellanox.com>; Yongseok Koh
> <yskoh@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix link speed info when link is down
> 
> When the link is down, the link speed returned by ethtool is UINT32_MAX
> and the link status is 0.
> 
> In this case, the DPDK ethdev link speed should be set to
> ETH_SPEED_NUM_NONE.
> Otherwise since link speed is non-zero but link status is zero, this is an
> inconsistent situation and -EAGAIN is returned, which is not right.
> 
> Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> b/drivers/net/mlx5/mlx5_ethdev.c index 9629cfb333..33a32fc2fa 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -908,7 +908,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev
> *dev,
>  			dev->data->port_id, strerror(rte_errno));
>  		return ret;
>  	}
> -	dev_link.link_speed = ecmd->speed;
> +	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
> ETH_SPEED_NUM_NONE :
> +							    ecmd->speed;
>  	sc = ecmd->link_mode_masks[0] |
>  		((uint64_t)ecmd->link_mode_masks[1] << 32);
>  	priv->link_speed_capa = 0;
> --
> 2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down
  2019-08-05  8:02 [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down Xiaoyu Min
  2019-08-05 13:39 ` Slava Ovsiienko
@ 2019-08-05 15:16 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2019-08-05 15:16 UTC (permalink / raw)
  To: Jack Min, Shahaf Shuler, Yongseok Koh, Slava Ovsiienko; +Cc: dev, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaoyu Min
> Sent: Monday, August 5, 2019 11:02 AM
> To: Shahaf Shuler <shahafs@mellanox.com>; Yongseok Koh
> <yskoh@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down
> 
> When the link is down, the link speed returned by ethtool is
> UINT32_MAX and the link status is 0.
> 
> In this case, the DPDK ethdev link speed should be set to
> ETH_SPEED_NUM_NONE.
> Otherwise since link speed is non-zero but link status is zero, this
> is an inconsistent situation and -EAGAIN is returned, which is not right.
> 
> Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> b/drivers/net/mlx5/mlx5_ethdev.c
> index 9629cfb333..33a32fc2fa 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -908,7 +908,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev
> *dev,
>  			dev->data->port_id, strerror(rte_errno));
>  		return ret;
>  	}
> -	dev_link.link_speed = ecmd->speed;
> +	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
> ETH_SPEED_NUM_NONE :
> +							    ecmd->speed;
>  	sc = ecmd->link_mode_masks[0] |
>  		((uint64_t)ecmd->link_mode_masks[1] << 32);
>  	priv->link_speed_capa = 0;
> --
> 2.21.0

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-05 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05  8:02 [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down Xiaoyu Min
2019-08-05 13:39 ` Slava Ovsiienko
2019-08-05 15:16 ` Raslan Darawsheh

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