History

net/mlx5: add debugfs stats for doorbell dma pools

Add a debugfs file exposing per-node DMA pool usage for doorbell allocations. # cat /sys/kernel/debug/mlx5/<dev>/db_dma_pools node block_size used_blocks allocated_blocks 0 64 0 0 1 64 0 0

Nimrod Oren committed 3 months ago

Commit b7cfcc91 parent c2923562 files · +28 −0Browse files

Unified · Split

2 files
  1. drivers/net/ethernet/mellanox/mlx5/core/alloc.c +27 −0
  2. include/linux/mlx5/driver.h +1 −0
drivers/net/ethernet/mellanox/mlx5/core/alloc.c+27−0
@@ -437,11 +437,34 @@ void mlx5_frag_buf_free(struct mlx5_core_dev *dev, struct mlx5_frag_buf *buf) · 436 unmodified lines
437}437}
438EXPORT_SYMBOL_GPL(mlx5_frag_buf_free);438EXPORT_SYMBOL_GPL(mlx5_frag_buf_free);
439 439
440static int mlx5_db_dma_pools_debugfs_show(struct seq_file *file, void *priv)
441{
442 struct mlx5_core_dev *dev = file->private;
443 int node;
444
445 mlx5_dma_pools_debugfs_print_header(file);
446
447 for_each_node_state(node, N_POSSIBLE) {
448 struct mlx5_dma_pool *pool = dev->priv.db_node_pools[node];
449
450 if (!pool)
451 continue;
452
453 mlx5_dma_pool_debugfs_stats_print(file, pool);
454 }
455
456 return 0;
457}
458DEFINE_SHOW_ATTRIBUTE(mlx5_db_dma_pools_debugfs);
459
440void mlx5_db_pools_cleanup(struct mlx5_core_dev *dev)460void mlx5_db_pools_cleanup(struct mlx5_core_dev *dev)
441{461{
442 struct mlx5_priv *priv = &dev->priv;462 struct mlx5_priv *priv = &dev->priv;
443 int node;463 int node;
444 464
465 debugfs_remove(priv->dbg.db_dma_pools_debugfs);
466 priv->dbg.db_dma_pools_debugfs = NULL;
467
445 for_each_node_state(node, N_POSSIBLE)468 for_each_node_state(node, N_POSSIBLE)
446 if (priv->db_node_pools[node])469 if (priv->db_node_pools[node])
447 mlx5_dma_pool_destroy(priv->db_node_pools[node]);470 mlx5_dma_pool_destroy(priv->db_node_pools[node]);
@@ -471,6 +494,10 @@ int mlx5_db_pools_init(struct mlx5_core_dev *dev) · 23 unmodified lines
471 priv->db_node_pools[node] = pool;494 priv->db_node_pools[node] = pool;
472 }495 }
473 496
497 priv->dbg.db_dma_pools_debugfs =
498 debugfs_create_file("db_dma_pools", 0444, priv->dbg.dbg_root,
499 dev, &mlx5_db_dma_pools_debugfs_fops);
500
474 return 0;501 return 0;
475}502}
476 503
include/linux/mlx5/driver.h+1−0
@@ -548,6 +548,7 @@ struct mlx5_debugfs_entries { · 547 unmodified lines
548 struct dentry *cq_debugfs;548 struct dentry *cq_debugfs;
549 struct dentry *cmdif_debugfs;549 struct dentry *cmdif_debugfs;
550 struct dentry *frag_buf_dma_pools_debugfs;550 struct dentry *frag_buf_dma_pools_debugfs;
551 struct dentry *db_dma_pools_debugfs;
551 struct dentry *pages_debugfs;552 struct dentry *pages_debugfs;
552 struct dentry *lag_debugfs;553 struct dentry *lag_debugfs;
553};554};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t