aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/net_namespace.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index bd10a7908993..aef430d779bd 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -7,6 +7,7 @@
7#include <asm/atomic.h> 7#include <asm/atomic.h>
8#include <linux/workqueue.h> 8#include <linux/workqueue.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/sysctl.h>
10 11
11#include <net/netns/core.h> 12#include <net/netns/core.h>
12#include <net/netns/mib.h> 13#include <net/netns/mib.h>
@@ -27,20 +28,26 @@ struct sock;
27struct ctl_table_header; 28struct ctl_table_header;
28struct net_generic; 29struct net_generic;
29struct sock; 30struct sock;
31struct netns_ipvs;
30 32
31 33
32#define NETDEV_HASHBITS 8 34#define NETDEV_HASHBITS 8
33#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) 35#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
34 36
35struct net { 37struct net {
38 atomic_t passive; /* To decided when the network
39 * namespace should be freed.
40 */
36 atomic_t count; /* To decided when the network 41 atomic_t count; /* To decided when the network
37 * namespace should be freed. 42 * namespace should be shut down.
38 */ 43 */
39#ifdef NETNS_REFCNT_DEBUG 44#ifdef NETNS_REFCNT_DEBUG
40 atomic_t use_count; /* To track references we 45 atomic_t use_count; /* To track references we
41 * destroy on demand 46 * destroy on demand
42 */ 47 */
43#endif 48#endif
49 spinlock_t rules_mod_lock;
50
44 struct list_head list; /* list of network namespaces */ 51 struct list_head list; /* list of network namespaces */
45 struct list_head cleanup_list; /* namespaces on death row */ 52 struct list_head cleanup_list; /* namespaces on death row */
46 struct list_head exit_list; /* Use only net_mutex */ 53 struct list_head exit_list; /* Use only net_mutex */
@@ -52,7 +59,8 @@ struct net {
52 struct ctl_table_set sysctls; 59 struct ctl_table_set sysctls;
53#endif 60#endif
54 61
55 struct net_device *loopback_dev; /* The loopback */ 62 struct sock *rtnl; /* rtnetlink socket */
63 struct sock *genl_sock;
56 64
57 struct list_head dev_base_head; 65 struct list_head dev_base_head;
58 struct hlist_head *dev_name_head; 66 struct hlist_head *dev_name_head;
@@ -60,11 +68,9 @@ struct net {
60 68
61 /* core fib_rules */ 69 /* core fib_rules */
62 struct list_head rules_ops; 70 struct list_head rules_ops;
63 spinlock_t rules_mod_lock;
64 71
65 struct sock *rtnl; /* rtnetlink socket */
66 struct sock *genl_sock;
67 72
73 struct net_device *loopback_dev; /* The loopback */
68 struct netns_core core; 74 struct netns_core core;
69 struct netns_mib mib; 75 struct netns_mib mib;
70 struct netns_packet packet; 76 struct netns_packet packet;
@@ -84,13 +90,16 @@ struct net {
84 struct sock *nfnl; 90 struct sock *nfnl;
85 struct sock *nfnl_stash; 91 struct sock *nfnl_stash;
86#endif 92#endif
87#ifdef CONFIG_XFRM
88 struct netns_xfrm xfrm;
89#endif
90#ifdef CONFIG_WEXT_CORE 93#ifdef CONFIG_WEXT_CORE
91 struct sk_buff_head wext_nlevents; 94 struct sk_buff_head wext_nlevents;
92#endif 95#endif
93 struct net_generic *gen; 96 struct net_generic __rcu *gen;
97
98 /* Note : following structs are cache line aligned */
99#ifdef CONFIG_XFRM
100 struct netns_xfrm xfrm;
101#endif
102 struct netns_ipvs *ipvs;
94}; 103};
95 104
96 105
@@ -114,6 +123,7 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
114extern struct list_head net_namespace_list; 123extern struct list_head net_namespace_list;
115 124
116extern struct net *get_net_ns_by_pid(pid_t pid); 125extern struct net *get_net_ns_by_pid(pid_t pid);
126extern struct net *get_net_ns_by_fd(int pid);
117 127
118#ifdef CONFIG_NET_NS 128#ifdef CONFIG_NET_NS
119extern void __put_net(struct net *net); 129extern void __put_net(struct net *net);
@@ -147,6 +157,9 @@ int net_eq(const struct net *net1, const struct net *net2)
147{ 157{
148 return net1 == net2; 158 return net1 == net2;
149} 159}
160
161extern void net_drop_ns(void *);
162
150#else 163#else
151 164
152static inline struct net *get_net(struct net *net) 165static inline struct net *get_net(struct net *net)
@@ -168,6 +181,8 @@ int net_eq(const struct net *net1, const struct net *net2)
168{ 181{
169 return 1; 182 return 1;
170} 183}
184
185#define net_drop_ns NULL
171#endif 186#endif
172 187
173 188