Commit 66771a1c authored by Moshe Shemesh's avatar Moshe Shemesh Committed by Saeed Mahameed

net/mlx5: Move debugfs entries to separate struct

Move the debugfs entry pointers under priv to their own struct.
Add get function for device debugfs root.
Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent d2cb8dda
...@@ -433,8 +433,7 @@ void mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u32 port_num) ...@@ -433,8 +433,7 @@ void mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u32 port_num)
dev->port[port_num].dbg_cc_params = dbg_cc_params; dev->port[port_num].dbg_cc_params = dbg_cc_params;
dbg_cc_params->root = debugfs_create_dir("cc_params", dbg_cc_params->root = debugfs_create_dir("cc_params", mlx5_debugfs_get_dev_root(mdev));
mdev->priv.dbg_root);
for (i = 0; i < MLX5_IB_DBG_CC_MAX; i++) { for (i = 0; i < MLX5_IB_DBG_CC_MAX; i++) {
dbg_cc_params->params[i].offset = i; dbg_cc_params->params[i].offset = i;
......
...@@ -4178,7 +4178,7 @@ static int mlx5_ib_stage_delay_drop_init(struct mlx5_ib_dev *dev) ...@@ -4178,7 +4178,7 @@ static int mlx5_ib_stage_delay_drop_init(struct mlx5_ib_dev *dev)
if (!mlx5_debugfs_root) if (!mlx5_debugfs_root)
return 0; return 0;
root = debugfs_create_dir("delay_drop", dev->mdev->priv.dbg_root); root = debugfs_create_dir("delay_drop", mlx5_debugfs_get_dev_root(dev->mdev));
dev->delay_drop.dir_debugfs = root; dev->delay_drop.dir_debugfs = root;
debugfs_create_atomic_t("num_timeout_events", 0400, root, debugfs_create_atomic_t("num_timeout_events", 0400, root,
......
...@@ -696,7 +696,7 @@ static void mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev) ...@@ -696,7 +696,7 @@ static void mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev)
if (!mlx5_debugfs_root || dev->is_rep) if (!mlx5_debugfs_root || dev->is_rep)
return; return;
cache->root = debugfs_create_dir("mr_cache", dev->mdev->priv.dbg_root); cache->root = debugfs_create_dir("mr_cache", mlx5_debugfs_get_dev_root(dev->mdev));
for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) { for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
ent = &cache->ent[i]; ent = &cache->ent[i];
......
...@@ -1543,7 +1543,7 @@ static void create_debugfs_files(struct mlx5_core_dev *dev) ...@@ -1543,7 +1543,7 @@ static void create_debugfs_files(struct mlx5_core_dev *dev)
{ {
struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
dbg->dbg_root = debugfs_create_dir("cmd", dev->priv.dbg_root); dbg->dbg_root = debugfs_create_dir("cmd", mlx5_debugfs_get_dev_root(dev));
debugfs_create_file("in", 0400, dbg->dbg_root, dev, &dfops); debugfs_create_file("in", 0400, dbg->dbg_root, dev, &dfops);
debugfs_create_file("out", 0200, dbg->dbg_root, dev, &dfops); debugfs_create_file("out", 0200, dbg->dbg_root, dev, &dfops);
......
...@@ -99,26 +99,32 @@ void mlx5_unregister_debugfs(void) ...@@ -99,26 +99,32 @@ void mlx5_unregister_debugfs(void)
debugfs_remove(mlx5_debugfs_root); debugfs_remove(mlx5_debugfs_root);
} }
struct dentry *mlx5_debugfs_get_dev_root(struct mlx5_core_dev *dev)
{
return dev->priv.dbg.dbg_root;
}
EXPORT_SYMBOL(mlx5_debugfs_get_dev_root);
void mlx5_qp_debugfs_init(struct mlx5_core_dev *dev) void mlx5_qp_debugfs_init(struct mlx5_core_dev *dev)
{ {
dev->priv.qp_debugfs = debugfs_create_dir("QPs", dev->priv.dbg_root); dev->priv.dbg.qp_debugfs = debugfs_create_dir("QPs", dev->priv.dbg.dbg_root);
} }
EXPORT_SYMBOL(mlx5_qp_debugfs_init); EXPORT_SYMBOL(mlx5_qp_debugfs_init);
void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev) void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev)
{ {
debugfs_remove_recursive(dev->priv.qp_debugfs); debugfs_remove_recursive(dev->priv.dbg.qp_debugfs);
} }
EXPORT_SYMBOL(mlx5_qp_debugfs_cleanup); EXPORT_SYMBOL(mlx5_qp_debugfs_cleanup);
void mlx5_eq_debugfs_init(struct mlx5_core_dev *dev) void mlx5_eq_debugfs_init(struct mlx5_core_dev *dev)
{ {
dev->priv.eq_debugfs = debugfs_create_dir("EQs", dev->priv.dbg_root); dev->priv.dbg.eq_debugfs = debugfs_create_dir("EQs", dev->priv.dbg.dbg_root);
} }
void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev) void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev)
{ {
debugfs_remove_recursive(dev->priv.eq_debugfs); debugfs_remove_recursive(dev->priv.dbg.eq_debugfs);
} }
static ssize_t average_read(struct file *filp, char __user *buf, size_t count, static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
...@@ -168,8 +174,8 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev) ...@@ -168,8 +174,8 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev)
const char *namep; const char *namep;
int i; int i;
cmd = &dev->priv.cmdif_debugfs; cmd = &dev->priv.dbg.cmdif_debugfs;
*cmd = debugfs_create_dir("commands", dev->priv.dbg_root); *cmd = debugfs_create_dir("commands", dev->priv.dbg.dbg_root);
for (i = 0; i < MLX5_CMD_OP_MAX; i++) { for (i = 0; i < MLX5_CMD_OP_MAX; i++) {
stats = &dev->cmd.stats[i]; stats = &dev->cmd.stats[i];
...@@ -193,17 +199,17 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev) ...@@ -193,17 +199,17 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev)
void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev) void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev)
{ {
debugfs_remove_recursive(dev->priv.cmdif_debugfs); debugfs_remove_recursive(dev->priv.dbg.cmdif_debugfs);
} }
void mlx5_cq_debugfs_init(struct mlx5_core_dev *dev) void mlx5_cq_debugfs_init(struct mlx5_core_dev *dev)
{ {
dev->priv.cq_debugfs = debugfs_create_dir("CQs", dev->priv.dbg_root); dev->priv.dbg.cq_debugfs = debugfs_create_dir("CQs", dev->priv.dbg.dbg_root);
} }
void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev) void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev)
{ {
debugfs_remove_recursive(dev->priv.cq_debugfs); debugfs_remove_recursive(dev->priv.dbg.cq_debugfs);
} }
static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp, static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
...@@ -448,7 +454,7 @@ int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp) ...@@ -448,7 +454,7 @@ int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp)
if (!mlx5_debugfs_root) if (!mlx5_debugfs_root)
return 0; return 0;
err = add_res_tree(dev, MLX5_DBG_RSC_QP, dev->priv.qp_debugfs, err = add_res_tree(dev, MLX5_DBG_RSC_QP, dev->priv.dbg.qp_debugfs,
&qp->dbg, qp->qpn, qp_fields, &qp->dbg, qp->qpn, qp_fields,
ARRAY_SIZE(qp_fields), qp); ARRAY_SIZE(qp_fields), qp);
if (err) if (err)
...@@ -475,7 +481,7 @@ int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq) ...@@ -475,7 +481,7 @@ int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
if (!mlx5_debugfs_root) if (!mlx5_debugfs_root)
return 0; return 0;
err = add_res_tree(dev, MLX5_DBG_RSC_EQ, dev->priv.eq_debugfs, err = add_res_tree(dev, MLX5_DBG_RSC_EQ, dev->priv.dbg.eq_debugfs,
&eq->dbg, eq->eqn, eq_fields, &eq->dbg, eq->eqn, eq_fields,
ARRAY_SIZE(eq_fields), eq); ARRAY_SIZE(eq_fields), eq);
if (err) if (err)
...@@ -500,7 +506,7 @@ int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) ...@@ -500,7 +506,7 @@ int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)
if (!mlx5_debugfs_root) if (!mlx5_debugfs_root)
return 0; return 0;
err = add_res_tree(dev, MLX5_DBG_RSC_CQ, dev->priv.cq_debugfs, err = add_res_tree(dev, MLX5_DBG_RSC_CQ, dev->priv.dbg.cq_debugfs,
&cq->dbg, cq->cqn, cq_fields, &cq->dbg, cq->cqn, cq_fields,
ARRAY_SIZE(cq_fields), cq); ARRAY_SIZE(cq_fields), cq);
if (err) if (err)
......
...@@ -1487,7 +1487,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) ...@@ -1487,7 +1487,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
INIT_LIST_HEAD(&priv->pgdir_list); INIT_LIST_HEAD(&priv->pgdir_list);
priv->numa_node = dev_to_node(mlx5_core_dma_dev(dev)); priv->numa_node = dev_to_node(mlx5_core_dma_dev(dev));
priv->dbg_root = debugfs_create_dir(dev_name(dev->device), priv->dbg.dbg_root = debugfs_create_dir(dev_name(dev->device),
mlx5_debugfs_root); mlx5_debugfs_root);
INIT_LIST_HEAD(&priv->traps); INIT_LIST_HEAD(&priv->traps);
...@@ -1524,7 +1524,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) ...@@ -1524,7 +1524,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
err_health_init: err_health_init:
mlx5_tout_cleanup(dev); mlx5_tout_cleanup(dev);
err_timeout_init: err_timeout_init:
debugfs_remove(dev->priv.dbg_root); debugfs_remove(dev->priv.dbg.dbg_root);
mutex_destroy(&priv->pgdir_mutex); mutex_destroy(&priv->pgdir_mutex);
mutex_destroy(&priv->alloc_mutex); mutex_destroy(&priv->alloc_mutex);
mutex_destroy(&priv->bfregs.wc_head.lock); mutex_destroy(&priv->bfregs.wc_head.lock);
...@@ -1542,7 +1542,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev) ...@@ -1542,7 +1542,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
mlx5_pagealloc_cleanup(dev); mlx5_pagealloc_cleanup(dev);
mlx5_health_cleanup(dev); mlx5_health_cleanup(dev);
mlx5_tout_cleanup(dev); mlx5_tout_cleanup(dev);
debugfs_remove_recursive(dev->priv.dbg_root); debugfs_remove_recursive(dev->priv.dbg.dbg_root);
mutex_destroy(&priv->pgdir_mutex); mutex_destroy(&priv->pgdir_mutex);
mutex_destroy(&priv->alloc_mutex); mutex_destroy(&priv->alloc_mutex);
mutex_destroy(&priv->bfregs.wc_head.lock); mutex_destroy(&priv->bfregs.wc_head.lock);
......
...@@ -630,7 +630,7 @@ void mlx5dr_dbg_init_dump(struct mlx5dr_domain *dmn) ...@@ -630,7 +630,7 @@ void mlx5dr_dbg_init_dump(struct mlx5dr_domain *dmn)
} }
dmn->dump_info.steering_debugfs = dmn->dump_info.steering_debugfs =
debugfs_create_dir("steering", dev->priv.dbg_root); debugfs_create_dir("steering", mlx5_debugfs_get_dev_root(dev));
dmn->dump_info.fdb_debugfs = dmn->dump_info.fdb_debugfs =
debugfs_create_dir("fdb", dmn->dump_info.steering_debugfs); debugfs_create_dir("fdb", dmn->dump_info.steering_debugfs);
......
...@@ -551,6 +551,14 @@ struct mlx5_adev { ...@@ -551,6 +551,14 @@ struct mlx5_adev {
int idx; int idx;
}; };
struct mlx5_debugfs_entries {
struct dentry *dbg_root;
struct dentry *qp_debugfs;
struct dentry *eq_debugfs;
struct dentry *cq_debugfs;
struct dentry *cmdif_debugfs;
};
struct mlx5_ft_pool; struct mlx5_ft_pool;
struct mlx5_priv { struct mlx5_priv {
/* IRQ table valid only for real pci devices PF or VF */ /* IRQ table valid only for real pci devices PF or VF */
...@@ -570,12 +578,7 @@ struct mlx5_priv { ...@@ -570,12 +578,7 @@ struct mlx5_priv {
struct mlx5_core_health health; struct mlx5_core_health health;
struct list_head traps; struct list_head traps;
/* start: qp staff */ struct mlx5_debugfs_entries dbg;
struct dentry *qp_debugfs;
struct dentry *eq_debugfs;
struct dentry *cq_debugfs;
struct dentry *cmdif_debugfs;
/* end: qp staff */
/* start: alloc staff */ /* start: alloc staff */
/* protect buffer allocation according to numa node */ /* protect buffer allocation according to numa node */
...@@ -585,7 +588,6 @@ struct mlx5_priv { ...@@ -585,7 +588,6 @@ struct mlx5_priv {
struct mutex pgdir_mutex; struct mutex pgdir_mutex;
struct list_head pgdir_list; struct list_head pgdir_list;
/* end: alloc staff */ /* end: alloc staff */
struct dentry *dbg_root;
struct list_head ctx_list; struct list_head ctx_list;
spinlock_t ctx_lock; spinlock_t ctx_lock;
...@@ -1038,6 +1040,7 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn); ...@@ -1038,6 +1040,7 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn);
int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
struct dentry *mlx5_debugfs_get_dev_root(struct mlx5_core_dev *dev);
void mlx5_qp_debugfs_init(struct mlx5_core_dev *dev); void mlx5_qp_debugfs_init(struct mlx5_core_dev *dev);
void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev); void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
int mlx5_access_reg(struct mlx5_core_dev *dev, void *data_in, int size_in, int mlx5_access_reg(struct mlx5_core_dev *dev, void *data_in, int size_in,
......
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