This commit enables the tag and header modify action index pool
per-core cache in non-reclaim memory mode.

Signed-off-by: Suanming Mou <suanmi...@nvidia.com>
Acked-by: Matan Azrad <ma...@nvidia.com>
---
 drivers/net/mlx5/mlx5.c         | 4 +++-
 drivers/net/mlx5/mlx5.h         | 1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3b5c7840a8..f79a094a35 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -217,7 +217,8 @@ static const struct mlx5_indexed_pool_config 
mlx5_ipool_cfg[] = {
                .grow_trunk = 3,
                .grow_shift = 2,
                .need_lock = 1,
-               .release_mem_en = 1,
+               .release_mem_en = 0,
+               .per_core_cache = (1 << 16),
                .malloc = mlx5_malloc,
                .free = mlx5_free,
                .type = "mlx5_tag_ipool",
@@ -1129,6 +1130,7 @@ mlx5_alloc_shared_dev_ctx(const struct 
mlx5_dev_spawn_data *spawn,
        }
        sh->refcnt = 1;
        sh->max_port = spawn->max_port;
+       sh->reclaim_mode = config->reclaim_mode;
        strncpy(sh->ibdev_name, mlx5_os_get_ctx_device_name(sh->ctx),
                sizeof(sh->ibdev_name) - 1);
        strncpy(sh->ibdev_path, mlx5_os_get_ctx_device_path(sh->ctx),
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index e7e4749824..30893c7f38 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -1116,6 +1116,7 @@ struct mlx5_dev_ctx_shared {
        uint32_t qp_ts_format:2; /* QP timestamp formats supported. */
        uint32_t meter_aso_en:1; /* Flow Meter ASO is supported. */
        uint32_t ct_aso_en:1; /* Connection Tracking ASO is supported. */
+       uint32_t reclaim_mode:1; /* Reclaim memory. */
        uint32_t max_port; /* Maximal IB device port index. */
        struct mlx5_bond_info bond; /* Bonding information. */
        void *ctx; /* Verbs/DV/DevX context. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index e39fe43854..739c387c0a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5361,7 +5361,8 @@ flow_dv_modify_ipool_get(struct mlx5_dev_ctx_shared *sh, 
uint8_t index)
                       .grow_trunk = 3,
                       .grow_shift = 2,
                       .need_lock = 1,
-                      .release_mem_en = 1,
+                      .release_mem_en = !!sh->reclaim_mode,
+                      .per_core_cache = sh->reclaim_mode ? 0 : (1 << 16),
                       .malloc = mlx5_malloc,
                       .free = mlx5_free,
                       .type = "mlx5_modify_action_resource",
-- 
2.25.1

Reply via email to