Commit 484c1ada authored by Eran Ben Elisha's avatar Eran Ben Elisha Committed by Saeed Mahameed

net/mlx5e: Use fail-safe channels reopen in tx reporter recover

When requested to recover from error, the tx reporter might open new
channels and close the existing ones. Use safe channels switch flow in
order to guarantee opened channels at the end of the recover flow.
For this purpose, define mlx5e_safe_reopen_channels function and use it
within those flows.

Fixes: de8650a8 ("net/mlx5e: Add tx reporter support")
Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 192fba79
...@@ -858,6 +858,7 @@ void mlx5e_close_channels(struct mlx5e_channels *chs); ...@@ -858,6 +858,7 @@ void mlx5e_close_channels(struct mlx5e_channels *chs);
* switching channels * switching channels
*/ */
typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv); typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv);
int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv);
int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
struct mlx5e_channels *new_chs, struct mlx5e_channels *new_chs,
mlx5e_fp_hw_modify hw_modify); mlx5e_fp_hw_modify hw_modify);
......
...@@ -194,8 +194,7 @@ static int mlx5e_tx_reporter_recover_all(struct mlx5e_priv *priv) ...@@ -194,8 +194,7 @@ static int mlx5e_tx_reporter_recover_all(struct mlx5e_priv *priv)
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
goto out; goto out;
mlx5e_close_locked(priv->netdev); err = mlx5e_safe_reopen_channels(priv);
err = mlx5e_open_locked(priv->netdev);
out: out:
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
......
...@@ -2937,6 +2937,14 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, ...@@ -2937,6 +2937,14 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
return 0; return 0;
} }
int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv)
{
struct mlx5e_channels new_channels = {};
new_channels.params = priv->channels.params;
return mlx5e_safe_switch_channels(priv, &new_channels, NULL);
}
void mlx5e_timestamp_init(struct mlx5e_priv *priv) void mlx5e_timestamp_init(struct mlx5e_priv *priv)
{ {
priv->tstamp.tx_type = HWTSTAMP_TX_OFF; priv->tstamp.tx_type = HWTSTAMP_TX_OFF;
...@@ -4161,11 +4169,10 @@ static void mlx5e_tx_timeout_work(struct work_struct *work) ...@@ -4161,11 +4169,10 @@ static void mlx5e_tx_timeout_work(struct work_struct *work)
if (!report_failed) if (!report_failed)
goto unlock; goto unlock;
mlx5e_close_locked(priv->netdev); err = mlx5e_safe_reopen_channels(priv);
err = mlx5e_open_locked(priv->netdev);
if (err) if (err)
netdev_err(priv->netdev, netdev_err(priv->netdev,
"mlx5e_open_locked failed recovering from a tx_timeout, err(%d).\n", "mlx5e_safe_reopen_channels failed recovering from a tx_timeout, err(%d).\n",
err); err);
unlock: unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment