]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: Add SPF function type for page management
authorMoshe Shemesh <moshe@nvidia.com>
Thu, 21 May 2026 11:08:43 +0000 (14:08 +0300)
committerJakub Kicinski <kuba@kernel.org>
Mon, 25 May 2026 20:48:51 +0000 (13:48 -0700)
Add MLX5_SPF to enum mlx5_func_type so SPFs get their own page counter,
and add the corresponding WARN check at page cleanup. Wait for SPF pages
to be reclaimed during ECPF teardown, alongside the existing host PF and
VF page waits.

SPF page requests are always identified by vhca_id, so the legacy
func_id_to_type() path is not reached for satellite PFs.

Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260521110843.367329-13-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
drivers/net/ethernet/mellanox/mlx5/core/ecpf.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
include/linux/mlx5/driver.h

index 6347957fefcbe42c7fc36065ff5cfcd838f1d4fe..30be2b631e7c3e99e7160599e05aeedbcb9d1ee9 100644 (file)
@@ -316,6 +316,8 @@ void mlx5_pages_by_func_type_debugfs_init(struct mlx5_core_dev *dev)
                           &dev->priv.page_counters[MLX5_SF]);
        debugfs_create_u32("fw_pages_host_pf", 0400, pages,
                           &dev->priv.page_counters[MLX5_HOST_PF]);
+       debugfs_create_u32("fw_pages_spfs", 0400, pages,
+                          &dev->priv.page_counters[MLX5_SPF]);
 }
 
 void mlx5_pages_by_func_type_debugfs_cleanup(struct mlx5_core_dev *dev)
@@ -329,6 +331,7 @@ void mlx5_pages_by_func_type_debugfs_cleanup(struct mlx5_core_dev *dev)
        debugfs_lookup_and_remove("fw_pages_ec_vfs", pages);
        debugfs_lookup_and_remove("fw_pages_sfs", pages);
        debugfs_lookup_and_remove("fw_pages_host_pf", pages);
+       debugfs_lookup_and_remove("fw_pages_spfs", pages);
 }
 
 static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
index 350c47d3643b9275f8764720a39ea4a76c1e82a9..9839f1a58640ff7f32db747c1002a31f941a9d4f 100644 (file)
@@ -102,6 +102,11 @@ void mlx5_ec_cleanup(struct mlx5_core_dev *dev)
        if (err)
                mlx5_core_warn(dev, "Timeout reclaiming external host PF pages err(%d)\n", err);
 
+       err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_SPF]);
+       if (err)
+               mlx5_core_warn(dev, "Timeout reclaiming SPF pages err(%d)\n",
+                              err);
+
        err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF]);
        if (err)
                mlx5_core_warn(dev, "Timeout reclaiming external host VFs pages err(%d)\n", err);
index bc3c116f5327dc20053ffcf514ac95401fc26401..f8cfbf76dd6a540b0cd9dde638700921595dc0d2 100644 (file)
@@ -863,6 +863,8 @@ esw_vport_to_func_type(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
                return MLX5_SF;
        if (xa_get_mark(&esw->vports, vport_num, MLX5_ESW_VPT_VF))
                return MLX5_VF;
+       if (mlx5_esw_is_spf_vport(esw, vport_num))
+               return MLX5_SPF;
        return MLX5_EC_VF;
 }
 
index ce2f7fa9bd48b5d13b1f7467ea579fabee5f2288..7fef3a7fee6ef7f3e046d8bd9d896c29ba7f1254 100644 (file)
@@ -885,6 +885,9 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev)
        WARN(dev->priv.page_counters[MLX5_HOST_PF],
             "External host PF FW pages counter is %d after reclaiming all pages\n",
             dev->priv.page_counters[MLX5_HOST_PF]);
+       WARN(dev->priv.page_counters[MLX5_SPF],
+            "SPFs FW pages counter is %d after reclaiming all pages\n",
+            dev->priv.page_counters[MLX5_SPF]);
        WARN(dev->priv.page_counters[MLX5_EC_VF],
             "EC VFs FW pages counter is %d after reclaiming all pages\n",
             dev->priv.page_counters[MLX5_EC_VF]);
index 9a4bb25d8e0ab4cea58c041bcfd0fbcfbc05da5f..b1871c0821d0b9ef091b0fa77c6c22343654c1f8 100644 (file)
@@ -557,6 +557,7 @@ enum mlx5_func_type {
        MLX5_VF,
        MLX5_SF,
        MLX5_HOST_PF,
+       MLX5_SPF,
        MLX5_EC_VF,
        MLX5_FUNC_TYPE_NUM,
        MLX5_FUNC_TYPE_NONE = MLX5_FUNC_TYPE_NUM,