summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-03-31 15:58:50 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-31 23:25:39 -0400
commit6befe4a78b1553edb6eed3a78b4bcd9748526672 (patch)
treef53d1046d1145435a58c2d7d576e08d04250f849
parent648700f76b03b7e8149d13cc2bdb3355035258a9 (diff)
inet: frags: remove some helpers
Remove sum_frag_mem_limit(), ip_frag_mem() & ip6_frag_mem() Also since we use rhashtable we can bring back the number of fragments in "grep FRAG /proc/net/sockstat /proc/net/sockstat6" that was removed in commit 434d305405ab ("inet: frag: don't account number of fragment queues") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_frag.h5
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ipv6.h7
-rw-r--r--net/ipv4/ip_fragment.c5
-rw-r--r--net/ipv4/proc.c6
-rw-r--r--net/ipv6/proc.c5
6 files changed, 6 insertions, 23 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 3fec0d3a0d01..4b5449df0aad 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -141,11 +141,6 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
141 atomic_add(i, &nf->mem); 141 atomic_add(i, &nf->mem);
142} 142}
143 143
144static inline int sum_frag_mem_limit(struct netns_frags *nf)
145{
146 return atomic_read(&nf->mem);
147}
148
149/* RFC 3168 support : 144/* RFC 3168 support :
150 * We want to check ECN values of all fragments, do detect invalid combinations. 145 * We want to check ECN values of all fragments, do detect invalid combinations.
151 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. 146 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
diff --git a/include/net/ip.h b/include/net/ip.h
index 36f8f7811093..ecffd843e7b8 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -588,7 +588,6 @@ static inline struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *s
588 return skb; 588 return skb;
589} 589}
590#endif 590#endif
591int ip_frag_mem(struct net *net);
592 591
593/* 592/*
594 * Functions provided by ip_forward.c 593 * Functions provided by ip_forward.c
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6fa9a2bc5896..37455e840347 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -379,13 +379,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
379 idev->cnf.accept_ra; 379 idev->cnf.accept_ra;
380} 380}
381 381
382#if IS_ENABLED(CONFIG_IPV6)
383static inline int ip6_frag_mem(struct net *net)
384{
385 return sum_frag_mem_limit(&net->ipv6.frags);
386}
387#endif
388
389#define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */ 382#define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */
390#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ 383#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
391#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 384#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 4021820db6f2..44f4fa306e22 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -83,11 +83,6 @@ static u8 ip4_frag_ecn(u8 tos)
83 83
84static struct inet_frags ip4_frags; 84static struct inet_frags ip4_frags;
85 85
86int ip_frag_mem(struct net *net)
87{
88 return sum_frag_mem_limit(&net->ipv4.frags);
89}
90
91static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, 86static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
92 struct net_device *dev); 87 struct net_device *dev);
93 88
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index adfb75340275..aacfce0d7d82 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -54,7 +54,6 @@
54static int sockstat_seq_show(struct seq_file *seq, void *v) 54static int sockstat_seq_show(struct seq_file *seq, void *v)
55{ 55{
56 struct net *net = seq->private; 56 struct net *net = seq->private;
57 unsigned int frag_mem;
58 int orphans, sockets; 57 int orphans, sockets;
59 58
60 orphans = percpu_counter_sum_positive(&tcp_orphan_count); 59 orphans = percpu_counter_sum_positive(&tcp_orphan_count);
@@ -72,8 +71,9 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
72 sock_prot_inuse_get(net, &udplite_prot)); 71 sock_prot_inuse_get(net, &udplite_prot));
73 seq_printf(seq, "RAW: inuse %d\n", 72 seq_printf(seq, "RAW: inuse %d\n",
74 sock_prot_inuse_get(net, &raw_prot)); 73 sock_prot_inuse_get(net, &raw_prot));
75 frag_mem = ip_frag_mem(net); 74 seq_printf(seq, "FRAG: inuse %u memory %u\n",
76 seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem); 75 atomic_read(&net->ipv4.frags.rhashtable.nelems),
76 frag_mem_limit(&net->ipv4.frags));
77 return 0; 77 return 0;
78} 78}
79 79
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 6e57028d2e91..8befeb91e071 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -38,7 +38,6 @@
38static int sockstat6_seq_show(struct seq_file *seq, void *v) 38static int sockstat6_seq_show(struct seq_file *seq, void *v)
39{ 39{
40 struct net *net = seq->private; 40 struct net *net = seq->private;
41 unsigned int frag_mem = ip6_frag_mem(net);
42 41
43 seq_printf(seq, "TCP6: inuse %d\n", 42 seq_printf(seq, "TCP6: inuse %d\n",
44 sock_prot_inuse_get(net, &tcpv6_prot)); 43 sock_prot_inuse_get(net, &tcpv6_prot));
@@ -48,7 +47,9 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
48 sock_prot_inuse_get(net, &udplitev6_prot)); 47 sock_prot_inuse_get(net, &udplitev6_prot));
49 seq_printf(seq, "RAW6: inuse %d\n", 48 seq_printf(seq, "RAW6: inuse %d\n",
50 sock_prot_inuse_get(net, &rawv6_prot)); 49 sock_prot_inuse_get(net, &rawv6_prot));
51 seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem); 50 seq_printf(seq, "FRAG6: inuse %u memory %u\n",
51 atomic_read(&net->ipv6.frags.rhashtable.nelems),
52 frag_mem_limit(&net->ipv6.frags));
52 return 0; 53 return 0;
53} 54}
54 55