diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-22 09:06:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:10:35 -0500 |
commit | e5a2bb842cd9681d00d4ca963e63e4d3647e66f8 (patch) | |
tree | b47692f3312039cb944f68f6fbeb0d10442f8056 | |
parent | ac18e7509e7df327e30d6e073a787d922eaf211d (diff) |
[NETNS][FRAGS]: Make the nqueues counter per-namespace.
This is simple - just move the variable from struct inet_frags
to struct netns_frags and adjust the usage appropriately.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/inet_frag.h | 4 | ||||
-rw-r--r-- | include/net/ip.h | 2 | ||||
-rw-r--r-- | include/net/ipv6.h | 2 | ||||
-rw-r--r-- | net/ipv4/inet_fragment.c | 11 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 6 | ||||
-rw-r--r-- | net/ipv4/proc.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_reasm.c | 1 | ||||
-rw-r--r-- | net/ipv6/proc.c | 2 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 6 |
9 files changed, 24 insertions, 12 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 8ab6df64a12a..d36f3a6e6d4e 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_FRAG_H__ | 2 | #define __NET_FRAG_H__ |
3 | 3 | ||
4 | struct netns_frags { | 4 | struct netns_frags { |
5 | int nqueues; | ||
5 | }; | 6 | }; |
6 | 7 | ||
7 | struct inet_frag_queue { | 8 | struct inet_frag_queue { |
@@ -36,7 +37,6 @@ struct inet_frags { | |||
36 | struct hlist_head hash[INETFRAGS_HASHSZ]; | 37 | struct hlist_head hash[INETFRAGS_HASHSZ]; |
37 | rwlock_t lock; | 38 | rwlock_t lock; |
38 | u32 rnd; | 39 | u32 rnd; |
39 | int nqueues; | ||
40 | int qsize; | 40 | int qsize; |
41 | atomic_t mem; | 41 | atomic_t mem; |
42 | struct timer_list secret_timer; | 42 | struct timer_list secret_timer; |
@@ -55,6 +55,8 @@ struct inet_frags { | |||
55 | void inet_frags_init(struct inet_frags *); | 55 | void inet_frags_init(struct inet_frags *); |
56 | void inet_frags_fini(struct inet_frags *); | 56 | void inet_frags_fini(struct inet_frags *); |
57 | 57 | ||
58 | void inet_frags_init_net(struct netns_frags *nf); | ||
59 | |||
58 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); | 60 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); |
59 | void inet_frag_destroy(struct inet_frag_queue *q, | 61 | void inet_frag_destroy(struct inet_frag_queue *q, |
60 | struct inet_frags *f, int *work); | 62 | struct inet_frags *f, int *work); |
diff --git a/include/net/ip.h b/include/net/ip.h index 9d43ac222d15..fbe28308bf73 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -332,7 +332,7 @@ enum ip_defrag_users | |||
332 | 332 | ||
333 | int ip_defrag(struct sk_buff *skb, u32 user); | 333 | int ip_defrag(struct sk_buff *skb, u32 user); |
334 | int ip_frag_mem(void); | 334 | int ip_frag_mem(void); |
335 | int ip_frag_nqueues(void); | 335 | int ip_frag_nqueues(struct net *net); |
336 | 336 | ||
337 | /* | 337 | /* |
338 | * Functions provided by ip_forward.c | 338 | * Functions provided by ip_forward.c |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 87ca1bf17d71..da1c089680d8 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -245,7 +245,7 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | |||
245 | 245 | ||
246 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | 246 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); |
247 | 247 | ||
248 | int ip6_frag_nqueues(void); | 248 | int ip6_frag_nqueues(struct net *net); |
249 | int ip6_frag_mem(void); | 249 | int ip6_frag_mem(void); |
250 | 250 | ||
251 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ | 251 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 158c5f60d023..4fec0b911f85 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -63,7 +63,6 @@ void inet_frags_init(struct inet_frags *f) | |||
63 | f->rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^ | 63 | f->rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^ |
64 | (jiffies ^ (jiffies >> 6))); | 64 | (jiffies ^ (jiffies >> 6))); |
65 | 65 | ||
66 | f->nqueues = 0; | ||
67 | atomic_set(&f->mem, 0); | 66 | atomic_set(&f->mem, 0); |
68 | 67 | ||
69 | setup_timer(&f->secret_timer, inet_frag_secret_rebuild, | 68 | setup_timer(&f->secret_timer, inet_frag_secret_rebuild, |
@@ -73,6 +72,12 @@ void inet_frags_init(struct inet_frags *f) | |||
73 | } | 72 | } |
74 | EXPORT_SYMBOL(inet_frags_init); | 73 | EXPORT_SYMBOL(inet_frags_init); |
75 | 74 | ||
75 | void inet_frags_init_net(struct netns_frags *nf) | ||
76 | { | ||
77 | nf->nqueues = 0; | ||
78 | } | ||
79 | EXPORT_SYMBOL(inet_frags_init_net); | ||
80 | |||
76 | void inet_frags_fini(struct inet_frags *f) | 81 | void inet_frags_fini(struct inet_frags *f) |
77 | { | 82 | { |
78 | del_timer(&f->secret_timer); | 83 | del_timer(&f->secret_timer); |
@@ -84,7 +89,7 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) | |||
84 | write_lock(&f->lock); | 89 | write_lock(&f->lock); |
85 | hlist_del(&fq->list); | 90 | hlist_del(&fq->list); |
86 | list_del(&fq->lru_list); | 91 | list_del(&fq->lru_list); |
87 | f->nqueues--; | 92 | fq->net->nqueues--; |
88 | write_unlock(&f->lock); | 93 | write_unlock(&f->lock); |
89 | } | 94 | } |
90 | 95 | ||
@@ -206,7 +211,7 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, | |||
206 | atomic_inc(&qp->refcnt); | 211 | atomic_inc(&qp->refcnt); |
207 | hlist_add_head(&qp->list, &f->hash[hash]); | 212 | hlist_add_head(&qp->list, &f->hash[hash]); |
208 | list_add_tail(&qp->lru_list, &f->lru_list); | 213 | list_add_tail(&qp->lru_list, &f->lru_list); |
209 | f->nqueues++; | 214 | nf->nqueues++; |
210 | write_unlock(&f->lock); | 215 | write_unlock(&f->lock); |
211 | return qp; | 216 | return qp; |
212 | } | 217 | } |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 56211ef46eed..cd8c83025b48 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -95,9 +95,9 @@ static struct inet_frags_ctl ip4_frags_ctl __read_mostly = { | |||
95 | 95 | ||
96 | static struct inet_frags ip4_frags; | 96 | static struct inet_frags ip4_frags; |
97 | 97 | ||
98 | int ip_frag_nqueues(void) | 98 | int ip_frag_nqueues(struct net *net) |
99 | { | 99 | { |
100 | return ip4_frags.nqueues; | 100 | return net->ipv4.frags.nqueues; |
101 | } | 101 | } |
102 | 102 | ||
103 | int ip_frag_mem(void) | 103 | int ip_frag_mem(void) |
@@ -675,6 +675,8 @@ static inline int ip4_frags_ctl_register(struct net *net) | |||
675 | 675 | ||
676 | static int ipv4_frags_init_net(struct net *net) | 676 | static int ipv4_frags_init_net(struct net *net) |
677 | { | 677 | { |
678 | inet_frags_init_net(&net->ipv4.frags); | ||
679 | |||
678 | return ip4_frags_ctl_register(net); | 680 | return ip4_frags_ctl_register(net); |
679 | } | 681 | } |
680 | 682 | ||
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index cb3787fbeb90..bae32808616e 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -62,7 +62,7 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) | |||
62 | seq_printf(seq, "UDPLITE: inuse %d\n", sock_prot_inuse_get(&udplite_prot)); | 62 | seq_printf(seq, "UDPLITE: inuse %d\n", sock_prot_inuse_get(&udplite_prot)); |
63 | seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse_get(&raw_prot)); | 63 | seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse_get(&raw_prot)); |
64 | seq_printf(seq, "FRAG: inuse %d memory %d\n", | 64 | seq_printf(seq, "FRAG: inuse %d memory %d\n", |
65 | ip_frag_nqueues(), ip_frag_mem()); | 65 | ip_frag_nqueues(&init_net), ip_frag_mem()); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 18accd4eab06..0b9d0097b68d 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -712,6 +712,7 @@ int nf_ct_frag6_init(void) | |||
712 | nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); | 712 | nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); |
713 | nf_frags.match = ip6_frag_match; | 713 | nf_frags.match = ip6_frag_match; |
714 | nf_frags.frag_expire = nf_ct_frag6_expire; | 714 | nf_frags.frag_expire = nf_ct_frag6_expire; |
715 | inet_frags_init_net(&nf_init_frags); | ||
715 | inet_frags_init(&nf_frags); | 716 | inet_frags_init(&nf_frags); |
716 | 717 | ||
717 | return 0; | 718 | return 0; |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 571d95a21c15..dec34c87cb4a 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -44,7 +44,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) | |||
44 | seq_printf(seq, "RAW6: inuse %d\n", | 44 | seq_printf(seq, "RAW6: inuse %d\n", |
45 | sock_prot_inuse_get(&rawv6_prot)); | 45 | sock_prot_inuse_get(&rawv6_prot)); |
46 | seq_printf(seq, "FRAG6: inuse %d memory %d\n", | 46 | seq_printf(seq, "FRAG6: inuse %d memory %d\n", |
47 | ip6_frag_nqueues(), ip6_frag_mem()); | 47 | ip6_frag_nqueues(&init_net), ip6_frag_mem()); |
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index ab2d53b81b70..77a874020f3a 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -84,9 +84,9 @@ struct frag_queue | |||
84 | 84 | ||
85 | static struct inet_frags ip6_frags; | 85 | static struct inet_frags ip6_frags; |
86 | 86 | ||
87 | int ip6_frag_nqueues(void) | 87 | int ip6_frag_nqueues(struct net *net) |
88 | { | 88 | { |
89 | return ip6_frags.nqueues; | 89 | return net->ipv6.frags.nqueues; |
90 | } | 90 | } |
91 | 91 | ||
92 | int ip6_frag_mem(void) | 92 | int ip6_frag_mem(void) |
@@ -690,6 +690,8 @@ static int ipv6_frags_init_net(struct net *net) | |||
690 | net->ipv6.sysctl.frags.timeout = IPV6_FRAG_TIMEOUT; | 690 | net->ipv6.sysctl.frags.timeout = IPV6_FRAG_TIMEOUT; |
691 | net->ipv6.sysctl.frags.secret_interval = 10 * 60 * HZ; | 691 | net->ipv6.sysctl.frags.secret_interval = 10 * 60 * HZ; |
692 | 692 | ||
693 | inet_frags_init_net(&net->ipv6.frags); | ||
694 | |||
693 | return ip6_frags_sysctl_register(net); | 695 | return ip6_frags_sysctl_register(net); |
694 | } | 696 | } |
695 | 697 | ||