aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/reassembly.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-15 05:33:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-15 15:26:40 -0400
commit04128f233f2b344f3438cde09723e9946463a573 (patch)
tree04f4518ef51c74de4d318d7ea908b3215a6aa9c8 /net/ipv6/reassembly.c
parent7eb95156d9dce2f59794264db336ce007d71638b (diff)
[INET]: Collect common frag sysctl variables together
Some sysctl variables are used to tune the frag queues management and it will be useful to work with them in a common way in the future, so move them into one structure, moreover they are the same for all the frag management codes. I don't place them in the existing inet_frags object, introduced in the previous patch for two reasons: 1. to keep them in the __read_mostly section; 2. not to export the whole inet_frags objects outside. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r--net/ipv6/reassembly.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index ecf340047cde..ced1a5f5b776 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -56,11 +56,6 @@
56#include <net/addrconf.h> 56#include <net/addrconf.h>
57#include <net/inet_frag.h> 57#include <net/inet_frag.h>
58 58
59int sysctl_ip6frag_high_thresh __read_mostly = 256*1024;
60int sysctl_ip6frag_low_thresh __read_mostly = 192*1024;
61
62int sysctl_ip6frag_time __read_mostly = IPV6_FRAG_TIMEOUT;
63
64struct ip6frag_skb_cb 59struct ip6frag_skb_cb
65{ 60{
66 struct inet6_skb_parm h; 61 struct inet6_skb_parm h;
@@ -87,6 +82,13 @@ struct frag_queue
87 __u16 nhoffset; 82 __u16 nhoffset;
88}; 83};
89 84
85struct inet_frags_ctl ip6_frags_ctl __read_mostly = {
86 .high_thresh = 256 * 1024,
87 .low_thresh = 192 * 1024,
88 .timeout = IPV6_FRAG_TIMEOUT,
89 .secret_interval = 10 * 60 * HZ,
90};
91
90static struct inet_frags ip6_frags; 92static struct inet_frags ip6_frags;
91 93
92int ip6_frag_nqueues(void) 94int ip6_frag_nqueues(void)
@@ -147,8 +149,6 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
147 return c & (INETFRAGS_HASHSZ - 1); 149 return c & (INETFRAGS_HASHSZ - 1);
148} 150}
149 151
150int sysctl_ip6frag_secret_interval __read_mostly = 10 * 60 * HZ;
151
152static void ip6_frag_secret_rebuild(unsigned long dummy) 152static void ip6_frag_secret_rebuild(unsigned long dummy)
153{ 153{
154 unsigned long now = jiffies; 154 unsigned long now = jiffies;
@@ -177,7 +177,7 @@ static void ip6_frag_secret_rebuild(unsigned long dummy)
177 } 177 }
178 write_unlock(&ip6_frags.lock); 178 write_unlock(&ip6_frags.lock);
179 179
180 mod_timer(&ip6_frags.secret_timer, now + sysctl_ip6frag_secret_interval); 180 mod_timer(&ip6_frags.secret_timer, now + ip6_frags_ctl.secret_interval);
181} 181}
182 182
183/* Memory Tracking Functions. */ 183/* Memory Tracking Functions. */
@@ -256,7 +256,7 @@ static void ip6_evictor(struct inet6_dev *idev)
256 struct list_head *tmp; 256 struct list_head *tmp;
257 int work; 257 int work;
258 258
259 work = atomic_read(&ip6_frags.mem) - sysctl_ip6frag_low_thresh; 259 work = atomic_read(&ip6_frags.mem) - ip6_frags_ctl.low_thresh;
260 if (work <= 0) 260 if (work <= 0)
261 return; 261 return;
262 262
@@ -348,7 +348,7 @@ static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
348#endif 348#endif
349 fq = fq_in; 349 fq = fq_in;
350 350
351 if (!mod_timer(&fq->q.timer, jiffies + sysctl_ip6frag_time)) 351 if (!mod_timer(&fq->q.timer, jiffies + ip6_frags_ctl.timeout))
352 atomic_inc(&fq->q.refcnt); 352 atomic_inc(&fq->q.refcnt);
353 353
354 atomic_inc(&fq->q.refcnt); 354 atomic_inc(&fq->q.refcnt);
@@ -754,7 +754,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
754 return 1; 754 return 1;
755 } 755 }
756 756
757 if (atomic_read(&ip6_frags.mem) > sysctl_ip6frag_high_thresh) 757 if (atomic_read(&ip6_frags.mem) > ip6_frags_ctl.high_thresh)
758 ip6_evictor(ip6_dst_idev(skb->dst)); 758 ip6_evictor(ip6_dst_idev(skb->dst));
759 759
760 if ((fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr, 760 if ((fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr,
@@ -788,8 +788,9 @@ void __init ipv6_frag_init(void)
788 788
789 init_timer(&ip6_frags.secret_timer); 789 init_timer(&ip6_frags.secret_timer);
790 ip6_frags.secret_timer.function = ip6_frag_secret_rebuild; 790 ip6_frags.secret_timer.function = ip6_frag_secret_rebuild;
791 ip6_frags.secret_timer.expires = jiffies + sysctl_ip6frag_secret_interval; 791 ip6_frags.secret_timer.expires = jiffies + ip6_frags_ctl.secret_interval;
792 add_timer(&ip6_frags.secret_timer); 792 add_timer(&ip6_frags.secret_timer);
793 793
794 ip6_frags.ctl = &ip6_frags_ctl;
794 inet_frags_init(&ip6_frags); 795 inet_frags_init(&ip6_frags);
795} 796}