aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2014-07-24 10:50:33 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-28 01:34:36 -0400
commit434d305405ab86414f6ea3f261307d443a2c3506 (patch)
tree4637301f47599b6a4bac0c63d3d5df8cebc57f89
parentb13d3cbfb8e8a8f53930af67d1ebf05149f32c24 (diff)
inet: frag: don't account number of fragment queues
The 'nqueues' counter is protected by the lru list lock, once thats removed this needs to be converted to atomic counter. Given this isn't used for anything except for reporting it to userspace via /proc, just remove it. We still report the memory currently used by fragment reassembly queues. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ipv6.h5
-rw-r--r--net/ipv4/inet_fragment.c1
-rw-r--r--net/ipv4/ip_fragment.c5
-rw-r--r--net/ipv4/proc.c5
-rw-r--r--net/ipv6/proc.c4
7 files changed, 5 insertions, 19 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e975032ea11b..68de33765705 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -4,7 +4,6 @@
4#include <linux/percpu_counter.h> 4#include <linux/percpu_counter.h>
5 5
6struct netns_frags { 6struct netns_frags {
7 int nqueues;
8 struct list_head lru_list; 7 struct list_head lru_list;
9 spinlock_t lru_lock; 8 spinlock_t lru_lock;
10 9
@@ -158,7 +157,6 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
158{ 157{
159 spin_lock(&q->net->lru_lock); 158 spin_lock(&q->net->lru_lock);
160 list_del_init(&q->lru_list); 159 list_del_init(&q->lru_list);
161 q->net->nqueues--;
162 spin_unlock(&q->net->lru_lock); 160 spin_unlock(&q->net->lru_lock);
163} 161}
164 162
@@ -167,7 +165,6 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
167{ 165{
168 spin_lock(&nf->lru_lock); 166 spin_lock(&nf->lru_lock);
169 list_add_tail(&q->lru_list, &nf->lru_list); 167 list_add_tail(&q->lru_list, &nf->lru_list);
170 q->net->nqueues++;
171 spin_unlock(&nf->lru_lock); 168 spin_unlock(&nf->lru_lock);
172} 169}
173 170
diff --git a/include/net/ip.h b/include/net/ip.h
index 2e8f055989c3..ca14799545fd 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -495,7 +495,6 @@ static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
495} 495}
496#endif 496#endif
497int ip_frag_mem(struct net *net); 497int ip_frag_mem(struct net *net);
498int ip_frag_nqueues(struct net *net);
499 498
500/* 499/*
501 * Functions provided by ip_forward.c 500 * Functions provided by ip_forward.c
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 25c2170e1298..a2db816e8461 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -299,11 +299,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
299} 299}
300 300
301#if IS_ENABLED(CONFIG_IPV6) 301#if IS_ENABLED(CONFIG_IPV6)
302static inline int ip6_frag_nqueues(struct net *net)
303{
304 return net->ipv6.frags.nqueues;
305}
306
307static inline int ip6_frag_mem(struct net *net) 302static inline int ip6_frag_mem(struct net *net)
308{ 303{
309 return sum_frag_mem_limit(&net->ipv6.frags); 304 return sum_frag_mem_limit(&net->ipv6.frags);
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 43315ecb9400..231ca0b40811 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -193,7 +193,6 @@ EXPORT_SYMBOL(inet_frags_init);
193 193
194void inet_frags_init_net(struct netns_frags *nf) 194void inet_frags_init_net(struct netns_frags *nf)
195{ 195{
196 nf->nqueues = 0;
197 init_frag_mem_limit(nf); 196 init_frag_mem_limit(nf);
198 INIT_LIST_HEAD(&nf->lru_list); 197 INIT_LIST_HEAD(&nf->lru_list);
199 spin_lock_init(&nf->lru_lock); 198 spin_lock_init(&nf->lru_lock);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 54bd170c5eb4..1f42c2e3966b 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -86,11 +86,6 @@ static inline u8 ip4_frag_ecn(u8 tos)
86 86
87static struct inet_frags ip4_frags; 87static struct inet_frags ip4_frags;
88 88
89int ip_frag_nqueues(struct net *net)
90{
91 return net->ipv4.frags.nqueues;
92}
93
94int ip_frag_mem(struct net *net) 89int ip_frag_mem(struct net *net)
95{ 90{
96 return sum_frag_mem_limit(&net->ipv4.frags); 91 return sum_frag_mem_limit(&net->ipv4.frags);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index ae0af9386f7c..8e3eb39f84e7 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -52,6 +52,7 @@
52static int sockstat_seq_show(struct seq_file *seq, void *v) 52static int sockstat_seq_show(struct seq_file *seq, void *v)
53{ 53{
54 struct net *net = seq->private; 54 struct net *net = seq->private;
55 unsigned int frag_mem;
55 int orphans, sockets; 56 int orphans, sockets;
56 57
57 local_bh_disable(); 58 local_bh_disable();
@@ -71,8 +72,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
71 sock_prot_inuse_get(net, &udplite_prot)); 72 sock_prot_inuse_get(net, &udplite_prot));
72 seq_printf(seq, "RAW: inuse %d\n", 73 seq_printf(seq, "RAW: inuse %d\n",
73 sock_prot_inuse_get(net, &raw_prot)); 74 sock_prot_inuse_get(net, &raw_prot));
74 seq_printf(seq, "FRAG: inuse %d memory %d\n", 75 frag_mem = ip_frag_mem(net);
75 ip_frag_nqueues(net), ip_frag_mem(net)); 76 seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem);
76 return 0; 77 return 0;
77} 78}
78 79
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 3317440ea341..2d6f860e5c1e 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -33,6 +33,7 @@
33static int sockstat6_seq_show(struct seq_file *seq, void *v) 33static int sockstat6_seq_show(struct seq_file *seq, void *v)
34{ 34{
35 struct net *net = seq->private; 35 struct net *net = seq->private;
36 unsigned int frag_mem = ip6_frag_mem(net);
36 37
37 seq_printf(seq, "TCP6: inuse %d\n", 38 seq_printf(seq, "TCP6: inuse %d\n",
38 sock_prot_inuse_get(net, &tcpv6_prot)); 39 sock_prot_inuse_get(net, &tcpv6_prot));
@@ -42,8 +43,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
42 sock_prot_inuse_get(net, &udplitev6_prot)); 43 sock_prot_inuse_get(net, &udplitev6_prot));
43 seq_printf(seq, "RAW6: inuse %d\n", 44 seq_printf(seq, "RAW6: inuse %d\n",
44 sock_prot_inuse_get(net, &rawv6_prot)); 45 sock_prot_inuse_get(net, &rawv6_prot));
45 seq_printf(seq, "FRAG6: inuse %d memory %d\n", 46 seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem);
46 ip6_frag_nqueues(net), ip6_frag_mem(net));
47 return 0; 47 return 0;
48} 48}
49 49