Skip to content

Commit 57295e0

Browse files
kliteynSaeed Mahameed
authored andcommitted
net/mlx5: DR, Add memory statistics for domain object
Add counters for number of buddies that are currently in use per domain per buddy type (STE, MODIFY-HEADER, MODIFY-PATTERN). Signed-off-by: Erez Shitrit <erezsh@nvidia.com> Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com> Reviewed-by: Alex Vesker <valex@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent cedb666 commit 57295e0

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,15 +633,18 @@ dr_dump_domain(struct seq_file *file, struct mlx5dr_domain *dmn)
633633
u64 domain_id = DR_DBG_PTR_TO_ID(dmn);
634634
int ret;
635635

636-
seq_printf(file, "%d,0x%llx,%d,0%x,%d,%u.%u.%u,%s,%d\n",
636+
seq_printf(file, "%d,0x%llx,%d,0%x,%d,%u.%u.%u,%s,%d,%u,%u,%u\n",
637637
DR_DUMP_REC_TYPE_DOMAIN,
638638
domain_id, dmn->type, dmn->info.caps.gvmi,
639639
dmn->info.supp_sw_steering,
640640
/* package version */
641641
LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL,
642642
LINUX_VERSION_SUBLEVEL,
643643
pci_name(dmn->mdev->pdev),
644-
0); /* domain flags */
644+
0, /* domain flags */
645+
dmn->num_buddies[DR_ICM_TYPE_STE],
646+
dmn->num_buddies[DR_ICM_TYPE_MODIFY_ACTION],
647+
dmn->num_buddies[DR_ICM_TYPE_MODIFY_HDR_PTRN]);
645648

646649
ret = dr_dump_domain_info(file, &dmn->info, domain_id);
647650
if (ret < 0)

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
288288
/* add it to the -start- of the list in order to search in it first */
289289
list_add(&buddy->list_node, &pool->buddy_mem_list);
290290

291+
pool->dmn->num_buddies[pool->icm_type]++;
292+
291293
return 0;
292294

293295
err_cleanup_buddy:
@@ -301,13 +303,17 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
301303

302304
static void dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy)
303305
{
306+
enum mlx5dr_icm_type icm_type = buddy->pool->icm_type;
307+
304308
dr_icm_pool_mr_destroy(buddy->icm_mr);
305309

306310
mlx5dr_buddy_cleanup(buddy);
307311

308-
if (buddy->pool->icm_type == DR_ICM_TYPE_STE)
312+
if (icm_type == DR_ICM_TYPE_STE)
309313
dr_icm_buddy_cleanup_ste_cache(buddy);
310314

315+
buddy->pool->dmn->num_buddies[icm_type]--;
316+
311317
kvfree(buddy);
312318
}
313319

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ enum mlx5dr_icm_type {
7272
DR_ICM_TYPE_STE,
7373
DR_ICM_TYPE_MODIFY_ACTION,
7474
DR_ICM_TYPE_MODIFY_HDR_PTRN,
75+
DR_ICM_TYPE_MAX,
7576
};
7677

7778
static inline enum mlx5dr_icm_chunk_size
@@ -955,6 +956,8 @@ struct mlx5dr_domain {
955956
struct list_head dbg_tbl_list;
956957
struct mlx5dr_dbg_dump_info dump_info;
957958
struct xarray definers_xa;
959+
/* memory management statistics */
960+
u32 num_buddies[DR_ICM_TYPE_MAX];
958961
};
959962

960963
struct mlx5dr_table_rx_tx {

0 commit comments

Comments
 (0)