[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180322225757.10377-7-dsa@cumulusnetworks.com>
Date: Thu, 22 Mar 2018 15:57:56 -0700
From: David Ahern <dsa@...ulusnetworks.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, roopa@...ulusnetworks.com,
shm@...ulusnetworks.com, jiri@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, David Ahern <dsa@...ulusnetworks.com>
Subject: [PATCH RFC net-next 6/7] devlink: Export methods to get and set namespace
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 <dsa@...ulusnetworks.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
Powered by blists - more mailing lists