aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
diff options
context:
space:
mode:
authorRongwei Liu <rongweil@nvidia.com>2022-01-28 06:12:09 +0200
committerSaeed Mahameed <saeedm@nvidia.com>2022-03-17 11:51:56 -0700
commit5c4f9b6e91e8b3957abe95b18040cc519ce6edc0 (patch)
treebfd108f8c58829ee36123b6ad4b5318d95a5ea93 /drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
parentnet/mlx5: DR, Remove mr_addr rkey from struct mlx5dr_icm_chunk (diff)
downloadlinux-dev-5c4f9b6e91e8b3957abe95b18040cc519ce6edc0.tar.xz
linux-dev-5c4f9b6e91e8b3957abe95b18040cc519ce6edc0.zip
net/mlx5: DR, Remove icm_addr from mlx5dr_icm_chunk to reduce memory
It can be calculated quickly from buddy memory pool by function mlx5dr_icm_pool_get_chunk_icm_addr(). This function is very lightweight and straightforward. Reduce 8 bytes and current size of struct mlx5_dr_icm_chunk is 64 bytes. Signed-off-by: Rongwei Liu <rongweil@nvidia.com> Reviewed-by: Shun Hao <shunh@nvidia.com> Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
index 672d385a8f40..539af89da629 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
@@ -69,6 +69,13 @@ u32 mlx5dr_icm_pool_get_chunk_rkey(struct mlx5dr_icm_chunk *chunk)
return chunk->buddy_mem->icm_mr->mkey;
}
+u64 mlx5dr_icm_pool_get_chunk_icm_addr(struct mlx5dr_icm_chunk *chunk)
+{
+ u32 size = mlx5dr_icm_pool_dm_type_to_entry_size(chunk->buddy_mem->pool->icm_type);
+
+ return (u64)chunk->buddy_mem->icm_mr->icm_start_addr + size * chunk->seg;
+}
+
static struct mlx5dr_icm_mr *
dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool)
{
@@ -310,8 +317,6 @@ dr_icm_chunk_create(struct mlx5dr_icm_pool *pool,
offset = mlx5dr_icm_pool_dm_type_to_entry_size(pool->icm_type) * seg;
- chunk->icm_addr =
- (uintptr_t)buddy_mem_pool->icm_mr->icm_start_addr + offset;
chunk->num_of_entries =
mlx5dr_icm_pool_chunk_size_to_entries(chunk_size);
chunk->byte_size =