| From 0e19c140d37fbc36ccab5f9619110ea0dbc935e4 Mon Sep 17 00:00:00 2001 |
| From: Aya Levin <ayal@mellanox.com> |
| Date: Wed, 1 Jul 2020 12:21:53 +0300 |
| Subject: [PATCH] net/mlx5e: Fix error path of device attach |
| |
| commit 5cd39b6e9a420329a9a408894be7ba8aa7dd755e upstream. |
| |
| On failure to attach the netdev, fix the rollback by re-setting the |
| device's state back to MLX5E_STATE_DESTROYING. |
| |
| Failing to attach doesn't stop statistics polling via .ndo_get_stats64. |
| In this case, although the device is not attached, it falsely continues |
| to query the firmware for counters. Setting the device's state back to |
| MLX5E_STATE_DESTROYING prevents the firmware counters query. |
| |
| Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks") |
| Signed-off-by: Aya Levin <ayal@mellanox.com> |
| Reviewed-by: Tariq Toukan <tariqt@mellanox.com> |
| Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| index 5f33074d4094..180b74b34f9a 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| @@ -5071,6 +5071,8 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) |
| profile->cleanup_tx(priv); |
| |
| out: |
| + set_bit(MLX5E_STATE_DESTROYING, &priv->state); |
| + cancel_work_sync(&priv->update_stats_work); |
| return err; |
| } |
| |
| -- |
| 2.27.0 |
| |