summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorMoti Haimovsky <motih@mellanox.com>2019-10-16 10:34:03 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-23 16:43:10 +0200
commit06ee15784871cc457d62b6c965bc8cdac40f9703 (patch)
treee67865509183341ae3016a6a613ae469d1604761 /drivers/net/mlx5/mlx5_ethdev.c
parentf3d0c07b095d7d83ff81abd40990b55372295f46 (diff)
downloaddpdk-next-eventdev-06ee15784871cc457d62b6c965bc8cdac40f9703.zip
dpdk-next-eventdev-06ee15784871cc457d62b6c965bc8cdac40f9703.tar.gz
dpdk-next-eventdev-06ee15784871cc457d62b6c965bc8cdac40f9703.tar.xz
net/mlx5: retry on link update failure
mlx5_link_update immediately returns when called with no-wait parameter and its call for retrieving the link status returns with EAGAIN error. This is too harsh on busy systems where a first call fails with EAGAIN from time to time. This patch adds a (very limited) retry on such cases in order to allow retrieving the link status. Signed-off-by: Moti Haimovsky <motih@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index f2b1752..5f05b2b 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -999,6 +999,7 @@ mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
int ret;
struct rte_eth_link dev_link;
time_t start_time = time(NULL);
+ int retry = MLX5_GET_LINK_STATUS_RETRY_COUNT;
do {
ret = mlx5_link_update_unlocked_gs(dev, &dev_link);
@@ -1007,7 +1008,7 @@ mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
if (ret == 0)
break;
/* Handle wait to complete situation. */
- if (wait_to_complete && ret == -EAGAIN) {
+ if ((wait_to_complete || retry) && ret == -EAGAIN) {
if (abs((int)difftime(time(NULL), start_time)) <
MLX5_LINK_STATUS_TIMEOUT) {
usleep(0);
@@ -1019,7 +1020,7 @@ mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
} else if (ret < 0) {
return ret;
}
- } while (wait_to_complete);
+ } while (wait_to_complete || retry-- > 0);
ret = !!memcmp(&dev->data->dev_link, &dev_link,
sizeof(struct rte_eth_link));
dev->data->dev_link = dev_link;