diff options
author | 2021-04-05 18:27:40 +0300 | |
---|---|---|
committer | 2021-07-26 09:50:38 -0700 | |
commit | 3f22d6c77bb91b3429814c3baae91903c8cf7f90 (patch) | |
tree | 644dbc1bdf71f5710f505c996893d5cb02bae127 /drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |
parent | net/mlx5e: Move mlx5e_build_rss_params() call to init_rx (diff) | |
download | wireguard-linux-3f22d6c77bb91b3429814c3baae91903c8cf7f90.tar.xz wireguard-linux-3f22d6c77bb91b3429814c3baae91903c8cf7f90.zip |
net/mlx5e: Move RX resources to a separate struct
This commit moves RQTs and TIRs to a separate struct that is allocated
dynamically in profiles that support these RX resources (all profiles,
except IPoIB PKey). It also allows to remove rqt_enabled flags, as RQTs
are always enabled in profiles that support RX resources.
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_rep.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 0df6c6f99820..590a7ae35155 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -647,6 +647,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) { struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5_eswitch_rep *rep = rpriv->rep; + struct mlx5e_rx_res *res = priv->rx_res; struct ttc_params ttc_params = {}; int tt, err; @@ -654,7 +655,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) MLX5_FLOW_NAMESPACE_KERNEL); /* The inner_ttc in the ttc params is intentionally not set */ - ttc_params.any_tt_tirn = priv->direct_tir[0].tirn; + ttc_params.any_tt_tirn = res->direct_tirs[0].tirn; mlx5e_set_ttc_ft_params(&ttc_params); if (rep->vport != MLX5_VPORT_UPLINK) @@ -662,7 +663,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) ttc_params.ft_attr.level = MLX5E_TTC_FT_LEVEL + 1; for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) - ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn; + ttc_params.indir_tirn[tt] = res->indir_tirs[tt].tirn; err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc); if (err) { @@ -760,7 +761,11 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) u16 max_nch = priv->max_nch; int err; - mlx5e_build_rss_params(&priv->rss_params, priv->channels.params.num_channels); + priv->rx_res = kvzalloc(sizeof(*priv->rx_res), GFP_KERNEL); + if (!priv->rx_res) + return -ENOMEM; + + mlx5e_build_rss_params(&priv->rx_res->rss_params, priv->channels.params.num_channels); mlx5e_init_l2_addr(priv); @@ -774,7 +779,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) if (err) goto err_close_drop_rq; - err = mlx5e_create_direct_rqts(priv, priv->direct_tir, max_nch); + err = mlx5e_create_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch); if (err) goto err_destroy_indirect_rqts; @@ -782,7 +787,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) if (err) goto err_destroy_direct_rqts; - err = mlx5e_create_direct_tirs(priv, priv->direct_tir, max_nch); + err = mlx5e_create_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch); if (err) goto err_destroy_indirect_tirs; @@ -807,16 +812,17 @@ err_destroy_root_ft: err_destroy_ttc_table: mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); err_destroy_direct_tirs: - mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); + mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch); err_destroy_indirect_tirs: mlx5e_destroy_indirect_tirs(priv); err_destroy_direct_rqts: - mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); + mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch); err_destroy_indirect_rqts: - priv->indir_rqt_enabled = false; - mlx5e_rqt_destroy(&priv->indir_rqt); + mlx5e_rqt_destroy(&priv->rx_res->indir_rqt); err_close_drop_rq: mlx5e_close_drop_rq(&priv->drop_rq); + kvfree(priv->rx_res); + priv->rx_res = NULL; return err; } @@ -828,12 +834,13 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) rep_vport_rx_rule_destroy(priv); mlx5e_destroy_rep_root_ft(priv); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); - mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); + mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch); mlx5e_destroy_indirect_tirs(priv); - mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); - priv->indir_rqt_enabled = false; - mlx5e_rqt_destroy(&priv->indir_rqt); + mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch); + mlx5e_rqt_destroy(&priv->rx_res->indir_rqt); mlx5e_close_drop_rq(&priv->drop_rq); + kvfree(priv->rx_res); + priv->rx_res = NULL; } static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv) |