Commit 3e7380bb authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'devlink-prepare-mlxsw-and-netdevsim-for-locked-reload'

Jiri Pirko says:

====================
devlink: prepare mlxsw and netdevsim for locked reload

This is preparation patchset to be able to eventually make a switch and
make reload cmd to take devlink->lock as the other commands do.

This patchset is preparing 2 major users of devlink API - mlxsw and
netdevsim. The sets of functions are similar, therefore taking care of
both here.
====================

Link: https://lore.kernel.org/r/20220716110241.3390528-1-jiri@resnulli.usSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 6e693a10 f655dacb
......@@ -127,7 +127,7 @@ static int mlxsw_core_resources_ports_register(struct mlxsw_core *mlxsw_core)
max_ports, 1,
DEVLINK_RESOURCE_UNIT_ENTRY);
return devlink_resource_register(devlink,
return devl_resource_register(devlink,
DEVLINK_RESOURCE_GENERIC_NAME_PORTS,
max_ports, MLXSW_CORE_RESOURCE_PORTS,
DEVLINK_RESOURCE_ID_PARENT_TOP,
......@@ -157,7 +157,7 @@ static int mlxsw_ports_init(struct mlxsw_core *mlxsw_core, bool reload)
goto err_resources_ports_register;
}
atomic_set(&mlxsw_core->active_ports_count, 0);
devlink_resource_occ_get_register(devlink, MLXSW_CORE_RESOURCE_PORTS,
devl_resource_occ_get_register(devlink, MLXSW_CORE_RESOURCE_PORTS,
mlxsw_ports_occ_get, mlxsw_core);
return 0;
......@@ -171,9 +171,9 @@ static void mlxsw_ports_fini(struct mlxsw_core *mlxsw_core, bool reload)
{
struct devlink *devlink = priv_to_devlink(mlxsw_core);
devlink_resource_occ_get_unregister(devlink, MLXSW_CORE_RESOURCE_PORTS);
devl_resource_occ_get_unregister(devlink, MLXSW_CORE_RESOURCE_PORTS);
if (!reload)
devlink_resources_unregister(priv_to_devlink(mlxsw_core));
devl_resources_unregister(priv_to_devlink(mlxsw_core));
kfree(mlxsw_core->ports);
}
......@@ -1488,7 +1488,9 @@ mlxsw_devlink_core_bus_device_reload_down(struct devlink *devlink,
if (!(mlxsw_core->bus->features & MLXSW_BUS_F_RESET))
return -EOPNOTSUPP;
devl_lock(devlink);
mlxsw_core_bus_device_unregister(mlxsw_core, true);
devl_unlock(devlink);
return 0;
}
......@@ -1498,13 +1500,17 @@ mlxsw_devlink_core_bus_device_reload_up(struct devlink *devlink, enum devlink_re
struct netlink_ext_ack *extack)
{
struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
int err;
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
return mlxsw_core_bus_device_register(mlxsw_core->bus_info,
devl_lock(devlink);
err = mlxsw_core_bus_device_register(mlxsw_core->bus_info,
mlxsw_core->bus,
mlxsw_core->bus_priv, true,
devlink, extack);
devl_unlock(devlink);
return err;
}
static int mlxsw_devlink_flash_update(struct devlink *devlink,
......@@ -2102,6 +2108,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
err = -ENOMEM;
goto err_devlink_alloc;
}
devl_lock(devlink);
}
mlxsw_core = devlink_priv(devlink);
......@@ -2187,6 +2194,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
if (!reload) {
devlink_set_features(devlink, DEVLINK_F_RELOAD);
devl_unlock(devlink);
devlink_register(devlink);
}
return 0;
......@@ -2214,12 +2222,14 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
mlxsw_ports_fini(mlxsw_core, reload);
err_ports_init:
if (!reload)
devlink_resources_unregister(devlink);
devl_resources_unregister(devlink);
err_register_resources:
mlxsw_bus->fini(bus_priv);
err_bus_init:
if (!reload)
if (!reload) {
devl_unlock(devlink);
devlink_free(devlink);
}
err_devlink_alloc:
return err;
}
......@@ -2255,8 +2265,10 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
{
struct devlink *devlink = priv_to_devlink(mlxsw_core);
if (!reload)
if (!reload) {
devlink_unregister(devlink);
devl_lock(devlink);
}
if (devlink_is_reload_failed(devlink)) {
if (!reload)
......@@ -2281,17 +2293,20 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
kfree(mlxsw_core->lag.mapping);
mlxsw_ports_fini(mlxsw_core, reload);
if (!reload)
devlink_resources_unregister(devlink);
devl_resources_unregister(devlink);
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
if (!reload)
if (!reload) {
devlink_free(devlink);
devl_unlock(devlink);
}
return;
reload_fail_deinit:
mlxsw_core_params_unregister(mlxsw_core);
devlink_resources_unregister(devlink);
devl_resources_unregister(devlink);
devlink_free(devlink);
devl_unlock(devlink);
}
EXPORT_SYMBOL(mlxsw_core_bus_device_unregister);
......
......@@ -1999,7 +1999,6 @@ __mlxsw_sp_port_mapping_events_cancel(struct mlxsw_sp *mlxsw_sp)
static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp)
{
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
int i;
for (i = 1; i < max_ports; i++)
......@@ -2007,12 +2006,10 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp)
/* Make sure all scheduled events are processed */
__mlxsw_sp_port_mapping_events_cancel(mlxsw_sp);
devl_lock(devlink);
for (i = 1; i < max_ports; i++)
if (mlxsw_sp_port_created(mlxsw_sp, i))
mlxsw_sp_port_remove(mlxsw_sp, i);
mlxsw_sp_cpu_port_remove(mlxsw_sp);
devl_unlock(devlink);
kfree(mlxsw_sp->ports);
mlxsw_sp->ports = NULL;
}
......@@ -2034,7 +2031,6 @@ mlxsw_sp_ports_remove_selected(struct mlxsw_core *mlxsw_core,
static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
{
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
struct mlxsw_sp_port_mapping_events *events;
struct mlxsw_sp_port_mapping *port_mapping;
size_t alloc_size;
......@@ -2057,7 +2053,6 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
goto err_event_enable;
}
devl_lock(devlink);
err = mlxsw_sp_cpu_port_create(mlxsw_sp);
if (err)
goto err_cpu_port_create;
......@@ -2070,7 +2065,6 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
if (err)
goto err_port_create;
}
devl_unlock(devlink);
return 0;
err_port_create:
......@@ -2080,7 +2074,6 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
i = max_ports;
mlxsw_sp_cpu_port_remove(mlxsw_sp);
err_cpu_port_create:
devl_unlock(devlink);
err_event_enable:
for (i--; i >= 1; i--)
mlxsw_sp_port_mapping_event_set(mlxsw_sp, i, false);
......@@ -3477,7 +3470,7 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core)
&hash_single_size_params);
kvd_size = MLXSW_CORE_RES_GET(mlxsw_core, KVD_SIZE);
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
kvd_size, MLXSW_SP_RESOURCE_KVD,
DEVLINK_RESOURCE_ID_PARENT_TOP,
&kvd_size_params);
......@@ -3485,7 +3478,7 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core)
return err;
linear_size = profile->kvd_linear_size;
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR,
linear_size,
MLXSW_SP_RESOURCE_KVD_LINEAR,
MLXSW_SP_RESOURCE_KVD,
......@@ -3502,7 +3495,7 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core)
double_size /= profile->kvd_hash_double_parts +
profile->kvd_hash_single_parts;
double_size = rounddown(double_size, MLXSW_SP_KVD_GRANULARITY);
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_HASH_DOUBLE,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_HASH_DOUBLE,
double_size,
MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE,
MLXSW_SP_RESOURCE_KVD,
......@@ -3511,7 +3504,7 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core)
return err;
single_size = kvd_size - double_size - linear_size;
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE,
single_size,
MLXSW_SP_RESOURCE_KVD_HASH_SINGLE,
MLXSW_SP_RESOURCE_KVD,
......@@ -3536,7 +3529,7 @@ static int mlxsw_sp2_resources_kvd_register(struct mlxsw_core *mlxsw_core)
MLXSW_SP_KVD_GRANULARITY,
DEVLINK_RESOURCE_UNIT_ENTRY);
return devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
return devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
kvd_size, MLXSW_SP_RESOURCE_KVD,
DEVLINK_RESOURCE_ID_PARENT_TOP,
&kvd_size_params);
......@@ -3555,7 +3548,7 @@ static int mlxsw_sp_resources_span_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&span_size_params, max_span, max_span,
1, DEVLINK_RESOURCE_UNIT_ENTRY);
return devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_SPAN,
return devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_SPAN,
max_span, MLXSW_SP_RESOURCE_SPAN,
DEVLINK_RESOURCE_ID_PARENT_TOP,
&span_size_params);
......@@ -3577,7 +3570,7 @@ mlxsw_sp_resources_rif_mac_profile_register(struct mlxsw_core *mlxsw_core)
max_rif_mac_profiles, 1,
DEVLINK_RESOURCE_UNIT_ENTRY);
return devlink_resource_register(devlink,
return devl_resource_register(devlink,
"rif_mac_profiles",
max_rif_mac_profiles,
MLXSW_SP_RESOURCE_RIF_MAC_PROFILES,
......@@ -3598,7 +3591,7 @@ static int mlxsw_sp_resources_rifs_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, max_rifs, max_rifs,
1, DEVLINK_RESOURCE_UNIT_ENTRY);
return devlink_resource_register(devlink, "rifs", max_rifs,
return devl_resource_register(devlink, "rifs", max_rifs,
MLXSW_SP_RESOURCE_RIFS,
DEVLINK_RESOURCE_ID_PARENT_TOP,
&size_params);
......@@ -3639,7 +3632,7 @@ static int mlxsw_sp1_resources_register(struct mlxsw_core *mlxsw_core)
err_policer_resources_register:
err_resources_counter_register:
err_resources_span_register:
devlink_resources_unregister(priv_to_devlink(mlxsw_core));
devl_resources_unregister(priv_to_devlink(mlxsw_core));
return err;
}
......@@ -3678,7 +3671,7 @@ static int mlxsw_sp2_resources_register(struct mlxsw_core *mlxsw_core)
err_policer_resources_register:
err_resources_counter_register:
err_resources_span_register:
devlink_resources_unregister(priv_to_devlink(mlxsw_core));
devl_resources_unregister(priv_to_devlink(mlxsw_core));
return err;
}
......@@ -3702,13 +3695,13 @@ static int mlxsw_sp_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
* granularity from the profile. In case the user
* provided the sizes they are obtained via devlink.
*/
err = devlink_resource_size_get(devlink,
err = devl_resource_size_get(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR,
p_linear_size);
if (err)
*p_linear_size = profile->kvd_linear_size;
err = devlink_resource_size_get(devlink,
err = devl_resource_size_get(devlink,
MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE,
p_double_size);
if (err) {
......@@ -3721,7 +3714,7 @@ static int mlxsw_sp_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
MLXSW_SP_KVD_GRANULARITY);
}
err = devlink_resource_size_get(devlink,
err = devl_resource_size_get(devlink,
MLXSW_SP_RESOURCE_KVD_HASH_SINGLE,
p_single_size);
if (err)
......
......@@ -216,7 +216,7 @@ mlxsw_sp1_kvdl_part_init(struct mlxsw_sp *mlxsw_sp,
u64 resource_size;
int err;
err = devlink_resource_size_get(devlink, info->resource_id,
err = devl_resource_size_get(devlink, info->resource_id,
&resource_size);
if (err) {
need_update = false;
......@@ -338,19 +338,19 @@ static int mlxsw_sp1_kvdl_init(struct mlxsw_sp *mlxsw_sp, void *priv)
err = mlxsw_sp1_kvdl_parts_init(mlxsw_sp, kvdl);
if (err)
return err;
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR,
mlxsw_sp1_kvdl_occ_get,
kvdl);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE,
mlxsw_sp1_kvdl_single_occ_get,
kvdl);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS,
mlxsw_sp1_kvdl_chunks_occ_get,
kvdl);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS,
mlxsw_sp1_kvdl_large_chunks_occ_get,
kvdl);
......@@ -362,13 +362,13 @@ static void mlxsw_sp1_kvdl_fini(struct mlxsw_sp *mlxsw_sp, void *priv)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
struct mlxsw_sp1_kvdl *kvdl = priv;
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_KVD_LINEAR);
mlxsw_sp1_kvdl_parts_fini(kvdl);
}
......@@ -396,7 +396,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, 0, kvdl_max_size,
MLXSW_SP1_KVDL_SINGLE_ALLOC_SIZE,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_SINGLES,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_SINGLES,
MLXSW_SP1_KVDL_SINGLE_SIZE,
MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE,
MLXSW_SP_RESOURCE_KVD_LINEAR,
......@@ -407,7 +407,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, 0, kvdl_max_size,
MLXSW_SP1_KVDL_CHUNKS_ALLOC_SIZE,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_CHUNKS,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_CHUNKS,
MLXSW_SP1_KVDL_CHUNKS_SIZE,
MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS,
MLXSW_SP_RESOURCE_KVD_LINEAR,
......@@ -418,7 +418,7 @@ int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, 0, kvdl_max_size,
MLXSW_SP1_KVDL_LARGE_CHUNKS_ALLOC_SIZE,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_LARGE_CHUNKS,
err = devl_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_LARGE_CHUNKS,
MLXSW_SP1_KVDL_LARGE_CHUNKS_SIZE,
MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS,
MLXSW_SP_RESOURCE_KVD_LINEAR,
......
......@@ -1290,7 +1290,7 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
if (err)
goto err_sb_mms_init;
mlxsw_sp_pool_count(mlxsw_sp, &ing_pool_count, &eg_pool_count);
err = devlink_sb_register(priv_to_devlink(mlxsw_sp->core), 0,
err = devl_sb_register(priv_to_devlink(mlxsw_sp->core), 0,
mlxsw_sp->sb->sb_size,
ing_pool_count,
eg_pool_count,
......@@ -1314,7 +1314,7 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp)
{
devlink_sb_unregister(priv_to_devlink(mlxsw_sp->core), 0);
devl_sb_unregister(priv_to_devlink(mlxsw_sp->core), 0);
mlxsw_sp_sb_ports_fini(mlxsw_sp);
kfree(mlxsw_sp->sb);
}
......
......@@ -67,13 +67,13 @@ static int mlxsw_sp_counter_sub_pools_init(struct mlxsw_sp *mlxsw_sp)
return -EIO;
sub_pool->entry_size = mlxsw_core_res_get(mlxsw_sp->core,
res_id);
err = devlink_resource_size_get(devlink,
err = devl_resource_size_get(devlink,
sub_pool->resource_id,
&sub_pool->size);
if (err)
goto err_resource_size_get;
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
sub_pool->resource_id,
mlxsw_sp_counter_sub_pool_occ_get,
sub_pool);
......@@ -88,7 +88,7 @@ static int mlxsw_sp_counter_sub_pools_init(struct mlxsw_sp *mlxsw_sp)
for (i--; i >= 0; i--) {
sub_pool = &pool->sub_pools[i];
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
sub_pool->resource_id);
}
return err;
......@@ -105,7 +105,7 @@ static void mlxsw_sp_counter_sub_pools_fini(struct mlxsw_sp *mlxsw_sp)
sub_pool = &pool->sub_pools[i];
WARN_ON(atomic_read(&sub_pool->active_entries_count));
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
sub_pool->resource_id);
}
}
......@@ -135,11 +135,11 @@ int mlxsw_sp_counter_pool_init(struct mlxsw_sp *mlxsw_sp)
spin_lock_init(&pool->counter_pool_lock);
atomic_set(&pool->active_entries_count, 0);
err = devlink_resource_size_get(devlink, MLXSW_SP_RESOURCE_COUNTERS,
err = devl_resource_size_get(devlink, MLXSW_SP_RESOURCE_COUNTERS,
&pool->pool_size);
if (err)
goto err_pool_resource_size_get;
devlink_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_COUNTERS,
devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_COUNTERS,
mlxsw_sp_counter_pool_occ_get, pool);
pool->usage = bitmap_zalloc(pool->pool_size, GFP_KERNEL);
......@@ -157,7 +157,7 @@ int mlxsw_sp_counter_pool_init(struct mlxsw_sp *mlxsw_sp)
err_sub_pools_init:
bitmap_free(pool->usage);
err_usage_alloc:
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_COUNTERS);
err_pool_resource_size_get:
kfree(pool);
......@@ -174,7 +174,7 @@ void mlxsw_sp_counter_pool_fini(struct mlxsw_sp *mlxsw_sp)
pool->pool_size);
WARN_ON(atomic_read(&pool->active_entries_count));
bitmap_free(pool->usage);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_COUNTERS);
kfree(pool);
}
......@@ -262,7 +262,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, pool_size,
pool_size, bank_size,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink,
err = devl_resource_register(devlink,
MLXSW_SP_RESOURCE_NAME_COUNTERS,
pool_size,
MLXSW_SP_RESOURCE_COUNTERS,
......@@ -287,7 +287,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, sub_pool_size,
sub_pool_size, bank_size,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink,
err = devl_resource_register(devlink,
sub_pool->resource_name,
sub_pool_size,
sub_pool->resource_id,
......
......@@ -295,7 +295,7 @@ static int mlxsw_sp_dpipe_erif_table_init(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
return devlink_dpipe_table_register(devlink,
return devl_dpipe_table_register(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ERIF,
&mlxsw_sp_erif_ops,
mlxsw_sp, false);
......@@ -305,7 +305,7 @@ static void mlxsw_sp_dpipe_erif_table_fini(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
devlink_dpipe_table_unregister(devlink, MLXSW_SP_DPIPE_TABLE_NAME_ERIF);
devl_dpipe_table_unregister(devlink, MLXSW_SP_DPIPE_TABLE_NAME_ERIF);
}
static int mlxsw_sp_dpipe_table_host_matches_dump(struct sk_buff *skb, int type)
......@@ -749,14 +749,14 @@ static int mlxsw_sp_dpipe_host4_table_init(struct mlxsw_sp *mlxsw_sp)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
int err;
err = devlink_dpipe_table_register(devlink,
err = devl_dpipe_table_register(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST4,
&mlxsw_sp_host4_ops,
mlxsw_sp, false);
if (err)
return err;
err = devlink_dpipe_table_resource_set(devlink,
err = devl_dpipe_table_resource_set(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST4,
MLXSW_SP_RESOURCE_KVD_HASH_SINGLE,
MLXSW_SP_DPIPE_TABLE_RESOURCE_UNIT_HOST4);
......@@ -766,7 +766,7 @@ static int mlxsw_sp_dpipe_host4_table_init(struct mlxsw_sp *mlxsw_sp)
return 0;
err_resource_set:
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST4);
return err;
}
......@@ -775,7 +775,7 @@ static void mlxsw_sp_dpipe_host4_table_fini(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST4);
}
......@@ -826,14 +826,14 @@ static int mlxsw_sp_dpipe_host6_table_init(struct mlxsw_sp *mlxsw_sp)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
int err;
err = devlink_dpipe_table_register(devlink,
err = devl_dpipe_table_register(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6,
&mlxsw_sp_host6_ops,
mlxsw_sp, false);
if (err)
return err;
err = devlink_dpipe_table_resource_set(devlink,
err = devl_dpipe_table_resource_set(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6,
MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE,
MLXSW_SP_DPIPE_TABLE_RESOURCE_UNIT_HOST6);
......@@ -843,7 +843,7 @@ static int mlxsw_sp_dpipe_host6_table_init(struct mlxsw_sp *mlxsw_sp)
return 0;
err_resource_set:
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6);
return err;
}
......@@ -852,7 +852,7 @@ static void mlxsw_sp_dpipe_host6_table_fini(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6);
}
......@@ -1231,14 +1231,14 @@ static int mlxsw_sp_dpipe_adj_table_init(struct mlxsw_sp *mlxsw_sp)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
int err;
err = devlink_dpipe_table_register(devlink,
err = devl_dpipe_table_register(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ADJ,
&mlxsw_sp_dpipe_table_adj_ops,
mlxsw_sp, false);
if (err)
return err;
err = devlink_dpipe_table_resource_set(devlink,
err = devl_dpipe_table_resource_set(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ADJ,
MLXSW_SP_RESOURCE_KVD_LINEAR,
MLXSW_SP_DPIPE_TABLE_RESOURCE_UNIT_ADJ);
......@@ -1248,7 +1248,7 @@ static int mlxsw_sp_dpipe_adj_table_init(struct mlxsw_sp *mlxsw_sp)
return 0;
err_resource_set:
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ADJ);
return err;
}
......@@ -1257,7 +1257,7 @@ static void mlxsw_sp_dpipe_adj_table_fini(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
devlink_dpipe_table_unregister(devlink,
devl_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ADJ);
}
......@@ -1266,7 +1266,7 @@ int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
int err;
devlink_dpipe_headers_register(devlink, &mlxsw_sp_dpipe_headers);
devl_dpipe_headers_register(devlink, &mlxsw_sp_dpipe_headers);
err = mlxsw_sp_dpipe_erif_table_init(mlxsw_sp);
if (err)
......@@ -1292,7 +1292,7 @@ int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp)
err_host4_table_init:
mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp);
err_erif_table_init:
devlink_dpipe_headers_unregister(priv_to_devlink(mlxsw_sp->core));
devl_dpipe_headers_unregister(priv_to_devlink(mlxsw_sp->core));
return err;
}
......@@ -1304,5 +1304,5 @@ void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp)
mlxsw_sp_dpipe_host6_table_fini(mlxsw_sp);
mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp);
mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp);
devlink_dpipe_headers_unregister(devlink);
devl_dpipe_headers_unregister(devlink);
}
......@@ -94,7 +94,7 @@ mlxsw_sp_policer_single_rate_family_init(struct mlxsw_sp_policer_family *family)
atomic_set(&family->policers_count, 0);
devlink = priv_to_devlink(core);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_SINGLE_RATE_POLICERS,
mlxsw_sp_policer_single_rate_occ_get,
family);
......@@ -107,7 +107,7 @@ mlxsw_sp_policer_single_rate_family_fini(struct mlxsw_sp_policer_family *family)
{
struct devlink *devlink = priv_to_devlink(family->mlxsw_sp->core);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_SINGLE_RATE_POLICERS);
WARN_ON(atomic_read(&family->policers_count) != 0);
}
......@@ -419,7 +419,7 @@ int mlxsw_sp_policer_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, global_policers,
global_policers, 1,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink, "global_policers",
err = devl_resource_register(devlink, "global_policers",
global_policers,
MLXSW_SP_RESOURCE_GLOBAL_POLICERS,
DEVLINK_RESOURCE_ID_PARENT_TOP,
......@@ -430,7 +430,7 @@ int mlxsw_sp_policer_resources_register(struct mlxsw_core *mlxsw_core)
devlink_resource_size_params_init(&size_params, single_rate_policers,
single_rate_policers, 1,
DEVLINK_RESOURCE_UNIT_ENTRY);
err = devlink_resource_register(devlink, "single_rate_policers",
err = devl_resource_register(devlink, "single_rate_policers",
single_rate_policers,
MLXSW_SP_RESOURCE_SINGLE_RATE_POLICERS,
MLXSW_SP_RESOURCE_GLOBAL_POLICERS,
......
......@@ -9962,11 +9962,11 @@ static int mlxsw_sp_rifs_init(struct mlxsw_sp *mlxsw_sp)
idr_init(&mlxsw_sp->router->rif_mac_profiles_idr);
atomic_set(&mlxsw_sp->router->rif_mac_profiles_count, 0);
atomic_set(&mlxsw_sp->router->rifs_count, 0);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_RIF_MAC_PROFILES,
mlxsw_sp_rif_mac_profiles_occ_get,
mlxsw_sp);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
MLXSW_SP_RESOURCE_RIFS,
mlxsw_sp_rifs_occ_get,
mlxsw_sp);
......@@ -9983,8 +9983,8 @@ static void mlxsw_sp_rifs_fini(struct mlxsw_sp *mlxsw_sp)
for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++)
WARN_ON_ONCE(mlxsw_sp->router->rifs[i]);
devlink_resource_occ_get_unregister(devlink, MLXSW_SP_RESOURCE_RIFS);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink, MLXSW_SP_RESOURCE_RIFS);
devl_resource_occ_get_unregister(devlink,
MLXSW_SP_RESOURCE_RIF_MAC_PROFILES);
WARN_ON(!idr_is_empty(&mlxsw_sp->router->rif_mac_profiles_idr));
idr_destroy(&mlxsw_sp->router->rif_mac_profiles_idr);
......
......@@ -106,7 +106,7 @@ int mlxsw_sp_span_init(struct mlxsw_sp *mlxsw_sp)
if (err)
goto err_init;
devlink_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_SPAN,
devl_resource_occ_get_register(devlink, MLXSW_SP_RESOURCE_SPAN,
mlxsw_sp_span_occ_get, mlxsw_sp);
INIT_WORK(&span->work, mlxsw_sp_span_respin_work);
......@@ -123,7 +123,7 @@ void mlxsw_sp_span_fini(struct mlxsw_sp *mlxsw_sp)
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
cancel_work_sync(&mlxsw_sp->span->work);
devlink_resource_occ_get_unregister(devlink, MLXSW_SP_RESOURCE_SPAN);
devl_resource_occ_get_unregister(devlink, MLXSW_SP_RESOURCE_SPAN);
WARN_ON_ONCE(!list_empty(&mlxsw_sp->span->trigger_entries_list));
WARN_ON_ONCE(!list_empty(&mlxsw_sp->span->analyzed_ports_list));
......
......@@ -1298,7 +1298,7 @@ static int mlxsw_sp_trap_policers_init(struct mlxsw_sp *mlxsw_sp)
for (i = 0; i < trap->policers_count; i++) {
policer_item = &trap->policer_items_arr[i];
err = devlink_trap_policers_register(devlink,
err = devl_trap_policers_register(devlink,
&policer_item->policer, 1);
if (err)
goto err_trap_policer_register;
......@@ -1309,7 +1309,7 @@ static int mlxsw_sp_trap_policers_init(struct mlxsw_sp *mlxsw_sp)
err_trap_policer_register:
for (i--; i >= 0; i--) {
policer_item = &trap->policer_items_arr[i];
devlink_trap_policers_unregister(devlink,
devl_trap_policers_unregister(devlink,
&policer_item->policer, 1);
}
mlxsw_sp_trap_policer_items_arr_fini(mlxsw_sp);
......@@ -1325,7 +1325,7 @@ static void mlxsw_sp_trap_policers_fini(struct mlxsw_sp *mlxsw_sp)
for (i = trap->policers_count - 1; i >= 0; i--) {
policer_item = &trap->policer_items_arr[i];
devlink_trap_policers_unregister(devlink,
devl_trap_policers_unregister(devlink,
&policer_item->policer, 1);
}
mlxsw_sp_trap_policer_items_arr_fini(mlxsw_sp);
......@@ -1381,8 +1381,7 @@ static int mlxsw_sp_trap_groups_init(struct mlxsw_sp *mlxsw_sp)
for (i = 0; i < trap->groups_count; i++) {
group_item = &trap->group_items_arr[i];
err = devlink_trap_groups_register(devlink, &group_item->group,
1);
err = devl_trap_groups_register(devlink, &group_item->group, 1);
if (err)
goto err_trap_group_register;
}
......@@ -1392,7 +1391,7 @@ static int mlxsw_sp_trap_groups_init(struct mlxsw_sp *mlxsw_sp)
err_trap_group_register:
for (i--; i >= 0; i--) {
group_item = &trap->group_items_arr[i];
devlink_trap_groups_unregister(devlink, &group_item->group, 1);
devl_trap_groups_unregister(devlink, &group_item->group, 1);
}
mlxsw_sp_trap_group_items_arr_fini(mlxsw_sp);
return err;
......@@ -1408,7 +1407,7 @@ static void mlxsw_sp_trap_groups_fini(struct mlxsw_sp *mlxsw_sp)
const struct mlxsw_sp_trap_group_item *group_item;
group_item = &trap->group_items_arr[i];
devlink_trap_groups_unregister(devlink, &group_item->group, 1);
devl_trap_groups_unregister(devlink, &group_item->group, 1);
}
mlxsw_sp_trap_group_items_arr_fini(mlxsw_sp);
}
......@@ -1469,7 +1468,7 @@ static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp)
for (i = 0; i < trap->traps_count; i++) {
trap_item = &trap->trap_items_arr[i];
err = devlink_traps_register(devlink, &trap_item->trap, 1,
err = devl_traps_register(devlink, &trap_item->trap, 1,
mlxsw_sp);
if (err)
goto err_trap_register;
......@@ -1480,7 +1479,7 @@ static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp)
err_trap_register:
for (i--; i >= 0; i--) {
trap_item = &trap->trap_items_arr[i];
devlink_traps_unregister(devlink, &trap_item->trap, 1);
devl_traps_unregister(devlink, &trap_item->trap, 1);
}
mlxsw_sp_trap_items_arr_fini(mlxsw_sp);
return err;
......@@ -1496,7 +1495,7 @@ static void mlxsw_sp_traps_fini(struct mlxsw_sp *mlxsw_sp)
const struct mlxsw_sp_trap_item *trap_item;
trap_item = &trap->trap_items_arr[i];
devlink_traps_unregister(devlink, &trap_item->trap, 1);
devl_traps_unregister(devlink, &trap_item->trap, 1);
}
mlxsw_sp_trap_items_arr_fini(mlxsw_sp);
}
......
......@@ -72,16 +72,7 @@ new_port_store(struct device *dev, struct device_attribute *attr,
if (ret)
return ret;
if (!mutex_trylock(&nsim_bus_dev->nsim_bus_reload_lock))
return -EBUSY;
if (nsim_bus_dev->in_reload) {
mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
return -EBUSY;
}
ret = nsim_drv_port_add(nsim_bus_dev, NSIM_DEV_PORT_TYPE_PF, port_index);
mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
return ret ? ret : count;
}
......@@ -102,16 +93,7 @@ del_port_store(struct device *dev, struct device_attribute *attr,
if (ret)
return ret;
if (!mutex_trylock(&nsim_bus_dev->nsim_bus_reload_lock))
return -EBUSY;
if (nsim_bus_dev->in_reload) {
mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
return -EBUSY;
}
ret = nsim_drv_port_del(nsim_bus_dev, NSIM_DEV_PORT_TYPE_PF, port_index);
mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
return ret ? ret : count;
}
......@@ -298,7 +280,6 @@ nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queu
nsim_bus_dev->num_queues = num_queues;
nsim_bus_dev->initial_net = current->nsproxy->net_ns;
nsim_bus_dev->max_vfs = NSIM_BUS_DEV_MAX_VFS;
mutex_init(&nsim_bus_dev->nsim_bus_reload_lock);
/* Disallow using nsim_bus_dev */
smp_store_release(&nsim_bus_dev->init, false);
......
This diff is collapsed.
......@@ -1453,7 +1453,7 @@ static void nsim_fib_set_max_all(struct nsim_fib_data *data,
int err;
u64 val;
err = devlink_resource_size_get(devlink, res_ids[i], &val);
err = devl_resource_size_get(devlink, res_ids[i], &val);
if (err)
val = (u64) -1;
nsim_fib_set_max(data, res_ids[i], val);
......@@ -1562,23 +1562,23 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
goto err_nexthop_nb_unregister;
}
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
NSIM_RESOURCE_IPV4_FIB,
nsim_fib_ipv4_resource_occ_get,
data);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
NSIM_RESOURCE_IPV4_FIB_RULES,
nsim_fib_ipv4_rules_res_occ_get,
data);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
NSIM_RESOURCE_IPV6_FIB,
nsim_fib_ipv6_resource_occ_get,
data);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
NSIM_RESOURCE_IPV6_FIB_RULES,
nsim_fib_ipv6_rules_res_occ_get,
data);
devlink_resource_occ_get_register(devlink,
devl_resource_occ_get_register(devlink,
NSIM_RESOURCE_NEXTHOPS,
nsim_fib_nexthops_res_occ_get,
data);
......@@ -1604,15 +1604,15 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data)
{
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_NEXTHOPS);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_IPV6_FIB_RULES);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_IPV6_FIB);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_IPV4_FIB_RULES);
devlink_resource_occ_get_unregister(devlink,
devl_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_IPV4_FIB);
unregister_fib_notifier(devlink_net(devlink), &data->fib_nb);
unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb);
......
......@@ -376,9 +376,6 @@ struct nsim_bus_dev {
*/
unsigned int max_vfs;
unsigned int num_vfs;
/* Lock for devlink->reload_enabled in netdevsim module */
struct mutex nsim_bus_reload_lock;
bool in_reload;
bool init;
};
......
......@@ -1517,6 +1517,7 @@ struct device *devlink_to_dev(const struct devlink *devlink);
/* Devlink instance explicit locking */
void devl_lock(struct devlink *devlink);
int devl_trylock(struct devlink *devlink);
void devl_unlock(struct devlink *devlink);
void devl_assert_locked(struct devlink *devlink);
bool devl_lock_is_held(struct devlink *devlink);
......@@ -1579,20 +1580,25 @@ void devlink_linecard_provision_clear(struct devlink_linecard *linecard);
void devlink_linecard_provision_fail(struct devlink_linecard *linecard);
void devlink_linecard_activate(struct devlink_linecard *linecard);
void devlink_linecard_deactivate(struct devlink_linecard *linecard);
int devl_sb_register(struct devlink *devlink, unsigned int sb_index,
u32 size, u16 ingress_pools_count,
u16 egress_pools_count, u16 ingress_tc_count,
u16 egress_tc_count);
int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
u32 size, u16 ingress_pools_count,
u16 egress_pools_count, u16 ingress_tc_count,
u16 egress_tc_count);
void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index);
void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
int devlink_dpipe_table_register(struct devlink *devlink,
int devl_dpipe_table_register(struct devlink *devlink,
const char *table_name,
struct devlink_dpipe_table_ops *table_ops,
void *priv, bool counter_control_extern);
void devlink_dpipe_table_unregister(struct devlink *devlink,
void devl_dpipe_table_unregister(struct devlink *devlink,
const char *table_name);
void devlink_dpipe_headers_register(struct devlink *devlink,
void devl_dpipe_headers_register(struct devlink *devlink,
struct devlink_dpipe_headers *dpipe_headers);
void devlink_dpipe_headers_unregister(struct devlink *devlink);
void devl_dpipe_headers_unregister(struct devlink *devlink);
bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
const char *table_name);
int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
......@@ -1608,23 +1614,40 @@ extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
int devl_resource_register(struct devlink *devlink,
const char *resource_name,
u64 resource_size,
u64 resource_id,
u64 parent_resource_id,
const struct devlink_resource_size_params *size_params);
int devlink_resource_register(struct devlink *devlink,
const char *resource_name,
u64 resource_size,
u64 resource_id,
u64 parent_resource_id,
const struct devlink_resource_size_params *size_params);
void devl_resources_unregister(struct devlink *devlink);
void devlink_resources_unregister(struct devlink *devlink);
int devlink_resource_size_get(struct devlink *devlink,
int devl_resource_size_get(struct devlink *devlink,
u64 resource_id,
u64 *p_resource_size);
int devl_dpipe_table_resource_set(struct devlink *devlink,
const char *table_name, u64 resource_id,
u64 resource_units);
int devlink_dpipe_table_resource_set(struct devlink *devlink,
const char *table_name, u64 resource_id,
u64 resource_units);
void devl_resource_occ_get_register(struct devlink *devlink,
u64 resource_id,
devlink_resource_occ_get_t *occ_get,
void *occ_get_priv);
void devlink_resource_occ_get_register(struct devlink *devlink,
u64 resource_id,
devlink_resource_occ_get_t *occ_get,
void *occ_get_priv);
void devl_resource_occ_get_unregister(struct devlink *devlink,
u64 resource_id);
void devlink_resource_occ_get_unregister(struct devlink *devlink,
u64 resource_id);
int devlink_params_register(struct devlink *devlink,
......@@ -1642,6 +1665,10 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
union devlink_param_value init_val);
void devlink_param_value_changed(struct devlink *devlink, u32 param_id);
struct devlink_region *devl_region_create(struct devlink *devlink,
const struct devlink_region_ops *ops,
u32 region_max_snapshots,
u64 region_size);
struct devlink_region *
devlink_region_create(struct devlink *devlink,
const struct devlink_region_ops *ops,
......@@ -1650,6 +1677,7 @@ struct devlink_region *
devlink_port_region_create(struct devlink_port *port,
const struct devlink_port_region_ops *ops,
u32 region_max_snapshots, u64 region_size);
void devl_region_destroy(struct devlink_region *region);
void devlink_region_destroy(struct devlink_region *region);
void devlink_port_region_destroy(struct devlink_region *region);
......@@ -1745,9 +1773,15 @@ void devlink_flash_update_timeout_notify(struct devlink *devlink,
const char *component,
unsigned long timeout);
int devl_traps_register(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count, void *priv);
int devlink_traps_register(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count, void *priv);
void devl_traps_unregister(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count);
void devlink_traps_unregister(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count);
......@@ -1755,18 +1789,24 @@ void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
void *trap_ctx, struct devlink_port *in_devlink_port,
const struct flow_action_cookie *fa_cookie);
void *devlink_trap_ctx_priv(void *trap_ctx);
int devl_trap_groups_register(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
int devlink_trap_groups_register(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
void devl_trap_groups_unregister(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
void devlink_trap_groups_unregister(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
int
devlink_trap_policers_register(struct devlink *devlink,
devl_trap_policers_register(struct devlink *devlink,
const struct devlink_trap_policer *policers,
size_t policers_count);
void
devlink_trap_policers_unregister(struct devlink *devlink,
devl_trap_policers_unregister(struct devlink *devlink,
const struct devlink_trap_policer *policers,
size_t policers_count);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment