net/mlx5: Add SPF function type for page management

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>
This commit is contained in:
Moshe Shemesh 2026-05-21 14:08:43 +03:00 committed by Jakub Kicinski
parent 652be53b37
commit ea0dada719
5 changed files with 14 additions and 0 deletions

View 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,

View 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);

View 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;
}

View 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]);

View 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,