net/mlx5: fix condition for link update fallback
authorAsaf Penso <asafp@mellanox.com>
Wed, 19 Jun 2019 09:52:45 +0000 (09:52 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 4 Jul 2019 23:52:02 +0000 (01:52 +0200)
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: 7d2e32f76cfc ("net/mlx5: fix ethtool link setting call order")
Cc: stable@dpdk.org
Reported-by: Srinivas Narayan <srinivas.narayan@att.com>
Signed-off-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5_ethdev.c

index 0c7162d..eeefe4d 100644 (file)
@@ -1051,7 +1051,7 @@ mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 
        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;