From 86393e52c3f1e2f6be18383f6ecdbcdc5727d545 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Sat, 29 Aug 2009 01:34:49 +0000 Subject: 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 Signed-off-by: David S. Miller --- include/net/dst.h | 23 +---------------------- include/net/dst_ops.h | 28 ++++++++++++++++++++++++++++ include/net/netns/ipv6.h | 3 ++- 3 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 include/net/dst_ops.h (limited to 'include/net') diff --git a/include/net/dst.h b/include/net/dst.h index 7fc409c19b3..5a900ddcf10 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -8,6 +8,7 @@ #ifndef _NET_DST_H #define _NET_DST_H +#include #include #include #include @@ -102,28 +103,6 @@ struct dst_entry }; }; - -struct dst_ops -{ - unsigned short family; - __be16 protocol; - unsigned gc_thresh; - - int (*gc)(struct dst_ops *ops); - struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); - void (*destroy)(struct dst_entry *); - void (*ifdown)(struct dst_entry *, - struct net_device *dev, int how); - struct dst_entry * (*negative_advice)(struct dst_entry *); - void (*link_failure)(struct sk_buff *); - void (*update_pmtu)(struct dst_entry *dst, u32 mtu); - int (*local_out)(struct sk_buff *skb); - - atomic_t entries; - struct kmem_cache *kmem_cachep; - struct net *dst_net; -}; - #ifdef __KERNEL__ static inline u32 diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h new file mode 100644 index 00000000000..d1ff9b7e99b --- /dev/null +++ b/include/net/dst_ops.h @@ -0,0 +1,28 @@ +#ifndef _NET_DST_OPS_H +#define _NET_DST_OPS_H +#include + +struct dst_entry; +struct kmem_cachep; +struct net_device; +struct sk_buff; + +struct dst_ops { + unsigned short family; + __be16 protocol; + unsigned gc_thresh; + + int (*gc)(struct dst_ops *ops); + struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); + void (*destroy)(struct dst_entry *); + void (*ifdown)(struct dst_entry *, + struct net_device *dev, int how); + struct dst_entry * (*negative_advice)(struct dst_entry *); + void (*link_failure)(struct sk_buff *); + void (*update_pmtu)(struct dst_entry *dst, u32 mtu); + int (*local_out)(struct sk_buff *skb); + + atomic_t entries; + struct kmem_cache *kmem_cachep; +}; +#endif diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index afab4e4cbac..dfeb2d7c425 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -6,6 +6,7 @@ #ifndef __NETNS_IPV6_H__ #define __NETNS_IPV6_H__ +#include struct ctl_table_header; @@ -42,7 +43,7 @@ struct netns_ipv6 { struct timer_list ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; - struct dst_ops *ip6_dst_ops; + struct dst_ops ip6_dst_ops; unsigned int ip6_rt_gc_expire; unsigned long ip6_rt_last_gc; #ifdef CONFIG_IPV6_MULTIPLE_TABLES -- cgit v1.2.3