Export devlink_net and devlink_net_set for modules to be able to set
the network namespace for a devlink instance and retrieve it later.

Signed-off-by: David Ahern <d...@cumulusnetworks.com>
---
 include/net/devlink.h | 2 ++
 net/core/devlink.c    | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index d5b707375e48..e6f7d0f674a5 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -361,6 +361,8 @@ struct ib_device;
 #if IS_ENABLED(CONFIG_NET_DEVLINK)
 
 struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
+struct net *devlink_net(const struct devlink *devlink);
+void devlink_net_set(struct devlink *devlink, struct net *net);
 int devlink_register(struct devlink *devlink, struct device *dev);
 void devlink_unregister(struct devlink *devlink);
 void devlink_free(struct devlink *devlink);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index d03b96f87c25..53cddffe97fc 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -92,15 +92,17 @@ static LIST_HEAD(devlink_list);
  */
 static DEFINE_MUTEX(devlink_mutex);
 
-static struct net *devlink_net(const struct devlink *devlink)
+struct net *devlink_net(const struct devlink *devlink)
 {
        return read_pnet(&devlink->_net);
 }
+EXPORT_SYMBOL_GPL(devlink_net);
 
-static void devlink_net_set(struct devlink *devlink, struct net *net)
+void devlink_net_set(struct devlink *devlink, struct net *net)
 {
        write_pnet(&devlink->_net, net);
 }
+EXPORT_SYMBOL_GPL(devlink_net_set);
 
 static struct devlink *devlink_get_from_attrs(struct net *net,
                                              struct nlattr **attrs)
-- 
2.11.0

Reply via email to