diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-07-30 13:16:40 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-07-30 13:16:40 -0700 |
commit | aae950b189413ed3201354600d44223da0bcf63c (patch) | |
tree | 91c846c831266cdd737c0d3f5e78bc191558dfbe /include/net | |
parent | a432934a30679c0e3c47b87f13e4901bc1a3fc03 (diff) | |
parent | 26713455048eb19122b1561b471d30710177ef97 (diff) | |
download | linux-aae950b189413ed3201354600d44223da0bcf63c.tar.bz2 |
Merge branch 'clean-devlink-net-namespace-operations'
Leon Romanovsky says:
====================
Clean devlink net namespace operations
This short series continues my work on devlink core code to make devlink
reload less prone to errors and harden it from API abuse.
Despite first patch being a clear fix, I would ask you to apply it to
net-next anyway, because the fixed patch is anyway old and it will
help us to eliminate merge conflicts that will arise for following
patches or even for the second one.
====================
Link: https://lore.kernel.org/r/cover.1627578998.git.leonro@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/devlink.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h index e48a62320407..08f4c6191e72 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1540,8 +1540,18 @@ static inline struct devlink *netdev_to_devlink(struct net_device *dev) struct ib_device; struct net *devlink_net(const struct devlink *devlink); -void devlink_net_set(struct devlink *devlink, struct net *net); -struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size); +/* This call is intended for software devices that can create + * devlink instances in other namespaces than init_net. + * + * Drivers that operate on real HW must use devlink_alloc() instead. + */ +struct devlink *devlink_alloc_ns(const struct devlink_ops *ops, + size_t priv_size, struct net *net); +static inline struct devlink *devlink_alloc(const struct devlink_ops *ops, + size_t priv_size) +{ + return devlink_alloc_ns(ops, priv_size, &init_net); +} int devlink_register(struct devlink *devlink, struct device *dev); void devlink_unregister(struct devlink *devlink); void devlink_reload_enable(struct devlink *devlink); |