mutex_destroy(&esw->fdb_table.offloads.vports.lock);
}
-static void
-esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, int work_gen,
- const u32 *out)
+static void esw_vfs_changed_event_handler(struct mlx5_eswitch *esw)
{
- struct devlink *devlink;
bool host_pf_disabled;
+ void *host_params;
u16 new_num_vfs;
+ const u32 *out;
- devlink = priv_to_devlink(esw->dev);
- devl_lock(devlink);
-
- /* Stale work from one or more mode changes ago. Bail out. */
- if (work_gen != atomic_read(&esw->esw_funcs.generation))
- goto unlock;
+ out = mlx5_esw_query_functions(esw->dev);
+ if (IS_ERR(out))
+ return;
- new_num_vfs = MLX5_GET(query_esw_functions_out, out,
- host_params_context.host_num_of_vfs);
- host_pf_disabled = MLX5_GET(query_esw_functions_out, out,
- host_params_context.host_pf_disabled);
+ host_params = MLX5_ADDR_OF(query_esw_functions_out, out,
+ net_function_params);
+ new_num_vfs = MLX5_GET(host_params_context, host_params,
+ host_num_of_vfs);
+ host_pf_disabled = MLX5_GET(host_params_context, host_params,
+ host_pf_disabled);
if (new_num_vfs == esw->esw_funcs.num_vfs || host_pf_disabled)
- goto unlock;
+ goto free;
/* Number of VFs can only change from "0 to x" or "x to 0". */
if (esw->esw_funcs.num_vfs > 0) {