Skip to content

Commit

Permalink
net/mlx5e: Add error flow when failing update_rx
Browse files Browse the repository at this point in the history
Up until now, return value of update_rx was ignored. Therefore, flow
continues even if it fails. Add error flow in case of update_rx fails in
mlx5e_open_locked, mlx5i_open and mlx5i_pkey_open.

Signed-off-by: Guy Truzman <gtruzman@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Guy Truzman authored and Saeed Mahameed committed Nov 12, 2022
1 parent 38438d3 commit e74ae1f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3069,7 +3069,10 @@ int mlx5e_open_locked(struct net_device *netdev)
if (err)
goto err_clear_state_opened_flag;

priv->profile->update_rx(priv);
err = priv->profile->update_rx(priv);
if (err)
goto err_close_channels;

mlx5e_selq_apply(&priv->selq);
mlx5e_activate_priv_channels(priv);
mlx5e_apply_traps(priv, true);
Expand All @@ -3079,6 +3082,8 @@ int mlx5e_open_locked(struct net_device *netdev)
mlx5e_queue_update_stats(priv);
return 0;

err_close_channels:
mlx5e_close_channels(&priv->channels);
err_clear_state_opened_flag:
clear_bit(MLX5E_STATE_OPENED, &priv->state);
mlx5e_selq_cancel(&priv->selq);
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,17 @@ static int mlx5i_open(struct net_device *netdev)
if (err)
goto err_remove_fs_underlay_qp;

epriv->profile->update_rx(epriv);
err = epriv->profile->update_rx(epriv);
if (err)
goto err_close_channels;

mlx5e_activate_priv_channels(epriv);

mutex_unlock(&epriv->state_lock);
return 0;

err_close_channels:
mlx5e_close_channels(&epriv->channels);
err_remove_fs_underlay_qp:
mlx5_fs_remove_rx_underlay_qpn(mdev, ipriv->qpn);
err_reset_qp:
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,16 @@ static int mlx5i_pkey_open(struct net_device *netdev)
mlx5_core_warn(mdev, "opening child channels failed, %d\n", err);
goto err_clear_state_opened_flag;
}
epriv->profile->update_rx(epriv);
err = epriv->profile->update_rx(epriv);
if (err)
goto err_close_channels;
mlx5e_activate_priv_channels(epriv);
mutex_unlock(&epriv->state_lock);

return 0;

err_close_channels:
mlx5e_close_channels(&epriv->channels);
err_clear_state_opened_flag:
mlx5e_destroy_tis(mdev, epriv->tisn[0][0]);
err_remove_rx_uderlay_qp:
Expand Down

0 comments on commit e74ae1f

Please sign in to comment.