From: Leon Romanovsky <leon@kernel.org>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Dragos Tatulea <dtatulea@nvidia.com>,
Gal Pressman <gal@nvidia.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
Mark Bloch <mbloch@nvidia.com>, Nimrod Oren <noren@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH net-next 3/3] net/mlx5: add debugfs stats for doorbell dma pools
Date: Thu, 23 Jul 2026 13:12:55 +0300 [thread overview]
Message-ID: <20260723101255.GG110966@unreal> (raw)
In-Reply-To: <20260723072222.1863558-4-tariqt@nvidia.com>
On Thu, Jul 23, 2026 at 10:22:22AM +0300, Tariq Toukan wrote:
> From: Nimrod Oren <noren@nvidia.com>
>
> 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
>
> Signed-off-by: Nimrod Oren <noren@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
> .../net/ethernet/mellanox/mlx5/core/alloc.c | 30 +++++++++++++++++++
> include/linux/mlx5/driver.h | 1 +
> 2 files changed, 31 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
> index 3975c726d35c..60ff413999f7 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
> @@ -437,11 +437,37 @@ void mlx5_frag_buf_free(struct mlx5_core_dev *dev, struct mlx5_frag_buf *buf)
> }
> EXPORT_SYMBOL_GPL(mlx5_frag_buf_free);
>
> +static int mlx5_db_dma_pools_debugfs_show(struct seq_file *file, void *priv)
> +{
> + struct mlx5_core_dev *dev = file->private;
> + int node;
> +
> + mlx5_dma_pools_debugfs_print_header(file);
> +
> + if (!dev->priv.db_node_pools)
> + return 0;
According to patch #1, this check is useless. You are failing mlx5 probe
function if DMA pools initialization failed.
Thanks
> +
> + for_each_node_state(node, N_POSSIBLE) {
> + struct mlx5_dma_pool *pool = dev->priv.db_node_pools[node];
> +
> + if (!pool)
> + continue;
> +
> + mlx5_dma_pool_debugfs_stats_print(file, pool);
> + }
> +
> + return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(mlx5_db_dma_pools_debugfs);
> +
> void mlx5_db_pools_cleanup(struct mlx5_core_dev *dev)
> {
> struct mlx5_priv *priv = &dev->priv;
> int node;
>
> + debugfs_remove(priv->dbg.db_dma_pools_debugfs);
> + priv->dbg.db_dma_pools_debugfs = NULL;
> +
> for_each_node_state(node, N_POSSIBLE)
> if (priv->db_node_pools[node])
> mlx5_dma_pool_destroy(priv->db_node_pools[node]);
> @@ -471,6 +497,10 @@ int mlx5_db_pools_init(struct mlx5_core_dev *dev)
> priv->db_node_pools[node] = pool;
> }
>
> + priv->dbg.db_dma_pools_debugfs =
> + debugfs_create_file("db_dma_pools", 0444, priv->dbg.dbg_root,
> + dev, &mlx5_db_dma_pools_debugfs_fops);
> +
> return 0;
> }
>
> diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
> index 2c56bb1d676d..83d0a83bbfbc 100644
> --- a/include/linux/mlx5/driver.h
> +++ b/include/linux/mlx5/driver.h
> @@ -548,6 +548,7 @@ struct mlx5_debugfs_entries {
> struct dentry *cq_debugfs;
> struct dentry *cmdif_debugfs;
> struct dentry *frag_buf_dma_pools_debugfs;
> + struct dentry *db_dma_pools_debugfs;
> struct dentry *pages_debugfs;
> struct dentry *lag_debugfs;
> };
> --
> 2.44.0
>
prev parent reply other threads:[~2026-07-23 10:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 7:22 [PATCH net-next 0/3] net/mlx5: allocate doorbells from dma pools Tariq Toukan
2026-07-23 7:22 ` [PATCH net-next 1/3] net/mlx5: initialize doorbell " Tariq Toukan
2026-07-23 7:22 ` [PATCH net-next 2/3] net/mlx5: allocate doorbells from " Tariq Toukan
2026-07-23 7:22 ` [PATCH net-next 3/3] net/mlx5: add debugfs stats for doorbell " Tariq Toukan
2026-07-23 10:12 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723101255.GG110966@unreal \
--to=leon@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.