diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-08-28 21:34:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 20:40:31 -0400 |
commit | 86393e52c3f1e2f6be18383f6ecdbcdc5727d545 (patch) | |
tree | f5c688c0cb5292143478249f807c4b2372f69dfd /include/net | |
parent | 885a136c52a8871175477baf3903e1c38751b35a (diff) |
netns: embed ip6_dst_ops directly
struct net::ipv6.ip6_dst_ops is separatedly dynamically allocated,
but there is no fundamental reason for it. Embed it directly into
struct netns_ipv6.
For that:
* move struct dst_ops into separate header to fix circular dependencies
I honestly tried not to, it's pretty impossible to do other way
* drop dynamical allocation, allocate together with netns
For a change, remove struct dst_ops::dst_net, it's deducible
by using container_of() given dst_ops pointer.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/dst.h | 23 | ||||
-rw-r--r-- | include/net/dst_ops.h | 28 | ||||
-rw-r--r-- | include/net/netns/ipv6.h | 3 |
3 files changed, 31 insertions, 23 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 7fc409c19b37..5a900ddcf10d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef _NET_DST_H | 8 | #ifndef _NET_DST_H |
9 | #define _NET_DST_H | 9 | #define _NET_DST_H |
10 | 10 | ||
11 | #include <net/dst_ops.h> | ||
11 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
12 | #include <linux/rtnetlink.h> | 13 | #include <linux/rtnetlink.h> |
13 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
@@ -102,28 +103,6 @@ struct dst_entry | |||
102 | }; | 103 | }; |
103 | }; | 104 | }; |
104 | 105 | ||
105 | |||
106 | struct dst_ops | ||
107 | { | ||
108 | unsigned short family; | ||
109 | __be16 protocol; | ||
110 | unsigned gc_thresh; | ||
111 | |||
112 | int (*gc)(struct dst_ops *ops); | ||
113 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | ||
114 | void (*destroy)(struct dst_entry *); | ||
115 | void (*ifdown)(struct dst_entry *, | ||
116 | struct net_device *dev, int how); | ||
117 | struct dst_entry * (*negative_advice)(struct dst_entry *); | ||
118 | void (*link_failure)(struct sk_buff *); | ||
119 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | ||
120 | int (*local_out)(struct sk_buff *skb); | ||
121 | |||
122 | atomic_t entries; | ||
123 | struct kmem_cache *kmem_cachep; | ||
124 | struct net *dst_net; | ||
125 | }; | ||
126 | |||
127 | #ifdef __KERNEL__ | 106 | #ifdef __KERNEL__ |
128 | 107 | ||
129 | static inline u32 | 108 | static inline u32 |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h new file mode 100644 index 000000000000..d1ff9b7e99b8 --- /dev/null +++ b/include/net/dst_ops.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _NET_DST_OPS_H | ||
2 | #define _NET_DST_OPS_H | ||
3 | #include <linux/types.h> | ||
4 | |||
5 | struct dst_entry; | ||
6 | struct kmem_cachep; | ||
7 | struct net_device; | ||
8 | struct sk_buff; | ||
9 | |||
10 | struct dst_ops { | ||
11 | unsigned short family; | ||
12 | __be16 protocol; | ||
13 | unsigned gc_thresh; | ||
14 | |||
15 | int (*gc)(struct dst_ops *ops); | ||
16 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | ||
17 | void (*destroy)(struct dst_entry *); | ||
18 | void (*ifdown)(struct dst_entry *, | ||
19 | struct net_device *dev, int how); | ||
20 | struct dst_entry * (*negative_advice)(struct dst_entry *); | ||
21 | void (*link_failure)(struct sk_buff *); | ||
22 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | ||
23 | int (*local_out)(struct sk_buff *skb); | ||
24 | |||
25 | atomic_t entries; | ||
26 | struct kmem_cache *kmem_cachep; | ||
27 | }; | ||
28 | #endif | ||
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index afab4e4cbac7..dfeb2d7c425b 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #ifndef __NETNS_IPV6_H__ | 7 | #ifndef __NETNS_IPV6_H__ |
8 | #define __NETNS_IPV6_H__ | 8 | #define __NETNS_IPV6_H__ |
9 | #include <net/dst_ops.h> | ||
9 | 10 | ||
10 | struct ctl_table_header; | 11 | struct ctl_table_header; |
11 | 12 | ||
@@ -42,7 +43,7 @@ struct netns_ipv6 { | |||
42 | struct timer_list ip6_fib_timer; | 43 | struct timer_list ip6_fib_timer; |
43 | struct hlist_head *fib_table_hash; | 44 | struct hlist_head *fib_table_hash; |
44 | struct fib6_table *fib6_main_tbl; | 45 | struct fib6_table *fib6_main_tbl; |
45 | struct dst_ops *ip6_dst_ops; | 46 | struct dst_ops ip6_dst_ops; |
46 | unsigned int ip6_rt_gc_expire; | 47 | unsigned int ip6_rt_gc_expire; |
47 | unsigned long ip6_rt_last_gc; | 48 | unsigned long ip6_rt_last_gc; |
48 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 49 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |