net/mlx5: Query to see if host PF is disabled

The host PF can be disabled, query firmware to check if the host PF of
this function exists.

Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: William Tu <witu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1755112796-467444-2-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Daniel Jurgens
2025-08-13 22:19:55 +03:00
committed by Jakub Kicinski
parent d0f110773d
commit 9e84de72ae
2 changed files with 24 additions and 0 deletions

View File

@@ -1038,6 +1038,25 @@ const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
return ERR_PTR(err);
}
static int mlx5_esw_host_functions_enabled_query(struct mlx5_eswitch *esw)
{
const u32 *query_host_out;
if (!mlx5_core_is_ecpf_esw_manager(esw->dev))
return 0;
query_host_out = mlx5_esw_query_functions(esw->dev);
if (IS_ERR(query_host_out))
return PTR_ERR(query_host_out);
esw->esw_funcs.host_funcs_disabled =
MLX5_GET(query_esw_functions_out, query_host_out,
host_params_context.host_pf_not_exist);
kvfree(query_host_out);
return 0;
}
static void mlx5_eswitch_event_handler_register(struct mlx5_eswitch *esw)
{
if (esw->mode == MLX5_ESWITCH_OFFLOADS && mlx5_eswitch_is_funcs_handler(esw->dev)) {
@@ -1874,6 +1893,10 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
goto abort;
}
err = mlx5_esw_host_functions_enabled_query(esw);
if (err)
goto abort;
err = mlx5_esw_vports_init(esw);
if (err)
goto abort;

View File

@@ -323,6 +323,7 @@ struct mlx5_host_work {
struct mlx5_esw_functions {
struct mlx5_nb nb;
bool host_funcs_disabled;
u16 num_vfs;
u16 num_ec_vfs;
};