Lines Matching refs:devlink

150 static int devlink_param_get(struct devlink *devlink,  in devlink_param_get()  argument
156 return param->get(devlink, param->id, ctx); in devlink_param_get()
159 static int devlink_param_set(struct devlink *devlink, in devlink_param_set() argument
166 return param->set(devlink, param->id, ctx, extack); in devlink_param_set()
238 static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink, in devlink_nl_param_fill() argument
268 err = devlink_param_get(devlink, param, &ctx); in devlink_nl_param_fill()
280 if (devlink_nl_put_handle(msg, devlink)) in devlink_nl_param_fill()
331 static void devlink_param_notify(struct devlink *devlink, in devlink_param_notify() argument
347 if (!devl_is_registered(devlink) || !devlink_nl_notify_need(devlink)) in devlink_param_notify()
353 err = devlink_nl_param_fill(msg, devlink, port_index, param_item, cmd, in devlink_param_notify()
360 devlink_nl_notify_send(devlink, msg); in devlink_param_notify()
363 static void devlink_params_notify(struct devlink *devlink, in devlink_params_notify() argument
369 xa_for_each(&devlink->params, param_id, param_item) in devlink_params_notify()
370 devlink_param_notify(devlink, 0, param_item, cmd); in devlink_params_notify()
373 void devlink_params_notify_register(struct devlink *devlink) in devlink_params_notify_register() argument
375 devlink_params_notify(devlink, DEVLINK_CMD_PARAM_NEW); in devlink_params_notify_register()
378 void devlink_params_notify_unregister(struct devlink *devlink) in devlink_params_notify_unregister() argument
380 devlink_params_notify(devlink, DEVLINK_CMD_PARAM_DEL); in devlink_params_notify_unregister()
384 struct devlink *devlink, in devlink_nl_param_get_dump_one() argument
393 xa_for_each_start(&devlink->params, param_id, param_item, state->idx) { in devlink_nl_param_get_dump_one()
394 err = devlink_nl_param_fill(msg, devlink, 0, param_item, in devlink_nl_param_get_dump_one()
505 struct devlink *devlink = info->user_ptr[0]; in devlink_nl_param_get_doit() local
510 param_item = devlink_param_get_from_info(&devlink->params, info); in devlink_nl_param_get_doit()
518 err = devlink_nl_param_fill(msg, devlink, 0, param_item, in devlink_nl_param_get_doit()
529 static int __devlink_nl_cmd_param_set_doit(struct devlink *devlink, in __devlink_nl_cmd_param_set_doit() argument
556 err = param->validate(devlink, param->id, value, info->extack); in __devlink_nl_cmd_param_set_doit()
575 err = devlink_param_set(devlink, param, &ctx, info->extack); in __devlink_nl_cmd_param_set_doit()
580 devlink_param_notify(devlink, port_index, param_item, cmd); in __devlink_nl_cmd_param_set_doit()
586 struct devlink *devlink = info->user_ptr[0]; in devlink_nl_param_set_doit() local
588 return __devlink_nl_cmd_param_set_doit(devlink, 0, &devlink->params, in devlink_nl_param_set_doit()
623 static int devlink_param_register(struct devlink *devlink, in devlink_param_register() argument
630 WARN_ON(devlink_param_find_by_name(&devlink->params, param->name)); in devlink_param_register()
643 err = xa_insert(&devlink->params, param->id, param_item, GFP_KERNEL); in devlink_param_register()
647 devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_NEW); in devlink_param_register()
655 static void devlink_param_unregister(struct devlink *devlink, in devlink_param_unregister() argument
660 param_item = devlink_param_find_by_id(&devlink->params, param->id); in devlink_param_unregister()
663 devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_DEL); in devlink_param_unregister()
664 xa_erase(&devlink->params, param->id); in devlink_param_unregister()
677 int devl_params_register(struct devlink *devlink, in devl_params_register() argument
684 lockdep_assert_held(&devlink->lock); in devl_params_register()
687 err = devlink_param_register(devlink, param); in devl_params_register()
698 devlink_param_unregister(devlink, param); in devl_params_register()
703 int devlink_params_register(struct devlink *devlink, in devlink_params_register() argument
709 devl_lock(devlink); in devlink_params_register()
710 err = devl_params_register(devlink, params, params_count); in devlink_params_register()
711 devl_unlock(devlink); in devlink_params_register()
722 void devl_params_unregister(struct devlink *devlink, in devl_params_unregister() argument
729 lockdep_assert_held(&devlink->lock); in devl_params_unregister()
732 devlink_param_unregister(devlink, param); in devl_params_unregister()
736 void devlink_params_unregister(struct devlink *devlink, in devlink_params_unregister() argument
740 devl_lock(devlink); in devlink_params_unregister()
741 devl_params_unregister(devlink, params, params_count); in devlink_params_unregister()
742 devl_unlock(devlink); in devlink_params_unregister()
769 int devl_param_driverinit_value_get(struct devlink *devlink, u32 param_id, in devl_param_driverinit_value_get() argument
774 if (WARN_ON(!devlink_reload_supported(devlink->ops))) in devl_param_driverinit_value_get()
777 param_item = devlink_param_find_by_id(&devlink->params, param_id); in devl_param_driverinit_value_get()
806 void devl_param_driverinit_value_set(struct devlink *devlink, u32 param_id, in devl_param_driverinit_value_set() argument
811 devl_assert_locked(devlink); in devl_param_driverinit_value_set()
813 param_item = devlink_param_find_by_id(&devlink->params, param_id); in devl_param_driverinit_value_set()
824 devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_NEW); in devl_param_driverinit_value_set()
828 void devlink_params_driverinit_load_new(struct devlink *devlink) in devlink_params_driverinit_load_new() argument
833 xa_for_each(&devlink->params, param_id, param_item) { in devlink_params_driverinit_load_new()
856 void devl_param_value_changed(struct devlink *devlink, u32 param_id) in devl_param_value_changed() argument
860 param_item = devlink_param_find_by_id(&devlink->params, param_id); in devl_param_value_changed()
863 devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_NEW); in devl_param_value_changed()