summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/datapath.h
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2012-02-22 19:58:59 -0800
committerJesse Gross <jesse@nicira.com>2012-08-22 14:48:55 -0700
commit46df7b814548849deee01f50bc75f8f5ae8cd767 (patch)
tree1663fa6ae46edcba3787c0a4ff839365bb52bcbe /net/openvswitch/datapath.h
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff)
openvswitch: Add support for network namespaces.
Following patch adds support for network namespace to openvswitch. Since it must release devices when namespaces are destroyed, a side effect of this patch is that the module no longer keeps a refcount but instead cleans up any state when it is unloaded. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'net/openvswitch/datapath.h')
-rw-r--r--net/openvswitch/datapath.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h
index c1105c14753..771c11e13e3 100644
--- a/net/openvswitch/datapath.h
+++ b/net/openvswitch/datapath.h
@@ -27,8 +27,7 @@
#include <linux/u64_stats_sync.h>
#include "flow.h"
-
-struct vport;
+#include "vport.h"
#define DP_MAX_PORTS 1024
#define SAMPLE_ACTION_DEPTH 3
@@ -63,6 +62,7 @@ struct dp_stats_percpu {
* @port_list: List of all ports in @ports in arbitrary order. RTNL required
* to iterate or modify.
* @stats_percpu: Per-CPU datapath statistics.
+ * @net: Reference to net namespace.
*
* Context: See the comment on locking at the top of datapath.c for additional
* locking information.
@@ -80,6 +80,11 @@ struct datapath {
/* Stats. */
struct dp_stats_percpu __percpu *stats_percpu;
+
+#ifdef CONFIG_NET_NS
+ /* Network namespace ref. */
+ struct net *net;
+#endif
};
/**
@@ -108,6 +113,16 @@ struct dp_upcall_info {
u32 pid;
};
+static inline struct net *ovs_dp_get_net(struct datapath *dp)
+{
+ return read_pnet(&dp->net);
+}
+
+static inline void ovs_dp_set_net(struct datapath *dp, struct net *net)
+{
+ write_pnet(&dp->net, net);
+}
+
extern struct notifier_block ovs_dp_device_notifier;
extern struct genl_multicast_group ovs_dp_vport_multicast_group;