Commit 917d1e79 authored by Hamdan Igbaria's avatar Hamdan Igbaria Committed by Saeed Mahameed

net/mlx5: DR, Change SWS usage to debug fs seq_file interface

In current SWS debug dump mechanism we implement the seq_file interface,
but we only implement the 'show' callback to dump the whole steering DB
with a single call to this callback.

However, for large data size the seq_printf function will fail to
allocate a buffer with the adequate capacity to hold such data.

This patch solves this problem by utilizing the seq_file interface
mechanism in the following way:
 - when the user triggers a dump procedure, we will allocate a list of
   buffers that hold the whole data dump (in the start callback)
 - using the start, next, show and stop callbacks of the seq_file
   API we iterate through the list and dump the whole data
Signed-off-by: default avatarHamdan Igbaria <hamdani@nvidia.com>
Reviewed-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 507472ed
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ /* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
#define MLX5DR_DEBUG_DUMP_BUFF_SIZE (64 * 1024 * 1024)
#define MLX5DR_DEBUG_DUMP_BUFF_LENGTH 512
enum {
MLX5DR_DEBUG_DUMP_STATE_FREE,
MLX5DR_DEBUG_DUMP_STATE_IN_PROGRESS,
};
struct mlx5dr_dbg_dump_buff {
char *buff;
u32 index;
struct list_head node;
};
struct mlx5dr_dbg_dump_data {
struct list_head buff_list;
};
struct mlx5dr_dbg_dump_info { struct mlx5dr_dbg_dump_info {
struct mutex dbg_mutex; /* protect dbg lists */ struct mutex dbg_mutex; /* protect dbg lists */
struct dentry *steering_debugfs; struct dentry *steering_debugfs;
struct dentry *fdb_debugfs; struct dentry *fdb_debugfs;
struct mlx5dr_dbg_dump_data *dump_data;
atomic_t state;
}; };
void mlx5dr_dbg_init_dump(struct mlx5dr_domain *dmn); void mlx5dr_dbg_init_dump(struct mlx5dr_domain *dmn);
......
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