Lines Matching refs:devlink

10 	struct devlink *devlink;  member
35 devlink_region_get_by_name(struct devlink *devlink, const char *region_name) in devlink_region_get_by_name() argument
39 list_for_each_entry(region, &devlink->region_list, list) in devlink_region_get_by_name()
72 struct devlink *devlink, in devlink_nl_region_snapshot_id_put() argument
95 struct devlink *devlink, in devlink_nl_region_snapshots_id_put() argument
108 err = devlink_nl_region_snapshot_id_put(msg, devlink, snapshot); in devlink_nl_region_snapshots_id_put()
121 static int devlink_nl_region_fill(struct sk_buff *msg, struct devlink *devlink, in devlink_nl_region_fill() argument
133 err = devlink_nl_put_handle(msg, devlink); in devlink_nl_region_fill()
159 err = devlink_nl_region_snapshots_id_put(msg, devlink, region); in devlink_nl_region_fill()
176 struct devlink *devlink = region->devlink; in devlink_nl_region_notify_build() local
191 err = devlink_nl_put_handle(msg, devlink); in devlink_nl_region_notify_build()
233 struct devlink *devlink = region->devlink; in devlink_nl_region_notify() local
238 if (!__devl_is_registered(devlink) || !devlink_nl_notify_need(devlink)) in devlink_nl_region_notify()
245 devlink_nl_notify_send(devlink, msg); in devlink_nl_region_notify()
248 void devlink_regions_notify_register(struct devlink *devlink) in devlink_regions_notify_register() argument
252 list_for_each_entry(region, &devlink->region_list, list) in devlink_regions_notify_register()
256 void devlink_regions_notify_unregister(struct devlink *devlink) in devlink_regions_notify_unregister() argument
260 list_for_each_entry_reverse(region, &devlink->region_list, list) in devlink_regions_notify_unregister()
279 static int __devlink_snapshot_id_increment(struct devlink *devlink, u32 id) in __devlink_snapshot_id_increment() argument
285 xa_lock(&devlink->snapshot_ids); in __devlink_snapshot_id_increment()
286 p = xa_load(&devlink->snapshot_ids, id); in __devlink_snapshot_id_increment()
300 err = xa_err(__xa_store(&devlink->snapshot_ids, id, xa_mk_value(count), in __devlink_snapshot_id_increment()
303 xa_unlock(&devlink->snapshot_ids); in __devlink_snapshot_id_increment()
322 static void __devlink_snapshot_id_decrement(struct devlink *devlink, u32 id) in __devlink_snapshot_id_decrement() argument
327 xa_lock(&devlink->snapshot_ids); in __devlink_snapshot_id_decrement()
328 p = xa_load(&devlink->snapshot_ids, id); in __devlink_snapshot_id_decrement()
339 __xa_store(&devlink->snapshot_ids, id, xa_mk_value(count), in __devlink_snapshot_id_decrement()
343 __xa_erase(&devlink->snapshot_ids, id); in __devlink_snapshot_id_decrement()
346 xa_unlock(&devlink->snapshot_ids); in __devlink_snapshot_id_decrement()
365 static int __devlink_snapshot_id_insert(struct devlink *devlink, u32 id) in __devlink_snapshot_id_insert() argument
369 xa_lock(&devlink->snapshot_ids); in __devlink_snapshot_id_insert()
370 if (xa_load(&devlink->snapshot_ids, id)) { in __devlink_snapshot_id_insert()
371 xa_unlock(&devlink->snapshot_ids); in __devlink_snapshot_id_insert()
374 err = xa_err(__xa_store(&devlink->snapshot_ids, id, xa_mk_value(0), in __devlink_snapshot_id_insert()
376 xa_unlock(&devlink->snapshot_ids); in __devlink_snapshot_id_insert()
396 static int __devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id) in __devlink_region_snapshot_id_get() argument
398 return xa_alloc(&devlink->snapshot_ids, id, xa_mk_value(1), in __devlink_region_snapshot_id_get()
420 struct devlink *devlink = region->devlink; in __devlink_region_snapshot_create() local
437 err = __devlink_snapshot_id_increment(devlink, snapshot_id); in __devlink_region_snapshot_create()
460 struct devlink *devlink = region->devlink; in devlink_region_snapshot_del() local
468 __devlink_snapshot_id_decrement(devlink, snapshot->id); in devlink_region_snapshot_del()
474 struct devlink *devlink = info->user_ptr[0]; in devlink_nl_region_get_doit() local
488 port = devlink_port_get_by_index(devlink, index); in devlink_nl_region_get_doit()
497 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_region_get_doit()
506 err = devlink_nl_region_fill(msg, devlink, DEVLINK_CMD_REGION_GET, in devlink_nl_region_get_doit()
530 err = devlink_nl_region_fill(msg, port->devlink, in devlink_nl_cmd_region_get_port_dumpit()
545 struct devlink *devlink, in devlink_nl_region_get_dump_one() argument
556 list_for_each_entry(region, &devlink->region_list, list) { in devlink_nl_region_get_dump_one()
561 err = devlink_nl_region_fill(msg, devlink, in devlink_nl_region_get_dump_one()
573 xa_for_each(&devlink->ports, port_index, port) { in devlink_nl_region_get_dump_one()
593 struct devlink *devlink = info->user_ptr[0]; in devlink_nl_region_del_doit() local
611 port = devlink_port_get_by_index(devlink, index); in devlink_nl_region_del_doit()
619 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_region_del_doit()
638 struct devlink *devlink = info->user_ptr[0]; in devlink_nl_region_new_doit() local
659 port = devlink_port_get_by_index(devlink, index); in devlink_nl_region_new_doit()
667 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_region_new_doit()
697 err = __devlink_snapshot_id_insert(devlink, snapshot_id); in devlink_nl_region_new_doit()
701 err = __devlink_region_snapshot_id_get(devlink, &snapshot_id); in devlink_nl_region_new_doit()
712 err = region->ops->snapshot(devlink, region->ops, in devlink_nl_region_new_doit()
750 __devlink_snapshot_id_decrement(devlink, snapshot_id); in devlink_nl_region_new_doit()
862 return region->ops->read(region->devlink, region->ops, extack, in devlink_region_direct_fill()
878 struct devlink *devlink; in devlink_nl_region_read_dumpit() local
886 devlink = devlink_get_from_attrs_lock(sock_net(cb->skb->sk), attrs, in devlink_nl_region_read_dumpit()
888 if (IS_ERR(devlink)) in devlink_nl_region_read_dumpit()
889 return PTR_ERR(devlink); in devlink_nl_region_read_dumpit()
900 port = devlink_port_get_by_index(devlink, index); in devlink_nl_region_read_dumpit()
913 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_region_read_dumpit()
988 err = devlink_nl_put_handle(skb, devlink); in devlink_nl_region_read_dumpit()
1026 devl_unlock(devlink); in devlink_nl_region_read_dumpit()
1027 devlink_put(devlink); in devlink_nl_region_read_dumpit()
1033 devl_unlock(devlink); in devlink_nl_region_read_dumpit()
1034 devlink_put(devlink); in devlink_nl_region_read_dumpit()
1046 struct devlink_region *devl_region_create(struct devlink *devlink, in devl_region_create() argument
1053 devl_assert_locked(devlink); in devl_region_create()
1058 if (devlink_region_get_by_name(devlink, ops->name)) in devl_region_create()
1065 region->devlink = devlink; in devl_region_create()
1071 list_add_tail(&region->list, &devlink->region_list); in devl_region_create()
1089 devlink_region_create(struct devlink *devlink, in devlink_region_create() argument
1095 devl_lock(devlink); in devlink_region_create()
1096 region = devl_region_create(devlink, ops, region_max_snapshots, in devlink_region_create()
1098 devl_unlock(devlink); in devlink_region_create()
1118 struct devlink *devlink = port->devlink; in devlink_port_region_create() local
1127 devl_lock(devlink); in devlink_port_region_create()
1140 region->devlink = devlink; in devlink_port_region_create()
1150 devl_unlock(devlink); in devlink_port_region_create()
1154 devl_unlock(devlink); in devlink_port_region_create()
1166 struct devlink *devlink = region->devlink; in devl_region_destroy() local
1169 devl_assert_locked(devlink); in devl_region_destroy()
1194 struct devlink *devlink = region->devlink; in devlink_region_destroy() local
1196 devl_lock(devlink); in devlink_region_destroy()
1198 devl_unlock(devlink); in devlink_region_destroy()
1217 int devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id) in devlink_region_snapshot_id_get() argument
1219 return __devlink_region_snapshot_id_get(devlink, id); in devlink_region_snapshot_id_get()
1233 void devlink_region_snapshot_id_put(struct devlink *devlink, u32 id) in devlink_region_snapshot_id_put() argument
1235 __devlink_snapshot_id_decrement(devlink, id); in devlink_region_snapshot_id_put()