]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: wire frag buf pools lifecycle hooks
authorNimrod Oren <noren@nvidia.com>
Wed, 29 Apr 2026 20:14:27 +0000 (23:14 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 2 May 2026 02:02:07 +0000 (19:02 -0700)
Wire mlx5_frag_buf pools init/cleanup hooks into
mlx5_mdev_init()/uninit() and the init unwind path.

Keep temporary no-op stubs in alloc.c so lifecycle ordering is in place
before the coherent DMA sub-page allocator implementation is added in
follow-up patches.

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

index 202feab1558a30c93587ed633cbbc3d5773440a2..cebb3559d2c9bfd32bde2006ed86ba56dda256a8 100644 (file)
@@ -71,6 +71,17 @@ static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev,
        return cpu_handle;
 }
 
+/* Implemented later in the series */
+void mlx5_frag_buf_pools_cleanup(struct mlx5_core_dev *dev)
+{
+}
+
+/* Implemented later in the series */
+int mlx5_frag_buf_pools_init(struct mlx5_core_dev *dev)
+{
+       return 0;
+}
+
 int mlx5_frag_buf_alloc_node(struct mlx5_core_dev *dev, int size,
                             struct mlx5_frag_buf *buf, int node)
 {
index 74827e8ca12555869b191c5d728e2b7a9db549b9..b1b9ebfd38660e48f0eb0121d301ad20a65b5e05 100644 (file)
@@ -1817,6 +1817,10 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
        priv->dbg.dbg_root = debugfs_create_dir(dev_name(dev->device),
                                                mlx5_debugfs_root);
 
+       err = mlx5_frag_buf_pools_init(dev);
+       if (err)
+               goto err_frag_buf_pools_init;
+
        INIT_LIST_HEAD(&priv->traps);
 
        err = mlx5_cmd_init(dev);
@@ -1878,6 +1882,8 @@ err_health_init:
 err_timeout_init:
        mlx5_cmd_cleanup(dev);
 err_cmd_init:
+       mlx5_frag_buf_pools_cleanup(dev);
+err_frag_buf_pools_init:
        debugfs_remove(dev->priv.dbg.dbg_root);
        mutex_destroy(&priv->pgdir_mutex);
        mutex_destroy(&priv->alloc_mutex);
@@ -1902,6 +1908,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
        mlx5_health_cleanup(dev);
        mlx5_tout_cleanup(dev);
        mlx5_cmd_cleanup(dev);
+       mlx5_frag_buf_pools_cleanup(dev);
        debugfs_remove_recursive(dev->priv.dbg.dbg_root);
        mutex_destroy(&priv->pgdir_mutex);
        mutex_destroy(&priv->alloc_mutex);
index 1507e881d962ac2676b9f676ac6c488de117bb3d..87f01c4e8d658b7eeb5eca9a0982ae1dc52974fc 100644 (file)
@@ -436,6 +436,8 @@ mlx5_sf_coredev_to_adev(struct mlx5_core_dev *mdev)
 
 int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx);
 void mlx5_mdev_uninit(struct mlx5_core_dev *dev);
+int mlx5_frag_buf_pools_init(struct mlx5_core_dev *dev);
+void mlx5_frag_buf_pools_cleanup(struct mlx5_core_dev *dev);
 int mlx5_init_one(struct mlx5_core_dev *dev);
 int mlx5_init_one_devl_locked(struct mlx5_core_dev *dev);
 void mlx5_uninit_one(struct mlx5_core_dev *dev);