Skip to content

Commit 9e84de7

Browse files
danielj-mellanoxkuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: William Tu <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d0f1107 commit 9e84de7

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)) {
@@ -1874,6 +1893,10 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
18741893
goto abort;
18751894
}
18761895

1896+
err = mlx5_esw_host_functions_enabled_query(esw);
1897+
if (err)
1898+
goto abort;
1899+
18771900
err = mlx5_esw_vports_init(esw);
18781901
if (err)
18791902
goto abort;

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

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

324324
struct mlx5_esw_functions {
325325
struct mlx5_nb nb;
326+
bool host_funcs_disabled;
326327
u16 num_vfs;
327328
u16 num_ec_vfs;
328329
};

0 commit comments

Comments
 (0)