Commit 9c4a7665 authored by Parav Pandit's avatar Parav Pandit Committed by David S. Miller

devlink: Add APIs to publish, unpublish individual parameter

Enable drivers to publish/unpublish individual parameter.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b40c51ef
......@@ -1651,6 +1651,10 @@ void devlink_param_unregister(struct devlink *devlink,
const struct devlink_param *param);
void devlink_params_publish(struct devlink *devlink);
void devlink_params_unpublish(struct devlink *devlink);
void devlink_param_publish(struct devlink *devlink,
const struct devlink_param *param);
void devlink_param_unpublish(struct devlink *devlink,
const struct devlink_param *param);
int devlink_port_params_register(struct devlink_port *devlink_port,
const struct devlink_param *params,
size_t params_count);
......
......@@ -9982,6 +9982,54 @@ void devlink_params_unpublish(struct devlink *devlink)
}
EXPORT_SYMBOL_GPL(devlink_params_unpublish);
/**
* devlink_param_publish - publish one configuration parameter
*
* @devlink: devlink
* @param: one configuration parameter
*
* Publish previously registered configuration parameter.
*/
void devlink_param_publish(struct devlink *devlink,
const struct devlink_param *param)
{
struct devlink_param_item *param_item;
list_for_each_entry(param_item, &devlink->param_list, list) {
if (param_item->param != param || param_item->published)
continue;
param_item->published = true;
devlink_param_notify(devlink, 0, param_item,
DEVLINK_CMD_PARAM_NEW);
break;
}
}
EXPORT_SYMBOL_GPL(devlink_param_publish);
/**
* devlink_param_unpublish - unpublish one configuration parameter
*
* @devlink: devlink
* @param: one configuration parameter
*
* Unpublish previously registered configuration parameter.
*/
void devlink_param_unpublish(struct devlink *devlink,
const struct devlink_param *param)
{
struct devlink_param_item *param_item;
list_for_each_entry(param_item, &devlink->param_list, list) {
if (param_item->param != param || !param_item->published)
continue;
param_item->published = false;
devlink_param_notify(devlink, 0, param_item,
DEVLINK_CMD_PARAM_DEL);
break;
}
}
EXPORT_SYMBOL_GPL(devlink_param_unpublish);
/**
* devlink_port_params_register - register port configuration parameters
*
......
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