mirror_ubuntu-kernels/net/devlink
Jiri Pirko c137743bce devlink: introduce object and nested devlink relationship infra
It is a bit tricky to maintain relationship between devlink objects and
nested devlink instances due to following aspects:

1) Locking. It is necessary to lock the devlink instance that contains
   the object first, only after that to lock the nested instance.
2) Lifetimes. Objects (e.g devlink port) may be removed before
   the nested devlink instance.
3) Notifications. If nested instance changes (e.g. gets
   registered/unregistered) the nested-in object needs to send
   appropriate notifications.

Resolve this by introducing an xarray that holds 1:1 relationships
between devlink object and related nested devlink instance.
Use that xarray index to get the object/nested devlink instance on
the other side.

Provide necessary helpers:
devlink_rel_nested_in_add/clear() to add and clear the relationship.
devlink_rel_nested_in_notify() to call the nested-in object to send
	notifications during nested instance register/unregister/netns
	change.
devlink_rel_devlink_handle_put() to be used by nested-in object fill
	function to fill the nested handle.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-09-17 14:01:47 +01:00
..
core.c devlink: introduce object and nested devlink relationship infra 2023-09-17 14:01:47 +01:00
dev.c devlink: introduce object and nested devlink relationship infra 2023-09-17 14:01:47 +01:00
devl_internal.h devlink: introduce object and nested devlink relationship infra 2023-09-17 14:01:47 +01:00
dpipe.c devlink: push dpipe related code into separate file 2023-08-28 08:02:22 -07:00
health.c genetlink: use attrs from struct genl_info 2023-08-15 15:00:45 -07:00
linecard.c devlink: extend devlink_nl_put_nested_handle() with attrtype arg 2023-09-17 14:01:46 +01:00
Makefile devlink: move devlink_notify_register/unregister() to dev.c 2023-08-28 08:02:24 -07:00
netlink_gen.c netlink: specs: devlink: extend health reporter dump attributes by port index 2023-08-14 11:47:25 -07:00
netlink_gen.h netlink: specs: devlink: add commands that do per-instance dump 2023-08-14 11:47:25 -07:00
netlink.c devlink: extend devlink_nl_put_nested_handle() with attrtype arg 2023-09-17 14:01:46 +01:00
param.c devlink: push param related code into separate file 2023-08-28 08:02:22 -07:00
port.c devlink: move linecard struct into linecard.c 2023-09-17 14:01:46 +01:00
rate.c devlink: push rate related code into separate file 2023-08-28 08:02:23 -07:00
region.c devlink: push region related code into separate file 2023-08-28 08:02:23 -07:00
resource.c devlink: push resource related code into separate file 2023-08-28 08:02:22 -07:00
sb.c devlink: push shared buffer related code into separate file 2023-08-28 08:02:22 -07:00
trap.c devlink: push trap related code into separate file 2023-08-28 08:02:23 -07:00