• Home
  • Raw
  • Download

Lines Matching refs:region

29 	struct devlink_region *region;  member
37 struct devlink_region *region; in devlink_region_get_by_name() local
39 list_for_each_entry(region, &devlink->region_list, list) in devlink_region_get_by_name()
40 if (!strcmp(region->ops->name, region_name)) in devlink_region_get_by_name()
41 return region; in devlink_region_get_by_name()
50 struct devlink_region *region; in devlink_port_region_get_by_name() local
52 list_for_each_entry(region, &port->region_list, list) in devlink_port_region_get_by_name()
53 if (!strcmp(region->ops->name, region_name)) in devlink_port_region_get_by_name()
54 return region; in devlink_port_region_get_by_name()
60 devlink_region_snapshot_get_by_id(struct devlink_region *region, u32 id) in devlink_region_snapshot_get_by_id() argument
64 list_for_each_entry(snapshot, &region->snapshot_list, list) in devlink_region_snapshot_get_by_id()
96 struct devlink_region *region) in devlink_nl_region_snapshots_id_put() argument
107 list_for_each_entry(snapshot, &region->snapshot_list, list) { in devlink_nl_region_snapshots_id_put()
124 struct devlink_region *region) in devlink_nl_region_fill() argument
137 if (region->port) { in devlink_nl_region_fill()
139 region->port->index); in devlink_nl_region_fill()
144 err = nla_put_string(msg, DEVLINK_ATTR_REGION_NAME, region->ops->name); in devlink_nl_region_fill()
149 region->size, in devlink_nl_region_fill()
155 region->max_snapshots); in devlink_nl_region_fill()
159 err = devlink_nl_region_snapshots_id_put(msg, devlink, region); in devlink_nl_region_fill()
172 devlink_nl_region_notify_build(struct devlink_region *region, in devlink_nl_region_notify_build() argument
176 struct devlink *devlink = region->devlink; in devlink_nl_region_notify_build()
195 if (region->port) { in devlink_nl_region_notify_build()
197 region->port->index); in devlink_nl_region_notify_build()
203 region->ops->name); in devlink_nl_region_notify_build()
214 region->size, DEVLINK_ATTR_PAD); in devlink_nl_region_notify_build()
229 static void devlink_nl_region_notify(struct devlink_region *region, in devlink_nl_region_notify() argument
233 struct devlink *devlink = region->devlink; in devlink_nl_region_notify()
240 msg = devlink_nl_region_notify_build(region, snapshot, cmd, 0, 0); in devlink_nl_region_notify()
250 struct devlink_region *region; in devlink_regions_notify_register() local
252 list_for_each_entry(region, &devlink->region_list, list) in devlink_regions_notify_register()
253 devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_NEW); in devlink_regions_notify_register()
258 struct devlink_region *region; in devlink_regions_notify_unregister() local
260 list_for_each_entry_reverse(region, &devlink->region_list, list) in devlink_regions_notify_unregister()
261 devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_DEL); in devlink_regions_notify_unregister()
417 __devlink_region_snapshot_create(struct devlink_region *region, in __devlink_region_snapshot_create() argument
420 struct devlink *devlink = region->devlink; in __devlink_region_snapshot_create()
424 lockdep_assert_held(&region->snapshot_lock); in __devlink_region_snapshot_create()
427 if (region->cur_snapshots == region->max_snapshots) in __devlink_region_snapshot_create()
430 if (devlink_region_snapshot_get_by_id(region, snapshot_id)) in __devlink_region_snapshot_create()
442 snapshot->region = region; in __devlink_region_snapshot_create()
445 list_add_tail(&snapshot->list, &region->snapshot_list); in __devlink_region_snapshot_create()
447 region->cur_snapshots++; in __devlink_region_snapshot_create()
449 devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_NEW); in __devlink_region_snapshot_create()
457 static void devlink_region_snapshot_del(struct devlink_region *region, in devlink_region_snapshot_del() argument
460 struct devlink *devlink = region->devlink; in devlink_region_snapshot_del()
462 lockdep_assert_held(&region->snapshot_lock); in devlink_region_snapshot_del()
464 devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_DEL); in devlink_region_snapshot_del()
465 region->cur_snapshots--; in devlink_region_snapshot_del()
467 region->ops->destructor(snapshot->data); in devlink_region_snapshot_del()
476 struct devlink_region *region; in devlink_nl_region_get_doit() local
495 region = devlink_port_region_get_by_name(port, region_name); in devlink_nl_region_get_doit()
497 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_region_get_doit()
499 if (!region) in devlink_nl_region_get_doit()
508 region); in devlink_nl_region_get_doit()
522 struct devlink_region *region; in devlink_nl_cmd_region_get_port_dumpit() local
525 list_for_each_entry(region, &port->region_list, list) { in devlink_nl_cmd_region_get_port_dumpit()
534 flags, region); in devlink_nl_cmd_region_get_port_dumpit()
550 struct devlink_region *region; in devlink_nl_region_get_dump_one() local
556 list_for_each_entry(region, &devlink->region_list, list) { in devlink_nl_region_get_dump_one()
565 region); in devlink_nl_region_get_dump_one()
596 struct devlink_region *region; in devlink_nl_cmd_region_del() local
617 region = devlink_port_region_get_by_name(port, region_name); in devlink_nl_cmd_region_del()
619 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_cmd_region_del()
621 if (!region) in devlink_nl_cmd_region_del()
624 mutex_lock(&region->snapshot_lock); in devlink_nl_cmd_region_del()
625 snapshot = devlink_region_snapshot_get_by_id(region, snapshot_id); in devlink_nl_cmd_region_del()
627 mutex_unlock(&region->snapshot_lock); in devlink_nl_cmd_region_del()
631 devlink_region_snapshot_del(region, snapshot); in devlink_nl_cmd_region_del()
632 mutex_unlock(&region->snapshot_lock); in devlink_nl_cmd_region_del()
642 struct devlink_region *region; in devlink_nl_cmd_region_new() local
665 region = devlink_port_region_get_by_name(port, region_name); in devlink_nl_cmd_region_new()
667 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_cmd_region_new()
669 if (!region) { in devlink_nl_cmd_region_new()
674 if (!region->ops->snapshot) { in devlink_nl_cmd_region_new()
679 mutex_lock(&region->snapshot_lock); in devlink_nl_cmd_region_new()
681 if (region->cur_snapshots == region->max_snapshots) { in devlink_nl_cmd_region_new()
691 if (devlink_region_snapshot_get_by_id(region, snapshot_id)) { in devlink_nl_cmd_region_new()
709 err = region->port_ops->snapshot(port, region->port_ops, in devlink_nl_cmd_region_new()
712 err = region->ops->snapshot(devlink, region->ops, in devlink_nl_cmd_region_new()
717 err = __devlink_region_snapshot_create(region, data, snapshot_id); in devlink_nl_cmd_region_new()
724 snapshot = devlink_region_snapshot_get_by_id(region, in devlink_nl_cmd_region_new()
731 msg = devlink_nl_region_notify_build(region, snapshot, in devlink_nl_cmd_region_new()
744 mutex_unlock(&region->snapshot_lock); in devlink_nl_cmd_region_new()
748 region->ops->destructor(data); in devlink_nl_cmd_region_new()
751 mutex_unlock(&region->snapshot_lock); in devlink_nl_cmd_region_new()
755 devlink_region_snapshot_del(region, snapshot); in devlink_nl_cmd_region_new()
757 mutex_unlock(&region->snapshot_lock); in devlink_nl_cmd_region_new()
850 struct devlink_region *region = cb_priv; in devlink_region_port_direct_fill() local
852 return region->port_ops->read(region->port, region->port_ops, extack, in devlink_region_port_direct_fill()
860 struct devlink_region *region = cb_priv; in devlink_region_direct_fill() local
862 return region->ops->read(region->devlink, region->ops, extack, in devlink_region_direct_fill()
876 struct devlink_region *region; in devlink_nl_cmd_region_read_dumpit() local
910 region = devlink_port_region_get_by_name(port, region_name); in devlink_nl_cmd_region_read_dumpit()
912 region = devlink_region_get_by_name(devlink, region_name); in devlink_nl_cmd_region_read_dumpit()
914 if (!region) { in devlink_nl_cmd_region_read_dumpit()
928 if (!region->ops->read) { in devlink_nl_cmd_region_read_dumpit()
938 region_cb_priv = region; in devlink_nl_cmd_region_read_dumpit()
950 snapshot = devlink_region_snapshot_get_by_id(region, snapshot_id); in devlink_nl_cmd_region_read_dumpit()
970 if (end_offset > region->size) in devlink_nl_cmd_region_read_dumpit()
971 end_offset = region->size; in devlink_nl_cmd_region_read_dumpit()
991 if (region->port) { in devlink_nl_cmd_region_read_dumpit()
993 region->port->index); in devlink_nl_cmd_region_read_dumpit()
1050 struct devlink_region *region; in devl_region_create() local
1060 region = kzalloc(sizeof(*region), GFP_KERNEL); in devl_region_create()
1061 if (!region) in devl_region_create()
1064 region->devlink = devlink; in devl_region_create()
1065 region->max_snapshots = region_max_snapshots; in devl_region_create()
1066 region->ops = ops; in devl_region_create()
1067 region->size = region_size; in devl_region_create()
1068 INIT_LIST_HEAD(&region->snapshot_list); in devl_region_create()
1069 mutex_init(&region->snapshot_lock); in devl_region_create()
1070 list_add_tail(&region->list, &devlink->region_list); in devl_region_create()
1071 devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_NEW); in devl_region_create()
1073 return region; in devl_region_create()
1092 struct devlink_region *region; in devlink_region_create() local
1095 region = devl_region_create(devlink, ops, region_max_snapshots, in devlink_region_create()
1098 return region; in devlink_region_create()
1118 struct devlink_region *region; in devlink_port_region_create() local
1133 region = kzalloc(sizeof(*region), GFP_KERNEL); in devlink_port_region_create()
1134 if (!region) { in devlink_port_region_create()
1139 region->devlink = devlink; in devlink_port_region_create()
1140 region->port = port; in devlink_port_region_create()
1141 region->max_snapshots = region_max_snapshots; in devlink_port_region_create()
1142 region->port_ops = ops; in devlink_port_region_create()
1143 region->size = region_size; in devlink_port_region_create()
1144 INIT_LIST_HEAD(&region->snapshot_list); in devlink_port_region_create()
1145 mutex_init(&region->snapshot_lock); in devlink_port_region_create()
1146 list_add_tail(&region->list, &port->region_list); in devlink_port_region_create()
1147 devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_NEW); in devlink_port_region_create()
1150 return region; in devlink_port_region_create()
1163 void devl_region_destroy(struct devlink_region *region) in devl_region_destroy() argument
1165 struct devlink *devlink = region->devlink; in devl_region_destroy()
1171 mutex_lock(&region->snapshot_lock); in devl_region_destroy()
1172 list_for_each_entry_safe(snapshot, ts, &region->snapshot_list, list) in devl_region_destroy()
1173 devlink_region_snapshot_del(region, snapshot); in devl_region_destroy()
1174 mutex_unlock(&region->snapshot_lock); in devl_region_destroy()
1176 list_del(&region->list); in devl_region_destroy()
1177 mutex_destroy(&region->snapshot_lock); in devl_region_destroy()
1179 devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_DEL); in devl_region_destroy()
1180 kfree(region); in devl_region_destroy()
1191 void devlink_region_destroy(struct devlink_region *region) in devlink_region_destroy() argument
1193 struct devlink *devlink = region->devlink; in devlink_region_destroy()
1196 devl_region_destroy(region); in devlink_region_destroy()
1250 int devlink_region_snapshot_create(struct devlink_region *region, in devlink_region_snapshot_create() argument
1255 mutex_lock(&region->snapshot_lock); in devlink_region_snapshot_create()
1256 err = __devlink_region_snapshot_create(region, data, snapshot_id); in devlink_region_snapshot_create()
1257 mutex_unlock(&region->snapshot_lock); in devlink_region_snapshot_create()