diff options
Diffstat (limited to 'net/openvswitch/datapath.h')
-rw-r--r-- | net/openvswitch/datapath.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h index c1105c147531..771c11e13e34 100644 --- a/net/openvswitch/datapath.h +++ b/net/openvswitch/datapath.h | |||
@@ -27,8 +27,7 @@ | |||
27 | #include <linux/u64_stats_sync.h> | 27 | #include <linux/u64_stats_sync.h> |
28 | 28 | ||
29 | #include "flow.h" | 29 | #include "flow.h" |
30 | 30 | #include "vport.h" | |
31 | struct vport; | ||
32 | 31 | ||
33 | #define DP_MAX_PORTS 1024 | 32 | #define DP_MAX_PORTS 1024 |
34 | #define SAMPLE_ACTION_DEPTH 3 | 33 | #define SAMPLE_ACTION_DEPTH 3 |
@@ -63,6 +62,7 @@ struct dp_stats_percpu { | |||
63 | * @port_list: List of all ports in @ports in arbitrary order. RTNL required | 62 | * @port_list: List of all ports in @ports in arbitrary order. RTNL required |
64 | * to iterate or modify. | 63 | * to iterate or modify. |
65 | * @stats_percpu: Per-CPU datapath statistics. | 64 | * @stats_percpu: Per-CPU datapath statistics. |
65 | * @net: Reference to net namespace. | ||
66 | * | 66 | * |
67 | * Context: See the comment on locking at the top of datapath.c for additional | 67 | * Context: See the comment on locking at the top of datapath.c for additional |
68 | * locking information. | 68 | * locking information. |
@@ -80,6 +80,11 @@ struct datapath { | |||
80 | 80 | ||
81 | /* Stats. */ | 81 | /* Stats. */ |
82 | struct dp_stats_percpu __percpu *stats_percpu; | 82 | struct dp_stats_percpu __percpu *stats_percpu; |
83 | |||
84 | #ifdef CONFIG_NET_NS | ||
85 | /* Network namespace ref. */ | ||
86 | struct net *net; | ||
87 | #endif | ||
83 | }; | 88 | }; |
84 | 89 | ||
85 | /** | 90 | /** |
@@ -108,6 +113,16 @@ struct dp_upcall_info { | |||
108 | u32 pid; | 113 | u32 pid; |
109 | }; | 114 | }; |
110 | 115 | ||
116 | static inline struct net *ovs_dp_get_net(struct datapath *dp) | ||
117 | { | ||
118 | return read_pnet(&dp->net); | ||
119 | } | ||
120 | |||
121 | static inline void ovs_dp_set_net(struct datapath *dp, struct net *net) | ||
122 | { | ||
123 | write_pnet(&dp->net, net); | ||
124 | } | ||
125 | |||
111 | extern struct notifier_block ovs_dp_device_notifier; | 126 | extern struct notifier_block ovs_dp_device_notifier; |
112 | extern struct genl_multicast_group ovs_dp_vport_multicast_group; | 127 | extern struct genl_multicast_group ovs_dp_vport_multicast_group; |
113 | 128 | ||