diff options
author | Jiri Pirko <jiri@nvidia.com> | 2022-11-02 17:01:59 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-03 20:48:32 -0700 |
commit | 3830c5719af66fac9849cf5fb04b03d4e4bb46ff (patch) | |
tree | 91497f7c72e25307c569b71c91bcd01c59edbd14 /include/net/devlink.h | |
parent | 0884aaf37afaac69dd31cb501b67635569483bb3 (diff) |
net: devlink: convert devlink port type-specific pointers to union
Instead of storing type_dev as a void pointer, convert it to union and
use it to store either struct net_device or struct ib_device pointer.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/devlink.h')
-rw-r--r-- | include/net/devlink.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h index ba6b8b094943..6c55aabaedf1 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -121,12 +121,19 @@ struct devlink_port { struct list_head region_list; struct devlink *devlink; unsigned int index; - spinlock_t type_lock; /* Protects type and type_dev - * pointer consistency. + spinlock_t type_lock; /* Protects type and type_eth/ib + * structures consistency. */ enum devlink_port_type type; enum devlink_port_type desired_type; - void *type_dev; + union { + struct { + struct net_device *netdev; + } type_eth; + struct { + struct ib_device *ibdev; + } type_ib; + }; struct devlink_port_attrs attrs; u8 attrs_set:1, switch_port:1, |