From patchwork Wed Jun 19 09:52:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asaf Penso X-Patchwork-Id: 54951 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5ED3A1C2CA; Wed, 19 Jun 2019 11:52:57 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 486E01C2C1; Wed, 19 Jun 2019 11:52:56 +0200 (CEST) From: Asaf Penso To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, srinivas.narayan@att.com, stable@dpdk.org Date: Wed, 19 Jun 2019 09:52:45 +0000 Message-Id: <1560937965-448702-1-git-send-email-asafp@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix condition for calling mlx5_link_update_unlocked_gset 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" mlx5_link_update uses the newer ethtool command ETHTOOL_GLINKSETTINGS to determine interface capabilities but falls back to the older (deprecated) ETHTOOL_GSET command if the new method fails for any reason. The older method only supports reporting of capabilities up to 40G. However, mlx5_link_update_unlocked_gs can return a failure for a number of reasons (including the link being down). Using the older method in cases of transient failure of the method can result in reporting of reduced capabilities to the application. The older method (mlx5_link_update_unlocked_gset) should only be invoked if the newer method returns EOPNOTSUPP. Fixes: 7d2e32f7 ("net/mlx5: fix ethtool link setting call order") Cc: stable@dpdk.org Signed-off-by: Asaf Penso Reported-by: Srinivas Narayan Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index ac0500a..61e12cc 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -947,7 +947,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size) do { ret = mlx5_link_update_unlocked_gs(dev, &dev_link); - if (ret) + if (ret == -ENOTSUP) ret = mlx5_link_update_unlocked_gset(dev, &dev_link); if (ret == 0) break;