From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E711FA00E6 for ; Mon, 5 Aug 2019 10:02:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9D4E1BACA; Mon, 5 Aug 2019 10:02:09 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 84FDD1B9FA; Mon, 5 Aug 2019 10:02:08 +0200 (CEST) From: Xiaoyu Min To: Shahaf Shuler , Yongseok Koh , Viacheslav Ovsiienko Cc: dev@dpdk.org, stable@dpdk.org Date: Mon, 5 Aug 2019 16:02:03 +0800 Message-Id: <4b0167f58ced8ae76262b0accbf14a4653b29283.1564991888.git.jackmin@mellanox.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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