aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/reassembly.c
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2012-09-18 12:50:11 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-19 17:23:28 -0400
commit6b102865e7ba9ff1e3c49c32c7187bb427d91798 (patch)
tree21a7f917457ab79f40d5bd579e547a030b2f0610 /net/ipv6/reassembly.c
parentd4915c087f7c2457c580efc16fe0bfa1a576274d (diff)
ipv6: unify fragment thresh handling code
Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Michal Kubeček <mkubecek@suse.cz> Cc: David Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r--net/ipv6/reassembly.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index cf74f4e79356..da8a4e301b1b 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -131,15 +131,6 @@ void ip6_frag_init(struct inet_frag_queue *q, void *a)
131} 131}
132EXPORT_SYMBOL(ip6_frag_init); 132EXPORT_SYMBOL(ip6_frag_init);
133 133
134static void ip6_evictor(struct net *net, struct inet6_dev *idev)
135{
136 int evicted;
137
138 evicted = inet_frag_evictor(&net->ipv6.frags, &ip6_frags);
139 if (evicted)
140 IP6_ADD_STATS_BH(net, idev, IPSTATS_MIB_REASMFAILS, evicted);
141}
142
143void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, 134void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
144 struct inet_frags *frags) 135 struct inet_frags *frags)
145{ 136{
@@ -515,6 +506,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
515 struct frag_queue *fq; 506 struct frag_queue *fq;
516 const struct ipv6hdr *hdr = ipv6_hdr(skb); 507 const struct ipv6hdr *hdr = ipv6_hdr(skb);
517 struct net *net = dev_net(skb_dst(skb)->dev); 508 struct net *net = dev_net(skb_dst(skb)->dev);
509 int evicted;
518 510
519 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS); 511 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
520 512
@@ -539,8 +531,10 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
539 return 1; 531 return 1;
540 } 532 }
541 533
542 if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) 534 evicted = inet_frag_evictor(&net->ipv6.frags, &ip6_frags, false);
543 ip6_evictor(net, ip6_dst_idev(skb_dst(skb))); 535 if (evicted)
536 IP6_ADD_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
537 IPSTATS_MIB_REASMFAILS, evicted);
544 538
545 fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr); 539 fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr);
546 if (fq != NULL) { 540 if (fq != NULL) {