Skip to content
/ linux Public

Commit 87db2ef

Browse files
danielj-mellanoxgregkh
authored andcommitted
net/mlx5: Query to see if host PF is disabled
[ Upstream commit 9e84de7 ] 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> Stable-dep-of: aed763a ("net/mlx5: Fix deadlock between devlink lock and esw->wq") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0e4dd50 commit 87db2ef

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,25 @@ const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
10381038
return ERR_PTR(err);
10391039
}
10401040

1041+
static int mlx5_esw_host_functions_enabled_query(struct mlx5_eswitch *esw)
1042+
{
1043+
const u32 *query_host_out;
1044+
1045+
if (!mlx5_core_is_ecpf_esw_manager(esw->dev))
1046+
return 0;
1047+
1048+
query_host_out = mlx5_esw_query_functions(esw->dev);
1049+
if (IS_ERR(query_host_out))
1050+
return PTR_ERR(query_host_out);
1051+
1052+
esw->esw_funcs.host_funcs_disabled =
1053+
MLX5_GET(query_esw_functions_out, query_host_out,
1054+
host_params_context.host_pf_not_exist);
1055+
1056+
kvfree(query_host_out);
1057+
return 0;
1058+
}
1059+
10411060
static void mlx5_eswitch_event_handler_register(struct mlx5_eswitch *esw)
10421061
{
10431062
if (esw->mode == MLX5_ESWITCH_OFFLOADS && mlx5_eswitch_is_funcs_handler(esw->dev)) {
@@ -1870,6 +1889,10 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
18701889
goto abort;
18711890
}
18721891

1892+
err = mlx5_esw_host_functions_enabled_query(esw);
1893+
if (err)
1894+
goto abort;
1895+
18731896
err = mlx5_esw_vports_init(esw);
18741897
if (err)
18751898
goto abort;

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ struct mlx5_host_work {
315315

316316
struct mlx5_esw_functions {
317317
struct mlx5_nb nb;
318+
bool host_funcs_disabled;
318319
u16 num_vfs;
319320
u16 num_ec_vfs;
320321
};

0 commit comments

Comments
 (0)