devlink: expose peer SF devlink instance
authorJiri Pirko <jiri@nvidia.com>
Wed, 13 Sep 2023 07:12:39 +0000 (09:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Sep 2023 13:01:47 +0000 (14:01 +0100)
commit0b7a2721e36c11313f8b0f251a508d25a872cd28
tree001cedc27c5bf95176403b45f5620f0c8393207f
parentc137743bce02b18c1537d4681aa515f7b80bf0a8
devlink: expose peer SF devlink instance

Introduce a new helper devl_port_fn_devlink_set() to be used by driver
assigning a devlink instance to the peer devlink port function.

Expose this to user over new netlink attribute nested under port
function nest to expose devlink handle related to the port function.

This is particularly helpful for user to understand the relationship
between devlink instances created for SFs and the port functions
they belong to.

Note that caller of devlink_port_notify() needs to hold devlink
instance lock, put the assertion to devl_port_fn_devlink_set() to make
this requirement explicit. Also note the limitations that only allow to
make this assignment for registered objects.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/devlink.h
include/uapi/linux/devlink.h
net/devlink/port.c