]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/mlx5: use internal dma pools for frag buf alloc
authorNimrod Oren <noren@nvidia.com>
Wed, 29 Apr 2026 20:14:29 +0000 (23:14 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 2 May 2026 02:02:07 +0000 (19:02 -0700)
commitfbf6f64a4322cfeb0d98f39baf8ce18246dd12c0
tree944eb2ffb7b2b7077f9aa8fb5976f2adbebe0127
parent3b16155425af46ac89c6cc676db0ca1ec4c4ab85
net/mlx5: use internal dma pools for frag buf alloc

Add mlx5_dma_pool alloc/free paths, and wire mlx5_frag_buf allocation
and free paths to use them.

mlx5_frag_buf_alloc_node() now selects an mlx5_dma_pool to allocate
fragments from, instead of directly allocating full coherent pages.

mlx5_frag_buf_free() frees from the respective pool.

mlx5_dma_pool_alloc() keeps allocation fast by maintaining pages with
available indexes at the head of the list, so the common allocation path
can take a free index immediately. New backing pages are allocated only
when no free index is available.

mlx5_dma_pool_free() returns released indexes to the pool and frees a
backing page once all of its indexes become free. This avoids keeping
fully free pages for the lifetime of the pool and reduces coherent DMA
memory footprint.

Signed-off-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260429201429.223809-4-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/alloc.c
include/linux/mlx5/driver.h