Commit bc5506a1 authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Saeed Mahameed

net/mlx5e: Check if inner FT is supported outside of create/destroy functions

Move the mlx5e_tunnel_inner_ft_supported() check for inner flow tables
support outside of mlx5e_create_inner_ttc_table() and
mlx5e_destroy_inner_ttc_table(). It allows to avoid accessing invalid
TIRNs of inner indirect TIRs. In a later commit these accesses will be
replaced by getters that will WARN if inner indirect TIRs don't exist.
Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 69994ef3
...@@ -1349,9 +1349,6 @@ static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_para ...@@ -1349,9 +1349,6 @@ static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_para
struct mlx5e_flow_table *ft = &ttc->ft; struct mlx5e_flow_table *ft = &ttc->ft;
int err; int err;
if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
return 0;
ft->t = mlx5_create_flow_table(priv->fs.ns, &params->ft_attr); ft->t = mlx5_create_flow_table(priv->fs.ns, &params->ft_attr);
if (IS_ERR(ft->t)) { if (IS_ERR(ft->t)) {
err = PTR_ERR(ft->t); err = PTR_ERR(ft->t);
...@@ -1377,9 +1374,6 @@ static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_para ...@@ -1377,9 +1374,6 @@ static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_para
static void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv, static void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
struct mlx5e_ttc_table *ttc) struct mlx5e_ttc_table *ttc)
{ {
if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
return;
mlx5e_cleanup_ttc_rules(ttc); mlx5e_cleanup_ttc_rules(ttc);
mlx5e_destroy_flow_table(&ttc->ft); mlx5e_destroy_flow_table(&ttc->ft);
} }
...@@ -1788,6 +1782,8 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) ...@@ -1788,6 +1782,8 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
} }
mlx5e_set_ttc_basic_params(priv, &ttc_params); mlx5e_set_ttc_basic_params(priv, &ttc_params);
if (mlx5e_tunnel_inner_ft_supported(priv->mdev)) {
mlx5e_set_inner_ttc_ft_params(&ttc_params); mlx5e_set_inner_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn; ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn;
...@@ -1798,6 +1794,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) ...@@ -1798,6 +1794,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
err); err);
goto err_destroy_arfs_tables; goto err_destroy_arfs_tables;
} }
}
mlx5e_set_ttc_ft_params(&ttc_params); mlx5e_set_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
...@@ -1839,6 +1836,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) ...@@ -1839,6 +1836,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
err_destroy_ttc_table: err_destroy_ttc_table:
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
err_destroy_inner_ttc_table: err_destroy_inner_ttc_table:
if (mlx5e_tunnel_inner_ft_supported(priv->mdev))
mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc); mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
err_destroy_arfs_tables: err_destroy_arfs_tables:
mlx5e_arfs_destroy_tables(priv); mlx5e_arfs_destroy_tables(priv);
...@@ -1852,6 +1850,7 @@ void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv) ...@@ -1852,6 +1850,7 @@ void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv)
mlx5e_destroy_vlan_table(priv); mlx5e_destroy_vlan_table(priv);
mlx5e_destroy_l2_table(priv); mlx5e_destroy_l2_table(priv);
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
if (mlx5e_tunnel_inner_ft_supported(priv->mdev))
mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc); mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
mlx5e_arfs_destroy_tables(priv); mlx5e_arfs_destroy_tables(priv);
mlx5e_ethtool_cleanup_steering(priv); mlx5e_ethtool_cleanup_steering(priv);
......
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